停车场-进出记录-车辆营收数据
This commit is contained in:
parent
0735a44297
commit
b4d10f30cd
@ -0,0 +1,41 @@
|
||||
package cn.iocoder.yudao.module.parking.controller.admin.revenue.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 RevenuePageReqVO extends PageParam {
|
||||
|
||||
@Schema(description = "车牌")
|
||||
private String plate;
|
||||
|
||||
@Schema(description = "结算时间")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private String[] getTime;
|
||||
|
||||
@Schema(description = "支付金额")
|
||||
private String payCharge;
|
||||
|
||||
@Schema(description = "支付类型")
|
||||
private String payKind;
|
||||
|
||||
@Schema(description = "区域名称", example = "张三")
|
||||
private String areaName;
|
||||
|
||||
@Schema(description = "备注", example = "你猜")
|
||||
private String memo;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDateTime[] createTime;
|
||||
|
||||
}
|
@ -0,0 +1,48 @@
|
||||
package cn.iocoder.yudao.module.parking.controller.admin.revenue.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 RevenueRespVO {
|
||||
|
||||
@Schema(description = "id", requiredMode = Schema.RequiredMode.REQUIRED, example = "31542")
|
||||
@ExcelProperty("id")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "车牌", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("车牌")
|
||||
private String plate;
|
||||
|
||||
@Schema(description = "结算时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("结算时间")
|
||||
private String getTime;
|
||||
|
||||
@Schema(description = "支付金额", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("支付金额")
|
||||
private String payCharge;
|
||||
|
||||
@Schema(description = "支付类型", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("支付类型")
|
||||
private String payKind;
|
||||
|
||||
@Schema(description = "区域名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "张三")
|
||||
@ExcelProperty("区域名称")
|
||||
private String areaName;
|
||||
|
||||
@Schema(description = "备注", example = "你猜")
|
||||
@ExcelProperty("备注")
|
||||
private String memo;
|
||||
|
||||
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("创建时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
}
|
@ -0,0 +1,38 @@
|
||||
package cn.iocoder.yudao.module.parking.controller.admin.revenue.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 RevenueSaveReqVO {
|
||||
|
||||
@Schema(description = "id", requiredMode = Schema.RequiredMode.REQUIRED, example = "31542")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "车牌", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotEmpty(message = "车牌不能为空")
|
||||
private String plate;
|
||||
|
||||
@Schema(description = "结算时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotEmpty(message = "结算时间不能为空")
|
||||
private String getTime;
|
||||
|
||||
@Schema(description = "支付金额", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotEmpty(message = "支付金额不能为空")
|
||||
private String payCharge;
|
||||
|
||||
@Schema(description = "支付类型", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotEmpty(message = "支付类型不能为空")
|
||||
private String payKind;
|
||||
|
||||
@Schema(description = "区域名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "张三")
|
||||
@NotEmpty(message = "区域名称不能为空")
|
||||
private String areaName;
|
||||
|
||||
@Schema(description = "备注", example = "你猜")
|
||||
private String memo;
|
||||
|
||||
}
|
@ -0,0 +1,55 @@
|
||||
package cn.iocoder.yudao.module.parking.dal.dataobject.revenue;
|
||||
|
||||
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("revenue")
|
||||
@KeySequence("revenue_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class RevenueDO extends BaseDO {
|
||||
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
@TableId
|
||||
private Long id;
|
||||
/**
|
||||
* 车牌
|
||||
*/
|
||||
private String plate;
|
||||
/**
|
||||
* 结算时间
|
||||
*/
|
||||
private String getTime;
|
||||
/**
|
||||
* 支付金额
|
||||
*/
|
||||
private String payCharge;
|
||||
/**
|
||||
* 支付类型
|
||||
*/
|
||||
private String payKind;
|
||||
/**
|
||||
* 区域名称
|
||||
*/
|
||||
private String areaName;
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String memo;
|
||||
|
||||
}
|
@ -0,0 +1,32 @@
|
||||
package cn.iocoder.yudao.module.parking.dal.mysql.revenue;
|
||||
|
||||
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.revenue.RevenueDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import cn.iocoder.yudao.module.parking.controller.admin.revenue.vo.*;
|
||||
|
||||
/**
|
||||
* 车辆营收数据 Mapper
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@Mapper
|
||||
public interface RevenueMapper extends BaseMapperX<RevenueDO> {
|
||||
|
||||
default PageResult<RevenueDO> selectPage(RevenuePageReqVO reqVO) {
|
||||
return selectPage(reqVO, new LambdaQueryWrapperX<RevenueDO>()
|
||||
.eqIfPresent(RevenueDO::getPlate, reqVO.getPlate())
|
||||
.betweenIfPresent(RevenueDO::getGetTime, reqVO.getGetTime())
|
||||
.eqIfPresent(RevenueDO::getPayCharge, reqVO.getPayCharge())
|
||||
.eqIfPresent(RevenueDO::getPayKind, reqVO.getPayKind())
|
||||
.likeIfPresent(RevenueDO::getAreaName, reqVO.getAreaName())
|
||||
.eqIfPresent(RevenueDO::getMemo, reqVO.getMemo())
|
||||
.betweenIfPresent(RevenueDO::getCreateTime, reqVO.getCreateTime())
|
||||
.orderByDesc(RevenueDO::getId));
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,55 @@
|
||||
package cn.iocoder.yudao.module.parking.service.revenue;
|
||||
|
||||
import java.util.*;
|
||||
import javax.validation.*;
|
||||
import cn.iocoder.yudao.module.parking.controller.admin.revenue.vo.*;
|
||||
import cn.iocoder.yudao.module.parking.dal.dataobject.revenue.RevenueDO;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
|
||||
/**
|
||||
* 车辆营收数据 Service 接口
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
public interface RevenueService {
|
||||
|
||||
/**
|
||||
* 创建车辆营收数据
|
||||
*
|
||||
* @param createReqVO 创建信息
|
||||
* @return 编号
|
||||
*/
|
||||
Long createRevenue(@Valid RevenueSaveReqVO createReqVO);
|
||||
|
||||
/**
|
||||
* 更新车辆营收数据
|
||||
*
|
||||
* @param updateReqVO 更新信息
|
||||
*/
|
||||
void updateRevenue(@Valid RevenueSaveReqVO updateReqVO);
|
||||
|
||||
/**
|
||||
* 删除车辆营收数据
|
||||
*
|
||||
* @param id 编号
|
||||
*/
|
||||
void deleteRevenue(Long id);
|
||||
|
||||
/**
|
||||
* 获得车辆营收数据
|
||||
*
|
||||
* @param id 编号
|
||||
* @return 车辆营收数据
|
||||
*/
|
||||
RevenueDO getRevenue(Long id);
|
||||
|
||||
/**
|
||||
* 获得车辆营收数据分页
|
||||
*
|
||||
* @param pageReqVO 分页查询
|
||||
* @return 车辆营收数据分页
|
||||
*/
|
||||
PageResult<RevenueDO> getRevenuePage(RevenuePageReqVO pageReqVO);
|
||||
|
||||
}
|
@ -0,0 +1,74 @@
|
||||
package cn.iocoder.yudao.module.parking.service.revenue;
|
||||
|
||||
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.revenue.vo.*;
|
||||
import cn.iocoder.yudao.module.parking.dal.dataobject.revenue.RevenueDO;
|
||||
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.revenue.RevenueMapper;
|
||||
|
||||
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 RevenueServiceImpl implements RevenueService {
|
||||
|
||||
@Resource
|
||||
private RevenueMapper revenueMapper;
|
||||
|
||||
@Override
|
||||
public Long createRevenue(RevenueSaveReqVO createReqVO) {
|
||||
// 插入
|
||||
RevenueDO revenue = BeanUtils.toBean(createReqVO, RevenueDO.class);
|
||||
revenueMapper.insert(revenue);
|
||||
// 返回
|
||||
return revenue.getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateRevenue(RevenueSaveReqVO updateReqVO) {
|
||||
// 校验存在
|
||||
validateRevenueExists(updateReqVO.getId());
|
||||
// 更新
|
||||
RevenueDO updateObj = BeanUtils.toBean(updateReqVO, RevenueDO.class);
|
||||
revenueMapper.updateById(updateObj);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteRevenue(Long id) {
|
||||
// 校验存在
|
||||
validateRevenueExists(id);
|
||||
// 删除
|
||||
revenueMapper.deleteById(id);
|
||||
}
|
||||
|
||||
private void validateRevenueExists(Long id) {
|
||||
if (revenueMapper.selectById(id) == null) {
|
||||
throw exception(REVENUE_NOT_EXISTS);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public RevenueDO getRevenue(Long id) {
|
||||
return revenueMapper.selectById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResult<RevenueDO> getRevenuePage(RevenuePageReqVO pageReqVO) {
|
||||
return revenueMapper.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.revenue.RevenueMapper">
|
||||
|
||||
<!--
|
||||
一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
|
||||
无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
|
||||
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
|
||||
文档可见:https://www.iocoder.cn/MyBatis/x-plugins/
|
||||
-->
|
||||
|
||||
</mapper>
|
Loading…
x
Reference in New Issue
Block a user