select
d.sur_id,
a.user_id,
a.pf_id,
a.team_id as teamid,
b.user_name as tdfzr,
sum(c.post_num) as tdrs,
d.expedition_companyName as dcmb,
a.enter_time as qdsj
from law_team_setting as a
LEFT JOIN law_staff as b ON a.user_id = b.user_acc
LEFT JOIN law_post_info as c ON a.team_id = c.team_id
LEFT JOIN law_survey as d ON a.team_sur_id = d.sur_id
group by a.team_id
HAVING 1 = 1
<if test="user != null and user != '' ">
AND a.user_id = concat(#{user, jdbcType=VARCHAR})
</if>
<if test="target != null and target != '' ">
AND d.sur_id = concat(#{target, jdbcType=VARCHAR})
</if>
<if test="timeOne != null and timeOne != '' ">
<![CDATA[ AND qdsj >= #{timeOne} ]]>
</if>
<if test="timeTwo != null and timeTwo != '' ">
<![CDATA[ AND qdsj <= #{timeTwo} ]]>
</if>
and a.pf_id = #{pfId,jdbcType=VARCHAR}
LIMIT #{startRow},10
select count(*) TotalNum from (
select
d.sur_id,
a.user_id,
a.pf_id,
a.team_id,
b.user_name as tdfzr,
sum(c.post_num) as tdrs,
d.expedition_companyName as dcmb,
a.enter_time as qdsj
from law_team_setting as a
LEFT JOIN law_staff as b ON a.user_id = b.user_acc
LEFT JOIN law_post_info as c ON a.team_id = c.team_id
LEFT JOIN law_survey as d ON a.team_sur_id = d.sur_id
group by a.team_id
HAVING 1 = 1
<if test="user != null and user != '' ">
AND a.user_id = concat(#{user, jdbcType=VARCHAR})
</if>
<if test="target != null and target != '' ">
AND d.sur_id = concat(#{target, jdbcType=VARCHAR})
</if>
<if test="timeOne != null and timeOne != '' ">
<![CDATA[ AND qdsj >= #{timeOne} ]]>
</if>
<if test="timeTwo != null and timeTwo != '' ">
<![CDATA[ AND qdsj <= #{timeTwo} ]]>
</if>
and a.pf_id = #{pfId,jdbcType=VARCHAR}
) as info
d.sur_id,
a.user_id,
a.pf_id,
a.team_id as teamid,
b.user_name as tdfzr,
sum(c.post_num) as tdrs,
d.expedition_companyName as dcmb,
a.enter_time as qdsj
from law_team_setting as a
LEFT JOIN law_staff as b ON a.user_id = b.user_acc
LEFT JOIN law_post_info as c ON a.team_id = c.team_id
LEFT JOIN law_survey as d ON a.team_sur_id = d.sur_id
group by a.team_id
HAVING 1 = 1
<if test="user != null and user != '' ">
AND a.user_id = concat(#{user, jdbcType=VARCHAR})
</if>
<if test="target != null and target != '' ">
AND d.sur_id = concat(#{target, jdbcType=VARCHAR})
</if>
<if test="timeOne != null and timeOne != '' ">
<![CDATA[ AND qdsj >= #{timeOne} ]]>
</if>
<if test="timeTwo != null and timeTwo != '' ">
<![CDATA[ AND qdsj <= #{timeTwo} ]]>
</if>
and a.pf_id = #{pfId,jdbcType=VARCHAR}
LIMIT #{startRow},10
select count(*) TotalNum from (
select
d.sur_id,
a.user_id,
a.pf_id,
a.team_id,
b.user_name as tdfzr,
sum(c.post_num) as tdrs,
d.expedition_companyName as dcmb,
a.enter_time as qdsj
from law_team_setting as a
LEFT JOIN law_staff as b ON a.user_id = b.user_acc
LEFT JOIN law_post_info as c ON a.team_id = c.team_id
LEFT JOIN law_survey as d ON a.team_sur_id = d.sur_id
group by a.team_id
HAVING 1 = 1
<if test="user != null and user != '' ">
AND a.user_id = concat(#{user, jdbcType=VARCHAR})
</if>
<if test="target != null and target != '' ">
AND d.sur_id = concat(#{target, jdbcType=VARCHAR})
</if>
<if test="timeOne != null and timeOne != '' ">
<![CDATA[ AND qdsj >= #{timeOne} ]]>
</if>
<if test="timeTwo != null and timeTwo != '' ">
<![CDATA[ AND qdsj <= #{timeTwo} ]]>
</if>
and a.pf_id = #{pfId,jdbcType=VARCHAR}
) as info