xuhy
2025-09-05 09e0581125bb2fb26395ac1b8e8429201b6f7871
ruoyi-system/src/main/resources/mapper/system/TSysAppUserMapper.xml
@@ -11,6 +11,8 @@
        <result column="sex" property="sex" />
        <result column="open_id" property="openId" />
        <result column="chronic_disease_id" property="chronicDiseaseId" />
        <result column="status" property="status" />
        <result column="last_reminder_time" property="lastReminderTime" />
        <result column="create_time" property="createTime" />
        <result column="update_time" property="updateTime" />
        <result column="create_by" property="createBy" />
@@ -20,20 +22,20 @@
    <!-- 通用查询结果列 -->
    <sql id="Base_Column_List">
        id, nick_name, phone, birth_time, sex, open_id,chronic_disease_id, create_time, update_time, create_by, update_by, disabled
        id, nick_name, phone, birth_time, sex, open_id,chronic_disease_id,status,last_reminder_time, create_time, update_time, create_by, update_by, disabled
    </sql>
    <select id="pageList" resultType="com.ruoyi.system.vo.TSysAppUserVO">
        select tsau.id, tsau.nick_name, tsau.phone, tsau.birth_time, tsau.sex, tsau.open_id,
               tsau.chronic_disease_id, tsau.create_time, tsau.update_time, tsau.create_by,
               tsau.chronic_disease_id,tsau.status,tsau.last_reminder_time, tsau.create_time, tsau.update_time, tsau.create_by,
               tsau.update_by, tsau.disabled, tsi.lastInspectionTime
        from t_sys_app_user tsau
        left join (select id,app_user_id, max(check_time) as lastInspectionTime from t_sys_inspection limit 1) tsi on tsi.app_user_id = tsau.id
        <where>
            <if test="query.phone != null and query.phone != ''">
                and phone = #{query.phone}
                and tsau.phone = #{query.phone}
            </if>
            <if test="query.nickName != null and query.nickName != ''">
                and nick_name like concat('%',#{query.nickName},'%')
                and tsau.nick_name like concat('%',#{query.nickName},'%')
            </if>
            <if test="query.startTime != null and query.startTime != '' and query.endTime != null and query.endTime != ''">
                and tsau.id in (select app_user_id from t_sys_inspection where check_time between #{query.startTime} and #{query.endTime})
@@ -51,5 +53,24 @@
        </where>
        ORDER BY tsau.create_time DESC
    </select>
    <select id="pageChronicDiseaseUserList" resultType="com.ruoyi.system.vo.TSysAppUserVO">
        select tsau.id, tsau.nick_name, tsau.phone, tsau.birth_time, tsau.sex, tsau.open_id,
               tsau.chronic_disease_id,tsau.status,tsau.last_reminder_time, tsau.create_time, tsau.update_time, tsau.create_by,
               tsau.update_by, tsau.disabled
        from t_sys_app_user tsau
        <where>
            <if test="query.phone != null and query.phone != ''">
                and tsau.phone = #{query.phone}
            </if>
            <if test="query.nickName != null and query.nickName != ''">
                and tsau.nick_name like concat('%',#{query.nickName},'%')
            </if>
            <if test="query.inspectionId != null and query.inspectionId != ''">
                and FIND_IN_SET(#{query.inspectionId},tsau.chronic_disease_id)
            </if>
            AND tsau.disabled = ${@com.ruoyi.common.enums.DisabledEnum@NO.getCode()}
        </where>
        ORDER BY tsau.create_time DESC
    </select>
</mapper>