停车场-远程抬杠

This commit is contained in:
XinWei 2024-07-30 15:59:48 +08:00
parent 1fa722df3c
commit f4a240d8b3
10 changed files with 388 additions and 1 deletions

View File

@ -21,5 +21,6 @@ public interface ErrorCodeConstants {
ErrorCode BLUE_CARD_HEARTBEAT_NOT_EXISTS = new ErrorCode(1_005_001_011, "蓝卡心跳不存在");
// ========== 固定车续费记录 1_005_001_012 ==========
ErrorCode FIXED_VEHICLE_RENEWAL_RECORD_NOT_EXISTS = new ErrorCode(1_005_001_012, "固定车续费记录不存在");
// ========== 远程抬杠 1_005_001_013 ==========
ErrorCode LIFTING_ROD_NOT_EXISTS = new ErrorCode(1_005_001_013, "远程抬杠不存在");
}

View File

@ -0,0 +1,95 @@
package cn.iocoder.yudao.module.parking.controller.admin.liftingrod;
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.liftingrod.vo.*;
import cn.iocoder.yudao.module.parking.dal.dataobject.liftingrod.LiftingRodDO;
import cn.iocoder.yudao.module.parking.service.liftingrod.LiftingRodService;
@Tag(name = "管理后台 - 远程抬杠")
@RestController
@RequestMapping("/parking/lifting-rod")
@Validated
public class LiftingRodController {
@Resource
private LiftingRodService liftingRodService;
@PostMapping("/create")
@Operation(summary = "创建远程抬杠")
@PreAuthorize("@ss.hasPermission('parking:lifting-rod:create')")
public CommonResult<Long> createLiftingRod(@Valid @RequestBody LiftingRodSaveReqVO createReqVO) {
return success(liftingRodService.createLiftingRod(createReqVO));
}
@PutMapping("/update")
@Operation(summary = "更新远程抬杠")
@PreAuthorize("@ss.hasPermission('parking:lifting-rod:update')")
public CommonResult<Boolean> updateLiftingRod(@Valid @RequestBody LiftingRodSaveReqVO updateReqVO) {
liftingRodService.updateLiftingRod(updateReqVO);
return success(true);
}
@DeleteMapping("/delete")
@Operation(summary = "删除远程抬杠")
@Parameter(name = "id", description = "编号", required = true)
@PreAuthorize("@ss.hasPermission('parking:lifting-rod:delete')")
public CommonResult<Boolean> deleteLiftingRod(@RequestParam("id") Long id) {
liftingRodService.deleteLiftingRod(id);
return success(true);
}
@GetMapping("/get")
@Operation(summary = "获得远程抬杠")
@Parameter(name = "id", description = "编号", required = true, example = "1024")
@PreAuthorize("@ss.hasPermission('parking:lifting-rod:query')")
public CommonResult<LiftingRodRespVO> getLiftingRod(@RequestParam("id") Long id) {
LiftingRodDO liftingRod = liftingRodService.getLiftingRod(id);
return success(BeanUtils.toBean(liftingRod, LiftingRodRespVO.class));
}
@GetMapping("/page")
@Operation(summary = "获得远程抬杠分页")
@PreAuthorize("@ss.hasPermission('parking:lifting-rod:query')")
public CommonResult<PageResult<LiftingRodRespVO>> getLiftingRodPage(@Valid LiftingRodPageReqVO pageReqVO) {
PageResult<LiftingRodDO> pageResult = liftingRodService.getLiftingRodPage(pageReqVO);
return success(BeanUtils.toBean(pageResult, LiftingRodRespVO.class));
}
@GetMapping("/export-excel")
@Operation(summary = "导出远程抬杠 Excel")
@PreAuthorize("@ss.hasPermission('parking:lifting-rod:export')")
@ApiAccessLog(operateType = EXPORT)
public void exportLiftingRodExcel(@Valid LiftingRodPageReqVO pageReqVO,
HttpServletResponse response) throws IOException {
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
List<LiftingRodDO> list = liftingRodService.getLiftingRodPage(pageReqVO).getList();
// 导出 Excel
ExcelUtils.write(response, "远程抬杠.xls", "数据", LiftingRodRespVO.class,
BeanUtils.toBean(list, LiftingRodRespVO.class));
}
}

View File

