吉安感知网项目-后端
xiebin
2026-01-12 2cd4bf987f9e98023bb9e44d3bd94d889e000b66
add-框架查询定义
3 files modified
3 files added
99 ■■■■■ changed files
drone-common/src/main/java/org/sxkj/common/model/GenericConverter.java 28 ●●●●● patch | view | raw | blame | history
drone-service/drone-fw/src/main/java/org/sxkj/fw/device/controller/FwDeviceController.java 11 ●●●●● patch | view | raw | blame | history
drone-service/drone-fw/src/main/java/org/sxkj/fw/device/entity/FwDeviceEntity.java 6 ●●●●● patch | view | raw | blame | history
drone-service/drone-fw/src/main/java/org/sxkj/fw/device/param/FwDeviceDetailParam.java 21 ●●●●● patch | view | raw | blame | history
drone-service/drone-fw/src/main/java/org/sxkj/fw/device/param/FwDevicePageParam.java 32 ●●●●● patch | view | raw | blame | history
drone-service/drone-fw/src/main/java/org/sxkj/fw/device/wrapper/FwDeviceWrapper.java 1 ●●●● patch | view | raw | blame | history
drone-common/src/main/java/org/sxkj/common/model/GenericConverter.java
New file
@@ -0,0 +1,28 @@
package org.sxkj.common.model;
import org.springblade.core.tool.utils.BeanUtil;
import java.io.Serializable;
/**
 * @Description 通用转换工具类
 * @Author AIX
 * @Date 2026/1/12 10:22
 * @Version 1.0
 */
public class GenericConverter implements Serializable {
    private static final long serialVersionUID = 1L;
    public static <S, T> T convert(S source, Class<T> targetType) {
        T target = BeanUtil.newInstance(targetType);
        BeanUtil.copy(source, target);
        return target;
    }
    public static <S, T> T copy(S source, T target) {
        BeanUtil.copy(source, target);
        return target;
    }
}
drone-service/drone-fw/src/main/java/org/sxkj/fw/device/controller/FwDeviceController.java
@@ -33,9 +33,12 @@
import org.springblade.core.tool.utils.DateUtil;
import org.springblade.core.tool.utils.Func;
import org.springframework.web.bind.annotation.*;
import org.sxkj.common.model.GenericConverter;
import org.sxkj.fw.device.dto.FwDeviceDTO;
import org.sxkj.fw.device.entity.FwDeviceEntity;
import org.sxkj.fw.device.excel.FwDeviceExcel;
import org.sxkj.fw.device.param.FwDeviceDetailParam;
import org.sxkj.fw.device.param.FwDevicePageParam;
import org.sxkj.fw.device.service.IFwDeviceService;
import org.sxkj.fw.device.vo.FwDeviceVO;
import org.sxkj.fw.device.wrapper.FwDeviceWrapper;
@@ -66,8 +69,8 @@
    @GetMapping("/detail")
    @ApiOperationSupport(order = 1)
    @ApiOperation(value = "详情", notes = "传入fwDevice")
    public R<FwDeviceVO> detail(FwDeviceDTO fwDevice) {
        FwDeviceEntity detail = fwDeviceService.getOne(Condition.getQueryWrapper(FwDeviceWrapper.build().entityDTO(fwDevice)));
    public R<FwDeviceVO> detail(@Valid FwDeviceDetailParam fwDevice) {
        FwDeviceEntity detail = fwDeviceService.getOne(Condition.getQueryWrapper(GenericConverter.convert(fwDevice, FwDeviceEntity.class)));
        if (detail == null) {
            return R.fail("该设备不存在");
@@ -82,8 +85,8 @@
    @GetMapping("/page")
    @ApiOperationSupport(order = 2)
    @ApiOperation(value = "分页", notes = "传入fwDevice")
    public R<IPage<FwDeviceVO>> page(FwDeviceDTO fwDevice, Query query) {
        IPage<FwDeviceEntity> pages = fwDeviceService.selectFwDevicePage(Condition.getPage(query), fwDevice);
    public R<IPage<FwDeviceVO>> page(FwDevicePageParam fwDevice, Query query) {
        IPage<FwDeviceEntity> pages = fwDeviceService.selectFwDevicePage(Condition.getPage(query), GenericConverter.convert(fwDevice, FwDeviceDTO.class));
        return R.data(FwDeviceWrapper.build().pageVO(pages));
    }
drone-service/drone-fw/src/main/java/org/sxkj/fw/device/entity/FwDeviceEntity.java
@@ -38,6 +38,12 @@
public class FwDeviceEntity extends BaseEntity {
    /**
     * 设备sn
     */
    @ApiModelProperty(value = "设备sn")
    private String deviceSn;
    /**
     * 设备名称
     */
    @ApiModelProperty(value = "设备名称")
drone-service/drone-fw/src/main/java/org/sxkj/fw/device/param/FwDeviceDetailParam.java
New file
@@ -0,0 +1,21 @@
package org.sxkj.fw.device.param;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotBlank;
/**
 * @Description 创建设备详情查询参数类
 * @Author AIX
 * @Date 2026/1/12 10:33
 * @Version 1.0
 */
@Data
public class FwDeviceDetailParam {
    @ApiModelProperty(value = "主键")
    @NotBlank
    private    Long id;
}
drone-service/drone-fw/src/main/java/org/sxkj/fw/device/param/FwDevicePageParam.java
New file
@@ -0,0 +1,32 @@
package org.sxkj.fw.device.param;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
 * @Description 创建设备分页查询参数类
 * @Author AIX
 * @Date 2026/1/12 10:33
 * @Version 1.0
 */
@Data
public class FwDevicePageParam {
    /**
     * 设备名称
     */
    @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/wrapper/FwDeviceWrapper.java
@@ -44,5 +44,4 @@
        return Objects.requireNonNull(BeanUtil.copy(fwDevice, FwDeviceEntity.class));
    }
}