diff --git a/src/main/java/com/zhgd/xmgl/modules/weight/controller/WeighPicController.java b/src/main/java/com/zhgd/xmgl/modules/weight/controller/WeighPicController.java index 7cd265b53..f67bb2d70 100644 --- a/src/main/java/com/zhgd/xmgl/modules/weight/controller/WeighPicController.java +++ b/src/main/java/com/zhgd/xmgl/modules/weight/controller/WeighPicController.java @@ -74,6 +74,14 @@ public class WeighPicController { return result; } + @ApiOperation(value = " 列表查询称重图片信息", httpMethod = "GET") + @GetMapping(value = "/list/condition") + public Result> queryList(WeighPic weighPic, + HttpServletRequest req) { + QueryWrapper queryWrapper = QueryGenerator.initQueryWrapper(weighPic, req.getParameterMap()); + return Result.success(weighPicService.list(queryWrapper)); + } + /** * 添加 * @@ -83,16 +91,7 @@ public class WeighPicController { @ApiOperation(value = " 添加称重图片信息", notes = "添加称重图片信息", httpMethod = "POST") @PostMapping(value = "/add") public Result add(@RequestBody WeighPic weighPic) { - Result result = new Result(); - try { - weighPicService.save(weighPic); - result.success("添加成功!"); - } catch (Exception e) { - e.printStackTrace(); - log.info(e.getMessage()); - result.error500("操作失败"); - } - return result; + return weighPicService.add(weighPic); } /** diff --git a/src/main/java/com/zhgd/xmgl/modules/weight/entity/WeighInfo.java b/src/main/java/com/zhgd/xmgl/modules/weight/entity/WeighInfo.java index 4dec5a9af..092b8ab82 100644 --- a/src/main/java/com/zhgd/xmgl/modules/weight/entity/WeighInfo.java +++ b/src/main/java/com/zhgd/xmgl/modules/weight/entity/WeighInfo.java @@ -1,16 +1,16 @@ 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.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 @@ -85,14 +85,22 @@ public class WeighInfo implements Serializable { @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") @ApiModelProperty(value="一磅时间") private java.util.Date aCheckTime ; - /**二磅时间*/ + /** + * 二磅时间 + */ @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 bCheckTime ; - /**所属项目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 bCheckTime; + /** + * 所属项目SN + */ @Excel(name = "所属项目SN", width = 15) - @ApiModelProperty(value="所属项目SN") - private java.lang.String projectSn ; + @ApiModelProperty(value = "所属项目SN") + private java.lang.String projectSn; + /** + * 远程现场的weighdata_info的id + */ + private java.lang.String removeWeighdataInfoId; } diff --git a/src/main/java/com/zhgd/xmgl/modules/weight/entity/WeighPic.java b/src/main/java/com/zhgd/xmgl/modules/weight/entity/WeighPic.java index 4fe5573e1..cd0eafd96 100644 --- a/src/main/java/com/zhgd/xmgl/modules/weight/entity/WeighPic.java +++ b/src/main/java/com/zhgd/xmgl/modules/weight/entity/WeighPic.java @@ -1,6 +1,7 @@ package com.zhgd.xmgl.modules.weight.entity; 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 com.fasterxml.jackson.annotation.JsonFormat; @@ -35,7 +36,7 @@ public class WeighPic implements Serializable { */ @Excel(name = "称重记录ID", width = 15) @ApiModelProperty(value = "称重记录ID") - private java.lang.Integer weighDataInfoId; + private java.lang.Long weighDataInfoId; /** * 重车图片1 */ @@ -54,6 +55,7 @@ public class WeighPic implements Serializable { @Excel(name = "重车图片3", width = 15) @ApiModelProperty(value = "重车图片3") private java.lang.String fullPic3; + private java.lang.String fullPic4; /** * 空车图片1 */ @@ -72,6 +74,7 @@ public class WeighPic implements Serializable { @Excel(name = "空车图片3", width = 15) @ApiModelProperty(value = "空车图片3") private java.lang.String emptyPic3; + private java.lang.String emptyPic4; /** * 录入时间 */ @@ -94,4 +97,10 @@ public class WeighPic implements Serializable { @Excel(name = "备注", width = 15) @ApiModelProperty(value = "备注") private java.lang.String remarks; + + /** + * 远程现场的weighdata_info的id + */ + @TableField(exist = false) + private java.lang.String removeWeighdataInfoId; } diff --git a/src/main/java/com/zhgd/xmgl/modules/weight/service/IWeighPicService.java b/src/main/java/com/zhgd/xmgl/modules/weight/service/IWeighPicService.java index 5bdd0b33f..56f29f0b8 100644 --- a/src/main/java/com/zhgd/xmgl/modules/weight/service/IWeighPicService.java +++ b/src/main/java/com/zhgd/xmgl/modules/weight/service/IWeighPicService.java @@ -1,5 +1,6 @@ package com.zhgd.xmgl.modules.weight.service; +import com.zhgd.jeecg.common.api.vo.Result; import com.zhgd.xmgl.modules.weight.entity.WeighPic; import com.baomidou.mybatisplus.extension.service.IService; @@ -11,4 +12,5 @@ import com.baomidou.mybatisplus.extension.service.IService; */ public interface IWeighPicService extends IService { + Result add(WeighPic weighPic); } diff --git a/src/main/java/com/zhgd/xmgl/modules/weight/service/impl/WeighPicServiceImpl.java b/src/main/java/com/zhgd/xmgl/modules/weight/service/impl/WeighPicServiceImpl.java index 5d11f31d5..c19a96d61 100644 --- a/src/main/java/com/zhgd/xmgl/modules/weight/service/impl/WeighPicServiceImpl.java +++ b/src/main/java/com/zhgd/xmgl/modules/weight/service/impl/WeighPicServiceImpl.java @@ -1,19 +1,44 @@ package com.zhgd.xmgl.modules.weight.service.impl; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.zhgd.jeecg.common.api.vo.Result; +import com.zhgd.xmgl.modules.weight.entity.WeighInfo; import com.zhgd.xmgl.modules.weight.entity.WeighPic; +import com.zhgd.xmgl.modules.weight.mapper.WeighInfoMapper; import com.zhgd.xmgl.modules.weight.mapper.WeighPicMapper; import com.zhgd.xmgl.modules.weight.service.IWeighPicService; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; - /** * @Description: 称重图片 * @author: pds - * @date: 2023-03-21 + * @date: 2023-03-21 * @version: V1.0 */ @Service +@Slf4j public class WeighPicServiceImpl extends ServiceImpl implements IWeighPicService { + @Autowired + private WeighInfoMapper weighInfoMapper; + @Override + public Result add(WeighPic weighPic) { + WeighInfo weighInfo = weighInfoMapper.selectOne(new LambdaQueryWrapper().eq(WeighInfo::getRemoveWeighdataInfoId, weighPic.getRemoveWeighdataInfoId())); + if (weighInfo != null) { + weighPic.setWeighDataInfoId(weighInfo.getId()); + } + Result result = new Result(); + try { + save(weighPic); + result.success("添加成功!"); + } catch (Exception e) { + e.printStackTrace(); + log.info(e.getMessage()); + result.error500("操作失败"); + } + return result; + } } diff --git a/src/main/resources/jeecg/code-template/one/java/${bussiPackage}/${entityPackage}/controller/${entityName}Controller.javai b/src/main/resources/jeecg/code-template/one/java/${bussiPackage}/${entityPackage}/controller/${entityName}Controller.javai index 07627beef..e3e26be83 100644 --- a/src/main/resources/jeecg/code-template/one/java/${bussiPackage}/${entityPackage}/controller/${entityName}Controller.javai +++ b/src/main/resources/jeecg/code-template/one/java/${bussiPackage}/${entityPackage}/controller/${entityName}Controller.javai @@ -61,7 +61,7 @@ public class ${entityName}Controller { * @return */ @ApiOperation(value = " 分页列表查询${tableVo.ftlDescription}信息", notes = "分页列表查询${tableVo.ftlDescription}信息", httpMethod="GET") - @GetMapping(value = "/list") + @GetMapping(value = "/page") public Result> queryPageList(${entityName} ${entityName?uncap_first}, @RequestParam(name="pageNo", defaultValue="1") Integer pageNo, @RequestParam(name="pageSize", defaultValue="10") Integer pageSize, @@ -74,7 +74,24 @@ public class ${entityName}Controller { result.setResult(pageList); return result; } - + + /** + * 列表查询 + * @param ${entityName?uncap_first} + * @param pageNo 页码 + * @param pageSize 条数 + * @param req + * @return + */ + @ApiOperation(value = " 列表查询${tableVo.ftlDescription}信息", notes = "列表查询${tableVo.ftlDescription}信息", httpMethod="GET") + @GetMapping(value = "/list") + public Result> queryList(${entityName} ${entityName?uncap_first}, + HttpServletRequest req) { + + QueryWrapper<${entityName}> queryWrapper = QueryGenerator.initQueryWrapper(${entityName?uncap_first}, req.getParameterMap()); + return Result.success(${entityName?uncap_first}Service.list(queryWrapper)); + } + /** * 添加 * @param ${entityName?uncap_first}