zhongrj
2024-01-12 ea2efbd460ed26706bb6c956828cbb119dd1e51b
src/main/java/org/springblade/modules/house/mapper/HouseholdMapper.xml
@@ -718,7 +718,7 @@
    </select>
    <select id="getKeynotePersonnelPage" resultType="org.springblade.modules.house.vo.HouseholdVO">
    <select id="getKeynotePersonnelPage" resultMap="householdPageAndLabelMap">
        SELECT
        jh.id,
@@ -828,9 +828,111 @@
            <if test="household.aoiCode!=null and household.aoiCode!=''">
                and jhs.district_code = #{household.aoiCode}
            </if>
            AND EXISTS (
            SELECT
            *
            FROM
            jczz_user_house_label juhl
            LEFT JOIN jczz_label jl ON juhl.label_id = jl.id
            WHERE
            juhl.lable_type = 1
            AND jl.parent_id = 103
            AND juhl.household_id = jh.id
            AND juhl.label_id IS NOT NULL
            )
            and jh.is_deleted = 0
            order by jh.create_time desc
        </where>
    </select>
    <!--根据人员标签编号集合查询对应的住户(按颜色区分近多少天没有发过任务的住户)-->
    <select id="getHouseholdListByParam" resultType="org.springblade.modules.house.vo.HouseholdVO">
        select jh.* from jczz_household jh
        left join jczz_user_house_label juhl on juhl.household_id = jh.id
        where jh.is_deleted = 0
        and juhl.lable_type = 1
        and juhl.color = '#30D17C'
        and jh.id in (
        select household_id from jczz_grid_work_log where is_deleted = 0 and source = 2 and TIMESTAMPDIFF( day, now(), create_time )=30
        )
        <choose>
            <when test="list!=null and list.size()>0">
                and juhl.label_id in
                <foreach collection="list" item="id" separator="," open="(" close=")">
                    #{id}
                </foreach>
            </when>
            <otherwise>
                and juhl.label_id in ('')
            </otherwise>
        </choose>
        union all
        (
        select jh.* from jczz_household jh
        left join jczz_user_house_label juhl on juhl.household_id = jh.id
        where jh.is_deleted = 0
        and juhl.lable_type = 1
        and juhl.color = '#FFB42B'
        and jh.id in (
        select household_id from jczz_grid_work_log where is_deleted = 0 and source = 2 and TIMESTAMPDIFF( day, now(), create_time )=14
        )
        <choose>
            <when test="list!=null and list.size()>0">
                and juhl.label_id in
                <foreach collection="list" item="id" separator="," open="(" close=")">
                    #{id}
                </foreach>
            </when>
            <otherwise>
                and juhl.label_id in ('')
            </otherwise>
        </choose>
        )
        union all
        (
        select jh.* from jczz_household jh
        left join jczz_user_house_label juhl on juhl.household_id = jh.id
        where jh.is_deleted = 0
        and juhl.lable_type = 1
        and juhl.color = '#EA1F1F'
        and jh.id in (
        select household_id from jczz_grid_work_log where is_deleted = 0 and source = 2 and TIMESTAMPDIFF( day, now(), create_time )=7
        )
        <choose>
            <when test="list!=null and list.size()>0">
                and juhl.label_id in
                <foreach collection="list" item="id" separator="," open="(" close=")">
                    #{id}
                </foreach>
            </when>
            <otherwise>
                and juhl.label_id in ('')
            </otherwise>
        </choose>
        )
        union all
        (
        select jh.* from jczz_household jh
        left join jczz_user_house_label juhl on juhl.household_id = jh.id
        where jh.is_deleted = 0 and juhl.lable_type = 1
        and jh.id not in (
        select household_id from jczz_grid_work_log where is_deleted = 0
        and household_id is not null
        and source = 2
        group by household_id
        )
        <choose>
            <when test="list!=null and list.size()>0">
                and juhl.label_id in
                <foreach collection="list" item="id" separator="," open="(" close=")">
                    #{id}
                </foreach>
            </when>
            <otherwise>
                and juhl.label_id in ('')
            </otherwise>
        </choose>
        )
    </select>
</mapper>