add:关联ts_user表查询+分页

This commit is contained in:
zj
2021-07-09 11:38:19 +08:00
parent 04792ee931
commit 2ee918e1d0
7 changed files with 30 additions and 13 deletions
@@ -72,20 +72,19 @@ public class SarStandProjectLibraryController extends BaseController<SarStandPro
@GetMapping("/queryProjectManager") @GetMapping("/queryProjectManager")
@ApiOperation("查询产品线项目经理") @ApiOperation("查询产品线项目经理")
public ResponseMessage queryProjectManager(){ public ResponseMessage queryProjectManager(@RequestParam(defaultValue = "1", value = "current")int current, @RequestParam(defaultValue = "10", value = "PageSize") int pageSize){
List<SarStandProjectLibrary> list1 = sarStandProjectLibraryService.queryProjectManager(); List<SarStandProjectLibrary> list1 = sarStandProjectLibraryService.queryProjectManager((current-1)*pageSize,pageSize);
// 创建一个新的list集合,用于存储去重后的元素 // 创建一个新的list集合,用于存储去重后的元素
List<productLineDto> listTemp = new ArrayList(); List<productLineDto> listTemp = new ArrayList();
for (SarStandProjectLibrary sarStandProjectLibrary:list1){ for (SarStandProjectLibrary sarStandProjectLibrary:list1){
productLineDto p = new productLineDto(); productLineDto p = new productLineDto();
p.setProductLine(sarStandProjectLibrary.getProductLine()); p.setProductLine(sarStandProjectLibrary.getProductLine());
p.setProjectManager(sarStandProjectLibrary.getProjectManager()); p.setUName(sarStandProjectLibrary.getUName());
List<SarStandProjectLibrary> list2 = sarStandProjectLibraryService.queryByProductLine(sarStandProjectLibrary.getProductLine()); List<SarStandProjectLibrary> list2 = sarStandProjectLibraryService.queryByProductLine(sarStandProjectLibrary.getProductLine());
p.setSarStandProjectLibraries(list2); p.setSarStandProjectLibraries(list2);
listTemp.add(p); listTemp.add(p);
} }
System.out.println(listTemp); System.out.println(listTemp);
return Result.success("200",listTemp); return Result.success("200",listTemp);
} }
@@ -3,6 +3,8 @@ package com.adc.da.slrs.sarStandProjectLibrary.dao;
import com.adc.da.slrs.sarStandProjectLibrary.entity.SarStandProjectLibrary; import com.adc.da.slrs.sarStandProjectLibrary.entity.SarStandProjectLibrary;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import java.util.List;
/** /**
* <p> * <p>
* Mapper 接口 * Mapper 接口
@@ -12,5 +14,6 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
* @since 2021-06-15 * @since 2021-06-15
*/ */
public interface SarStandProjectLibraryDao extends BaseMapper<SarStandProjectLibrary> { public interface SarStandProjectLibraryDao extends BaseMapper<SarStandProjectLibrary> {
List<SarStandProjectLibrary> queryProjectManager(int current, int pageSize);
} }
@@ -3,6 +3,7 @@ package com.adc.da.slrs.sarStandProjectLibrary.entity;
import com.adc.da.base.entity.BaseEntity; import com.adc.da.base.entity.BaseEntity;
import java.util.Date; import java.util.Date;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
@@ -63,7 +64,12 @@ public class SarStandProjectLibrary extends BaseEntity {
@ApiModelProperty(value = "产品线") @ApiModelProperty(value = "产品线")
private String productLine; private String productLine;
@ApiModelProperty(value = "项目经理")
private String projectManager; private String projectManager;
@ApiModelProperty(value = "项目经理名称")
@TableField(exist = false)
private String uName;
} }
@@ -7,7 +7,7 @@ import java.util.List;
@Data @Data
public class productLineDto { public class productLineDto {
private String projectManager; private String uName;
private String productLine; private String productLine;
@@ -11,6 +11,6 @@ public interface SarStandProjectLibraryService {
IPage<SarStandProjectLibrary> queryMaintenanceProject(int current, int pageSize, SarStandProjectLibraryDto sarDto); IPage<SarStandProjectLibrary> queryMaintenanceProject(int current, int pageSize, SarStandProjectLibraryDto sarDto);
IPage<SarStandProjectLibrary> queryNotMaintenanceProject(int current, int pageSize, SarStandProjectLibraryDto sarDto); IPage<SarStandProjectLibrary> queryNotMaintenanceProject(int current, int pageSize, SarStandProjectLibraryDto sarDto);
List<SarStandProjectLibrary> queryById(String id); List<SarStandProjectLibrary> queryById(String id);
List<SarStandProjectLibrary> queryProjectManager(); List<SarStandProjectLibrary> queryProjectManager(int current, int pageSize);
List<SarStandProjectLibrary> queryByProductLine(String productLine); List<SarStandProjectLibrary> queryByProductLine(String productLine);
} }
@@ -42,7 +42,7 @@ public class SarStandProjectLibraryServiceImpl extends ServiceImpl<SarStandProje
sar.setProjectStatus(sarDto.getProjectStatus()); sar.setProjectStatus(sarDto.getProjectStatus());
sar.setProjectGroup(sarDto.getProjectGroup()); sar.setProjectGroup(sarDto.getProjectGroup());
sar.setCurrentNode(sarDto.getCurrentNode()); sar.setCurrentNode(sarDto.getCurrentNode());
sar.setProjectLevel(sar.getProjectLevel()); sar.setProjectLevel(sarDto.getProjectLevel());
sar.setProjectManager(sarDto.getProjectManager()); sar.setProjectManager(sarDto.getProjectManager());
sar.setProductLine(sarDto.getProductLine()); sar.setProductLine(sarDto.getProductLine());
SimpleDateFormat formater = new SimpleDateFormat(); SimpleDateFormat formater = new SimpleDateFormat();
@@ -84,7 +84,7 @@ public class SarStandProjectLibraryServiceImpl extends ServiceImpl<SarStandProje
sar.setProjectStatus(sarDto.getProjectStatus()); sar.setProjectStatus(sarDto.getProjectStatus());
sar.setProjectGroup(sarDto.getProjectGroup()); sar.setProjectGroup(sarDto.getProjectGroup());
sar.setCurrentNode(sarDto.getCurrentNode()); sar.setCurrentNode(sarDto.getCurrentNode());
sar.setProjectLevel(sar.getProjectLevel()); sar.setProjectLevel(sarDto.getProjectLevel());
sar.setProjectManager(sarDto.getProjectManager()); sar.setProjectManager(sarDto.getProjectManager());
sar.setProductLine(sarDto.getProductLine()); sar.setProductLine(sarDto.getProductLine());
SimpleDateFormat formater = new SimpleDateFormat(); SimpleDateFormat formater = new SimpleDateFormat();
@@ -125,11 +125,11 @@ public class SarStandProjectLibraryServiceImpl extends ServiceImpl<SarStandProje
} }
@Override @Override
public List<SarStandProjectLibrary> queryProjectManager() { public List<SarStandProjectLibrary> queryProjectManager(int current, int pageSize) {
QueryWrapper<SarStandProjectLibrary> wrapper = new QueryWrapper<>(); // QueryWrapper<SarStandProjectLibrary> wrapper = new QueryWrapper<>();
wrapper.select("product_line","project_manager"); // wrapper.select("product_line","project_manager");
wrapper.groupBy("product_line"); // wrapper.groupBy("product_line");
List<SarStandProjectLibrary> list = sarStandProjectLibraryDao.selectList(wrapper); List<SarStandProjectLibrary> list = sarStandProjectLibraryDao.queryProjectManager(current,pageSize);
return list; return list;
} }
@@ -2,4 +2,13 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.adc.da.slrs.sarStandProjectLibrary.dao.SarStandProjectLibraryDao"> <mapper namespace="com.adc.da.slrs.sarStandProjectLibrary.dao.SarStandProjectLibraryDao">
<select id="queryProjectManager" resultType="com.adc.da.slrs.sarStandProjectLibrary.entity.SarStandProjectLibrary">
select s.product_line,t.UNAME as uName
from sar_stand_project_library s
INNER JOIN ts_user t
ON s.project_manager=t.USID
GROUP BY s.product_line
limit #{current},#{pageSize}
</select>
</mapper> </mapper>