Ver código fonte

技术档案优化

hsh 11 meses atrás
pai
commit
bfa108f939

+ 16 - 4
src/main/java/thyyxxk/webserver/dao/his/technologyArchives/TechnologyArchivesDao.java

@@ -48,6 +48,9 @@ public interface TechnologyArchivesDao extends BaseMapper<TechnologyArchivesType
     @Select("select rtrim(code) as code, rtrim(name) as name from technology_archives_type where type = #{type} order by sort ")
     List<Map<String, Object>> selectTechnologyArchivesType(@Param("type") String type);
 
+    @Select("select rtrim(code) as code, rtrim(name) as name from technology_archives_type order by sort ")
+    List<Map<String, Object>> selectTechnologyArchivesTypeAll();
+
     @Select("select count(1) from sys_parameters where code = 'technologyArchivesCode' and name like '%${code}%' ")
     int selectTechnologyArchivesTypeQx(@Param("code") String code);
 
@@ -60,23 +63,32 @@ public interface TechnologyArchivesDao extends BaseMapper<TechnologyArchivesType
             "<if test=\"code != null and code != '' \">" +
             " and a.account = #{code} " +
             "</if>" +
+            "<if test=\"socialNo != null and socialNo != '' \">" +
+            " and a.social_no = #{socialNo} " +
+            "</if>" +
             "</script>")
-    List<Map<String, Object>> selectTechnologyArchivesInfo(@Param("tableName") String tableName, @Param("code") String code);
+    List<Map<String, Object>> selectTechnologyArchivesInfo(@Param("tableName") String tableName, @Param("code") String code, @Param("socialNo") String socialNo);
 
     @Select("<script>" +
             " select * from ${tableName} where 1 = 1 " +
             "<if test=\"code != null and code != '' \">" +
             " account = #{code} " +
             "</if>" +
+            "<if test=\"socialNo != null and socialNo != '' \">" +
+            " and social_no = #{socialNo} " +
+            "</if>" +
             "</script>")
-    List<Map<String, Object>> selectTechnologyArchivesMainInfo(@Param("tableName") String tableName, @Param("code") String code);
+    List<Map<String, Object>> selectTechnologyArchivesMainInfo(@Param("tableName") String tableName, @Param("code") String code, @Param("socialNo") String socialNo);
 
     @Select("<script>" +
             " ${sql} where 1 = 1 " +
             "<if test=\"code != null and code != '' \">" +
-            " and account = #{code} " +
+            " and m.account = #{code} " +
+            "</if>" +
+            "<if test=\"socialNo != null and socialNo != '' \">" +
+            " and m.social_no = #{socialNo} " +
             "</if>" +
             "</script>")
-    List<Map<String, Object>> selectTechnologyArchivesInfoBySql(@Param("sql") String sql, @Param("code") String code);
+    List<Map<String, Object>> selectTechnologyArchivesInfoBySql(@Param("sql") String sql, @Param("code") String code, @Param("socialNo") String socialNo);
 
 }

+ 60 - 9
src/main/java/thyyxxk/webserver/service/technologyArchives/TechnologyArchivesService.java

