智慧保安后台管理-外网项目备份
Administrator
2021-12-25 497df0adf57c8a076596fa763cdbe5a554b96b5b
src/main/java/org/springblade/modules/system/mapper/UserMapper.xml
@@ -100,7 +100,25 @@
            and bu.hold = #{user.hold}
        </if>
        <if test="user.deptId!=null and user.deptId != ''">
            and (bd.id = #{user.deptId} or bd.parent_id = #{user.deptId})
            and bd.id in
            (
                select id from blade_dept where id = #{user.deptId}
                union
                SELECT
                id
                FROM
                (
                SELECT
                t1.id,t1.parent_id,t1.dept_name,
                IF
                ( find_in_set( parent_id, @pids ) > 0, @pids := concat( @pids, ',', id ), 0 ) AS ischild
                FROM
                ( SELECT id, parent_id,dept_name FROM blade_dept t ORDER BY parent_id, id ) t1,
                ( SELECT @pids := #{user.deptId} ) t2
                ) t3
                WHERE
                ischild != 0
            )
        </if>
        <if test="user.roleId!=null and user.roleId != ''">
            and bu.role_id = #{user.roleId}
@@ -124,7 +142,24 @@
            and bu.real_name like concat('%', #{user.realName},'%')
        </if>
        <if test="user.dispatch!=null and user.dispatch != ''">
            and bu.dispatch = #{user.dispatch}
            <if test="user.dispatch == 0">
                and bu.dispatch = #{user.dispatch}
            </if>
            <if test="user.dispatch == 1">
                and bu.dispatch = #{user.dispatch}
            </if>
        </if>
        <if test="user.isAvatar==1">
            and bu.avatar is not null and bu.avatar!=""
        </if>
        <if test="user.isAvatar==2">
            and (bu.avatar is null or bu.avatar="")
        </if>
        <if test="user.isFingerprint==1">
            and bu.fingerprint is not null and bu.fingerprint!=""
        </if>
        <if test="user.isFingerprint==2">
            and (bu.fingerprint is null or bu.fingerprint="")
        </if>
        <if test="user.userType!=null and user.userType != ''">
            and bu.user_type = #{user.userType}
@@ -135,7 +170,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>
    <select id="selectUserPage" resultMap="userResultMap">
@@ -166,7 +206,25 @@
            and real_name like concat(concat('%', #{user.realName}),'%')
        </if>
        <if test="user.deptId!=null and user.deptId != ''">
            and (bd.id = #{user.deptId} or bd.parent_id = #{user.deptId})
            and bd.id in
            (
                select id from blade_dept where id = #{user.deptId}
                union
                SELECT
                id
                FROM
                (
                SELECT
                t1.id,t1.parent_id,t1.dept_name,
                IF
                ( find_in_set( parent_id, @pids ) > 0, @pids := concat( @pids, ',', id ), 0 ) AS ischild
                FROM
                ( SELECT id, parent_id,dept_name FROM blade_dept t ORDER BY parent_id, id ) t1,
                ( SELECT @pids := #{user.deptId} ) t2
                ) t3
                WHERE
                ischild != 0
            )
        </if>
        <if test="user.userType!=null and user.userType != ''">
            and user_type = #{user.userType}
@@ -275,6 +333,9 @@
        <if test="user.status!=null and user.status != ''">
            and bu.status = #{user.status}
        </if>
        <if test="user.equipmentCode!=null">
            and bu.equipment_code !="" and bu.equipment_code is not null and bu.equipment_code !=null
        </if>
        <if test="user.jurisdiction!=null and user.jurisdiction != ''">
            and bu.jurisdiction = #{user.jurisdiction}
        </if>
@@ -374,13 +435,9 @@
            where 1 = 1
            <if test="user.examType==1">
                and a.isApply != 1
                and a.age&gt;=18
                and a.age&lt;=60
            </if>
            <if test="user.examType==2">
                and a.isTrain != 1
                and a.age&gt;=18
                and a.age&lt;=60
            </if>
        )
    </select>
@@ -419,7 +476,7 @@
    <!--计算保安人员年龄-->
    <select id="getUserAgeById" resultType="org.springblade.modules.system.vo.UserVO">
        select id,ifnull(DATE_FORMAT(NOW(), '%Y') - SUBSTRING(cardid,7,4),0) age,securitynumber,cardid
        select id,real_name realName,ifnull(DATE_FORMAT(NOW(), '%Y') - SUBSTRING(cardid,7,4),0) age,securitynumber,cardid
        from
        blade_user
        where
@@ -647,6 +704,7 @@
    <!--导出保安员信息-->
    <select id="exportSecurityInfo" resultType="org.springblade.modules.system.excel.SecurityExcel">
        select
        distinct bu.id,
        bd.dept_name deptId,
        bu.real_name realName,
        bu.phone,
@@ -688,6 +746,18 @@
                and bu.examination_type = #{user.examinationType}
            </if>
        </if>
        <if test="user.isAvatar==1">
            and bu.avatar is not null and bu.avatar!=""
        </if>
        <if test="user.isAvatar==2">
            and (bu.avatar is null or bu.avatar="")
        </if>
        <if test="user.isFingerprint==1">
            and bu.fingerprint is not null and bu.fingerprint!=""
        </if>
        <if test="user.isFingerprint==2">
            and (bu.fingerprint is null or bu.fingerprint="")
        </if>
        <if test="user.account!=null and user.account != ''">
            and bu.account like concat('%', #{user.account},'%')
        </if>
@@ -695,7 +765,25 @@
            and bu.hold = #{user.hold}
        </if>
        <if test="user.deptId!=null and user.deptId != ''">
            and (bd.id = #{user.deptId} or bd.parent_id = #{user.deptId})
            and bd.id in
            (
                select id from blade_dept where id = #{user.deptId}
                union
                SELECT
                id
                FROM
                (
                SELECT
                t1.id,t1.parent_id,t1.dept_name,
                IF
                ( find_in_set( parent_id, @pids ) > 0, @pids := concat( @pids, ',', id ), 0 ) AS ischild
                FROM
                ( SELECT id, parent_id,dept_name FROM blade_dept t ORDER BY parent_id, id ) t1,
                ( SELECT @pids := #{user.deptId} ) t2
                ) t3
                WHERE
                ischild != 0
            )
        </if>
        <if test="user.roleId!=null and user.roleId != ''">
            and bu.role_id = #{user.roleId}
@@ -719,7 +807,12 @@
            and bu.real_name like concat('%', #{user.realName},'%')
        </if>
        <if test="user.dispatch!=null and user.dispatch != ''">
            and bu.dispatch = #{user.dispatch}
            <if test="user.dispatch == 0">
                and bu.dispatch = #{user.dispatch}
            </if>
            <if test="user.dispatch == 1">
                and bu.dispatch = #{user.dispatch}
            </if>
        </if>
        <if test="user.userType!=null and user.userType != ''">
            and bu.user_type = #{user.userType}
@@ -733,6 +826,71 @@
        ORDER BY bu.id desc
    </select>
    <!--查询押运人员编码不为null的保安信息-->
    <select id="selectEquipent" resultType="java.util.HashMap">
        SELECT id,
               equipment_code as code
        FROM blade_user
        WHERE dept_id = '1460129345988239362'
          AND role_id = '1412226235153731586'
          AND is_deleted = 0
          AND `status` = 1
          AND equipment_code IS NOT NULL
    </select>
    <!--查詢用戶派遣記錄信息-->
    <select id="getUserDispatcherInfo" resultType="org.springblade.modules.dispatcher.vo.DispatcherVO">
        select
        sdu.name dispatcherCompany,
        dispatcherTime dispatchertime,
        sd.end_time endTime
        from blade_user bu
        left join
        sys_dispatcher sd
        on
        sd.user_ids = bu.id
        left join
        sys_dispatcher_unit sdu
        on
        sdu.id = sd.dispatcher_unit_id
        where 1=1
        and sd.status = 0
        and bu.dispatch = 0
        and bu.id = #{id}
    </select>
    <!-- 批量插入时将主键值设置到参数user的userId字段上 -->
    <insert id="batchUserList" useGeneratedKeys="true" keyProperty="id">
        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,securitynumber,
        hold,jurisdiction,examination_type,status,is_deleted,dispatch,create_time
        )
        values
        <foreach collection="list" item="user" separator=",">
            (#{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.securitynumber},
            #{user.hold},#{user.jurisdiction},#{user.examinationType},#{user.status},#{user.isDeleted},#{user.dispatch},#{user.createTime}
            )
        </foreach>
    </insert>
    <!-- 批量插入时将主键值设置到参数user的userId字段上 -->
    <insert id="batchExperienceList" useGeneratedKeys="true" keyProperty="id">
        insert into sys_experience
        (
        name,post,entryTime,cardId,companyname,securityId
        )
        values
        <foreach collection="list" item="item" separator=",">
            (
            #{item.name},#{item.post},#{item.entrytime},#{item.cardid},#{item.companyname},#{item.securityid}
            )
        </foreach>
    </insert>
</mapper>