预约车模块
This commit is contained in:
parent
4d5cb21c17
commit
00b921f0ba
@ -23,4 +23,6 @@ public interface ErrorCodeConstants {
|
||||
ErrorCode CHARGE_INFO_NOT_EXISTS = new ErrorCode(1_005_001_029, "收费信息不存在");
|
||||
// ========== 远程抬杠日志 1_005_001_030 ==========
|
||||
ErrorCode LIFTING_ROD_NOT_EXISTS = new ErrorCode(1_005_001_030, "远程抬杠日志不存在");
|
||||
// ========== 预约车 1_005_001_031 ==========
|
||||
ErrorCode BOOK_CAR_NOT_EXISTS = new ErrorCode(1_005_001_031, "预约车不存在");
|
||||
}
|
||||
|
@ -0,0 +1,95 @@
|
||||
package cn.iocoder.yudao.module.parking.controller.admin.bookcar;
|
||||
|
||||
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.bookcar.vo.*;
|
||||
import cn.iocoder.yudao.module.parking.dal.dataobject.bookcar.BookCarDO;
|
||||
import cn.iocoder.yudao.module.parking.service.bookcar.BookCarService;
|
||||
|
||||
@Tag(name = "管理后台 - 预约车")
|
||||
@RestController
|
||||
@RequestMapping("/parking/book-car")
|
||||
@Validated
|
||||
public class BookCarController {
|
||||
|
||||
@Resource
|
||||
private BookCarService bookCarService;
|
||||
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建预约车")
|
||||
@PreAuthorize("@ss.hasPermission('parking:book-car:create')")
|
||||
public CommonResult<Long> createBookCar(@Valid @RequestBody BookCarSaveReqVO createReqVO) {
|
||||
return success(bookCarService.createBookCar(createReqVO));
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "更新预约车")
|
||||
@PreAuthorize("@ss.hasPermission('parking:book-car:update')")
|
||||
public CommonResult<Boolean> updateBookCar(@Valid @RequestBody BookCarSaveReqVO updateReqVO) {
|
||||
bookCarService.updateBookCar(updateReqVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "删除预约车")
|
||||
@Parameter(name = "id", description = "编号", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('parking:book-car:delete')")
|
||||
public CommonResult<Boolean> deleteBookCar(@RequestParam("id") Long id) {
|
||||
bookCarService.deleteBookCar(id);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得预约车")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
@PreAuthorize("@ss.hasPermission('parking:book-car:query')")
|
||||
public CommonResult<BookCarRespVO> getBookCar(@RequestParam("id") Long id) {
|
||||
BookCarDO bookCar = bookCarService.getBookCar(id);
|
||||
return success(BeanUtils.toBean(bookCar, BookCarRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得预约车分页")
|
||||
@PreAuthorize("@ss.hasPermission('parking:book-car:query')")
|
||||
public CommonResult<PageResult<BookCarRespVO>> getBookCarPage(@Valid BookCarPageReqVO pageReqVO) {
|
||||
PageResult<BookCarDO> pageResult = bookCarService.getBookCarPage(pageReqVO);
|
||||
return success(BeanUtils.toBean(pageResult, BookCarRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/export-excel")
|
||||
@Operation(summary = "导出预约车 Excel")
|
||||
@PreAuthorize("@ss.hasPermission('parking:book-car:export')")
|
||||
@ApiAccessLog(operateType = EXPORT)
|
||||
public void exportBookCarExcel(@Valid BookCarPageReqVO pageReqVO,
|
||||
HttpServletResponse response) throws IOException {
|
||||
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
||||
List<BookCarDO> list = bookCarService.getBookCarPage(pageReqVO).getList();
|
||||
// 导出 Excel
|
||||
ExcelUtils.write(response, "预约车.xls", "数据", BookCarRespVO.class,
|
||||
BeanUtils.toBean(list, BookCarRespVO.class));
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,69 @@
|
||||
package cn.iocoder.yudao.module.parking.controller.admin.bookcar.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 BookCarPageReqVO extends PageParam {
|
||||
|
||||
@Schema(description = "场库编号")
|
||||
private String parkNumber;
|
||||
|
||||
@Schema(description = "预约车牌号")
|
||||
private String plate;
|
||||
|
||||
@Schema(description = "预约开始时间")
|
||||
private String start;
|
||||
|
||||
@Schema(description = "预约结束时间")
|
||||
private String end;
|
||||
|
||||
@Schema(description = "区域号", example = "17211")
|
||||
private String areaId;
|
||||
|
||||
@Schema(description = "操作")
|
||||
private String flag;
|
||||
|
||||
@Schema(description = "金额")
|
||||
private String charge;
|
||||
|
||||
@Schema(description = "预约订单号", example = "8375")
|
||||
private String bookOrderId;
|
||||
|
||||
@Schema(description = "入场时间")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private String[] inTime;
|
||||
|
||||
@Schema(description = "下发场库时间")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private String[] downTime;
|
||||
|
||||
@Schema(description = "订单下单时间")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private String[] bookOrderTime;
|
||||
|
||||
@Schema(description = "准入开始时间")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private String[] letInStartTime;
|
||||
|
||||
@Schema(description = "准入结束时间")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private String[] letInEndTime;
|
||||
|
||||
@Schema(description = "备注", example = "你猜")
|
||||
private String memo;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDateTime[] createTime;
|
||||
|
||||
}
|
@ -0,0 +1,80 @@
|
||||
package cn.iocoder.yudao.module.parking.controller.admin.bookcar.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 BookCarRespVO {
|
||||
|
||||
@Schema(description = "id", requiredMode = Schema.RequiredMode.REQUIRED, example = "23401")
|
||||
@ExcelProperty("id")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "场库编号", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("场库编号")
|
||||
private String parkNumber;
|
||||
|
||||
@Schema(description = "预约车牌号", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("预约车牌号")
|
||||
private String plate;
|
||||
|
||||
@Schema(description = "预约开始时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("预约开始时间")
|
||||
private String start;
|
||||
|
||||
@Schema(description = "预约结束时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("预约结束时间")
|
||||
private String end;
|
||||
|
||||
@Schema(description = "区域号", example = "17211")
|
||||
@ExcelProperty("区域号")
|
||||
private String areaId;
|
||||
|
||||
@Schema(description = "操作")
|
||||
@ExcelProperty("操作")
|
||||
private String flag;
|
||||
|
||||
@Schema(description = "金额")
|
||||
@ExcelProperty("金额")
|
||||
private String charge;
|
||||
|
||||
@Schema(description = "预约订单号", requiredMode = Schema.RequiredMode.REQUIRED, example = "8375")
|
||||
@ExcelProperty("预约订单号")
|
||||
private String bookOrderId;
|
||||
|
||||
@Schema(description = "入场时间")
|
||||
@ExcelProperty("入场时间")
|
||||
private String inTime;
|
||||
|
||||
@Schema(description = "下发场库时间")
|
||||
@ExcelProperty("下发场库时间")
|
||||
private String downTime;
|
||||
|
||||
@Schema(description = "订单下单时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("订单下单时间")
|
||||
private String bookOrderTime;
|
||||
|
||||
@Schema(description = "准入开始时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("准入开始时间")
|
||||
private String letInStartTime;
|
||||
|
||||
@Schema(description = "准入结束时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("准入结束时间")
|
||||
private String letInEndTime;
|
||||
|
||||
@Schema(description = "备注", example = "你猜")
|
||||
@ExcelProperty("备注")
|
||||
private String memo;
|
||||
|
||||
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("创建时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
}
|
@ -0,0 +1,65 @@
|
||||
package cn.iocoder.yudao.module.parking.controller.admin.bookcar.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 BookCarSaveReqVO {
|
||||
|
||||
@Schema(description = "id", requiredMode = Schema.RequiredMode.REQUIRED, example = "23401")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "场库编号", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotEmpty(message = "场库编号不能为空")
|
||||
private String parkNumber;
|
||||
|
||||
@Schema(description = "预约车牌号", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotEmpty(message = "预约车牌号不能为空")
|
||||
private String plate;
|
||||
|
||||
@Schema(description = "预约开始时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotEmpty(message = "预约开始时间不能为空")
|
||||
private String start;
|
||||
|
||||
@Schema(description = "预约结束时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotEmpty(message = "预约结束时间不能为空")
|
||||
private String end;
|
||||
|
||||
@Schema(description = "区域号", example = "17211")
|
||||
private String areaId;
|
||||
|
||||
@Schema(description = "操作")
|
||||
private String flag;
|
||||
|
||||
@Schema(description = "金额")
|
||||
private String charge;
|
||||
|
||||
@Schema(description = "预约订单号", requiredMode = Schema.RequiredMode.REQUIRED, example = "8375")
|
||||
@NotEmpty(message = "预约订单号不能为空")
|
||||
private String bookOrderId;
|
||||
|
||||
@Schema(description = "入场时间")
|
||||
private String inTime;
|
||||
|
||||
@Schema(description = "下发场库时间")
|
||||
private String downTime;
|
||||
|
||||
@Schema(description = "订单下单时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotEmpty(message = "订单下单时间不能为空")
|
||||
private String bookOrderTime;
|
||||
|
||||
@Schema(description = "准入开始时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotEmpty(message = "准入开始时间不能为空")
|
||||
private String letInStartTime;
|
||||
|
||||
@Schema(description = "准入结束时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotEmpty(message = "准入结束时间不能为空")
|
||||
private String letInEndTime;
|
||||
|
||||
@Schema(description = "备注", example = "你猜")
|
||||
private String memo;
|
||||
|
||||
}
|
@ -0,0 +1,87 @@
|
||||
package cn.iocoder.yudao.module.parking.dal.dataobject.bookcar;
|
||||
|
||||
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("book_car")
|
||||
@KeySequence("book_car_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class BookCarDO extends BaseDO {
|
||||
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
@TableId
|
||||
private Long id;
|
||||
/**
|
||||
* 场库编号
|
||||
*/
|
||||
private String parkNumber;
|
||||
/**
|
||||
* 预约车牌号
|
||||
*/
|
||||
private String plate;
|
||||
/**
|
||||
* 预约开始时间
|
||||
*/
|
||||
private String start;
|
||||
/**
|
||||
* 预约结束时间
|
||||
*/
|
||||
private String end;
|
||||
/**
|
||||
* 区域号
|
||||
*/
|
||||
private String areaId;
|
||||
/**
|
||||
* 操作
|
||||
*/
|
||||
private String flag;
|
||||
/**
|
||||
* 金额
|
||||
*/
|
||||
private String charge;
|
||||
/**
|
||||
* 预约订单号
|
||||
*/
|
||||
private String bookOrderId;
|
||||
/**
|
||||
* 入场时间
|
||||
*/
|
||||
private String inTime;
|
||||
/**
|
||||
* 下发场库时间
|
||||
*/
|
||||
private String downTime;
|
||||
/**
|
||||
* 订单下单时间
|
||||
*/
|
||||
private String bookOrderTime;
|
||||
/**
|
||||
* 准入开始时间
|
||||
*/
|
||||
private String letInStartTime;
|
||||
/**
|
||||
* 准入结束时间
|
||||
*/
|
||||
private String letInEndTime;
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String memo;
|
||||
|
||||
}
|
@ -0,0 +1,40 @@
|
||||
package cn.iocoder.yudao.module.parking.dal.mysql.bookcar;
|
||||
|
||||
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.bookcar.BookCarDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import cn.iocoder.yudao.module.parking.controller.admin.bookcar.vo.*;
|
||||
|
||||
/**
|
||||
* 预约车 Mapper
|
||||
*
|
||||
* @author 管理员
|
||||
*/
|
||||
@Mapper
|
||||
public interface BookCarMapper extends BaseMapperX<BookCarDO> {
|
||||
|
||||
default PageResult<BookCarDO> selectPage(BookCarPageReqVO reqVO) {
|
||||
return selectPage(reqVO, new LambdaQueryWrapperX<BookCarDO>()
|
||||
.eqIfPresent(BookCarDO::getParkNumber, reqVO.getParkNumber())
|
||||
.eqIfPresent(BookCarDO::getPlate, reqVO.getPlate())
|
||||
.eqIfPresent(BookCarDO::getStart, reqVO.getStart())
|
||||
.eqIfPresent(BookCarDO::getEnd, reqVO.getEnd())
|
||||
.eqIfPresent(BookCarDO::getAreaId, reqVO.getAreaId())
|
||||
.eqIfPresent(BookCarDO::getFlag, reqVO.getFlag())
|
||||
.eqIfPresent(BookCarDO::getCharge, reqVO.getCharge())
|
||||
.eqIfPresent(BookCarDO::getBookOrderId, reqVO.getBookOrderId())
|
||||
.betweenIfPresent(BookCarDO::getInTime, reqVO.getInTime())
|
||||
.betweenIfPresent(BookCarDO::getDownTime, reqVO.getDownTime())
|
||||
.betweenIfPresent(BookCarDO::getBookOrderTime, reqVO.getBookOrderTime())
|
||||
.betweenIfPresent(BookCarDO::getLetInStartTime, reqVO.getLetInStartTime())
|
||||
.betweenIfPresent(BookCarDO::getLetInEndTime, reqVO.getLetInEndTime())
|
||||
.eqIfPresent(BookCarDO::getMemo, reqVO.getMemo())
|
||||
.betweenIfPresent(BookCarDO::getCreateTime, reqVO.getCreateTime())
|
||||
.orderByDesc(BookCarDO::getId));
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,55 @@
|
||||
package cn.iocoder.yudao.module.parking.service.bookcar;
|
||||
|
||||
import java.util.*;
|
||||
import javax.validation.*;
|
||||
import cn.iocoder.yudao.module.parking.controller.admin.bookcar.vo.*;
|
||||
import cn.iocoder.yudao.module.parking.dal.dataobject.bookcar.BookCarDO;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
|
||||
/**
|
||||
* 预约车 Service 接口
|
||||
*
|
||||
* @author 管理员
|
||||
*/
|
||||
public interface BookCarService {
|
||||
|
||||
/**
|
||||
* 创建预约车
|
||||
*
|
||||
* @param createReqVO 创建信息
|
||||
* @return 编号
|
||||
*/
|
||||
Long createBookCar(@Valid BookCarSaveReqVO createReqVO);
|
||||
|
||||
/**
|
||||
* 更新预约车
|
||||
*
|
||||
* @param updateReqVO 更新信息
|
||||
*/
|
||||
void updateBookCar(@Valid BookCarSaveReqVO updateReqVO);
|
||||
|
||||
/**
|
||||
* 删除预约车
|
||||
*
|
||||
* @param id 编号
|
||||
*/
|
||||
void deleteBookCar(Long id);
|
||||
|
||||
/**
|
||||
* 获得预约车
|
||||
*
|
||||
* @param id 编号
|
||||
* @return 预约车
|
||||
*/
|
||||
BookCarDO getBookCar(Long id);
|
||||
|
||||
/**
|
||||
* 获得预约车分页
|
||||
*
|
||||
* @param pageReqVO 分页查询
|
||||
* @return 预约车分页
|
||||
*/
|
||||
PageResult<BookCarDO> getBookCarPage(BookCarPageReqVO pageReqVO);
|
||||
|
||||
}
|
@ -0,0 +1,74 @@
|
||||
package cn.iocoder.yudao.module.parking.service.bookcar;
|
||||
|
||||
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.bookcar.vo.*;
|
||||
import cn.iocoder.yudao.module.parking.dal.dataobject.bookcar.BookCarDO;
|
||||
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.bookcar.BookCarMapper;
|
||||
|
||||
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 BookCarServiceImpl implements BookCarService {
|
||||
|
||||
@Resource
|
||||
private BookCarMapper bookCarMapper;
|
||||
|
||||
@Override
|
||||
public Long createBookCar(BookCarSaveReqVO createReqVO) {
|
||||
// 插入
|
||||
BookCarDO bookCar = BeanUtils.toBean(createReqVO, BookCarDO.class);
|
||||
bookCarMapper.insert(bookCar);
|
||||
// 返回
|
||||
return bookCar.getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateBookCar(BookCarSaveReqVO updateReqVO) {
|
||||
// 校验存在
|
||||
validateBookCarExists(updateReqVO.getId());
|
||||
// 更新
|
||||
BookCarDO updateObj = BeanUtils.toBean(updateReqVO, BookCarDO.class);
|
||||
bookCarMapper.updateById(updateObj);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteBookCar(Long id) {
|
||||
// 校验存在
|
||||
validateBookCarExists(id);
|
||||
// 删除
|
||||
bookCarMapper.deleteById(id);
|
||||
}
|
||||
|
||||
private void validateBookCarExists(Long id) {
|
||||
if (bookCarMapper.selectById(id) == null) {
|
||||
throw exception(BOOK_CAR_NOT_EXISTS);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public BookCarDO getBookCar(Long id) {
|
||||
return bookCarMapper.selectById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResult<BookCarDO> getBookCarPage(BookCarPageReqVO pageReqVO) {
|
||||
return bookCarMapper.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.bookcar.BookCarMapper">
|
||||
|
||||
<!--
|
||||
一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
|
||||
无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
|
||||
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
|
||||
文档可见:https://www.iocoder.cn/MyBatis/x-plugins/
|
||||
-->
|
||||
|
||||
</mapper>
|
Loading…
Reference in New Issue
Block a user