diff --git a/ludu-module-parking/ludu-module-parking-api/src/main/java/cn/iocoder/yudao/module/parking/enums/ErrorCodeConstants.java b/ludu-module-parking/ludu-module-parking-api/src/main/java/cn/iocoder/yudao/module/parking/enums/ErrorCodeConstants.java index 633991418..4a98aaa43 100644 --- a/ludu-module-parking/ludu-module-parking-api/src/main/java/cn/iocoder/yudao/module/parking/enums/ErrorCodeConstants.java +++ b/ludu-module-parking/ludu-module-parking-api/src/main/java/cn/iocoder/yudao/module/parking/enums/ErrorCodeConstants.java @@ -17,4 +17,6 @@ public interface ErrorCodeConstants { 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, "黑名单配置不存在"); + // ========== 蓝卡心跳 1_005_001_011 ========== + ErrorCode BLUE_CARD_HEARTBEAT_NOT_EXISTS = new ErrorCode(1_005_001_011, "蓝卡心跳不存在"); } diff --git a/ludu-module-parking/ludu-module-parking-biz/src/main/java/cn/iocoder/yudao/module/parking/controller/admin/bluecardheartbeat/BlueCardHeartbeatController.java b/ludu-module-parking/ludu-module-parking-biz/src/main/java/cn/iocoder/yudao/module/parking/controller/admin/bluecardheartbeat/BlueCardHeartbeatController.java new file mode 100644 index 000000000..16b11c2b9 --- /dev/null +++ b/ludu-module-parking/ludu-module-parking-biz/src/main/java/cn/iocoder/yudao/module/parking/controller/admin/bluecardheartbeat/BlueCardHeartbeatController.java @@ -0,0 +1,95 @@ +package cn.iocoder.yudao.module.parking.controller.admin.bluecardheartbeat; + +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.bluecardheartbeat.vo.*; +import cn.iocoder.yudao.module.parking.dal.dataobject.bluecardheartbeat.BlueCardHeartbeatDO; +import cn.iocoder.yudao.module.parking.service.bluecardheartbeat.BlueCardHeartbeatService; + +@Tag(name = "管理后台 - 蓝卡心跳") +@RestController +@RequestMapping("/parking/blue-card-heartbeat") +@Validated +public class BlueCardHeartbeatController { + + @Resource + private BlueCardHeartbeatService blueCardHeartbeatService; + + @PostMapping("/create") + @Operation(summary = "创建蓝卡心跳") + @PreAuthorize("@ss.hasPermission('parking:blue-card-heartbeat:create')") + public CommonResult createBlueCardHeartbeat(@Valid @RequestBody BlueCardHeartbeatSaveReqVO createReqVO) { + return success(blueCardHeartbeatService.createBlueCardHeartbeat(createReqVO)); + } + + @PutMapping("/update") + @Operation(summary = "更新蓝卡心跳") + @PreAuthorize("@ss.hasPermission('parking:blue-card-heartbeat:update')") + public CommonResult updateBlueCardHeartbeat(@Valid @RequestBody BlueCardHeartbeatSaveReqVO updateReqVO) { + blueCardHeartbeatService.updateBlueCardHeartbeat(updateReqVO); + return success(true); + } + + @DeleteMapping("/delete") + @Operation(summary = "删除蓝卡心跳") + @Parameter(name = "id", description = "编号", required = true) + @PreAuthorize("@ss.hasPermission('parking:blue-card-heartbeat:delete')") + public CommonResult deleteBlueCardHeartbeat(@RequestParam("id") Long id) { + blueCardHeartbeatService.deleteBlueCardHeartbeat(id); + return success(true); + } + + @GetMapping("/get") + @Operation(summary = "获得蓝卡心跳") + @Parameter(name = "id", description = "编号", required = true, example = "1024") + @PreAuthorize("@ss.hasPermission('parking:blue-card-heartbeat:query')") + public CommonResult getBlueCardHeartbeat(@RequestParam("id") Long id) { + BlueCardHeartbeatDO blueCardHeartbeat = blueCardHeartbeatService.getBlueCardHeartbeat(id); + return success(BeanUtils.toBean(blueCardHeartbeat, BlueCardHeartbeatRespVO.class)); + } + + @GetMapping("/page") + @Operation(summary = "获得蓝卡心跳分页") + @PreAuthorize("@ss.hasPermission('parking:blue-card-heartbeat:query')") + public CommonResult> getBlueCardHeartbeatPage(@Valid BlueCardHeartbeatPageReqVO pageReqVO) { + PageResult pageResult = blueCardHeartbeatService.getBlueCardHeartbeatPage(pageReqVO); + return success(BeanUtils.toBean(pageResult, BlueCardHeartbeatRespVO.class)); + } + + @GetMapping("/export-excel") + @Operation(summary = "导出蓝卡心跳 Excel") + @PreAuthorize("@ss.hasPermission('parking:blue-card-heartbeat:export')") + @ApiAccessLog(operateType = EXPORT) + public void exportBlueCardHeartbeatExcel(@Valid BlueCardHeartbeatPageReqVO pageReqVO, + HttpServletResponse response) throws IOException { + pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE); + List list = blueCardHeartbeatService.getBlueCardHeartbeatPage(pageReqVO).getList(); + // 导出 Excel + ExcelUtils.write(response, "蓝卡心跳.xls", "数据", BlueCardHeartbeatRespVO.class, + BeanUtils.toBean(list, BlueCardHeartbeatRespVO.class)); + } + +} \ No newline at end of file diff --git a/ludu-module-parking/ludu-module-parking-biz/src/main/java/cn/iocoder/yudao/module/parking/controller/admin/bluecardheartbeat/vo/BlueCardHeartbeatPageReqVO.java b/ludu-module-parking/ludu-module-parking-biz/src/main/java/cn/iocoder/yudao/module/parking/controller/admin/bluecardheartbeat/vo/BlueCardHeartbeatPageReqVO.java new file mode 100644 index 000000000..35f1b4bae --- /dev/null +++ b/ludu-module-parking/ludu-module-parking-biz/src/main/java/cn/iocoder/yudao/module/parking/controller/admin/bluecardheartbeat/vo/BlueCardHeartbeatPageReqVO.java @@ -0,0 +1,55 @@ +package cn.iocoder.yudao.module.parking.controller.admin.bluecardheartbeat.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 BlueCardHeartbeatPageReqVO extends PageParam { + + @Schema(description = "场库编号") + private String parkNumber; + + @Schema(description = "场库总车位数", example = "24793") + private Integer spaceCount; + + @Schema(description = "场库空车位数", example = "16856") + private Integer freeSpaceCount; + + @Schema(description = "场库可预约数", example = "20922") + private Integer bookSpaceCount; + + @Schema(description = "场库在场预约数", example = "5983") + private Integer bookInParkCount; + + @Schema(description = "区域名称", example = "赵六") + private String areaName; + + @Schema(description = "区域车位数", example = "30986") + private Integer areaSpaceCount; + + @Schema(description = "区域空位数", example = "12741") + private Integer areaLastSpaceCount; + + @Schema(description = "区域可预约车位数", example = "26713") + private Integer areaBookSpaceCount; + + @Schema(description = "区域在场预约数", example = "15466") + private Integer areaBookInParkCount; + + @Schema(description = "区域Id", example = "31607") + private Integer areaId; + + @Schema(description = "创建时间") + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + private LocalDateTime[] createTime; + +} \ No newline at end of file diff --git a/ludu-module-parking/ludu-module-parking-biz/src/main/java/cn/iocoder/yudao/module/parking/controller/admin/bluecardheartbeat/vo/BlueCardHeartbeatRespVO.java b/ludu-module-parking/ludu-module-parking-biz/src/main/java/cn/iocoder/yudao/module/parking/controller/admin/bluecardheartbeat/vo/BlueCardHeartbeatRespVO.java new file mode 100644 index 000000000..a230546d8 --- /dev/null +++ b/ludu-module-parking/ludu-module-parking-biz/src/main/java/cn/iocoder/yudao/module/parking/controller/admin/bluecardheartbeat/vo/BlueCardHeartbeatRespVO.java @@ -0,0 +1,68 @@ +package cn.iocoder.yudao.module.parking.controller.admin.bluecardheartbeat.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 BlueCardHeartbeatRespVO { + + @Schema(description = "id", requiredMode = Schema.RequiredMode.REQUIRED, example = "27224") + @ExcelProperty("id") + private Long id; + + @Schema(description = "场库编号", requiredMode = Schema.RequiredMode.REQUIRED) + @ExcelProperty("场库编号") + private String parkNumber; + + @Schema(description = "场库总车位数", requiredMode = Schema.RequiredMode.REQUIRED, example = "24793") + @ExcelProperty("场库总车位数") + private Integer spaceCount; + + @Schema(description = "场库空车位数", requiredMode = Schema.RequiredMode.REQUIRED, example = "16856") + @ExcelProperty("场库空车位数") + private Integer freeSpaceCount; + + @Schema(description = "场库可预约数", requiredMode = Schema.RequiredMode.REQUIRED, example = "20922") + @ExcelProperty("场库可预约数") + private Integer bookSpaceCount; + + @Schema(description = "场库在场预约数", requiredMode = Schema.RequiredMode.REQUIRED, example = "5983") + @ExcelProperty("场库在场预约数") + private Integer bookInParkCount; + + @Schema(description = "区域名称", example = "赵六") + @ExcelProperty("区域名称") + private String areaName; + + @Schema(description = "区域车位数", example = "30986") + @ExcelProperty("区域车位数") + private Integer areaSpaceCount; + + @Schema(description = "区域空位数", example = "12741") + @ExcelProperty("区域空位数") + private Integer areaLastSpaceCount; + + @Schema(description = "区域可预约车位数", example = "26713") + @ExcelProperty("区域可预约车位数") + private Integer areaBookSpaceCount; + + @Schema(description = "区域在场预约数", example = "15466") + @ExcelProperty("区域在场预约数") + private Integer areaBookInParkCount; + + @Schema(description = "区域Id", example = "31607") + @ExcelProperty("区域Id") + private Integer areaId; + + @Schema(description = "创建时间") + @ExcelProperty("创建时间") + private LocalDateTime createTime; + +} \ No newline at end of file diff --git a/ludu-module-parking/ludu-module-parking-biz/src/main/java/cn/iocoder/yudao/module/parking/controller/admin/bluecardheartbeat/vo/BlueCardHeartbeatSaveReqVO.java b/ludu-module-parking/ludu-module-parking-biz/src/main/java/cn/iocoder/yudao/module/parking/controller/admin/bluecardheartbeat/vo/BlueCardHeartbeatSaveReqVO.java new file mode 100644 index 000000000..81092fcba --- /dev/null +++ b/ludu-module-parking/ludu-module-parking-biz/src/main/java/cn/iocoder/yudao/module/parking/controller/admin/bluecardheartbeat/vo/BlueCardHeartbeatSaveReqVO.java @@ -0,0 +1,53 @@ +package cn.iocoder.yudao.module.parking.controller.admin.bluecardheartbeat.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 BlueCardHeartbeatSaveReqVO { + + @Schema(description = "id", requiredMode = Schema.RequiredMode.REQUIRED, example = "27224") + private Long id; + + @Schema(description = "场库编号", requiredMode = Schema.RequiredMode.REQUIRED) + @NotEmpty(message = "场库编号不能为空") + private String parkNumber; + + @Schema(description = "场库总车位数", requiredMode = Schema.RequiredMode.REQUIRED, example = "24793") + @NotNull(message = "场库总车位数不能为空") + private Integer spaceCount; + + @Schema(description = "场库空车位数", requiredMode = Schema.RequiredMode.REQUIRED, example = "16856") + @NotNull(message = "场库空车位数不能为空") + private Integer freeSpaceCount; + + @Schema(description = "场库可预约数", requiredMode = Schema.RequiredMode.REQUIRED, example = "20922") + @NotNull(message = "场库可预约数不能为空") + private Integer bookSpaceCount; + + @Schema(description = "场库在场预约数", requiredMode = Schema.RequiredMode.REQUIRED, example = "5983") + @NotNull(message = "场库在场预约数不能为空") + private Integer bookInParkCount; + + @Schema(description = "区域名称", example = "赵六") + private String areaName; + + @Schema(description = "区域车位数", example = "30986") + private Integer areaSpaceCount; + + @Schema(description = "区域空位数", example = "12741") + private Integer areaLastSpaceCount; + + @Schema(description = "区域可预约车位数", example = "26713") + private Integer areaBookSpaceCount; + + @Schema(description = "区域在场预约数", example = "15466") + private Integer areaBookInParkCount; + + @Schema(description = "区域Id", example = "31607") + private Integer areaId; + +} \ No newline at end of file diff --git a/ludu-module-parking/ludu-module-parking-biz/src/main/java/cn/iocoder/yudao/module/parking/dal/dataobject/bluecardheartbeat/BlueCardHeartbeatDO.java b/ludu-module-parking/ludu-module-parking-biz/src/main/java/cn/iocoder/yudao/module/parking/dal/dataobject/bluecardheartbeat/BlueCardHeartbeatDO.java new file mode 100644 index 000000000..0351da0fe --- /dev/null +++ b/ludu-module-parking/ludu-module-parking-biz/src/main/java/cn/iocoder/yudao/module/parking/dal/dataobject/bluecardheartbeat/BlueCardHeartbeatDO.java @@ -0,0 +1,75 @@ +package cn.iocoder.yudao.module.parking.dal.dataobject.bluecardheartbeat; + +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("blue_card_heartbeat") +@KeySequence("blue_card_heartbeat_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。 +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class BlueCardHeartbeatDO extends BaseDO { + + /** + * id + */ + @TableId + private Long id; + /** + * 场库编号 + */ + private String parkNumber; + /** + * 场库总车位数 + */ + private Integer spaceCount; + /** + * 场库空车位数 + */ + private Integer freeSpaceCount; + /** + * 场库可预约数 + */ + private Integer bookSpaceCount; + /** + * 场库在场预约数 + */ + private Integer bookInParkCount; + /** + * 区域名称 + */ + private String areaName; + /** + * 区域车位数 + */ + private Integer areaSpaceCount; + /** + * 区域空位数 + */ + private Integer areaLastSpaceCount; + /** + * 区域可预约车位数 + */ + private Integer areaBookSpaceCount; + /** + * 区域在场预约数 + */ + private Integer areaBookInParkCount; + /** + * 区域Id + */ + private Integer areaId; + +} \ No newline at end of file diff --git a/ludu-module-parking/ludu-module-parking-biz/src/main/java/cn/iocoder/yudao/module/parking/dal/mysql/bluecardheartbeat/BlueCardHeartbeatMapper.java b/ludu-module-parking/ludu-module-parking-biz/src/main/java/cn/iocoder/yudao/module/parking/dal/mysql/bluecardheartbeat/BlueCardHeartbeatMapper.java new file mode 100644 index 000000000..54224877c --- /dev/null +++ b/ludu-module-parking/ludu-module-parking-biz/src/main/java/cn/iocoder/yudao/module/parking/dal/mysql/bluecardheartbeat/BlueCardHeartbeatMapper.java @@ -0,0 +1,37 @@ +package cn.iocoder.yudao.module.parking.dal.mysql.bluecardheartbeat; + +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.bluecardheartbeat.BlueCardHeartbeatDO; +import org.apache.ibatis.annotations.Mapper; +import cn.iocoder.yudao.module.parking.controller.admin.bluecardheartbeat.vo.*; + +/** + * 蓝卡心跳 Mapper + * + * @author 芋道源码 + */ +@Mapper +public interface BlueCardHeartbeatMapper extends BaseMapperX { + + default PageResult selectPage(BlueCardHeartbeatPageReqVO reqVO) { + return selectPage(reqVO, new LambdaQueryWrapperX() + .eqIfPresent(BlueCardHeartbeatDO::getParkNumber, reqVO.getParkNumber()) + .eqIfPresent(BlueCardHeartbeatDO::getSpaceCount, reqVO.getSpaceCount()) + .eqIfPresent(BlueCardHeartbeatDO::getFreeSpaceCount, reqVO.getFreeSpaceCount()) + .eqIfPresent(BlueCardHeartbeatDO::getBookSpaceCount, reqVO.getBookSpaceCount()) + .eqIfPresent(BlueCardHeartbeatDO::getBookInParkCount, reqVO.getBookInParkCount()) + .likeIfPresent(BlueCardHeartbeatDO::getAreaName, reqVO.getAreaName()) + .eqIfPresent(BlueCardHeartbeatDO::getAreaSpaceCount, reqVO.getAreaSpaceCount()) + .eqIfPresent(BlueCardHeartbeatDO::getAreaLastSpaceCount, reqVO.getAreaLastSpaceCount()) + .eqIfPresent(BlueCardHeartbeatDO::getAreaBookSpaceCount, reqVO.getAreaBookSpaceCount()) + .eqIfPresent(BlueCardHeartbeatDO::getAreaBookInParkCount, reqVO.getAreaBookInParkCount()) + .eqIfPresent(BlueCardHeartbeatDO::getAreaId, reqVO.getAreaId()) + .betweenIfPresent(BlueCardHeartbeatDO::getCreateTime, reqVO.getCreateTime()) + .orderByDesc(BlueCardHeartbeatDO::getId)); + } + +} \ No newline at end of file diff --git a/ludu-module-parking/ludu-module-parking-biz/src/main/java/cn/iocoder/yudao/module/parking/service/bluecardheartbeat/BlueCardHeartbeatService.java b/ludu-module-parking/ludu-module-parking-biz/src/main/java/cn/iocoder/yudao/module/parking/service/bluecardheartbeat/BlueCardHeartbeatService.java new file mode 100644 index 000000000..072cb11a7 --- /dev/null +++ b/ludu-module-parking/ludu-module-parking-biz/src/main/java/cn/iocoder/yudao/module/parking/service/bluecardheartbeat/BlueCardHeartbeatService.java @@ -0,0 +1,55 @@ +package cn.iocoder.yudao.module.parking.service.bluecardheartbeat; + +import java.util.*; +import javax.validation.*; +import cn.iocoder.yudao.module.parking.controller.admin.bluecardheartbeat.vo.*; +import cn.iocoder.yudao.module.parking.dal.dataobject.bluecardheartbeat.BlueCardHeartbeatDO; +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.framework.common.pojo.PageParam; + +/** + * 蓝卡心跳 Service 接口 + * + * @author 芋道源码 + */ +public interface BlueCardHeartbeatService { + + /** + * 创建蓝卡心跳 + * + * @param createReqVO 创建信息 + * @return 编号 + */ + Long createBlueCardHeartbeat(@Valid BlueCardHeartbeatSaveReqVO createReqVO); + + /** + * 更新蓝卡心跳 + * + * @param updateReqVO 更新信息 + */ + void updateBlueCardHeartbeat(@Valid BlueCardHeartbeatSaveReqVO updateReqVO); + + /** + * 删除蓝卡心跳 + * + * @param id 编号 + */ + void deleteBlueCardHeartbeat(Long id); + + /** + * 获得蓝卡心跳 + * + * @param id 编号 + * @return 蓝卡心跳 + */ + BlueCardHeartbeatDO getBlueCardHeartbeat(Long id); + + /** + * 获得蓝卡心跳分页 + * + * @param pageReqVO 分页查询 + * @return 蓝卡心跳分页 + */ + PageResult getBlueCardHeartbeatPage(BlueCardHeartbeatPageReqVO pageReqVO); + +} \ No newline at end of file diff --git a/ludu-module-parking/ludu-module-parking-biz/src/main/java/cn/iocoder/yudao/module/parking/service/bluecardheartbeat/BlueCardHeartbeatServiceImpl.java b/ludu-module-parking/ludu-module-parking-biz/src/main/java/cn/iocoder/yudao/module/parking/service/bluecardheartbeat/BlueCardHeartbeatServiceImpl.java new file mode 100644 index 000000000..8eecfa509 --- /dev/null +++ b/ludu-module-parking/ludu-module-parking-biz/src/main/java/cn/iocoder/yudao/module/parking/service/bluecardheartbeat/BlueCardHeartbeatServiceImpl.java @@ -0,0 +1,74 @@ +package cn.iocoder.yudao.module.parking.service.bluecardheartbeat; + +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.bluecardheartbeat.vo.*; +import cn.iocoder.yudao.module.parking.dal.dataobject.bluecardheartbeat.BlueCardHeartbeatDO; +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.bluecardheartbeat.BlueCardHeartbeatMapper; + +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 BlueCardHeartbeatServiceImpl implements BlueCardHeartbeatService { + + @Resource + private BlueCardHeartbeatMapper blueCardHeartbeatMapper; + + @Override + public Long createBlueCardHeartbeat(BlueCardHeartbeatSaveReqVO createReqVO) { + // 插入 + BlueCardHeartbeatDO blueCardHeartbeat = BeanUtils.toBean(createReqVO, BlueCardHeartbeatDO.class); + blueCardHeartbeatMapper.insert(blueCardHeartbeat); + // 返回 + return blueCardHeartbeat.getId(); + } + + @Override + public void updateBlueCardHeartbeat(BlueCardHeartbeatSaveReqVO updateReqVO) { + // 校验存在 + validateBlueCardHeartbeatExists(updateReqVO.getId()); + // 更新 + BlueCardHeartbeatDO updateObj = BeanUtils.toBean(updateReqVO, BlueCardHeartbeatDO.class); + blueCardHeartbeatMapper.updateById(updateObj); + } + + @Override + public void deleteBlueCardHeartbeat(Long id) { + // 校验存在 + validateBlueCardHeartbeatExists(id); + // 删除 + blueCardHeartbeatMapper.deleteById(id); + } + + private void validateBlueCardHeartbeatExists(Long id) { + if (blueCardHeartbeatMapper.selectById(id) == null) { + throw exception(BLUE_CARD_HEARTBEAT_NOT_EXISTS); + } + } + + @Override + public BlueCardHeartbeatDO getBlueCardHeartbeat(Long id) { + return blueCardHeartbeatMapper.selectById(id); + } + + @Override + public PageResult getBlueCardHeartbeatPage(BlueCardHeartbeatPageReqVO pageReqVO) { + return blueCardHeartbeatMapper.selectPage(pageReqVO); + } + +} \ No newline at end of file diff --git a/ludu-module-parking/ludu-module-parking-biz/src/main/resources/mapper/bluecardheartbeat/BlueCardHeartbeatMapper.xml b/ludu-module-parking/ludu-module-parking-biz/src/main/resources/mapper/bluecardheartbeat/BlueCardHeartbeatMapper.xml new file mode 100644 index 000000000..4652432cc --- /dev/null +++ b/ludu-module-parking/ludu-module-parking-biz/src/main/resources/mapper/bluecardheartbeat/BlueCardHeartbeatMapper.xml @@ -0,0 +1,12 @@ + + + + + + + \ No newline at end of file