停车场后台-通道修改
This commit is contained in:
parent
fb04836336
commit
3021ea045a
@ -38,16 +38,15 @@ public class PassagewayController {
|
|||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private PassagewayService passagewayService;
|
private PassagewayService passagewayService;
|
||||||
@PostMapping("/passagewayUpload")
|
|
||||||
public BlueCardResult passagewayUpload(@RequestBody PassagewayReqDataVO passagewayReqDataVO){
|
@PostMapping("/insertPassageway")
|
||||||
|
public BlueCardResult insertPassageway(@RequestBody PassagewayReqDataVO passagewayReqDataVO){
|
||||||
return passagewayService.passagewayUpload(passagewayReqDataVO);
|
return passagewayService.passagewayUpload(passagewayReqDataVO);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@PostMapping("/create")
|
@PostMapping("/create")
|
||||||
@Operation(summary = "创建通道信息")
|
@Operation(summary = "创建通道信息")
|
||||||
@PreAuthorize("@ss.hasPermission('parking:passageway:create')")
|
@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));
|
return success(passagewayService.createPassageway(createReqVO));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -63,7 +62,7 @@ public class PassagewayController {
|
|||||||
@Operation(summary = "删除通道信息")
|
@Operation(summary = "删除通道信息")
|
||||||
@Parameter(name = "id", description = "编号", required = true)
|
@Parameter(name = "id", description = "编号", required = true)
|
||||||
@PreAuthorize("@ss.hasPermission('parking:passageway:delete')")
|
@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);
|
passagewayService.deletePassageway(id);
|
||||||
return success(true);
|
return success(true);
|
||||||
}
|
}
|
||||||
@ -72,7 +71,7 @@ public class PassagewayController {
|
|||||||
@Operation(summary = "获得通道信息")
|
@Operation(summary = "获得通道信息")
|
||||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||||
@PreAuthorize("@ss.hasPermission('parking:passageway:query')")
|
@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);
|
PassagewayDO passageway = passagewayService.getPassageway(id);
|
||||||
return success(BeanUtils.toBean(passageway, PassagewayRespVO.class));
|
return success(BeanUtils.toBean(passageway, PassagewayRespVO.class));
|
||||||
}
|
}
|
||||||
@ -90,12 +89,12 @@ public class PassagewayController {
|
|||||||
@PreAuthorize("@ss.hasPermission('parking:passageway:export')")
|
@PreAuthorize("@ss.hasPermission('parking:passageway:export')")
|
||||||
@ApiAccessLog(operateType = EXPORT)
|
@ApiAccessLog(operateType = EXPORT)
|
||||||
public void exportPassagewayExcel(@Valid PassagewayPageReqVO pageReqVO,
|
public void exportPassagewayExcel(@Valid PassagewayPageReqVO pageReqVO,
|
||||||
HttpServletResponse response) throws IOException {
|
HttpServletResponse response) throws IOException {
|
||||||
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
||||||
List<PassagewayDO> list = passagewayService.getPassagewayPage(pageReqVO).getList();
|
List<PassagewayDO> list = passagewayService.getPassagewayPage(pageReqVO).getList();
|
||||||
// 导出 Excel
|
// 导出 Excel
|
||||||
ExcelUtils.write(response, "通道信息.xls", "数据", PassagewayRespVO.class,
|
ExcelUtils.write(response, "通道信息.xls", "数据", PassagewayRespVO.class,
|
||||||
BeanUtils.toBean(list, PassagewayRespVO.class));
|
BeanUtils.toBean(list, PassagewayRespVO.class));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -14,6 +14,8 @@ import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_
|
|||||||
@EqualsAndHashCode(callSuper = true)
|
@EqualsAndHashCode(callSuper = true)
|
||||||
@ToString(callSuper = true)
|
@ToString(callSuper = true)
|
||||||
public class PassagewayPageReqVO extends PageParam {
|
public class PassagewayPageReqVO extends PageParam {
|
||||||
|
@Schema(description = "通道 Id", example = "4961")
|
||||||
|
private String passagewayId;
|
||||||
|
|
||||||
@Schema(description = "场库编号")
|
@Schema(description = "场库编号")
|
||||||
private String parkNumber;
|
private String parkNumber;
|
||||||
|
@ -12,6 +12,9 @@ import com.alibaba.excel.annotation.*;
|
|||||||
@Data
|
@Data
|
||||||
@ExcelIgnoreUnannotated
|
@ExcelIgnoreUnannotated
|
||||||
public class PassagewayRespVO {
|
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")
|
@Schema(description = "通道 Id", requiredMode = Schema.RequiredMode.REQUIRED, example = "7099")
|
||||||
@ExcelProperty("通道 Id")
|
@ExcelProperty("通道 Id")
|
||||||
|
@ -8,7 +8,8 @@ import javax.validation.constraints.*;
|
|||||||
@Schema(description = "管理后台 - 通道信息新增/修改 Request VO")
|
@Schema(description = "管理后台 - 通道信息新增/修改 Request VO")
|
||||||
@Data
|
@Data
|
||||||
public class PassagewaySaveReqVO {
|
public class PassagewaySaveReqVO {
|
||||||
|
@Schema(description = "id", requiredMode = Schema.RequiredMode.REQUIRED, example = "9494")
|
||||||
|
private Long id;
|
||||||
@Schema(description = "通道 Id", requiredMode = Schema.RequiredMode.REQUIRED, example = "7099")
|
@Schema(description = "通道 Id", requiredMode = Schema.RequiredMode.REQUIRED, example = "7099")
|
||||||
private String passagewayId;
|
private String passagewayId;
|
||||||
|
|
||||||
|
@ -22,11 +22,6 @@ import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
|||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
public class PassagewayDO extends BaseDO {
|
public class PassagewayDO extends BaseDO {
|
||||||
|
|
||||||
/**
|
|
||||||
* 通道 Id
|
|
||||||
*/
|
|
||||||
@TableId(type = IdType.INPUT)
|
|
||||||
private String passagewayId;
|
|
||||||
/**
|
/**
|
||||||
* 场库编号
|
* 场库编号
|
||||||
*/
|
*/
|
||||||
@ -43,5 +38,14 @@ public class PassagewayDO extends BaseDO {
|
|||||||
* 目标区域 Id
|
* 目标区域 Id
|
||||||
*/
|
*/
|
||||||
private String targetAreaId;
|
private String targetAreaId;
|
||||||
|
/**
|
||||||
|
* id
|
||||||
|
*/
|
||||||
|
@TableId
|
||||||
|
private Long id;
|
||||||
|
/**
|
||||||
|
* 通道 Id
|
||||||
|
*/
|
||||||
|
private String passagewayId;
|
||||||
|
|
||||||
}
|
}
|
@ -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.query.LambdaQueryWrapperX;
|
||||||
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
||||||
import cn.iocoder.yudao.module.parking.dal.dataobject.passageway.PassagewayDO;
|
import cn.iocoder.yudao.module.parking.dal.dataobject.passageway.PassagewayDO;
|
||||||
|
import org.apache.ibatis.annotations.Delete;
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
import cn.iocoder.yudao.module.parking.controller.admin.passageway.vo.*;
|
import cn.iocoder.yudao.module.parking.controller.admin.passageway.vo.*;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 通道信息 Mapper
|
* 通道信息 Mapper
|
||||||
@ -24,7 +26,10 @@ public interface PassagewayMapper extends BaseMapperX<PassagewayDO> {
|
|||||||
.eqIfPresent(PassagewayDO::getSourceAreaId, reqVO.getSourceAreaId())
|
.eqIfPresent(PassagewayDO::getSourceAreaId, reqVO.getSourceAreaId())
|
||||||
.eqIfPresent(PassagewayDO::getTargetAreaId, reqVO.getTargetAreaId())
|
.eqIfPresent(PassagewayDO::getTargetAreaId, reqVO.getTargetAreaId())
|
||||||
.betweenIfPresent(PassagewayDO::getCreateTime, reqVO.getCreateTime())
|
.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);
|
||||||
}
|
}
|
@ -21,7 +21,7 @@ public interface PassagewayService {
|
|||||||
* @param createReqVO 创建信息
|
* @param createReqVO 创建信息
|
||||||
* @return 编号
|
* @return 编号
|
||||||
*/
|
*/
|
||||||
String createPassageway(@Valid PassagewaySaveReqVO createReqVO);
|
Long createPassageway(@Valid PassagewaySaveReqVO createReqVO);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 更新通道信息
|
* 更新通道信息
|
||||||
@ -35,7 +35,7 @@ public interface PassagewayService {
|
|||||||
*
|
*
|
||||||
* @param id 编号
|
* @param id 编号
|
||||||
*/
|
*/
|
||||||
void deletePassageway(String id);
|
void deletePassageway(Long id);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获得通道信息
|
* 获得通道信息
|
||||||
@ -43,7 +43,7 @@ public interface PassagewayService {
|
|||||||
* @param id 编号
|
* @param id 编号
|
||||||
* @return 通道信息
|
* @return 通道信息
|
||||||
*/
|
*/
|
||||||
PassagewayDO getPassageway(String id);
|
PassagewayDO getPassageway(Long id);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获得通道信息分页
|
* 获得通道信息分页
|
||||||
|
@ -31,39 +31,39 @@ public class PassagewayServiceImpl implements PassagewayService {
|
|||||||
private PassagewayMapper passagewayMapper;
|
private PassagewayMapper passagewayMapper;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String createPassageway(PassagewaySaveReqVO createReqVO) {
|
public Long createPassageway(PassagewaySaveReqVO createReqVO) {
|
||||||
// 插入
|
// 插入
|
||||||
PassagewayDO passageway = BeanUtils.toBean(createReqVO, PassagewayDO.class);
|
PassagewayDO passageway = BeanUtils.toBean(createReqVO, PassagewayDO.class);
|
||||||
passagewayMapper.insert(passageway);
|
passagewayMapper.insert(passageway);
|
||||||
// 返回
|
// 返回
|
||||||
return passageway.getPassagewayId();
|
return passageway.getId();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updatePassageway(PassagewaySaveReqVO updateReqVO) {
|
public void updatePassageway(PassagewaySaveReqVO updateReqVO) {
|
||||||
// 校验存在
|
// 校验存在
|
||||||
validatePassagewayExists(updateReqVO.getPassagewayId());
|
validatePassagewayExists(updateReqVO.getId());
|
||||||
// 更新
|
// 更新
|
||||||
PassagewayDO updateObj = BeanUtils.toBean(updateReqVO, PassagewayDO.class);
|
PassagewayDO updateObj = BeanUtils.toBean(updateReqVO, PassagewayDO.class);
|
||||||
passagewayMapper.updateById(updateObj);
|
passagewayMapper.updateById(updateObj);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void deletePassageway(String id) {
|
public void deletePassageway(Long id) {
|
||||||
// 校验存在
|
// 校验存在
|
||||||
validatePassagewayExists(id);
|
validatePassagewayExists(id);
|
||||||
// 删除
|
// 删除
|
||||||
passagewayMapper.deleteById(id);
|
passagewayMapper.deleteById(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void validatePassagewayExists(String id) {
|
private void validatePassagewayExists(Long id) {
|
||||||
if (passagewayMapper.selectById(id) == null) {
|
if (passagewayMapper.selectById(id) == null) {
|
||||||
throw exception(PASSAGEWAY_NOT_EXISTS);
|
throw exception(PASSAGEWAY_NOT_EXISTS);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PassagewayDO getPassageway(String id) {
|
public PassagewayDO getPassageway(Long id) {
|
||||||
return passagewayMapper.selectById(id);
|
return passagewayMapper.selectById(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -75,7 +75,10 @@ public class PassagewayServiceImpl implements PassagewayService {
|
|||||||
@Override
|
@Override
|
||||||
public BlueCardResult passagewayUpload(PassagewayReqDataVO passagewayReqDataVO) {
|
public BlueCardResult passagewayUpload(PassagewayReqDataVO passagewayReqDataVO) {
|
||||||
List<PassagewaySaveReqVO> passagewaySaveReqVOList = passagewayReqDataVO.getDatas();
|
List<PassagewaySaveReqVO> passagewaySaveReqVOList = passagewayReqDataVO.getDatas();
|
||||||
// TODO 判断重复覆盖
|
// 先物理删除对应场库编号的通道信息
|
||||||
|
passagewayMapper.physicalDeleteByParkNumber(passagewayReqDataVO.getParkNumber());
|
||||||
|
// 批量插入数据
|
||||||
|
passagewayMapper.insertBatch(BeanUtils.toBean(passagewaySaveReqVOList, PassagewayDO.class));
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user