lidongdong
2022-10-11 2e5ffea1fc7263fff8e3b6a87707233597c07c8f
flower_city/src/main/resources/mapper/GuideRepairOrderMapper.xml
@@ -138,10 +138,63 @@
        where  id= #{id}
    </update>
    <select id="countNum" resultType="integer">
        select count(id) from automessage_guide_repair_order
    </select>
    <select id="countStatisticsNum" parameterType="string" resultType="integer">
        select count(id) from automessage_guide_repair_order
        <where>
            <if test="state != null and state != ''">
                automessage_guide_repair_order.state=#{state}
            </if>
            <if test="ids != null">
                and department_id IN
                <foreach collection="ids" item="param"  open="(" close=")" separator=",">
                    #{param}
                </foreach>
            </if>
            <if test="time != null and time == 1 ">
                and to_days(automessage_guide_repair_order.create_time) = to_days(now())
            </if>
            <if test="time != null and time == 2 ">
                and TO_DAYS(NOW()) - TO_DAYS(automessage_guide_repair_order.create_time) = 1
            </if>
            <if test="time != null and time == 3 ">
                and DATE_FORMAT( automessage_guide_repair_order.create_time, '%Y%m' ) = DATE_FORMAT( CURDATE( ) , '%Y%m' )
            </if>
            <if test="time != null and time == 4 ">
                and YEAR(automessage_guide_repair_order.create_time)=YEAR(NOW())
            </if>
        </where>
    </select>
    <select id="countListNum"  resultType="com.dg.core.db.gen.entity.CountListNum">
        select create_time,count(id) as num from automessage_guide_repair_order
        <where>
            <if test="state != null and state != ''">
                automessage_guide_repair_order.state=#{state}
            </if>
            <if test="ids != null">
                and department_id IN
                <foreach collection="ids" item="param"  open="(" close=")" separator=",">
                    #{param}
                </foreach>
            </if>
        </where>
        GROUP BY
            date_format(create_time,'%y%m%d')
        ORDER BY
            create_time DESC
            LIMIT #{time}
    </select>
</mapper>