From f5c1732bf6bfd05af3fa53286e9c85f34d77c677 Mon Sep 17 00:00:00 2001
From: Administrator <admin>
Date: Mon, 30 Aug 2021 16:06:45 +0800
Subject: [PATCH] 未持证去除

---
 src/main/java/org/springblade/modules/system/mapper/UserMapper.xml             |    8 ++++----
 src/main/java/org/springblade/modules/system/mapper/DeptMapper.xml             |    2 +-
 src/main/java/org/springblade/modules/system/service/impl/UserServiceImpl.java |   31 +++++++++++++++++++++++++++----
 3 files changed, 32 insertions(+), 9 deletions(-)

diff --git a/src/main/java/org/springblade/modules/system/mapper/DeptMapper.xml b/src/main/java/org/springblade/modules/system/mapper/DeptMapper.xml
index 9e46a1d..2a06a19 100644
--- a/src/main/java/org/springblade/modules/system/mapper/DeptMapper.xml
+++ b/src/main/java/org/springblade/modules/system/mapper/DeptMapper.xml
@@ -367,7 +367,7 @@
                 and bu.status = 1
                 <if test="type==1">
                     and dept_category=1
-                    and (role_alias = '保安' or role_alias = '未持证保安')
+                    and role_alias = '保安'
                 </if>
                 <if test="type==2 or type==3">
                     and dept_category=2
diff --git a/src/main/java/org/springblade/modules/system/mapper/UserMapper.xml b/src/main/java/org/springblade/modules/system/mapper/UserMapper.xml
index 5e99b0d..78233e0 100644
--- a/src/main/java/org/springblade/modules/system/mapper/UserMapper.xml
+++ b/src/main/java/org/springblade/modules/system/mapper/UserMapper.xml
@@ -88,7 +88,7 @@
             and bu.role_id = #{user.roleId}
         </if>
         <if test="user.roleAlias!=null and user.roleAlias != ''">
-            and (br.role_alias = '保安' or br.role_alias = '未持证保安')
+            and br.role_alias = '保安'
         </if>
         <if test="user.status!=null and user.status != ''">
             and bu.status = #{user.status}
@@ -401,10 +401,9 @@
         where bu.id = #{user.id}
     </select>
 
+    <!--获取派遣信息-->
     <select id="getDispaterInfo" resultType="java.util.HashMap">
         select bu.*,sdu.jurisdiction from blade_user bu
-        left join
-        blade
         left join
         sys_dispatcher sd
         on
@@ -437,13 +436,14 @@
         on
         bd.id = si.departmentid
         where
+        1=1
         and bu.status = 1
         and bu.is_deleted = 0
         <if test="deptid!=null and deptid!=''">
             and bu.dept_id = #{deptid}
         </if>
         <if test="jurisdiction!=null and jurisdiction!=''">
-            and sdu.jurisdiction = #{jurisdiction}
+            and si.jurisdiction = #{jurisdiction}
             and dept_category=2
         </if>
     </select>
diff --git a/src/main/java/org/springblade/modules/system/service/impl/UserServiceImpl.java b/src/main/java/org/springblade/modules/system/service/impl/UserServiceImpl.java
index 7f854b8..e258e59 100644
--- a/src/main/java/org/springblade/modules/system/service/impl/UserServiceImpl.java
+++ b/src/main/java/org/springblade/modules/system/service/impl/UserServiceImpl.java
@@ -41,6 +41,9 @@
 import org.springblade.core.tool.support.Kv;
 import org.springblade.core.tool.utils.*;
 import org.springblade.modules.auth.enums.UserEnum;
+import org.springblade.modules.information.entity.Information;
+import org.springblade.modules.information.service.IInformationService;
+import org.springblade.modules.jurisdiction.entity.Jurisdiction;
 import org.springblade.modules.system.entity.*;
 import org.springblade.modules.system.excel.UserExcel;
 import org.springblade.modules.system.mapper.UserMapper;
@@ -72,6 +75,7 @@
 	private final IUserOauthService userOauthService;
 	private final IRoleService roleService;
 	private final BladeTenantProperties tenantProperties;
+	private final IInformationService iInformationService;
 
 	@Override
 	@Transactional(rollbackFor = Exception.class)
@@ -621,15 +625,34 @@
 		return baseMapper.getUserDetails(user);
 	}
 
+	/**
+	 *
+	 * @param type 1:派遣  2:保安向
+	 * @param deptid
+	 * @param jurisdiction
+	 * @return
+	 */
 	@Override
 	public List<Map<String, Object>> seleL(String type,String deptid, String jurisdiction) {
 		List<Map<String, Object>> list = new ArrayList<>();
-		//工作汇报
-		if (type.equals(1)){
+		//派遣
+		if (Integer.parseInt(type)==1){
 			list = baseMapper.getDispaterInfo(deptid, jurisdiction);
 		}
-		//派遣
-		if (type.equals(2) ||type.equals(3)){
+		//工作汇报
+		//保安向保安
+		if (Integer.parseInt(type)==2){
+			list = baseMapper.getWorkReportInfo(type,deptid, jurisdiction);
+		}
+		//保安向民警
+		if (Integer.parseInt(type)==3){
+			Information information = new Information();
+			information.setDepartmentid(deptid);
+			Information one = iInformationService.getOne(Condition.getQueryWrapper(information));
+			list = baseMapper.getWorkReportInfo(type,null, one.getJurisdiction());
+		}
+		//民警对民警
+		if (Integer.parseInt(type)==4){
 			list = baseMapper.getWorkReportInfo(type,deptid, jurisdiction);
 		}
 		return list;

--
Gitblit v1.9.3