yanghui
2022-10-27 c7a1a16c8d22b64f9025e800ebaf89b19b530228
flower_city/src/main/resources/mapper/SysUserMapper.xml
@@ -37,6 +37,7 @@
        <result property="openid"      column="openid"      />
        <result property="transactionNum"      column="transaction_num"      />
        <result property="isDivisionHead"      column="is_division_head"      />
        <result property="mattersIds"      column="matters_ids"      />
    </resultMap>
    <sql id="selectSysUserVo">
@@ -66,12 +67,20 @@
            department_id,
            stair_id,
            second_level_id,
            matters_ids,
            (SELECT GROUP_CONCAT(matter_name) FROM automessage_transaction_event WHERE id in (SELECT
              substring_index(substring_index(matters_ids,',', b.help_topic_id + 1), ',', -1) result
          FROM
              mysql.help_topic b
          where
                  b.help_topic_id &lt; (LENGTH(matters_ids) - LENGTH(REPLACE(matters_ids, ',', '')) + 1))) as mattersNames,
            concat(
                    IFNULL((SELECT name FROM area_code_2022 WHERE area_code_2022.code=(select city from automessage_organization_chart
                    IFNULL((SELECT name FROM automessage_area_code_2022 WHERE automessage_area_code_2022.code=(select city from automessage_organization_chart
                            where automessage_organization_chart.id=department_id)),''),
                    IFNULL((SELECT name FROM area_code_2022 WHERE area_code_2022.code=(select district from automessage_organization_chart
                    IFNULL((SELECT name FROM automessage_area_code_2022 WHERE automessage_area_code_2022.code=(select district from automessage_organization_chart
                            where automessage_organization_chart.id=department_id)),''),
                    IFNULL((SELECT name FROM area_code_2022 WHERE area_code_2022.code=(select village from automessage_organization_chart
                    IFNULL((SELECT name FROM automessage_area_code_2022 WHERE automessage_area_code_2022.code=(select village from automessage_organization_chart
                            where automessage_organization_chart.id=department_id)),'')
                ) AS department_area,
            leisure_state,
@@ -88,6 +97,9 @@
            openid,
            (select user_name from automessage_sys_user where automessage_sys_user.user_id=create_by) as createName,
            transaction_num,
            (select count(id) from automessage_guide_repair_order where automessage_guide_repair_order.state='3'
             and automessage_guide_repair_order.guide_user_id=user_id and
             automessage_guide_repair_order.guide_department_id=automessage_sys_user.department_id) as transactionEndNum,
            (select role_name from automessage_role_management where automessage_role_management.id=role_ids) as roleName,
            (select permission from automessage_role_management where automessage_role_management.id=role_ids) as permission,
            (select organization_name from automessage_organization_chart where automessage_sys_user.department_id=automessage_organization_chart.id) as department_name
@@ -98,12 +110,6 @@
    <select id="selectNum" parameterType="string" resultType="integer">
        select count(user_id) from automessage_sys_user
        <where>
            <if test="userName != null and userName != ''">
                AND user_name like concat('%', #{userName}, '%') or
                (department_id in (SELECT id FROM automessage_organization_chart
                WHERE organization_name like concat('%', #{userName}, '%'))) or
                phonenumber like concat('%', #{userName}, '%')
            </if>
            <if test="userType != null and userType != ''">
                AND user_type=#{userType}
            </if>
@@ -113,6 +119,13 @@
                    #{param}
                </foreach>
            </if>
            <if test="userName != null and userName != ''">
                AND (user_name like concat('%', #{userName}, '%') or
                (department_id in (SELECT id FROM automessage_organization_chart
                WHERE organization_name like concat('%', #{userName}, '%'))) or
                phonenumber like concat('%', #{userName}, '%'))
            </if>
        </where>
    </select>
@@ -130,12 +143,6 @@
    <select id="selectConfigList" parameterType="string" resultMap="SysUserResult">
        <include refid="selectSysUserVo"/>
        <where>
            <if test="userName != null and userName != ''">
                AND user_name like concat('%', #{userName}, '%') or
                (department_id in (SELECT id FROM automessage_organization_chart
                WHERE organization_name like concat('%', #{userName}, '%'))) or
                phonenumber like concat('%', #{userName}, '%')
            </if>
            <if test="userType != null and userType != ''">
                AND user_type=#{userType}
            </if>
@@ -144,6 +151,12 @@
                <foreach collection="ids" item="param"  open="(" close=")" separator=",">
                    #{param}
                </foreach>
            </if>
            <if test="userName != null and userName != ''">
                AND (user_name like concat('%', #{userName}, '%') or
                (department_id in (SELECT id FROM automessage_organization_chart
                WHERE organization_name like concat('%', #{userName}, '%'))) or
                phonenumber like concat('%', #{userName}, '%'))
            </if>
        </where>
        order by create_time desc
@@ -232,6 +245,7 @@
        <if test="transactionNames != null and transactionNames != '' ">,transaction_names</if>
        <if test="openid != null and openid != '' ">,openid</if>
        <if test="isDivisionHead != null and isDivisionHead != '' ">,is_division_head</if>
        <if test="mattersIds != null and mattersIds != '' ">,matters_ids</if>
        )values(
        sysdate()
        <if test="userId != null and userId != '' ">,#{userId}</if>
@@ -266,6 +280,7 @@
        <if test="transactionNames != null and transactionNames != '' ">,#{transactionNames}</if>
        <if test="openid != null and openid != '' ">,#{openid}</if>
        <if test="isDivisionHead != null and isDivisionHead != '' ">,#{isDivisionHead}</if>
        <if test="mattersIds != null and mattersIds != '' ">,#{mattersIds}</if>
        )
    </insert>
@@ -304,6 +319,7 @@
            <if test="transactionNames != null and transactionNames != '' ">,transaction_names=#{transactionNames}</if>
            <if test="openid != null and openid != '' ">,openid=#{openid}</if>
            <if test="isDivisionHead != null and isDivisionHead != '' ">,is_division_head=#{isDivisionHead}</if>
            <if test="mattersIds != null and mattersIds != '' ">,matters_ids=#{mattersIds}</if>
            ,update_time=sysdate()
        </set>
        where user_id= #{userId}