修改文档对比-修改排序和模糊搜索
This commit is contained in:
+25
-13
@@ -2,14 +2,13 @@ package com.jero.modules.compare.controller;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
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.constant.enums.CutEnum;
|
||||
import com.jero.common.system.base.controller.JeroController;
|
||||
import com.jero.common.system.query.QueryGenerator;
|
||||
import com.jero.common.system.vo.LoginUser;
|
||||
import com.jero.generater.modules.online.cgform.entity.OnlCgformField;
|
||||
import com.jero.generater.modules.online.cgform.service.impl.OnlCgformFieldServiceImpl;
|
||||
@@ -17,6 +16,8 @@ import com.jero.modules.compare.entity.SarFileCompareDetailVO;
|
||||
import com.jero.modules.compare.entity.SarFileCompareInfo;
|
||||
import com.jero.modules.compare.service.ISarFileCompareInfoService;
|
||||
import com.jero.modules.docTranslation.enums.ReleaseConditionEnum;
|
||||
import com.jero.modules.system.entity.SysUser;
|
||||
import com.jero.modules.system.util.StringUtils;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@@ -50,22 +51,33 @@ public class SarFileCompareInfoController extends JeroController<SarFileCompareI
|
||||
|
||||
/**
|
||||
* 分页列表查询
|
||||
*
|
||||
* @param sarFileCompareInfo
|
||||
* @param pageNo
|
||||
* @param pageSize
|
||||
* @param req
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "文档对比信息表-分页列表查询")
|
||||
@ApiOperation(value = "文档对比信息表-分页列表查询", notes = "文档对比信息表-分页列表查询")
|
||||
@GetMapping(value = "/page")
|
||||
public Result<?> queryPageList(SarFileCompareInfo sarFileCompareInfo, @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
|
||||
@RequestParam(name = "cut", defaultValue = "cn") String cut, HttpServletRequest req) {
|
||||
QueryWrapper<SarFileCompareInfo> queryWrapper = QueryGenerator.initQueryWrapper(sarFileCompareInfo, req.getParameterMap());
|
||||
public Result<?> queryPageList(@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
|
||||
@RequestParam(name = "cut", defaultValue = "cn") String cut,
|
||||
@RequestParam(name = "serialNumber", defaultValue = "") String serialNumber,
|
||||
@RequestParam(name = "title", defaultValue = "") String title,
|
||||
@RequestParam(name = "releaseState", defaultValue = "") String releaseState,
|
||||
HttpServletRequest req) {
|
||||
LambdaQueryWrapper<SarFileCompareInfo> queryWrapper = new LambdaQueryWrapper<>();
|
||||
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
||||
queryWrapper.eq("create_by", sysUser.getUsername()).or().eq("release_state", ReleaseConditionEnum.PUBLISHED.getValue());
|
||||
queryWrapper.orderByAsc("create_by");
|
||||
queryWrapper.and(LambdaQueryWrapper -> LambdaQueryWrapper.eq(SarFileCompareInfo::getCreateBy, sysUser.getUsername()).or().eq(SarFileCompareInfo::getReleaseState, ReleaseConditionEnum.PUBLISHED.getValue()));
|
||||
if (StringUtils.isNotBlank(serialNumber)) {
|
||||
String finalSerialNumber = serialNumber.replace("%", "\\%");;
|
||||
queryWrapper.and(LambdaQueryWrapper -> LambdaQueryWrapper.like(SarFileCompareInfo::getSerialNumberLeft, finalSerialNumber).or().like(SarFileCompareInfo::getSerialNumberRight, finalSerialNumber));
|
||||
|
||||
}
|
||||
if (StringUtils.isNotBlank(title)) {
|
||||
String finalTitle = title.replace("%", "\\%");
|
||||
queryWrapper.and(i -> i.like(SarFileCompareInfo::getTitleLeft, finalTitle).or().like(SarFileCompareInfo::getTitleRight, finalTitle));
|
||||
}
|
||||
if (StringUtils.isNotBlank(releaseState)) {
|
||||
queryWrapper.and(LambdaQueryWrapper -> LambdaQueryWrapper.eq(SarFileCompareInfo::getReleaseState, releaseState));
|
||||
}
|
||||
queryWrapper.orderByDesc(SarFileCompareInfo::getCreateTime);
|
||||
Page<SarFileCompareInfo> page = new Page<>(pageNo, pageSize);
|
||||
IPage<SarFileCompareInfo> pageList = sarFileCompareInfoService.page(page, queryWrapper);
|
||||
for (SarFileCompareInfo info : pageList.getRecords()) {
|
||||
|
||||
Reference in New Issue
Block a user