|
@@ -0,0 +1,91 @@
|
|
|
+/*
|
|
|
+ * Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
|
|
|
+ *
|
|
|
+ * Redistribution and use in source and binary forms, with or without
|
|
|
+ * modification, are permitted provided that the following conditions are met:
|
|
|
+ *
|
|
|
+ * Redistributions of source code must retain the above copyright notice,
|
|
|
+ * this list of conditions and the following disclaimer.
|
|
|
+ * Redistributions in binary form must reproduce the above copyright
|
|
|
+ * notice, this list of conditions and the following disclaimer in the
|
|
|
+ * documentation and/or other materials provided with the distribution.
|
|
|
+ * Neither the name of the dreamlu.net developer nor the names of its
|
|
|
+ * contributors may be used to endorse or promote products derived from
|
|
|
+ * this software without specific prior written permission.
|
|
|
+ * Author: Chill 庄骞 (smallchill@163.com)
|
|
|
+ */
|
|
|
+package org.springblade.manager.service.impl;
|
|
|
+
|
|
|
+import org.springblade.manager.dto.ParameterElementDTO;
|
|
|
+import org.springblade.manager.entity.ContractInfo;
|
|
|
+import org.springblade.manager.entity.ParameterElement;
|
|
|
+import org.springblade.manager.entity.ProjectInfo;
|
|
|
+import org.springblade.manager.vo.ParameterElementVO;
|
|
|
+import org.springblade.manager.mapper.ParameterElementMapper;
|
|
|
+import org.springblade.manager.service.IParameterElementService;
|
|
|
+import org.springblade.core.mp.base.BaseServiceImpl;
|
|
|
+import org.springframework.jdbc.core.BeanPropertyRowMapper;
|
|
|
+import org.springframework.jdbc.core.JdbcTemplate;
|
|
|
+import org.springframework.stereotype.Service;
|
|
|
+import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
+
|
|
|
+import javax.annotation.Resource;
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
+/**
|
|
|
+ * 参数库元素表 服务实现类
|
|
|
+ *
|
|
|
+ * @author BladeX
|
|
|
+ * @since 2025-02-21
|
|
|
+ */
|
|
|
+@Service
|
|
|
+public class ParameterElementServiceImpl extends BaseServiceImpl<ParameterElementMapper, ParameterElement> implements IParameterElementService {
|
|
|
+
|
|
|
+ @Resource
|
|
|
+ private JdbcTemplate jdbcTemplate;
|
|
|
+ @Override
|
|
|
+ public IPage<ParameterElementVO> selectParameterElementPage(IPage<ParameterElementVO> page, ParameterElementVO parameterElement) {
|
|
|
+ return page.setRecords(baseMapper.selectParameterElementPage(page, parameterElement));
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public List<ParameterElementVO> getParameterElementList(ParameterElementDTO dto) {
|
|
|
+ StringBuilder SQL=new StringBuilder("SELECT a.*,b.name FROM m_parameter_element a left join blade_user b on a.create_user=b.id where a.parameter_id="+dto.getParameterId()+" and a.is_deleted=0 ");
|
|
|
+ if(dto.getProjectId()!=null){
|
|
|
+ SQL.append(" and a.project_id="+dto.getProjectId());
|
|
|
+ }
|
|
|
+ if(dto.getContractId()!=null&&!dto.getContractId().equals("")){
|
|
|
+ SQL.append(" and a.contract_id like '%"+dto.getContractId()+"%'");
|
|
|
+ }
|
|
|
+ if(dto.getElementName()!=null&&!dto.getElementName().equals("")){
|
|
|
+ SQL.append(" and a.element_name like '%"+dto.getElementName()+"%'");
|
|
|
+ }
|
|
|
+
|
|
|
+ List<ParameterElementVO> vos = jdbcTemplate.query(SQL.toString(), new BeanPropertyRowMapper<>(ParameterElementVO.class));
|
|
|
+ if(vos.size()>0){
|
|
|
+ for (ParameterElementVO vo : vos) {
|
|
|
+ if(vo.getProjectId()!=null&&!vo.getProjectId().equals("")){
|
|
|
+ String sql1="select project_name from m_project_info where id="+vo.getProjectId()+" and is_deleted=0";
|
|
|
+ List<ProjectInfo> query = jdbcTemplate.query(sql1, new BeanPropertyRowMapper<>(ProjectInfo.class));
|
|
|
+ vo.setProjectName(query.get(0).getProjectName());
|
|
|
+ }
|
|
|
+ if (vo.getContractId()!=null&&!vo.getContractId().equals("")) {
|
|
|
+ String contractIds =vo.getContractId();
|
|
|
+ String[] ids = contractIds.split(",");
|
|
|
+ String contractName="";
|
|
|
+ for (String id : ids) {
|
|
|
+ String sql2="select contract_name from m_contract_info where id="+id+" and is_deleted=0";
|
|
|
+ List<ContractInfo> query1 = jdbcTemplate.query(sql2, new BeanPropertyRowMapper<>(ContractInfo.class));
|
|
|
+ contractName=contractName+","+query1.get(0).getContractName();
|
|
|
+ }
|
|
|
+ if (contractName.startsWith(",")) {
|
|
|
+ contractName = contractName.substring(1);
|
|
|
+ }
|
|
|
+ vo.setContractName(contractName);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return vos;
|
|
|
+ }
|
|
|
+
|
|
|
+}
|