mirror of
http://192.168.1.205:9980/cf_devdept2/cf_imes_server.git
synced 2026-08-15 06:02:06 +08:00
板材接口修改
This commit is contained in:
+7
-3
@@ -59,10 +59,14 @@ public class PlateController {
|
|||||||
|
|
||||||
@DeleteMapping("/delete")
|
@DeleteMapping("/delete")
|
||||||
@Operation(summary = "删除板材信息表 plate_{N}")
|
@Operation(summary = "删除板材信息表 plate_{N}")
|
||||||
@Parameter(name = "id", description = "编号", required = true)
|
@Parameters({
|
||||||
|
@Parameter(name = "id", description = "编号", required = true),
|
||||||
|
@Parameter(name = "organId", description = "板材所属组织ID")
|
||||||
|
})
|
||||||
@PreAuthorize("@ss.hasPermission('manage:plate:delete')")
|
@PreAuthorize("@ss.hasPermission('manage:plate:delete')")
|
||||||
public CommonResult<Boolean> deletePlate(@RequestParam("id") Long id) {
|
public CommonResult<Boolean> deletePlate(@RequestParam("id") Long id,
|
||||||
plateService.deletePlate(id);
|
@RequestParam(value = "organId",required = false) Long organId) {
|
||||||
|
plateService.deletePlate(id,organId);
|
||||||
return success(true);
|
return success(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -38,7 +38,7 @@ public interface PlateService {
|
|||||||
*
|
*
|
||||||
* @param id 编号
|
* @param id 编号
|
||||||
*/
|
*/
|
||||||
void deletePlate(Long id);
|
void deletePlate(Long id,Long organId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获得板材信息表 plate_{N}
|
* 获得板材信息表 plate_{N}
|
||||||
|
|||||||
+15
-7
@@ -58,23 +58,31 @@ public class PlateServiceImpl implements PlateService {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updatePlate(PlateSaveReqVO updateReqVO) {
|
public void updatePlate(PlateSaveReqVO updateReqVO) {
|
||||||
// 校验存在
|
|
||||||
validatePlateExists(updateReqVO.getId());
|
|
||||||
// 更新 判断是否有组织id
|
// 更新 判断是否有组织id
|
||||||
|
if (updateReqVO.getOrganId() == null || updateReqVO.getOrganId() == 0){
|
||||||
|
updateReqVO.setOrganId(OrganContextHolder.getOrganId());
|
||||||
|
}else {
|
||||||
|
validateOrganExists(updateReqVO.getOrganId());
|
||||||
|
}
|
||||||
|
// 校验存在
|
||||||
|
validatePlateExists(updateReqVO.getId(), updateReqVO.getOrganId());
|
||||||
PlateDO updateObj = BeanUtils.toBean(updateReqVO, PlateDO.class);
|
PlateDO updateObj = BeanUtils.toBean(updateReqVO, PlateDO.class);
|
||||||
plateMapper.updateById(updateObj);
|
plateMapper.updateById(updateObj);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void deletePlate(Long id) {
|
public void deletePlate(Long id,Long organId) {
|
||||||
|
if (organId == null || organId == 0){
|
||||||
|
organId = OrganContextHolder.getOrganId();
|
||||||
|
}
|
||||||
// 校验存在
|
// 校验存在
|
||||||
validatePlateExists(id);
|
validatePlateExists(id,organId);
|
||||||
// 删除
|
// 删除
|
||||||
plateMapper.deleteById(id);
|
plateMapper.deleteById(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void validatePlateExists(Long id) {
|
private void validatePlateExists(Long id,Long organId) {
|
||||||
if (plateMapper.selectById(id) == null) {
|
if (plateMapper.selectOneById(id,organId) == null) {
|
||||||
throw exception(PLATE_NOT_EXISTS);
|
throw exception(PLATE_NOT_EXISTS);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -139,7 +147,7 @@ public class PlateServiceImpl implements PlateService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 当前组织中板材是否存在
|
// 当前组织中板材是否存在
|
||||||
private void validateGoodExists(String goodsId ,Long organId) {
|
private void validateGoodExists(String goodsId ,Long organId) {
|
||||||
if (plateMapper.selectByGoodID(goodsId ,organId) != null){
|
if (plateMapper.selectByGoodID(goodsId ,organId) != null){
|
||||||
throw exception(ErrorCodeConstants.PLATE_EXISTS);
|
throw exception(ErrorCodeConstants.PLATE_EXISTS);
|
||||||
|
|||||||
Reference in New Issue
Block a user