feat: 清扫记录

master
wangrunpu 4 weeks ago
parent 4a25b9f75b
commit d3d94f468b

@ -174,8 +174,9 @@ public interface ErrorCodeConstants {
// ========== 巡查记录 TODO 补充编号 ==========
ErrorCode DUST_PATROL_RECORD_NOT_EXISTS = new ErrorCode(1_002_029_003, "巡查记录不存在");
// ========== 巡查问题整改 TODO 补充编号 ==========
ErrorCode DUST_PATROL_RECTIFY_NOT_EXISTS = new ErrorCode(1_002_029_004, "巡查问题整改不存在");
// ========== 粉尘清扫打卡记录 TODO 补充编号 ==========
ErrorCode DUST_CLEARRECORD_NOT_EXISTS = new ErrorCode(1_002_029_005, "粉尘清扫打卡记录不存在");
}

@ -0,0 +1,104 @@
package cn.iocoder.yudao.module.system.controller.admin.dustclearrecord;
import org.springframework.web.bind.annotation.*;
import jakarta.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import org.springframework.security.access.prepost.PreAuthorize;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Operation;
import jakarta.validation.constraints.*;
import jakarta.validation.*;
import jakarta.servlet.http.*;
import java.util.*;
import java.io.IOException;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog;
import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.*;
import cn.iocoder.yudao.module.system.controller.admin.dustclearrecord.vo.*;
import cn.iocoder.yudao.module.system.dal.dataobject.dustclearrecord.DustClearrecordDO;
import cn.iocoder.yudao.module.system.service.dustclearrecord.DustClearrecordService;
@Tag(name = "管理后台 - 粉尘清扫打卡记录")
@RestController
@RequestMapping("/system/dust-clearrecord")
@Validated
public class DustClearrecordController {
@Resource
private DustClearrecordService dustClearrecordService;
@PostMapping("/create")
@Operation(summary = "创建粉尘清扫打卡记录")
@PreAuthorize("@ss.hasPermission('system:dust-clearrecord:create')")
public CommonResult<String> createDustClearrecord(@Valid @RequestBody DustClearrecordSaveReqVO createReqVO) {
return success(dustClearrecordService.createDustClearrecord(createReqVO));
}
@PutMapping("/update")
@Operation(summary = "更新粉尘清扫打卡记录")
@PreAuthorize("@ss.hasPermission('system:dust-clearrecord:update')")
public CommonResult<Boolean> updateDustClearrecord(@Valid @RequestBody DustClearrecordSaveReqVO updateReqVO) {
dustClearrecordService.updateDustClearrecord(updateReqVO);
return success(true);
}
@DeleteMapping("/delete")
@Operation(summary = "删除粉尘清扫打卡记录")
@Parameter(name = "id", description = "编号", required = true)
@PreAuthorize("@ss.hasPermission('system:dust-clearrecord:delete')")
public CommonResult<Boolean> deleteDustClearrecord(@RequestParam("id") String id) {
dustClearrecordService.deleteDustClearrecord(id);
return success(true);
}
@DeleteMapping("/delete-list")
@Parameter(name = "ids", description = "编号", required = true)
@Operation(summary = "批量删除粉尘清扫打卡记录")
@PreAuthorize("@ss.hasPermission('system:dust-clearrecord:delete')")
public CommonResult<Boolean> deleteDustClearrecordList(@RequestParam("ids") List<String> ids) {
dustClearrecordService.deleteDustClearrecordListByIds(ids);
return success(true);
}
@GetMapping("/get")
@Operation(summary = "获得粉尘清扫打卡记录")
@Parameter(name = "id", description = "编号", required = true, example = "1024")
@PreAuthorize("@ss.hasPermission('system:dust-clearrecord:query')")
public CommonResult<DustClearrecordRespVO> getDustClearrecord(@RequestParam("id") String id) {
DustClearrecordDO dustClearrecord = dustClearrecordService.getDustClearrecord(id);
return success(BeanUtils.toBean(dustClearrecord, DustClearrecordRespVO.class));
}
@GetMapping("/page")
@Operation(summary = "获得粉尘清扫打卡记录分页")
@PreAuthorize("@ss.hasPermission('system:dust-clearrecord:query')")
public CommonResult<PageResult<DustClearrecordRespVO>> getDustClearrecordPage(@Valid DustClearrecordPageReqVO pageReqVO) {
PageResult<DustClearrecordDO> pageResult = dustClearrecordService.getDustClearrecordPage(pageReqVO);
return success(BeanUtils.toBean(pageResult, DustClearrecordRespVO.class));
}
@GetMapping("/export-excel")
@Operation(summary = "导出粉尘清扫打卡记录 Excel")
@PreAuthorize("@ss.hasPermission('system:dust-clearrecord:export')")
@ApiAccessLog(operateType = EXPORT)
public void exportDustClearrecordExcel(@Valid DustClearrecordPageReqVO pageReqVO,
HttpServletResponse response) throws IOException {
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
List<DustClearrecordDO> list = dustClearrecordService.getDustClearrecordPage(pageReqVO).getList();
// 导出 Excel
ExcelUtils.write(response, "粉尘清扫打卡记录.xls", "数据", DustClearrecordRespVO.class,
BeanUtils.toBean(list, DustClearrecordRespVO.class));
}
}

