区域管理
This commit is contained in:
@@ -0,0 +1,106 @@
|
|||||||
|
package org.dromara.property.controller;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
|
import jakarta.validation.constraints.*;
|
||||||
|
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.dromara.common.idempotent.annotation.RepeatSubmit;
|
||||||
|
import org.dromara.common.log.annotation.Log;
|
||||||
|
import org.dromara.common.web.core.BaseController;
|
||||||
|
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||||
|
import org.dromara.common.core.domain.R;
|
||||||
|
import org.dromara.common.core.validate.AddGroup;
|
||||||
|
import org.dromara.common.core.validate.EditGroup;
|
||||||
|
import org.dromara.common.log.enums.BusinessType;
|
||||||
|
import org.dromara.common.excel.utils.ExcelUtil;
|
||||||
|
import org.dromara.property.domain.vo.AttendanceAreaDeviceVo;
|
||||||
|
import org.dromara.property.domain.bo.AttendanceAreaDeviceBo;
|
||||||
|
import org.dromara.property.service.IAttendanceAreaDeviceService;
|
||||||
|
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 摄像头区域中间
|
||||||
|
* 前端访问路由地址为:/property/areaDevice
|
||||||
|
*
|
||||||
|
* @author LionLi
|
||||||
|
* @date 2025-08-17
|
||||||
|
*/
|
||||||
|
@Validated
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/areaDevice")
|
||||||
|
public class AttendanceAreaDeviceController extends BaseController {
|
||||||
|
|
||||||
|
private final IAttendanceAreaDeviceService attendanceAreaDeviceService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询摄像头区域中间列表
|
||||||
|
*/
|
||||||
|
@SaCheckPermission("property:areaDevice:list")
|
||||||
|
@GetMapping("/list")
|
||||||
|
public TableDataInfo<AttendanceAreaDeviceVo> list(AttendanceAreaDeviceBo bo, PageQuery pageQuery) {
|
||||||
|
return attendanceAreaDeviceService.queryPageList(bo, pageQuery);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出摄像头区域中间列表
|
||||||
|
*/
|
||||||
|
@SaCheckPermission("property:areaDevice:export")
|
||||||
|
@Log(title = "摄像头区域中间", businessType = BusinessType.EXPORT)
|
||||||
|
@PostMapping("/export")
|
||||||
|
public void export(AttendanceAreaDeviceBo bo, HttpServletResponse response) {
|
||||||
|
List<AttendanceAreaDeviceVo> list = attendanceAreaDeviceService.queryList(bo);
|
||||||
|
ExcelUtil.exportExcel(list, "摄像头区域中间", AttendanceAreaDeviceVo.class, response);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取摄像头区域中间详细信息
|
||||||
|
*
|
||||||
|
* @param id 主键
|
||||||
|
*/
|
||||||
|
@SaCheckPermission("property:areaDevice:query")
|
||||||
|
@GetMapping("/{id}")
|
||||||
|
public R<AttendanceAreaDeviceVo> getInfo(@NotNull(message = "主键不能为空")
|
||||||
|
@PathVariable("id") Long id) {
|
||||||
|
return R.ok(attendanceAreaDeviceService.queryById(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增摄像头区域中间
|
||||||
|
*/
|
||||||
|
@SaCheckPermission("property:areaDevice:add")
|
||||||
|
@Log(title = "摄像头区域中间", businessType = BusinessType.INSERT)
|
||||||
|
@RepeatSubmit()
|
||||||
|
@PostMapping()
|
||||||
|
public R<Void> add(@Validated(AddGroup.class) @RequestBody AttendanceAreaDeviceBo bo) {
|
||||||
|
return toAjax(attendanceAreaDeviceService.insertByBo(bo));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改摄像头区域中间
|
||||||
|
*/
|
||||||
|
@SaCheckPermission("property:areaDevice:edit")
|
||||||
|
@Log(title = "摄像头区域中间", businessType = BusinessType.UPDATE)
|
||||||
|
@RepeatSubmit()
|
||||||
|
@PutMapping()
|
||||||
|
public R<Void> edit(@Validated(EditGroup.class) @RequestBody AttendanceAreaDeviceBo bo) {
|
||||||
|
return toAjax(attendanceAreaDeviceService.updateByBo(bo));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除摄像头区域中间
|
||||||
|
*
|
||||||
|
* @param ids 主键串
|
||||||
|
*/
|
||||||
|
@SaCheckPermission("property:areaDevice:remove")
|
||||||
|
@Log(title = "摄像头区域中间", businessType = BusinessType.DELETE)
|
||||||
|
@DeleteMapping("/{ids}")
|
||||||
|
public R<Void> remove(@NotEmpty(message = "主键不能为空")
|
||||||
|
@PathVariable("ids") Long[] ids) {
|
||||||
|
return toAjax(attendanceAreaDeviceService.deleteWithValidByIds(List.of(ids), true));
|
||||||
|
}
|
||||||
|
}
|
@@ -27,10 +27,10 @@ public class AttendanceArea extends TenantEntity {
|
|||||||
@TableId(value = "id")
|
@TableId(value = "id")
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
/**
|
// /**
|
||||||
* 摄像机id
|
// * 摄像机id
|
||||||
*/
|
// */
|
||||||
private Long deviceManageId;
|
// private Long deviceManageId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 区域
|
* 区域
|
||||||
|
@@ -8,10 +8,10 @@ import lombok.EqualsAndHashCode;
|
|||||||
import java.io.Serial;
|
import java.io.Serial;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 摄像头区域中间表 attendance_area_device
|
* 摄像头区域中间对象 attendance_area_device
|
||||||
*
|
*
|
||||||
* @author LionLi
|
* @author LionLi
|
||||||
* @date 2025-08-13
|
* @date 2025-08-17
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
@EqualsAndHashCode(callSuper = true)
|
@EqualsAndHashCode(callSuper = true)
|
||||||
@@ -33,10 +33,9 @@ public class AttendanceAreaDevice extends TenantEntity {
|
|||||||
private Long areaId;
|
private Long areaId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 摄像机id
|
* 摄像机id
|
||||||
*/
|
*/
|
||||||
private String deviceManageId;
|
private Long deviceManageId;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -39,20 +39,20 @@ public class AttendanceUserGroup extends TenantEntity {
|
|||||||
*/
|
*/
|
||||||
private Long employeeId;
|
private Long employeeId;
|
||||||
|
|
||||||
// /**
|
/**
|
||||||
// * 员工姓名
|
* 员工姓名
|
||||||
// */
|
*/
|
||||||
// private String employeeName;
|
private String employeeName;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 部门ID
|
* 部门ID
|
||||||
*/
|
*/
|
||||||
private Long deptId;
|
private Long deptId;
|
||||||
|
|
||||||
// /**
|
/**
|
||||||
// * 部门名称
|
* 部门名称
|
||||||
// */
|
*/
|
||||||
// private String deptName;
|
private String deptName;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 开始日期
|
* 开始日期
|
||||||
|
@@ -28,10 +28,6 @@ public class AttendanceAreaBo extends BaseEntity {
|
|||||||
@NotNull(message = "主键id不能为空", groups = { EditGroup.class })
|
@NotNull(message = "主键id不能为空", groups = { EditGroup.class })
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
/**
|
|
||||||
* 摄像机id
|
|
||||||
*/
|
|
||||||
private Long deviceManageId;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 区域
|
* 区域
|
||||||
@@ -44,4 +40,11 @@ public class AttendanceAreaBo extends BaseEntity {
|
|||||||
private String reamark;
|
private String reamark;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 摄像机id
|
||||||
|
*/
|
||||||
|
private List<Long> deviceManageId;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -0,0 +1,40 @@
|
|||||||
|
package org.dromara.property.domain.bo;
|
||||||
|
|
||||||
|
import org.dromara.property.domain.AttendanceAreaDevice;
|
||||||
|
import org.dromara.common.mybatis.core.domain.BaseEntity;
|
||||||
|
import org.dromara.common.core.validate.AddGroup;
|
||||||
|
import org.dromara.common.core.validate.EditGroup;
|
||||||
|
import io.github.linpeilie.annotations.AutoMapper;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import jakarta.validation.constraints.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 摄像头区域中间业务对象 attendance_area_device
|
||||||
|
*
|
||||||
|
* @author LionLi
|
||||||
|
* @date 2025-08-17
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@AutoMapper(target = AttendanceAreaDevice.class, reverseConvertGenerate = false)
|
||||||
|
public class AttendanceAreaDeviceBo extends BaseEntity {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 主键id
|
||||||
|
*/
|
||||||
|
@NotNull(message = "主键id不能为空", groups = { EditGroup.class })
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 区域id
|
||||||
|
*/
|
||||||
|
private Long areaId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 摄像机id
|
||||||
|
*/
|
||||||
|
private Long deviceManageId;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@@ -39,20 +39,20 @@ public class AttendanceUserGroupBo extends BaseEntity {
|
|||||||
*/
|
*/
|
||||||
private Long employeeId;
|
private Long employeeId;
|
||||||
|
|
||||||
// /**
|
/**
|
||||||
// * 员工姓名
|
* 员工姓名
|
||||||
// */
|
*/
|
||||||
// private String employeeName;
|
private String employeeName;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 部门ID
|
* 部门ID
|
||||||
*/
|
*/
|
||||||
private Long deptId;
|
private Long deptId;
|
||||||
|
|
||||||
// /**
|
/**
|
||||||
// * 部门名称
|
* 部门名称
|
||||||
// */
|
*/
|
||||||
// private String deptName;
|
private String deptName;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 开始日期
|
* 开始日期
|
||||||
|
@@ -0,0 +1,50 @@
|
|||||||
|
package org.dromara.property.domain.vo;
|
||||||
|
|
||||||
|
import org.dromara.property.domain.AttendanceAreaDevice;
|
||||||
|
import cn.idev.excel.annotation.ExcelIgnoreUnannotated;
|
||||||
|
import cn.idev.excel.annotation.ExcelProperty;
|
||||||
|
import org.dromara.common.excel.annotation.ExcelDictFormat;
|
||||||
|
import org.dromara.common.excel.convert.ExcelDictConvert;
|
||||||
|
import io.github.linpeilie.annotations.AutoMapper;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serial;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 摄像头区域中间视图对象 attendance_area_device
|
||||||
|
*
|
||||||
|
* @author LionLi
|
||||||
|
* @date 2025-08-17
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@ExcelIgnoreUnannotated
|
||||||
|
@AutoMapper(target = AttendanceAreaDevice.class)
|
||||||
|
public class AttendanceAreaDeviceVo implements Serializable {
|
||||||
|
|
||||||
|
@Serial
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 主键id
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "主键id")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 区域id
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "区域id")
|
||||||
|
private Long areaId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 摄像机id
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "摄像机id")
|
||||||
|
private Long deviceManageId;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@@ -7,11 +7,12 @@ import org.dromara.common.excel.annotation.ExcelDictFormat;
|
|||||||
import org.dromara.common.excel.convert.ExcelDictConvert;
|
import org.dromara.common.excel.convert.ExcelDictConvert;
|
||||||
import io.github.linpeilie.annotations.AutoMapper;
|
import io.github.linpeilie.annotations.AutoMapper;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
import org.dromara.property.domain.AttendanceAreaDevice;
|
||||||
|
|
||||||
import java.io.Serial;
|
import java.io.Serial;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -34,11 +35,11 @@ public class AttendanceAreaVo implements Serializable {
|
|||||||
@ExcelProperty(value = "主键id")
|
@ExcelProperty(value = "主键id")
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
/**
|
// /**
|
||||||
* 摄像机id
|
// * 摄像机id
|
||||||
*/
|
// */
|
||||||
@ExcelProperty(value = "摄像机id")
|
// @ExcelProperty(value = "摄像机id")
|
||||||
private Long deviceManageId;
|
// private Long deviceManageId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 区域
|
* 区域
|
||||||
@@ -52,5 +53,7 @@ public class AttendanceAreaVo implements Serializable {
|
|||||||
@ExcelProperty(value = "备注")
|
@ExcelProperty(value = "备注")
|
||||||
private String reamark;
|
private String reamark;
|
||||||
|
|
||||||
|
private List<AttendanceAreaDevice> areaDevice;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -47,11 +47,11 @@ public class AttendanceUserGroupVo implements Serializable {
|
|||||||
@ExcelProperty(value = "员工ID")
|
@ExcelProperty(value = "员工ID")
|
||||||
private Long employeeId;
|
private Long employeeId;
|
||||||
|
|
||||||
// /**
|
/**
|
||||||
// * 员工姓名
|
* 员工姓名
|
||||||
// */
|
*/
|
||||||
// @ExcelProperty(value = "员工姓名")
|
@ExcelProperty(value = "员工姓名")
|
||||||
// private String employeeName;
|
private String employeeName;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 部门ID
|
* 部门ID
|
||||||
@@ -59,11 +59,11 @@ public class AttendanceUserGroupVo implements Serializable {
|
|||||||
@ExcelProperty(value = "部门ID")
|
@ExcelProperty(value = "部门ID")
|
||||||
private Long deptId;
|
private Long deptId;
|
||||||
|
|
||||||
// /**
|
/**
|
||||||
// * 部门名称
|
* 部门名称
|
||||||
// */
|
*/
|
||||||
// @ExcelProperty(value = "部门名称")
|
@ExcelProperty(value = "部门名称")
|
||||||
// private String deptName;
|
private String deptName;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 开始日期
|
* 开始日期
|
||||||
@@ -89,8 +89,6 @@ public class AttendanceUserGroupVo implements Serializable {
|
|||||||
|
|
||||||
private RemoteUserVo remoteUserVo;
|
private RemoteUserVo remoteUserVo;
|
||||||
|
|
||||||
private String deptName;
|
|
||||||
|
|
||||||
private AttendanceArea attendanceArea;
|
private AttendanceArea attendanceArea;
|
||||||
|
|
||||||
|
|
||||||
|
@@ -0,0 +1,15 @@
|
|||||||
|
package org.dromara.property.mapper;
|
||||||
|
|
||||||
|
import org.dromara.property.domain.AttendanceAreaDevice;
|
||||||
|
import org.dromara.property.domain.vo.AttendanceAreaDeviceVo;
|
||||||
|
import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 摄像头区域中间Mapper接口
|
||||||
|
*
|
||||||
|
* @author LionLi
|
||||||
|
* @date 2025-08-17
|
||||||
|
*/
|
||||||
|
public interface AttendanceAreaDeviceMapper extends BaseMapperPlus<AttendanceAreaDevice, AttendanceAreaDeviceVo> {
|
||||||
|
|
||||||
|
}
|
@@ -0,0 +1,69 @@
|
|||||||
|
package org.dromara.property.service;
|
||||||
|
|
||||||
|
import org.dromara.property.domain.AttendanceAreaDevice;
|
||||||
|
import org.dromara.property.domain.vo.AttendanceAreaDeviceVo;
|
||||||
|
import org.dromara.property.domain.bo.AttendanceAreaDeviceBo;
|
||||||
|
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||||
|
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||||
|
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 摄像头区域中间Service接口
|
||||||
|
*
|
||||||
|
* @author LionLi
|
||||||
|
* @date 2025-08-17
|
||||||
|
*/
|
||||||
|
public interface IAttendanceAreaDeviceService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询摄像头区域中间
|
||||||
|
*
|
||||||
|
* @param id 主键
|
||||||
|
* @return 摄像头区域中间
|
||||||
|
*/
|
||||||
|
AttendanceAreaDeviceVo queryById(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页查询摄像头区域中间列表
|
||||||
|
*
|
||||||
|
* @param bo 查询条件
|
||||||
|
* @param pageQuery 分页参数
|
||||||
|
* @return 摄像头区域中间分页列表
|
||||||
|
*/
|
||||||
|
TableDataInfo<AttendanceAreaDeviceVo> queryPageList(AttendanceAreaDeviceBo bo, PageQuery pageQuery);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询符合条件的摄像头区域中间列表
|
||||||
|
*
|
||||||
|
* @param bo 查询条件
|
||||||
|
* @return 摄像头区域中间列表
|
||||||
|
*/
|
||||||
|
List<AttendanceAreaDeviceVo> queryList(AttendanceAreaDeviceBo bo);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增摄像头区域中间
|
||||||
|
*
|
||||||
|
* @param bo 摄像头区域中间
|
||||||
|
* @return 是否新增成功
|
||||||
|
*/
|
||||||
|
Boolean insertByBo(AttendanceAreaDeviceBo bo);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改摄像头区域中间
|
||||||
|
*
|
||||||
|
* @param bo 摄像头区域中间
|
||||||
|
* @return 是否修改成功
|
||||||
|
*/
|
||||||
|
Boolean updateByBo(AttendanceAreaDeviceBo bo);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 校验并批量删除摄像头区域中间信息
|
||||||
|
*
|
||||||
|
* @param ids 待删除的主键集合
|
||||||
|
* @param isValid 是否进行有效性校验
|
||||||
|
* @return 是否删除成功
|
||||||
|
*/
|
||||||
|
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
|
||||||
|
}
|
@@ -0,0 +1,133 @@
|
|||||||
|
package org.dromara.property.service.impl;
|
||||||
|
|
||||||
|
import org.dromara.common.core.utils.MapstructUtils;
|
||||||
|
import org.dromara.common.core.utils.StringUtils;
|
||||||
|
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||||
|
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.dromara.property.domain.bo.AttendanceAreaDeviceBo;
|
||||||
|
import org.dromara.property.domain.vo.AttendanceAreaDeviceVo;
|
||||||
|
import org.dromara.property.domain.AttendanceAreaDevice;
|
||||||
|
import org.dromara.property.mapper.AttendanceAreaDeviceMapper;
|
||||||
|
import org.dromara.property.service.IAttendanceAreaDeviceService;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Collection;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 摄像头区域中间Service业务层处理
|
||||||
|
*
|
||||||
|
* @author LionLi
|
||||||
|
* @date 2025-08-17
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
@Service
|
||||||
|
public class AttendanceAreaDeviceServiceImpl implements IAttendanceAreaDeviceService {
|
||||||
|
|
||||||
|
private final AttendanceAreaDeviceMapper baseMapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询摄像头区域中间
|
||||||
|
*
|
||||||
|
* @param id 主键
|
||||||
|
* @return 摄像头区域中间
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public AttendanceAreaDeviceVo queryById(Long id){
|
||||||
|
return baseMapper.selectVoById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页查询摄像头区域中间列表
|
||||||
|
*
|
||||||
|
* @param bo 查询条件
|
||||||
|
* @param pageQuery 分页参数
|
||||||
|
* @return 摄像头区域中间分页列表
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public TableDataInfo<AttendanceAreaDeviceVo> queryPageList(AttendanceAreaDeviceBo bo, PageQuery pageQuery) {
|
||||||
|
LambdaQueryWrapper<AttendanceAreaDevice> lqw = buildQueryWrapper(bo);
|
||||||
|
Page<AttendanceAreaDeviceVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
||||||
|
return TableDataInfo.build(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询符合条件的摄像头区域中间列表
|
||||||
|
*
|
||||||
|
* @param bo 查询条件
|
||||||
|
* @return 摄像头区域中间列表
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<AttendanceAreaDeviceVo> queryList(AttendanceAreaDeviceBo bo) {
|
||||||
|
LambdaQueryWrapper<AttendanceAreaDevice> lqw = buildQueryWrapper(bo);
|
||||||
|
return baseMapper.selectVoList(lqw);
|
||||||
|
}
|
||||||
|
|
||||||
|
private LambdaQueryWrapper<AttendanceAreaDevice> buildQueryWrapper(AttendanceAreaDeviceBo bo) {
|
||||||
|
Map<String, Object> params = bo.getParams();
|
||||||
|
LambdaQueryWrapper<AttendanceAreaDevice> lqw = Wrappers.lambdaQuery();
|
||||||
|
lqw.orderByAsc(AttendanceAreaDevice::getId);
|
||||||
|
lqw.eq(bo.getAreaId() != null, AttendanceAreaDevice::getAreaId, bo.getAreaId());
|
||||||
|
lqw.eq(bo.getDeviceManageId() != null, AttendanceAreaDevice::getDeviceManageId, bo.getDeviceManageId());
|
||||||
|
return lqw;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增摄像头区域中间
|
||||||
|
*
|
||||||
|
* @param bo 摄像头区域中间
|
||||||
|
* @return 是否新增成功
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Boolean insertByBo(AttendanceAreaDeviceBo bo) {
|
||||||
|
AttendanceAreaDevice add = MapstructUtils.convert(bo, AttendanceAreaDevice.class);
|
||||||
|
validEntityBeforeSave(add);
|
||||||
|
boolean flag = baseMapper.insert(add) > 0;
|
||||||
|
if (flag) {
|
||||||
|
bo.setId(add.getId());
|
||||||
|
}
|
||||||
|
return flag;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改摄像头区域中间
|
||||||
|
*
|
||||||
|
* @param bo 摄像头区域中间
|
||||||
|
* @return 是否修改成功
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Boolean updateByBo(AttendanceAreaDeviceBo bo) {
|
||||||
|
AttendanceAreaDevice update = MapstructUtils.convert(bo, AttendanceAreaDevice.class);
|
||||||
|
validEntityBeforeSave(update);
|
||||||
|
return baseMapper.updateById(update) > 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 保存前的数据校验
|
||||||
|
*/
|
||||||
|
private void validEntityBeforeSave(AttendanceAreaDevice entity){
|
||||||
|
//TODO 做一些数据校验,如唯一约束
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 校验并批量删除摄像头区域中间信息
|
||||||
|
*
|
||||||
|
* @param ids 待删除的主键集合
|
||||||
|
* @param isValid 是否进行有效性校验
|
||||||
|
* @return 是否删除成功
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
|
||||||
|
if(isValid){
|
||||||
|
//TODO 做一些业务上的校验,判断是否需要校验
|
||||||
|
}
|
||||||
|
return baseMapper.deleteByIds(ids) > 0;
|
||||||
|
}
|
||||||
|
}
|
@@ -10,13 +10,17 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|||||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.dromara.property.domain.AttendanceAreaDevice;
|
||||||
|
import org.dromara.property.mapper.AttendanceAreaDeviceMapper;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.dromara.property.domain.bo.AttendanceAreaBo;
|
import org.dromara.property.domain.bo.AttendanceAreaBo;
|
||||||
import org.dromara.property.domain.vo.AttendanceAreaVo;
|
import org.dromara.property.domain.vo.AttendanceAreaVo;
|
||||||
import org.dromara.property.domain.AttendanceArea;
|
import org.dromara.property.domain.AttendanceArea;
|
||||||
import org.dromara.property.mapper.AttendanceAreaMapper;
|
import org.dromara.property.mapper.AttendanceAreaMapper;
|
||||||
import org.dromara.property.service.IAttendanceAreaService;
|
import org.dromara.property.service.IAttendanceAreaService;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
@@ -34,6 +38,8 @@ public class AttendanceAreaServiceImpl implements IAttendanceAreaService {
|
|||||||
|
|
||||||
private final AttendanceAreaMapper baseMapper;
|
private final AttendanceAreaMapper baseMapper;
|
||||||
|
|
||||||
|
private final AttendanceAreaDeviceMapper areaDeviceMapper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询区域区域管理
|
* 查询区域区域管理
|
||||||
*
|
*
|
||||||
@@ -56,7 +62,18 @@ public class AttendanceAreaServiceImpl implements IAttendanceAreaService {
|
|||||||
public TableDataInfo<AttendanceAreaVo> queryPageList(AttendanceAreaBo bo, PageQuery pageQuery) {
|
public TableDataInfo<AttendanceAreaVo> queryPageList(AttendanceAreaBo bo, PageQuery pageQuery) {
|
||||||
LambdaQueryWrapper<AttendanceArea> lqw = buildQueryWrapper(bo);
|
LambdaQueryWrapper<AttendanceArea> lqw = buildQueryWrapper(bo);
|
||||||
Page<AttendanceAreaVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
Page<AttendanceAreaVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
||||||
return TableDataInfo.build(result);
|
|
||||||
|
Page<AttendanceAreaVo> attendanceAreaVoPage = result.setRecords(result.getRecords().stream().map(vo -> {
|
||||||
|
//获取areaId
|
||||||
|
Long areaId = vo.getId();
|
||||||
|
//根据areaId查询中间表数据
|
||||||
|
List<AttendanceAreaDevice> attendanceAreaDeviceList = areaDeviceMapper.selectList(Wrappers.<AttendanceAreaDevice>lambdaQuery().eq(AttendanceAreaDevice::getAreaId, areaId));
|
||||||
|
vo.setAreaDevice(attendanceAreaDeviceList);
|
||||||
|
return vo;
|
||||||
|
}
|
||||||
|
).toList());
|
||||||
|
|
||||||
|
return TableDataInfo.build(attendanceAreaVoPage);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -75,7 +92,6 @@ public class AttendanceAreaServiceImpl implements IAttendanceAreaService {
|
|||||||
Map<String, Object> params = bo.getParams();
|
Map<String, Object> params = bo.getParams();
|
||||||
LambdaQueryWrapper<AttendanceArea> lqw = Wrappers.lambdaQuery();
|
LambdaQueryWrapper<AttendanceArea> lqw = Wrappers.lambdaQuery();
|
||||||
lqw.orderByAsc(AttendanceArea::getId);
|
lqw.orderByAsc(AttendanceArea::getId);
|
||||||
lqw.eq(bo.getDeviceManageId() != null, AttendanceArea::getDeviceManageId, bo.getDeviceManageId());
|
|
||||||
lqw.like(StringUtils.isNotBlank(bo.getArea()), AttendanceArea::getArea, bo.getArea());
|
lqw.like(StringUtils.isNotBlank(bo.getArea()), AttendanceArea::getArea, bo.getArea());
|
||||||
lqw.eq(StringUtils.isNotBlank(bo.getReamark()), AttendanceArea::getReamark, bo.getReamark());
|
lqw.eq(StringUtils.isNotBlank(bo.getReamark()), AttendanceArea::getReamark, bo.getReamark());
|
||||||
return lqw;
|
return lqw;
|
||||||
@@ -87,17 +103,27 @@ public class AttendanceAreaServiceImpl implements IAttendanceAreaService {
|
|||||||
* @param bo 区域区域管理
|
* @param bo 区域区域管理
|
||||||
* @return 是否新增成功
|
* @return 是否新增成功
|
||||||
*/
|
*/
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
@Override
|
@Override
|
||||||
public Boolean insertByBo(AttendanceAreaBo bo) {
|
public Boolean insertByBo(AttendanceAreaBo bo) {
|
||||||
AttendanceArea add = MapstructUtils.convert(bo, AttendanceArea.class);
|
AttendanceArea add = MapstructUtils.convert(bo, AttendanceArea.class);
|
||||||
if (ObjectUtil.isNotEmpty(bo.getDeviceManageId())) {
|
|
||||||
assert add != null;
|
|
||||||
// 将 deviceManageId 集合转换为以逗号分隔的字符串
|
|
||||||
// String deviceManageIdsStr = StringUtils.join(bo.getDeviceManageId(), ",");
|
|
||||||
add.setDeviceManageId(bo.getDeviceManageId());
|
|
||||||
}
|
|
||||||
validEntityBeforeSave(add);
|
validEntityBeforeSave(add);
|
||||||
boolean flag = baseMapper.insert(add) > 0;
|
boolean flag = baseMapper.insert(add) > 0;
|
||||||
|
|
||||||
|
//获取bo的id
|
||||||
|
Long areaId = add.getId();
|
||||||
|
|
||||||
|
//获取设备id集合
|
||||||
|
List<Long> deviceManageId = bo.getDeviceManageId();
|
||||||
|
|
||||||
|
//根据区域id向设备中间表插入数据
|
||||||
|
for (Long deviceId : deviceManageId) {
|
||||||
|
AttendanceAreaDevice attendanceAreaDevice = new AttendanceAreaDevice();
|
||||||
|
attendanceAreaDevice.setAreaId(areaId);
|
||||||
|
attendanceAreaDevice.setDeviceManageId(deviceId);
|
||||||
|
areaDeviceMapper.insert(attendanceAreaDevice);
|
||||||
|
}
|
||||||
|
|
||||||
if (flag) {
|
if (flag) {
|
||||||
bo.setId(add.getId());
|
bo.setId(add.getId());
|
||||||
}
|
}
|
||||||
@@ -114,6 +140,23 @@ public class AttendanceAreaServiceImpl implements IAttendanceAreaService {
|
|||||||
public Boolean updateByBo(AttendanceAreaBo bo) {
|
public Boolean updateByBo(AttendanceAreaBo bo) {
|
||||||
AttendanceArea update = MapstructUtils.convert(bo, AttendanceArea.class);
|
AttendanceArea update = MapstructUtils.convert(bo, AttendanceArea.class);
|
||||||
validEntityBeforeSave(update);
|
validEntityBeforeSave(update);
|
||||||
|
|
||||||
|
//获取id
|
||||||
|
Long id = update.getId();
|
||||||
|
//根据id删除中间表数据
|
||||||
|
areaDeviceMapper.delete(Wrappers.<AttendanceAreaDevice>lambdaQuery().eq(AttendanceAreaDevice::getAreaId, id));
|
||||||
|
|
||||||
|
//获取设备id集合
|
||||||
|
List<Long> deviceManageId = bo.getDeviceManageId();
|
||||||
|
|
||||||
|
//根据区域id向设备中间表插入数据
|
||||||
|
for (Long deviceId : deviceManageId) {
|
||||||
|
AttendanceAreaDevice attendanceAreaDevice = new AttendanceAreaDevice();
|
||||||
|
attendanceAreaDevice.setAreaId(id);
|
||||||
|
attendanceAreaDevice.setDeviceManageId(deviceId);
|
||||||
|
areaDeviceMapper.insert(attendanceAreaDevice);
|
||||||
|
}
|
||||||
|
|
||||||
return baseMapper.updateById(update) > 0;
|
return baseMapper.updateById(update) > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -131,11 +174,15 @@ public class AttendanceAreaServiceImpl implements IAttendanceAreaService {
|
|||||||
* @param isValid 是否进行有效性校验
|
* @param isValid 是否进行有效性校验
|
||||||
* @return 是否删除成功
|
* @return 是否删除成功
|
||||||
*/
|
*/
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
@Override
|
@Override
|
||||||
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
|
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
|
||||||
if(isValid){
|
if(isValid){
|
||||||
//TODO 做一些业务上的校验,判断是否需要校验
|
//TODO 做一些业务上的校验,判断是否需要校验
|
||||||
}
|
}
|
||||||
|
|
||||||
|
areaDeviceMapper.delete(Wrappers.<AttendanceAreaDevice>lambdaQuery().in(AttendanceAreaDevice::getAreaId, ids));
|
||||||
|
|
||||||
return baseMapper.deleteByIds(ids) > 0;
|
return baseMapper.deleteByIds(ids) > 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user