Browse Source

科室信息维护——添加(本地)

wangyu 6 years ago
parent
commit
15819dfd58

+ 19 - 0
icssman-service/src/main/java/com/diagbot/facade/DeptInfoFacade.java

@@ -1,6 +1,11 @@
 package com.diagbot.facade;
 
+import com.diagbot.entity.DeptInfo;
 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 org.springframework.stereotype.Component;
 
 /**
@@ -10,4 +15,18 @@ import org.springframework.stereotype.Component;
  */
 @Component
 public class DeptInfoFacade extends DeptInfoServiceImpl {
+
+    /**
+     * 添加科室信息(本地)
+     * @param addDeptInfoVO
+     * @return
+     */
+    public Boolean addDeptInfo(AddDeptInfoVO addDeptInfoVO) {
+        DeptInfo deptInfo =new DeptInfo();
+        BeanUtil.copyProperties(addDeptInfoVO,deptInfo);
+        deptInfo.setCreator(UserUtils.getCurrentPrincipleID());
+        deptInfo.setGmtCreate(DateUtil.now());
+        Boolean flag = this.save(deptInfo);
+        return flag;
+    }
 }

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

@@ -0,0 +1,18 @@
+package com.diagbot.vo;
+
+import lombok.Getter;
+import lombok.Setter;
+
+import javax.validation.constraints.NotNull;
+
+/**
+ * @Description:
+ * @author: wangyu
+ * @time: 2018/12/5 13:17
+ */
+@Getter
+@Setter
+public class AddDeptInfoVO {
+    @NotNull(message = "请输入科室名称")
+    private String name;
+}

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

@@ -1,7 +1,16 @@
 package com.diagbot.web;
 
 
+import com.diagbot.annotation.SysLogger;
+import com.diagbot.dto.RespDTO;
+import com.diagbot.facade.DeptInfoFacade;
+import com.diagbot.vo.AddDeptInfoVO;
 import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
@@ -16,7 +25,19 @@ import org.springframework.web.bind.annotation.RestController;
 @RestController
 @RequestMapping("/deptInfo")
 @SuppressWarnings("unchecked")
-@Api(value = "科室相关API", tags = { "科室相关API" })
+@Api(value = "科室维护相关API", tags = { "科室相关维护API" })
 public class DeptInfoController {
 
+    @Autowired
+    private DeptInfoFacade deptInfoFacade;
+
+    @ApiOperation(value = "科室维护——添加(本地科室)[by:wangyu]",
+            notes = "name: 科室编号,必填<br>")
+    @PostMapping("/addDeptInfo")
+    @SysLogger("addDeptInfo")
+    @Transactional
+    public RespDTO<Boolean> addDeptInfo(@RequestBody AddDeptInfoVO addDeptInfoVO) {
+        Boolean data = deptInfoFacade.addDeptInfo(addDeptInfoVO);
+        return RespDTO.onSuc(data);
+    }
 }