From 8b375fe00a241b3a769b82fe3dac8d1c9dce8a02 Mon Sep 17 00:00:00 2001
From: Administrator <admin>
Date: Thu, 16 Jun 2022 14:36:07 +0800
Subject: [PATCH] 模拟考试修改

---
 src/main/java/org/springblade/modules/system/mapper/UserMapper.xml |  102 ++++++++++++++++++++++++++++++++++++++++++++++++---
 1 files changed, 96 insertions(+), 6 deletions(-)

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 85a849c..e9d1b2f 100644
--- a/src/main/java/org/springblade/modules/system/mapper/UserMapper.xml
+++ b/src/main/java/org/springblade/modules/system/mapper/UserMapper.xml
@@ -360,7 +360,7 @@
             and account like concat('%', #{user.account},'%')
         </if>
         <if test="user.roleId!=null and user.roleId != ''">
-            and br.role_alias = '公安管理员'
+            and (br.role_alias = '公安管理员' or br.role_alias = '民警')
         </if>
         <if test="user.realName!=null and user.realName != ''">
             and real_name like concat(concat('%', #{user.realName}),'%')
@@ -555,7 +555,7 @@
             select #{user.deptId} as id,
                 '全部' as name,
                 0 as parentId
-                from blade_user
+                from blade_user limit 1
         )
 
         union all
@@ -572,7 +572,7 @@
                     ifnull(TIMESTAMPDIFF(YEAR, SUBSTRING(bu.cardid, 7, 8), CURDATE()),0) AS age,
                     bu.is_apply isApply,
                     bu.is_train isTrain,
-                    bu.real_name as name,
+                    bu.account as name,
                     #{user.deptId} parentId
                 from
                     blade_user bu
@@ -587,7 +587,7 @@
                 where
                 bu.is_deleted = 0
                 and bu.status = 1
-                and (bu.examination_type != 1 or bu.examination_type is null)
+                and ((bu.examination_type != 1 and bu.examination_type != 2) or bu.examination_type is null)
                 and (hold = 2 or hold = 3)
                 and bd.id = #{user.deptId}
                 and br.role_alias = '保安'
@@ -601,6 +601,59 @@
             </if>
         )
     </select>
+
+    <!--保安员列表树 安员列表树,帅选无保安证,下拉tree-->
+<!--    <select id="getSecurityApplyTree" resultType="org.springblade.modules.system.node.TreeNode">-->
+<!--        (-->
+<!--            select #{user.deptId} as id,-->
+<!--                '全部' as name,-->
+<!--                0 as parentId-->
+<!--                from blade_user limit 1-->
+<!--        )-->
+
+<!--        union all-->
+
+<!--        (-->
+<!--            select-->
+<!--            a.id,-->
+<!--            a.name,-->
+<!--            a.parentId-->
+<!--            from (-->
+<!--                select-->
+<!--                    distinct-->
+<!--                    bu.id,-->
+<!--                    ifnull(TIMESTAMPDIFF(YEAR, SUBSTRING(bu.cardid, 7, 8), CURDATE()),0) AS age,-->
+<!--                    bu.is_apply isApply,-->
+<!--                    bu.is_train isTrain,-->
+<!--                    bu.real_name as name,-->
+<!--                    #{user.deptId} parentId-->
+<!--                from-->
+<!--                    blade_user bu-->
+<!--                left join-->
+<!--                blade_dept bd-->
+<!--                on-->
+<!--                bu.dept_id = bd.id-->
+<!--                left join-->
+<!--                blade_role br-->
+<!--                on-->
+<!--                br.id = bu.role_id-->
+<!--                where-->
+<!--                bu.is_deleted = 0-->
+<!--                and bu.status = 1-->
+<!--                and ((bu.examination_type != 1 and bu.examination_type != 2) or bu.examination_type is null)-->
+<!--                and (hold = 2 or hold = 3)-->
+<!--                and bd.id = #{user.deptId}-->
+<!--                and br.role_alias = '保安'-->
+<!--            ) a-->
+<!--            where 1 = 1-->
+<!--            <if test="user.examType==1">-->
+<!--                and a.isApply != 1-->
+<!--            </if>-->
+<!--            <if test="user.examType==2">-->
+<!--                and a.isTrain != 1-->
+<!--            </if>-->
+<!--        )-->
+<!--    </select>-->
 
 
     <select id="selectInr" resultType="java.util.HashMap">
@@ -847,7 +900,7 @@
         select
         distinct
         bu.id,
-        bu.real_name as name,
+        bu.account as name,
         #{user.deptId} parentId
         from
         blade_user bu
@@ -871,7 +924,7 @@
 
 
     <!--导出保安员信息-->
-    <select id="exportSecurityInfo" resultType="org.springblade.modules.system.excel.SecurityExcel">
+    <select id="exportSecurityInfo" resultType="org.springblade.modules.system.excel.ExportSecurityExcel">
         select
         distinct bu.id,
         bd.dept_name deptId,
@@ -1068,6 +1121,21 @@
         </foreach>
     </insert>
 
+    <!-- 批量更新用户数据 -->
+    <update id="batchUpdateUserList" parameterType="java.util.List">
+        <foreach collection="list" item="user" index="index" separator=";">
+        update blade_user
+            set account = #{user.account},
+                 PASSWORD = #{user.password},
+                 real_name = #{user.realName},
+                 phone = #{user.registered},
+                 registered = #{user.registered},
+                 securitynumber = #{user.securitynumber},
+                 hold = #{user.hold} where id = #{user.id}
+        </foreach>
+    </update>
+
+
     <!--查询学历统计信息-->
     <select id="getAgeStatistics" resultType="java.lang.Integer">
         select count(*) c from (
@@ -1126,6 +1194,28 @@
         )
     </select>
 
+    <select id="getUserById" resultType="org.springblade.modules.system.entity.User">
+        select * from blade_user where id = #{id}
+    </select>
+
+    <insert id="insertUser">
+        insert into blade_user
+        (
+            id,tenant_id,account,password,name,real_name,avatar,email,phone,sex,
+            role_id,dept_id,cardid,nativePlace,nation,fingerprint,education,
+            politicaloutlook,healstats,height,address,registered,rtime,
+            securitynumber,hold,jurisdiction,examination_type,status,is_deleted,dispatch,guncode,create_time,cell
+        )
+        values
+        (
+            #{user.id},#{user.tenantId},#{user.account},#{user.password},#{user.name},#{user.realName},#{user.avatar},
+            #{user.email},#{user.phone},#{user.sex},
+            #{user.roleId},#{user.deptId},#{user.cardid},#{user.nativeplace},#{user.nation},#{user.fingerprint},#{user.education},
+            #{user.politicaloutlook},#{user.healstats},#{user.height},#{user.address},#{user.registered},#{user.rtime},
+            #{user.securitynumber},#{user.hold},#{user.jurisdiction},#{user.examinationType},#{user.status},#{user.isDeleted},
+            #{user.dispatch},#{user.guncode},#{user.createTime},#{user.cell}
+        )
+    </insert>
 
 
 </mapper>

--
Gitblit v1.9.3