拆分 引用标准 条件查询 单独处理

This commit is contained in:
gaojiabao
2023-05-16 11:39:22 +08:00
parent e35fd3a93d
commit c649f1f208
3 changed files with 106 additions and 0 deletions
@@ -139,6 +139,50 @@ public class SarStandardsInfoController extends BaseController<SarStandardsInfo>
return Result.success(getPageInfo(page.getPager(), rows));
}
@ApiOperation(value = "|SarStandardsInfoEO|自定义分页查询")
@GetMapping("/getSarStandardsInfoSplitPage")
//@RequiresPermissions("lawss:sarStandardsInfo:getSarStandardsInfoPage")
public ResponseMessage<PageInfo<SarStandardsInfo>> getSarStandardsInfoSplitPage(SarStandardsInfoEOPage page,@RequestParam(defaultValue = "0") String mark) throws Exception {
if (null != page.getNowOrderBy()) {
nowOrderFunc(page);
}
if (StringUtils.isNotBlank(page.getAdvanceSearchVOStr())) {
List<SarAdvanceSearchVO> searchList = JSONObject.parseArray(page.getAdvanceSearchVOStr(),SarAdvanceSearchVO.class);
//不改传参强行置换
// searchList.forEach(sarAdvanceSearchVO -> {
// if ("TXLB".equals(sarAdvanceSearchVO.getField())){
// sarAdvanceSearchVO.setField("STAND_SYSTEM");
// }
// });
String advanceStr = SarAdvanceSearchUtil.createStandSql(searchList,"sar_stand_attr_info");
if (StringUtils.isNotBlank(advanceStr)) {
page.setAdvanceSearchStr(advanceStr);
} else {
page.setAdvanceSearchStr(null);
}
}
if(page.getUserId() == null || page.getUserId().equals("")){
page.setUserId(LoginUserUtil.getUserId());
}
List<SarStandardsInfo> rows = sarStandardsInfoEOService.getSarStandardsInfoSplitPage(page);
// 去掉日期时分秒
rows.forEach(item->{
Optional.ofNullable(item.getSSRQ())
.ifPresent(SSRQ -> item.setSSRQ(item.getSSRQ().replaceAll("\\s[0-6][0-9]\\:[0-6][0-9]\\:[0-6][0-9]", "")));
Optional.ofNullable(item.getXCXSSRQ())
.ifPresent(SSRQ ->item.setXCXSSRQ(item.getXCXSSRQ().replaceAll("\\s[0-6][0-9]\\:[0-6][0-9]\\:[0-6][0-9]", "")));
Optional.ofNullable(item.getZCCSSRQ())
.ifPresent(SSRQ ->item.setZCCSSRQ(item.getZCCSSRQ().replaceAll("\\s[0-6][0-9]\\:[0-6][0-9]\\:[0-6][0-9]", "")));
});
return Result.success(getPageInfo(page.getPager(), rows));
}
@ApiOperation(value = "|SarStandardsInfoEO|自定义分页查询")
@GetMapping("/getSarStandardsInfoPageByWk1")
//@RequiresPermissions("lawss:sarStandardsInfo:getSarStandardsInfoPage")
@@ -78,4 +78,6 @@ public interface ISarStandardsInfoService extends IService<SarStandardsInfo> {
List<SarStandardsInfo> listQuery2(SarStandardsInfoEOPage page);
ResponseMessage fileNameTranslation();
List<SarStandardsInfo> getSarStandardsInfoSplitPage(SarStandardsInfoEOPage page);
}
@@ -87,6 +87,7 @@ import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.serializer.SerializerFeature;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import lombok.SneakyThrows;
import net.sf.json.JSONObject;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.ObjectUtils;
@@ -3781,5 +3782,64 @@ public class SarStandardsInfoServiceImpl extends ServiceImpl<SarStandardsInfoDao
return Result.success(objects);
}
@SneakyThrows
@Override
public List<SarStandardsInfo> getSarStandardsInfoSplitPage(SarStandardsInfoEOPage page){
//查询当前登录人角色拥有权限的菜单
if (page.getMenuId() != null && page.getUserId() != null && StringUtils.isNotBlank(page.getUserId())) {
String treeType = page.getTreeType();
QueryWrapper qw = new QueryWrapper<>();
qw.eq("ID", page.getMenuId());
qw.isNull("PARENT_ID");
List<TsResource> children = iTsResourceService.list(qw);
if (children.isEmpty() && !page.getMenuId().equals("nomenu") && StringUtils.isNotBlank(treeType) && "tsr".equals(treeType)) {
// List<String> getMenuIdList = tsUserService.getResourceUserId(page.getUserId());
// if (getMenuIdList != null && !getMenuIdList.isEmpty()) {
// page.setMenuRoleList(getMenuIdList);
// } else {
// page.setMenuRoleList(null);
// }
List<String> ids = iTsResourceService.getChildMenuList(page.getMenuId());
if (ids != null && !ids.isEmpty()) {
page.setMenuAllChildrenIdList(ids);
}
} else if (!page.getMenuId().equals("nomenu") && StringUtils.isNotBlank(treeType) && "sarMs".equals(treeType)) {
// List<String> getMenuIdList = tsUserService.getResourceUserId(page.getUserId());
// if (getMenuIdList != null && !getMenuIdList.isEmpty()) {
// page.setMenuRoleList(getMenuIdList);
// } else {
// page.setMenuRoleList(null);
// }
List<String> ids = iSarMenuStandardService.getChildMenuList(page.getMenuId());
if (ids != null && !ids.isEmpty()) {
page.setMenuAllChildrenIdList(ids);
}
} else if (page.getMenuId().equals("nomenu") && StringUtils.isNotBlank(page.getSarMsType()) && "filterSarMsMenu".equals(page.getSarMsType())) {
// List<String> getMenuIdList = tsUserService.getResourceUserId(page.getUserId());
// if (getMenuIdList != null && !getMenuIdList.isEmpty()) {
// page.setMenuRoleList(getMenuIdList);
// } else {
// page.setMenuRoleList(null);
// }
List<String> ids = iSarMenuStandardService.getChildMenuList(page.getSarMsMenuId());
if (ids != null && !ids.isEmpty()) {
page.setMenuAllChildrenIdList(ids);
}
}
}
Integer rowCount = dao.getSarStandardsInfoCount(page);
page.getPager().setRowCount(rowCount);
List<SarStandardsInfo> sarlist = dao.getSarStandardsInfoPage(page, "0");
if(sarlist.isEmpty()){
page.setStandName(page.getStandNumber());
page.setStandNumber(null);
rowCount = dao.getSarStandardsInfoCount(page);
page.getPager().setRowCount(rowCount);
sarlist = dao.getSarStandardsInfoPage(page, "0");
}
attrInfoCollect(sarlist);
return sarlist;
}
}