diff --git a/cs-system/cs-system-api/src/main/java/com/njcn/cssystem/enums/CsSystemResponseEnum.java b/cs-system/cs-system-api/src/main/java/com/njcn/cssystem/enums/CsSystemResponseEnum.java index d50d966..ccb6491 100644 --- a/cs-system/cs-system-api/src/main/java/com/njcn/cssystem/enums/CsSystemResponseEnum.java +++ b/cs-system/cs-system-api/src/main/java/com/njcn/cssystem/enums/CsSystemResponseEnum.java @@ -15,9 +15,11 @@ public enum CsSystemResponseEnum { *

*/ DICT_REPEAT("A0301","字典数据重复!"), + SAME_DATA_ERROR("A0301","数据重复"), CS_SYSTEM_COMMON_ERROR("A00302","治理系统模块异常"), + ; private final String code; diff --git a/cs-system/cs-system-api/src/main/java/com/njcn/cssystem/pojo/param/ElementParam.java b/cs-system/cs-system-api/src/main/java/com/njcn/cssystem/pojo/param/ElementParam.java index 7d38e52..8845903 100644 --- a/cs-system/cs-system-api/src/main/java/com/njcn/cssystem/pojo/param/ElementParam.java +++ b/cs-system/cs-system-api/src/main/java/com/njcn/cssystem/pojo/param/ElementParam.java @@ -38,4 +38,8 @@ public class ElementParam { @NotNull(message="图元文件不能为空!") private MultipartFile multipartFile; + @ApiModelProperty(value = "图元类型") + @NotBlank(message="图元类型不能为空!") + private String elementForm; + } diff --git a/cs-system/cs-system-api/src/main/java/com/njcn/cssystem/pojo/po/CsElement.java b/cs-system/cs-system-api/src/main/java/com/njcn/cssystem/pojo/po/CsElement.java index 4bb898c..dbee247 100644 --- a/cs-system/cs-system-api/src/main/java/com/njcn/cssystem/pojo/po/CsElement.java +++ b/cs-system/cs-system-api/src/main/java/com/njcn/cssystem/pojo/po/CsElement.java @@ -58,5 +58,10 @@ public class CsElement extends BaseEntity { */ private Integer status; + /** + * 图元类型 + */ + private String elementForm; + } diff --git a/cs-system/cs-system-boot/src/main/java/com/njcn/cssystem/controller/zutai/ElementController.java b/cs-system/cs-system-boot/src/main/java/com/njcn/cssystem/controller/zutai/ElementController.java index c9353cc..4d13c2e 100644 --- a/cs-system/cs-system-boot/src/main/java/com/njcn/cssystem/controller/zutai/ElementController.java +++ b/cs-system/cs-system-boot/src/main/java/com/njcn/cssystem/controller/zutai/ElementController.java @@ -10,11 +10,13 @@ import com.njcn.cssystem.pojo.po.CsElement; import com.njcn.cssystem.service.IElementService; import com.njcn.web.controller.BaseController; import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiOperation; import lombok.AllArgsConstructor; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; import java.util.List; @@ -36,7 +38,7 @@ public class ElementController extends BaseController { @OperateInfo(info = LogEnum.BUSINESS_COMMON) @PostMapping("/add") - @ApiOperation("组态图元新增") + @ApiOperation("新增图元") public HttpResult add(@Validated ElementParam param){ String methodDescribe = getMethodDescribe("add"); CsElement csElement = csElementService.addElement(param); @@ -45,11 +47,21 @@ public class ElementController extends BaseController { @OperateInfo(info = LogEnum.BUSINESS_COMMON) @PostMapping("/find") - @ApiOperation("查询组态图元数据") + @ApiOperation("查询图元") public HttpResult> find(){ String methodDescribe = getMethodDescribe("find"); List list = csElementService.findElement(); return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe); } + @OperateInfo(info = LogEnum.BUSINESS_COMMON) + @PostMapping("/delete") + @ApiOperation("删除图元") + @ApiImplicitParam(name = "id", value = "图元Id", required = true) + public HttpResult deleteById(@RequestParam("id") String id){ + String methodDescribe = getMethodDescribe("deleteById"); + csElementService.deleteById(id); + return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe); + } + } diff --git a/cs-system/cs-system-boot/src/main/java/com/njcn/cssystem/service/IElementService.java b/cs-system/cs-system-boot/src/main/java/com/njcn/cssystem/service/IElementService.java index e6e3112..4318bac 100644 --- a/cs-system/cs-system-boot/src/main/java/com/njcn/cssystem/service/IElementService.java +++ b/cs-system/cs-system-boot/src/main/java/com/njcn/cssystem/service/IElementService.java @@ -27,4 +27,9 @@ public interface IElementService extends IService { */ List findElement(); + /** + * 组态图元数据查询 + */ + void deleteById(String id); + } diff --git a/cs-system/cs-system-boot/src/main/java/com/njcn/cssystem/service/impl/CsElementServiceImpl.java b/cs-system/cs-system-boot/src/main/java/com/njcn/cssystem/service/impl/CsElementServiceImpl.java index 073cb6d..4c3d66b 100644 --- a/cs-system/cs-system-boot/src/main/java/com/njcn/cssystem/service/impl/CsElementServiceImpl.java +++ b/cs-system/cs-system-boot/src/main/java/com/njcn/cssystem/service/impl/CsElementServiceImpl.java @@ -1,6 +1,8 @@ package com.njcn.cssystem.service.impl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.njcn.common.pojo.exception.BusinessException; +import com.njcn.cssystem.enums.CsSystemResponseEnum; import com.njcn.cssystem.mapper.CsElementMapper; import com.njcn.cssystem.pojo.param.ElementParam; import com.njcn.cssystem.pojo.po.CsElement; @@ -12,6 +14,7 @@ import org.springframework.beans.BeanUtils; import org.springframework.stereotype.Service; import java.util.List; +import java.util.Objects; /** *

@@ -29,6 +32,13 @@ public class CsElementServiceImpl extends ServiceImpl