update 区域管理表- 删除接口

This commit is contained in:
lijiarao
2023-08-21 14:45:44 +08:00
parent f662149c2b
commit e5146b61a9
@@ -14,6 +14,8 @@ import com.jero.modules.tag.service.ILawsTagService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.apache.ibatis.annotations.Results;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
@@ -150,26 +152,26 @@ public class LawsAreaController extends JeroController<LawsArea, ILawsAreaServic
/**
* 通过id删除
*
* @param id
* @return
*/
@AutoLog(value = "区域管理表-通过id删除")
@ApiOperation(value="区域管理表-通过id删除", notes="区域管理表-通过id删除")
@GetMapping(value = "/delete")
@RequiresPermissions("area:delete")
public Result<?> delete(@RequestParam(name="id",required=true) String id,
@RequestParam(name="cut",required=true) String cut) {
public Result<?> delete(@RequestBody Map<String, String> map) {
if(!map.containsKey("id") || StringUtils.isEmpty(map.get("id"))){
return Result.error("请选择数据!");
}
String id = map.get("id");
LawsArea lawsArea = lawsAreaService.queryById(id);
int count= lawsTagService.queryExitArea(lawsArea);
if (count > 0) {
//中英切换提示语
// TODO 只改一半?编辑和新增改了,删除不改?
if(LanguageEnum.CN.getValue().equals(cut)) {
//if(LanguageEnum.CN.getValue().equals(cut)) {
return Result.error("该展示区域有关联数据,无法删除!");
}else{
return Result.error("This exhibition area has associated data and cannot be deleted!");
}
//}else{
// return Result.error("This exhibition area has associated data and cannot be deleted!");
//}
}else {
lawsAreaService.deleteById(id);
return Result.OK("删除成功!");
@@ -179,15 +181,15 @@ public class LawsAreaController extends JeroController<LawsArea, ILawsAreaServic
/**
* 批量删除
*
* @param ids
* @return
*/
@AutoLog(value = "区域管理表-批量删除")
@ApiOperation(value="区域管理表-批量删除", notes="区域管理表-批量删除")
@GetMapping(value = "/deleteBatch")
public Result<?> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
this.lawsAreaService.deleteByIds(Arrays.asList(ids.split(",")));
public Result<?> deleteBatch(@RequestBody Map<String, String> map) {
if(!map.containsKey("ids") || StringUtils.isEmpty(map.get("ids"))){
return Result.error("请选择数据!");
}
this.lawsAreaService.deleteByIds(Arrays.asList(map.get("ids").split(",")));
return Result.OK("批量删除成功!");
}