123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262 |
- <?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.hcloud.microserver.h5.dao.OrderPayApplyMapper">
- <resultMap id="BaseResultMap" type="com.hcloud.microserver.facade.carbon.entity.OrderPayApply">
- <id column="guid" jdbcType="CHAR" property="guid"/>
- <result column="fk_customer_id" jdbcType="CHAR" property="fkCustomerId"/>
- <result column="fk_order_id" jdbcType="CHAR" property="fkOrderId"/>
- <result column="apply_user_name" jdbcType="VARCHAR" property="applyUserName"/>
- <result column="pay_amount" jdbcType="DECIMAL" property="payAmount"/>
- <result column="remark" jdbcType="VARCHAR" property="remark"/>
- <result column="apply_status" jdbcType="INTEGER" property="applyStatus"/>
- <result column="state" jdbcType="INTEGER" property="state"/>
- <result column="create_time" jdbcType="TIMESTAMP" property="createTime"/>
- <result column="modified_time" jdbcType="TIMESTAMP" property="modifiedTime"/>
- </resultMap>
- <sql id="Base_Column_List">
- guid, fk_customer_id, fk_order_id, apply_user_name, pay_amount, remark, apply_status,
- state, create_time, modified_time
- </sql>
- <select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
- select
- <include refid="Base_Column_List"/>
- from t_order_pay_apply
- where guid = #{guid,jdbcType=CHAR}
- </select>
- <select id="searchPayApplyInfoByPage" parameterType="com.hcloud.microserver.commoncore.base.PageBean"
- resultType="com.hcloud.microserver.h5.bo.PayApplyInfoBO">
- SELECT
- aa.guid,
- aa.fk_order_id AS orderId,
- cc.order_no AS orderNo,
- bb.account,
- aa.apply_user_name AS applyUserName,
- aa.pay_amount AS payAmount,
- cc.order_carbon_amount AS orderCarbonAmount,
- cc.order_status AS orderStatus,
- cc.create_time AS orderTime,
- ee.goods_name AS goodsName
- FROM
- t_order_pay_apply aa
- LEFT JOIN t_customer_info bb ON aa.fk_customer_id = bb.guid
- LEFT JOIN t_goods_order_info cc ON aa.fk_order_id = cc.guid
- LEFT JOIN t_goods_order_detail dd ON dd.fk_order_guid = cc.guid
- LEFT JOIN t_goods_info ee ON ee.guid = dd.fk_goods_guid
- WHERE
- cc.order_status = 2 and aa.state=1
- <if test="data.beginTime!=null and data.beginTime!=''">
- AND cc.create_time >= concat(#{data.beginTime},' 00:00:00')
- </if>
- <if test="data.endTime!=null and data.endTime!=''">
- <![CDATA[
- AND cc.create_time <= concat(#{data.endTime},' 23:59:59')
- ]]>
- </if>
- <if test="data.orderStatus!=null">
- AND cc.order_status=#{data.orderStatus}
- </if>
- <if test="data.account!=null and data.account!=''">
- AND bb.account=#{data.account}
- </if>
- <if test="data.orderNo!=null and data.orderNo!=''">
- AND cc.orderNo=#{data.orderNo}
- </if>
- </select>
- <select id="getPayApplyInfoByOrderId" parameterType="java.lang.String" resultMap="BaseResultMap">
- select
- <include refid="Base_Column_List"/>
- from t_order_pay_apply
- where
- state=1 and apply_status in (1,2)
- and fk_order_id = #{orderId,jdbcType=CHAR}
- </select>
- <delete id="deleteByPrimaryKey" parameterType="java.lang.String">
- delete from t_order_pay_apply
- where guid = #{guid,jdbcType=CHAR}
- </delete>
- <insert id="insert" parameterType="com.hcloud.microserver.facade.carbon.entity.OrderPayApply">
- insert into t_order_pay_apply (guid, fk_customer_id, fk_order_id,
- apply_user_name, pay_amount, remark,
- apply_status, state, create_time,
- modified_time)
- values (#{guid,jdbcType=CHAR}, #{fkCustomerId,jdbcType=CHAR}, #{fkOrderId,jdbcType=CHAR},
- #{applyUserName,jdbcType=VARCHAR}, #{payAmount,jdbcType=DECIMAL}, #{remark,jdbcType=VARCHAR},
- #{applyStatus,jdbcType=INTEGER}, #{state,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP},
- #{modifiedTime,jdbcType=TIMESTAMP})
- </insert>
- <insert id="insertSelective" parameterType="com.hcloud.microserver.facade.carbon.entity.OrderPayApply">
- insert into t_order_pay_apply
- <trim prefix="(" suffix=")" suffixOverrides=",">
- <if test="guid != null">
- guid,
- </if>
- <if test="fkCustomerId != null">
- fk_customer_id,
- </if>
- <if test="fkOrderId != null">
- fk_order_id,
- </if>
- <if test="applyUserName != null">
- apply_user_name,
- </if>
- <if test="payAmount != null">
- pay_amount,
- </if>
- <if test="remark != null">
- remark,
- </if>
- <if test="applyStatus != null">
- apply_status,
- </if>
- <if test="state != null">
- state,
- </if>
- <if test="createTime != null">
- create_time,
- </if>
- <if test="modifiedTime != null">
- modified_time,
- </if>
- </trim>
- <trim prefix="values (" suffix=")" suffixOverrides=",">
- <if test="guid != null">
- #{guid,jdbcType=CHAR},
- </if>
- <if test="fkCustomerId != null">
- #{fkCustomerId,jdbcType=CHAR},
- </if>
- <if test="fkOrderId != null">
- #{fkOrderId,jdbcType=CHAR},
- </if>
- <if test="applyUserName != null">
- #{applyUserName,jdbcType=VARCHAR},
- </if>
- <if test="payAmount != null">
- #{payAmount,jdbcType=DECIMAL},
- </if>
- <if test="remark != null">
- #{remark,jdbcType=VARCHAR},
- </if>
- <if test="applyStatus != null">
- #{applyStatus,jdbcType=INTEGER},
- </if>
- <if test="state != null">
- #{state,jdbcType=INTEGER},
- </if>
- <if test="createTime != null">
- #{createTime,jdbcType=TIMESTAMP},
- </if>
- <if test="modifiedTime != null">
- #{modifiedTime,jdbcType=TIMESTAMP},
- </if>
- </trim>
- </insert>
- <update id="updateByPrimaryKeySelective" parameterType="com.hcloud.microserver.facade.carbon.entity.OrderPayApply">
- update t_order_pay_apply
- <set>
- <if test="fkCustomerId != null">
- fk_customer_id = #{fkCustomerId,jdbcType=CHAR},
- </if>
- <if test="fkOrderId != null">
- fk_order_id = #{fkOrderId,jdbcType=CHAR},
- </if>
- <if test="applyUserName != null">
- apply_user_name = #{applyUserName,jdbcType=VARCHAR},
- </if>
- <if test="payAmount != null">
- pay_amount = #{payAmount,jdbcType=DECIMAL},
- </if>
- <if test="remark != null">
- remark = #{remark,jdbcType=VARCHAR},
- </if>
- <if test="applyStatus != null">
- apply_status = #{applyStatus,jdbcType=INTEGER},
- </if>
- <if test="state != null">
- state = #{state,jdbcType=INTEGER},
- </if>
- <if test="createTime != null">
- create_time = #{createTime,jdbcType=TIMESTAMP},
- </if>
- <if test="modifiedTime != null">
- modified_time = #{modifiedTime,jdbcType=TIMESTAMP},
- </if>
- </set>
- where guid = #{guid,jdbcType=CHAR}
- </update>
- <update id="updateByPrimaryKey" parameterType="com.hcloud.microserver.facade.carbon.entity.OrderPayApply">
- update t_order_pay_apply
- set fk_customer_id = #{fkCustomerId,jdbcType=CHAR},
- fk_order_id = #{fkOrderId,jdbcType=CHAR},
- apply_user_name = #{applyUserName,jdbcType=VARCHAR},
- pay_amount = #{payAmount,jdbcType=DECIMAL},
- remark = #{remark,jdbcType=VARCHAR},
- apply_status = #{applyStatus,jdbcType=INTEGER},
- state = #{state,jdbcType=INTEGER},
- create_time = #{createTime,jdbcType=TIMESTAMP},
- modified_time = #{modifiedTime,jdbcType=TIMESTAMP}
- where guid = #{guid,jdbcType=CHAR}
- </update>
- <update id="updateOrderPayApplyBelongInfo">
- update t_order_pay_apply
- set fk_customer_id = #{newId}
- where fk_customer_id = #{oldId}
- </update>
- <select id="selectListByPage" parameterType="com.hcloud.microserver.facade.carbon.forms.OrderPayApplyForm"
- resultType="com.hcloud.microserver.h5.bo.OrderPayApplyBO">
- select
- apply.guid as guid,
- apply.fk_order_id as orderGuid,
- orderInfo.order_no as orderNo,
- goods.goods_name as goodsName,
- customer.account as account,
- customer.customer_name as customerName,
- apply.pay_amount as payAmount,
- goods.carbon_val as carbonVal,
- orderInfo.create_time as orderTime,
- orderInfo.order_status as orderStatus,
- case orderInfo.order_status
- when 1 then '待支付'
- when 2 then '已支付'
- when 3 then '待审核'
- when 4 then '已审核'
- when 5 then '已确认' end as orderStatusName
- from t_order_pay_apply apply
- left join t_goods_order_info orderInfo on apply.fk_order_id = orderInfo.guid
- left join t_customer_info customer on apply.fk_customer_id = customer.guid
- left join t_goods_order_detail detail on detail.fk_order_guid = orderInfo.guid
- left join t_goods_info goods on goods.guid = detail.fk_goods_guid
- left join t_goods_pay_order payOrder on payOrder.fk_order_id = orderInfo.guid
- <where>
- payOrder.state = 1
- and payOrder.pay_channel = 4
- and apply.state = 1
- and orderInfo.state = 1
- and customer.state = 1
- and detail.state = 1
- and goods.state = 1
- <if test="beginTime != null and beginTime != ''">
- <![CDATA[
- AND orderInfo.create_time >= concat(#{beginTime}, ' 00:00:00')
- ]]>
- </if>
- <if test="endTime != null and endTime != ''">
- <![CDATA[
- AND orderInfo.create_time <= concat(#{endTime},' 23:59:59')
- ]]>
- </if>
- <if test="orderStatus != null">
- AND orderInfo.order_status = #{orderStatus,jdbcType=INTEGER}
- </if>
- <if test="account != null and account != ''">
- AND customer.account = #{account,jdbcType=VARCHAR}
- </if>
- <if test="orderNo != null and orderNo != ''">
- AND orderInfo.orderNo = #{orderNo,jdbcType=VARCHAR}
- </if>
- </where>
- order by apply.modified_time desc
- </select>
- </mapper>
|