停车场-进出记录-车辆进出记录数据

This commit is contained in:
XinWei 2024-07-31 10:31:26 +08:00
parent 938662d535
commit 0735a44297
8 changed files with 281 additions and 2 deletions

View File

@ -27,6 +27,8 @@ public interface ErrorCodeConstants {
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, "进出记录图片不存在");
// ========== 车辆进出记录数据 1_005_001_016 ==========
ErrorCode VEHICLE_RECORD_NOT_EXISTS = new ErrorCode(1_005_001_016, "车辆进出记录数据不存在");
// ========== 车辆营收数据 1_005_001_017 ==========
ErrorCode REVENUE_NOT_EXISTS = new ErrorCode(1_005_001_017, "车辆营收数据不存在");
}

View File

@ -0,0 +1,35 @@
package cn.iocoder.yudao.module.parking.controller.admin.vehiclerecord.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 VehicleRecordPageReqVO extends PageParam {
@Schema(description = "进或出")
private String intoOrOut;
@Schema(description = "车牌号")
private String licenseNumber;
@Schema(description = "时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private String[] time;
@Schema(description = "图片")
private String picture;
@Schema(description = "创建时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] createTime;
}

View File

@ -0,0 +1,40 @@
package cn.iocoder.yudao.module.parking.controller.admin.vehiclerecord.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 VehicleRecordRespVO {
@Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "10787")
@ExcelProperty("编号")
private Long id;
@Schema(description = "进或出", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("进或出")
private String intoOrOut;
@Schema(description = "车牌号", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("车牌号")
private String licenseNumber;
@Schema(description = "时间", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("时间")
private String time;
@Schema(description = "图片", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("图片")
private String picture;
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("创建时间")
private LocalDateTime createTime;
}

View File

@ -0,0 +1,31 @@
package cn.iocoder.yudao.module.parking.controller.admin.vehiclerecord.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 VehicleRecordSaveReqVO {
@Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "10787")
private Long id;
@Schema(description = "进或出", requiredMode = Schema.RequiredMode.REQUIRED)
@NotEmpty(message = "进或出不能为空")
private String intoOrOut;
@Schema(description = "车牌号", requiredMode = Schema.RequiredMode.REQUIRED)
@NotEmpty(message = "车牌号不能为空")
private String licenseNumber;
@Schema(description = "时间", requiredMode = Schema.RequiredMode.REQUIRED)
@NotEmpty(message = "时间不能为空")
private String time;
@Schema(description = "图片", requiredMode = Schema.RequiredMode.REQUIRED)
@NotEmpty(message = "图片不能为空")
private String picture;
}

View File

@ -0,0 +1,30 @@
package cn.iocoder.yudao.module.parking.dal.mysql.vehiclerecord;
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.vehiclerecord.VehicleRecordDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.parking.controller.admin.vehiclerecord.vo.*;
/**
* 车辆进出记录数据 Mapper
*
* @author 芋道源码
*/
@Mapper
public interface VehicleRecordMapper extends BaseMapperX<VehicleRecordDO> {
default PageResult<VehicleRecordDO> selectPage(VehicleRecordPageReqVO reqVO) {
return selectPage(reqVO, new LambdaQueryWrapperX<VehicleRecordDO>()
.eqIfPresent(VehicleRecordDO::getIntoOrOut, reqVO.getIntoOrOut())
.eqIfPresent(VehicleRecordDO::getLicenseNumber, reqVO.getLicenseNumber())
.betweenIfPresent(VehicleRecordDO::getTime, reqVO.getTime())
.eqIfPresent(VehicleRecordDO::getPicture, reqVO.getPicture())
.betweenIfPresent(VehicleRecordDO::getCreateTime, reqVO.getCreateTime())
.orderByDesc(VehicleRecordDO::getId));
}
}

View File

@ -0,0 +1,55 @@
package cn.iocoder.yudao.module.parking.service.vehiclerecord;
import java.util.*;
import javax.validation.*;
import cn.iocoder.yudao.module.parking.controller.admin.vehiclerecord.vo.*;
import cn.iocoder.yudao.module.parking.dal.dataobject.vehiclerecord.VehicleRecordDO;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
/**
* 车辆进出记录数据 Service 接口
*
* @author 芋道源码
*/
public interface VehicleRecordService {
/**
* 创建车辆进出记录数据
*
* @param createReqVO 创建信息
* @return 编号
*/
Long createVehicleRecord(@Valid VehicleRecordSaveReqVO createReqVO);
/**
* 更新车辆进出记录数据
*
* @param updateReqVO 更新信息
*/
void updateVehicleRecord(@Valid VehicleRecordSaveReqVO updateReqVO);
/**
* 删除车辆进出记录数据
*
* @param id 编号
*/
void deleteVehicleRecord(Long id);
/**
* 获得车辆进出记录数据
*
* @param id 编号
* @return 车辆进出记录数据
*/
VehicleRecordDO getVehicleRecord(Long id);
/**
* 获得车辆进出记录数据分页
*
* @param pageReqVO 分页查询
* @return 车辆进出记录数据分页
*/
PageResult<VehicleRecordDO> getVehicleRecordPage(VehicleRecordPageReqVO pageReqVO);
}

View File

@ -0,0 +1,74 @@
package cn.iocoder.yudao.module.parking.service.vehiclerecord;
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.vehiclerecord.vo.*;
import cn.iocoder.yudao.module.parking.dal.dataobject.vehiclerecord.VehicleRecordDO;
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.vehiclerecord.VehicleRecordMapper;
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 VehicleRecordServiceImpl implements VehicleRecordService {
@Resource
private VehicleRecordMapper vehicleRecordMapper;
@Override
public Long createVehicleRecord(VehicleRecordSaveReqVO createReqVO) {
// 插入
VehicleRecordDO vehicleRecord = BeanUtils.toBean(createReqVO, VehicleRecordDO.class);
vehicleRecordMapper.insert(vehicleRecord);
// 返回
return vehicleRecord.getId();
}
@Override
public void updateVehicleRecord(VehicleRecordSaveReqVO updateReqVO) {
// 校验存在
validateVehicleRecordExists(updateReqVO.getId());
// 更新
VehicleRecordDO updateObj = BeanUtils.toBean(updateReqVO, VehicleRecordDO.class);
vehicleRecordMapper.updateById(updateObj);
}
@Override
public void deleteVehicleRecord(Long id) {
// 校验存在
validateVehicleRecordExists(id);
// 删除
vehicleRecordMapper.deleteById(id);
}
private void validateVehicleRecordExists(Long id) {
if (vehicleRecordMapper.selectById(id) == null) {
throw exception(VEHICLE_RECORD_NOT_EXISTS);
}
}
@Override
public VehicleRecordDO getVehicleRecord(Long id) {
return vehicleRecordMapper.selectById(id);
}
@Override
public PageResult<VehicleRecordDO> getVehicleRecordPage(VehicleRecordPageReqVO pageReqVO) {
return vehicleRecordMapper.selectPage(pageReqVO);
}
}

View File

@ -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.vehiclerecord.VehicleRecordMapper">
<!--
一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
文档可见https://www.iocoder.cn/MyBatis/x-plugins/
-->
</mapper>