停车场-进出记录图片
This commit is contained in:
parent
76a080268c
commit
a463de07a7
@ -25,6 +25,8 @@ public interface ErrorCodeConstants {
|
||||
ErrorCode LIFTING_ROD_NOT_EXISTS = new ErrorCode(1_005_001_013, "远程抬杠不存在");
|
||||
// ========== 同步白名单 1_005_001_014 ==========
|
||||
ErrorCode SYNCHRONIZATION_OF_WHITELIST_INFORMATION_NOT_EXISTS = new ErrorCode(1_005_001_014, "同步白名单不存在");
|
||||
// ========== 进出记录图片 1_005_001_015 ==========
|
||||
ErrorCode ACCESS_RECORD_PICTURE_NOT_EXISTS = new ErrorCode(1_005_001_015, "进出记录图片不存在");
|
||||
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,95 @@
|
||||
package cn.iocoder.yudao.module.parking.controller.admin.accessrecordpicture;
|
||||
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import javax.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 javax.validation.constraints.*;
|
||||
import javax.validation.*;
|
||||
import javax.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.parking.controller.admin.accessrecordpicture.vo.*;
|
||||
import cn.iocoder.yudao.module.parking.dal.dataobject.accessrecordpicture.AccessRecordPictureDO;
|
||||
import cn.iocoder.yudao.module.parking.service.accessrecordpicture.AccessRecordPictureService;
|
||||
|
||||
@Tag(name = "管理后台 - 进出记录图片")
|
||||
@RestController
|
||||
@RequestMapping("/parking/access-record-picture")
|
||||
@Validated
|
||||
public class AccessRecordPictureController {
|
||||
|
||||
@Resource
|
||||
private AccessRecordPictureService accessRecordPictureService;
|
||||
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建进出记录图片")
|
||||
@PreAuthorize("@ss.hasPermission('parking:access-record-picture:create')")
|
||||
public CommonResult<Long> createAccessRecordPicture(@Valid @RequestBody AccessRecordPictureSaveReqVO createReqVO) {
|
||||
return success(accessRecordPictureService.createAccessRecordPicture(createReqVO));
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "更新进出记录图片")
|
||||
@PreAuthorize("@ss.hasPermission('parking:access-record-picture:update')")
|
||||
public CommonResult<Boolean> updateAccessRecordPicture(@Valid @RequestBody AccessRecordPictureSaveReqVO updateReqVO) {
|
||||
accessRecordPictureService.updateAccessRecordPicture(updateReqVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "删除进出记录图片")
|
||||
@Parameter(name = "id", description = "编号", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('parking:access-record-picture:delete')")
|
||||
public CommonResult<Boolean> deleteAccessRecordPicture(@RequestParam("id") Long id) {
|
||||
accessRecordPictureService.deleteAccessRecordPicture(id);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得进出记录图片")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
@PreAuthorize("@ss.hasPermission('parking:access-record-picture:query')")
|
||||
public CommonResult<AccessRecordPictureRespVO> getAccessRecordPicture(@RequestParam("id") Long id) {
|
||||
AccessRecordPictureDO accessRecordPicture = accessRecordPictureService.getAccessRecordPicture(id);
|
||||
return success(BeanUtils.toBean(accessRecordPicture, AccessRecordPictureRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得进出记录图片分页")
|
||||
@PreAuthorize("@ss.hasPermission('parking:access-record-picture:query')")
|
||||
public CommonResult<PageResult<AccessRecordPictureRespVO>> getAccessRecordPicturePage(@Valid AccessRecordPicturePageReqVO pageReqVO) {
|
||||
PageResult<AccessRecordPictureDO> pageResult = accessRecordPictureService.getAccessRecordPicturePage(pageReqVO);
|
||||
return success(BeanUtils.toBean(pageResult, AccessRecordPictureRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/export-excel")
|
||||
@Operation(summary = "导出进出记录图片 Excel")
|
||||
@PreAuthorize("@ss.hasPermission('parking:access-record-picture:export')")
|
||||
@ApiAccessLog(operateType = EXPORT)
|
||||
public void exportAccessRecordPictureExcel(@Valid AccessRecordPicturePageReqVO pageReqVO,
|
||||
HttpServletResponse response) throws IOException {
|
||||
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
||||
List<AccessRecordPictureDO> list = accessRecordPictureService.getAccessRecordPicturePage(pageReqVO).getList();
|
||||
// 导出 Excel
|
||||
ExcelUtils.write(response, "进出记录图片.xls", "数据", AccessRecordPictureRespVO.class,
|
||||
BeanUtils.toBean(list, AccessRecordPictureRespVO.class));
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,34 @@
|
||||
package cn.iocoder.yudao.module.parking.controller.admin.accessrecordpicture.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
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class AccessRecordPicturePageReqVO extends PageParam {
|
||||
|
||||
@Schema(description = "场库编号")
|
||||
private String parkNumber;
|
||||
|
||||
@Schema(description = "图片名称", example = "赵六")
|
||||
private String imageName;
|
||||
|
||||
@Schema(description = "图片内容")
|
||||
private String image;
|
||||
|
||||
@Schema(description = "图片来源地址")
|
||||
private String imgAddress;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDateTime[] createTime;
|
||||
|
||||
}
|
@ -0,0 +1,40 @@
|
||||
package cn.iocoder.yudao.module.parking.controller.admin.accessrecordpicture.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import java.util.*;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import java.time.LocalDateTime;
|
||||
import com.alibaba.excel.annotation.*;
|
||||
|
||||
@Schema(description = "管理后台 - 进出记录图片 Response VO")
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
public class AccessRecordPictureRespVO {
|
||||
|
||||
@Schema(description = "id", requiredMode = Schema.RequiredMode.REQUIRED, example = "18669")
|
||||
@ExcelProperty("id")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "场库编号", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("场库编号")
|
||||
private String parkNumber;
|
||||
|
||||
@Schema(description = "图片名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "赵六")
|
||||
@ExcelProperty("图片名称")
|
||||
private String imageName;
|
||||
|
||||
@Schema(description = "图片内容", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("图片内容")
|
||||
private String image;
|
||||
|
||||
@Schema(description = "图片来源地址")
|
||||
@ExcelProperty("图片来源地址")
|
||||
private String imgAddress;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
@ExcelProperty("创建时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
}
|
@ -0,0 +1,30 @@
|
||||
package cn.iocoder.yudao.module.parking.controller.admin.accessrecordpicture.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import javax.validation.constraints.*;
|
||||
|
||||
@Schema(description = "管理后台 - 进出记录图片新增/修改 Request VO")
|
||||
@Data
|
||||
public class AccessRecordPictureSaveReqVO {
|
||||
|
||||
@Schema(description = "id", requiredMode = Schema.RequiredMode.REQUIRED, example = "18669")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "场库编号", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotEmpty(message = "场库编号不能为空")
|
||||
private String parkNumber;
|
||||
|
||||
@Schema(description = "图片名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "赵六")
|
||||
@NotEmpty(message = "图片名称不能为空")
|
||||
private String imageName;
|
||||
|
||||
@Schema(description = "图片内容", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotEmpty(message = "图片内容不能为空")
|
||||
private String image;
|
||||
|
||||
@Schema(description = "图片来源地址")
|
||||
private String imgAddress;
|
||||
|
||||
}
|
@ -0,0 +1,47 @@
|
||||
package cn.iocoder.yudao.module.parking.dal.dataobject.accessrecordpicture;
|
||||
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
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("access_record_picture")
|
||||
@KeySequence("access_record_picture_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class AccessRecordPictureDO extends BaseDO {
|
||||
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
@TableId
|
||||
private Long id;
|
||||
/**
|
||||
* 场库编号
|
||||
*/
|
||||
private String parkNumber;
|
||||
/**
|
||||
* 图片名称
|
||||
*/
|
||||
private String imageName;
|
||||
/**
|
||||
* 图片内容
|
||||
*/
|
||||
private String image;
|
||||
/**
|
||||
* 图片来源地址
|
||||
*/
|
||||
private String imgAddress;
|
||||
|
||||
}
|
@ -0,0 +1,30 @@
|
||||
package cn.iocoder.yudao.module.parking.dal.mysql.accessrecordpicture;
|
||||
|
||||
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.parking.dal.dataobject.accessrecordpicture.AccessRecordPictureDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import cn.iocoder.yudao.module.parking.controller.admin.accessrecordpicture.vo.*;
|
||||
|
||||
/**
|
||||
* 进出记录图片 Mapper
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@Mapper
|
||||
public interface AccessRecordPictureMapper extends BaseMapperX<AccessRecordPictureDO> {
|
||||
|
||||
default PageResult<AccessRecordPictureDO> selectPage(AccessRecordPicturePageReqVO reqVO) {
|
||||
return selectPage(reqVO, new LambdaQueryWrapperX<AccessRecordPictureDO>()
|
||||
.eqIfPresent(AccessRecordPictureDO::getParkNumber, reqVO.getParkNumber())
|
||||
.likeIfPresent(AccessRecordPictureDO::getImageName, reqVO.getImageName())
|
||||
.eqIfPresent(AccessRecordPictureDO::getImage, reqVO.getImage())
|
||||
.eqIfPresent(AccessRecordPictureDO::getImgAddress, reqVO.getImgAddress())
|
||||
.betweenIfPresent(AccessRecordPictureDO::getCreateTime, reqVO.getCreateTime())
|
||||
.orderByDesc(AccessRecordPictureDO::getId));
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,55 @@
|
||||
package cn.iocoder.yudao.module.parking.service.accessrecordpicture;
|
||||
|
||||
import java.util.*;
|
||||
import javax.validation.*;
|
||||
import cn.iocoder.yudao.module.parking.controller.admin.accessrecordpicture.vo.*;
|
||||
import cn.iocoder.yudao.module.parking.dal.dataobject.accessrecordpicture.AccessRecordPictureDO;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
|
||||
/**
|
||||
* 进出记录图片 Service 接口
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
public interface AccessRecordPictureService {
|
||||
|
||||
/**
|
||||
* 创建进出记录图片
|
||||
*
|
||||
* @param createReqVO 创建信息
|
||||
* @return 编号
|
||||
*/
|
||||
Long createAccessRecordPicture(@Valid AccessRecordPictureSaveReqVO createReqVO);
|
||||
|
||||
/**
|
||||
* 更新进出记录图片
|
||||
*
|
||||
* @param updateReqVO 更新信息
|
||||
*/
|
||||
void updateAccessRecordPicture(@Valid AccessRecordPictureSaveReqVO updateReqVO);
|
||||
|
||||
/**
|
||||
* 删除进出记录图片
|
||||
*
|
||||
* @param id 编号
|
||||
*/
|
||||
void deleteAccessRecordPicture(Long id);
|
||||
|
||||
/**
|
||||
* 获得进出记录图片
|
||||
*
|
||||
* @param id 编号
|
||||
* @return 进出记录图片
|
||||
*/
|
||||
AccessRecordPictureDO getAccessRecordPicture(Long id);
|
||||
|
||||
/**
|
||||
* 获得进出记录图片分页
|
||||
*
|
||||
* @param pageReqVO 分页查询
|
||||
* @return 进出记录图片分页
|
||||
*/
|
||||
PageResult<AccessRecordPictureDO> getAccessRecordPicturePage(AccessRecordPicturePageReqVO pageReqVO);
|
||||
|
||||
}
|
@ -0,0 +1,74 @@
|
||||
package cn.iocoder.yudao.module.parking.service.accessrecordpicture;
|
||||
|
||||
import org.springframework.stereotype.Service;
|
||||
import javax.annotation.Resource;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.*;
|
||||
import cn.iocoder.yudao.module.parking.controller.admin.accessrecordpicture.vo.*;
|
||||
import cn.iocoder.yudao.module.parking.dal.dataobject.accessrecordpicture.AccessRecordPictureDO;
|
||||
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.parking.dal.mysql.accessrecordpicture.AccessRecordPictureMapper;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static cn.iocoder.yudao.module.parking.enums.ErrorCodeConstants.*;
|
||||
|
||||
/**
|
||||
* 进出记录图片 Service 实现类
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@Service
|
||||
@Validated
|
||||
public class AccessRecordPictureServiceImpl implements AccessRecordPictureService {
|
||||
|
||||
@Resource
|
||||
private AccessRecordPictureMapper accessRecordPictureMapper;
|
||||
|
||||
@Override
|
||||
public Long createAccessRecordPicture(AccessRecordPictureSaveReqVO createReqVO) {
|
||||
// 插入
|
||||
AccessRecordPictureDO accessRecordPicture = BeanUtils.toBean(createReqVO, AccessRecordPictureDO.class);
|
||||
accessRecordPictureMapper.insert(accessRecordPicture);
|
||||
// 返回
|
||||
return accessRecordPicture.getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateAccessRecordPicture(AccessRecordPictureSaveReqVO updateReqVO) {
|
||||
// 校验存在
|
||||
validateAccessRecordPictureExists(updateReqVO.getId());
|
||||
// 更新
|
||||
AccessRecordPictureDO updateObj = BeanUtils.toBean(updateReqVO, AccessRecordPictureDO.class);
|
||||
accessRecordPictureMapper.updateById(updateObj);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteAccessRecordPicture(Long id) {
|
||||
// 校验存在
|
||||
validateAccessRecordPictureExists(id);
|
||||
// 删除
|
||||
accessRecordPictureMapper.deleteById(id);
|
||||
}
|
||||
|
||||
private void validateAccessRecordPictureExists(Long id) {
|
||||
if (accessRecordPictureMapper.selectById(id) == null) {
|
||||
throw exception(ACCESS_RECORD_PICTURE_NOT_EXISTS);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public AccessRecordPictureDO getAccessRecordPicture(Long id) {
|
||||
return accessRecordPictureMapper.selectById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResult<AccessRecordPictureDO> getAccessRecordPicturePage(AccessRecordPicturePageReqVO pageReqVO) {
|
||||
return accessRecordPictureMapper.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.parking.dal.mysql.accessrecordpicture.AccessRecordPictureMapper">
|
||||
|
||||
<!--
|
||||
一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
|
||||
无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
|
||||
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
|
||||
文档可见:https://www.iocoder.cn/MyBatis/x-plugins/
|
||||
-->
|
||||
|
||||
</mapper>
|
Loading…
Reference in New Issue
Block a user