xinwei #3
@ -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, "蓝卡心跳不存在");
|
||||
}
|
||||
|
@ -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<Long> createBlueCardHeartbeat(@Valid @RequestBody BlueCardHeartbeatSaveReqVO createReqVO) {
|
||||
return success(blueCardHeartbeatService.createBlueCardHeartbeat(createReqVO));
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "更新蓝卡心跳")
|
||||
@PreAuthorize("@ss.hasPermission('parking:blue-card-heartbeat:update')")
|
||||
public CommonResult<Boolean> 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<Boolean> 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<BlueCardHeartbeatRespVO> 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<PageResult<BlueCardHeartbeatRespVO>> getBlueCardHeartbeatPage(@Valid BlueCardHeartbeatPageReqVO pageReqVO) {
|
||||
PageResult<BlueCardHeartbeatDO> 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<BlueCardHeartbeatDO> list = blueCardHeartbeatService.getBlueCardHeartbeatPage(pageReqVO).getList();
|
||||
// 导出 Excel
|
||||
ExcelUtils.write(response, "蓝卡心跳.xls", "数据", BlueCardHeartbeatRespVO.class,
|
||||
BeanUtils.toBean(list, BlueCardHeartbeatRespVO.class));
|
||||
}
|
||||
|
||||
}
|
@ -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;
|
||||
|
||||
}
|
@ -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;
|
||||
|
||||
}
|
@ -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;
|
||||
|
||||
}
|
@ -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;
|
||||
|
||||
}
|
@ -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<BlueCardHeartbeatDO> {
|
||||
|
||||
default PageResult<BlueCardHeartbeatDO> selectPage(BlueCardHeartbeatPageReqVO reqVO) {
|
||||
return selectPage(reqVO, new LambdaQueryWrapperX<BlueCardHeartbeatDO>()
|
||||
.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));
|
||||
}
|
||||
|
||||
}
|
@ -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<BlueCardHeartbeatDO> getBlueCardHeartbeatPage(BlueCardHeartbeatPageReqVO pageReqVO);
|
||||
|
||||
}
|
@ -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<BlueCardHeartbeatDO> getBlueCardHeartbeatPage(BlueCardHeartbeatPageReqVO pageReqVO) {
|
||||
return blueCardHeartbeatMapper.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.bluecardheartbeat.BlueCardHeartbeatMapper">
|
||||
|
||||
<!--
|
||||
一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
|
||||
无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
|
||||
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
|
||||
文档可见:https://www.iocoder.cn/MyBatis/x-plugins/
|
||||
-->
|
||||
|
||||
</mapper>
|
Loading…
Reference in New Issue
Block a user