@ -0,0 +1,48 @@
package cn.iocoder.yudao.module.system.controller.admin.dustclearrecord.vo;
import lombok.*;
import java.util.*;
import io.swagger.v3.oas.annotations.media.Schema;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
@Schema(description = "管理后台 - 粉尘清扫打卡记录分页 Request VO")
@Data
public class DustClearrecordPageReqVO extends PageParam {
@Schema(description = "数据接入标识", example = "2822")
private String dataId;
@Schema(description = "清扫项目", example = "芋艿")
private String clearItemName;
@Schema(description = "完成情况 0:未完成;1:已完成")
private String taskProcess;
@Schema(description = "打卡人")
private String taskPerson;
@Schema(description = "打卡日期")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] taskTime;
@Schema(description = "创建时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] createTime;
@Schema(description = "图片", example = "15259")
private String picOssId;
@Schema(description = "图片", example = "https://www.iocoder.cn")
private String picOssUrl;
@Schema(description = "附件", example = "29669")
private String fileOssId;
@Schema(description = "附件", example = "https://www.iocoder.cn")
private String fileOssUrl;
}

@ -0,0 +1,59 @@
package cn.iocoder.yudao.module.system.controller.admin.dustclearrecord.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.util.*;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
import cn.idev.excel.annotation.*;
@Schema(description = "管理后台 - 粉尘清扫打卡记录 Response VO")
@Data
@ExcelIgnoreUnannotated
public class DustClearrecordRespVO {
@Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "21496")
@ExcelProperty("主键")
private String id;
@Schema(description = "数据接入标识", requiredMode = Schema.RequiredMode.REQUIRED, example = "2822")
@ExcelProperty("数据接入标识")
private String dataId;
@Schema(description = "清扫项目", requiredMode = Schema.RequiredMode.REQUIRED, example = "芋艿")
@ExcelProperty("清扫项目")
private String clearItemName;
@Schema(description = "完成情况 0:未完成;1:已完成", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("完成情况 0:未完成;1:已完成")
private String taskProcess;
@Schema(description = "打卡人", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("打卡人")
private String taskPerson;
@Schema(description = "打卡日期", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("打卡日期")
private LocalDateTime taskTime;
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("创建时间")
private LocalDateTime createTime;
@Schema(description = "图片", example = "15259")
@ExcelProperty("图片")
private String picOssId;
@Schema(description = "图片", example = "https://www.iocoder.cn")
@ExcelProperty("图片")
private String picOssUrl;
@Schema(description = "附件", example = "29669")
@ExcelProperty("附件")
private String fileOssId;
@Schema(description = "附件", example = "https://www.iocoder.cn")
@ExcelProperty("附件")
private String fileOssUrl;
}

@ -0,0 +1,49 @@
package cn.iocoder.yudao.module.system.controller.admin.dustclearrecord.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.util.*;
import jakarta.validation.constraints.*;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
@Schema(description = "管理后台 - 粉尘清扫打卡记录新增/修改 Request VO")
@Data
public class DustClearrecordSaveReqVO {
@Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "21496")
private String id;
@Schema(description = "数据接入标识", requiredMode = Schema.RequiredMode.REQUIRED, example = "2822")
@NotEmpty(message = "数据接入标识不能为空")
private String dataId;
@Schema(description = "清扫项目", requiredMode = Schema.RequiredMode.REQUIRED, example = "芋艿")
@NotEmpty(message = "清扫项目不能为空")
private String clearItemName;
@Schema(description = "完成情况 0:未完成;1:已完成", requiredMode = Schema.RequiredMode.REQUIRED)
@NotEmpty(message = "完成情况 0:未完成;1:已完成不能为空")
private String taskProcess;
@Schema(description = "打卡人", requiredMode = Schema.RequiredMode.REQUIRED)
@NotEmpty(message = "打卡人不能为空")
private String taskPerson;
@Schema(description = "打卡日期", requiredMode = Schema.RequiredMode.REQUIRED)
@NotNull(message = "打卡日期不能为空")
private LocalDateTime taskTime;
@Schema(description = "图片", example = "15259")
private String picOssId;
@Schema(description = "图片", example = "https://www.iocoder.cn")
private String picOssUrl;
@Schema(description = "附件", example = "29669")
private String fileOssId;
@Schema(description = "附件", example = "https://www.iocoder.cn")
private String fileOssUrl;
}

@ -0,0 +1,69 @@
package cn.iocoder.yudao.module.system.dal.dataobject.dustclearrecord;
import lombok.*;
import java.util.*;
import java.time.LocalDateTime;
import java.time.LocalDateTime;
import java.time.LocalDateTime;
import com.baomidou.mybatisplus.annotation.*;
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
/**
* DO
*
* @author
*/
@TableName("hazard_dust_clearrecord")
@KeySequence("hazard_dust_clearrecord_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class DustClearrecordDO extends BaseDO {
/**
*
*/
@TableId(type = IdType.INPUT)
private String id;
/**
*
*/
private String dataId;
/**
*
*/
private String clearItemName;
/**
* 0:;1:
*/
private String taskProcess;
/**
*
*/
private String taskPerson;
/**
*
*/
private LocalDateTime taskTime;
/**
*
*/
private String picOssId;
/**
*
*/
private String picOssUrl;
/**
*
*/
private String fileOssId;
/**
*
*/
private String fileOssUrl;
}

@ -0,0 +1,35 @@
package cn.iocoder.yudao.module.system.dal.mysql.dustclearrecord;
import java.util.*;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.system.dal.dataobject.dustclearrecord.DustClearrecordDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.system.controller.admin.dustclearrecord.vo.*;
/**
* Mapper
*
* @author
*/
@Mapper
public interface DustClearrecordMapper extends BaseMapperX<DustClearrecordDO> {
default PageResult<DustClearrecordDO> selectPage(DustClearrecordPageReqVO reqVO) {
return selectPage(reqVO, new LambdaQueryWrapperX<DustClearrecordDO>()
.eqIfPresent(DustClearrecordDO::getDataId, reqVO.getDataId())
.likeIfPresent(DustClearrecordDO::getClearItemName, reqVO.getClearItemName())
.eqIfPresent(DustClearrecordDO::getTaskProcess, reqVO.getTaskProcess())
.eqIfPresent(DustClearrecordDO::getTaskPerson, reqVO.getTaskPerson())
.betweenIfPresent(DustClearrecordDO::getTaskTime, reqVO.getTaskTime())
.betweenIfPresent(DustClearrecordDO::getCreateTime, reqVO.getCreateTime())
.eqIfPresent(DustClearrecordDO::getPicOssId, reqVO.getPicOssId())
.eqIfPresent(DustClearrecordDO::getPicOssUrl, reqVO.getPicOssUrl())
.eqIfPresent(DustClearrecordDO::getFileOssId, reqVO.getFileOssId())
.eqIfPresent(DustClearrecordDO::getFileOssUrl, reqVO.getFileOssUrl())
.orderByDesc(DustClearrecordDO::getId));
}
}

@ -0,0 +1,62 @@
package cn.iocoder.yudao.module.system.service.dustclearrecord;
import java.util.*;
import jakarta.validation.*;
import cn.iocoder.yudao.module.system.controller.admin.dustclearrecord.vo.*;
import cn.iocoder.yudao.module.system.dal.dataobject.dustclearrecord.DustClearrecordDO;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
/**
* Service
*
* @author
*/
public interface DustClearrecordService {
/**
*
*
* @param createReqVO
* @return
*/
String createDustClearrecord(@Valid DustClearrecordSaveReqVO createReqVO);
/**
*
*
* @param updateReqVO
*/
void updateDustClearrecord(@Valid DustClearrecordSaveReqVO updateReqVO);
/**
*
*
* @param id
*/
void deleteDustClearrecord(String id);
/**
*
*
* @param ids
*/
void deleteDustClearrecordListByIds(List<String> ids);
/**
*
*
* @param id
* @return
*/
DustClearrecordDO getDustClearrecord(String id);
/**
*
*
* @param pageReqVO
* @return
*/
PageResult<DustClearrecordDO> getDustClearrecordPage(DustClearrecordPageReqVO pageReqVO);
}

@ -0,0 +1,85 @@
package cn.iocoder.yudao.module.system.service.dustclearrecord;
import cn.hutool.core.collection.CollUtil;
import org.springframework.stereotype.Service;
import jakarta.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import org.springframework.transaction.annotation.Transactional;
import java.util.*;
import cn.iocoder.yudao.module.system.controller.admin.dustclearrecord.vo.*;
import cn.iocoder.yudao.module.system.dal.dataobject.dustclearrecord.DustClearrecordDO;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import cn.iocoder.yudao.module.system.dal.mysql.dustclearrecord.DustClearrecordMapper;
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertList;
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.diffList;
import static cn.iocoder.yudao.module.system.enums.ErrorCodeConstants.*;
/**
* Service
*
* @author
*/
@Service
@Validated
public class DustClearrecordServiceImpl implements DustClearrecordService {
@Resource
private DustClearrecordMapper dustClearrecordMapper;
@Override
public String createDustClearrecord(DustClearrecordSaveReqVO createReqVO) {
// 插入
DustClearrecordDO dustClearrecord = BeanUtils.toBean(createReqVO, DustClearrecordDO.class);
dustClearrecordMapper.insert(dustClearrecord);
// 返回
return dustClearrecord.getId();
}
@Override
public void updateDustClearrecord(DustClearrecordSaveReqVO updateReqVO) {
// 校验存在
validateDustClearrecordExists(updateReqVO.getId());
// 更新
DustClearrecordDO updateObj = BeanUtils.toBean(updateReqVO, DustClearrecordDO.class);
dustClearrecordMapper.updateById(updateObj);
}
@Override
public void deleteDustClearrecord(String id) {
// 校验存在
validateDustClearrecordExists(id);
// 删除
dustClearrecordMapper.deleteById(id);
}
@Override
public void deleteDustClearrecordListByIds(List<String> ids) {
// 删除
dustClearrecordMapper.deleteByIds(ids);
}
private void validateDustClearrecordExists(String id) {
if (dustClearrecordMapper.selectById(id) == null) {
throw exception(DUST_CLEARRECORD_NOT_EXISTS);
}
}
@Override
public DustClearrecordDO getDustClearrecord(String id) {
return dustClearrecordMapper.selectById(id);
}
@Override
public PageResult<DustClearrecordDO> getDustClearrecordPage(DustClearrecordPageReqVO pageReqVO) {
return dustClearrecordMapper.selectPage(pageReqVO);
}
}

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="cn.iocoder.yudao.module.system.dal.mysql.dustclearrecord.DustClearrecordMapper">
<!--
一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
文档可见https://www.iocoder.cn/MyBatis/x-plugins/
-->
</mapper>
Loading…
Cancel
Save