代码优化

This commit is contained in:
Administrator 2023-04-28 17:54:38 +08:00
parent 42230a1b3b
commit 9c5a06003b
6 changed files with 548 additions and 483 deletions

View File

@ -62,36 +62,22 @@ public class WeighBookVehicleInfoController {
* @param weighBookVehicleInfo
* @param pageNo
* @param pageSize
* @param lastAdddatetime 现场上次拉取的时间
* @param req
* @return
*/
@ApiOperation(value = " 分页列表查询过磅预约车辆信息信息", notes = "分页列表查询过磅预约车辆信息信息", httpMethod = "GET")
@GetMapping(value = "/list")
public Result<IPage<WeighBookVehicleInfo>> queryPageList(WeighBookVehicleInfo weighBookVehicleInfo, @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize, String lastAdddatetime, HttpServletRequest req) {
Result<IPage<WeighBookVehicleInfo>> result = new Result<IPage<WeighBookVehicleInfo>>();
LambdaQueryWrapper<WeighBookVehicleInfo> queryWrapper = new LambdaQueryWrapper<WeighBookVehicleInfo>()
.eq(StringUtils.isNotBlank(weighBookVehicleInfo.getProjectSn()),WeighBookVehicleInfo::getProjectSn,weighBookVehicleInfo.getProjectSn())
.like(StringUtils.isNotBlank(weighBookVehicleInfo.getSpecifications()),WeighBookVehicleInfo::getSpecifications,weighBookVehicleInfo.getSpecifications())
.like(StringUtils.isNotBlank(weighBookVehicleInfo.getGoodsName()),WeighBookVehicleInfo::getGoodsName,weighBookVehicleInfo.getGoodsName())
.like(StringUtils.isNotBlank(weighBookVehicleInfo.getLicensePlate()),WeighBookVehicleInfo::getLicensePlate,weighBookVehicleInfo.getLicensePlate());
if (StringUtils.isNotBlank(lastAdddatetime)) {
DateTime dateTime = DateUtil.parse(lastAdddatetime);
queryWrapper.ge(WeighBookVehicleInfo::getAddDateTime, dateTime);
}
Page<WeighBookVehicleInfo> page = new Page<WeighBookVehicleInfo>(pageNo, pageSize);
IPage<WeighBookVehicleInfo> pageList = weighBookVehicleInfoService.page(page, queryWrapper);
result.setSuccess(true);
result.setResult(pageList);
return result;
public Result<IPage<WeighBookVehicleInfo>> queryPageList(WeighBookVehicleInfo weighBookVehicleInfo, @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize, HttpServletRequest req) {
return weighBookVehicleInfoService.queryPageList(weighBookVehicleInfo, pageNo, pageSize, req);
}
/**
* 添加
*
* @param weighBookVehicleInfo
* @return
*/
@ApiOperation(value = " 添加过磅预约车辆信息信息", notes = "添加过磅预约车辆信息信息" , httpMethod="POST")
@ApiOperation(value = " 添加过磅预约车辆信息信息", notes = "添加过磅预约车辆信息信息", httpMethod = "POST")
@PostMapping(value = "/add")
public Result<WeighBookVehicleInfo> add(@RequestBody WeighBookVehicleInfo weighBookVehicleInfo) {
Result<WeighBookVehicleInfo> result = new Result<WeighBookVehicleInfo>();
@ -108,10 +94,11 @@ public class WeighBookVehicleInfoController {
/**
* 编辑
*
* @param weighBookVehicleInfo
* @return
*/
@ApiOperation(value = "编辑过磅预约车辆信息信息", notes = "编辑过磅预约车辆信息信息" , httpMethod="POST")
@ApiOperation(value = "编辑过磅预约车辆信息信息", notes = "编辑过磅预约车辆信息信息", httpMethod = "POST")
@PostMapping(value = "/edit")
public Result<WeighBookVehicleInfo> edit(@RequestBody WeighBookVehicleInfo weighBookVehicleInfo) {
Result<WeighBookVehicleInfo> result = new Result<WeighBookVehicleInfo>();
@ -153,17 +140,18 @@ public class WeighBookVehicleInfoController {
/**
* 批量删除
*
* @param ids
* @return
*/
@ApiOperation(value = "批量删除过磅预约车辆信息信息", notes = "批量删除过磅预约车辆信息信息", httpMethod="POST")
@ApiOperation(value = "批量删除过磅预约车辆信息信息", notes = "批量删除过磅预约车辆信息信息", httpMethod = "POST")
@ApiImplicitParam(name = "id", value = "过磅预约车辆信息ID字符串", paramType = "query", required = true, dataType = "String")
@PostMapping(value = "/deleteBatch")
public Result<WeighBookVehicleInfo> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
public Result<WeighBookVehicleInfo> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
Result<WeighBookVehicleInfo> result = new Result<WeighBookVehicleInfo>();
if(ids==null || "".equals(ids.trim())) {
if (ids == null || "".equals(ids.trim())) {
result.error500("参数不识别!");
}else {
} else {
this.weighBookVehicleInfoService.removeByIds(Arrays.asList(ids.split(",")));
result.success("删除成功!");
}
@ -172,18 +160,19 @@ public class WeighBookVehicleInfoController {
/**
* 通过id查询
*
* @param id
* @return
*/
@ApiOperation(value = "通过id查询过磅预约车辆信息信息", notes = "通过id查询过磅预约车辆信息信息" , httpMethod="GET")
@ApiOperation(value = "通过id查询过磅预约车辆信息信息", notes = "通过id查询过磅预约车辆信息信息", httpMethod = "GET")
@ApiImplicitParam(name = "id", value = "过磅预约车辆信息ID", paramType = "query", required = true, dataType = "Integer")
@GetMapping(value = "/queryById")
public Result<WeighBookVehicleInfo> queryById(@RequestParam(name="id",required=true) String id) {
public Result<WeighBookVehicleInfo> queryById(@RequestParam(name = "id", required = true) String id) {
Result<WeighBookVehicleInfo> result = new Result<WeighBookVehicleInfo>();
WeighBookVehicleInfo weighBookVehicleInfo = weighBookVehicleInfoService.getById(id);
if(weighBookVehicleInfo==null) {
if (weighBookVehicleInfo == null) {
result.error500("未找到对应实体");
}else {
} else {
result.setResult(weighBookVehicleInfo);
result.setSuccess(true);
}
@ -196,7 +185,7 @@ public class WeighBookVehicleInfoController {
* @param request
* @param response
*/
@ApiOperation(value = "导出excel过磅预约车辆信息信息", notes = "导出excel过磅预约车辆信息信息" , httpMethod="POST")
@ApiOperation(value = "导出excel过磅预约车辆信息信息", notes = "导出excel过磅预约车辆信息信息", httpMethod = "POST")
@RequestMapping(value = "/exportXls")
public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response) {
// Step.1 组装查询条件
@ -230,7 +219,7 @@ public class WeighBookVehicleInfoController {
* @param response
* @return
*/
@ApiOperation(value = "通过excel导入过磅预约车辆信息信息", notes = "通过excel导入过磅预约车辆信息信息", httpMethod="POST")
@ApiOperation(value = "通过excel导入过磅预约车辆信息信息", notes = "通过excel导入过磅预约车辆信息信息", httpMethod = "POST")
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;

View File

@ -1,43 +1,39 @@
package com.zhgd.xmgl.modules.weight.controller;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.zhgd.jeecg.common.api.vo.Result;
import com.zhgd.jeecg.common.system.query.QueryGenerator;
import com.zhgd.jeecg.common.util.oConvertUtils;
import com.zhgd.xmgl.modules.weight.entity.WeighInfo;
import com.zhgd.xmgl.modules.weight.service.IWeighInfoService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.jeecgframework.poi.excel.ExcelImportUtil;
import org.jeecgframework.poi.excel.def.NormalExcelConstants;
import org.jeecgframework.poi.excel.entity.ExportParams;
import org.jeecgframework.poi.excel.entity.ImportParams;
import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.MultipartHttpServletRequest;
import org.springframework.web.servlet.ModelAndView;
import com.alibaba.fastjson.JSON;
/**
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
/**
* @Title: Controller
* @Description: 称重记录表
* @author pds
@ -54,27 +50,29 @@ public class WeighInfoController {
/**
* 分页列表查询
*
* @param weighInfo
* @param pageNo
* @param pageSize
* @param req
* @return
*/
@ApiOperation(value = " 分页列表查询称重记录表信息", notes = "分页列表查询称重记录表信息", httpMethod="GET")
@ApiOperation(value = " 分页列表查询称重记录表信息", notes = "分页列表查询称重记录表信息", httpMethod = "GET")
@GetMapping(value = "/list")
public Result<IPage<WeighInfo>> queryPageList(WeighInfo weighInfo,
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
HttpServletRequest req) {
return weighInfoService.queryPageList(weighInfo, pageNo, pageSize, req);
}
/**
* 添加
* 现场端添加称重记录表信息
*
* @param weighInfo
* @return
*/
@ApiOperation(value = " 添加称重记录表信息", notes = "添加称重记录表信息" , httpMethod="POST")
@ApiOperation(value = " 添加称重记录表信息", notes = "添加称重记录表信息", httpMethod = "POST")
@PostMapping(value = "/add")
public Result<WeighInfo> add(@RequestBody WeighInfo weighInfo) {
Result<WeighInfo> result = new Result<WeighInfo>();
@ -91,17 +89,18 @@ public class WeighInfoController {
/**
* 编辑
*
* @param weighInfo
* @return
*/
@ApiOperation(value = "编辑称重记录表信息", notes = "编辑称重记录表信息" , httpMethod="POST")
@ApiOperation(value = "编辑称重记录表信息", notes = "编辑称重记录表信息", httpMethod = "POST")
@PostMapping(value = "/edit")
public Result<WeighInfo> edit(@RequestBody WeighInfo weighInfo) {
Result<WeighInfo> result = new Result<WeighInfo>();
WeighInfo weighInfoEntity = weighInfoService.getById(weighInfo.getId());
if(weighInfoEntity==null) {
if (weighInfoEntity == null) {
result.error500("未找到对应实体");
}else {
} else {
weighInfoService.updateById(weighInfo);
result.success("修改成功!");
}
@ -111,21 +110,22 @@ public class WeighInfoController {
/**
* 通过id删除
*
* @param id
* @return
*/
@ApiOperation(value = "删除称重记录表信息", notes = "删除称重记录表信息" , httpMethod="POST")
@ApiOperation(value = "删除称重记录表信息", notes = "删除称重记录表信息", httpMethod = "POST")
@PostMapping(value = "/delete")
public Result<WeighInfo> delete(@RequestBody String id) {
JSONObject jsonObject = JSON.parseObject(id, JSONObject.class);
id = String.valueOf(jsonObject.get("id"));
Result<WeighInfo> result = new Result<WeighInfo>();
WeighInfo weighInfo = weighInfoService.getById(id);
if(weighInfo==null) {
if (weighInfo == null) {
result.error500("未找到对应实体");
}else {
} else {
boolean ok = weighInfoService.removeById(id);
if(ok) {
if (ok) {
result.success("删除成功!");
}
}
@ -135,17 +135,18 @@ public class WeighInfoController {
/**
* 批量删除
*
* @param ids
* @return
*/
@ApiOperation(value = "批量删除称重记录表信息", notes = "批量删除称重记录表信息", httpMethod="POST")
@ApiOperation(value = "批量删除称重记录表信息", notes = "批量删除称重记录表信息", httpMethod = "POST")
@ApiImplicitParam(name = "id", value = "称重记录表ID字符串", paramType = "query", required = true, dataType = "String")
@PostMapping(value = "/deleteBatch")
public Result<WeighInfo> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
public Result<WeighInfo> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
Result<WeighInfo> result = new Result<WeighInfo>();
if(ids==null || "".equals(ids.trim())) {
if (ids == null || "".equals(ids.trim())) {
result.error500("参数不识别!");
}else {
} else {
this.weighInfoService.removeByIds(Arrays.asList(ids.split(",")));
result.success("删除成功!");
}
@ -154,18 +155,19 @@ public class WeighInfoController {
/**
* 通过id查询
*
* @param id
* @return
*/
@ApiOperation(value = "通过id查询称重记录表信息", notes = "通过id查询称重记录表信息" , httpMethod="GET")
@ApiOperation(value = "通过id查询称重记录表信息", notes = "通过id查询称重记录表信息", httpMethod = "GET")
@ApiImplicitParam(name = "id", value = "称重记录表ID", paramType = "query", required = true, dataType = "Integer")
@GetMapping(value = "/queryById")
public Result<WeighInfo> queryById(@RequestParam(name="id",required=true) String id) {
public Result<WeighInfo> queryById(@RequestParam(name = "id", required = true) String id) {
Result<WeighInfo> result = new Result<WeighInfo>();
WeighInfo weighInfo = weighInfoService.getById(id);
if(weighInfo==null) {
if (weighInfo == null) {
result.error500("未找到对应实体");
}else {
} else {
result.setResult(weighInfo);
result.setSuccess(true);
}
@ -178,7 +180,7 @@ public class WeighInfoController {
* @param request
* @param response
*/
@ApiOperation(value = "导出excel称重记录表信息", notes = "导出excel称重记录表信息" , httpMethod="POST")
@ApiOperation(value = "导出excel称重记录表信息", notes = "导出excel称重记录表信息", httpMethod = "POST")
@RequestMapping(value = "/exportXls")
public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response) {
// Step.1 组装查询条件
@ -212,7 +214,7 @@ public class WeighInfoController {
* @param response
* @return
*/
@ApiOperation(value = "通过excel导入称重记录表信息", notes = "通过excel导入称重记录表信息", httpMethod="POST")
@ApiOperation(value = "通过excel导入称重记录表信息", notes = "通过excel导入称重记录表信息", httpMethod = "POST")
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;

View File

@ -83,7 +83,7 @@ public class WeighPicController {
}
/**
* 添加
* 现场端添加称重图片信息
*
* @param weighPic
* @return

View File

@ -1,16 +1,18 @@
package com.zhgd.xmgl.modules.weight.entity;
import java.io.Serializable;
import java.util.Date;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.format.annotation.DateTimeFormat;
import org.jeecgframework.poi.excel.annotation.Excel;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.jeecgframework.poi.excel.annotation.Excel;
import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serializable;
/**
* @Description: 过磅预约车辆信息
* @author pds
@ -19,62 +21,97 @@ import io.swagger.annotations.ApiModelProperty;
*/
@Data
@TableName("weigh_book_vehicle_info")
@ApiModel(value="WeighBookVehicleInfo实体类",description="WeighBookVehicleInfo")
@ApiModel(value = "WeighBookVehicleInfo实体类", description = "WeighBookVehicleInfo")
public class WeighBookVehicleInfo implements Serializable {
private static final long serialVersionUID = 1L;
/**主键id*/
/**
* 主键id
*/
@TableId(type = IdType.ASSIGN_ID)
@ApiModelProperty(value="主键id")
private java.lang.Long id ;
/**车牌号码*/
@ApiModelProperty(value = "主键id")
private java.lang.Long id;
/**
* 车牌号码
*/
@Excel(name = "车牌号码", width = 15)
@ApiModelProperty(value="车牌号码")
private java.lang.String licensePlate ;
/**发货单位*/
@ApiModelProperty(value = "车牌号码")
private java.lang.String licensePlate;
/**
* 发货单位
*/
@Excel(name = "发货单位", width = 15)
@ApiModelProperty(value="发货单位")
private java.lang.String forwardingUnit ;
/**收货单位*/
@ApiModelProperty(value = "发货单位")
private java.lang.String forwardingUnit;
/**
* 收货单位
*/
@Excel(name = "收货单位", width = 15)
@ApiModelProperty(value="收货单位")
private java.lang.String receivingUnit ;
/**货名*/
@ApiModelProperty(value = "收货单位")
private java.lang.String receivingUnit;
/**
* 货名
*/
@Excel(name = "货名", width = 15)
@ApiModelProperty(value="货名")
private java.lang.String goodsName ;
/**规格*/
@ApiModelProperty(value = "货名")
private java.lang.String goodsName;
/**
* 规格
*/
@Excel(name = "规格", width = 15)
@ApiModelProperty(value="规格")
private java.lang.String specifications ;
/**备注*/
@ApiModelProperty(value = "规格")
private java.lang.String specifications;
/**
* 备注
*/
@Excel(name = "备注", width = 15)
@ApiModelProperty(value="备注")
private java.lang.String reserve ;
/**过磅类型*/
@ApiModelProperty(value = "备注")
private java.lang.String reserve;
/**
* 过磅类型
*/
@Excel(name = "过磅类型", width = 15)
@ApiModelProperty(value="过磅类型")
private java.lang.Integer weighingType ;
/**录入时间*/
@ApiModelProperty(value = "过磅类型")
private java.lang.Integer weighingType;
/**
* 录入时间
*/
@Excel(name = "录入时间", width = 20, format = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value="录入时间")
private java.util.Date addDateTime ;
/**创建时间*/
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "录入时间")
private java.util.Date addDateTime;
/**
* 创建时间
*/
@Excel(name = "创建时间", width = 20, format = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value="创建时间")
private java.util.Date createTime ;
/**更新时间*/
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "创建时间")
private java.util.Date createTime;
/**
* 更新时间
*/
@Excel(name = "更新时间", width = 20, format = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value="更新时间")
private java.util.Date updateTime ;
/**所属项目SN*/
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "更新时间")
private java.util.Date updateTime;
/**
* 所属项目SN
*/
@Excel(name = "所属项目SN", width = 15)
@ApiModelProperty(value="所属项目SN")
private java.lang.String projectSn ;
@ApiModelProperty(value = "所属项目SN")
private java.lang.String projectSn;
/**
* 现场上次拉取的时间
*/
@TableField(exist = false)
private String lastAddTime;
/**
* 上次查询的id查询这个id数据之后的数据不返回这条id数据
*/
@TableField(exist = false)
private Long lastQueryId;
}

View File

@ -1,8 +1,12 @@
package com.zhgd.xmgl.modules.weight.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.zhgd.jeecg.common.api.vo.Result;
import com.zhgd.xmgl.modules.weight.entity.WeighBookVehicleInfo;
import com.baomidou.mybatisplus.extension.service.IService;
import javax.servlet.http.HttpServletRequest;
/**
* @Description: 过磅预约车辆信息
* @author pds
@ -11,4 +15,5 @@ import com.baomidou.mybatisplus.extension.service.IService;
*/
public interface IWeighBookVehicleInfoService extends IService<WeighBookVehicleInfo> {
Result<IPage<WeighBookVehicleInfo>> queryPageList(WeighBookVehicleInfo weighBookVehicleInfo, Integer pageNo, Integer pageSize, HttpServletRequest req);
}

View File

@ -1,11 +1,19 @@
package com.zhgd.xmgl.modules.weight.service.impl;
import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUtil;
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.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zhgd.jeecg.common.api.vo.Result;
import com.zhgd.xmgl.modules.weight.entity.WeighBookVehicleInfo;
import com.zhgd.xmgl.modules.weight.mapper.WeighBookVehicleInfoMapper;
import com.zhgd.xmgl.modules.weight.service.IWeighBookVehicleInfoService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import javax.servlet.http.HttpServletRequest;
/**
* @Description: 过磅预约车辆信息
@ -16,4 +24,28 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@Service
public class WeighBookVehicleInfoServiceImpl extends ServiceImpl<WeighBookVehicleInfoMapper, WeighBookVehicleInfo> implements IWeighBookVehicleInfoService {
@Override
public Result queryPageList(WeighBookVehicleInfo weighBookVehicleInfo, Integer pageNo, Integer pageSize, HttpServletRequest req) {
if (StringUtils.isBlank(weighBookVehicleInfo.getProjectSn())) {
return Result.error("projectSn不能为空");
}
String lastAdddatetime = weighBookVehicleInfo.getLastAddTime();
Long lastQueryId = weighBookVehicleInfo.getLastQueryId();
Result<IPage<WeighBookVehicleInfo>> result = new Result<IPage<WeighBookVehicleInfo>>();
LambdaQueryWrapper<WeighBookVehicleInfo> queryWrapper = new LambdaQueryWrapper<WeighBookVehicleInfo>()
.eq(StringUtils.isNotBlank(weighBookVehicleInfo.getProjectSn()), WeighBookVehicleInfo::getProjectSn, weighBookVehicleInfo.getProjectSn())
.like(StringUtils.isNotBlank(weighBookVehicleInfo.getSpecifications()), WeighBookVehicleInfo::getSpecifications, weighBookVehicleInfo.getSpecifications())
.like(StringUtils.isNotBlank(weighBookVehicleInfo.getGoodsName()), WeighBookVehicleInfo::getGoodsName, weighBookVehicleInfo.getGoodsName())
.like(StringUtils.isNotBlank(weighBookVehicleInfo.getLicensePlate()), WeighBookVehicleInfo::getLicensePlate, weighBookVehicleInfo.getLicensePlate())
.gt(lastQueryId != null, WeighBookVehicleInfo::getId, lastQueryId);
if (StringUtils.isNotBlank(lastAdddatetime)) {
DateTime dateTime = DateUtil.parse(lastAdddatetime);
queryWrapper.ge(WeighBookVehicleInfo::getAddDateTime, dateTime);
}
Page<WeighBookVehicleInfo> page = new Page<WeighBookVehicleInfo>(pageNo, pageSize);
IPage<WeighBookVehicleInfo> pageList = page(page, queryWrapper);
result.setSuccess(true);
result.setResult(pageList);
return result;
}
}