合并代码

This commit is contained in:
2022-11-23 19:05:16 +08:00
parent dce2972202
commit 9b2759f71e
44 changed files with 969 additions and 975 deletions

View File

@@ -22,13 +22,13 @@ public interface PwRStatOrgClassifiedMapper {
* @param deptIdList 单位id
* @param startTime 开始时间
* @param endTime 结束时间
* @param monitorSort 监测点类别
* @param distributionPoint 配网id
* @return 配网区域暂态事件分类统计(年)
*/
List<RStatEventOrgPO> getYearInfo(@Param("deptIdList") List<String> deptIdList,
@Param("startTime") String startTime,
@Param("endTime") String endTime,
@Param("monitorSort") List<String> monitorSort);
@Param("distributionPoint")String distributionPoint);
/**
* 获取配网区域暂态事件分类统计(月)
@@ -36,13 +36,13 @@ public interface PwRStatOrgClassifiedMapper {
* @param deptIdList 单位id
* @param startTime 开始时间
* @param endTime 结束时间
* @param monitorSort 监测点类别
* @param distributionPoint 配网id
* @return 配网区域暂态事件分类统计(月)
*/
List<RStatEventOrgPO> getQuarterInfo(@Param("deptIdList") List<String> deptIdList,
@Param("startTime") String startTime,
@Param("endTime") String endTime,
@Param("monitorSort") List<String> monitorSort);
@Param("distributionPoint") String distributionPoint);
/**
* 获取配网区域暂态事件分类统计(月)
@@ -50,11 +50,11 @@ public interface PwRStatOrgClassifiedMapper {
* @param deptIdList 单位id
* @param startTime 开始时间
* @param endTime 结束时间
* @param monitorSort 监测点类别
* @param distributionPoint 配网id
* @return 配网区域暂态事件分类统计(月)
*/
List<RStatEventOrgPO> getMonthInfo(@Param("deptIdList") List<String> deptIdList,
@Param("startTime") String startTime,
@Param("endTime") String endTime,
@Param("monitorSort") List<String> monitorSort);
@Param("distributionPoint") String distributionPoint);
}

View File

@@ -21,13 +21,13 @@ public interface PwRStatOrgMapper {
* @param deptIdList 单位id
* @param startTime 开始时间
* @param endTime 结束时间
* @param monitorSort 监测点类别
* @param distributionPoint 配网id
* @return 配网区域暂态指标统计(年)
*/
List<RStatOrgPO> getYearInfo(@Param("deptIdList") List<String> deptIdList,
@Param("startTime") String startTime,
@Param("endTime") String endTime,
@Param("monitorSort") List<String> monitorSort);
@Param("distributionPoint") String distributionPoint);
/**
* 获取配网区域暂态指标统计(季)
@@ -35,13 +35,13 @@ public interface PwRStatOrgMapper {
* @param deptIdList 单位id
* @param startTime 开始时间
* @param endTime 结束时间
* @param monitorSort 监测点类别
* @param distributionPoint 配网id
* @return 配网区域暂态指标统计(季)
*/
List<RStatOrgPO> getQuarterInfo(@Param("deptIdList") List<String> deptIdList,
@Param("startTime") String startTime,
@Param("endTime") String endTime,
@Param("monitorSort") List<String> monitorSort);
@Param("distributionPoint") String distributionPoint);
/**
* 获取配网区域暂态指标统计(月)
@@ -49,11 +49,11 @@ public interface PwRStatOrgMapper {
* @param deptIdList 单位id
* @param startTime 开始时间
* @param endTime 结束时间
* @param monitorSort 监测点类别
* @param distributionPoint 配网id
* @return 配网区域暂态指标统计(月)
*/
List<RStatOrgPO> getMonthInfo(@Param("deptIdList") List<String> deptIdList,
@Param("startTime") String startTime,
@Param("endTime") String endTime,
@Param("monitorSort") List<String> monitorSort);
@Param("distributionPoint") String distributionPoint);
}

View File

