add:关联ts_user表查询+分页
This commit is contained in:
+3
-4
@@ -72,20 +72,19 @@ public class SarStandProjectLibraryController extends BaseController<SarStandPro
|
||||
|
||||
@GetMapping("/queryProjectManager")
|
||||
@ApiOperation("查询产品线项目经理")
|
||||
public ResponseMessage queryProjectManager(){
|
||||
List<SarStandProjectLibrary> list1 = sarStandProjectLibraryService.queryProjectManager();
|
||||
public ResponseMessage queryProjectManager(@RequestParam(defaultValue = "1", value = "current")int current, @RequestParam(defaultValue = "10", value = "PageSize") int pageSize){
|
||||
List<SarStandProjectLibrary> list1 = sarStandProjectLibraryService.queryProjectManager((current-1)*pageSize,pageSize);
|
||||
// 创建一个新的list集合,用于存储去重后的元素
|
||||
List<productLineDto> listTemp = new ArrayList();
|
||||
for (SarStandProjectLibrary sarStandProjectLibrary:list1){
|
||||
productLineDto p = new productLineDto();
|
||||
p.setProductLine(sarStandProjectLibrary.getProductLine());
|
||||
p.setProjectManager(sarStandProjectLibrary.getProjectManager());
|
||||
p.setUName(sarStandProjectLibrary.getUName());
|
||||
List<SarStandProjectLibrary> list2 = sarStandProjectLibraryService.queryByProductLine(sarStandProjectLibrary.getProductLine());
|
||||
p.setSarStandProjectLibraries(list2);
|
||||
listTemp.add(p);
|
||||
}
|
||||
System.out.println(listTemp);
|
||||
|
||||
return Result.success("200",listTemp);
|
||||
}
|
||||
|
||||
|
||||
+3
@@ -3,6 +3,8 @@ package com.adc.da.slrs.sarStandProjectLibrary.dao;
|
||||
import com.adc.da.slrs.sarStandProjectLibrary.entity.SarStandProjectLibrary;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Mapper 接口
|
||||
@@ -12,5 +14,6 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
* @since 2021-06-15
|
||||
*/
|
||||
public interface SarStandProjectLibraryDao extends BaseMapper<SarStandProjectLibrary> {
|
||||
List<SarStandProjectLibrary> queryProjectManager(int current, int pageSize);
|
||||
|
||||
}
|
||||
|
||||
+6
@@ -3,6 +3,7 @@ package com.adc.da.slrs.sarStandProjectLibrary.entity;
|
||||
import com.adc.da.base.entity.BaseEntity;
|
||||
import java.util.Date;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
@@ -63,7 +64,12 @@ public class SarStandProjectLibrary extends BaseEntity {
|
||||
@ApiModelProperty(value = "产品线")
|
||||
private String productLine;
|
||||
|
||||
@ApiModelProperty(value = "项目经理")
|
||||
private String projectManager;
|
||||
|
||||
@ApiModelProperty(value = "项目经理名称")
|
||||
@TableField(exist = false)
|
||||
private String uName;
|
||||
|
||||
|
||||
}
|
||||
|
||||
+1
-1
@@ -7,7 +7,7 @@ import java.util.List;
|
||||
@Data
|
||||
public class productLineDto {
|
||||
|
||||
private String projectManager;
|
||||
private String uName;
|
||||
|
||||
private String productLine;
|
||||
|
||||
|
||||
+1
-1
@@ -11,6 +11,6 @@ public interface SarStandProjectLibraryService {
|
||||
IPage<SarStandProjectLibrary> queryMaintenanceProject(int current, int pageSize, SarStandProjectLibraryDto sarDto);
|
||||
IPage<SarStandProjectLibrary> queryNotMaintenanceProject(int current, int pageSize, SarStandProjectLibraryDto sarDto);
|
||||
List<SarStandProjectLibrary> queryById(String id);
|
||||
List<SarStandProjectLibrary> queryProjectManager();
|
||||
List<SarStandProjectLibrary> queryProjectManager(int current, int pageSize);
|
||||
List<SarStandProjectLibrary> queryByProductLine(String productLine);
|
||||
}
|
||||
|
||||
+7
-7
@@ -42,7 +42,7 @@ public class SarStandProjectLibraryServiceImpl extends ServiceImpl<SarStandProje
|
||||
sar.setProjectStatus(sarDto.getProjectStatus());
|
||||
sar.setProjectGroup(sarDto.getProjectGroup());
|
||||
sar.setCurrentNode(sarDto.getCurrentNode());
|
||||
sar.setProjectLevel(sar.getProjectLevel());
|
||||
sar.setProjectLevel(sarDto.getProjectLevel());
|
||||
sar.setProjectManager(sarDto.getProjectManager());
|
||||
sar.setProductLine(sarDto.getProductLine());
|
||||
SimpleDateFormat formater = new SimpleDateFormat();
|
||||
@@ -84,7 +84,7 @@ public class SarStandProjectLibraryServiceImpl extends ServiceImpl<SarStandProje
|
||||
sar.setProjectStatus(sarDto.getProjectStatus());
|
||||
sar.setProjectGroup(sarDto.getProjectGroup());
|
||||
sar.setCurrentNode(sarDto.getCurrentNode());
|
||||
sar.setProjectLevel(sar.getProjectLevel());
|
||||
sar.setProjectLevel(sarDto.getProjectLevel());
|
||||
sar.setProjectManager(sarDto.getProjectManager());
|
||||
sar.setProductLine(sarDto.getProductLine());
|
||||
SimpleDateFormat formater = new SimpleDateFormat();
|
||||
@@ -125,11 +125,11 @@ public class SarStandProjectLibraryServiceImpl extends ServiceImpl<SarStandProje
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SarStandProjectLibrary> queryProjectManager() {
|
||||
QueryWrapper<SarStandProjectLibrary> wrapper = new QueryWrapper<>();
|
||||
wrapper.select("product_line","project_manager");
|
||||
wrapper.groupBy("product_line");
|
||||
List<SarStandProjectLibrary> list = sarStandProjectLibraryDao.selectList(wrapper);
|
||||
public List<SarStandProjectLibrary> queryProjectManager(int current, int pageSize) {
|
||||
// QueryWrapper<SarStandProjectLibrary> wrapper = new QueryWrapper<>();
|
||||
// wrapper.select("product_line","project_manager");
|
||||
// wrapper.groupBy("product_line");
|
||||
List<SarStandProjectLibrary> list = sarStandProjectLibraryDao.queryProjectManager(current,pageSize);
|
||||
return list;
|
||||
}
|
||||
|
||||
|
||||
+9
@@ -2,4 +2,13 @@
|
||||
<!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">
|
||||
|
||||
|
||||
<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>
|
||||
|
||||
Reference in New Issue
Block a user