Commit 9440bb1b authored by zhangyingbin's avatar zhangyingbin

修改监管规则列表查询接口

parent edf2fc43
package com.yeejoin.amos.boot.module.ugp.biz.controller; package com.yeejoin.amos.boot.module.ugp.biz.controller;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.yeejoin.amos.boot.module.common.api.entity.OrgUsr; import com.yeejoin.amos.boot.module.common.api.entity.OrgUsr;
import com.yeejoin.amos.boot.module.ugp.api.entity.SuperviseRule; import com.yeejoin.amos.boot.module.ugp.api.entity.SuperviseRule;
import com.yeejoin.amos.boot.module.ugp.biz.service.impl.OrgServiceImpl; import com.yeejoin.amos.boot.module.ugp.biz.service.impl.OrgServiceImpl;
...@@ -140,13 +141,13 @@ public class SuperviseRuleController extends BaseController { ...@@ -140,13 +141,13 @@ public class SuperviseRuleController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false) @TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@GetMapping(value = "/page") @GetMapping(value = "/page")
@ApiOperation(httpMethod = "GET",value = "监管区域规则表分页查询", notes = "监管区域规则表分页查询") @ApiOperation(httpMethod = "GET",value = "监管区域规则表分页查询", notes = "监管区域规则表分页查询")
public ResponseModel<Page<SuperviseRuleDto>> queryForPage( public ResponseModel<IPage<SuperviseRuleDto>> queryForPage(
@RequestParam(value = "current") int current, @RequestParam(value = "current") int current,
@RequestParam(value = "size") int size, @RequestParam(value = "size") int size,
SuperviseRule superviseRule SuperviseRule superviseRule
) { ) {
//this.current = current; //this.current = current;
Page<SuperviseRuleDto> page = new Page<>(); Page page = new Page<>();
page.setCurrent(current); page.setCurrent(current);
page.setSize(size); page.setSize(size);
......
package com.yeejoin.amos.boot.module.ugp.biz.service.impl; package com.yeejoin.amos.boot.module.ugp.biz.service.impl;
import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.yeejoin.amos.boot.module.ugp.api.entity.SuperviseRule; import com.yeejoin.amos.boot.module.ugp.api.entity.SuperviseRule;
import com.yeejoin.amos.boot.module.ugp.api.mapper.SuperviseRuleMapper; import com.yeejoin.amos.boot.module.ugp.api.mapper.SuperviseRuleMapper;
import com.yeejoin.amos.boot.module.ugp.api.service.ISuperviseRuleService; import com.yeejoin.amos.boot.module.ugp.api.service.ISuperviseRuleService;
import com.yeejoin.amos.boot.module.ugp.api.dto.SuperviseRuleDto; import com.yeejoin.amos.boot.module.ugp.api.dto.SuperviseRuleDto;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.rdbms.service.BaseService; import org.typroject.tyboot.core.rdbms.service.BaseService;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import java.util.ArrayList;
import java.util.List; import java.util.List;
/** /**
...@@ -25,22 +31,35 @@ public class SuperviseRuleServiceImpl extends BaseService<SuperviseRuleDto,Super ...@@ -25,22 +31,35 @@ public class SuperviseRuleServiceImpl extends BaseService<SuperviseRuleDto,Super
/** /**
* 分页查询 * 分页查询
*/ */
public Page<SuperviseRuleDto> queryForSuperviseRulePage(Page<SuperviseRuleDto> page,SuperviseRule superviseRule) { public IPage<SuperviseRuleDto> queryForSuperviseRulePage(IPage page, SuperviseRule superviseRule) {
Integer adminRegionCode = superviseRule.getAdminRegionCode(); Integer adminRegionCode = superviseRule.getAdminRegionCode();
Long superviseDeptId = superviseRule.getSuperviseDeptId(); Long superviseDeptId = superviseRule.getSuperviseDeptId();
Long inspectionUnitId = superviseRule.getInspectionUnitId(); Long inspectionUnitId = superviseRule.getInspectionUnitId();
LambdaQueryWrapper<SuperviseRule> wrapper = new LambdaQueryWrapper<>();
page = this.queryForPage(page,null,false,adminRegionCode,superviseDeptId,inspectionUnitId); if(!ValidationUtil.isEmpty(adminRegionCode)){
List<SuperviseRuleDto> superviseRuleDtoList = page.getRecords(); wrapper.eq(SuperviseRule::getAdminRegionCode,adminRegionCode);
}
for(SuperviseRuleDto superviseRuleDto: superviseRuleDtoList){ if(!ValidationUtil.isEmpty(superviseDeptId)){
superviseRuleDto.setSuperviseDept(orgServiceImpl.getOrgUsrById(String.valueOf(superviseRuleDto.getSuperviseDeptId())).getBizOrgName()); wrapper.like(SuperviseRule::getSuperviseDeptId,superviseDeptId);
superviseRuleDto.setInspectionUnit(orgServiceImpl.getOrgUsrById(String.valueOf(superviseRuleDto.getInspectionUnitId())).getBizOrgName()); }
superviseRuleDto.setCreateUnit(orgServiceImpl.getOrgUsrById(String.valueOf(superviseRuleDto.getCreateUnitId())).getBizOrgName()); if(!ValidationUtil.isEmpty(inspectionUnitId)){
wrapper.like(SuperviseRule::getInspectionUnitId,inspectionUnitId);
} }
page = this.page(page,wrapper);
List<SuperviseRule> superviseRuleList = page.getRecords();
List<SuperviseRuleDto> superviseRuleDtoList = new ArrayList<>();
for(SuperviseRule rule: superviseRuleList){
SuperviseRuleDto superviseRuleDto = new SuperviseRuleDto();
BeanUtils.copyProperties(rule,superviseRuleDto);
superviseRuleDto.setSuperviseDept(orgServiceImpl.getOrgUsrById(String.valueOf(rule.getSuperviseDeptId())).getBizOrgName());
superviseRuleDto.setInspectionUnit(orgServiceImpl.getOrgUsrById(String.valueOf(rule.getInspectionUnitId())).getBizOrgName());
superviseRuleDto.setCreateUnit(orgServiceImpl.getOrgUsrById(String.valueOf(rule.getCreateUnitId())).getBizOrgName());
superviseRuleDtoList.add(superviseRuleDto);
}
page.setRecords(superviseRuleDtoList);
return page; return page;
} }
......
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