项目库--列表查询
This commit is contained in:
+13
-4
@@ -1,6 +1,6 @@
|
||||
package com.jero.modules.project.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.jero.common.api.vo.Result;
|
||||
import com.jero.common.aspect.annotation.AutoLog;
|
||||
import com.jero.common.system.base.controller.JeroController;
|
||||
@@ -12,7 +12,15 @@ import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
@@ -46,8 +54,9 @@ public class ProjectLibraryBaseController extends JeroController<ProjectLibraryB
|
||||
@ApiOperation(value="项目库基础表-分页列表查询", notes="项目库基础表-分页列表查询")
|
||||
@PostMapping(value = "/page")
|
||||
public Result<?> queryPageList(@RequestBody Map<String,Object> params) {
|
||||
IPage<ProjectLibraryBase> pageList= projectLibraryBaseService.queryPageList(params);
|
||||
return Result.OK(params.get("cut").toString(),pageList);
|
||||
List<ProjectLibraryBase> pageList= projectLibraryBaseService.queryPageList(params);
|
||||
Page pages = projectLibraryBaseService.getPages(Integer.parseInt(params.get("pageNo").toString()), Integer.parseInt(params.get("pageSize").toString()), pageList);
|
||||
return Result.OK(params.get("cut").toString(),pages);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+11
-2
@@ -12,7 +12,7 @@ import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
@@ -25,7 +25,7 @@ import java.io.Serializable;
|
||||
@TableName("project_library_base")
|
||||
@Accessors(chain = true)
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class ProjectLibraryBase implements Serializable {
|
||||
public class ProjectLibraryBase implements Comparable<ProjectLibraryBase> {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**主键*/
|
||||
@@ -123,4 +123,13 @@ public class ProjectLibraryBase implements Serializable {
|
||||
//说明
|
||||
private String explanation;
|
||||
|
||||
@TableField(exist = false)
|
||||
private List<ProjectLibraryBase> children;
|
||||
|
||||
@Override
|
||||
public int compareTo(ProjectLibraryBase o) {
|
||||
return Integer.valueOf(this.projectVersion)-Integer.valueOf(o.projectVersion);//升序
|
||||
// return o.id-this.id;//降序
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+2
-1
@@ -16,7 +16,8 @@ import java.util.Map;
|
||||
*/
|
||||
public interface ProjectLibraryBaseMapper extends BaseMapper<ProjectLibraryBase> {
|
||||
/**分页列表*/
|
||||
IPage<ProjectLibraryBase> queryPageList(IPage page, Map<String, Object> params);
|
||||
List<ProjectLibraryBase> queryPageList(@Param("params") Map<String, Object> params);
|
||||
// IPage<ProjectLibraryBase> queryPageList(IPage page, Map<String, Object> params);
|
||||
|
||||
List<ProjectLibraryBase> getList(@Param("projectLibraryBase") ProjectLibraryBase projectLibraryBase);
|
||||
|
||||
|
||||
+67
-1
@@ -43,7 +43,10 @@
|
||||
plb.create_time,
|
||||
plb.sys_org_code,
|
||||
plb.update_by,
|
||||
plb.update_time
|
||||
plb.update_time,
|
||||
parent_id,
|
||||
project_version,
|
||||
explanation
|
||||
from project_library_base as plb
|
||||
left join project_name_info as pni on plb.project_name_id=pni.id
|
||||
left join sys_user as studiouser on plb.studio_engineer=studiouser.id
|
||||
@@ -113,6 +116,69 @@
|
||||
</where>
|
||||
order by plb.create_time desc
|
||||
</select>
|
||||
<!-- <select id="queryPageList" resultType="com.jero.modules.project.entity.ProjectLibraryBase">-->
|
||||
|
||||
<!-- <include refid="select_item"/>-->
|
||||
|
||||
<!-- <where>-->
|
||||
<!-- <if test="params.projectName != null and params.projectName != ''">-->
|
||||
<!-- <!–搜索条件:项目名称,包含%,单独搜索–>-->
|
||||
<!-- <choose>-->
|
||||
<!-- <when test='params.projectName != null and params.projectName != "" and params.projectName.contains("%")'>-->
|
||||
<!-- ( pni.project_name like '%1%%' escape '1' or pni.project_name like '%1%%' escape '1')-->
|
||||
<!-- </when>-->
|
||||
<!-- <otherwise>-->
|
||||
<!-- (pni.project_name like concat('%',#{params.projectName},'%') or pyni.year_name like concat('%',#{params.projectName},'%'))-->
|
||||
<!-- </otherwise>-->
|
||||
<!-- </choose>-->
|
||||
<!-- </if>-->
|
||||
|
||||
<!-- <!–搜索条件:目标市场–>-->
|
||||
<!-- <if test="params.targetMarket != null and params.targetMarket != '' ">-->
|
||||
<!-- and plb.target_market like concat('%',#{params.targetMarket},'%')-->
|
||||
<!-- </if>-->
|
||||
|
||||
<!-- <!–搜索条件:项目状态–>-->
|
||||
<!-- <if test="params.projectStatus != null and params.projectStatus != '' ">-->
|
||||
<!-- and plb.project_status like concat('%',#{params.projectStatus},'%')-->
|
||||
<!-- </if>-->
|
||||
|
||||
<!-- <if test="params.studioEngineer != null and params.studioEngineer != ''">-->
|
||||
<!-- <!–搜索条件:studio工程师,包含%,单独搜索–>-->
|
||||
<!-- <choose>-->
|
||||
<!-- <when test='params.studioEngineer != null and params.studioEngineer != "" and params.studioEngineer.contains("%")'>-->
|
||||
<!-- and plb.studio_engineer like '%1%%' escape '1'-->
|
||||
<!-- </when>-->
|
||||
<!-- <otherwise>-->
|
||||
<!-- and plb.studio_engineer like concat('%',#{params.studioEngineer},'%')-->
|
||||
<!-- </otherwise>-->
|
||||
<!-- </choose>-->
|
||||
<!-- </if>-->
|
||||
|
||||
<!-- <if test="params.certificationEngineer != null and params.certificationEngineer != ''">-->
|
||||
<!-- <!–搜索条件:认证工程师,包含%,单独搜索–>-->
|
||||
<!-- <choose>-->
|
||||
<!-- <when test='params.certificationEngineer != null and params.certificationEngineer != "" and params.certificationEngineer.contains("%")'>-->
|
||||
<!-- and plb.certification_engineer like '%1%%' escape '1'-->
|
||||
<!-- </when>-->
|
||||
<!-- <otherwise>-->
|
||||
<!-- and plb.certification_engineer like concat('%',#{params.certificationEngineer},'%')-->
|
||||
<!-- </otherwise>-->
|
||||
<!-- </choose>-->
|
||||
<!-- </if>-->
|
||||
|
||||
<!-- <!–搜索条件:车型平台–>-->
|
||||
<!-- <if test="params.vehiclePlatform != null and params.vehiclePlatform != '' ">-->
|
||||
<!-- and plb.vehicle_platform like concat('%',#{params.vehiclePlatform},'%')-->
|
||||
<!-- </if>-->
|
||||
|
||||
<!-- <!–搜索条件:数字平台–>-->
|
||||
<!-- <if test="params.digitalPlatform != null and params.digitalPlatform != '' ">-->
|
||||
<!-- and plb.digital_platform like concat('%',#{params.digitalPlatform},'%')-->
|
||||
<!-- </if>-->
|
||||
<!-- </where>-->
|
||||
<!-- order by plb.create_time desc-->
|
||||
<!-- </select>-->
|
||||
<select id="getList" resultType="com.jero.modules.project.entity.ProjectLibraryBase">
|
||||
|
||||
<include refid="select_item"/>
|
||||
|
||||
+5
-2
@@ -1,6 +1,6 @@
|
||||
package com.jero.modules.project.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.jero.modules.project.entity.ProjectLibraryBase;
|
||||
|
||||
@@ -78,7 +78,8 @@ public interface IProjectLibraryBaseService extends IService<ProjectLibraryBase>
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
IPage<ProjectLibraryBase> queryPageList(Map<String, Object> params);
|
||||
List<ProjectLibraryBase> queryPageList(Map<String, Object> params);
|
||||
// IPage<ProjectLibraryBase> queryPageList(Map<String, Object> params);
|
||||
|
||||
/**
|
||||
* 项目详情-统计接口
|
||||
@@ -99,4 +100,6 @@ public interface IProjectLibraryBaseService extends IService<ProjectLibraryBase>
|
||||
void checkData(String id, String cut);
|
||||
|
||||
void disposeData(List<ProjectLibraryBase> records,String cut,boolean disposeTargetMarketFlag);
|
||||
|
||||
Page getPages(Integer currentPage, Integer pageSize, List<ProjectLibraryBase> list);
|
||||
}
|
||||
|
||||
+80
-8
@@ -2,7 +2,6 @@ package com.jero.modules.project.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.jero.common.constant.enums.CutEnum;
|
||||
@@ -61,8 +60,10 @@ import java.io.OutputStream;
|
||||
import java.text.ParseException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
@@ -444,21 +445,92 @@ public class ProjectLibraryBaseServiceImpl extends ServiceImpl<ProjectLibraryBas
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public IPage<ProjectLibraryBase> queryPageList(Map<String,Object> params) {
|
||||
public List<ProjectLibraryBase> queryPageList(Map<String,Object> params) {
|
||||
Integer pageNo = Integer.parseInt(params.get("pageNo").toString());
|
||||
Integer pageSize = Integer.parseInt(params.get("pageSize").toString());
|
||||
IPage page = new Page(pageNo, pageSize);
|
||||
IPage<ProjectLibraryBase> result = projectLibraryBaseMapper.queryPageList(page, params);
|
||||
List<ProjectLibraryBase> records = result.getRecords();
|
||||
disposeData(records,"",false);
|
||||
for(ProjectLibraryBase projectLibraryBase: records){
|
||||
List<ProjectLibraryBase> result = projectLibraryBaseMapper.queryPageList(params);
|
||||
disposeData(result,"",false);
|
||||
for(ProjectLibraryBase projectLibraryBase: result){
|
||||
if(StringUtils.isNotBlank(projectLibraryBase.getYearName())){
|
||||
projectLibraryBase.setProjectName(projectLibraryBase.getProjectName() + "-" + projectLibraryBase.getYearName());
|
||||
}
|
||||
}
|
||||
return result;
|
||||
//数据组装
|
||||
List<ProjectLibraryBase> resultTemp = new LinkedList<>();
|
||||
for (ProjectLibraryBase projectLibraryBase : result) {
|
||||
if(StringUtils.isBlank(projectLibraryBase.getParentId())){
|
||||
resultTemp.add(projectLibraryBase);
|
||||
}
|
||||
}
|
||||
|
||||
for (ProjectLibraryBase projectLibraryBase : resultTemp) {
|
||||
//子项目
|
||||
List<ProjectLibraryBase> children = result.stream()
|
||||
.filter(e -> StringUtils.isNotBlank(e.getParentId()) && projectLibraryBase.getId().equals(e.getParentId())).collect(Collectors.toList());
|
||||
if(children.size() != 0){
|
||||
//按版本排序
|
||||
Collections.sort(children);
|
||||
projectLibraryBase.setChildren(children);
|
||||
//最后一个版本号(主项目和主项目都需要设置)
|
||||
String versionLast = children.get(children.size() - 1).getProjectVersion();
|
||||
//主版本设置最后一个版本号(用于项目扩展中的版本号)
|
||||
projectLibraryBase.setVersionLast(versionLast);
|
||||
for (ProjectLibraryBase child : children) {
|
||||
//每个子版本版本设置最后一个版本号(用于项目扩展中的版本号)
|
||||
child.setVersionLast(versionLast);
|
||||
}
|
||||
}
|
||||
}
|
||||
return resultTemp;
|
||||
}
|
||||
|
||||
public Page getPages(Integer currentPage, Integer pageSize, List<ProjectLibraryBase> list){
|
||||
Page page =new Page();
|
||||
if(list==null){
|
||||
return null;
|
||||
}
|
||||
int size = list.size();
|
||||
if(pageSize > size){
|
||||
pageSize = size;
|
||||
}
|
||||
if(pageSize!=0){
|
||||
//求出最⼤页数,防⽌currentPage越界
|
||||
int maxPage = size % pageSize ==0? size / pageSize : size / pageSize +1;
|
||||
if(currentPage > maxPage){
|
||||
currentPage = maxPage;
|
||||
}
|
||||
}
|
||||
//当前页第⼀条数据的下标
|
||||
int curIdx = currentPage >1?(currentPage -1)* pageSize :0;
|
||||
List pageList =new ArrayList();
|
||||
//将当前页的数据放进pageList
|
||||
for(int i =0; i < pageSize && curIdx + i < size; i++){
|
||||
pageList.add(list.get(curIdx + i));
|
||||
}
|
||||
page.setCurrent(currentPage).setSize(pageSize).setTotal(list.size()).setRecords(pageList);
|
||||
return page;
|
||||
}
|
||||
// /**
|
||||
// * 分页列表查询
|
||||
// *
|
||||
// * @return
|
||||
// */
|
||||
// @Override
|
||||
// public IPage<ProjectLibraryBase> queryPageList(Map<String,Object> params) {
|
||||
// Integer pageNo = Integer.parseInt(params.get("pageNo").toString());
|
||||
// Integer pageSize = Integer.parseInt(params.get("pageSize").toString());
|
||||
// IPage page = new Page(pageNo, pageSize);
|
||||
// IPage<ProjectLibraryBase> result = projectLibraryBaseMapper.queryPageList(page, params);
|
||||
// List<ProjectLibraryBase> records = result.getRecords();
|
||||
// disposeData(records,"",false);
|
||||
// for(ProjectLibraryBase projectLibraryBase: records){
|
||||
// if(StringUtils.isNotBlank(projectLibraryBase.getYearName())){
|
||||
// projectLibraryBase.setProjectName(projectLibraryBase.getProjectName() + "-" + projectLibraryBase.getYearName());
|
||||
// }
|
||||
// }
|
||||
// return result;
|
||||
// }
|
||||
|
||||
@Override
|
||||
public void disposeData(List<ProjectLibraryBase> records,String cut,boolean disposeTargetMarketFlag) {
|
||||
List<DictModel> targetMarketList = sysDictService.queryDictItemsByCode(DicCodeEnum.REGION.getCode());
|
||||
|
||||
Reference in New Issue
Block a user