drone-service/drone-fw/src/main/java/org/sxkj/fw/device/controller/FwDeviceScrapController.java
@@ -16,34 +16,33 @@ */ package org.sxkj.fw.device.controller; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiParam; import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; import lombok.AllArgsConstructor; import javax.validation.Valid; import org.springblade.core.secure.BladeUser; import org.springblade.core.mp.support.Condition; import org.springblade.core.mp.support.Query; import org.springblade.core.tool.api.R; import org.springblade.core.tool.utils.Func; import org.springframework.web.bind.annotation.*; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import org.sxkj.fw.device.entity.FwDeviceScrapEntity; import org.sxkj.fw.device.vo.FwDeviceScrapVO; import org.sxkj.fw.device.excel.FwDeviceScrapExcel; import org.sxkj.fw.device.wrapper.FwDeviceScrapWrapper; import org.sxkj.fw.device.service.IFwDeviceScrapService; import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import lombok.AllArgsConstructor; import org.springblade.core.boot.ctrl.BladeController; import org.springblade.core.tool.utils.DateUtil; import org.springblade.core.excel.util.ExcelUtil; import org.springblade.core.mp.support.Condition; import org.springblade.core.mp.support.Query; import org.springblade.core.secure.BladeUser; import org.springblade.core.tool.api.R; import org.springblade.core.tool.constant.BladeConstant; import org.springblade.core.tool.utils.DateUtil; import org.springframework.web.bind.annotation.*; import org.sxkj.fw.device.dto.FwDeviceScrapDTO; import org.sxkj.fw.device.entity.FwDeviceScrapEntity; import org.sxkj.fw.device.excel.FwDeviceScrapExcel; import org.sxkj.fw.device.service.IFwDeviceScrapService; import org.sxkj.fw.device.vo.FwDeviceScrapVO; import org.sxkj.fw.device.wrapper.FwDeviceScrapWrapper; import springfox.documentation.annotations.ApiIgnore; import java.util.Map; import java.util.List; import javax.servlet.http.HttpServletResponse; import javax.validation.Valid; import java.util.List; import java.util.Map; /** * 设备报废记录表 控制器 @@ -65,19 +64,19 @@ @GetMapping("/detail") @ApiOperationSupport(order = 1) @ApiOperation(value = "详情", notes = "传入fwDeviceScrap") public R<FwDeviceScrapVO> detail(FwDeviceScrapEntity fwDeviceScrap) { FwDeviceScrapEntity detail = fwDeviceScrapService.getOne(Condition.getQueryWrapper(fwDeviceScrap)); public R<FwDeviceScrapVO> detail(FwDeviceScrapDTO fwDeviceScrap) { if (fwDeviceScrap.getId() == null) { return R.fail("参数错误"); } FwDeviceScrapEntity detail = fwDeviceScrapService.getOne( Condition.getQueryWrapper( FwDeviceScrapWrapper.build().entityDTO(fwDeviceScrap))); if (detail == null) { return R.fail("数据不存在"); } return R.data(FwDeviceScrapWrapper.build().entityVO(detail)); } /** * 设备报废记录表 分页 */ @GetMapping("/list") @ApiOperationSupport(order = 2) @ApiOperation(value = "分页", notes = "传入fwDeviceScrap") public R<IPage<FwDeviceScrapVO>> list(@ApiIgnore @RequestParam Map<String, Object> fwDeviceScrap, Query query) { IPage<FwDeviceScrapEntity> pages = fwDeviceScrapService.page(Condition.getPage(query), Condition.getQueryWrapper(fwDeviceScrap, FwDeviceScrapEntity.class)); return R.data(FwDeviceScrapWrapper.build().pageVO(pages)); } /** @@ -86,7 +85,7 @@ @GetMapping("/page") @ApiOperationSupport(order = 3) @ApiOperation(value = "分页", notes = "传入fwDeviceScrap") public R<IPage<FwDeviceScrapVO>> page(FwDeviceScrapVO fwDeviceScrap, Query query) { public R<IPage<FwDeviceScrapVO>> page(FwDeviceScrapDTO fwDeviceScrap, Query query) { IPage<FwDeviceScrapVO> pages = fwDeviceScrapService.selectFwDeviceScrapPage(Condition.getPage(query), fwDeviceScrap); return R.data(pages); } @@ -96,41 +95,15 @@ */ @PostMapping("/save") @ApiOperationSupport(order = 4) @ApiOperation(value = "新增", notes = "传入fwDeviceScrap") public R save(@Valid @RequestBody FwDeviceScrapEntity fwDeviceScrap) { return R.status(fwDeviceScrapService.save(fwDeviceScrap)); } @ApiOperation(value = "新增报废记录", notes = "传入fwDeviceScrap,deviceId必填") public R save(@Valid @RequestBody FwDeviceScrapDTO fwDeviceScrap) { /** * 设备报废记录表 修改 */ @PostMapping("/update") @ApiOperationSupport(order = 5) @ApiOperation(value = "修改", notes = "传入fwDeviceScrap") public R update(@Valid @RequestBody FwDeviceScrapEntity fwDeviceScrap) { return R.status(fwDeviceScrapService.updateById(fwDeviceScrap)); } if (fwDeviceScrap.getDeviceId() == null) { return R.fail("参数错误"); } /** * 设备报废记录表 新增或修改 */ @PostMapping("/submit") @ApiOperationSupport(order = 6) @ApiOperation(value = "新增或修改", notes = "传入fwDeviceScrap") public R submit(@Valid @RequestBody FwDeviceScrapEntity fwDeviceScrap) { return R.status(fwDeviceScrapService.saveOrUpdate(fwDeviceScrap)); return R.status(fwDeviceScrapService.saveFwDeviceScrap(fwDeviceScrap)); } /** * 设备报废记录表 删除 */ @PostMapping("/remove") @ApiOperationSupport(order = 7) @ApiOperation(value = "逻辑删除", notes = "传入ids") public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) { return R.status(fwDeviceScrapService.deleteLogic(Func.toLongList(ids))); } /** * 导出数据 @@ -138,6 +111,7 @@ @GetMapping("/export-fwDeviceScrap") @ApiOperationSupport(order = 9) @ApiOperation(value = "导出数据", notes = "传入fwDeviceScrap") @ApiIgnore public void exportFwDeviceScrap(@ApiIgnore @RequestParam Map<String, Object> fwDeviceScrap, BladeUser bladeUser, HttpServletResponse response) { QueryWrapper<FwDeviceScrapEntity> queryWrapper = Condition.getQueryWrapper(fwDeviceScrap, FwDeviceScrapEntity.class); //if (!AuthUtil.isAdministrator()) { drone-service/drone-fw/src/main/java/org/sxkj/fw/device/dto/FwDeviceScrapDTO.java
@@ -16,9 +16,14 @@ */ package org.sxkj.fw.device.dto; import com.baomidou.mybatisplus.annotation.TableField; import io.swagger.annotations.ApiModelProperty; import org.sxkj.fw.device.entity.FwDeviceScrapEntity; import lombok.Data; import lombok.EqualsAndHashCode; import java.io.Serializable; import java.util.Date; /** * 设备报废记录表 数据传输对象实体类 @@ -27,8 +32,40 @@ * @since 2026-01-08 */ @Data @EqualsAndHashCode(callSuper = true) public class FwDeviceScrapDTO extends FwDeviceScrapEntity { public class FwDeviceScrapDTO implements Serializable { private static final long serialVersionUID = 1L; @ApiModelProperty(value = "主键") private Long id; /** * 设备ID(关联ja_fw_device.id) */ @ApiModelProperty(value = "设备ID") private Long deviceId; /** * 报废时间 */ @ApiModelProperty(value = "报废时间") private Date scrapTime; /** * 报废原因 */ @ApiModelProperty(value = "报废原因") private String scrapReason; /** * 处置方式 */ @ApiModelProperty(value = "处置方式") private String disposeWay; // 查询使用 @ApiModelProperty(value = "设备名称") private String deviceName; @ApiModelProperty(value = "设备类型") private String deviceType; @ApiModelProperty(value = "所属部门") private Long belongDept; } drone-service/drone-fw/src/main/java/org/sxkj/fw/device/mapper/FwDeviceScrapMapper.java
@@ -16,13 +16,15 @@ */ package org.sxkj.fw.device.mapper; import org.sxkj.fw.device.entity.FwDeviceScrapEntity; import org.sxkj.fw.device.vo.FwDeviceScrapVO; import org.sxkj.fw.device.excel.FwDeviceScrapExcel; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.conditions.Wrapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.metadata.IPage; import org.apache.ibatis.annotations.Param; import org.sxkj.fw.device.dto.FwDeviceScrapDTO; import org.sxkj.fw.device.entity.FwDeviceScrapEntity; import org.sxkj.fw.device.excel.FwDeviceScrapExcel; import org.sxkj.fw.device.vo.FwDeviceScrapVO; import java.util.List; /** @@ -34,13 +36,20 @@ public interface FwDeviceScrapMapper extends BaseMapper<FwDeviceScrapEntity> { /** * 获取详情 * @param id 计划id * @return 计划详情 */ FwDeviceScrapVO getFwDeviceScrapById(@Param("id") Long id); /** * 自定义分页 * * @param page * @param fwDeviceScrap * @return */ List<FwDeviceScrapVO> selectFwDeviceScrapPage(IPage page, FwDeviceScrapVO fwDeviceScrap); List<FwDeviceScrapVO> selectFwDeviceScrapPage(IPage page, FwDeviceScrapDTO fwDeviceScrap); /** drone-service/drone-fw/src/main/java/org/sxkj/fw/device/mapper/FwDeviceScrapMapper.xml
@@ -3,65 +3,75 @@ <mapper namespace="org.sxkj.fw.device.mapper.FwDeviceScrapMapper"> <!-- 通用查询映射结果 --> <resultMap id="fwDeviceScrapResultMap" type="org.sxkj.fw.device.entity.FwDeviceScrapEntity"> <resultMap id="fwDeviceScrapResultMap" type="org.sxkj.fw.device.vo.FwDeviceScrapVO"> <result column="id" property="id"/> <result column="device_id" property="deviceId"/> <result column="scrap_time" property="scrapTime"/> <result column="scrap_reason" property="scrapReason"/> <result column="dispose_way" property="disposeWay"/> <result column="area_code" property="areaCode"/> <result column="create_user" property="createUser"/> <result column="create_dept" property="createDept"/> <result column="create_time" property="createTime"/> <result column="update_user" property="updateUser"/> <result column="update_time" property="updateTime"/> <result column="status" property="status"/> <result column="is_deleted" property="isDeleted"/> <result column="device_name" property="deviceName"/> <result column="device_type" property="deviceType"/> <result column="device_att" property="deviceAtt"/> <result column="device_model" property="deviceModel"/> <result column="belong_dept" property="belongDept"/> <result column="device_specification" property="deviceSpecification"/> <result column="manufacturer" property="manufacturer"/> <result column="source" property="source"/> <result column="purpose" property="purpose"/> </resultMap> <select id="getFwDeviceScrapById" resultMap="fwDeviceScrapResultMap"> select b.device_name, b.device_type, b.device_att, b.device_model, b.belong_dept, b.device_specification, b.manufacturer, b.source, b.purpose, a.* from ja_fw_device_scrap a left join ja_fw_device b on (a.device_id = b.id) <where> a.is_deleted = 0 <if test="id != null and id != ''"> and a.id = #{id} </if> </where> limit 1 </select> <select id="selectFwDeviceScrapPage" resultMap="fwDeviceScrapResultMap"> select * from ja_fw_device_scrap select b.device_name, b.device_type, b.device_att, b.device_model, b.belong_dept, b.device_specification, b.manufacturer, b.source, b.purpose, a.* from ja_fw_device_scrap a left join ja_fw_device b on (a.device_id = b.id) <where> is_deleted = 0 <if test="param2.id != null and param2.id != ''"> and id = #{param2.id} </if> a.is_deleted = 0 <if test="param2.deviceId != null and param2.deviceId != ''"> and device_id = #{param2.deviceId} </if> <if test="param2.scrapTime != null and param2.scrapTime != ''"> and scrap_time = #{param2.scrapTime} <if test="param2.deviceName != null and param2.deviceName != ''"> and device_name like concat('%',#{param2.deviceName},'%') </if> <if test="param2.scrapReason != null and param2.scrapReason != ''"> and scrap_reason = #{param2.scrapReason} <if test="param2.deviceType != null and param2.deviceType != ''"> and device_type = #{param2.deviceType} </if> <if test="param2.disposeWay != null and param2.disposeWay != ''"> and dispose_way = #{param2.disposeWay} </if> <if test="param2.areaCode != null and param2.areaCode != ''"> and area_code = #{param2.areaCode} </if> <if test="param2.createUser != null and param2.createUser != ''"> and create_user = #{param2.createUser} </if> <if test="param2.createDept != null and param2.createDept != ''"> and create_dept = #{param2.createDept} </if> <if test="param2.createTime != null and param2.createTime != ''"> and create_time = #{param2.createTime} </if> <if test="param2.updateUser != null and param2.updateUser != ''"> and update_user = #{param2.updateUser} </if> <if test="param2.updateTime != null and param2.updateTime != ''"> and update_time = #{param2.updateTime} </if> <if test="param2.status != null and param2.status != ''"> and status = #{param2.status} </if> <if test="param2.isDeleted != null and param2.isDeleted != ''"> and is_deleted = #{param2.isDeleted} <if test="param2.belongDept != null and param2.belongDept != ''"> and belong_dept = #{param2.belongDept} </if> </where> </select> drone-service/drone-fw/src/main/java/org/sxkj/fw/device/service/IFwDeviceScrapService.java
@@ -17,11 +17,13 @@ package org.sxkj.fw.device.service; import com.baomidou.mybatisplus.core.conditions.Wrapper; import org.sxkj.fw.device.entity.FwDeviceScrapEntity; import org.sxkj.fw.device.vo.FwDeviceScrapVO; import org.sxkj.fw.device.excel.FwDeviceScrapExcel; import com.baomidou.mybatisplus.core.metadata.IPage; import org.springblade.core.mp.base.BaseService; import org.sxkj.fw.device.dto.FwDeviceScrapDTO; import org.sxkj.fw.device.entity.FwDeviceScrapEntity; import org.sxkj.fw.device.excel.FwDeviceScrapExcel; import org.sxkj.fw.device.vo.FwDeviceScrapVO; import java.util.List; /** @@ -31,6 +33,14 @@ * @since 2026-01-08 */ public interface IFwDeviceScrapService extends BaseService<FwDeviceScrapEntity> { /** * 新增报废记录 * @param dto 报废记录 * @return true/false */ boolean saveFwDeviceScrap(FwDeviceScrapDTO dto); /** * 自定义分页 * @@ -38,7 +48,7 @@ * @param fwDeviceScrap * @return */ IPage<FwDeviceScrapVO> selectFwDeviceScrapPage(IPage<FwDeviceScrapVO> page, FwDeviceScrapVO fwDeviceScrap); IPage<FwDeviceScrapVO> selectFwDeviceScrapPage(IPage<FwDeviceScrapVO> page, FwDeviceScrapDTO fwDeviceScrap); /** drone-service/drone-fw/src/main/java/org/sxkj/fw/device/service/impl/FwDeviceScrapServiceImpl.java
@@ -16,15 +16,22 @@ */ package org.sxkj.fw.device.service.impl; import com.baomidou.mybatisplus.core.conditions.Wrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import lombok.AllArgsConstructor; import org.springblade.core.mp.base.BaseServiceImpl; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.sxkj.fw.device.dto.FwDeviceScrapDTO; import org.sxkj.fw.device.entity.FwDeviceEntity; import org.sxkj.fw.device.entity.FwDeviceScrapEntity; import org.sxkj.fw.device.vo.FwDeviceScrapVO; import org.sxkj.fw.device.excel.FwDeviceScrapExcel; import org.sxkj.fw.device.mapper.FwDeviceScrapMapper; import org.sxkj.fw.device.service.IFwDeviceScrapService; import org.springframework.stereotype.Service; import com.baomidou.mybatisplus.core.conditions.Wrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import org.springblade.core.mp.base.BaseServiceImpl; import org.sxkj.fw.device.service.IFwDeviceService; import org.sxkj.fw.device.vo.FwDeviceScrapVO; import org.sxkj.fw.device.wrapper.FwDeviceScrapWrapper; import java.util.List; /** @@ -34,10 +41,26 @@ * @since 2026-01-08 */ @Service @AllArgsConstructor public class FwDeviceScrapServiceImpl extends BaseServiceImpl<FwDeviceScrapMapper, FwDeviceScrapEntity> implements IFwDeviceScrapService { private final IFwDeviceService fwDeviceService; @Override public IPage<FwDeviceScrapVO> selectFwDeviceScrapPage(IPage<FwDeviceScrapVO> page, FwDeviceScrapVO fwDeviceScrap) { @Transactional public boolean saveFwDeviceScrap(FwDeviceScrapDTO dto) { boolean isSuccess = super.save(FwDeviceScrapWrapper.build().entityDTO(dto)); if (isSuccess) { FwDeviceEntity fwDevice = new FwDeviceEntity(); fwDevice.setId(dto.getDeviceId()); fwDevice.setStatus(3); isSuccess = fwDeviceService.updateById(fwDevice); } return isSuccess; } @Override public IPage<FwDeviceScrapVO> selectFwDeviceScrapPage(IPage<FwDeviceScrapVO> page, FwDeviceScrapDTO fwDeviceScrap) { return page.setRecords(baseMapper.selectFwDeviceScrapPage(page, fwDeviceScrap)); } drone-service/drone-fw/src/main/java/org/sxkj/fw/device/vo/FwDeviceMaintainPlanVO.java
@@ -52,6 +52,7 @@ @ApiModelProperty(value = "计划周期具体值,数组对象[1,2,3]") private List<String> planCycleValue; // 设备相关 /** * 设备名称 */ drone-service/drone-fw/src/main/java/org/sxkj/fw/device/vo/FwDeviceScrapVO.java
@@ -16,10 +16,14 @@ */ package org.sxkj.fw.device.vo; import io.swagger.annotations.ApiModelProperty; import org.sxkj.fw.device.entity.FwDeviceScrapEntity; import org.springblade.core.tool.node.INode; import lombok.Data; import lombok.EqualsAndHashCode; import java.io.Serializable; import java.util.Date; /** * 设备报废记录表 视图实体类 @@ -28,8 +32,87 @@ * @since 2026-01-08 */ @Data @EqualsAndHashCode(callSuper = true) public class FwDeviceScrapVO extends FwDeviceScrapEntity { public class FwDeviceScrapVO implements Serializable { private static final long serialVersionUID = 1L; @ApiModelProperty(value = "主键") private Long id; /** * 设备ID(关联ja_fw_device.id) */ @ApiModelProperty(value = "设备ID") private Long deviceId; /** * 报废时间 */ @ApiModelProperty(value = "报废时间") private Date scrapTime; /** * 报废原因 */ @ApiModelProperty(value = "报废原因") private String scrapReason; /** * 处置方式 */ @ApiModelProperty(value = "处置方式") private String disposeWay; // 设备相关 /** * 设备名称 */ @ApiModelProperty(value = "设备名称") private String deviceName; /** * 设备类型 */ @ApiModelProperty(value = "设备类型") private String deviceType; /** * 设备属性 */ @ApiModelProperty(value = "设备属性") private String deviceAtt; /** * 设备型号 */ @ApiModelProperty(value = "设备型号") private String deviceModel; /** * 所属部门 */ @ApiModelProperty(value = "所属部门") private Long belongDept; /** * 设备规格 */ @ApiModelProperty(value = "设备规格") private String deviceSpecification; /** * 生产厂商 */ @ApiModelProperty(value = "生产厂商") private String manufacturer; /** * 来源 */ @ApiModelProperty(value = "来源") private String source; /** * 用途 */ @ApiModelProperty(value = "用途") private String purpose; } drone-service/drone-fw/src/main/java/org/sxkj/fw/device/wrapper/FwDeviceScrapWrapper.java
@@ -18,8 +18,10 @@ import org.springblade.core.mp.support.BaseEntityWrapper; import org.springblade.core.tool.utils.BeanUtil; import org.sxkj.fw.device.dto.FwDeviceScrapDTO; import org.sxkj.fw.device.entity.FwDeviceScrapEntity; import org.sxkj.fw.device.vo.FwDeviceScrapVO; import java.util.Objects; /** @@ -36,15 +38,10 @@ @Override public FwDeviceScrapVO entityVO(FwDeviceScrapEntity fwDeviceScrap) { FwDeviceScrapVO fwDeviceScrapVO = Objects.requireNonNull(BeanUtil.copy(fwDeviceScrap, FwDeviceScrapVO.class)); //User createUser = UserCache.getUser(fwDeviceScrap.getCreateUser()); //User updateUser = UserCache.getUser(fwDeviceScrap.getUpdateUser()); //fwDeviceScrapVO.setCreateUserName(createUser.getName()); //fwDeviceScrapVO.setUpdateUserName(updateUser.getName()); return fwDeviceScrapVO; return Objects.requireNonNull(BeanUtil.copy(fwDeviceScrap, FwDeviceScrapVO.class)); } public FwDeviceScrapEntity entityDTO(FwDeviceScrapDTO fwDeviceScrap) { return Objects.requireNonNull(BeanUtil.copy(fwDeviceScrap, FwDeviceScrapEntity.class)); } }