|
|
@@ -14,6 +14,7 @@
|
|
|
<result column="proof_count" jdbcType="REAL" property="proofCount" />
|
|
|
<result column="salemans_id" jdbcType="VARCHAR" property="salemansId" />
|
|
|
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
|
|
|
+ <result column="history" jdbcType="INTEGER" property="history" />
|
|
|
</resultMap>
|
|
|
<sql id="Example_Where_Clause">
|
|
|
<!--
|
|
|
@@ -89,7 +90,7 @@
|
|
|
This element is automatically generated by MyBatis Generator, do not modify.
|
|
|
This element was generated on Tue Nov 27 14:53:14 CST 2018.
|
|
|
-->
|
|
|
- id, type, month, amount, proof_count, salemans_id, update_time
|
|
|
+ id, type, month, amount, proof_count, salemans_id, update_time, history
|
|
|
</sql>
|
|
|
<select id="selectByExample" parameterType="com.goafanti.common.model.TOrderMonthReportExample" resultMap="BaseResultMap">
|
|
|
<!--
|
|
|
@@ -149,10 +150,10 @@
|
|
|
-->
|
|
|
insert into t_order_month_report (id, type, month,
|
|
|
amount, proof_count, salemans_id,
|
|
|
- update_time)
|
|
|
+ update_time, history)
|
|
|
values (#{id,jdbcType=INTEGER}, #{type,jdbcType=INTEGER}, #{month,jdbcType=INTEGER},
|
|
|
#{amount,jdbcType=DECIMAL}, #{proofCount,jdbcType=REAL}, #{salemansId,jdbcType=VARCHAR},
|
|
|
- #{updateTime,jdbcType=TIMESTAMP})
|
|
|
+ #{updateTime,jdbcType=TIMESTAMP}, #{history,jdbcType=INTEGER})
|
|
|
</insert>
|
|
|
<insert id="insertSelective" parameterType="com.goafanti.common.model.TOrderMonthReport">
|
|
|
<!--
|
|
|
@@ -183,6 +184,9 @@
|
|
|
<if test="updateTime != null">
|
|
|
update_time,
|
|
|
</if>
|
|
|
+ <if test="history != null">
|
|
|
+ history,
|
|
|
+ </if>
|
|
|
</trim>
|
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
|
<if test="id != null">
|
|
|
@@ -206,6 +210,9 @@
|
|
|
<if test="updateTime != null">
|
|
|
#{updateTime,jdbcType=TIMESTAMP},
|
|
|
</if>
|
|
|
+ <if test="history != null">
|
|
|
+ #{history,jdbcType=INTEGER},
|
|
|
+ </if>
|
|
|
</trim>
|
|
|
</insert>
|
|
|
<select id="countByExample" parameterType="com.goafanti.common.model.TOrderMonthReportExample" resultType="java.lang.Integer">
|
|
|
@@ -317,8 +324,8 @@
|
|
|
</update>
|
|
|
<!-- 定时插入上月的签单数据 -->
|
|
|
<insert id="insertLastMonthOrderData" parameterType="java.lang.String">
|
|
|
- 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
|
|
|
+ REPLACE INTO t_order_month_report(`type`,`month`,amount,proof_count,salemans_id,history)
|
|
|
+ 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 , 1
|
|
|
from t_order_new o
|
|
|
where 1 = 1
|
|
|
and o.proof_status = 1 and o.delete_sign = 0 and o.order_status <> 7
|
|
|
@@ -478,8 +485,8 @@
|
|
|
</insert>
|
|
|
<!-- 更新指定月份的统计数据 -->
|
|
|
<insert id="updateByMonth" parameterType="java.lang.Integer">
|
|
|
- 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
|
|
|
+ REPLACE INTO t_order_month_report(`type`,`month`,amount,proof_count,salemans_id,history)
|
|
|
+ select o.order_type, #{month,jdbcType=INTEGER},sum(o.total_amount), sum(o.proof_count), o.salesman_id ,1
|
|
|
from t_order_new o
|
|
|
where 1 = 1
|
|
|
and o.proof_status = 1 and o.delete_sign = 0 and o.order_status <> 7
|
|
|
@@ -493,4 +500,8 @@
|
|
|
where CAST(`month` as CHAR) like concat (year(now()),'%')
|
|
|
group by m.salemans_id , m.`type`
|
|
|
</insert>
|
|
|
+ <!-- 获得历史状态 -->
|
|
|
+ <select id="getHistory" parameterType="com.goafanti.common.model.TOrderMonthReport" resultType="java.lang.Integer">
|
|
|
+ select history from t_order_month_report where salemans_id = #{salemansId,jdbcType=VARCHAR} and `type` = #{type,jdbcType=INTEGER} and `month` = #{month,jdbcType=INTEGER}
|
|
|
+ </select>
|
|
|
</mapper>
|