@ -0,0 +1,28 @@
package cn.iocoder.yudao.module.parking.controller.admin.liftingrod.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 LiftingRodPageReqVO extends PageParam {
@Schema(description = "停车场编号")
private String parkNumber;
@Schema(description = "通道Id", example = "18744")
private String passagewayId;
@Schema(description = "创建时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] createTime;
}

View File

@ -0,0 +1,32 @@
package cn.iocoder.yudao.module.parking.controller.admin.liftingrod.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 LiftingRodRespVO {
@Schema(description = "id", requiredMode = Schema.RequiredMode.REQUIRED, example = "24642")
@ExcelProperty("id")
private Long id;
@Schema(description = "停车场编号", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("停车场编号")
private String parkNumber;
@Schema(description = "通道Id", requiredMode = Schema.RequiredMode.REQUIRED, example = "18744")
@ExcelProperty("通道Id")
private String passagewayId;
@Schema(description = "创建时间")
@ExcelProperty("创建时间")
private LocalDateTime createTime;
}

View File

@ -0,0 +1,23 @@
package cn.iocoder.yudao.module.parking.controller.admin.liftingrod.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 LiftingRodSaveReqVO {
@Schema(description = "id", requiredMode = Schema.RequiredMode.REQUIRED, example = "24642")
private Long id;
@Schema(description = "停车场编号", requiredMode = Schema.RequiredMode.REQUIRED)
@NotEmpty(message = "停车场编号不能为空")
private String parkNumber;
@Schema(description = "通道Id", requiredMode = Schema.RequiredMode.REQUIRED, example = "18744")
@NotEmpty(message = "通道Id不能为空")
private String passagewayId;
}

View File

@ -0,0 +1,39 @@
package cn.iocoder.yudao.module.parking.dal.dataobject.liftingrod;
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("lifting_rod")
@KeySequence("lifting_rod_seq") // 用于 OraclePostgreSQLKingbaseDB2H2 数据库的主键自增如果是 MySQL 等数据库可不写
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class LiftingRodDO extends BaseDO {
/**
* id
*/
@TableId
private Long id;
/**
* 停车场编号
*/
private String parkNumber;
/**
* 通道Id
*/
private String passagewayId;
}

View File

@ -0,0 +1,28 @@
package cn.iocoder.yudao.module.parking.dal.mysql.liftingrod;
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.liftingrod.LiftingRodDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.parking.controller.admin.liftingrod.vo.*;
/**
* 远程抬杠 Mapper
*
* @author 芋道源码
*/
@Mapper
public interface LiftingRodMapper extends BaseMapperX<LiftingRodDO> {
default PageResult<LiftingRodDO> selectPage(LiftingRodPageReqVO reqVO) {
return selectPage(reqVO, new LambdaQueryWrapperX<LiftingRodDO>()
.eqIfPresent(LiftingRodDO::getParkNumber, reqVO.getParkNumber())
.eqIfPresent(LiftingRodDO::getPassagewayId, reqVO.getPassagewayId())
.betweenIfPresent(LiftingRodDO::getCreateTime, reqVO.getCreateTime())
.orderByDesc(LiftingRodDO::getId));
}
}

View File

@ -0,0 +1,55 @@
package cn.iocoder.yudao.module.parking.service.liftingrod;
import java.util.*;
import javax.validation.*;
import cn.iocoder.yudao.module.parking.controller.admin.liftingrod.vo.*;
import cn.iocoder.yudao.module.parking.dal.dataobject.liftingrod.LiftingRodDO;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
/**
* 远程抬杠 Service 接口
*
* @author 芋道源码
*/
public interface LiftingRodService {
/**
* 创建远程抬杠
*
* @param createReqVO 创建信息
* @return 编号
*/
Long createLiftingRod(@Valid LiftingRodSaveReqVO createReqVO);
/**
* 更新远程抬杠
*
* @param updateReqVO 更新信息
*/
void updateLiftingRod(@Valid LiftingRodSaveReqVO updateReqVO);
/**
* 删除远程抬杠
*
* @param id 编号
*/
void deleteLiftingRod(Long id);
/**
* 获得远程抬杠
*
* @param id 编号
* @return 远程抬杠
*/
LiftingRodDO getLiftingRod(Long id);
/**
* 获得远程抬杠分页
*
* @param pageReqVO 分页查询
* @return 远程抬杠分页
*/
PageResult<LiftingRodDO> getLiftingRodPage(LiftingRodPageReqVO pageReqVO);
}

View File

@ -0,0 +1,74 @@
package cn.iocoder.yudao.module.parking.service.liftingrod;
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.liftingrod.vo.*;
import cn.iocoder.yudao.module.parking.dal.dataobject.liftingrod.LiftingRodDO;
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.liftingrod.LiftingRodMapper;
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 LiftingRodServiceImpl implements LiftingRodService {
@Resource
private LiftingRodMapper liftingRodMapper;
@Override
public Long createLiftingRod(LiftingRodSaveReqVO createReqVO) {
// 插入
LiftingRodDO liftingRod = BeanUtils.toBean(createReqVO, LiftingRodDO.class);
liftingRodMapper.insert(liftingRod);
// 返回
return liftingRod.getId();
}
@Override
public void updateLiftingRod(LiftingRodSaveReqVO updateReqVO) {
// 校验存在
validateLiftingRodExists(updateReqVO.getId());
// 更新
LiftingRodDO updateObj = BeanUtils.toBean(updateReqVO, LiftingRodDO.class);
liftingRodMapper.updateById(updateObj);
}
@Override
public void deleteLiftingRod(Long id) {
// 校验存在
validateLiftingRodExists(id);
// 删除
liftingRodMapper.deleteById(id);
}
private void validateLiftingRodExists(Long id) {
if (liftingRodMapper.selectById(id) == null) {
throw exception(LIFTING_ROD_NOT_EXISTS);
}
}
@Override
public LiftingRodDO getLiftingRod(Long id) {
return liftingRodMapper.selectById(id);
}
@Override
public PageResult<LiftingRodDO> getLiftingRodPage(LiftingRodPageReqVO pageReqVO) {
return liftingRodMapper.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.liftingrod.LiftingRodMapper">
<!--
一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
文档可见https://www.iocoder.cn/MyBatis/x-plugins/
-->
</mapper>