更新字典,行政区划,视频相关接口
parent
e52d85bddc
commit
2e8d910689
|
|
@ -0,0 +1,184 @@
|
||||||
|
package com.gunshi.project.xyt.controller;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.gunshi.core.annotation.Get;
|
||||||
|
import com.gunshi.core.annotation.Post;
|
||||||
|
import com.gunshi.core.result.R;
|
||||||
|
import com.gunshi.project.xyt.entity.basedata.AddvcdSearch;
|
||||||
|
import com.gunshi.project.xyt.entity.basedata.CheckStringSearch;
|
||||||
|
import com.gunshi.project.xyt.entity.basedata.GeneralSearch;
|
||||||
|
import com.gunshi.project.xyt.entity.basedata.StAddvcdTreeVo;
|
||||||
|
import com.gunshi.project.xyt.entity.basedata.StCameraAreaTreeVo;
|
||||||
|
import com.gunshi.project.xyt.entity.basedata.StCameraAreaVo;
|
||||||
|
import com.gunshi.project.xyt.entity.basedata.StCameraSearch;
|
||||||
|
import com.gunshi.project.xyt.entity.basedata.StCameraVo;
|
||||||
|
import com.gunshi.project.xyt.entity.basedata.SysDictVo;
|
||||||
|
import com.gunshi.project.xyt.model.StAddvcdD;
|
||||||
|
import com.gunshi.project.xyt.model.StCameraAreaB;
|
||||||
|
import com.gunshi.project.xyt.model.StCameraB;
|
||||||
|
import com.gunshi.project.xyt.model.SysDictB;
|
||||||
|
import com.gunshi.project.xyt.service.StAdcdService;
|
||||||
|
import com.gunshi.project.xyt.service.StCameraAreaService;
|
||||||
|
import com.gunshi.project.xyt.service.StCameraService;
|
||||||
|
import com.gunshi.project.xyt.service.SysDictService;
|
||||||
|
import com.gunshi.project.xyt.validate.markers.Update;
|
||||||
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
|
import io.swagger.v3.oas.annotations.Parameter;
|
||||||
|
import io.swagger.v3.oas.annotations.enums.ParameterIn;
|
||||||
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Sun Lejun
|
||||||
|
* @version 1.0
|
||||||
|
* @date 2024/1/26
|
||||||
|
*/
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@Slf4j
|
||||||
|
@Tag(name = "基础数据接口-controller", description = "基础数据接口")
|
||||||
|
@Data
|
||||||
|
@RequestMapping("/database/")
|
||||||
|
public class BasicDataController {
|
||||||
|
private final SysDictService sysDictService;
|
||||||
|
private final StAdcdService stAdcdService;
|
||||||
|
private final StCameraAreaService stCameraAreaService;
|
||||||
|
private final StCameraService stCameraService;
|
||||||
|
|
||||||
|
|
||||||
|
@Post(path = "/dict/search/query", summary = "查询字典接口")
|
||||||
|
public R<Page<SysDictVo>> queryDictList(@Validated @RequestBody GeneralSearch search) {
|
||||||
|
return R.ok(sysDictService.queryBySearch(search));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Get(path = "/dict/search/queryByPid", summary = "根据父ID查询字典接口 返回树结构")
|
||||||
|
public R<List<SysDictVo>> queryDictList(
|
||||||
|
@RequestParam(required = false, name="pid")
|
||||||
|
@Parameter(in = ParameterIn.QUERY, name="pid",description = "根据父ID查询字典,如果不传则查询所有")
|
||||||
|
Long pid
|
||||||
|
) {
|
||||||
|
return R.ok(sysDictService.queryByPid(pid));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Post(path = "/dict/manage/insert", summary = "新增字典接口")
|
||||||
|
public R<Boolean> insertDictParent(@Validated @RequestBody SysDictB sysDictB) {
|
||||||
|
sysDictService.insert(sysDictB);
|
||||||
|
return R.ok(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Post(path = "/dict/manage/update", summary = "更新字典接口")
|
||||||
|
public R<Boolean> updateDict(@Validated({Update.class}) @RequestBody SysDictB sysDictB) {
|
||||||
|
sysDictService.updateById(sysDictB);
|
||||||
|
return R.ok(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Post(path = "/dict/search/check", summary = "检查字典编码和名称接口")
|
||||||
|
public R<String> checkDictCode(@RequestBody @Validated CheckStringSearch checkStringSearch) {
|
||||||
|
try {
|
||||||
|
String keyword = checkStringSearch.getKeyword();
|
||||||
|
SysDictB sysDictB = new SysDictB();
|
||||||
|
sysDictB.setDictNm(keyword);
|
||||||
|
sysDictB.setDictCd(keyword);
|
||||||
|
if (Objects.nonNull(checkStringSearch.getId())) {
|
||||||
|
sysDictB.setId(checkStringSearch.getId());
|
||||||
|
}
|
||||||
|
sysDictService.checkExistCodeAndName(sysDictB);
|
||||||
|
} catch (IllegalArgumentException e) {
|
||||||
|
return R.error(417, e.getMessage());
|
||||||
|
}
|
||||||
|
return R.ok();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@Post(path = "/adcd/search/query", summary = "查询行政区划列表接口")
|
||||||
|
public R<Page<StAddvcdD>> queryAddvcdList(@Validated @RequestBody AddvcdSearch search) {
|
||||||
|
return R.ok(stAdcdService.queryBySearch(search));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Get(path = "/adcd/search/tree", summary = "查询行政区划树接口")
|
||||||
|
public R<List<StAddvcdTreeVo>> queryAddvcdTree(
|
||||||
|
@RequestParam(required = false, name="adcd")
|
||||||
|
@Parameter(in = ParameterIn.QUERY, name="adcd",description = "行政区划编码 为空查询全部,不为空查询下级树,比如4205查4205开头的所有返回树型结构")
|
||||||
|
String adcd) {
|
||||||
|
return R.ok(stAdcdService.queryTree(adcd));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Post(path = "/adcd/manage/insert", summary = "新增行政区划列表接口")
|
||||||
|
public R<Boolean> insertAddvcd(@Validated @RequestBody StAddvcdD stAddvcdD) {
|
||||||
|
stAdcdService.insert(stAddvcdD);
|
||||||
|
return R.ok(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Post(path = "/adcd/manage/update", summary = "更新行政区划列表接口")
|
||||||
|
public R<Boolean> updateAddvcd(@Validated @RequestBody StAddvcdD stAddvcdD) {
|
||||||
|
stAdcdService.updateById(stAddvcdD);
|
||||||
|
return R.ok(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Post(path = "/camera/area/search/list", summary = "查询视频区域列表接口")
|
||||||
|
public R<Page<StCameraAreaVo>> queryCameraAreaList(@Validated @RequestBody GeneralSearch search) {
|
||||||
|
return R.ok(stCameraAreaService.queryListBySearch(search));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Post(path = "/camera/area/search/tree", summary = "查询视频区域树接口")
|
||||||
|
public R<List<StCameraAreaTreeVo>> queryCameraAreaTree() {
|
||||||
|
return R.ok(stCameraAreaService.queryTree());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Post(path = "/camera/area/manage/insert", summary = "新增视频区域接口")
|
||||||
|
public R<Boolean> insertCameraArea(@Validated @RequestBody StCameraAreaB stCameraAreaB) {
|
||||||
|
stCameraAreaService.insert(stCameraAreaB);
|
||||||
|
return R.ok(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Post(path = "/camera/area/manage/update", summary = "更新视频区域接口")
|
||||||
|
public R<Boolean> updateCameraArea(@Validated({Update.class}) @RequestBody StCameraAreaB stCameraAreaB) {
|
||||||
|
stCameraAreaService.update(stCameraAreaB);
|
||||||
|
return R.ok(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Post(path = "/camera/area/search/check", summary = "检查视频区域名称是否存在接口")
|
||||||
|
@Operation(summary = "检查视频区域名称是否存在接口")
|
||||||
|
public R<String> checkCameraAreaName(@RequestBody @Validated CheckStringSearch checkStringSearch) {
|
||||||
|
try {
|
||||||
|
stCameraAreaService.checkAreaName(checkStringSearch);
|
||||||
|
} catch (IllegalArgumentException e) {
|
||||||
|
return R.error(417, e.getMessage());
|
||||||
|
}
|
||||||
|
return R.ok();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Post(path = "/camera/search/query", summary = "查询视频列表接口")
|
||||||
|
@Operation(summary = "查询视频列表接口")
|
||||||
|
public R<Page<StCameraVo>> queryCameraList(@Validated @RequestBody StCameraSearch search) {
|
||||||
|
return R.ok(stCameraService.queryBySearch(search));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Post(path = "/camera/manage/insert", summary = "新增视频接口")
|
||||||
|
@Operation(summary = "新增视频接口")
|
||||||
|
public R<Boolean> insertCamera(@Validated @RequestBody StCameraB obj) {
|
||||||
|
stCameraService.insert(obj);
|
||||||
|
return R.ok(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Post(path = "/camera/manage/update", summary = "更新视频接口")
|
||||||
|
@Operation(summary = "更新视频接口")
|
||||||
|
public R<Boolean> updateCamera(@Validated({Update.class}) @RequestBody StCameraB obj) {
|
||||||
|
stCameraService.update(obj);
|
||||||
|
return R.ok(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -1,6 +1,8 @@
|
||||||
package com.gunshi.project.xyt.entity.basedata;
|
package com.gunshi.project.xyt.entity.basedata;
|
||||||
|
|
||||||
|
import com.gunshi.db.dto.PageSo;
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import jakarta.validation.constraints.NotNull;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
@ -13,13 +15,11 @@ import java.io.Serializable;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
@Schema(description = "行政区划查询对象")
|
@Schema(description = "行政区划查询对象")
|
||||||
public class AddvcdSearch implements Serializable {
|
public class AddvcdSearch {
|
||||||
@Schema(description="关键词:名称/编码")
|
@Schema(description="关键词:名称/编码")
|
||||||
private String keyword;
|
private String keyword;
|
||||||
|
|
||||||
@Schema(description="页码")
|
@NotNull(message = "分页参数不能为空")
|
||||||
private int page=1;
|
@Schema(description = "分页参数")
|
||||||
|
private PageSo pageSo;
|
||||||
@Schema(description="每页条数")
|
|
||||||
private int pageSize=999;
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,21 @@
|
||||||
|
package com.gunshi.project.xyt.entity.basedata;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import jakarta.validation.constraints.NotBlank;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Sun Lejun
|
||||||
|
* @version 1.0
|
||||||
|
* @date 2024/1/26
|
||||||
|
*/
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@Schema(description = "表单参数校验对象")
|
||||||
|
public class CheckStringSearch {
|
||||||
|
@Schema(description="编码/名称/关键词")
|
||||||
|
@NotBlank(message = "关键词不能为空")
|
||||||
|
private String keyword;
|
||||||
|
@Schema(description="修改时候传入当前对象id,用来排除自己")
|
||||||
|
private Long id;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,23 @@
|
||||||
|
package com.gunshi.project.xyt.entity.basedata;
|
||||||
|
|
||||||
|
import com.gunshi.db.dto.PageSo;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import jakarta.validation.constraints.NotNull;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Sun Lejun
|
||||||
|
* @version 1.0
|
||||||
|
* @date 2024/1/25
|
||||||
|
*/
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@Schema(description="通用关键词分页查询对象")
|
||||||
|
public class GeneralSearch {
|
||||||
|
@Schema(description="关键词:名称,编码", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
|
||||||
|
private String keyword;
|
||||||
|
|
||||||
|
@NotNull(message = "分页参数不能为空")
|
||||||
|
@Schema(description = "分页参数")
|
||||||
|
private PageSo pageSo;
|
||||||
|
}
|
||||||
|
|
@ -21,7 +21,7 @@ import java.util.List;
|
||||||
@ToString(callSuper = true)
|
@ToString(callSuper = true)
|
||||||
@Schema(description="视频点树信息")
|
@Schema(description="视频点树信息")
|
||||||
public class StCameraAreaTreeVo extends StCameraAreaB implements Serializable {
|
public class StCameraAreaTreeVo extends StCameraAreaB implements Serializable {
|
||||||
@Schema(description="子对象")
|
@Schema(description="子区域对象")
|
||||||
private List<StCameraAreaTreeVo> children = Lists.newArrayList();
|
private List<StCameraAreaTreeVo> children = Lists.newArrayList();
|
||||||
@Schema(description="监控点列表")
|
@Schema(description="监控点列表")
|
||||||
private List<StCameraVo> cameraList = Lists.newArrayList();
|
private List<StCameraVo> cameraList = Lists.newArrayList();
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,10 @@ package com.gunshi.project.xyt.entity.basedata;
|
||||||
|
|
||||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||||
|
import com.gunshi.db.dto.PageSo;
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import jakarta.validation.constraints.NotNull;
|
||||||
|
import jakarta.validation.constraints.Size;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
@ -16,17 +19,16 @@ import java.io.Serializable;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
@Schema(description = "视频点查询对象")
|
@Schema(description = "视频点查询对象")
|
||||||
public class StCameraSearch implements Serializable {
|
public class StCameraSearch {
|
||||||
@Schema(description="关键词:名称")
|
@Schema(description="关键词:名称")
|
||||||
|
@Size(max = 20, message = "关键词长度不能超过20")
|
||||||
private String keyword;
|
private String keyword;
|
||||||
|
|
||||||
@Schema(description="监控点类型")
|
@Schema(description="监控点类型 传枚举ID")
|
||||||
@JsonSerialize(using = ToStringSerializer.class)
|
@JsonSerialize(using = ToStringSerializer.class)
|
||||||
private Long camType;
|
private Long camType;
|
||||||
|
|
||||||
@Schema(description="页码")
|
@NotNull(message = "分页参数不能为空")
|
||||||
private int page=1;
|
@Schema(description = "分页参数")
|
||||||
|
private PageSo pageSo;
|
||||||
@Schema(description="每页条数")
|
|
||||||
private int pageSize=999;
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,23 +0,0 @@
|
||||||
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
|
|
||||||
@Schema(description="字典查询对象")
|
|
||||||
public class SysDictSearch {
|
|
||||||
@Schema(description="关键词:名称,编码")
|
|
||||||
private String keyword;
|
|
||||||
|
|
||||||
@Schema(description="页码")
|
|
||||||
private int page=1;
|
|
||||||
|
|
||||||
@Schema(description="每页条数")
|
|
||||||
private int pageSize=999;
|
|
||||||
}
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
package com.gunshi.project.xyt.mapper;
|
package com.gunshi.project.xyt.mapper;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.gunshi.project.xyt.entity.basedata.StCameraAreaTreeVo;
|
import com.gunshi.project.xyt.entity.basedata.StCameraAreaTreeVo;
|
||||||
import com.gunshi.project.xyt.entity.basedata.StCameraAreaVo;
|
import com.gunshi.project.xyt.entity.basedata.StCameraAreaVo;
|
||||||
import com.gunshi.project.xyt.model.StCameraAreaB;
|
import com.gunshi.project.xyt.model.StCameraAreaB;
|
||||||
|
|
@ -12,7 +13,8 @@ import org.apache.ibatis.annotations.Param;
|
||||||
public interface StCameraAreaBMapper extends BaseMapper<StCameraAreaB> {
|
public interface StCameraAreaBMapper extends BaseMapper<StCameraAreaB> {
|
||||||
int batchInsert(@Param("list") List<StCameraAreaB> list);
|
int batchInsert(@Param("list") List<StCameraAreaB> list);
|
||||||
|
|
||||||
List<StCameraAreaVo> queryStCameraAreaBList(@Param("name") String name);
|
Page<StCameraAreaVo> queryStCameraAreaBList(Page<StCameraAreaVo> page, @Param("name") String name);
|
||||||
|
|
||||||
|
List<StCameraAreaVo> queryStCameraAreaBList(@Param("name") String name);
|
||||||
List<StCameraAreaTreeVo> queryStCameraAreaBTree();
|
List<StCameraAreaTreeVo> queryStCameraAreaBTree();
|
||||||
}
|
}
|
||||||
|
|
@ -1,15 +1,15 @@
|
||||||
package com.gunshi.project.xyt.mapper;
|
package com.gunshi.project.xyt.mapper;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.gunshi.db.dao.IMapper;
|
import com.gunshi.db.dao.IMapper;
|
||||||
import com.gunshi.project.xyt.entity.basedata.SysDictSearch;
|
import com.gunshi.project.xyt.entity.basedata.GeneralSearch;
|
||||||
import com.gunshi.project.xyt.entity.basedata.SysDictVo;
|
import com.gunshi.project.xyt.entity.basedata.SysDictVo;
|
||||||
import com.gunshi.project.xyt.model.SysDictB;
|
import com.gunshi.project.xyt.model.SysDictB;
|
||||||
import java.util.List;
|
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
@Mapper
|
@Mapper
|
||||||
public interface SysDictBMapper extends IMapper<SysDictB> {
|
public interface SysDictBMapper extends IMapper<SysDictB> {
|
||||||
int batchInsert(@Param("list") List<SysDictB> list);
|
int batchInsert(@Param("list") List<SysDictB> list);
|
||||||
|
|
@ -26,7 +26,7 @@ public interface SysDictBMapper extends IMapper<SysDictB> {
|
||||||
* @param search 查询条件
|
* @param search 查询条件
|
||||||
* @return PID和ID
|
* @return PID和ID
|
||||||
*/
|
*/
|
||||||
Page<SysDictB> queryPidBySearch(Page<Long> page, @Param("obj") SysDictSearch search);
|
Page<SysDictB> queryPidBySearch(Page<Long> page, @Param("obj") GeneralSearch search);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据PID和ID查询字典记录
|
* 根据PID和ID查询字典记录
|
||||||
|
|
@ -34,4 +34,6 @@ public interface SysDictBMapper extends IMapper<SysDictB> {
|
||||||
* @return 字典
|
* @return 字典
|
||||||
*/
|
*/
|
||||||
List<SysDictVo> queryByPidOrIds(@Param("obj") List<Long> id);
|
List<SysDictVo> queryByPidOrIds(@Param("obj") List<Long> id);
|
||||||
|
|
||||||
|
List<SysDictVo> getAll();
|
||||||
}
|
}
|
||||||
|
|
@ -10,6 +10,7 @@ import java.math.BigDecimal;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
import jakarta.validation.constraints.NotBlank;
|
import jakarta.validation.constraints.NotBlank;
|
||||||
|
import jakarta.validation.constraints.NotNull;
|
||||||
import jakarta.validation.constraints.Size;
|
import jakarta.validation.constraints.Size;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
|
|
@ -25,8 +26,8 @@ public class StAddvcdD {
|
||||||
*/
|
*/
|
||||||
@TableId(value = "ADDVCD", type = IdType.INPUT)
|
@TableId(value = "ADDVCD", type = IdType.INPUT)
|
||||||
@Schema(description = "行政区划编码 15位到村组")
|
@Schema(description = "行政区划编码 15位到村组")
|
||||||
@Size(max = 15, min = 15)
|
@Size(max = 15, min = 15, message = "行政区划编码长度必须为15位")
|
||||||
@NotBlank
|
@NotBlank(message = "行政区划编码不能为空")
|
||||||
private String addvcd;
|
private String addvcd;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -34,8 +35,8 @@ public class StAddvcdD {
|
||||||
*/
|
*/
|
||||||
@TableField(value = "ADDVNM")
|
@TableField(value = "ADDVNM")
|
||||||
@Schema(description = "行政区划名称")
|
@Schema(description = "行政区划名称")
|
||||||
@Size(max = 100)
|
@Size(max = 100, message = "行政区划名称长度不能超过100")
|
||||||
@NotBlank
|
@NotBlank(message = "行政区划名称不能为空")
|
||||||
private String addvnm;
|
private String addvnm;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -72,7 +73,8 @@ public class StAddvcdD {
|
||||||
* 排序字段
|
* 排序字段
|
||||||
*/
|
*/
|
||||||
@TableField(value = "SORT_ON")
|
@TableField(value = "SORT_ON")
|
||||||
@Schema(description = "排序字段", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
|
@Schema(description = "排序字段")
|
||||||
|
@NotNull(message = "排序字段不能为空")
|
||||||
private Integer sortOn;
|
private Integer sortOn;
|
||||||
|
|
||||||
public static final String COL_ADDVCD = "ADDVCD";
|
public static final String COL_ADDVCD = "ADDVCD";
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,7 @@ import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||||
|
import com.gunshi.project.xyt.validate.markers.Update;
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
@ -31,17 +32,18 @@ public class StCameraAreaB implements Serializable {
|
||||||
@TableId(value = "CAM_AR_ID", type = IdType.INPUT)
|
@TableId(value = "CAM_AR_ID", type = IdType.INPUT)
|
||||||
@Schema(description="视频区域ID, 新增时候不需要,修改时候需要")
|
@Schema(description="视频区域ID, 新增时候不需要,修改时候需要")
|
||||||
@JsonSerialize(using = ToStringSerializer.class)
|
@JsonSerialize(using = ToStringSerializer.class)
|
||||||
|
@NotNull(groups = {Update.class}, message = "视频区域ID不能为空")
|
||||||
private Long camArId;
|
private Long camArId;
|
||||||
|
|
||||||
@TableField(value = "CAM_AR_NM")
|
@TableField(value = "CAM_AR_NM")
|
||||||
@Schema(description="视频区域名称")
|
@Schema(description="视频区域名称")
|
||||||
@NotEmpty
|
@NotEmpty(message = "视频区域名称不能为空")
|
||||||
@Size(max = 200)
|
@Size(max = 200, message = "视频区域名称长度不能超过200")
|
||||||
private String camArNm;
|
private String camArNm;
|
||||||
|
|
||||||
@TableField(value = "PID")
|
@TableField(value = "PID")
|
||||||
@Schema(description="父ID")
|
@Schema(description="父ID, 顶层传0")
|
||||||
@NotNull
|
@NotNull(message = "父ID不能为空")
|
||||||
@JsonSerialize(using = ToStringSerializer.class)
|
@JsonSerialize(using = ToStringSerializer.class)
|
||||||
private Long pid;
|
private Long pid;
|
||||||
|
|
||||||
|
|
@ -54,7 +56,7 @@ public class StCameraAreaB implements Serializable {
|
||||||
*/
|
*/
|
||||||
@TableField(value = "[STATUS]")
|
@TableField(value = "[STATUS]")
|
||||||
@Schema(description="状态 1:启用 0:禁用")
|
@Schema(description="状态 1:启用 0:禁用")
|
||||||
@NotNull
|
@NotNull(message = "状态不能为空")
|
||||||
private Integer status;
|
private Integer status;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -62,7 +64,7 @@ public class StCameraAreaB implements Serializable {
|
||||||
*/
|
*/
|
||||||
@TableField(value = "COMMENTS", updateStrategy= FieldStrategy.ALWAYS)
|
@TableField(value = "COMMENTS", updateStrategy= FieldStrategy.ALWAYS)
|
||||||
@Schema(description="备注", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
|
@Schema(description="备注", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
|
||||||
@Size(max = 200)
|
@Size(max = 200, message = "备注长度不能超过200")
|
||||||
private String comments;
|
private String comments;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -8,12 +8,14 @@ import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||||
|
import com.gunshi.project.xyt.validate.markers.Update;
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
|
import jakarta.validation.constraints.Max;
|
||||||
import jakarta.validation.constraints.NotBlank;
|
import jakarta.validation.constraints.NotBlank;
|
||||||
import jakarta.validation.constraints.NotNull;
|
import jakarta.validation.constraints.NotNull;
|
||||||
import jakarta.validation.constraints.Size;
|
import jakarta.validation.constraints.Size;
|
||||||
|
|
@ -30,8 +32,9 @@ public class StCameraB implements Serializable {
|
||||||
* 视频点id
|
* 视频点id
|
||||||
*/
|
*/
|
||||||
@TableId(value = "CAM_ID", type = IdType.INPUT)
|
@TableId(value = "CAM_ID", type = IdType.INPUT)
|
||||||
@Schema(description="视频点id", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
|
@Schema(description="视频点id")
|
||||||
@JsonSerialize(using = ToStringSerializer.class)
|
@JsonSerialize(using = ToStringSerializer.class)
|
||||||
|
@NotNull(message = "视频点id不能为空", groups = {Update.class})
|
||||||
private Long camId;
|
private Long camId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -39,16 +42,16 @@ public class StCameraB implements Serializable {
|
||||||
*/
|
*/
|
||||||
@TableField(value = "CAM_NM")
|
@TableField(value = "CAM_NM")
|
||||||
@Schema(description="视频点名称")
|
@Schema(description="视频点名称")
|
||||||
@NotBlank
|
@NotBlank(message = "视频点名称不能为空")
|
||||||
@Size(max = 200)
|
@Size(max = 200, message = "视频点名称长度不能超过200")
|
||||||
private String camNm;
|
private String camNm;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 监控点类型
|
* 监控点类型
|
||||||
*/
|
*/
|
||||||
@TableField(value = "CAM_TYPE")
|
@TableField(value = "CAM_TYPE")
|
||||||
@Schema(description="监控点类型")
|
@Schema(description="监控点类型 传字典类的ID")
|
||||||
@NotNull
|
@NotNull(message = "监控点类型不能为空")
|
||||||
@JsonSerialize(using = ToStringSerializer.class)
|
@JsonSerialize(using = ToStringSerializer.class)
|
||||||
private Long camType;
|
private Long camType;
|
||||||
|
|
||||||
|
|
@ -56,15 +59,16 @@ public class StCameraB implements Serializable {
|
||||||
* 通道号
|
* 通道号
|
||||||
*/
|
*/
|
||||||
@TableField(value = "CAM_CH", updateStrategy= FieldStrategy.ALWAYS)
|
@TableField(value = "CAM_CH", updateStrategy= FieldStrategy.ALWAYS)
|
||||||
@Schema(description="通道号", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
|
@Schema(description="通道号")
|
||||||
|
@Max(20000)
|
||||||
private Integer camCh;
|
private Integer camCh;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 所在区域
|
* 所在区域
|
||||||
*/
|
*/
|
||||||
@TableField(value = "CAM_AR_ID")
|
@TableField(value = "CAM_AR_ID")
|
||||||
@Schema(description="所在区域")
|
@Schema(description="所在区域 传视频区域ID")
|
||||||
@NotNull
|
@NotNull(message = "所在区域不能为空")
|
||||||
@JsonSerialize(using = ToStringSerializer.class)
|
@JsonSerialize(using = ToStringSerializer.class)
|
||||||
private Long camArId;
|
private Long camArId;
|
||||||
|
|
||||||
|
|
@ -73,8 +77,8 @@ public class StCameraB implements Serializable {
|
||||||
*/
|
*/
|
||||||
@TableField(value = "CAM_URL")
|
@TableField(value = "CAM_URL")
|
||||||
@Schema(description="摄像头连接地址 IP和端口")
|
@Schema(description="摄像头连接地址 IP和端口")
|
||||||
@NotNull
|
@NotNull(message = "摄像头连接地址不能为空")
|
||||||
@Size(max = 200)
|
@Size(max = 200, message = "摄像头连接地址长度不能超过200")
|
||||||
private String camUrl;
|
private String camUrl;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -82,7 +86,8 @@ public class StCameraB implements Serializable {
|
||||||
*/
|
*/
|
||||||
@TableField(value = "CAM_SN")
|
@TableField(value = "CAM_SN")
|
||||||
@Schema(description="视频序列号")
|
@Schema(description="视频序列号")
|
||||||
@NotBlank
|
@NotBlank(message = "视频序列号不能为空")
|
||||||
|
@Size(max = 200, message = "视频序列号长度不能超过200")
|
||||||
private String camSn;
|
private String camSn;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -90,7 +95,7 @@ public class StCameraB implements Serializable {
|
||||||
*/
|
*/
|
||||||
@TableField(value = "LGTD")
|
@TableField(value = "LGTD")
|
||||||
@Schema(description="经度")
|
@Schema(description="经度")
|
||||||
@NotNull
|
@NotNull(message = "经度不能为空")
|
||||||
private BigDecimal lgtd;
|
private BigDecimal lgtd;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -98,15 +103,15 @@ public class StCameraB implements Serializable {
|
||||||
*/
|
*/
|
||||||
@TableField(value = "LTTD")
|
@TableField(value = "LTTD")
|
||||||
@Schema(description="纬度")
|
@Schema(description="纬度")
|
||||||
@NotNull
|
@NotNull(message = "纬度不能为空")
|
||||||
private BigDecimal lttd;
|
private BigDecimal lttd;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 备注
|
* 备注
|
||||||
*/
|
*/
|
||||||
@TableField(value = "COMMENTS", updateStrategy= FieldStrategy.ALWAYS)
|
@TableField(value = "COMMENTS", updateStrategy= FieldStrategy.ALWAYS)
|
||||||
@Schema(description="备注", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
|
@Schema(description="备注")
|
||||||
@Size(max = 200)
|
@Size(max = 200, message = "备注长度不能超过200")
|
||||||
private String comments;
|
private String comments;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -130,7 +135,7 @@ public class StCameraB implements Serializable {
|
||||||
*/
|
*/
|
||||||
@TableField(value = "[STATUS]")
|
@TableField(value = "[STATUS]")
|
||||||
@Schema(description="状态 1:启用 0:禁用")
|
@Schema(description="状态 1:启用 0:禁用")
|
||||||
@NotNull
|
@NotNull(message = "状态不能为空")
|
||||||
private Integer status;
|
private Integer status;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -138,7 +143,7 @@ public class StCameraB implements Serializable {
|
||||||
*/
|
*/
|
||||||
@TableField(value = "DEFAULT_SHOW")
|
@TableField(value = "DEFAULT_SHOW")
|
||||||
@Schema(description = "首页默认显示 1:显示 0:不显示")
|
@Schema(description = "首页默认显示 1:显示 0:不显示")
|
||||||
@NotNull
|
@NotNull(message = "首页默认显示不能为空")
|
||||||
private Integer defaultShow;
|
private Integer defaultShow;
|
||||||
|
|
||||||
public static final String COL_CAM_ID = "CAM_ID";
|
public static final String COL_CAM_ID = "CAM_ID";
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,8 @@ import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||||
|
import com.gunshi.project.xyt.validate.markers.Insert;
|
||||||
|
import com.gunshi.project.xyt.validate.markers.Update;
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
@ -28,8 +30,9 @@ public class SysDictB implements Serializable {
|
||||||
* ID
|
* ID
|
||||||
*/
|
*/
|
||||||
@TableId(value = "ID", type = IdType.INPUT)
|
@TableId(value = "ID", type = IdType.INPUT)
|
||||||
@Schema(description="ID", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
|
@Schema(description="ID 更新字典时候需要传入")
|
||||||
@JsonSerialize(using = ToStringSerializer.class)
|
@JsonSerialize(using = ToStringSerializer.class)
|
||||||
|
@NotNull(message = "ID不能为空", groups = {Update.class})
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -37,8 +40,8 @@ public class SysDictB implements Serializable {
|
||||||
*/
|
*/
|
||||||
@TableField(value = "DICT_NM")
|
@TableField(value = "DICT_NM")
|
||||||
@Schema(description="字典名称")
|
@Schema(description="字典名称")
|
||||||
@NotBlank
|
@NotBlank(message = "字典名称不能为空")
|
||||||
@Size(max = 200)
|
@Size(max = 200, message = "字典名称长度不能超过200")
|
||||||
private String dictNm;
|
private String dictNm;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -46,16 +49,16 @@ public class SysDictB implements Serializable {
|
||||||
*/
|
*/
|
||||||
@TableField(value = "DICT_CD")
|
@TableField(value = "DICT_CD")
|
||||||
@Schema(description="字典编码")
|
@Schema(description="字典编码")
|
||||||
@NotBlank
|
@NotBlank(message = "字典编码不能为空")
|
||||||
@Size(max = 100)
|
@Size(max = 100, message = "字典编码长度不能超过100")
|
||||||
private String dictCd;
|
private String dictCd;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 父id
|
* 父id
|
||||||
*/
|
*/
|
||||||
@TableField(value = "PID")
|
@TableField(value = "PID")
|
||||||
@Schema(description="父id")
|
@Schema(description="父id, 如果是顶层字典,则为0")
|
||||||
@NotNull
|
@NotNull(message = "父id不能为空")
|
||||||
@JsonSerialize(using = ToStringSerializer.class)
|
@JsonSerialize(using = ToStringSerializer.class)
|
||||||
private Long pid;
|
private Long pid;
|
||||||
|
|
||||||
|
|
@ -64,7 +67,7 @@ public class SysDictB implements Serializable {
|
||||||
*/
|
*/
|
||||||
@TableField(value = "SORT_ON")
|
@TableField(value = "SORT_ON")
|
||||||
@Schema(description="排序字段")
|
@Schema(description="排序字段")
|
||||||
@NotNull
|
@NotNull(message = "排序字段不能为空")
|
||||||
private Integer sortOn;
|
private Integer sortOn;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -88,7 +91,7 @@ public class SysDictB implements Serializable {
|
||||||
*/
|
*/
|
||||||
@TableField(value = "[STATUS]")
|
@TableField(value = "[STATUS]")
|
||||||
@Schema(description="状态 1:启用 0:禁用")
|
@Schema(description="状态 1:启用 0:禁用")
|
||||||
@NotNull
|
@NotNull(message = "状态不能为空 删除时候传0 其他1")
|
||||||
private Integer status;
|
private Integer status;
|
||||||
|
|
||||||
public static final String COL_ID = "ID";
|
public static final String COL_ID = "ID";
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,6 @@ import com.gunshi.project.xyt.mapper.StAddvcdDMapper;
|
||||||
import com.gunshi.project.xyt.model.StAddvcdD;
|
import com.gunshi.project.xyt.model.StAddvcdD;
|
||||||
import com.gunshi.util.common.tree.TreeUtil;
|
import com.gunshi.util.common.tree.TreeUtil;
|
||||||
import org.apache.commons.collections4.CollectionUtils;
|
import org.apache.commons.collections4.CollectionUtils;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
@ -50,7 +49,7 @@ public class StAdcdService extends BaseOrderDao<StAddvcdDMapper, StAddvcdD> {
|
||||||
queryWrapper.or();
|
queryWrapper.or();
|
||||||
queryWrapper.like(StAddvcdD.COL_ADDVNM, addvcdSearch.getKeyword());
|
queryWrapper.like(StAddvcdD.COL_ADDVNM, addvcdSearch.getKeyword());
|
||||||
queryWrapper.orderByAsc(StAddvcdD.COL_SORT_ON);
|
queryWrapper.orderByAsc(StAddvcdD.COL_SORT_ON);
|
||||||
return super.page(new Page<>(addvcdSearch.getPage(), addvcdSearch.getPageSize()), queryWrapper);
|
return super.page(addvcdSearch.getPageSo().toPage(), queryWrapper);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -65,13 +64,10 @@ public class StAdcdService extends BaseOrderDao<StAddvcdDMapper, StAddvcdD> {
|
||||||
}
|
}
|
||||||
stAddvcdTreeVos.forEach(t -> t.setParentCode(getParentAddvcd(t.getAddvcd())));
|
stAddvcdTreeVos.forEach(t -> t.setParentCode(getParentAddvcd(t.getAddvcd())));
|
||||||
String parentKey;
|
String parentKey;
|
||||||
if(StringUtils.isBlank(addvcd)){
|
if (addvcd.length() >= 15) {
|
||||||
parentKey = "/";
|
return stAddvcdTreeVos;
|
||||||
}
|
|
||||||
if (addvcd.length() > 15) {
|
|
||||||
parentKey = addvcd.substring(0, 15);
|
|
||||||
} else {
|
} else {
|
||||||
parentKey = String.format("%1$-15s", addvcd).replace(' ', '0');
|
parentKey = getParentAddvcd(String.format("%1$-15s", addvcd).replace(' ', '0'));
|
||||||
}
|
}
|
||||||
|
|
||||||
return TreeUtil.list2ListTree(
|
return TreeUtil.list2ListTree(
|
||||||
|
|
@ -79,6 +75,27 @@ public class StAdcdService extends BaseOrderDao<StAddvcdDMapper, StAddvcdD> {
|
||||||
StAddvcdTreeVo::getAddvcd, StAddvcdTreeVo::getParentCode, StAddvcdTreeVo::setChildren, null);
|
StAddvcdTreeVo::getAddvcd, StAddvcdTreeVo::getParentCode, StAddvcdTreeVo::setChildren, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增行政区划
|
||||||
|
* @param stAddvcdD 行政区划信息
|
||||||
|
*/
|
||||||
|
public void insert(StAddvcdD stAddvcdD) {
|
||||||
|
stAddvcdD.setTm(new Date());
|
||||||
|
stAddvcdD.setCreateTm(new Date());
|
||||||
|
super.save(stAddvcdD);
|
||||||
|
resort(stAddvcdD);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新行政区划
|
||||||
|
* @param stAddvcdD 行政区划信息
|
||||||
|
*/
|
||||||
|
public void update(StAddvcdD stAddvcdD) {
|
||||||
|
stAddvcdD.setTm(new Date());
|
||||||
|
super.updateById(stAddvcdD);
|
||||||
|
resort(stAddvcdD);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 重新排序
|
* 重新排序
|
||||||
* @param stAddvcdD 区划信息
|
* @param stAddvcdD 区划信息
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,10 @@
|
||||||
package com.gunshi.project.xyt.service;
|
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.conditions.query.QueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
|
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.gunshi.project.xyt.entity.basedata.CheckStringSearch;
|
||||||
|
import com.gunshi.project.xyt.entity.basedata.GeneralSearch;
|
||||||
import com.gunshi.project.xyt.entity.basedata.StCameraAreaTreeVo;
|
import com.gunshi.project.xyt.entity.basedata.StCameraAreaTreeVo;
|
||||||
import com.gunshi.project.xyt.entity.basedata.StCameraAreaVo;
|
import com.gunshi.project.xyt.entity.basedata.StCameraAreaVo;
|
||||||
import com.gunshi.project.xyt.entity.basedata.StCameraVo;
|
import com.gunshi.project.xyt.entity.basedata.StCameraVo;
|
||||||
|
|
@ -10,7 +12,6 @@ import com.gunshi.project.xyt.mapper.StCameraAreaBMapper;
|
||||||
import com.gunshi.project.xyt.mapper.StCameraBMapper;
|
import com.gunshi.project.xyt.mapper.StCameraBMapper;
|
||||||
import com.gunshi.project.xyt.model.StCameraAreaB;
|
import com.gunshi.project.xyt.model.StCameraAreaB;
|
||||||
import com.gunshi.util.common.tree.TreeUtil;
|
import com.gunshi.util.common.tree.TreeUtil;
|
||||||
import jakarta.validation.Valid;
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
@ -55,7 +56,7 @@ public class StCameraAreaService {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
return TreeUtil.list2ListTree(list, Long.valueOf(0L),
|
return TreeUtil.list2ListTree(list, 0L,
|
||||||
StCameraAreaTreeVo::getCamArId, StCameraAreaTreeVo::getPid,
|
StCameraAreaTreeVo::getCamArId, StCameraAreaTreeVo::getPid,
|
||||||
StCameraAreaTreeVo::setChildren, null);
|
StCameraAreaTreeVo::setChildren, null);
|
||||||
}
|
}
|
||||||
|
|
@ -65,6 +66,11 @@ public class StCameraAreaService {
|
||||||
* 查询视频区域列表
|
* 查询视频区域列表
|
||||||
* @return 视频区域列表
|
* @return 视频区域列表
|
||||||
*/
|
*/
|
||||||
|
public Page<StCameraAreaVo> queryListBySearch(GeneralSearch search) {
|
||||||
|
Page<StCameraAreaVo> page = search.getPageSo().toPage();
|
||||||
|
return stCameraAreaBMapper.queryStCameraAreaBList(page, search.getKeyword());
|
||||||
|
}
|
||||||
|
|
||||||
public List<StCameraAreaVo> queryListByName(String name) {
|
public List<StCameraAreaVo> queryListByName(String name) {
|
||||||
return stCameraAreaBMapper.queryStCameraAreaBList(name);
|
return stCameraAreaBMapper.queryStCameraAreaBList(name);
|
||||||
}
|
}
|
||||||
|
|
@ -74,7 +80,7 @@ public class StCameraAreaService {
|
||||||
*
|
*
|
||||||
* @param stCameraAreaB 视频区域
|
* @param stCameraAreaB 视频区域
|
||||||
*/
|
*/
|
||||||
public void insert(@Valid StCameraAreaB stCameraAreaB) {
|
public void insert(StCameraAreaB stCameraAreaB) {
|
||||||
checkStCameraAreaB(stCameraAreaB);
|
checkStCameraAreaB(stCameraAreaB);
|
||||||
|
|
||||||
QueryWrapper<StCameraAreaB> queryWrapper = new QueryWrapper<>();
|
QueryWrapper<StCameraAreaB> queryWrapper = new QueryWrapper<>();
|
||||||
|
|
@ -101,7 +107,7 @@ public class StCameraAreaService {
|
||||||
*
|
*
|
||||||
* @param stCameraAreaB 视频区域
|
* @param stCameraAreaB 视频区域
|
||||||
*/
|
*/
|
||||||
public void update(@Valid StCameraAreaB stCameraAreaB) {
|
public void update(StCameraAreaB stCameraAreaB) {
|
||||||
Long camArId = stCameraAreaB.getCamArId();
|
Long camArId = stCameraAreaB.getCamArId();
|
||||||
QueryWrapper<StCameraAreaB> queryWrapper2 = new QueryWrapper<>();
|
QueryWrapper<StCameraAreaB> queryWrapper2 = new QueryWrapper<>();
|
||||||
queryWrapper2.eq(StCameraAreaB.COL_CAM_AR_ID, camArId);
|
queryWrapper2.eq(StCameraAreaB.COL_CAM_AR_ID, camArId);
|
||||||
|
|
@ -140,5 +146,22 @@ public class StCameraAreaService {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 检查视频区域名称是否存在
|
||||||
|
* @param search 检查参数
|
||||||
|
*/
|
||||||
|
public void checkAreaName(CheckStringSearch search){
|
||||||
|
QueryWrapper<StCameraAreaB> queryWrapper = new QueryWrapper<>();
|
||||||
|
queryWrapper.eq(StCameraAreaB.COL_STATUS, 1);
|
||||||
|
queryWrapper.eq(StCameraAreaB.COL_CAM_AR_NM, search.getKeyword());
|
||||||
|
if(Objects.nonNull(search.getId())){
|
||||||
|
queryWrapper.not(t -> t.eq(StCameraAreaB.COL_CAM_AR_ID, search.getId()));
|
||||||
|
}
|
||||||
|
boolean exists = stCameraAreaBMapper.exists(queryWrapper);
|
||||||
|
if(exists){
|
||||||
|
throw new IllegalArgumentException("视频区域名称已存在");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -36,7 +36,7 @@ public class StCameraService {
|
||||||
}
|
}
|
||||||
|
|
||||||
public Page<StCameraVo> queryBySearch(StCameraSearch stCameraSearch){
|
public Page<StCameraVo> queryBySearch(StCameraSearch stCameraSearch){
|
||||||
Page<StCameraVo> page = new Page<>(stCameraSearch.getPage(), stCameraSearch.getPageSize());
|
Page<StCameraVo> page = stCameraSearch.getPageSo().toPage();
|
||||||
return stCameraBMapper.queryBySearch(page, stCameraSearch);
|
return stCameraBMapper.queryBySearch(page, stCameraSearch);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,19 +3,20 @@ package com.gunshi.project.xyt.service;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
|
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.google.common.collect.Lists;
|
||||||
import com.gunshi.db.dao.BaseOrderDao;
|
import com.gunshi.db.dao.BaseOrderDao;
|
||||||
import com.gunshi.project.xyt.entity.basedata.SysDictSearch;
|
import com.gunshi.project.xyt.entity.basedata.GeneralSearch;
|
||||||
import com.gunshi.project.xyt.entity.basedata.SysDictVo;
|
import com.gunshi.project.xyt.entity.basedata.SysDictVo;
|
||||||
import com.gunshi.project.xyt.mapper.SysDictBMapper;
|
import com.gunshi.project.xyt.mapper.SysDictBMapper;
|
||||||
import com.gunshi.project.xyt.model.SysDictB;
|
import com.gunshi.project.xyt.model.SysDictB;
|
||||||
import com.gunshi.util.common.tree.TreeUtil;
|
import com.gunshi.util.common.tree.TreeUtil;
|
||||||
import jakarta.validation.Valid;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -38,21 +39,32 @@ public class SysDictService extends BaseOrderDao<SysDictBMapper, SysDictB> {
|
||||||
return this.getBaseMapper().selectById(id);
|
return this.getBaseMapper().selectById(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<SysDictVo> queryByPid(Long pid){
|
||||||
|
List<SysDictVo> sysDictVos;
|
||||||
|
if(Objects.isNull(pid)){
|
||||||
|
sysDictVos = this.getBaseMapper().getAll();
|
||||||
|
}else {
|
||||||
|
sysDictVos = this.getBaseMapper().queryByPidOrIds(Lists.newArrayList(pid));
|
||||||
|
}
|
||||||
|
//转换成tree
|
||||||
|
return TreeUtil.list2ListTree(sysDictVos, 0L, SysDictVo::getId, SysDictVo::getPid, SysDictVo::setChildren, null);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据名称或者编码查询字典
|
* 根据名称或者编码查询字典
|
||||||
* @param search 查询条件
|
* @param search 查询条件
|
||||||
* @return 字典tree
|
* @return 字典tree
|
||||||
*/
|
*/
|
||||||
public Page<SysDictVo> queryBySearch(SysDictSearch search) {
|
public Page<SysDictVo> queryBySearch(GeneralSearch search) {
|
||||||
|
|
||||||
//构建分页对象
|
//构建分页对象
|
||||||
Page<Long> page = new Page<>(search.getPage(), search.getPageSize());
|
Page<Long> page = search.getPageSo().toPage();
|
||||||
//按PID和ID进行分页查询
|
//按PID和ID进行分页查询
|
||||||
Page<SysDictB> sysDictVoPage = this.getBaseMapper().queryPidBySearch(page, search);
|
Page<SysDictB> sysDictVoPage = this.getBaseMapper().queryPidBySearch(page, search);
|
||||||
long total = sysDictVoPage.getTotal();
|
long total = sysDictVoPage.getTotal();
|
||||||
long current = sysDictVoPage.getCurrent();
|
long current = sysDictVoPage.getCurrent();
|
||||||
if(total == 0) {
|
if(total == 0) {
|
||||||
return new Page<>(current, search.getPageSize());
|
return new Page<>(current, page.getSize());
|
||||||
}
|
}
|
||||||
//拿出查询出来的PID和ID,获取完整的记录
|
//拿出查询出来的PID和ID,获取完整的记录
|
||||||
List<SysDictB> records = sysDictVoPage.getRecords();
|
List<SysDictB> records = sysDictVoPage.getRecords();
|
||||||
|
|
@ -61,7 +73,7 @@ public class SysDictService extends BaseOrderDao<SysDictBMapper, SysDictB> {
|
||||||
//转换成tree
|
//转换成tree
|
||||||
List<SysDictVo> tree = TreeUtil.list2ListTree(sysDictVos, 0L, SysDictVo::getId, SysDictVo::getPid, SysDictVo::setChildren, null);
|
List<SysDictVo> tree = TreeUtil.list2ListTree(sysDictVos, 0L, SysDictVo::getId, SysDictVo::getPid, SysDictVo::setChildren, null);
|
||||||
//构建返回对象
|
//构建返回对象
|
||||||
Page<SysDictVo> result = new Page<>(search.getPage(), search.getPageSize());
|
Page<SysDictVo> result = new Page<>(page.getCurrent(), page.getSize());
|
||||||
result.setCurrent(current);
|
result.setCurrent(current);
|
||||||
result.setTotal(total);
|
result.setTotal(total);
|
||||||
result.setRecords(tree);
|
result.setRecords(tree);
|
||||||
|
|
@ -72,7 +84,7 @@ public class SysDictService extends BaseOrderDao<SysDictBMapper, SysDictB> {
|
||||||
* 新增字典
|
* 新增字典
|
||||||
* @param sysDictB 字典信息
|
* @param sysDictB 字典信息
|
||||||
*/
|
*/
|
||||||
public void insert(@Valid SysDictB sysDictB) {
|
public void insert(SysDictB sysDictB) {
|
||||||
checkExistCodeAndName(sysDictB);
|
checkExistCodeAndName(sysDictB);
|
||||||
sysDictB.setId(IdWorker.getId());
|
sysDictB.setId(IdWorker.getId());
|
||||||
sysDictB.setStatus(1);
|
sysDictB.setStatus(1);
|
||||||
|
|
@ -86,7 +98,7 @@ public class SysDictService extends BaseOrderDao<SysDictBMapper, SysDictB> {
|
||||||
* 更新字典
|
* 更新字典
|
||||||
* @param sysDictB 字典信息
|
* @param sysDictB 字典信息
|
||||||
*/
|
*/
|
||||||
public void update(@Valid SysDictB sysDictB) {
|
public void update(SysDictB sysDictB) {
|
||||||
checkExistById(sysDictB);
|
checkExistById(sysDictB);
|
||||||
checkExistCodeAndName(sysDictB);
|
checkExistCodeAndName(sysDictB);
|
||||||
sysDictB.setTm(new Date());
|
sysDictB.setTm(new Date());
|
||||||
|
|
@ -127,7 +139,7 @@ public class SysDictService extends BaseOrderDao<SysDictBMapper, SysDictB> {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 重新给字典排序
|
* 重新给字典排序
|
||||||
* @param sysDictB
|
* @param sysDictB 字典信息
|
||||||
*/
|
*/
|
||||||
private void resort(SysDictB sysDictB){
|
private void resort(SysDictB sysDictB){
|
||||||
Long pid = sysDictB.getPid();
|
Long pid = sysDictB.getPid();
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,7 @@
|
||||||
</insert>
|
</insert>
|
||||||
|
|
||||||
<select id="queryStCameraAreaBList" resultType="com.gunshi.project.xyt.entity.basedata.StCameraAreaVo">
|
<select id="queryStCameraAreaBList" resultType="com.gunshi.project.xyt.entity.basedata.StCameraAreaVo">
|
||||||
select t1.CAM_AR_ID, t1.CAM_AR_NM, t1.PID, t1.SORT_ON, t1.[STATUS], t1.COMMENTS, t1.CREATE_TM, t1.TM,
|
select t1.CAM_AR_ID, t1.CAM_AR_NM, t1.PID, t1.SORT_ON, t1.STATUS, t1.COMMENTS, t1.CREATE_TM, t1.TM,
|
||||||
t2.CAM_AR_NM PID_NAME
|
t2.CAM_AR_NM PID_NAME
|
||||||
from ST_CAMERA_AREA_B t1
|
from ST_CAMERA_AREA_B t1
|
||||||
left join ST_CAMERA_AREA_B t2 on t1.pid=t2.CAM_AR_ID
|
left join ST_CAMERA_AREA_B t2 on t1.pid=t2.CAM_AR_ID
|
||||||
|
|
|
||||||
|
|
@ -82,7 +82,17 @@
|
||||||
<foreach item="it" collection="obj" separator="," open="(" close=")">
|
<foreach item="it" collection="obj" separator="," open="(" close=")">
|
||||||
#{it}
|
#{it}
|
||||||
</foreach>
|
</foreach>
|
||||||
|
and STATUS = 1
|
||||||
</where>
|
</where>
|
||||||
order by SORT_ON
|
order by SORT_ON
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="getAll" resultType="com.gunshi.project.xyt.entity.basedata.SysDictVo">
|
||||||
|
select
|
||||||
|
<include refid="Base_Column_List"/>
|
||||||
|
from SYS_DICT_B a
|
||||||
|
<where>
|
||||||
|
and STATUS = 1
|
||||||
|
</where>
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
@ -1,6 +1,9 @@
|
||||||
package com.gunshi.project.xyt.service;
|
package com.gunshi.project.xyt.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.gunshi.db.dto.PageSo;
|
||||||
import com.gunshi.project.xyt.Main;
|
import com.gunshi.project.xyt.Main;
|
||||||
|
import com.gunshi.project.xyt.entity.basedata.GeneralSearch;
|
||||||
import com.gunshi.project.xyt.entity.basedata.StCameraAreaTreeVo;
|
import com.gunshi.project.xyt.entity.basedata.StCameraAreaTreeVo;
|
||||||
import com.gunshi.project.xyt.entity.basedata.StCameraAreaVo;
|
import com.gunshi.project.xyt.entity.basedata.StCameraAreaVo;
|
||||||
import com.gunshi.project.xyt.model.StCameraAreaB;
|
import com.gunshi.project.xyt.model.StCameraAreaB;
|
||||||
|
|
@ -26,6 +29,11 @@ class StCameraAreaServiceTest {
|
||||||
log.info("{}", list1);
|
log.info("{}", list1);
|
||||||
List<StCameraAreaVo> list2 = stCameraAreaService.queryListByName("");
|
List<StCameraAreaVo> list2 = stCameraAreaService.queryListByName("");
|
||||||
log.info("{}", list2);
|
log.info("{}", list2);
|
||||||
|
GeneralSearch generalSearch = new GeneralSearch();
|
||||||
|
generalSearch.setKeyword("");
|
||||||
|
generalSearch.setPageSo(PageSo.of(1, 10));
|
||||||
|
Page<StCameraAreaVo> stCameraAreaVoPage = stCameraAreaService.queryListBySearch(generalSearch);
|
||||||
|
log.info("{}", JacksonUtils.writeValue(stCameraAreaVoPage));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
package com.gunshi.project.xyt.service;
|
package com.gunshi.project.xyt.service;
|
||||||
|
|
||||||
import com.gunshi.project.xyt.Main;
|
import com.gunshi.project.xyt.Main;
|
||||||
import com.gunshi.project.xyt.entity.basedata.SysDictSearch;
|
import com.gunshi.project.xyt.entity.basedata.GeneralSearch;
|
||||||
import com.gunshi.project.xyt.model.SysDictB;
|
import com.gunshi.project.xyt.model.SysDictB;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
@ -10,8 +10,6 @@ import org.springframework.boot.test.context.SpringBootTest;
|
||||||
import org.springframework.test.context.ContextConfiguration;
|
import org.springframework.test.context.ContextConfiguration;
|
||||||
import ru.olegcherednik.jackson_utils.JacksonUtils;
|
import ru.olegcherednik.jackson_utils.JacksonUtils;
|
||||||
|
|
||||||
import static org.junit.jupiter.api.Assertions.*;
|
|
||||||
|
|
||||||
@SpringBootTest
|
@SpringBootTest
|
||||||
@ContextConfiguration(classes = Main.class)
|
@ContextConfiguration(classes = Main.class)
|
||||||
@Slf4j
|
@Slf4j
|
||||||
|
|
@ -38,22 +36,16 @@ class SysDictServiceTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void queryBySearch() {
|
void queryBySearch() {
|
||||||
SysDictSearch sysDictSearch = new SysDictSearch();
|
GeneralSearch sysDictSearch = new GeneralSearch();
|
||||||
sysDictSearch.setKeyword("");
|
sysDictSearch.setKeyword("");
|
||||||
sysDictSearch.setPage(1);
|
|
||||||
sysDictSearch.setPageSize(10);
|
|
||||||
log.info("{}", JacksonUtils.writeValue(sysDictService.queryBySearch(sysDictSearch)));
|
log.info("{}", JacksonUtils.writeValue(sysDictService.queryBySearch(sysDictSearch)));
|
||||||
|
|
||||||
sysDictSearch = new SysDictSearch();
|
sysDictSearch = new GeneralSearch();
|
||||||
sysDictSearch.setKeyword("类型");
|
sysDictSearch.setKeyword("类型");
|
||||||
sysDictSearch.setPage(1);
|
|
||||||
sysDictSearch.setPageSize(10);
|
|
||||||
log.info("{}", JacksonUtils.writeValue(sysDictService.queryBySearch(sysDictSearch)));
|
log.info("{}", JacksonUtils.writeValue(sysDictService.queryBySearch(sysDictSearch)));
|
||||||
|
|
||||||
sysDictSearch = new SysDictSearch();
|
sysDictSearch = new GeneralSearch();
|
||||||
sysDictSearch.setKeyword("类型");
|
sysDictSearch.setKeyword("类型");
|
||||||
sysDictSearch.setPage(1);
|
|
||||||
sysDictSearch.setPageSize(1);
|
|
||||||
log.info("{}", JacksonUtils.writeValue(sysDictService.queryBySearch(sysDictSearch)));
|
log.info("{}", JacksonUtils.writeValue(sysDictService.queryBySearch(sysDictSearch)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Loading…
Reference in New Issue