中扬CRM客户关系管理系统
#
luxiaotao1123
2022-11-24 fb28685a5209be09c042f1a65650cb2fecefbc90
src/main/resources/mapper/UserMapper.xml
@@ -19,4 +19,49 @@
    </resultMap>
    <select id="listByPage" resultMap="BaseResultMap">
        SELECT
        su.*
        FROM sys_user su
        LEFT JOIN sys_dept sd ON su.dept_id = sd.id
        WHERE 1=1
        AND (CHARINDEX(','+#{deptId}+',', ','+sd.path+',') > 0 OR sd.id = #{deptId})
        <if test="hostId != null and hostId != ''">
            and su.host_id = #{hostId}
        </if>
        <if test="username != null and username != ''">
            and su.username like concat('%',#{username},'%')
        </if>
        <if test="mobile != null and mobile != ''">
            and su.mobile like concat('%',#{mobile},'%')
        </if>
        ORDER BY su.create_time DESC
    </select>
    <select id="getUserByDept" resultMap="BaseResultMap">
        SELECT
        *
        FROM sys_user
        where 1=1
        <if test="hostId != null and hostId != ''">
            and host_id = #{hostId}
        </if>
        <if test="deptId != null and deptId != ''">
            and dept_id = #{deptId}
        </if>
    </select>
    <select id="getDeptManager" resultMap="BaseResultMap">
        SELECT
        su.*
        FROM sys_user su
        left join sys_role sr on su.role_id = sr.id
        where 1=1
        <if test="hostId != null and hostId != ''">
            and su.host_id = #{hostId}
        </if>
        and su.dept_id = #{deptId}
        and sr.code = 'manager'
    </select>
</mapper>