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