and ${criterion.condition} and ${criterion.condition} #{criterion.value} and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} and ${criterion.condition} #{listItem} and ${criterion.condition} and ${criterion.condition} #{criterion.value} and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} and ${criterion.condition} #{listItem} id, type, month, amount, proof_count, salemans_id, update_time delete from t_order_month_report where id = #{id,jdbcType=INTEGER} delete from t_order_month_report insert into t_order_month_report (id, type, month, amount, proof_count, salemans_id, update_time) values (#{id,jdbcType=INTEGER}, #{type,jdbcType=INTEGER}, #{month,jdbcType=INTEGER}, #{amount,jdbcType=DECIMAL}, #{proofCount,jdbcType=REAL}, #{salemansId,jdbcType=VARCHAR}, #{updateTime,jdbcType=TIMESTAMP}) insert into t_order_month_report id, type, month, amount, proof_count, salemans_id, update_time, #{id,jdbcType=INTEGER}, #{type,jdbcType=INTEGER}, #{month,jdbcType=INTEGER}, #{amount,jdbcType=DECIMAL}, #{proofCount,jdbcType=REAL}, #{salemansId,jdbcType=VARCHAR}, #{updateTime,jdbcType=TIMESTAMP}, update t_order_month_report id = #{record.id,jdbcType=INTEGER}, type = #{record.type,jdbcType=INTEGER}, month = #{record.month,jdbcType=INTEGER}, amount = #{record.amount,jdbcType=DECIMAL}, proof_count = #{record.proofCount,jdbcType=REAL}, salemans_id = #{record.salemansId,jdbcType=VARCHAR}, update_time = #{record.updateTime,jdbcType=TIMESTAMP}, update t_order_month_report set id = #{record.id,jdbcType=INTEGER}, type = #{record.type,jdbcType=INTEGER}, month = #{record.month,jdbcType=INTEGER}, amount = #{record.amount,jdbcType=DECIMAL}, proof_count = #{record.proofCount,jdbcType=REAL}, salemans_id = #{record.salemansId,jdbcType=VARCHAR}, update_time = #{record.updateTime,jdbcType=TIMESTAMP} update t_order_month_report type = #{type,jdbcType=INTEGER}, month = #{month,jdbcType=INTEGER}, amount = #{amount,jdbcType=DECIMAL}, proof_count = #{proofCount,jdbcType=REAL}, salemans_id = #{salemansId,jdbcType=VARCHAR}, update_time = #{updateTime,jdbcType=TIMESTAMP}, where id = #{id,jdbcType=INTEGER} update t_order_month_report set type = #{type,jdbcType=INTEGER}, month = #{month,jdbcType=INTEGER}, amount = #{amount,jdbcType=DECIMAL}, proof_count = #{proofCount,jdbcType=REAL}, salemans_id = #{salemansId,jdbcType=VARCHAR}, update_time = #{updateTime,jdbcType=TIMESTAMP} where id = #{id,jdbcType=INTEGER} REPLACE INTO t_order_month_report(`type`,`month`,amount,proof_count,salemans_id) select o.order_type, date_format(DATE_ADD(NOW(),INTERVAL -1 MONTH),'%Y%m'),sum(o.total_amount), sum(o.proof_count), o.salesman_id from t_order_new o where 1 = 1 and o.proof_status = 1 and o.delete_sign = 0 and o.order_status <> 7 and PERIOD_DIFF( date_format( now( ) , '%Y%m' ) , date_format( o.sign_time, '%Y%m' ) ) = 1 group by o.salesman_id , o.order_type REPLACE INTO t_order_year_report(`type`,`year`,amount,proof_count,salemans_id) select m.`type`, year(date_sub(now(),interval 1 year)), sum(amount), sum(proof_count), salemans_id from t_order_month_report m where CAST(`month` as CHAR) like concat (year(date_sub(now(),interval 1 year)),'%') group by m.salemans_id , m.`type` UPDATE t_order_month_report m, (select sum(proof_count) as proof_count, sum(total_amount) as amount , order_type, salesman_id from t_order_new where proof_status = 1 and salesman_id = #{salesmanId,jdbcType=VARCHAR} and order_type = #{orderType,jdbcType=INTEGER} and date_format( sign_time , '%Y%m' ) = date_format( #{signTime,jdbcType=DATE}, '%Y%m' )) as o SET m.proof_count = o.proof_count, m.amount = o.amount WHERE m.type = o.order_type and m.salemans_id = o.salesman_id and m.month = date_format( #{signTime,jdbcType=DATE}, '%Y%m' ) update t_order_year_report y,( SELECT salemans_id, `type`, sum(amount) amount, sum(proof_count) proof_count FROM t_order_month_report WHERE CAST(`month` as CHAR) like concat (date_format(now(),'%Y'),'%') GROUP BY salemans_id, type) m SET y.proof_count = m.proof_count, y.amount = m.amount WHERE y.salemans_id = m.salemans_id and y.type = m.type and year = date_format(now(),'%Y') INSERT INTO t_order_month_report(`type`,`month`,amount,proof_count,salemans_id) select order_type, date_format( sign_time , '%Y%m' ), sum(total_amount) as amount, sum(proof_count) as proof_count, salesman_id from t_order_new where proof_status = 1 and o.delete_sign = 0 and o.order_status <> 7 and salesman_id = #{salesmanId,jdbcType=VARCHAR} and order_type = #{orderType,jdbcType=INTEGER} and date_format( sign_time , '%Y%m' ) = date_format( #{signTime,jdbcType=DATE}, '%Y%m' ) REPLACE INTO t_order_month_report(`type`,`month`,amount,proof_count,salemans_id) select o.order_type, #{month,jdbcType=INTEGER},sum(o.total_amount), sum(o.proof_count), o.salesman_id from t_order_new o where 1 = 1 and o.proof_status = 1 and o.delete_sign = 0 and o.order_status <> 7 and date_format( o.sign_time, '%Y%m' ) = #{month,jdbcType=INTEGER} group by o.salesman_id , o.order_type REPLACE INTO t_order_year_report(`type`,`year`,amount,proof_count,salemans_id) select m.`type`, year(now()), sum(amount), sum(proof_count), salemans_id from t_order_month_report m where CAST(`month` as CHAR) like concat (year(now()),'%') group by m.salemans_id , m.`type`