智慧保安后台管理-外网项目备份
zhongrj
2023-09-17 8853292babb2ad94de4a3207966f1e83b767cd2d
src/main/java/org/springblade/modules/system/mapper/UserMapper.xml
@@ -344,21 +344,13 @@
        </if>
    </select>
    <!--用户列表信息-->
    <select id="selectUserPage" resultMap="userResultMap">
        select bu.* from blade_user bu
        left join
        blade_dept bd
        on
        bd.id = bu.dept_id
        left join
        sys_jurisdiction sj
        on
        sj.id = bu.jurisdiction
        left join
        blade_role br
        on
        br.id = bu.role_id
        where bu.is_deleted = 0
        left join blade_dept bd on bd.id = bu.dept_id
        left join sys_jurisdiction sj on sj.id = bu.jurisdiction
        left join blade_role br on br.id = bu.role_id
        where bu.is_deleted = 0 and bu.id != 1123598821738675201
        <if test="user.tenantId!=null and user.tenantId != ''">
            and tenant_id = #{user.tenantId}
        </if>
@@ -1138,5 +1130,54 @@
        select * from blade_user where id = #{id}
    </select>
    <!--根据手机号获取用户信息-->
    <select id="getUserByPhone" resultType="org.springblade.modules.system.entity.User">
        select * from blade_user where is_deleted = 0 and status = 1
        and tenant_id = #{tenantId} and phone = #{phone}
    </select>
    <!--按天查询 day 天未登录的人员ids集合信息-->
    <select id="getMoreDayNotLoginUser" resultType="java.lang.String">
        select bu.id from blade_user bu
        left join  (
            select user_id,max(create_time) as create_time from sys_login_record GROUP BY user_id
        )slr on bu.id = slr.user_id
         where bu.status = 1 and bu.is_deleted = 0 and bu.role_id = 1412226235153731586
         and DATE_SUB(CURDATE(), INTERVAL #{day} DAY) > date(bu.create_time)
         and DATE_SUB(CURDATE(), INTERVAL #{day} DAY) > date(slr.create_time)
    </select>
    <!--用户冻结操作-->
    <update id="updateFreeze">
        update blade_user set is_deleted = 1
        <choose>
            <when test="list!=null and list.size()>0">
                where id in
                <foreach collection="list" item="id" open="(" close=")" separator=",">
                    #{id}
                </foreach>
            </when>
            <otherwise>
                where id in ('')
            </otherwise>
        </choose>
    </update>
    <!--用户注销操作-->
    <update id="updateLogout">
        update blade_user set is_deleted = 1
        <choose>
            <when test="list!=null and list.size()>0">
                where id in
                <foreach collection="list" item="id" open="(" close=")" separator=",">
                    #{id}
                </foreach>
            </when>
            <otherwise>
                where id in ('')
            </otherwise>
        </choose>
    </update>
</mapper>