and (c.check_yearmonth = #{item.commissionPayoutYearmonth,jdbcType=VARCHAR}
and (c.check_yearmonth = #{item.commissionPayoutYearmonth,jdbcType=VARCHAR}
or (t.drop_option_code in(select distinct t.commission_type FROM ag_settlement_rule_base t where t.calculation_method='3' and t.is_active=1)
or (t.drop_option_code in(select distinct t.commission_type FROM ag_settlement_rule_base t where t.calculation_method='3' and t.is_active=1)
and QUARTER(DATE_SUB(STR_TO_DATE(CONCAT(c.check_yearmonth,'-01'), "%Y-%m-%d"),INTERVAL 1 MONTH))=QUARTER(DATE_SUB(STR_TO_DATE(CONCAT(#{item.commissionPayoutYearmonth,jdbcType=VARCHAR},'-01'), "%Y-%m-%d"),INTERVAL 1 MONTH))))
and SUBSTR(c.check_yearmonth,1,4) = SUBSTR(#{item.commissionPayoutYearmonth,jdbcType=VARCHAR},1,4)
and QUARTER(STR_TO_DATE(CONCAT(c.check_yearmonth,'-01'), "%Y-%m-%d"))=QUARTER(STR_TO_DATE(CONCAT(#{item.commissionPayoutYearmonth,jdbcType=VARCHAR},'-01'), "%Y-%m-%d")))
<!-- and QUARTER(DATE_SUB(STR_TO_DATE(CONCAT(c.check_yearmonth,'-01'), "%Y-%m-%d"),INTERVAL 1 MONTH))=QUARTER(DATE_SUB(STR_TO_DATE(CONCAT(#{item.commissionPayoutYearmonth,jdbcType=VARCHAR},'-01'), "%Y-%m-%d"),INTERVAL 1 MONTH)))) -->
</if>
</if>
<iftest="item.predictMonthPeriod != null">
<iftest="item.predictMonthPeriod != null">
and DATE_FORMAT(t.predict_month_period, '%Y-%m') = #{item.predictMonthPeriod,jdbcType=VARCHAR}
and DATE_FORMAT(t.predict_month_period, '%Y-%m') = #{item.predictMonthPeriod,jdbcType=VARCHAR}