Commit 9c0965db by 张晓

增加中心点列表页搜索条件

1 parent 10cfc34e
...@@ -8,12 +8,14 @@ import com.dituhui.pea.order.dto.EngineerBusinessDTO; ...@@ -8,12 +8,14 @@ import com.dituhui.pea.order.dto.EngineerBusinessDTO;
import com.dituhui.pea.order.entity.*; import com.dituhui.pea.order.entity.*;
import com.dituhui.pea.order.service.EngineerBusinessService; import com.dituhui.pea.order.service.EngineerBusinessService;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.BeanPropertyRowMapper; import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate; import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.core.RowMapper; import org.springframework.jdbc.core.RowMapper;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.stream.Collectors; import java.util.stream.Collectors;
...@@ -43,10 +45,25 @@ public class EngineerBusinessServiceImpl implements EngineerBusinessService { ...@@ -43,10 +45,25 @@ public class EngineerBusinessServiceImpl implements EngineerBusinessService {
public List<EngineerBusinessDTO.Engineer> getEngineerCenterList(EngineerBusinessDTO.Request engineerReq) { public List<EngineerBusinessDTO.Engineer> getEngineerCenterList(EngineerBusinessDTO.Request engineerReq) {
String sql = "select a.engineer_code , b.address, b.x, b.y from engineer_info a left join engineer_business b on a.engineer_code= b.engineer_code\n" + String sql = "select a.engineer_code , b.address, b.x, b.y from engineer_info a left join engineer_business b on a.engineer_code= b.engineer_code\n" +
" where a.group_id=?"; " where a.group_id=? ";
List<Object> params = new ArrayList<>();
params.add(engineerReq.getLevelValue());
if (StringUtils.isNotEmpty(engineerReq.getKind())) {
if ("fullJob".equals(engineerReq.getKind())) {
sql = sql + " and a.kind=1 ";
} else if ("partJob".equals(engineerReq.getKind())) {
sql = sql + " and a.kind=2 ";
}
}
if (StringUtils.isNotEmpty(engineerReq.getKey())) {
sql = sql + " and (a.engineer_code like ? or a.name like ? ) ";
params.add("%" + engineerReq.getKey() + "%");
params.add("%" + engineerReq.getKey() + "%");
}
// 创建一个新的BeanPropertyRowMapper对象 // 创建一个新的BeanPropertyRowMapper对象
RowMapper<EngineerBusinessEntity> rowMapper = new BeanPropertyRowMapper<>(EngineerBusinessEntity.class); RowMapper<EngineerBusinessEntity> rowMapper = new BeanPropertyRowMapper<>(EngineerBusinessEntity.class);
List<EngineerBusinessEntity> engineerEntiryList = this.jdbcTemplate.query(sql, rowMapper, engineerReq.getLevelValue()); List<EngineerBusinessEntity> engineerEntiryList = this.jdbcTemplate.query(sql, params.toArray(), rowMapper);
Map<String, String> codeNameMap = engineerInfoDao.findByGroupId(engineerReq.getLevelValue()).stream().collect(Collectors.toMap(EngineerInfoEntity::getEngineerCode, EngineerInfoEntity::getName)); Map<String, String> codeNameMap = engineerInfoDao.findByGroupId(engineerReq.getLevelValue()).stream().collect(Collectors.toMap(EngineerInfoEntity::getEngineerCode, EngineerInfoEntity::getName));
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!