Commit 9440bb1b authored by zhangyingbin's avatar zhangyingbin

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

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