<?xml version="1.0" encoding="UTF-8"?>
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
<mapper namespace="com.ruoyi.bussiness.mapper.PlacementApplyRecordMapper">
|
|
<select id="queryMainData" resultType="com.ruoyi.bussiness.object.response.screen.ScreenResponse">
|
SELECT
|
-- 本季度补偿金额
|
COALESCE(SUM(CASE
|
WHEN FIND_IN_SET(#{month},t1.cycle) and t2.`status` = 1
|
THEN t1.quarter_pay_amount
|
ELSE 0 END), 0) AS monthCompensationAmount,
|
|
-- 本季度补偿金额
|
COALESCE(SUM(CASE
|
WHEN FIND_IN_SET(#{lastMonth},cycle)
|
THEN t1.quarter_pay_amount
|
ELSE 0 END), 0) AS lastMonthCompensationAmount,
|
|
-- 本季度补偿金额
|
COALESCE(SUM(CASE
|
WHEN FIND_IN_SET(#{nextMonth},cycle)
|
THEN t1.quarter_pay_amount
|
ELSE 0 END), 0) AS nextMonthCompensationAmount,
|
|
-- 总户数(根据查询中所有涉及到的 placement_batch_id 汇总)
|
-- 总户数(根据查询中所有涉及到的 placement_batch_id 汇总)
|
COALESCE(
|
( SELECT count(1)
|
|
FROM t_placement_apply_record t1
|
JOIN t_placement_apply t2 ON t1.placement_apply_id = t2.id
|
WHERE t2.status = 1
|
|
), 0) AS houseHoldCount
|
|
FROM t_placement_batch_household t1
|
JOIN t_placement_batch t2 ON t1.placement_batch_id = t2.id
|
WHERE t2.status = 1
|
</select>
|
|
<select id="countPassIdCard" resultType="int" >
|
select ifnull(count(1),0) as `count`
|
FROM t_placement_apply_record t1
|
left JOIN t_placement_apply t2 ON t1.placement_apply_id = t2.id
|
where t2.status = 1 and t1.id_card = #{idCard}
|
</select>
|
|
<select id="getRecordsByCardIds" resultType="com.ruoyi.bussiness.domain.PlacementApplyRecord">
|
select t1.*
|
FROM t_placement_apply_record t1
|
JOIN t_placement_apply t2 ON t1.placement_apply_id = t2.id
|
WHERE t2.status = 1
|
and t1.id_card in
|
<foreach collection="idCards" item="card" open="(" separator="," close=")">
|
#{card}
|
</foreach>
|
</select>
|
|
<select id="countError" resultType="java.util.Map">
|
SELECT street,(id_card_exists_warn+id_card_no_warn+wait_family_names_warn+wait_family_names_no_warn+
|
wait_family_area_warn+compensation_amount_warn+compensation_sum_warn+quarter_pay_amount_warn+subsidy_amount_warn) as errorNum,
|
sum(id_card_exists_warn+id_card_no_warn+wait_family_names_warn+wait_family_names_no_warn) as settleNum,
|
sum(wait_family_area_warn) as areaNum,
|
sum(compensation_sum_warn+quarter_pay_amount_warn+subsidy_amount_warn) compensationNum
|
|
FROM t_placement_apply_record where placement_apply_id = #{applyId}
|
GROUP BY street
|
</select>
|
|
<select id="getRecordsByCardId" resultType="com.ruoyi.bussiness.domain.PlacementApplyRecord">
|
select t1.*
|
FROM t_placement_apply_record t1
|
JOIN t_placement_apply t2 ON t1.placement_apply_id = t2.id
|
WHERE t2.status = 1
|
and t1.id_card = #{idCard} limit 1
|
</select>
|
</mapper>
|