xuhy
2025-04-27 5fa6e6f8410ef9d057174bcff2a3c5038c54a551
ruoyi-system/src/main/resources/mapper/system/TTenantMapper.xml
@@ -70,5 +70,70 @@
        </if>
        AND t1.disabled = ${@com.ruoyi.common.enums.DisabledEnum@NO.getCode()}
    </select>
    <select id="examineList" resultType="com.ruoyi.system.vo.ExamineVO">
        select t1.* from t_contract t1
        <where>
            <if test="query.status == 1">
                AND t1.status = 2
            </if>
            <if test="query.status == 2">
                AND (t1.status !=1 and t1.status !=2)
            </if>
            <if test="query.status == 3">
                AND t1.create_by = #{query.userName}
            </if>
            <if test="query.time != null and query.time != ''">
                <choose>
                    <when test="query.time == 1">
                        AND t1.create_time &gt;= DATE_SUB(NOW(), INTERVAL 1 DAY)
                    </when>
                    <when test="query.time == 2">
                        AND t1.create_time &gt;= DATE_SUB(NOW(), INTERVAL 7 DAY)
                    </when>
                    <when test="query.time == 3">
                        AND t1.create_time &gt;= DATE_SUB(NOW(), INTERVAL 30 DAY)
                    </when>
                </choose>
            </if>
        </where>
        <choose>
            <when test="query.sort != null and query.sort != ''">
                <choose>
                    <when test="query.sort == 1">
                        ORDER BY t1.create_time DESC
                    </when>
                    <when test="query.sort == 2">
                        ORDER BY t1.create_time ASC
                    </when>
                </choose>
            </when>
            <otherwise>
                ORDER BY t1.create_time DESC
            </otherwise>
        </choose>
    </select>
    <select id="pageListByBusinessDeptId" resultType="com.ruoyi.system.vo.TenantVO">
        SELECT * FROM (
        SELECT tt.id, tt.resident_name, tt.checkIn_time, tt.tenant_attributes, tt.tenant_type, tt.phone,
        tt.id_card, tt.email,
        tt.bank_number, tt.mail_address, tt.create_time, tt.disabled,tt.account
        FROM t_tenant tt
        WHERE EXISTS (
        SELECT 1
        FROM t_contract tc
        WHERE tc.tenant_id = tt.id AND tc.business_dept_id = #{query.businessDeptId}
        )
        ) AS te
        <where>
            <if test="query.residentName != null and query.residentName != ''">
                AND te.resident_name LIKE concat('%',#{query.residentName},'%')
            </if>
            <if test="query.phone != null and query.phone != ''">
                AND te.phone LIKE concat('%',#{query.phone},'%')
            </if>
            AND te.disabled = ${@com.ruoyi.common.enums.DisabledEnum@NO.getCode()}
        </where>
        ORDER BY te.create_time DESC
    </select>
</mapper>