@@ -1485,7 +1485,12 @@ public class TechnologyArchivesService {
      */
     public ResultVo<Map<String, Object>> selectTechnologyArchivesType(String type) {
         Map<String, Object> map = new HashMap<>();
-        List<Map<String, Object>> list = dao.selectTechnologyArchivesType(type);
+        List<Map<String, Object>> list;
+        if("all".equals(type)){
+            list = dao.selectTechnologyArchivesTypeAll();
+        } else {
+            list = dao.selectTechnologyArchivesType(type);
+        }
         map.put("taList", list);
         return ResultVoUtil.success(map);
     }
@@ -1507,19 +1512,46 @@ public class TechnologyArchivesService {
         List<Map<String, Object>> list;
         TechnologyArchivesType t = dao.selectTechnologyArchivesTypeInfo(vo.getTextType());
         String sql = t.getTableSql();
+        String type = t.getType();
         if(dd == 0){
             // 没有审核权限,只能查询自己的记录
+            String sfz;
+            if(null == user.getSocialNo() || StringUtil.isBlank(user.getSocialNo())){
+                TechnologyArchivesMain mainSelf = mainDao.selectTechnologyArchivesMainBySocialNo(user.getCode().trim());
+                sfz = mainSelf.getSocialNo();
+            } else {
+                sfz = user.getSocialNo();
+            }
+            if(null == sfz || StringUtil.isBlank(sfz)){
+                return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "没有检索到的登录者技术档案的身份证信息,请检查!");
+            }
             if(t.getTableName().endsWith("main")){
                 if(StringUtil.notBlank(sql)){
-                    list = dao.selectTechnologyArchivesInfoBySql(sql, user.getCode());
+                    if("2".equals(type)){
+                        list = dao.selectTechnologyArchivesInfoBySql(sql, null, sfz);
+                    } else {
+                        list = dao.selectTechnologyArchivesInfoBySql(sql, user.getCode(), sfz);
+                    }
                 } else {
-                    list = dao.selectTechnologyArchivesMainInfo(t.getTableName(), user.getCode());
+                    if("2".equals(type)){
+                        list = dao.selectTechnologyArchivesMainInfo(t.getTableName(), null, sfz);
+                    } else {
+                        list = dao.selectTechnologyArchivesMainInfo(t.getTableName(), user.getCode(), sfz);
+                    }
                 }
             } else {
                 if(StringUtil.notBlank(sql)){
-                    list = dao.selectTechnologyArchivesInfoBySql(sql, user.getCode());
+                    if("2".equals(type)){
+                        list = dao.selectTechnologyArchivesInfoBySql(sql, null, sfz);
+                    } else {
+                        list = dao.selectTechnologyArchivesInfoBySql(sql, user.getCode(), sfz);
+                    }
                 } else {
-                    list = dao.selectTechnologyArchivesInfo(t.getTableName(), user.getCode());
+                    if("2".equals(type)){
+                        list = dao.selectTechnologyArchivesInfo(t.getTableName(), null, sfz);
+                    } else {
+                        list = dao.selectTechnologyArchivesInfo(t.getTableName(), user.getCode(), sfz);
+                    }
                 }
             }
         } else {
@@ -1527,18 +1559,37 @@ public class TechnologyArchivesService {
             TechnologyArchivesMain main = new TechnologyArchivesMain();
             if(StringUtil.notBlank(vo.getText())){
                 main = dao.selectEmployeeInfo(vo.getText());
+                if(null == main){
+                    return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "没有查到" + vo.getText() + "检索的账号信息,请检查!");
+                }
             }
             if(t.getTableName().endsWith("main")){
                 if(StringUtil.notBlank(sql)){
-                    list = dao.selectTechnologyArchivesInfoBySql(sql, main.getAccount());
+                    if("2".equals(type)){
+                        list = dao.selectTechnologyArchivesInfoBySql(sql, null, main.getSocialNo());
+                    } else {
+                        list = dao.selectTechnologyArchivesInfoBySql(sql, main.getAccount(),main.getSocialNo());
+                    }
                 } else {
-                    list = dao.selectTechnologyArchivesMainInfo(sql, main.getAccount());
+                    if("2".equals(type)){
+                        list = dao.selectTechnologyArchivesMainInfo(sql, null, main.getSocialNo());
+                    } else {
+                        list = dao.selectTechnologyArchivesMainInfo(sql, main.getAccount(), main.getSocialNo());
+                    }
                 }
             } else {
                 if(StringUtil.notBlank(sql)){
-                    list = dao.selectTechnologyArchivesInfoBySql(sql, main.getAccount());
+                    if("2".equals(type)){
+                        list = dao.selectTechnologyArchivesInfoBySql(sql, null, main.getSocialNo());
+                    } else {
+                        list = dao.selectTechnologyArchivesInfoBySql(sql, main.getAccount(), main.getSocialNo());
+                    }
                 } else {
-                    list = dao.selectTechnologyArchivesInfo(t.getTableName(), main.getAccount());
+                    if("2".equals(type)){
+                        list = dao.selectTechnologyArchivesInfo(t.getTableName(), null, main.getSocialNo());
+                    } else {
+                        list = dao.selectTechnologyArchivesInfo(t.getTableName(), main.getAccount(), main.getSocialNo());
+                    }
                 }
             }
         }