Parcourir la source

科室信息维护——删除

wangyu il y a 6 ans
Parent
commit
1eb5083206

+ 46 - 1
icssman-service/src/main/java/com/diagbot/facade/DeptInfoFacade.java

@@ -1,11 +1,15 @@
 package com.diagbot.facade;
 
 import com.diagbot.entity.DeptInfo;
+import com.diagbot.enums.IsDeleteEnum;
+import com.diagbot.exception.CommonErrorCode;
+import com.diagbot.exception.CommonException;
 import com.diagbot.service.impl.DeptInfoServiceImpl;
 import com.diagbot.util.BeanUtil;
 import com.diagbot.util.DateUtil;
 import com.diagbot.util.UserUtils;
 import com.diagbot.vo.AddDeptInfoVO;
+import com.diagbot.vo.UpdateDeptInfoVO;
 import org.springframework.stereotype.Component;
 
 /**
@@ -17,7 +21,7 @@ import org.springframework.stereotype.Component;
 public class DeptInfoFacade extends DeptInfoServiceImpl {
 
     /**
-     * 添加科室信息(本地)
+     * 添加科室信息
      * @param addDeptInfoVO
      * @return
      */
@@ -27,6 +31,47 @@ public class DeptInfoFacade extends DeptInfoServiceImpl {
         deptInfo.setCreator(UserUtils.getCurrentPrincipleID());
         deptInfo.setGmtCreate(DateUtil.now());
         Boolean flag = this.save(deptInfo);
+        if(!flag){
+            throw new CommonException(CommonErrorCode.FAIL,
+                    "科室信息添加失败");
+        }
+        return flag;
+    }
+
+    /**
+     * 修改科室信息
+     * @param updateDeptInfoVO
+     * @return
+     */
+    public Boolean updateDeptInfo(UpdateDeptInfoVO updateDeptInfoVO) {
+        DeptInfo deptInfo =new DeptInfo();
+        BeanUtil.copyProperties(updateDeptInfoVO,deptInfo);
+        deptInfo.setModifier(UserUtils.getCurrentPrincipleID());
+        deptInfo.setGmtModified(DateUtil.now());
+        Boolean flag = this.updateById(deptInfo);
+        if(!flag){
+            throw new CommonException(CommonErrorCode.FAIL,
+                    "科室信息修改失败");
+        }
+        return flag;
+    }
+
+    /**
+     * 删除科室信息
+     * @param updateDeptInfoVO
+     * @return
+     */
+    public Boolean deleteDeptInfo(UpdateDeptInfoVO updateDeptInfoVO) {
+        DeptInfo deptInfo =new DeptInfo();
+        BeanUtil.copyProperties(updateDeptInfoVO,deptInfo);
+        deptInfo.setModifier(UserUtils.getCurrentPrincipleID());
+        deptInfo.setIsDeleted(IsDeleteEnum.Y.getKey());
+        deptInfo.setGmtModified(DateUtil.now());
+        Boolean flag = this.updateById(deptInfo);
+        if(!flag){
+            throw new CommonException(CommonErrorCode.FAIL,
+                    "科室信息删除失败");
+        }
         return flag;
     }
 

+ 5 - 0
icssman-service/src/main/java/com/diagbot/facade/QuestionUsualFacade.java

@@ -81,6 +81,11 @@ public class QuestionUsualFacade extends QuestionUsualServiceImpl {
         return flag;
     }
 
+    /**
+     * 删除常用标签
+     * @param updateQuetionUsualVO
+     * @return
+     */
     public Boolean deleteQuestionUsual(UpdateQuetionUsualVO updateQuetionUsualVO){
         QuestionUsual questionUsual =new QuestionUsual();
         BeanUtil.copyProperties(updateQuetionUsualVO,questionUsual);

+ 18 - 0
icssman-service/src/main/java/com/diagbot/vo/DeleteDeptInfoVO.java

@@ -0,0 +1,18 @@
+package com.diagbot.vo;
+
+import lombok.Getter;
+import lombok.Setter;
+
+import javax.validation.constraints.NotBlank;
+
+/**
+ * @Description:
+ * @author: wangyu
+ * @time: 2018/12/5 16:27
+ */
+@Getter
+@Setter
+public class DeleteDeptInfoVO {
+    @NotBlank(message = "请输入id")
+    private Long id;
+}

+ 20 - 0
icssman-service/src/main/java/com/diagbot/vo/UpdateDeptInfoVO.java

@@ -0,0 +1,20 @@
+package com.diagbot.vo;
+
+import lombok.Getter;
+import lombok.Setter;
+
+import javax.validation.constraints.NotBlank;
+
+/**
+ * @Description: 修改科室信息入参
+ * @author: wangyu
+ * @time: 2018/12/5 16:17
+ */
+@Getter
+@Setter
+public class UpdateDeptInfoVO {
+    @NotBlank(message = "请输入id")
+    private Long id;
+    @NotBlank(message = "请输入科室名称")
+    private String name;
+}

+ 22 - 0
icssman-service/src/main/java/com/diagbot/web/DeptInfoController.java

@@ -5,6 +5,7 @@ import com.diagbot.annotation.SysLogger;
 import com.diagbot.dto.RespDTO;
 import com.diagbot.facade.DeptInfoFacade;
 import com.diagbot.vo.AddDeptInfoVO;
+import com.diagbot.vo.UpdateDeptInfoVO;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -40,4 +41,25 @@ public class DeptInfoController {
         Boolean data = deptInfoFacade.addDeptInfo(addDeptInfoVO);
         return RespDTO.onSuc(data);
     }
+
+    @ApiOperation(value = "科室维护——修改[by:wangyu]",
+            notes = "name: 科室名称,必填<br>" +
+                    "id: 科室id,必填")
+    @PostMapping("/updateDeptInfo")
+    @SysLogger("updateDeptInfo")
+    @Transactional
+    public RespDTO<Boolean> updateDeptInfo(@RequestBody UpdateDeptInfoVO updateDeptInfoVO) {
+        Boolean data = deptInfoFacade.updateDeptInfo(updateDeptInfoVO);
+        return RespDTO.onSuc(data);
+    }
+
+    @ApiOperation(value = "科室维护——删除[by:wangyu]",
+            notes = "id: 科室id,必填<br>")
+    @PostMapping("/deleteDeptInfo")
+    @SysLogger("deleteDeptInfo")
+    @Transactional
+    public RespDTO<Boolean> deleteDeptInfo(@RequestBody UpdateDeptInfoVO updateDeptInfoVO) {
+        Boolean data = deptInfoFacade.deleteDeptInfo(updateDeptInfoVO);
+        return RespDTO.onSuc(data);
+    }
 }