From ffb62aac389a6ac596fe8d0d44d4e242beeea0f2 Mon Sep 17 00:00:00 2001
From: Administrator <admin>
Date: Thu, 10 Mar 2022 11:46:31 +0800
Subject: [PATCH] 考勤查询接口修改,电子围栏自定义新增、修改,查询一个点是否在电子围栏内接口新增

---
 src/main/java/org/springblade/modules/system/mapper/UserMapper.xml |   27 +++++++++++++++++++++++----
 1 files changed, 23 insertions(+), 4 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 a34edf2..81e0138 100644
--- a/src/main/java/org/springblade/modules/system/mapper/UserMapper.xml
+++ b/src/main/java/org/springblade/modules/system/mapper/UserMapper.xml
@@ -55,6 +55,7 @@
         select
         distinct
         bu.*,IF(mod(SUBSTR(bu.cardid,17,1),2),1,2) sexs,
+        ifnull(TIMESTAMPDIFF(YEAR, SUBSTRING(bu.cardid, 7, 8), CURDATE()),0) AS age,
         sll.longitude,sll.latitude,
         bd.dept_name
         from
@@ -359,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}),'%')
@@ -567,7 +568,7 @@
             from (
                 select
                     distinct
-                    bu.id
+                    bu.id,
                     ifnull(TIMESTAMPDIFF(YEAR, SUBSTRING(bu.cardid, 7, 8), CURDATE()),0) AS age,
                     bu.is_apply isApply,
                     bu.is_train isTrain,
@@ -655,7 +656,16 @@
          blade_dept bd
          on
          bu.dept_id = bd.id
-        where securitynumber = #{securityNumber}
+        where
+        1=1
+        <if test="securityNumber!=null and securityNumber!=''">
+            and securitynumber = #{securityNumber}
+        </if>
+        <if test="cardid!=null and cardid!=''">
+            and cardid = #{cardid}
+        </if>
+        and bu.status = 1
+        and bu.is_deleted = 0
     </select>
 
 
@@ -982,7 +992,12 @@
         <if test="user.cardid!=null and user.cardid != ''">
             and bu.cardid like concat('%', #{user.cardid},'%')
         </if>
-        ORDER BY bu.id desc
+        <if test="user.sortName!=null and user.sortName!=''">
+            ORDER BY bu.${user.sortName} ${user.sort},bu.id desc
+        </if>
+        <if test="user.sortName==null or user.sortName==''">
+            ORDER BY bu.id desc
+        </if>
     </select>
 
     <!--查询押运人员编码不为null的保安信息-->
@@ -995,6 +1010,7 @@
           AND is_deleted = 0
           AND `status` = 1
           AND equipment_code IS NOT NULL
+          AND equipment_code!=""
     </select>
 
     <!--查詢用戶派遣記錄信息-->
@@ -1110,6 +1126,9 @@
         )
     </select>
 
+    <select id="getUserById" resultType="org.springblade.modules.system.entity.User">
+        select * from blade_user where id = #{id}
+    </select>
 
 
 </mapper>

--
Gitblit v1.9.3