| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303 |
- <?xml version="1.0" encoding="UTF-8" ?>
- <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
- <!--
- 这个文件是自动生成的。
- 不要修改此文件。所有改动将在下次重新自动生成时丢失。
- -->
- <mapper namespace="com.ym.mec.collectfee.dao.OrderDao">
- <resultMap type="com.ym.mec.collectfee.entity.Order" id="Order">
- <result column="id" property="id"/>
- <result column="oid" property="oid"/>
- <result column="branch_id" property="branchId"/>
- <result column="group_id" property="groupId"/>
- <result column="order_no" property="orderNo"/>
- <result column="user_id" property="userId"/>
- <result column="user_name" property="userName"/>
- <result column="amount" property="amount"/>
- <result column="type" property="type"/>
- <result column="pay" property="pay"/>
- <result column="bank" property="bank"/>
- <result column="account" property="account"/>
- <result column="u_account" property="uAccount"/>
- <result column="pay_id" property="payId"/>
- <result column="pay_time" property="payTime"/>
- <result column="remark" property="remark"/>
- <result column="class_id" property="classId"/>
- <result column="status" property="status"/>
- <result column="create_time" property="createTime"/>
- <result column="po_name" property="poName"/>
- <result column="voicy_part" property="voicyPart"/>
- <result column="balance" property="balance"/>
- <result column="batch_num" property="batchNum"/>
- <result column="tui_fee" property="tuiFee"/>
- <result column="goods_fee" property="goodsFee"/>
- <result column="sd_name" property="sdName"/>
- <result column="sd_fee" property="sdFee"/>
- <result column="promotion_type" property="promotionType" />
- </resultMap>
- <!-- 根据主键查询一条记录 -->
- <select id="get" resultMap="Order">
- SELECT * FROM `order` WHERE `id` = #{id}
- </select>
- <!-- 全查询 -->
- <select id="findAll" resultMap="Order">
- SELECT *
- FROM `order`
- ORDER BY id
- </select>
- <!-- 向数据库增加一条记录 -->
- <insert id="insert" parameterType="com.ym.mec.collectfee.entity.Order" useGeneratedKeys="true" keyColumn="id"
- keyProperty="id">
- <!--
- <selectKey resultClass="int" keyProperty="id" >
- SELECT SEQ_WSDEFINITION_ID.nextval AS ID FROM DUAL
- </selectKey>
- -->
- INSERT INTO `order`
- (id,oid,order_no,branch_id,group_id,user_id,user_name,amount,type,pay,bank,account,u_account,pay_id,pay_time,remark,class_id,status,create_time,po_name,voicy_part,balance,batch_num,tui_fee,goods_fee,sd_name,sd_fee,promotion_type)
- VALUES(#{id},#{oid},#{orderNo},#{branchId},#{groupId},#{userId},#{userName},#{amount},#{type},#{pay},#{bank},#{account},#{uAccount},#{payId},#{payTime},#{remark},#{classId},#{status},#{createTime},#{poName},#{voicyPart},#{balance},#{batchNum},#{tuiFee},#{goodsFee},#{sdName},#{sdFee},#{promotionType})
- </insert>
- <!-- 根据主键查询一条记录 -->
- <update id="update" parameterType="com.ym.mec.collectfee.entity.Order">
- UPDATE `order`
- <set>
- <if test="tuiFee != null">
- tui_fee = #{tuiFee},
- </if>
- <if test="goodsFee != null">
- goods_fee = #{goodsFee},
- </if>
- <if test="sdName != null">
- sd_name = #{sdName},
- </if>
- <if test="sdFee != null">
- sd_fee = #{sdFee},
- </if>
- <if test="amount != null">
- amount = #{amount},
- </if>
- <if test="classId != null">
- class_id = #{classId},
- </if>
- <if test="pay != null">
- pay = #{pay},
- </if>
- <if test="uAccount != null">
- u_account = #{uAccount},
- </if>
- <if test="remark != null">
- remark = #{remark},
- </if>
- <if test="oid != null">
- oid = #{oid},
- </if>
- <if test="batchNum != null">
- batch_num = #{batchNum},
- </if>
- <if test="payTime != null">
- pay_time = #{payTime},
- </if>
- <if test="bank != null">
- bank = #{bank},
- </if>
- <if test="balance != null">
- balance = #{balance},
- </if>
- <if test="userId != null">
- user_id = #{userId},
- </if>
- <if test="voicyPart != null">
- voicy_part = #{voicyPart},
- </if>
- <if test="poName != null">
- po_name = #{poName},
- </if>
- <if test="account != null">
- account = #{account},
- </if>
- <if test="payId != null">
- pay_id = #{payId},
- </if>
- <if test="status != null">
- status = #{status},
- </if>
- </set>
- WHERE id = #{id}
- </update>
- <!-- 根据主键删除一条记录 -->
- <delete id="delete">
- DELETE FROM `order` WHERE id = #{id}
- </delete>
- <!-- 分页查询 -->
- <select id="queryPage" resultMap="Order" parameterType="map">
- SELECT * FROM `order` ORDER BY id
- <include refid="global.limit"/>
- </select>
- <!-- 查询当前表的总记录数 -->
- <select id="queryCount" resultType="int">
- SELECT COUNT(*)
- FROM `order`
- </select>
- <select id="getOrderByUserId" resultMap="Order">
- SELECT * FROM `order` WHERE user_id = #{userId}
- </select>
- <select id="getOrderByClassId" resultMap="Order">
- SELECT * FROM `order` WHERE status=2
- <if test="classId != null">
- and class_id = #{classId}
- </if>
- <if test="type != null">
- and type = #{type}
- </if>
- <if test="branchId != null">
- and branch_id = #{branchId}
- </if>
- <if test="voicyPart != null">
- and voicy_part like '%${voicyPart}%'
- </if>
- <if test="account != null">
- and account = #{account}
- </if>
- <if test="startTime != null and startTime != ''">
- <![CDATA[ and pay_time >= ]]>#{startTime}
- </if>
- <if test="endTime != null and endTime != ''">
- <![CDATA[ and pay_time <= ]]>#{endTime}
- </if>
- </select>
- <select id="getOrderByBatch" resultMap="Order">
- SELECT * FROM `order` WHERE `batch_num` = #{batchNum}
- </select>
- <select id="countOrder" resultType="java.lang.Integer">
- SELECT COUNT(DISTINCT user_id) num FROM `order` WHERE `po_name` = #{poName} AND `voicy_part` = #{voicePort} AND
- `status` >= 1
- </select>
-
- <select id="getPromotionCount" resultType="java.lang.Integer">
- SELECT count(DISTINCT user_id) num FROM `order` WHERE `branch_id` = #{branchId} AND `promotion_type` = 1 and `status` =2
- </select>
-
- <select id="getUserPromotionCount" resultType="java.lang.Integer">
- SELECT count(id) num FROM `order` WHERE `user_id` = #{userId} AND `promotion_type` = 1 and `status` =2
- </select>
- <select id="getOrderByOrderNo" resultMap="Order">
- SELECT * FROM `order` WHERE `order_no` = #{orderNo} AND `status` = 1
- </select>
- <select id="findOrderByStatus" resultMap="Order">
- SELECT * FROM `order` WHERE `user_id` = #{userId} AND `status` = #{status}
- </select>
- <!-- 获取支付中和成功的订单数-->
- <select id="getPayOrderNums" resultType="java.lang.Integer">
- SELECT COUNT(*)
- FROM `order`
- WHERE `status` >= 1
- </select>
- <!-- 获取支付中的订单-->
- <select id="findPayingOrders" resultMap="Order">
- SELECT *
- FROM `order`
- WHERE `status` = 1
- </select>
- <!-- 获取支付中和成功的订单数-->
- <select id="getPayingOrderNums" resultType="java.lang.Integer" parameterType="java.lang.Integer">
- SELECT COUNT(*) FROM `order` WHERE `group_id`= #{groupId} AND `status` = 1
- </select>
- <!-- 根据id和status更新订单 -->
- <update id="updateByIdAndStatus" parameterType="map">
- UPDATE `order`
- <set>
- <if test="pay != null">
- pay = #{pay},
- </if>
- <if test="payTime != null">
- pay_time = #{payTime},
- </if>
- <if test="bank != null">
- bank = #{bank},
- </if>
- <if test="payId != null">
- pay_id = #{payId},
- </if>
- <if test="status != null">
- status = #{status}
- </if>
- </set>
- WHERE id = #{id} AND `status` = #{oldStatus}
- </update>
- <!-- 查询支付中超过30分钟的订单 -->
- <select id="findPayingOrdersOver" resultMap="Order" parameterType="map">
- SELECT * FROM `order` WHERE `order_no` IN
- <foreach collection="orderNoList" item="orderNo" index="index" open="(" close=")" separator=",">
- #{orderNo}
- </foreach>
- <![CDATA[ AND `status`=1 AND `create_time` <= ]]> #{beforeTime}
- </select>
- <!-- 乐团报名缴费订单 -->
- <select id="findRegOrderByStatus" resultMap="Order">
- SELECT * FROM `order` WHERE `user_id` = #{userId} AND `type`=1 AND `status` = #{status}
- </select>
- <sql id="orderPage">
- <if test="account != null">
- and FIND_IN_SET(account,#{account})
- </if>
- <if test="classId != null">
- and class_id = #{classId}
- </if>
- <if test="type != null">
- and type = #{type}
- </if>
- <if test="branchId != null">
- and branch_id = #{branchId}
- </if>
- <if test="voicyPart != null">
- and voicy_part like '%${voicyPart}%'
- </if>
- <if test="startTime != null and startTime != ''">
- <![CDATA[ and pay_time >= ]]>#{startTime}
- </if>
- <if test="endTime != null and endTime != ''">
- <![CDATA[ and pay_time <= ]]>#{endTime}
- </if>
- <if test="promotionType != null and promotionType!=0">
- and promotion_type = #{promotionType}
- </if>
- </sql>
- <!-- 查询当前表的总记录数 -->
- <select id="queryOrderCount" resultType="java.lang.Integer">
- SELECT COUNT(*) FROM `order` WHERE status=2
- <include refid="orderPage"/>
- </select>
- <!-- 查询当前表的总记录数 -->
- <select id="queryFeeAmount" resultType="map">
- SELECT SUM(amount) AS amount,SUM(tui_fee) as tuiFeeAmount,SUM(goods_fee) AS goodsFeeAmount,SUM(sd_Fee) AS
- sdFeeAmount, SUM(ROUND(amount*0.28/100,2)) as commissionAmount FROM `order` WHERE status=2
- <include refid="orderPage"/>
- </select>
- <select id="queryOrderPage" resultMap="Order" parameterType="map">
- SELECT * FROM `order` WHERE status=2
- <include refid="orderPage"/>
- <include refid="global.limit"/>
- </select>
- <select id="getOrderStatusByOrderNo" resultMap="Order">
- SELECT * FROM `order` WHERE `order_no` = #{orderNo}
- </select>
- </mapper>
|