@@ -23,7 +23,8 @@ public interface PwRmpEventDetailMapper {
* @author yzh
* @date 2022/10/31
*/
List<RmpEventDetailPO> getPwRmpEventDetail(UniversalFrontEndParam param);
List<RmpEventDetailPO> getPwRmpEventDetail(@Param("param") UniversalFrontEndParam param,
@Param("monitorIdList") List<String> monitorIdList);
/**
* 获取暂态事件明细

View File

@@ -22,15 +22,12 @@
rseo.data_type AS dataType
</sql>
<sql id="query_where">
rso.data_type = 02
AND rseo.data_type = 02
rso.data_type = #{distributionPoint}
AND rseo.data_type = #{distributionPoint}
AND rso.org_no IN
<foreach collection="deptIdList" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
<if test="monitorSort != null and monitorSort.size() >0">
</if>
<if test="startTime != null and startTime != ''">
AND DATE_FORMAT(rso.data_date, '%Y-%m-%d') &gt;= DATE_FORMAT(#{startTime}, '%Y-%m-%d')
</if>

View File

@@ -15,7 +15,7 @@
data_Type AS dataType
</sql>
<sql id="query_where">
data_type = 02
data_type = #{distributionPoint}
AND org_no IN
<foreach collection="deptIdList" item="item" open="(" close=")" separator=",">
#{item}
@@ -26,12 +26,6 @@
<if test="endTime != null and endTime != ''">
AND DATE_FORMAT(Data_Date, '%Y-%m-%d') &lt;= DATE_FORMAT(#{endTime}, '%Y-%m-%d')
</if>
<if test="monitorSort != null and monitorSort.size() != 0">
AND measurement_type_class IN
<foreach collection="monitorSort" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
</sql>

View File

@@ -5,17 +5,28 @@
<!--获取配网暂态事件明细-->
<select id="getPwRmpEventDetail" resultType="com.njcn.event.pojo.po.RmpEventDetailPO">
SELECT
event_id AS eventId,
measurement_point_id AS measurementPointId,
event_type AS eventType,
start_time AS startTime,
duration AS duration,
feature_amplitude AS featureAmplitude,
phase AS phase,
event_describe AS eventDescribe,
wave_path AS wavePath
event_id AS eventId,
measurement_point_id AS measurementPointId,
event_type AS eventType,
start_time AS startTime,
duration AS duration,
feature_amplitude AS featureAmplitude,
phase AS phase,
event_describe AS eventDescribe,
wave_path AS wavePath
FROM
r_mp_event_detail
r_mp_event_detail
WHERE
measurement_point_id IN
<foreach collection="monitorIdList" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
<if test="param.startTime != null and param.startTime != ''">
AND DATE_FORMAT(start_time, '%Y-%m-%d') &gt;= DATE_FORMAT(#{param.startTime}, '%Y-%m-%d')
</if>
<if test="param.endTime != null and param.endTime != ''">
AND DATE_FORMAT(start_time, '%Y-%m-%d') &lt;= DATE_FORMAT(#{param.endTime}, '%Y-%m-%d')
</if>
</select>
<select id="getDetailsOfTransientEvents" resultType="com.njcn.event.pojo.po.RmpEventDetailPO">

View File

@@ -1,7 +1,11 @@
package com.njcn.event.mapper.majornetwork;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.njcn.event.pojo.param.StatSubstationBizBaseParam;
import com.njcn.event.pojo.po.RStatEventD;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* <p>
@@ -13,4 +17,8 @@ import com.njcn.event.pojo.po.RStatEventD;
*/
public interface RStatEventDMapper extends BaseMapper<RStatEventD> {
List<RStatEventD> selectInfoList(@Param("param") StatSubstationBizBaseParam param,
@Param("dataType") String dataType,
@Param("measurementId") String measurementId,
@Param("harmonicId") String harmonicId);
}

View File

@@ -1,7 +1,12 @@
package com.njcn.event.mapper.majornetwork;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.njcn.event.pojo.param.StatSubstationBizBaseParam;
import com.njcn.event.pojo.po.RStatEventM;
import com.njcn.event.pojo.po.RStatEventQ;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* <p>
@@ -13,4 +18,12 @@ import com.njcn.event.pojo.po.RStatEventM;
*/
public interface RStatEventMMapper extends BaseMapper<RStatEventM> {
/**
* 监测点数据查询
* @param param
* @param dataType
* @return
*/
List<RStatEventM> selectInfoList(@Param("param") StatSubstationBizBaseParam param,
@Param("dataType") String dataType);
}

View File

@@ -18,13 +18,13 @@ public interface RStatEventOrgMapper {
/**
* 获取年区域暂态指标分类统计表
*
* @param deptIds 部门id
* @param deptCode 单位code
* @param startTime 开始时间
* @param endTime 结束时间
* @param mainnetPointId 主网字典id
* @return 年区域暂态指标分类统计表
*/
List<RStatEventOrgPO> getYearRStatEventOrgInfo(@Param("deptIds") List<String> deptIds,
List<RStatEventOrgPO> getYearRStatEventOrgInfo(@Param("deptCode") List<String> deptCode,
@Param("startTime") String startTime,
@Param("endTime") String endTime,
@Param("mainnetPointId") String mainnetPointId);
@@ -32,13 +32,13 @@ public interface RStatEventOrgMapper {
/**
* 获取季区域暂态指标分类统计表
*
* @param deptIds 部门id
* @param deptCode 单位code
* @param startTime 开始时间
* @param endTime 结束时间
* @param mainnetPointId 主网字典id
* @return 季区域暂态指标分类统计表
*/
List<RStatEventOrgPO> getQuarterRStatEventOrgInfo(@Param("deptIds") List<String> deptIds,
List<RStatEventOrgPO> getQuarterRStatEventOrgInfo(@Param("deptCode") List<String> deptCode,
@Param("startTime") String startTime,
@Param("endTime") String endTime,
@Param("mainnetPointId") String mainnetPointId);
@@ -46,13 +46,13 @@ public interface RStatEventOrgMapper {
/**
* 获取月区域暂态指标分类统计表
*
* @param deptIds 部门id
* @param deptCode 单位code
* @param startTime 开始时间
* @param endTime 结束时间
* @param mainnetPointId 主网字典id
* @return 月区域暂态指标分类统计表
*/
List<RStatEventOrgPO> getMonthRStatEventOrgInfoInfo(@Param("deptIds") List<String> deptIds,
List<RStatEventOrgPO> getMonthRStatEventOrgInfoInfo(@Param("deptCode") List<String> deptCode,
@Param("startTime") String startTime,
@Param("endTime") String endTime,
@Param("mainnetPointId") String mainnetPointId);

View File

@@ -1,7 +1,12 @@
package com.njcn.event.mapper.majornetwork;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.njcn.event.pojo.param.StatSubstationBizBaseParam;
import com.njcn.event.pojo.po.RStatEventQ;
import com.njcn.event.pojo.po.RStatEventY;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* <p>
@@ -13,4 +18,13 @@ import com.njcn.event.pojo.po.RStatEventQ;
*/
public interface RStatEventQMapper extends BaseMapper<RStatEventQ> {
/**
* 监测点数据查询
* @param param
* @param dataType
* @return
*/
List<RStatEventQ> selectInfoList(@Param("param") StatSubstationBizBaseParam param,
@Param("dataType") String dataType);
}

View File

@@ -1,7 +1,11 @@
package com.njcn.event.mapper.majornetwork;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.njcn.event.pojo.param.StatSubstationBizBaseParam;
import com.njcn.event.pojo.po.RStatEventVoltageM;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* <p>
@@ -13,4 +17,9 @@ import com.njcn.event.pojo.po.RStatEventVoltageM;
*/
public interface RStatEventVoltageMMapper extends BaseMapper<RStatEventVoltageM> {
List<RStatEventVoltageM> selectInfoList(@Param("param") StatSubstationBizBaseParam param,
@Param("dataType") String dataType,
@Param("measurementId") String measurementId,
@Param("harmonicId") String harmonicId);
}

View File

@@ -1,7 +1,11 @@
package com.njcn.event.mapper.majornetwork;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.njcn.event.pojo.param.StatSubstationBizBaseParam;
import com.njcn.event.pojo.po.RStatEventY;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* <p>
@@ -13,4 +17,13 @@ import com.njcn.event.pojo.po.RStatEventY;
*/
public interface RStatEventYMapper extends BaseMapper<RStatEventY> {
/**
* 监测点数据查询
* @param param
* @param dataType
* @return
*/
List<RStatEventY> selectInfoList(@Param("param") StatSubstationBizBaseParam param,
@Param("dataType") String dataType);
}

View File

@@ -19,13 +19,13 @@ public interface RStatOrgMapper {
/**
* 获取年区域暂态指标统计
*
* @param deptIds 单位id
* @param deptCode 单位code
* @param startTime 开始时间
* @param endTime 结束时间
* @param mainnetPointId 主网字典id
* @return 年区域暂态指标统计
*/
List<RStatOrgVO> getYearRStatOrgInfo(@Param("deptIds") List<String> deptIds,
List<RStatOrgVO> getYearRStatOrgInfo(@Param("deptCode") List<String> deptCode,
@Param("startTime") String startTime,
@Param("endTime") String endTime,
@Param("mainnetPointId") String mainnetPointId);
@@ -33,13 +33,13 @@ public interface RStatOrgMapper {
/**
* 获取季区域暂态指标统计
*
* @param deptIds 单位id
* @param deptCode 单位code
* @param startTime 开始时间
* @param endTime 结束时间
* @param mainnetPointId 主网字典id
* @return 季区域暂态指标统计
*/
List<RStatOrgVO> getQuarterRStatOrgInfo(@Param("deptIds") List<String> deptIds,
List<RStatOrgVO> getQuarterRStatOrgInfo(@Param("deptCode") List<String> deptCode,
@Param("startTime") String startTime,
@Param("endTime") String endTime,
@Param("mainnetPointId") String mainnetPointId);
@@ -47,13 +47,13 @@ public interface RStatOrgMapper {
/**
* 获取月区域暂态指标统计
*
* @param deptIds 单位id
* @param deptCode 单位code
* @param startTime 开始时间
* @param endTime 结束时间
* @param mainnetPointId 主网字典id
* @return 月区域暂态指标统计
*/
List<RStatOrgVO> getMonthRStatOrgInfo(@Param("deptIds") List<String> deptIds,
List<RStatOrgVO> getMonthRStatOrgInfo(@Param("deptCode") List<String> deptCode,
@Param("startTime") String startTime,
@Param("endTime") String endTime,
@Param("mainnetPointId") String mainnetPointId);

View File

@@ -210,6 +210,17 @@
feature_amplitude AS featureAmplitude
FROM
`r_mp_event_detail`
WHERE
measurement_point_id IN
<foreach collection="monitorIdList" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
<if test="startTime != null and startTime != ''">
AND DATE_FORMAT(start_time, '%Y-%m-%d') &gt;= DATE_FORMAT(#{startTime}, '%Y-%m-%d')
</if>
<if test="endTime != null and endTime != ''">
AND DATE_FORMAT(start_time, '%Y-%m-%d') &lt;= DATE_FORMAT(#{endTime}, '%Y-%m-%d')
</if>
</select>
<!--获取监测点电压暂降和短时中断分布情况-->
@@ -390,10 +401,11 @@
<choose>
<when test="dateType != null and dateType == 3">
<if test="startTime != null and startTime != ''">
AND DATE_FORMAT(start_time, '%Y-%m') &gt;= #{startTime}
AND DATE_FORMAT(start_time, '%Y-%m') &gt;= SUBSTRING(#{startTime}, 1, 7)
</if>
-- 没写错就是start_time SUBSTRING第二个参数代表第一个字符开始取7个字符
<if test="endTime != null and endTime != ''">
AND DATE_FORMAT(start_time, '%Y-%m') &lt;= #{endTime}
AND DATE_FORMAT(start_time, '%Y-%m') &lt;= SUBSTRING(#{endTime}, 1, 7)
</if>
</when>
<when test="dateType != null and dateType == 5">
@@ -441,10 +453,10 @@
<choose>
<when test="dateType != null and dateType == 3">
<if test="startTime != null and startTime != ''">
AND DATE_FORMAT(start_time, '%Y-%m') &gt;= #{startTime}
AND DATE_FORMAT(start_time, '%Y-%m') &gt;= SUBSTRING(#{startTime}, 1, 7)
</if>
<if test="endTime != null and endTime != ''">
AND DATE_FORMAT(start_time, '%Y-%m') &lt;= #{endTime}
AND DATE_FORMAT(start_time, '%Y-%m') &lt;= SUBSTRING(#{endTime}, 1, 7)
</if>
</when>
<when test="dateType != null and dateType == 5">

View File

@@ -13,5 +13,37 @@
<result column="event_count" property="eventCount" />
<result column="data_type" property="dataType" />
</resultMap>
<select id="selectInfoList" resultType="com.njcn.event.pojo.po.RStatEventD">
SELECT
data_date,
measurement_type_class,
event_type,
sum(event_measurement) as eventMeasurement,
sum(event_measurement_ratio) as eventMeasurementRatio,
sum(event_count) as eventCount
FROM
r_stat_event_d
<where>
and data_Type=#{dataType}
and measurement_type_class=#{measurementId}
and event_type=#{harmonicId}
<if test="param != null and param.ids != null and param.ids.size > 0">
AND org_no IN
<foreach collection='param.ids' item='item' index="index" open='(' separator=',' close=')'>
#{item}
</foreach>
</if>
<if test="param!=null and param.startTime != null and param.startTime !=''">
AND data_date >= #{param.startTime}
</if>
<if test="param!=null and param.endTime != null and param.endTime != ''">
AND data_date &lt;= #{param.endTime}
</if>
</where>
GROUP BY
data_date,
measurement_type_class,
event_type
</select>
</mapper>

View File

@@ -16,5 +16,36 @@
<result column="event_measurement_ratio_accrued" property="eventMeasurementRatioAccrued" />
<result column="data_type" property="dataType" />
</resultMap>
<select id="selectInfoList" resultType="com.njcn.event.pojo.po.RStatEventM">
SELECT
measurement_type_class,
event_type,
sum(event_measurement_average)/count(*) as eventMeasurementAverage ,
sum(event_measurement_accrued) as eventMeasurementAccrued,
sum(event_freq)/count(*) as eventFreq,
sum(event_count) as eventCount,
sum(event_measurement_ratio_average)/count(*) as eventMeasurementRatioAverage,
sum(event_measurement_ratio_accrued) as eventMeasurementRatioAccrued
FROM
r_stat_event_m
<where>
and data_Type=#{dataType}
<if test="param != null and param.ids != null and param.ids.size > 0">
AND org_no IN
<foreach collection='param.ids' item='item' index="index" open='(' separator=',' close=')'>
#{item}
</foreach>
</if>
<if test="param!=null and param.startTime != null and param.startTime !=''">
AND data_date >= #{param.startTime}
</if>
<if test="param!=null and param.endTime != null and param.endTime != ''">
AND data_date &lt;= #{param.endTime}
</if>
</where>
GROUP BY
measurement_type_class,
event_type
</select>
</mapper>

View File

@@ -20,10 +20,10 @@
rseo.data_type AS dataType
</sql>
<sql id="query_rStatEventOrg_where">
rso.data_type = "01"
AND rseo.data_type = "01"
rso.data_type = #{mainnetPointId}
AND rseo.data_type = #{mainnetPointId}
AND rso.org_no IN
<foreach collection="deptIds" item="item" open="(" close=")" separator=",">
<foreach collection="deptCode" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
<if test="startTime != null and startTime != ''">

View File

@@ -16,5 +16,36 @@
<result column="event_measurement_ratio_accrued" property="eventMeasurementRatioAccrued" />
<result column="data_type" property="dataType" />
</resultMap>
<select id="selectInfoList" resultType="com.njcn.event.pojo.po.RStatEventQ">
SELECT
measurement_type_class,
event_type,
sum(event_measurement_average)/count(*) as eventMeasurementAverage ,
sum(event_measurement_accrued) as eventMeasurementAccrued,
sum(event_freq)/count(*) as eventFreq,
sum(event_count) as eventCount,
sum(event_measurement_ratio_average)/count(*) as eventMeasurementRatioAverage,
sum(event_measurement_ratio_accrued) as eventMeasurementRatioAccrued
FROM
r_stat_event_q
<where>
and data_Type=#{dataType}
<if test="param != null and param.ids != null and param.ids.size > 0">
AND org_no IN
<foreach collection='param.ids' item='item' index="index" open='(' separator=',' close=')'>
#{item}
</foreach>
</if>
<if test="param!=null and param.startTime != null and param.startTime !=''">
AND data_date >= #{param.startTime}
</if>
<if test="param!=null and param.endTime != null and param.endTime != ''">
AND data_date &lt;= #{param.endTime}
</if>
</where>
GROUP BY
measurement_type_class,
event_type
</select>
</mapper>

View File

@@ -17,5 +17,40 @@
<result column="event_measurement_ratio_accrued" property="eventMeasurementRatioAccrued" />
<result column="data_type" property="dataType" />
</resultMap>
<select id="selectInfoList" resultType="com.njcn.event.pojo.po.RStatEventVoltageM">
SELECT
measurement_type_class,
event_type,
voltage_type,
sum(event_measurement_average)/count(*) as eventMeasurementAverage ,
sum(event_measurement_accrued) as eventMeasurementAccrued,
sum(event_freq) as eventFreq,
sum(event_count) as eventCount,
sum(event_measurement_ratio_average)/count(*) as eventMeasurementRatioAverage,
sum(event_measurement_ratio_accrued) as eventMeasurementRatioAccrued
FROM
r_stat_event_voltage_m
<where>
and data_Type=#{dataType}
and measurement_type_class=#{measurementId}
and event_type=#{harmonicId}
<if test="param != null and param.ids != null and param.ids.size > 0">
AND org_no IN
<foreach collection='param.ids' item='item' index="index" open='(' separator=',' close=')'>
#{item}
</foreach>
</if>
<if test="param!=null and param.startTime != null and param.startTime !=''">
AND data_date >= #{param.startTime}
</if>
<if test="param!=null and param.endTime != null and param.endTime != ''">
AND data_date &lt;= #{param.endTime}
</if>
</where>
GROUP BY
voltage_type,
measurement_type_class,
event_type
</select>
</mapper>

View File

@@ -16,5 +16,36 @@
<result column="event_measurement_ratio_accrued" property="eventMeasurementRatioAccrued" />
<result column="data_type" property="dataType" />
</resultMap>
<select id="selectInfoList" resultType="com.njcn.event.pojo.po.RStatEventY">
SELECT
measurement_type_class,
event_type,
sum(event_measurement_average)/count(*) as eventMeasurementAverage ,
sum(event_measurement_accrued) as eventMeasurementAccrued,
sum(event_freq)/count(*) as eventFreq,
sum(event_count) as eventCount,
sum(event_measurement_ratio_average)/count(*) as eventMeasurementRatioAverage,
sum(event_measurement_ratio_accrued) as eventMeasurementRatioAccrued
FROM
r_stat_event_y
<where>
and data_Type=#{dataType}
<if test="param != null and param.ids != null and param.ids.size > 0">
AND org_no IN
<foreach collection='param.ids' item='item' index="index" open='(' separator=',' close=')'>
#{item}
</foreach>
</if>
<if test="param!=null and param.startTime != null and param.startTime !=''">
AND data_date >= #{param.startTime}
</if>
<if test="param!=null and param.endTime != null and param.endTime != ''">
AND data_date &lt;= #{param.endTime}
</if>
</where>
GROUP BY
measurement_type_class,
event_type
</select>
</mapper>

View File

@@ -16,7 +16,7 @@
<sql id="query_where">
data_type = #{mainnetPointId}
AND org_no IN
<foreach collection="deptIds" item="item" open="(" close=")" separator=",">
<foreach collection="deptCode" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
<if test="startTime != null and startTime != ''">

View File

@@ -59,10 +59,10 @@
</foreach>
</if>
<if test="startTime != null and startTime != ''">
AND DATE_FORMAT(start_time, '%Y-%m') &gt;= #{startTime}
AND DATE_FORMAT(start_time, '%Y-%m') &gt;= SUBSTRING(#{startTime}, 1, 7)
</if>
<if test="endTime != null and endTime != ''">
AND DATE_FORMAT(start_time, '%Y-%m') &lt;= #{endTime}
AND DATE_FORMAT(start_time, '%Y-%m') &lt;= SUBSTRING(#{endTime}, 1, 7)
</if>
</select>
</mapper>