Commit 80ee6e69 authored by zhangyingbin's avatar zhangyingbin

资料提交-管材查询接口修改

parent 040712b0
......@@ -24,7 +24,7 @@ public class MaterialDto extends BaseDto {
@ApiModelProperty(value = "名称")
private String name;
@ApiModelProperty(value = "项目id")
@ApiModelProperty(value = "单位id")
private Long companyId;
@ApiModelProperty(value = "管材编号")
......@@ -66,4 +66,7 @@ public class MaterialDto extends BaseDto {
@ApiModelProperty(value = "单位机构代码")
private String orgCode;
@ApiModelProperty(value = "项目id")
private Long projectId;
}
......@@ -151,7 +151,7 @@ public class MaterialController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false)
@GetMapping( value = "/pageList")
@ApiOperation(httpMethod = "GET",value = "材料信息表分页查询", notes = "材料信息表分页查询")
public ResponseModel<IPage<Material>> queryPage( int current, int size, Material material) {
public ResponseModel<IPage<Material>> queryPage( int current, int size, MaterialDto material) {
IPage<Material> page = new Page<>();
page.setCurrent(current);
page.setSize(size);
......
......@@ -9,6 +9,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.google.common.collect.Lists;
import com.yeejoin.amos.boot.module.ugp.api.Enum.OrgEnum;
import com.yeejoin.amos.boot.module.ugp.api.Enum.ProjectResourceEnum;
import com.yeejoin.amos.boot.module.ugp.api.dto.AttachmentDto;
import com.yeejoin.amos.boot.module.ugp.api.dto.MaterialCount;
import com.yeejoin.amos.boot.module.ugp.api.dto.MaterialDto;
......@@ -57,6 +58,9 @@ public class MaterialServiceImpl extends BaseService<MaterialDto, Material, Mate
@Autowired
ProjectServiceImpl projectService;
@Autowired
ProjectResourceServiceImpl projectResourceServiceImpl;
/**
* 分页查询
*/
......@@ -78,14 +82,33 @@ public class MaterialServiceImpl extends BaseService<MaterialDto, Material, Mate
* 提交资料 获取管材列表(建设单位) 分页查询
*/
@BusinessIdentify
public IPage<Material> queryMaterialPage(IPage<Material> page, Material material) {
public IPage<Material> queryMaterialPage(IPage<Material> page, MaterialDto material) {
LambdaQueryWrapper<Material> wrapper = new LambdaQueryWrapper<>();
getWrapper(wrapper,material);
wrapper.in(Material::getCompanyId,getCompanyIds());
return this.page(page,wrapper);
}
public void getWrapper(LambdaQueryWrapper<Material> wrapper,Material material){
public void getWrapper(LambdaQueryWrapper<Material> wrapper,MaterialDto material){
List materialIds = new ArrayList<>();
LambdaQueryWrapper<ProjectResource> resourceWrapper = new LambdaQueryWrapper<>();
if(!ValidationUtil.isEmpty(material.getProjectId())){
resourceWrapper.eq(ProjectResource::getProjectId,material.getProjectId())
.eq(ProjectResource::getType, ProjectResourceEnum.管材资源.getCode());
List<ProjectResource> list = projectResourceServiceImpl.list(resourceWrapper);
for (ProjectResource projectResource: list) {
materialIds.add(projectResource.getResourceId());
}
wrapper.in(Material::getSequenceNbr,materialIds);
} else {
resourceWrapper.eq(ProjectResource::getType, ProjectResourceEnum.管材资源.getCode());
List<ProjectResource> list = projectResourceServiceImpl.list(resourceWrapper);
for (ProjectResource projectResource: list) {
materialIds.add(projectResource.getResourceId());
}
wrapper.notIn(Material::getSequenceNbr,materialIds);
}
if(!ValidationUtil.isEmpty(material.getName())){
wrapper.like(Material::getName,material.getName());
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment