luo
2023-12-09 cb5ddf074d60b72e35ee4bafaec95530f53d1839
guns-management/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/HouseResourceMapper.xml
@@ -412,6 +412,53 @@
        </where>
    </select>
    <select id="reprotList" resultType="com.stylefeng.guns.modular.system.dto.THouseResource">
        select * from (
        SELECT hs.insert_time as insertTime, hs.id, hs.cell_name as cellName, hs.house_address as houseAddress,
        hs.data_type as dataType,
        CASE
        WHEN hs.is_manage IS NULL AND ap.user_type = 2 THEN 2
        WHEN hs.is_manage IS NULL AND ap.user_type = 3 THEN 3
        ELSE hs.is_manage
        END AS isManage,
        IFNULL(ap.nickname,su.`name`) as name, IFNULL(ap.phone,su.phone) as phone,
        hs.house_model as houseModel, hs.building_orientation as buildingOrientation, hs.sale_amount as saleAmount,
        hs.house_area as houseArea , hs.status,hr.content,hr.audit,hr.back_reason as backReason,hr.back_date as backDate
        from t_report_house_resource hr
        LEFT JOIN t_house_resource hs on hr.house_resource_id = hs.id
        LEFT JOIN t_app_user ap ON hs.insert_user_id = ap.id
        LEFT JOIN sys_user su ON hs.insert_user_id = su.id AND hs.is_manage = 1
        where     hs.is_delete = 0 and hs.auth_status = 2
        ) a
        <where>
            <if test="null != id">
                and a.id = #{id}
            </if>
            <if test="null != cellName and '' != cellName">
                and a.cellName like CONCAT('%', #{cellName}, '%')
            </if>
            <if test="null != dataType">
                and a.dataType = #{dataType}
            </if>
            <if test="null != isManage">
                and a.isManage = #{isManage}
            </if>
            <if test="null != name and '' != name">
                and a.name like CONCAT('%', #{name}, '%')
            </if>
            <if test="null != min and '' != min">
                and a.saleAmount between #{min} and #{max}
            </if>
            <if test="null != size and '' != size">
                and a.houseArea = #{size}
            </if>
        </where>
    </select>
</mapper>