|
|
@ -295,15 +295,26 @@ |
|
|
|
GROUP BY stakeMarkId |
|
|
|
</select> |
|
|
|
<select id="selectWarningMarkDayOptimize" resultType="java.util.HashMap"> |
|
|
|
SELECT DISTINCT m.stake_mark stakeMarkId, |
|
|
|
(SELECT count( 0 ) FROM dc_warning w WHERE w.stake_mark = m.stake_mark |
|
|
|
<if test = 'type == "day"' >and DATE(w.warning_time)= DATE_FORMAT(#{warningTime},'%Y-%m-%d')</if> |
|
|
|
<if test = 'type == "month"' >and DATE_FORMAT(w.warning_time,'%Y-%m') =DATE_FORMAT(#{warningTime},'%Y-%m')</if> |
|
|
|
<if test = 'type == "year"' >and YEAR(w.warning_time) =DATE_FORMAT(#{warningTime},'%Y')</if> |
|
|
|
AND w.direction = #{direction}) sectionNumber FROM dc_stake_mark AS m |
|
|
|
SELECT DISTINCT m.stake_mark AS stakeMarkId,COALESCE(wc.count, 0) AS sectionNumber FROM |
|
|
|
dc_stake_mark AS m |
|
|
|
LEFT JOIN ( SELECT stake_mark, COUNT(0) AS count FROM dc_warning WHERE |
|
|
|
<if test = 'type == "day"' > DATE(warning_time)= DATE_FORMAT(#{warningTime},'%Y-%m-%d')</if> |
|
|
|
<if test = 'type == "month"' > DATE_FORMAT(warning_time,'%Y-%m') =DATE_FORMAT(#{warningTime},'%Y-%m')</if> |
|
|
|
<if test = 'type == "year"' > YEAR(warning_time) =DATE_FORMAT(#{warningTime},'%Y')</if> |
|
|
|
AND direction = #{direction} GROUP BY stake_mark ) AS wc ON m.stake_mark = wc.stake_mark |
|
|
|
WHERE m.section_id = #{sectionId} |
|
|
|
HAVING sectionNumber!=0 |
|
|
|
</select> |
|
|
|
HAVING sectionNumber != 0; |
|
|
|
</select> |
|
|
|
<!-- <select id="selectWarningMarkDayOptimize" resultType="java.util.HashMap">--> |
|
|
|
<!-- SELECT DISTINCT m.stake_mark stakeMarkId,--> |
|
|
|
<!-- (SELECT count( 0 ) FROM dc_warning w WHERE w.stake_mark = m.stake_mark--> |
|
|
|
<!-- <if test = 'type == "day"' >and DATE(w.warning_time)= DATE_FORMAT(#{warningTime},'%Y-%m-%d')</if>--> |
|
|
|
<!-- <if test = 'type == "month"' >and DATE_FORMAT(w.warning_time,'%Y-%m') =DATE_FORMAT(#{warningTime},'%Y-%m')</if>--> |
|
|
|
<!-- <if test = 'type == "year"' >and YEAR(w.warning_time) =DATE_FORMAT(#{warningTime},'%Y')</if>--> |
|
|
|
<!-- AND w.direction = #{direction}) sectionNumber FROM dc_stake_mark AS m--> |
|
|
|
<!-- WHERE m.section_id = #{sectionId}--> |
|
|
|
<!-- HAVING sectionNumber!=0--> |
|
|
|
<!-- </select>--> |
|
|
|
|
|
|
|
|
|
|
|
</mapper> |