|
|
@@ -474,22 +474,67 @@
|
|
|
from new_order_dun a
|
|
|
where tid = #{tid} and status=0
|
|
|
</select>
|
|
|
-
|
|
|
+
|
|
|
<insert id="insertBatch" parameterType="com.goafanti.order.bo.OutNewOrderDunBo">
|
|
|
- insert into new_order_dun ( order_no, tid,
|
|
|
- project_type, dun_type, wait_day,
|
|
|
- effective_count, aid, status,
|
|
|
- create_time, start_time, money,
|
|
|
+ insert into new_order_dun ( order_no, tid,
|
|
|
+ project_type, dun_type, wait_day,
|
|
|
+ effective_count, aid, status,
|
|
|
+ create_time, start_time, money,
|
|
|
appropriation_ratio, customize_name, customize_time
|
|
|
)
|
|
|
values
|
|
|
<foreach item="item" index="index" collection="list" separator=",">
|
|
|
- (#{item.orderNo,jdbcType=VARCHAR}, #{item.tid,jdbcType=INTEGER},
|
|
|
- #{item.projectType,jdbcType=INTEGER}, #{item.dunType,jdbcType=INTEGER}, #{item.waitDay,jdbcType=INTEGER},
|
|
|
- #{item.effectiveCount,jdbcType=INTEGER}, #{item.aid,jdbcType=VARCHAR}, #{item.status,jdbcType=INTEGER},
|
|
|
- #{item.createTime,jdbcType=TIMESTAMP}, #{item.startTime,jdbcType=TIMESTAMP}, #{item.money,jdbcType=DECIMAL},
|
|
|
+ (#{item.orderNo,jdbcType=VARCHAR}, #{item.tid,jdbcType=INTEGER},
|
|
|
+ #{item.projectType,jdbcType=INTEGER}, #{item.dunType,jdbcType=INTEGER}, #{item.waitDay,jdbcType=INTEGER},
|
|
|
+ #{item.effectiveCount,jdbcType=INTEGER}, #{item.aid,jdbcType=VARCHAR}, #{item.status,jdbcType=INTEGER},
|
|
|
+ #{item.createTime,jdbcType=TIMESTAMP}, #{item.startTime,jdbcType=TIMESTAMP}, #{item.money,jdbcType=DECIMAL},
|
|
|
#{item.appropriationRatio,jdbcType=DECIMAL}, #{item.customizeName,jdbcType=VARCHAR}, #{item.customizeTime,jdbcType=TIMESTAMP}
|
|
|
)
|
|
|
</foreach>
|
|
|
</insert>
|
|
|
+ <select id="selectOrderDunAll" resultType="com.goafanti.order.bo.OutSelectOrderDunAll">
|
|
|
+ select dg.name provinceName,z.province,z.quantity,z.totalAmount,z.receivables
|
|
|
+ from (select y.province,sum(1)quantity,sum(y.total_amount)totalAmount,sum(y.receivables)receivables
|
|
|
+ from (select c.province ,x.order_no,x.money receivables,a.total_amount
|
|
|
+ from (select order_no ,sum(money)money from new_order_dun nod where status=1
|
|
|
+ <if test="startDate!=null and endDate!=null">
|
|
|
+ and start_time between #{startDate} and #{endDate}
|
|
|
+ </if>
|
|
|
+ group by order_no)x left join t_order_new a on x.order_no=a.order_no left join admin b on a.salesman_id =b.id
|
|
|
+ left join department c on b.department_id =c.id
|
|
|
+ <if test="depId!=null">
|
|
|
+ where b.department_id = #{depId}
|
|
|
+ </if>
|
|
|
+ )y group by y.province)z left join district_glossory dg on z.province=dg.id
|
|
|
+ </select>
|
|
|
+ <select id="selectOrderDun" resultType="com.goafanti.order.bo.OutSelectOrderDun">
|
|
|
+ select z.provinceName,z.aName,z.totalAmount,z.money
|
|
|
+ from( select dg.name provinceName,y.name aName,sum(y.total_amount)totalAmount, sum(y.money)money
|
|
|
+ from (select c.province ,b.name ,x.money ,x.quantity,a.total_amount
|
|
|
+ from (select order_no ,sum(money)money,1 quantity from new_order_dun nod where status=1
|
|
|
+ <if test="startDate!=null and endDate!=null">
|
|
|
+ and start_time between #{startDate} and #{endDate}
|
|
|
+ </if>
|
|
|
+ group by order_no)x left join t_order_new a on x.order_no=a.order_no left join admin b on a.salesman_id =b.id
|
|
|
+ left join department c on b.department_id =c.id
|
|
|
+ <if test="depId !=null">
|
|
|
+ where b.department_id = #{depId}
|
|
|
+ </if>
|
|
|
+ <if test="province !=null">
|
|
|
+ and c.province= #{province}
|
|
|
+ </if>
|
|
|
+ <if test="aid !=null">
|
|
|
+ and b.id= #{aid}
|
|
|
+ </if>
|
|
|
+ )y left join district_glossory dg on y.province=dg.id
|
|
|
+ group by dg.name ,y.name)z
|
|
|
+ order by
|
|
|
+ <if test="sort=0">
|
|
|
+ z.totalAmount
|
|
|
+ </if>
|
|
|
+ <if test="sort=1">
|
|
|
+ z.totalAmount
|
|
|
+ </if>
|
|
|
+ desc
|
|
|
+ </select>
|
|
|
</mapper>
|