ソースを参照

新增人员选择api

chenminghua 4 年 前
コミット
1660017758

+ 13 - 3
src/main/java/com/gyee/frame/controller/ticket/LaborController.java

@@ -39,13 +39,11 @@ public class LaborController {
 
     @DataSource(value = DataSourceType.TICKET)
     @GetMapping(value = "group")
-    public AjaxResult getLaborGroup( @RequestParam("role") String role, @RequestParam("dept") String dept) {
+    public AjaxResult getLaborGroup(@RequestParam("role") String role, @RequestParam("dept") String dept) {
         Wfrole wfrole = wfroleService.getRole(role);
         if (wfrole == null)
             return AjaxResult.error(4004, "人员获取失败");
 
-        System.out.println(role);
-        System.out.println(wfrole.getRoletype());
         List<Labor> labors = new ArrayList<>();
         switch (wfrole.getRoletype()){
             case "自定义类":
@@ -83,5 +81,17 @@ public class LaborController {
 
         return AjaxResult.successData(labors);
     }
+
+    @DataSource(value = DataSourceType.TICKET)
+    @GetMapping(value = "list")
+    public AjaxResult getLabors(@RequestHeader("token") String header){
+        TokenUser token = shiroService.findToken(header);
+        List<Labor> labors = laborService.getLabors(token.getDepartment());
+
+        if (labors == null || labors.size() == 0)
+            return AjaxResult.error(4004, "数据为空");
+
+        return AjaxResult.successData(labors);
+    }
 }
 

+ 11 - 3
src/main/java/com/gyee/frame/service/impl/ticket/LaborServiceImpl.java

@@ -6,6 +6,7 @@ import com.gyee.frame.mapper.ticket.LaborMapper;
 import com.gyee.frame.service.ticket.LaborService;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.gyee.frame.util.MD5Util;
+import com.gyee.frame.util.ticket.TicketUtil;
 import org.springframework.stereotype.Service;
 
 import java.util.List;
@@ -47,7 +48,14 @@ public class LaborServiceImpl extends ServiceImpl<LaborMapper, Labor> implements
 
     @Override
     public List<Labor> getLabors(String dept) {
-        return null;
+        QueryWrapper<Labor> wrapper = new QueryWrapper<>();
+        if (TicketUtil.allDept().contains(dept)){
+            wrapper.eq("DEPTNUM", dept);
+        }
+
+        List<Labor> labors = baseMapper.selectList(wrapper);
+
+        return labors;
     }
 
 
@@ -59,11 +67,11 @@ public class LaborServiceImpl extends ServiceImpl<LaborMapper, Labor> implements
     }
 
     @Override
-    public Labor getItemLabor(String laborNum) {
+    public Labor getLaborItem(String laborNum) {
         QueryWrapper<Labor> wrapper = new QueryWrapper<>();
         wrapper.eq("LABORNUM", laborNum);
-        Labor labor = baseMapper.selectOne(wrapper);
 
+        Labor labor = baseMapper.selectOne(wrapper);
         return labor;
     }
 

+ 2 - 4
src/main/java/com/gyee/frame/service/ticket/LaborService.java

@@ -55,9 +55,7 @@ public interface LaborService extends IService<Labor> {
 
 
     /**
-     * 根据流程节点角色查询人员
-     *
-     * 场站
+     * 根据场站查询人员
      *
      * @param dept
      * @return
@@ -80,7 +78,7 @@ public interface LaborService extends IService<Labor> {
      * @param laborNum
      * @return
      */
-    Labor getItemLabor(String laborNum);
+    Labor getLaborItem(String laborNum);
 
     /**
      * 查询流程启动者