更新字典管理,摄像头管理
parent
c08fec77f5
commit
fa689284db
|
|
@ -1,5 +1,6 @@
|
|||
package com.gunshi.project.xyt.entity.basedata;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import com.gunshi.project.xyt.model.StCameraAreaB;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
|
@ -20,5 +21,7 @@ import java.util.List;
|
|||
@ToString(callSuper = true)
|
||||
public class StCameraAreaTreeVo extends StCameraAreaB implements Serializable {
|
||||
@Schema(description="子对象")
|
||||
private List<StCameraAreaTreeVo> children;
|
||||
private List<StCameraAreaTreeVo> children = Lists.newArrayList();
|
||||
@Schema(description="监控点列表")
|
||||
private List<StCameraVo> cameraList = Lists.newArrayList();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,32 @@
|
|||
package com.gunshi.project.xyt.entity.basedata;
|
||||
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @author Sun Lejun
|
||||
* @version 1.0
|
||||
* @date 2024/1/25
|
||||
*/
|
||||
|
||||
|
||||
@Data
|
||||
@Schema(description = "视频点查询对象")
|
||||
public class StCameraSearch implements Serializable {
|
||||
@Schema(description="关键词:名称")
|
||||
private String keyword;
|
||||
|
||||
@Schema(description="监控点类型")
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long camType;
|
||||
|
||||
@Schema(description="页码")
|
||||
private int page=1;
|
||||
|
||||
@Schema(description="每页条数")
|
||||
private int pageSize=999;
|
||||
}
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
package com.gunshi.project.xyt.entity.basedata;
|
||||
|
||||
import com.gunshi.project.xyt.model.StCameraB;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
|
||||
/**
|
||||
* @author Sun Lejun
|
||||
* @version 1.0
|
||||
* @date 2024/1/25
|
||||
*/
|
||||
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
@ToString(callSuper = true)
|
||||
@Schema(description = "视频点信息返回值")
|
||||
public class StCameraVo extends StCameraB {
|
||||
@Schema(description = "视频区域名称")
|
||||
private String camArNm;
|
||||
@Schema(description = "视频类型名称")
|
||||
private String camTypeNm;
|
||||
}
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
package com.gunshi.project.xyt.entity.basedata;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author Sun Lejun
|
||||
* @version 1.0
|
||||
* @date 2024/1/25
|
||||
*/
|
||||
|
||||
@Data
|
||||
public class SysDictSearch {
|
||||
@Schema(description="关键词:名称,编码")
|
||||
private String keyword;
|
||||
|
||||
@Schema(description="页码")
|
||||
private int page=1;
|
||||
|
||||
@Schema(description="每页条数")
|
||||
private int pageSize=999;
|
||||
}
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
package com.gunshi.project.xyt.entity.basedata;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import com.gunshi.project.xyt.model.SysDictB;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Sun Lejun
|
||||
* @version 1.0
|
||||
* @date 2024/1/25
|
||||
*/
|
||||
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
@ToString(callSuper = true)
|
||||
public class SysDictVo extends SysDictB implements Serializable {
|
||||
@Schema(description="子类")
|
||||
private List<SysDictVo> children = Lists.newArrayList();
|
||||
}
|
||||
|
|
@ -1,12 +1,39 @@
|
|||
package com.gunshi.project.xyt.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.gunshi.project.xyt.entity.basedata.StCameraSearch;
|
||||
import com.gunshi.project.xyt.entity.basedata.StCameraVo;
|
||||
import com.gunshi.project.xyt.model.StCameraB;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
@Mapper
|
||||
public interface StCameraBMapper extends BaseMapper<StCameraB> {
|
||||
int batchInsert(@Param("list") List<StCameraB> list);
|
||||
|
||||
/**
|
||||
* 检查视频序列化和名称是否存在
|
||||
* @param stCameraB 视频信息
|
||||
* @return true 存在 false 不存在
|
||||
*/
|
||||
boolean chechExists(@Param("obj") StCameraB stCameraB);
|
||||
|
||||
/**
|
||||
* 按查询条件查询视频列表
|
||||
* @param page 分页信息
|
||||
* @param obj 查询条件
|
||||
* @return 视频列表
|
||||
*/
|
||||
Page<StCameraVo> queryBySearch(Page<StCameraVo> page, @Param("obj") StCameraSearch obj);
|
||||
|
||||
/**
|
||||
* 查询所有视频
|
||||
* @return 视频列表
|
||||
*/
|
||||
List<StCameraVo> getAll();
|
||||
|
||||
}
|
||||
|
|
@ -1,12 +1,37 @@
|
|||
package com.gunshi.project.xyt.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.gunshi.db.dao.IMapper;
|
||||
import com.gunshi.project.xyt.entity.basedata.SysDictSearch;
|
||||
import com.gunshi.project.xyt.entity.basedata.SysDictVo;
|
||||
import com.gunshi.project.xyt.model.SysDictB;
|
||||
import java.util.List;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
@Mapper
|
||||
public interface SysDictBMapper extends BaseMapper<SysDictB> {
|
||||
public interface SysDictBMapper extends IMapper<SysDictB> {
|
||||
int batchInsert(@Param("list") List<SysDictB> list);
|
||||
|
||||
/**
|
||||
* 检查顶层的字典,编码和名称是否存在
|
||||
* @param sysDictB 字典信息
|
||||
* @return true存在 false不存在
|
||||
*/
|
||||
boolean checkExistCodeAndName(@Param("obj") SysDictB sysDictB);
|
||||
|
||||
/**
|
||||
* 根据名称和编码查询PID和ID
|
||||
* @param search 查询条件
|
||||
* @return PID和ID
|
||||
*/
|
||||
Page<SysDictB> queryPidBySearch(Page<Long> page, @Param("obj") SysDictSearch search);
|
||||
|
||||
/**
|
||||
* 根据PID和ID查询字典记录
|
||||
* @param id 字典ID or PID
|
||||
* @return 字典
|
||||
*/
|
||||
List<SysDictVo> queryByPidOrIds(@Param("obj") List<Long> id);
|
||||
}
|
||||
|
|
@ -1,9 +1,12 @@
|
|||
package com.gunshi.project.xyt.model;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.FieldStrategy;
|
||||
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.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
|
@ -26,6 +29,7 @@ public class StCameraAreaB implements Serializable {
|
|||
*/
|
||||
@TableId(value = "CAM_AR_ID", type = IdType.INPUT)
|
||||
@Schema(description="视频区域ID, 新增时候不需要,修改时候需要")
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long camArId;
|
||||
|
||||
@TableField(value = "CAM_AR_NM")
|
||||
|
|
@ -37,6 +41,7 @@ public class StCameraAreaB implements Serializable {
|
|||
@TableField(value = "PID")
|
||||
@Schema(description="父ID")
|
||||
@NotNull
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long pid;
|
||||
|
||||
@TableField(value = "SORT_ON")
|
||||
|
|
@ -54,7 +59,7 @@ public class StCameraAreaB implements Serializable {
|
|||
/**
|
||||
* 备注
|
||||
*/
|
||||
@TableField(value = "COMMENTS")
|
||||
@TableField(value = "COMMENTS", updateStrategy= FieldStrategy.ALWAYS)
|
||||
@Schema(description="备注", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
|
||||
@Size(max = 200)
|
||||
private String comments;
|
||||
|
|
|
|||
|
|
@ -1,9 +1,12 @@
|
|||
package com.gunshi.project.xyt.model;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.FieldStrategy;
|
||||
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.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
|
@ -27,6 +30,7 @@ public class StCameraB implements Serializable {
|
|||
*/
|
||||
@TableId(value = "CAM_ID", type = IdType.INPUT)
|
||||
@Schema(description="视频点id", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long camId;
|
||||
|
||||
/**
|
||||
|
|
@ -44,12 +48,13 @@ public class StCameraB implements Serializable {
|
|||
@TableField(value = "CAM_TYPE")
|
||||
@Schema(description="监控点类型")
|
||||
@NotNull
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long camType;
|
||||
|
||||
/**
|
||||
* 通道号
|
||||
*/
|
||||
@TableField(value = "CAM_CH")
|
||||
@TableField(value = "CAM_CH", updateStrategy= FieldStrategy.ALWAYS)
|
||||
@Schema(description="通道号", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
|
||||
private Integer camCh;
|
||||
|
||||
|
|
@ -59,6 +64,7 @@ public class StCameraB implements Serializable {
|
|||
@TableField(value = "CAM_AR_ID")
|
||||
@Schema(description="所在区域")
|
||||
@NotNull
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long camArId;
|
||||
|
||||
/**
|
||||
|
|
@ -97,7 +103,7 @@ public class StCameraB implements Serializable {
|
|||
/**
|
||||
* 备注
|
||||
*/
|
||||
@TableField(value = "COMMENTS")
|
||||
@TableField(value = "COMMENTS", updateStrategy= FieldStrategy.ALWAYS)
|
||||
@Schema(description="备注", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
|
||||
@Size(max = 200)
|
||||
private String comments;
|
||||
|
|
@ -124,6 +130,13 @@ public class StCameraB implements Serializable {
|
|||
@NotNull
|
||||
private Integer status;
|
||||
|
||||
/**
|
||||
* 首页默认显示 1:显示 0:不显示
|
||||
*/
|
||||
@TableField(value = "DEFAULT_SHOW")
|
||||
@Schema(description = "首页默认显示 1:显示 0:不显示")
|
||||
@NotNull
|
||||
private Integer defaultShow;
|
||||
|
||||
public static final String COL_CAM_ID = "CAM_ID";
|
||||
|
||||
|
|
@ -150,4 +163,6 @@ public class StCameraB implements Serializable {
|
|||
public static final String COL_TM = "TM";
|
||||
|
||||
public static final String COL_STATUS = "STATUS";
|
||||
|
||||
public static final String COL_DEFAULT_SHOW = "DEFAULT_SHOW";
|
||||
}
|
||||
|
|
@ -4,6 +4,8 @@ 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.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
|
@ -23,6 +25,7 @@ public class StDamB implements Serializable {
|
|||
*/
|
||||
@TableId(value = "DAM_ID", type = IdType.INPUT)
|
||||
@Schema(description="大坝ID")
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long damId;
|
||||
|
||||
/**
|
||||
|
|
@ -114,6 +117,7 @@ public class StDamB implements Serializable {
|
|||
*/
|
||||
@TableField(value = "DAM_TYPE_MAT")
|
||||
@Schema(description="大坝材料类型 DICT_ID")
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long damTypeMat;
|
||||
|
||||
/**
|
||||
|
|
@ -121,6 +125,7 @@ public class StDamB implements Serializable {
|
|||
*/
|
||||
@TableField(value = "DAM_TYPE_STR")
|
||||
@Schema(description="大坝结构类型 DICT_ID")
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long damTypeStr;
|
||||
|
||||
/**
|
||||
|
|
@ -184,6 +189,7 @@ public class StDamB implements Serializable {
|
|||
*/
|
||||
@TableField(value = "SDI")
|
||||
@Schema(description="抗震设计烈度 dict_id")
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long sdi;
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -4,6 +4,8 @@ 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.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
|
@ -23,6 +25,7 @@ public class StEqptB implements Serializable {
|
|||
*/
|
||||
@TableId(value = "WMEQ_ID", type = IdType.INPUT)
|
||||
@Schema(description="量水设施ID")
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long wmeqId;
|
||||
|
||||
/**
|
||||
|
|
@ -65,6 +68,7 @@ public class StEqptB implements Serializable {
|
|||
*/
|
||||
@TableField(value = "MEASURE")
|
||||
@Schema(description="设施类别 字典id")
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long measure;
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -4,6 +4,8 @@ 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.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
|
@ -23,6 +25,7 @@ public class StGateB implements Serializable {
|
|||
*/
|
||||
@TableId(value = "GATE_ID", type = IdType.INPUT)
|
||||
@Schema(description="闸阀ID")
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long gateId;
|
||||
|
||||
/**
|
||||
|
|
@ -65,6 +68,7 @@ public class StGateB implements Serializable {
|
|||
*/
|
||||
@TableField(value = "GATE_TP")
|
||||
@Schema(description="产品类型 dict_id")
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long gateTp;
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -4,6 +4,8 @@ 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.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
|
@ -22,6 +24,7 @@ public class StGateBFile implements Serializable {
|
|||
*/
|
||||
@TableField(value = "GATE_ID")
|
||||
@Schema(description="闸阀ID")
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long gateId;
|
||||
|
||||
/**
|
||||
|
|
@ -29,6 +32,7 @@ public class StGateBFile implements Serializable {
|
|||
*/
|
||||
@TableField(value = "FILE_ID")
|
||||
@Schema(description="文件ID")
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long fileId;
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -4,6 +4,8 @@ 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.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
|
@ -22,6 +24,7 @@ public class StMoncrB implements Serializable {
|
|||
*/
|
||||
@TableId(value = "CR_ID", type = IdType.INPUT)
|
||||
@Schema(description="断面ID")
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long crId;
|
||||
|
||||
/**
|
||||
|
|
@ -43,6 +46,7 @@ public class StMoncrB implements Serializable {
|
|||
*/
|
||||
@TableField(value = "CR_IMG_ID")
|
||||
@Schema(description="断面平面图 文件ID")
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long crImgId;
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -4,6 +4,8 @@ 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.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
|
@ -23,6 +25,7 @@ public class StResB implements Serializable {
|
|||
*/
|
||||
@TableId(value = "RES_ID", type = IdType.INPUT)
|
||||
@Schema(description="水库id")
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long resId;
|
||||
|
||||
/**
|
||||
|
|
@ -254,6 +257,7 @@ public class StResB implements Serializable {
|
|||
*/
|
||||
@TableField(value = "ENG_SCAL")
|
||||
@Schema(description="水库规模 dict_id")
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long engScal;
|
||||
|
||||
/**
|
||||
|
|
@ -275,6 +279,7 @@ public class StResB implements Serializable {
|
|||
*/
|
||||
@TableField(value = "ENG_GRAD")
|
||||
@Schema(description="工程等别 dict_id")
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long engGrad;
|
||||
|
||||
/**
|
||||
|
|
@ -366,6 +371,7 @@ public class StResB implements Serializable {
|
|||
*/
|
||||
@TableField(value = "RES_TYPE")
|
||||
@Schema(description="水库类型 dict_id")
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long resType;
|
||||
|
||||
/**
|
||||
|
|
@ -471,6 +477,7 @@ public class StResB implements Serializable {
|
|||
*/
|
||||
@TableField(value = "LVBSLV")
|
||||
@Schema(description="水准基面")
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long lvbslv;
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -4,6 +4,8 @@ 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.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
|
@ -22,6 +24,7 @@ public class StResFileRef implements Serializable {
|
|||
*/
|
||||
@TableId(value = "ID", type = IdType.INPUT)
|
||||
@Schema(description="id")
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
|
|
@ -29,6 +32,7 @@ public class StResFileRef implements Serializable {
|
|||
*/
|
||||
@TableField(value = "RES_ID")
|
||||
@Schema(description="水库ID")
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long resId;
|
||||
|
||||
/**
|
||||
|
|
@ -43,6 +47,7 @@ public class StResFileRef implements Serializable {
|
|||
*/
|
||||
@TableField(value = "FILE_ID")
|
||||
@Schema(description="文件ID")
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long fileId;
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -4,6 +4,8 @@ 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.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
|
@ -22,6 +24,7 @@ public class StResPersonRef implements Serializable {
|
|||
*/
|
||||
@TableId(value = "ID", type = IdType.INPUT)
|
||||
@Schema(description="id")
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
|
|
@ -29,6 +32,7 @@ public class StResPersonRef implements Serializable {
|
|||
*/
|
||||
@TableField(value = "RES_ID")
|
||||
@Schema(description="水库ID")
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long resId;
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -4,6 +4,8 @@ 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.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
|
@ -22,6 +24,7 @@ public class StResStcdRef implements Serializable {
|
|||
*/
|
||||
@TableId(value = "RES_ID", type = IdType.INPUT)
|
||||
@Schema(description="水库ID")
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long resId;
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -4,6 +4,8 @@ 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.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
|
@ -23,6 +25,7 @@ public class StRvB implements Serializable {
|
|||
*/
|
||||
@TableId(value = "RV_ID", type = IdType.INPUT)
|
||||
@Schema(description="河流ID")
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long rvId;
|
||||
|
||||
/**
|
||||
|
|
@ -93,6 +96,7 @@ public class StRvB implements Serializable {
|
|||
*/
|
||||
@TableField(value = "RV_TYPE")
|
||||
@Schema(description="河流类型 dict_id")
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long rvType;
|
||||
|
||||
/**
|
||||
|
|
@ -100,6 +104,7 @@ public class StRvB implements Serializable {
|
|||
*/
|
||||
@TableField(value = "RV_GRAD")
|
||||
@Schema(description="河流级别 dict_id")
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long rvGrad;
|
||||
|
||||
/**
|
||||
|
|
@ -107,6 +112,7 @@ public class StRvB implements Serializable {
|
|||
*/
|
||||
@TableField(value = "BANK")
|
||||
@Schema(description="岸别 dict_id")
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long bank;
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -4,6 +4,8 @@ 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.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
|
@ -23,6 +25,7 @@ public class StSpgPztb implements Serializable {
|
|||
*/
|
||||
@TableId(value = "ID", type = IdType.INPUT)
|
||||
@Schema(description="id")
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
|
|
@ -338,6 +341,7 @@ public class StSpgPztb implements Serializable {
|
|||
*/
|
||||
@TableField(value = "SKETCH_MAP")
|
||||
@Schema(description="埋设示意图 文件ID")
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long sketchMap;
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -4,6 +4,8 @@ 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.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
|
@ -23,6 +25,7 @@ public class StSpgSpprmp implements Serializable {
|
|||
*/
|
||||
@TableId(value = "ID", type = IdType.INPUT)
|
||||
@Schema(description="主键")
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
|
|
@ -184,6 +187,7 @@ public class StSpgSpprmp implements Serializable {
|
|||
*/
|
||||
@TableField(value = "SKETCH_MAP")
|
||||
@Schema(description="埋设示意图 文件ID")
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long sketchMap;
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -4,6 +4,8 @@ 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.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
|
@ -268,6 +270,7 @@ public class StStbprpB implements Serializable {
|
|||
*/
|
||||
@TableField(value = "PROTOCOLS")
|
||||
@Schema(description="归属协议")
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long protocols;
|
||||
|
||||
public static final String COL_STCD = "STCD";
|
||||
|
|
|
|||
|
|
@ -4,6 +4,8 @@ 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.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
|
@ -23,6 +25,7 @@ public class StZvarlB implements Serializable {
|
|||
*/
|
||||
@TableField(value = "RES_ID")
|
||||
@Schema(description="水库ID")
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long resId;
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -4,10 +4,16 @@ 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.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import jakarta.validation.constraints.Size;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
|
|
@ -21,7 +27,8 @@ public class SysDictB implements Serializable {
|
|||
* ID
|
||||
*/
|
||||
@TableId(value = "ID", type = IdType.INPUT)
|
||||
@Schema(description="ID")
|
||||
@Schema(description="ID", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
|
|
@ -29,6 +36,8 @@ public class SysDictB implements Serializable {
|
|||
*/
|
||||
@TableField(value = "DICT_NM")
|
||||
@Schema(description="字典名称")
|
||||
@NotBlank
|
||||
@Size(max = 200)
|
||||
private String dictNm;
|
||||
|
||||
/**
|
||||
|
|
@ -36,6 +45,8 @@ public class SysDictB implements Serializable {
|
|||
*/
|
||||
@TableField(value = "DICT_CD")
|
||||
@Schema(description="字典编码")
|
||||
@NotBlank
|
||||
@Size(max = 100)
|
||||
private String dictCd;
|
||||
|
||||
/**
|
||||
|
|
@ -43,6 +54,8 @@ public class SysDictB implements Serializable {
|
|||
*/
|
||||
@TableField(value = "PID")
|
||||
@Schema(description="父id")
|
||||
@NotNull
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long pid;
|
||||
|
||||
/**
|
||||
|
|
@ -50,20 +63,21 @@ public class SysDictB implements Serializable {
|
|||
*/
|
||||
@TableField(value = "SORT_ON")
|
||||
@Schema(description="排序字段")
|
||||
@NotNull
|
||||
private Integer sortOn;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@TableField(value = "CREATE_TM")
|
||||
@Schema(description="创建时间")
|
||||
@Schema(description="创建时间", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
|
||||
private Date createTm;
|
||||
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
@TableField(value = "TM")
|
||||
@Schema(description="修改时间")
|
||||
@Schema(description="修改时间", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
|
||||
private Date tm;
|
||||
|
||||
/**
|
||||
|
|
@ -71,6 +85,7 @@ public class SysDictB implements Serializable {
|
|||
*/
|
||||
@TableField(value = "[STATUS]")
|
||||
@Schema(description="状态 1:启用 0:禁用")
|
||||
@NotNull
|
||||
private Integer status;
|
||||
|
||||
public static final String COL_ID = "ID";
|
||||
|
|
|
|||
|
|
@ -5,12 +5,16 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|||
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
|
||||
import com.gunshi.project.xyt.entity.basedata.StCameraAreaTreeVo;
|
||||
import com.gunshi.project.xyt.entity.basedata.StCameraAreaVo;
|
||||
import com.gunshi.project.xyt.entity.basedata.StCameraVo;
|
||||
import com.gunshi.project.xyt.mapper.StCameraAreaBMapper;
|
||||
import com.gunshi.project.xyt.mapper.StCameraBMapper;
|
||||
import com.gunshi.project.xyt.model.StCameraAreaB;
|
||||
import com.gunshi.util.common.tree.TreeUtil;
|
||||
import jakarta.validation.Valid;
|
||||
import lombok.Data;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
|
@ -24,22 +28,33 @@ import java.util.Objects;
|
|||
|
||||
@Service
|
||||
@Slf4j
|
||||
@DSTransactional(rollbackFor = Exception.class)
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Data
|
||||
public class StCameraAreaService {
|
||||
private final StCameraAreaBMapper stCameraAreaBMapper;
|
||||
private final StCameraBMapper stCameraBMapper;
|
||||
|
||||
/**
|
||||
* 根据视频区域ID查询视频区域
|
||||
* @param camArId 视频区域ID
|
||||
* @return 视频区域
|
||||
*/
|
||||
public StCameraAreaB queryStCameraAreaBById(Long camArId) {
|
||||
public StCameraAreaB queryById(Long camArId) {
|
||||
return stCameraAreaBMapper.selectById(camArId);
|
||||
}
|
||||
|
||||
public List<StCameraAreaTreeVo> queryStCameraAreaBTree() {
|
||||
public List<StCameraAreaTreeVo> queryTree() {
|
||||
List<StCameraAreaTreeVo> list = stCameraAreaBMapper.queryStCameraAreaBTree();
|
||||
List<StCameraVo> all = stCameraBMapper.getAll();
|
||||
list.forEach(t -> {
|
||||
List<StCameraVo> cameraList = t.getCameraList();
|
||||
all.forEach(a -> {
|
||||
if (Objects.equals(a.getCamArId(), t.getCamArId())) {
|
||||
cameraList.add(a);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
return TreeUtil.list2ListTree(list, Long.valueOf(0L),
|
||||
StCameraAreaTreeVo::getCamArId, StCameraAreaTreeVo::getPid,
|
||||
StCameraAreaTreeVo::setChildren, null);
|
||||
|
|
@ -50,7 +65,7 @@ public class StCameraAreaService {
|
|||
* 查询视频区域列表
|
||||
* @return 视频区域列表
|
||||
*/
|
||||
public List<StCameraAreaVo> queryStCameraAreaBList(String name) {
|
||||
public List<StCameraAreaVo> queryListByName(String name) {
|
||||
return stCameraAreaBMapper.queryStCameraAreaBList(name);
|
||||
}
|
||||
|
||||
|
|
@ -59,7 +74,7 @@ public class StCameraAreaService {
|
|||
*
|
||||
* @param stCameraAreaB 视频区域
|
||||
*/
|
||||
public void insertStCameraAreaB(StCameraAreaB stCameraAreaB) {
|
||||
public void insert(@Valid StCameraAreaB stCameraAreaB) {
|
||||
checkStCameraAreaB(stCameraAreaB);
|
||||
|
||||
QueryWrapper<StCameraAreaB> queryWrapper = new QueryWrapper<>();
|
||||
|
|
@ -86,7 +101,7 @@ public class StCameraAreaService {
|
|||
*
|
||||
* @param stCameraAreaB 视频区域
|
||||
*/
|
||||
public void updateStCameraAreaB(StCameraAreaB stCameraAreaB) {
|
||||
public void update(@Valid StCameraAreaB stCameraAreaB) {
|
||||
Long camArId = stCameraAreaB.getCamArId();
|
||||
QueryWrapper<StCameraAreaB> queryWrapper2 = new QueryWrapper<>();
|
||||
queryWrapper2.eq(StCameraAreaB.COL_CAM_AR_ID, camArId);
|
||||
|
|
|
|||
|
|
@ -1,12 +1,21 @@
|
|||
package com.gunshi.project.xyt.service;
|
||||
|
||||
import com.baomidou.dynamic.datasource.annotation.DSTransactional;
|
||||
import com.gunshi.db.dao.BaseDao;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.gunshi.project.xyt.entity.basedata.StCameraSearch;
|
||||
import com.gunshi.project.xyt.entity.basedata.StCameraVo;
|
||||
import com.gunshi.project.xyt.mapper.StCameraAreaBMapper;
|
||||
import com.gunshi.project.xyt.mapper.StCameraBMapper;
|
||||
import com.gunshi.project.xyt.model.StCameraAreaB;
|
||||
import com.gunshi.project.xyt.model.StCameraB;
|
||||
import jakarta.validation.Valid;
|
||||
import lombok.Data;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @author Sun Lejun
|
||||
|
|
@ -16,17 +25,83 @@ import org.springframework.stereotype.Service;
|
|||
|
||||
@Service
|
||||
@Slf4j
|
||||
@DSTransactional(rollbackFor = Exception.class)
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Data
|
||||
public class StCameraService {
|
||||
private final StCameraBMapper stCameraBMapper;
|
||||
private final StCameraAreaBMapper stCameraAreaBMapper;
|
||||
|
||||
public StCameraB queryById(Long camId) {
|
||||
return stCameraBMapper.selectById(camId);
|
||||
}
|
||||
|
||||
public Page<StCameraVo> queryBySearch(StCameraSearch stCameraSearch){
|
||||
Page<StCameraVo> page = new Page<>(stCameraSearch.getPage(), stCameraSearch.getPageSize());
|
||||
return stCameraBMapper.queryBySearch(page, stCameraSearch);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 新增视频
|
||||
* @param stCameraB 视频
|
||||
* @param stCameraB 视频信息
|
||||
*/
|
||||
public void insert(StCameraB stCameraB) {
|
||||
public void insert(@Valid StCameraB stCameraB) {
|
||||
checkUnique(stCameraB);
|
||||
checkAreaExist(stCameraB);
|
||||
stCameraB.setCamId(IdWorker.getId());
|
||||
stCameraB.setCreateTm(new Date());
|
||||
stCameraB.setTm(new Date());
|
||||
stCameraBMapper.insert(stCameraB);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改视频
|
||||
* @param stCameraB 视频信息
|
||||
*/
|
||||
public void update(@Valid StCameraB stCameraB) {
|
||||
checkExist(stCameraB);
|
||||
checkUnique(stCameraB);
|
||||
checkAreaExist(stCameraB);
|
||||
stCameraB.setTm(new Date());
|
||||
stCameraBMapper.updateById(stCameraB);
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查视频参数唯一性
|
||||
* @param stCameraB 视频信息
|
||||
*/
|
||||
private void checkUnique(StCameraB stCameraB){
|
||||
boolean exists = stCameraBMapper.chechExists(stCameraB);
|
||||
if (exists){
|
||||
throw new IllegalArgumentException("视频名称或序列号已存在");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查视频ID是否存在
|
||||
* @param stCameraB 视频信息
|
||||
*/
|
||||
private void checkExist(StCameraB stCameraB){
|
||||
QueryWrapper<StCameraB> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq(StCameraB.COL_CAM_ID, stCameraB.getCamId());
|
||||
boolean exists = stCameraBMapper.exists(queryWrapper);
|
||||
if (!exists){
|
||||
throw new IllegalArgumentException("视频ID不存在");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查视频区域ID是否存在
|
||||
* @param stCameraB 视频信息
|
||||
*/
|
||||
private void checkAreaExist(StCameraB stCameraB){
|
||||
QueryWrapper<StCameraAreaB> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq(StCameraAreaB.COL_CAM_AR_ID, stCameraB.getCamArId());
|
||||
boolean exists = stCameraAreaBMapper.exists(queryWrapper);
|
||||
if (!exists){
|
||||
throw new IllegalArgumentException("视频区域ID不存在");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,141 @@
|
|||
package com.gunshi.project.xyt.service;
|
||||
|
||||
import com.baomidou.dynamic.datasource.annotation.DSTransactional;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.OrderItem;
|
||||
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.gunshi.db.dao.BaseOrderDao;
|
||||
import com.gunshi.project.xyt.entity.basedata.SysDictSearch;
|
||||
import com.gunshi.project.xyt.entity.basedata.SysDictVo;
|
||||
import com.gunshi.project.xyt.mapper.SysDictBMapper;
|
||||
import com.gunshi.project.xyt.model.SysDictB;
|
||||
import com.gunshi.util.common.tree.TreeUtil;
|
||||
import jakarta.validation.Valid;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Sun Lejun
|
||||
* @version 1.0
|
||||
* @date 2024/1/25
|
||||
*/
|
||||
|
||||
@Service
|
||||
@Slf4j
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public class SysDictService extends BaseOrderDao<SysDictBMapper, SysDictB> {
|
||||
|
||||
/**
|
||||
* 根据ID查询字典
|
||||
* @param id 字典ID
|
||||
* @return 字典
|
||||
*/
|
||||
public SysDictB queryById(Long id) {
|
||||
return this.getBaseMapper().selectById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据名称或者编码查询字典
|
||||
* @param search 查询条件
|
||||
* @return 字典tree
|
||||
*/
|
||||
public Page<SysDictVo> queryBySearch(SysDictSearch search) {
|
||||
|
||||
//构建分页对象
|
||||
Page<Long> page = new Page<>(search.getPage(), search.getPageSize());
|
||||
//按PID和ID进行分页查询
|
||||
Page<SysDictB> sysDictVoPage = this.getBaseMapper().queryPidBySearch(page, search);
|
||||
long total = sysDictVoPage.getTotal();
|
||||
long current = sysDictVoPage.getCurrent();
|
||||
if(total == 0) {
|
||||
return new Page<>(current, search.getPageSize());
|
||||
}
|
||||
//拿出查询出来的PID和ID,获取完整的记录
|
||||
List<SysDictB> records = sysDictVoPage.getRecords();
|
||||
List<Long> list = records.stream().map(SysDictB::getId).toList();
|
||||
List<SysDictVo> sysDictVos = this.getBaseMapper().queryByPidOrIds(list);
|
||||
//转换成tree
|
||||
List<SysDictVo> tree = TreeUtil.list2ListTree(sysDictVos, 0L, SysDictVo::getId, SysDictVo::getPid, SysDictVo::setChildren, null);
|
||||
//构建返回对象
|
||||
Page<SysDictVo> result = new Page<>(search.getPage(), search.getPageSize());
|
||||
result.setCurrent(current);
|
||||
result.setTotal(total);
|
||||
result.setRecords(tree);
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增字典
|
||||
* @param sysDictB 字典信息
|
||||
*/
|
||||
public void insert(@Valid SysDictB sysDictB) {
|
||||
checkExistCodeAndName(sysDictB);
|
||||
sysDictB.setId(IdWorker.getId());
|
||||
sysDictB.setStatus(1);
|
||||
sysDictB.setCreateTm(new Date());
|
||||
sysDictB.setTm(new Date());
|
||||
this.getBaseMapper().insert(sysDictB);
|
||||
resort(sysDictB);
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新字典
|
||||
* @param sysDictB 字典信息
|
||||
*/
|
||||
public void update(@Valid SysDictB sysDictB) {
|
||||
checkExistById(sysDictB);
|
||||
checkExistCodeAndName(sysDictB);
|
||||
sysDictB.setTm(new Date());
|
||||
|
||||
if(sysDictB.getStatus() == 0L){
|
||||
sysDictB.setSortOn(999);
|
||||
}
|
||||
this.getBaseMapper().updateById(sysDictB);
|
||||
resort(sysDictB);
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查字典编码和名称是否存在
|
||||
* @param sysDictB 字典信息
|
||||
*/
|
||||
public void checkExistCodeAndName(SysDictB sysDictB) {
|
||||
if (sysDictB.getPid() != 0L) {
|
||||
return;
|
||||
}
|
||||
boolean exist = this.getBaseMapper().checkExistCodeAndName(sysDictB);
|
||||
if (exist) {
|
||||
throw new IllegalArgumentException("顶层字典编码或名称已存在");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查字典是否存在
|
||||
* @param sysDictB 字典信息
|
||||
*/
|
||||
public void checkExistById(SysDictB sysDictB) {
|
||||
QueryWrapper<SysDictB> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq(SysDictB.COL_ID, sysDictB.getId());
|
||||
boolean exists = this.exists(queryWrapper);
|
||||
if (!exists) {
|
||||
throw new IllegalArgumentException("字典不存在");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 重新给字典排序
|
||||
* @param sysDictB
|
||||
*/
|
||||
private void resort(SysDictB sysDictB){
|
||||
Long pid = sysDictB.getPid();
|
||||
QueryWrapper<SysDictB> queryWrapper2 = new QueryWrapper<>();
|
||||
queryWrapper2.eq(SysDictB.COL_PID, pid);
|
||||
super.updateOrder(queryWrapper2, SysDictB::getSortOn, SysDictB::setSortOn, sysDictB, SysDictB::getId, t -> t.setTm(new Date()));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -17,24 +17,92 @@
|
|||
<result column="CREATE_TM" jdbcType="TIMESTAMP" property="createTm" />
|
||||
<result column="TM" jdbcType="TIMESTAMP" property="tm" />
|
||||
<result column="STATUS" jdbcType="INTEGER" property="status" />
|
||||
<result column="DEFAULT_SHOW" jdbcType="INTEGER" property="defaultShow" />
|
||||
</resultMap>
|
||||
<sql id="Base_Column_List">
|
||||
<!--@mbg.generated-->
|
||||
CAM_ID, CAM_NM, CAM_TYPE, CAM_CH, CAM_AR_ID, CAM_URL, CAM_SN, LGTD, LTTD, COMMENTS,
|
||||
CREATE_TM, TM, [STATUS]
|
||||
CREATE_TM, TM, [STATUS], DEFAULT_SHOW
|
||||
</sql>
|
||||
<insert id="batchInsert" parameterType="map">
|
||||
<!--@mbg.generated-->
|
||||
insert into dbo.ST_CAMERA_B
|
||||
(CAM_ID, CAM_NM, CAM_TYPE, CAM_CH, CAM_AR_ID, CAM_URL, CAM_SN, LGTD, LTTD, COMMENTS,
|
||||
CREATE_TM, TM, [STATUS])
|
||||
CREATE_TM, TM, [STATUS], DEFAULT_SHOW)
|
||||
values
|
||||
<foreach collection="list" item="item" separator=",">
|
||||
(#{item.camId,jdbcType=BIGINT}, #{item.camNm,jdbcType=VARCHAR}, #{item.camType,jdbcType=BIGINT},
|
||||
#{item.camCh,jdbcType=INTEGER}, #{item.camArId,jdbcType=BIGINT}, #{item.camUrl,jdbcType=VARCHAR},
|
||||
#{item.camSn,jdbcType=VARCHAR}, #{item.lgtd,jdbcType=DECIMAL}, #{item.lttd,jdbcType=DECIMAL},
|
||||
#{item.comments,jdbcType=VARCHAR}, #{item.createTm,jdbcType=TIMESTAMP}, #{item.tm,jdbcType=TIMESTAMP},
|
||||
#{item.status,jdbcType=INTEGER})
|
||||
#{item.status,jdbcType=INTEGER}, #{item.defaultShow,jdbcType=INTEGER})
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<select id="chechExists" resultType="boolean">
|
||||
select case when exists(
|
||||
select 1 from ST_CAMERA_B
|
||||
where (CAM_NM=#{obj.camNm} or CAM_SN=#{obj.camSn})
|
||||
and STATUS=1
|
||||
<if test='obj.camId!=null'>
|
||||
and CAM_ID!=#{obj.camId}
|
||||
</if>
|
||||
) then 1 else 0 end
|
||||
</select>
|
||||
|
||||
<select id="queryBySearch" resultType="com.gunshi.project.xyt.entity.basedata.StCameraVo">
|
||||
select t1.CAM_ID,
|
||||
t1.CAM_NM,
|
||||
t1.CAM_TYPE,
|
||||
t1.CAM_CH,
|
||||
t1.CAM_AR_ID,
|
||||
t1.CAM_URL,
|
||||
t1.CAM_SN,
|
||||
t1.LGTD,
|
||||
t1.LTTD,
|
||||
t1.COMMENTS,
|
||||
t1.CREATE_TM,
|
||||
t1.TM,
|
||||
t1.STATUS,
|
||||
t1.DEFAULT_SHOW,
|
||||
SCAB.CAM_AR_NM CAM_AR_NM,
|
||||
SDB.DICT_NM CAM_TYPE_NM
|
||||
from ST_CAMERA_B t1
|
||||
left join dbo.ST_CAMERA_AREA_B SCAB on t1.CAM_AR_ID = SCAB.CAM_AR_ID
|
||||
left join dbo.SYS_DICT_B SDB on t1.CAM_TYPE = SDB.ID
|
||||
<where>
|
||||
<if test="obj.keyword != null and obj.keyword != ''">
|
||||
and (t1.CAM_NM like concat('%', #{obj.keyword}, '%') or t1.CAM_SN like concat('%', #{obj.keyword}, '%'))
|
||||
</if>
|
||||
<if test="obj.camType != null">
|
||||
and t1.CAM_TYPE = #{obj.camType}
|
||||
</if>
|
||||
and t1.STATUS = 1
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="getAll" resultType="com.gunshi.project.xyt.entity.basedata.StCameraVo">
|
||||
select t1.CAM_ID,
|
||||
t1.CAM_NM,
|
||||
t1.CAM_TYPE,
|
||||
t1.CAM_CH,
|
||||
t1.CAM_AR_ID,
|
||||
t1.CAM_URL,
|
||||
t1.CAM_SN,
|
||||
t1.LGTD,
|
||||
t1.LTTD,
|
||||
t1.COMMENTS,
|
||||
t1.CREATE_TM,
|
||||
t1.TM,
|
||||
t1.STATUS,
|
||||
t1.DEFAULT_SHOW,
|
||||
SCAB.CAM_AR_NM CAM_AR_NM,
|
||||
SDB.DICT_NM CAM_TYPE_NM
|
||||
from ST_CAMERA_B t1
|
||||
left join dbo.ST_CAMERA_AREA_B SCAB on t1.CAM_AR_ID = SCAB.CAM_AR_ID
|
||||
left join dbo.SYS_DICT_B SDB on t1.CAM_TYPE = SDB.ID
|
||||
<where>
|
||||
and t1.STATUS = 1
|
||||
</where>
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
@ -28,4 +28,61 @@
|
|||
#{item.tm,jdbcType=TIMESTAMP}, #{item.status,jdbcType=INTEGER})
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<select id="checkExistCodeAndName" resultType="boolean">
|
||||
select case when
|
||||
exists(select 1
|
||||
from dbo.SYS_DICT_B where (DICT_NM = #{obj.dictNm} or DICT_CD = #{obj.dictCd})
|
||||
and STATUS = 1
|
||||
and PID = 0
|
||||
<if test='obj.id != null'>
|
||||
and ID != #{obj.id}
|
||||
</if>
|
||||
) then 1
|
||||
else 0 end
|
||||
</select>
|
||||
|
||||
<select id="queryPidBySearch" resultType="com.gunshi.project.xyt.model.SysDictB">
|
||||
select ID from (
|
||||
(select ID as ID
|
||||
from SYS_DICT_B
|
||||
<where>
|
||||
<if test="obj.keyword != null and obj.keyword != ''">
|
||||
and (DICT_NM like concat('%', #{obj.keyword}, '%') or DICT_CD like concat('%', #{obj.keyword}, '%'))
|
||||
</if>
|
||||
and PID = 0
|
||||
and STATUS = 1
|
||||
</where>
|
||||
)
|
||||
union
|
||||
(select PID as ID
|
||||
from SYS_DICT_B
|
||||
<where>
|
||||
<if test="obj.keyword != null and obj.keyword != ''">
|
||||
and (DICT_NM like concat('%', #{obj.keyword}, '%') or DICT_CD like concat('%', #{obj.keyword}, '%'))
|
||||
</if>
|
||||
<![CDATA[
|
||||
and PID <> 0]]>
|
||||
and STATUS = 1
|
||||
</where>
|
||||
)
|
||||
) temp_table
|
||||
</select>
|
||||
|
||||
<select id="queryByPidOrIds" resultType="com.gunshi.project.xyt.entity.basedata.SysDictVo">
|
||||
select
|
||||
<include refid="Base_Column_List"/>
|
||||
from SYS_DICT_B a
|
||||
<where>
|
||||
PID in
|
||||
<foreach item="it" collection="obj" separator="," open="(" close=")">
|
||||
#{it}
|
||||
</foreach>
|
||||
or ID in
|
||||
<foreach item="it" collection="obj" separator="," open="(" close=")">
|
||||
#{it}
|
||||
</foreach>
|
||||
</where>
|
||||
order by SORT_ON
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
@ -9,6 +9,7 @@ import org.junit.jupiter.api.Test;
|
|||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import ru.olegcherednik.jackson_utils.JacksonUtils;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
|
@ -21,9 +22,9 @@ class StCameraAreaServiceTest {
|
|||
|
||||
@Test
|
||||
void queryStCameraAreaBList() {
|
||||
List<StCameraAreaVo> list1 = stCameraAreaService.queryStCameraAreaBList("公路");
|
||||
List<StCameraAreaVo> list1 = stCameraAreaService.queryListByName("公路");
|
||||
log.info("{}", list1);
|
||||
List<StCameraAreaVo> list2 = stCameraAreaService.queryStCameraAreaBList("");
|
||||
List<StCameraAreaVo> list2 = stCameraAreaService.queryListByName("");
|
||||
log.info("{}", list2);
|
||||
}
|
||||
|
||||
|
|
@ -34,7 +35,7 @@ class StCameraAreaServiceTest {
|
|||
stCameraAreaB.setPid(0L);
|
||||
stCameraAreaB.setStatus(1);
|
||||
stCameraAreaB.setComments("备注2");
|
||||
stCameraAreaService.insertStCameraAreaB(stCameraAreaB);
|
||||
stCameraAreaService.insert(stCameraAreaB);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
@ -44,19 +45,19 @@ class StCameraAreaServiceTest {
|
|||
stCameraAreaB.setPid(1750075892207497218L);
|
||||
stCameraAreaB.setStatus(1);
|
||||
stCameraAreaB.setComments("备注");
|
||||
stCameraAreaService.insertStCameraAreaB(stCameraAreaB);
|
||||
stCameraAreaService.insert(stCameraAreaB);
|
||||
}
|
||||
|
||||
@Test
|
||||
void updateStCameraAreaB() {
|
||||
StCameraAreaB stCameraAreaB = stCameraAreaService.queryStCameraAreaBById(1750077729811742721L);
|
||||
stCameraAreaB.setComments("1234557");
|
||||
stCameraAreaService.updateStCameraAreaB(stCameraAreaB);
|
||||
StCameraAreaB stCameraAreaB = stCameraAreaService.queryById(1750077729811742721L);
|
||||
stCameraAreaB.setComments(null);
|
||||
stCameraAreaService.update(stCameraAreaB);
|
||||
}
|
||||
|
||||
@Test
|
||||
void queryStCameraAreaBTree() {
|
||||
List<StCameraAreaTreeVo> list = stCameraAreaService.queryStCameraAreaBTree();
|
||||
log.info("{}", list);
|
||||
List<StCameraAreaTreeVo> list = stCameraAreaService.queryTree();
|
||||
log.info("{}", JacksonUtils.writeValue(list));
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,83 @@
|
|||
package com.gunshi.project.xyt.service;
|
||||
|
||||
import com.gunshi.project.xyt.Main;
|
||||
import com.gunshi.project.xyt.entity.basedata.StCameraSearch;
|
||||
import com.gunshi.project.xyt.model.StCameraB;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import ru.olegcherednik.jackson_utils.JacksonUtils;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
|
||||
|
||||
@SpringBootTest
|
||||
@ContextConfiguration(classes = Main.class)
|
||||
@Slf4j
|
||||
class StCameraServiceTest {
|
||||
@Autowired
|
||||
private StCameraService stCameraService;
|
||||
|
||||
@Test
|
||||
void insert() {
|
||||
StCameraB stCameraB = new StCameraB();
|
||||
stCameraB.setCamNm("大坝1-1左1");
|
||||
stCameraB.setCamSn("12345678912");
|
||||
stCameraB.setCamArId(1001L);
|
||||
stCameraB.setCamType(1L);
|
||||
stCameraB.setStatus(1);
|
||||
stCameraB.setCamUrl("rtsp://172.16.0.1:1080");
|
||||
stCameraB.setComments("备注");
|
||||
stCameraB.setDefaultShow(0);
|
||||
stCameraB.setLgtd(BigDecimal.valueOf(101.1511d));
|
||||
stCameraB.setLttd(BigDecimal.valueOf(23.1511d));
|
||||
stCameraService.insert(stCameraB);
|
||||
}
|
||||
|
||||
@Test
|
||||
void update() {
|
||||
StCameraB stCameraB = stCameraService.queryById(1750353808199888897L);
|
||||
stCameraB.setCamNm("大坝顶左1-1");
|
||||
stCameraB.setCamCh(1);
|
||||
stCameraB.setComments(null);
|
||||
stCameraService.update(stCameraB);
|
||||
}
|
||||
|
||||
@Test
|
||||
void queryBySearch() {
|
||||
StCameraSearch stCameraSearch = new StCameraSearch();
|
||||
stCameraSearch.setKeyword("1-1");
|
||||
|
||||
log.info("{}", JacksonUtils.writeValue(stCameraService.queryBySearch(stCameraSearch)));
|
||||
|
||||
stCameraSearch = new StCameraSearch();
|
||||
stCameraSearch.setKeyword("1-1");
|
||||
stCameraSearch.setCamType(2L);
|
||||
log.info("{}", JacksonUtils.writeValue(stCameraService.queryBySearch(stCameraSearch)));
|
||||
|
||||
stCameraSearch = new StCameraSearch();
|
||||
stCameraSearch.setKeyword("1-1");
|
||||
stCameraSearch.setCamType(1L);
|
||||
stCameraSearch.setPage(1);
|
||||
stCameraSearch.setPageSize(10);
|
||||
log.info("{}", JacksonUtils.writeValue(stCameraService.queryBySearch(stCameraSearch)));
|
||||
|
||||
stCameraSearch = new StCameraSearch();
|
||||
stCameraSearch.setKeyword("1-1");
|
||||
stCameraSearch.setCamType(1L);
|
||||
stCameraSearch.setPage(1);
|
||||
stCameraSearch.setPageSize(1);
|
||||
log.info("{}", JacksonUtils.writeValue(stCameraService.queryBySearch(stCameraSearch)));
|
||||
|
||||
stCameraSearch = new StCameraSearch();
|
||||
stCameraSearch.setKeyword("1-1");
|
||||
stCameraSearch.setCamType(1L);
|
||||
stCameraSearch.setPage(2);
|
||||
stCameraSearch.setPageSize(10);
|
||||
log.info("{}", JacksonUtils.writeValue(stCameraService.queryBySearch(stCameraSearch)));
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,59 @@
|
|||
package com.gunshi.project.xyt.service;
|
||||
|
||||
import com.gunshi.project.xyt.Main;
|
||||
import com.gunshi.project.xyt.entity.basedata.SysDictSearch;
|
||||
import com.gunshi.project.xyt.model.SysDictB;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import ru.olegcherednik.jackson_utils.JacksonUtils;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
|
||||
@SpringBootTest
|
||||
@ContextConfiguration(classes = Main.class)
|
||||
@Slf4j
|
||||
class SysDictServiceTest {
|
||||
@Autowired
|
||||
private SysDictService sysDictService;
|
||||
@Test
|
||||
void insert() {
|
||||
SysDictB sysDictB = new SysDictB();
|
||||
sysDictB.setDictNm("测试类型");
|
||||
sysDictB.setDictCd("2");
|
||||
sysDictB.setPid(1750409373064220673L);
|
||||
sysDictB.setSortOn(1);
|
||||
sysDictB.setStatus(1);
|
||||
sysDictService.insert(sysDictB);
|
||||
}
|
||||
|
||||
@Test
|
||||
void update() {
|
||||
SysDictB sysDictB = sysDictService.queryById(1750400498717966338L);
|
||||
sysDictB.setSortOn(1);
|
||||
sysDictService.update(sysDictB);
|
||||
}
|
||||
|
||||
@Test
|
||||
void queryBySearch() {
|
||||
SysDictSearch sysDictSearch = new SysDictSearch();
|
||||
sysDictSearch.setKeyword("");
|
||||
sysDictSearch.setPage(1);
|
||||
sysDictSearch.setPageSize(10);
|
||||
log.info("{}", JacksonUtils.writeValue(sysDictService.queryBySearch(sysDictSearch)));
|
||||
|
||||
sysDictSearch = new SysDictSearch();
|
||||
sysDictSearch.setKeyword("类型");
|
||||
sysDictSearch.setPage(1);
|
||||
sysDictSearch.setPageSize(10);
|
||||
log.info("{}", JacksonUtils.writeValue(sysDictService.queryBySearch(sysDictSearch)));
|
||||
|
||||
sysDictSearch = new SysDictSearch();
|
||||
sysDictSearch.setKeyword("类型");
|
||||
sysDictSearch.setPage(1);
|
||||
sysDictSearch.setPageSize(1);
|
||||
log.info("{}", JacksonUtils.writeValue(sysDictService.queryBySearch(sysDictSearch)));
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue