停车场-黑名单配置
This commit is contained in:
parent
cd80d93d6d
commit
bf422b35ae
@ -13,6 +13,8 @@ public interface ErrorCodeConstants {
|
||||
ErrorCode CHARGE_INFORMATION_NOT_EXISTS = new ErrorCode(1_005_001_007, "收费信息不存在");
|
||||
// ========== 入场记录 1_005_001_008 ==========
|
||||
ErrorCode ENTRY_RECORD_NOT_EXISTS = new ErrorCode(1_005_001_008, "入场记录不存在");
|
||||
// ========== 白名单配置 TODO 补充编号 ==========
|
||||
// ========== 白名单配置 1_005_001_009 ==========
|
||||
ErrorCode WHITELIST_DELIVERY_NOT_EXISTS = new ErrorCode(1_005_001_009, "白名单配置不存在");
|
||||
// ========== 黑名单配置 1_005_001_010 ==========
|
||||
ErrorCode BLACKLIST_DELIVERY_NOT_EXISTS = new ErrorCode(1_005_001_010, "黑名单配置不存在");
|
||||
}
|
||||
|
@ -0,0 +1,95 @@
|
||||
package cn.iocoder.yudao.module.parking.controller.admin.blacklistdelivery;
|
||||
|
||||
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.blacklistdelivery.vo.*;
|
||||
import cn.iocoder.yudao.module.parking.dal.dataobject.blacklistdelivery.BlacklistDeliveryDO;
|
||||
import cn.iocoder.yudao.module.parking.service.blacklistdelivery.BlacklistDeliveryService;
|
||||
|
||||
@Tag(name = "管理后台 - 黑名单配置")
|
||||
@RestController
|
||||
@RequestMapping("/parking/blacklist-delivery")
|
||||
@Validated
|
||||
public class BlacklistDeliveryController {
|
||||
|
||||
@Resource
|
||||
private BlacklistDeliveryService blacklistDeliveryService;
|
||||
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建黑名单配置")
|
||||
@PreAuthorize("@ss.hasPermission('parking:blacklist-delivery:create')")
|
||||
public CommonResult<Long> createBlacklistDelivery(@Valid @RequestBody BlacklistDeliverySaveReqVO createReqVO) {
|
||||
return success(blacklistDeliveryService.createBlacklistDelivery(createReqVO));
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "更新黑名单配置")
|
||||
@PreAuthorize("@ss.hasPermission('parking:blacklist-delivery:update')")
|
||||
public CommonResult<Boolean> updateBlacklistDelivery(@Valid @RequestBody BlacklistDeliverySaveReqVO updateReqVO) {
|
||||
blacklistDeliveryService.updateBlacklistDelivery(updateReqVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "删除黑名单配置")
|
||||
@Parameter(name = "id", description = "编号", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('parking:blacklist-delivery:delete')")
|
||||
public CommonResult<Boolean> deleteBlacklistDelivery(@RequestParam("id") Long id) {
|
||||
blacklistDeliveryService.deleteBlacklistDelivery(id);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得黑名单配置")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
@PreAuthorize("@ss.hasPermission('parking:blacklist-delivery:query')")
|
||||
public CommonResult<BlacklistDeliveryRespVO> getBlacklistDelivery(@RequestParam("id") Long id) {
|
||||
BlacklistDeliveryDO blacklistDelivery = blacklistDeliveryService.getBlacklistDelivery(id);
|
||||
return success(BeanUtils.toBean(blacklistDelivery, BlacklistDeliveryRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得黑名单配置分页")
|
||||
@PreAuthorize("@ss.hasPermission('parking:blacklist-delivery:query')")
|
||||
public CommonResult<PageResult<BlacklistDeliveryRespVO>> getBlacklistDeliveryPage(@Valid BlacklistDeliveryPageReqVO pageReqVO) {
|
||||
PageResult<BlacklistDeliveryDO> pageResult = blacklistDeliveryService.getBlacklistDeliveryPage(pageReqVO);
|
||||
return success(BeanUtils.toBean(pageResult, BlacklistDeliveryRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/export-excel")
|
||||
@Operation(summary = "导出黑名单配置 Excel")
|
||||
@PreAuthorize("@ss.hasPermission('parking:blacklist-delivery:export')")
|
||||
@ApiAccessLog(operateType = EXPORT)
|
||||
public void exportBlacklistDeliveryExcel(@Valid BlacklistDeliveryPageReqVO pageReqVO,
|
||||
HttpServletResponse response) throws IOException {
|
||||
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
||||
List<BlacklistDeliveryDO> list = blacklistDeliveryService.getBlacklistDeliveryPage(pageReqVO).getList();
|
||||
// 导出 Excel
|
||||
ExcelUtils.write(response, "黑名单配置.xls", "数据", BlacklistDeliveryRespVO.class,
|
||||
BeanUtils.toBean(list, BlacklistDeliveryRespVO.class));
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,37 @@
|
||||
package cn.iocoder.yudao.module.parking.controller.admin.blacklistdelivery.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 BlacklistDeliveryPageReqVO extends PageParam {
|
||||
|
||||
@Schema(description = "场库编号")
|
||||
private String parkNumber;
|
||||
|
||||
@Schema(description = "来源")
|
||||
private String source;
|
||||
|
||||
@Schema(description = "本次黑名单数量")
|
||||
private Integer size;
|
||||
|
||||
@Schema(description = "车牌号")
|
||||
private String plate;
|
||||
|
||||
@Schema(description = "备注", example = "随便")
|
||||
private String memo;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDateTime[] createTime;
|
||||
|
||||
}
|
@ -0,0 +1,44 @@
|
||||
package cn.iocoder.yudao.module.parking.controller.admin.blacklistdelivery.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 BlacklistDeliveryRespVO {
|
||||
|
||||
@Schema(description = "id", requiredMode = Schema.RequiredMode.REQUIRED, example = "5316")
|
||||
@ExcelProperty("id")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "场库编号", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("场库编号")
|
||||
private String parkNumber;
|
||||
|
||||
@Schema(description = "来源", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("来源")
|
||||
private String source;
|
||||
|
||||
@Schema(description = "本次黑名单数量", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("本次黑名单数量")
|
||||
private Integer size;
|
||||
|
||||
@Schema(description = "车牌号")
|
||||
@ExcelProperty("车牌号")
|
||||
private String plate;
|
||||
|
||||
@Schema(description = "备注", example = "随便")
|
||||
@ExcelProperty("备注")
|
||||
private String memo;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
@ExcelProperty("创建时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
}
|
@ -0,0 +1,33 @@
|
||||
package cn.iocoder.yudao.module.parking.controller.admin.blacklistdelivery.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 BlacklistDeliverySaveReqVO {
|
||||
|
||||
@Schema(description = "id", requiredMode = Schema.RequiredMode.REQUIRED, example = "5316")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "场库编号", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotEmpty(message = "场库编号不能为空")
|
||||
private String parkNumber;
|
||||
|
||||
@Schema(description = "来源", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotEmpty(message = "来源不能为空")
|
||||
private String source;
|
||||
|
||||
@Schema(description = "本次黑名单数量", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "本次黑名单数量不能为空")
|
||||
private Integer size;
|
||||
|
||||
@Schema(description = "车牌号")
|
||||
private String plate;
|
||||
|
||||
@Schema(description = "备注", example = "随便")
|
||||
private String memo;
|
||||
|
||||
}
|
@ -0,0 +1,51 @@
|
||||
package cn.iocoder.yudao.module.parking.dal.dataobject.blacklistdelivery;
|
||||
|
||||
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("blacklist_delivery")
|
||||
@KeySequence("blacklist_delivery_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class BlacklistDeliveryDO extends BaseDO {
|
||||
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
@TableId
|
||||
private Long id;
|
||||
/**
|
||||
* 场库编号
|
||||
*/
|
||||
private String parkNumber;
|
||||
/**
|
||||
* 来源
|
||||
*/
|
||||
private String source;
|
||||
/**
|
||||
* 本次黑名单数量
|
||||
*/
|
||||
private Integer size;
|
||||
/**
|
||||
* 车牌号
|
||||
*/
|
||||
private String plate;
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String memo;
|
||||
|
||||
}
|
@ -0,0 +1,31 @@
|
||||
package cn.iocoder.yudao.module.parking.dal.mysql.blacklistdelivery;
|
||||
|
||||
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.blacklistdelivery.BlacklistDeliveryDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import cn.iocoder.yudao.module.parking.controller.admin.blacklistdelivery.vo.*;
|
||||
|
||||
/**
|
||||
* 黑名单配置 Mapper
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@Mapper
|
||||
public interface BlacklistDeliveryMapper extends BaseMapperX<BlacklistDeliveryDO> {
|
||||
|
||||
default PageResult<BlacklistDeliveryDO> selectPage(BlacklistDeliveryPageReqVO reqVO) {
|
||||
return selectPage(reqVO, new LambdaQueryWrapperX<BlacklistDeliveryDO>()
|
||||
.eqIfPresent(BlacklistDeliveryDO::getParkNumber, reqVO.getParkNumber())
|
||||
.eqIfPresent(BlacklistDeliveryDO::getSource, reqVO.getSource())
|
||||
.eqIfPresent(BlacklistDeliveryDO::getSize, reqVO.getSize())
|
||||
.eqIfPresent(BlacklistDeliveryDO::getPlate, reqVO.getPlate())
|
||||
.eqIfPresent(BlacklistDeliveryDO::getMemo, reqVO.getMemo())
|
||||
.betweenIfPresent(BlacklistDeliveryDO::getCreateTime, reqVO.getCreateTime())
|
||||
.orderByDesc(BlacklistDeliveryDO::getId));
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,55 @@
|
||||
package cn.iocoder.yudao.module.parking.service.blacklistdelivery;
|
||||
|
||||
import java.util.*;
|
||||
import javax.validation.*;
|
||||
import cn.iocoder.yudao.module.parking.controller.admin.blacklistdelivery.vo.*;
|
||||
import cn.iocoder.yudao.module.parking.dal.dataobject.blacklistdelivery.BlacklistDeliveryDO;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
|
||||
/**
|
||||
* 黑名单配置 Service 接口
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
public interface BlacklistDeliveryService {
|
||||
|
||||
/**
|
||||
* 创建黑名单配置
|
||||
*
|
||||
* @param createReqVO 创建信息
|
||||
* @return 编号
|
||||
*/
|
||||
Long createBlacklistDelivery(@Valid BlacklistDeliverySaveReqVO createReqVO);
|
||||
|
||||
/**
|
||||
* 更新黑名单配置
|
||||
*
|
||||
* @param updateReqVO 更新信息
|
||||
*/
|
||||
void updateBlacklistDelivery(@Valid BlacklistDeliverySaveReqVO updateReqVO);
|
||||
|
||||
/**
|
||||
* 删除黑名单配置
|
||||
*
|
||||
* @param id 编号
|
||||
*/
|
||||
void deleteBlacklistDelivery(Long id);
|
||||
|
||||
/**
|
||||
* 获得黑名单配置
|
||||
*
|
||||
* @param id 编号
|
||||
* @return 黑名单配置
|
||||
*/
|
||||
BlacklistDeliveryDO getBlacklistDelivery(Long id);
|
||||
|
||||
/**
|
||||
* 获得黑名单配置分页
|
||||
*
|
||||
* @param pageReqVO 分页查询
|
||||
* @return 黑名单配置分页
|
||||
*/
|
||||
PageResult<BlacklistDeliveryDO> getBlacklistDeliveryPage(BlacklistDeliveryPageReqVO pageReqVO);
|
||||
|
||||
}
|
@ -0,0 +1,74 @@
|
||||
package cn.iocoder.yudao.module.parking.service.blacklistdelivery;
|
||||
|
||||
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.blacklistdelivery.vo.*;
|
||||
import cn.iocoder.yudao.module.parking.dal.dataobject.blacklistdelivery.BlacklistDeliveryDO;
|
||||
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.blacklistdelivery.BlacklistDeliveryMapper;
|
||||
|
||||
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 BlacklistDeliveryServiceImpl implements BlacklistDeliveryService {
|
||||
|
||||
@Resource
|
||||
private BlacklistDeliveryMapper blacklistDeliveryMapper;
|
||||
|
||||
@Override
|
||||
public Long createBlacklistDelivery(BlacklistDeliverySaveReqVO createReqVO) {
|
||||
// 插入
|
||||
BlacklistDeliveryDO blacklistDelivery = BeanUtils.toBean(createReqVO, BlacklistDeliveryDO.class);
|
||||
blacklistDeliveryMapper.insert(blacklistDelivery);
|
||||
// 返回
|
||||
return blacklistDelivery.getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateBlacklistDelivery(BlacklistDeliverySaveReqVO updateReqVO) {
|
||||
// 校验存在
|
||||
validateBlacklistDeliveryExists(updateReqVO.getId());
|
||||
// 更新
|
||||
BlacklistDeliveryDO updateObj = BeanUtils.toBean(updateReqVO, BlacklistDeliveryDO.class);
|
||||
blacklistDeliveryMapper.updateById(updateObj);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteBlacklistDelivery(Long id) {
|
||||
// 校验存在
|
||||
validateBlacklistDeliveryExists(id);
|
||||
// 删除
|
||||
blacklistDeliveryMapper.deleteById(id);
|
||||
}
|
||||
|
||||
private void validateBlacklistDeliveryExists(Long id) {
|
||||
if (blacklistDeliveryMapper.selectById(id) == null) {
|
||||
throw exception(BLACKLIST_DELIVERY_NOT_EXISTS);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlacklistDeliveryDO getBlacklistDelivery(Long id) {
|
||||
return blacklistDeliveryMapper.selectById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResult<BlacklistDeliveryDO> getBlacklistDeliveryPage(BlacklistDeliveryPageReqVO pageReqVO) {
|
||||
return blacklistDeliveryMapper.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.blacklistdelivery.BlacklistDeliveryMapper">
|
||||
|
||||
<!--
|
||||
一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
|
||||
无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
|
||||
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
|
||||
文档可见:https://www.iocoder.cn/MyBatis/x-plugins/
|
||||
-->
|
||||
|
||||
</mapper>
|
Loading…
Reference in New Issue
Block a user