|
@@ -22,8 +22,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
GROUP BY a.id
|
|
|
</select>
|
|
|
|
|
|
- <select id="getOrderList" parameterType="CenterdataTHousingconstructionSteelcylinder" resultType="map">
|
|
|
- SELECT concat(a.`month`,'月') `month`, IFNULL(b.num, 0) num
|
|
|
+ <!--SELECT concat(a.`month`,'月') `month`, IFNULL(b.num, 0) num
|
|
|
FROM (SELECT 1 AS `month` UNION
|
|
|
SELECT 2 AS `month` UNION
|
|
|
SELECT 3 AS `month` UNION
|
|
@@ -49,6 +48,53 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
</if>
|
|
|
${params.dataScope}
|
|
|
GROUP BY MONTH( b.sign_time )) b on a.`month` = b.`month`
|
|
|
+ ORDER BY a.`month`-->
|
|
|
+ <select id="getOrderList" parameterType="CenterdataTHousingconstructionSteelcylinder" resultType="map">
|
|
|
+ SELECT
|
|
|
+ concat( a.`month`, '月' ) `month`,
|
|
|
+ IFNULL( b.num, 0 ) num
|
|
|
+ FROM (
|
|
|
+ SELECT 1 AS `month`
|
|
|
+ UNION
|
|
|
+ SELECT 2 AS `month`
|
|
|
+ UNION
|
|
|
+ SELECT 3 AS `month`
|
|
|
+ UNION
|
|
|
+ SELECT 4 AS `month`
|
|
|
+ UNION
|
|
|
+ SELECT 5 AS `month`
|
|
|
+ UNION
|
|
|
+ SELECT 6 AS `month`
|
|
|
+ UNION
|
|
|
+ SELECT 7 AS `month`
|
|
|
+ UNION
|
|
|
+ SELECT 8 AS `month`
|
|
|
+ UNION
|
|
|
+ SELECT 9 AS `month`
|
|
|
+ UNION
|
|
|
+ SELECT 10 AS `month`
|
|
|
+ UNION
|
|
|
+ SELECT 11 AS `month`
|
|
|
+ UNION
|
|
|
+ SELECT 12 AS `month`
|
|
|
+ ) a
|
|
|
+ LEFT JOIN (
|
|
|
+ SELECT a.`year_month`, sum( a.count ) AS num FROM (
|
|
|
+ SELECT MONTH ( sign_time ) AS `year_month`, steelcylinder_id, COUNT(*) AS count
|
|
|
+ FROM centerdata_t_housingconstruction_steelcylinder_log
|
|
|
+ WHERE YEAR ( sign_time ) = YEAR ( CURRENT_DATE )
|
|
|
+ AND steelcylinder_id IN (
|
|
|
+ SELECT id FROM centerdata_t_housingconstruction_steelcylinder a
|
|
|
+ <where>
|
|
|
+ <if test="enterpriseId != null and enterpriseId != ''">
|
|
|
+ and enterprise_id = #{enterpriseId}
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ )
|
|
|
+ GROUP BY DATE_FORMAT( sign_time, '%Y-%m' ),steelcylinder_id
|
|
|
+ ORDER BY`year_month`, steelcylinder_id
|
|
|
+ ) a GROUP BY a.`year_month`
|
|
|
+ ) b ON a.`month` = b.`year_month`
|
|
|
ORDER BY a.`month`
|
|
|
</select>
|
|
|
|