浏览代码

添加根据项目编码获取项目接口

wyyay 1 年之前
父节点
当前提交
455c3e753e

+ 3 - 0
api/src/main/java/com/ankaibei/workflow/api/ProjectApi.java

@@ -14,4 +14,7 @@ import org.springframework.web.bind.annotation.RequestParam;
 public interface ProjectApi {
     @GetMapping("/foreign/admin/upms/project/getProjectInfoByProjectName")
     ResMsg findProjectInfo(@RequestParam("projectName") String projectName);
+
+    @GetMapping("/foreign/admin/upms/project/getProjectInfoByCode")
+    ResMsg findProjectInfoByCode(@RequestParam("projectCode") String projectCode);
 }

+ 11 - 1
application-webadmin/src/main/java/com/ankaibei/workFlow/webadmin/ankaibei/mapper/ProjectInfoMapper.java

@@ -61,8 +61,18 @@ public interface ProjectInfoMapper extends JpaRepository<ProjectInfoEntity, Inte
      *
      * @param projectName
      */
-    @Query(value = "SELECT pro.*  FROM project_info pro WHERE if( :projectName !='', pro.project_name like CONCAT('%',:projectName,'%') , 1=1) and is_delete='1' and flow_task_status='3' order by pro.create_date desc",
+    @Query(value = "SELECT pro.*  FROM project_info pro WHERE if( :projectName !='', pro.project_name like CONCAT('%',:projectName,'%') , 1=1) and is_delete='1'  order by pro.create_date desc",
             //countQuery = "SELECT count(1) FROM project_info pro WHERE if( ?1 !='', pro.project_name like %?1% , 1=1) ",
             nativeQuery = true)
     List<ProjectInfoEntity> findAllByProjectName(@Param("projectName") String projectName);
+
+    /**
+     * 根据编码查询项目信息
+     *
+     * @param projectCode
+     */
+    @Query(value = "SELECT *  FROM project_info  WHERE project_code=?1 and is_delete='1'",
+            //countQuery = "SELECT count(1) FROM project_info pro WHERE if( ?1 !='', pro.project_name like %?1% , 1=1) ",
+            nativeQuery = true)
+    ProjectInfoEntity  findProjectInfoByCode(@Param("projectCode") String projectCode);
 }

+ 4 - 0
application-webadmin/src/main/java/com/ankaibei/workFlow/webadmin/ankaibei/service/ProjectInfoService.java

@@ -38,4 +38,8 @@ public interface ProjectInfoService {
     ResMsg findLastMonthProjectNumber();
 
     ResMsg substepOfProjectNumAtLastMonth();
+
+    List<ProjectInfoEntity> getProjectInfoByProjectName(String projectName);
+
+    ProjectInfoEntity getProjectInfoByCode(String projectCode);
 }

+ 14 - 0
application-webadmin/src/main/java/com/ankaibei/workFlow/webadmin/ankaibei/service/impl/ProjectInfoServiceImpl.java

@@ -1,8 +1,10 @@
 package com.ankaibei.workFlow.webadmin.ankaibei.service.impl;
 
+import cn.hutool.core.util.ObjectUtil;
 import cn.hutool.core.util.StrUtil;
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONObject;
+import com.ankaibei.workFlow.common.core.constant.ErrorCodeEnum;
 import com.ankaibei.workFlow.common.core.object.ResponseResult;
 import com.ankaibei.workFlow.common.core.object.TokenData;
 import com.ankaibei.workFlow.common.flow.constant.FlowConstant;
@@ -394,6 +396,18 @@ public class ProjectInfoServiceImpl implements ProjectInfoService {
         return new ResMsg(CodeEnum.OK, listDate);
     }
 
+    @Override
+    public List<ProjectInfoEntity> getProjectInfoByProjectName(String projectName) {
+        List<ProjectInfoEntity> list = projectInfoMapper.findAllByProjectName(projectName);
+        return list;
+    }
+
+    @Override
+    public ProjectInfoEntity getProjectInfoByCode(String projectCode) {
+            ProjectInfoEntity pro = projectInfoMapper.findProjectInfoByCode(projectCode);
+            return pro;
+    }
+
     /**
      * 获取一段时间内每一天的日期
      */

+ 13 - 2
application-webadmin/src/main/java/com/ankaibei/workFlow/webadmin/api/ProjectApiService.java

@@ -1,5 +1,6 @@
 package com.ankaibei.workFlow.webadmin.api;
 
+import cn.hutool.core.util.ObjectUtil;
 import com.ankaibei.workFlow.webadmin.ankaibei.entity.ProjectInfoEntity;
 import com.ankaibei.workFlow.webadmin.ankaibei.mapper.ProjectInfoMapper;
 import com.ankaibei.workFlow.webadmin.ankaibei.service.ProjectInfoService;
@@ -22,12 +23,22 @@ import java.util.List;
 @RequestMapping("/foreign/admin/upms/project")
 public class ProjectApiService implements ProjectApi {
     @Resource
-    private ProjectInfoMapper projectInfoMapper;
+    private ProjectInfoService projectInfoService;
 
     @Override
     @RequestMapping("/getProjectInfoByProjectName")
     public ResMsg findProjectInfo(String projectName) {
-        List<ProjectInfoEntity> list = projectInfoMapper.findAllByProjectName(projectName);
+        List<ProjectInfoEntity> list = projectInfoService.getProjectInfoByProjectName(projectName);
         return new ResMsg(CodeEnum.OK, list);
     }
+
+    @Override
+    @RequestMapping("/getProjectInfoByCode")
+    public ResMsg findProjectInfoByCode(String projectCode) {
+        if(ObjectUtil.isNotEmpty(projectCode)){
+            ProjectInfoEntity pro = projectInfoService.getProjectInfoByCode(projectCode);
+            return new ResMsg(CodeEnum.OK, pro);
+        }
+        return new ResMsg(CodeEnum.PARAM_IS_NULL);
+    }
 }