停车场后台-通道修改

This commit is contained in:
XinWei 2024-08-19 11:46:19 +08:00
parent fb04836336
commit 3021ea045a
8 changed files with 43 additions and 26 deletions

View File

@ -38,16 +38,15 @@ public class PassagewayController {
@Resource
private PassagewayService passagewayService;
@PostMapping("/passagewayUpload")
public BlueCardResult passagewayUpload(@RequestBody PassagewayReqDataVO passagewayReqDataVO){
@PostMapping("/insertPassageway")
public BlueCardResult insertPassageway(@RequestBody PassagewayReqDataVO passagewayReqDataVO){
return passagewayService.passagewayUpload(passagewayReqDataVO);
}
@PostMapping("/create")
@Operation(summary = "创建通道信息")
@PreAuthorize("@ss.hasPermission('parking:passageway:create')")
public CommonResult<String> createPassageway(@Valid @RequestBody PassagewaySaveReqVO createReqVO) {
public CommonResult<Long> createPassageway(@Valid @RequestBody PassagewaySaveReqVO createReqVO) {
return success(passagewayService.createPassageway(createReqVO));
}
@ -63,7 +62,7 @@ public class PassagewayController {
@Operation(summary = "删除通道信息")
@Parameter(name = "id", description = "编号", required = true)
@PreAuthorize("@ss.hasPermission('parking:passageway:delete')")
public CommonResult<Boolean> deletePassageway(@RequestParam("id") String id) {
public CommonResult<Boolean> deletePassageway(@RequestParam("id") Long id) {
passagewayService.deletePassageway(id);
return success(true);
}
@ -72,7 +71,7 @@ public class PassagewayController {
@Operation(summary = "获得通道信息")
@Parameter(name = "id", description = "编号", required = true, example = "1024")
@PreAuthorize("@ss.hasPermission('parking:passageway:query')")
public CommonResult<PassagewayRespVO> getPassageway(@RequestParam("id") String id) {
public CommonResult<PassagewayRespVO> getPassageway(@RequestParam("id") Long id) {
PassagewayDO passageway = passagewayService.getPassageway(id);
return success(BeanUtils.toBean(passageway, PassagewayRespVO.class));
}

View File

@ -14,6 +14,8 @@ import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class PassagewayPageReqVO extends PageParam {
@Schema(description = "通道 Id", example = "4961")
private String passagewayId;
@Schema(description = "场库编号")
private String parkNumber;

View File

@ -12,6 +12,9 @@ import com.alibaba.excel.annotation.*;
@Data
@ExcelIgnoreUnannotated
public class PassagewayRespVO {
@Schema(description = "id", requiredMode = Schema.RequiredMode.REQUIRED, example = "9494")
@ExcelProperty("id")
private Long id;
@Schema(description = "通道 Id", requiredMode = Schema.RequiredMode.REQUIRED, example = "7099")
@ExcelProperty("通道 Id")

View File

@ -8,7 +8,8 @@ import javax.validation.constraints.*;
@Schema(description = "管理后台 - 通道信息新增/修改 Request VO")
@Data
public class PassagewaySaveReqVO {
@Schema(description = "id", requiredMode = Schema.RequiredMode.REQUIRED, example = "9494")
private Long id;
@Schema(description = "通道 Id", requiredMode = Schema.RequiredMode.REQUIRED, example = "7099")
private String passagewayId;

View File

@ -22,11 +22,6 @@ import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
@AllArgsConstructor
public class PassagewayDO extends BaseDO {
/**
* 通道 Id
*/
@TableId(type = IdType.INPUT)
private String passagewayId;
/**
* 场库编号
*/
@ -43,5 +38,14 @@ public class PassagewayDO extends BaseDO {
* 目标区域 Id
*/
private String targetAreaId;
/**
* id
*/
@TableId
private Long id;
/**
* 通道 Id
*/
private String passagewayId;
}

View File

@ -6,8 +6,10 @@ 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.passageway.PassagewayDO;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.parking.controller.admin.passageway.vo.*;
import org.apache.ibatis.annotations.Param;
/**
* 通道信息 Mapper
@ -24,7 +26,10 @@ public interface PassagewayMapper extends BaseMapperX<PassagewayDO> {
.eqIfPresent(PassagewayDO::getSourceAreaId, reqVO.getSourceAreaId())
.eqIfPresent(PassagewayDO::getTargetAreaId, reqVO.getTargetAreaId())
.betweenIfPresent(PassagewayDO::getCreateTime, reqVO.getCreateTime())
.orderByDesc(PassagewayDO::getPassagewayId));
.eqIfPresent(PassagewayDO::getPassagewayId, reqVO.getPassagewayId())
.orderByDesc(PassagewayDO::getId));
}
@Delete("DELETE FROM `passageway` WHERE `park_number` = #{parkNumber}")
int physicalDeleteByParkNumber(@Param("parkNumber") String parkNumber);
}

View File

@ -21,7 +21,7 @@ public interface PassagewayService {
* @param createReqVO 创建信息
* @return 编号
*/
String createPassageway(@Valid PassagewaySaveReqVO createReqVO);
Long createPassageway(@Valid PassagewaySaveReqVO createReqVO);
/**
* 更新通道信息
@ -35,7 +35,7 @@ public interface PassagewayService {
*
* @param id 编号
*/
void deletePassageway(String id);
void deletePassageway(Long id);
/**
* 获得通道信息
@ -43,7 +43,7 @@ public interface PassagewayService {
* @param id 编号
* @return 通道信息
*/
PassagewayDO getPassageway(String id);
PassagewayDO getPassageway(Long id);
/**
* 获得通道信息分页

View File

@ -31,39 +31,39 @@ public class PassagewayServiceImpl implements PassagewayService {
private PassagewayMapper passagewayMapper;
@Override
public String createPassageway(PassagewaySaveReqVO createReqVO) {
public Long createPassageway(PassagewaySaveReqVO createReqVO) {
// 插入
PassagewayDO passageway = BeanUtils.toBean(createReqVO, PassagewayDO.class);
passagewayMapper.insert(passageway);
// 返回
return passageway.getPassagewayId();
return passageway.getId();
}
@Override
public void updatePassageway(PassagewaySaveReqVO updateReqVO) {
// 校验存在
validatePassagewayExists(updateReqVO.getPassagewayId());
validatePassagewayExists(updateReqVO.getId());
// 更新
PassagewayDO updateObj = BeanUtils.toBean(updateReqVO, PassagewayDO.class);
passagewayMapper.updateById(updateObj);
}
@Override
public void deletePassageway(String id) {
public void deletePassageway(Long id) {
// 校验存在
validatePassagewayExists(id);
// 删除
passagewayMapper.deleteById(id);
}
private void validatePassagewayExists(String id) {
private void validatePassagewayExists(Long id) {
if (passagewayMapper.selectById(id) == null) {
throw exception(PASSAGEWAY_NOT_EXISTS);
}
}
@Override
public PassagewayDO getPassageway(String id) {
public PassagewayDO getPassageway(Long id) {
return passagewayMapper.selectById(id);
}
@ -75,7 +75,10 @@ public class PassagewayServiceImpl implements PassagewayService {
@Override
public BlueCardResult passagewayUpload(PassagewayReqDataVO passagewayReqDataVO) {
List<PassagewaySaveReqVO> passagewaySaveReqVOList = passagewayReqDataVO.getDatas();
// TODO 判断重复覆盖
// 先物理删除对应场库编号的通道信息
passagewayMapper.physicalDeleteByParkNumber(passagewayReqDataVO.getParkNumber());
// 批量插入数据
passagewayMapper.insertBatch(BeanUtils.toBean(passagewaySaveReqVOList, PassagewayDO.class));
return null;
}