123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300 |
- <?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="GoodsOrderInfoMapper">
- <resultMap id="BaseResultMap" type="GoodsOrderInfo">
- <id column="guid" jdbcType="CHAR" property="guid" />
- <result column="fk_customer_guid" jdbcType="CHAR" property="fkCustomerGuid" />
- <result column="order_no" jdbcType="CHAR" property="orderNo" />
- <result column="customer_name" jdbcType="VARCHAR" property="customerName" />
- <result column="customer_type" jdbcType="VARCHAR" property="customerType" />
- <result column="order_amount" jdbcType="DECIMAL" property="orderAmount" />
- <result column="order_carbon_amount" jdbcType="DECIMAL" property="orderCarbonAmount" />
- <result column="order_status" jdbcType="INTEGER" property="orderStatus" />
- <result column="state" jdbcType="INTEGER" property="state" />
- <result column="create_user" jdbcType="CHAR" property="createUser" />
- <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
- <result column="modified_user" jdbcType="CHAR" property="modifiedUser" />
- <result column="modified_time" jdbcType="TIMESTAMP" property="modifiedTime" />
- <result column="pay_no" jdbcType="VARCHAR" property="payNo" />
- </resultMap>
- <sql id="Base_Column_List">
- guid, fk_customer_guid, order_no,customer_name,customer_type, order_amount,
- order_carbon_amount, order_status,state, create_user, create_time, modified_user,
- modified_time,pay_no
- </sql>
- <select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
- select
- <include refid="Base_Column_List" />
- from t_goods_order_info
- where guid = #{guid,jdbcType=CHAR}
- </select>
- <select id="searchOrderInfoByPage" parameterType="com.hcloud.microserver.commoncore.base.PageBean"
- resultType="OrderInfoBO">
- SELECT
- aa.guid,
- aa.order_no AS orderNo,
- bb.account AS account,
- bb.phone AS phone,
- case bb.customer_type when 1 then '自然人' when 2 then '履约企业' when 3 then '非履约企业' end as customerTypeName,
- aa.customer_name AS customerName,
- CASE cc.pay_channel
- WHEN 1 THEN
- '微信支付'
- WHEN 2 THEN
- '支付宝'
- WHEN 3 THEN
- '银联支付'
- ELSE
- '线下支付'
- END AS payChannel,
- aa.order_amount AS payAmount,
- aa.order_carbon_amount AS orderCarbonAmount,
- CASE aa.order_status
- WHEN 1 THEN
- '待支付'
- WHEN 2 THEN
- '已支付'
- WHEN 3 THEN
- '已审核'
- WHEN 4 THEN
- '已打款'
- ELSE
- '已作废'
- END AS orderStatus,
- aa.create_time AS createTime,
- dd.credential_no AS credentialNo
- FROM
- t_goods_order_info aa
- LEFT JOIN t_customer_info bb ON aa.fk_customer_guid = bb.guid
- AND bb.is_enable = 1
- AND bb.state = 1
- LEFT JOIN t_goods_pay_order cc ON cc.fk_order_id = aa.guid
- /*AND cc.state = 1
- AND cc.pay_no = aa.pay_no*/
- LEFT JOIN t_goods_credential_info dd ON dd.fk_order_id = aa.guid
- AND dd.state = 1
- WHERE
- aa.state=1
- <if test="data.beginDate!=null and data.beginDate!=''">
- AND aa.create_time >= concat(#{data.beginDate},' 00:00:00')
- </if>
- <if test="data.endDate!=null and data.endDate!=''">
- <![CDATA[
- AND aa.create_time <= concat(#{data.endDate},' 23:59:59')
- ]]>
- </if>
- <if test="data.payChannel!=null and data.payChannel != ''">
- AND cc.pay_channel = #{data.payChannel}
- </if>
- <if test="data.orderStatus!=null and data.orderStatus != ''">
- AND aa.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 aa.order_no = #{data.orderNo}
- </if>
- order by aa.create_time desc
- </select>
- <select id="searchOrderInfoByCustomerId" resultType="OrderInfoBO">
- SELECT
- aa.guid,
- aa.order_no AS orderNo,
- aa.create_time AS createTime,
- aa.order_status AS orderStatus,
- aa.order_amount AS orderAmount,
- aa.order_carbon_amount AS orderCarbonAmount,
- aa.pay_no AS payNo
- FROM
- t_goods_order_info aa
- WHERE
- aa.state = 1
- AND aa.fk_customer_guid = #{custId}
- <if test="orderStatus!=null and orderStatus!=-1">
- AND aa.order_status=#{orderStatus}
- </if>
- order by aa.create_time desc
- </select>
- <select id="getOrderInfoByNo" parameterType="java.lang.String" resultMap="BaseResultMap">
- select
- <include refid="Base_Column_List" />
- from t_goods_order_info
- where
- order_status =1 and state=1
- and order_no = #{orderNo}
- </select>
- <delete id="deleteByPrimaryKey" parameterType="java.lang.String">
- delete from t_goods_order_info
- where guid = #{guid,jdbcType=CHAR}
- </delete>
- <insert id="insert" parameterType="GoodsOrderInfo">
- insert into t_goods_order_info (guid, fk_customer_guid, order_no,
- customer_name,customer_type,order_amount, order_carbon_amount, order_status,
- state, create_user, create_time,
- modified_user, modified_time,pay_no)
- values (#{guid,jdbcType=CHAR}, #{fkCustomerGuid,jdbcType=CHAR}, #{orderNo,jdbcType=CHAR},
- #{customerName,jdbcType=VARCHAR},#{customerType,jdbcType=VARCHAR},#{orderAmount,jdbcType=DECIMAL},
- #{orderCarbonAmount,jdbcType=DECIMAL}, #{orderStatus,jdbcType=INTEGER},
- #{state,jdbcType=INTEGER}, #{createUser,jdbcType=CHAR}, #{createTime,jdbcType=TIMESTAMP},
- #{modifiedUser,jdbcType=CHAR}, #{modifiedTime,jdbcType=TIMESTAMP},#{payNo,jdbcType=VARCHAR})
- </insert>
- <insert id="insertSelective" parameterType="GoodsOrderInfo">
- insert into t_goods_order_info
- <trim prefix="(" suffix=")" suffixOverrides=",">
- <if test="guid != null">
- guid,
- </if>
- <if test="fkCustomerGuid != null">
- fk_customer_guid,
- </if>
- <if test="orderNo != null">
- order_no,
- </if>
- <if test="customerName != null">
- customer_name,
- </if>
- <if test="customerType != null">
- customer_type,
- </if>
- <if test="orderAmount != null">
- order_amount,
- </if>
- <if test="orderCarbonAmount != null">
- order_carbon_amount,
- </if>
- <if test="orderStatus != null">
- order_status,
- </if>
- <if test="state != null">
- state,
- </if>
- <if test="createUser != null">
- create_user,
- </if>
- <if test="createTime != null">
- create_time,
- </if>
- <if test="modifiedUser != null">
- modified_user,
- </if>
- <if test="modifiedTime != null">
- modified_time,
- </if>
- <if test="payNo != null">
- pay_no,
- </if>
- </trim>
- <trim prefix="values (" suffix=")" suffixOverrides=",">
- <if test="guid != null">
- #{guid,jdbcType=CHAR},
- </if>
- <if test="fkCustomerGuid != null">
- #{fkCustomerGuid,jdbcType=CHAR},
- </if>
- <if test="orderNo != null">
- #{orderNo,jdbcType=CHAR},
- </if>
- <if test="customerName != null">
- #{customerName,jdbcType=VARCHAR},
- </if>
- <if test="customerType != null">
- #{customerType,jdbcType=VARCHAR},
- </if>
- <if test="orderAmount != null">
- #{orderAmount,jdbcType=DECIMAL},
- </if>
- <if test="orderCarbonAmount != null">
- #{orderCarbonAmount,jdbcType=DECIMAL},
- </if>
- <if test="orderStatus != null">
- #{orderStatus,jdbcType=INTEGER},
- </if>
- <if test="state != null">
- #{state,jdbcType=INTEGER},
- </if>
- <if test="createUser != null">
- #{createUser,jdbcType=CHAR},
- </if>
- <if test="createTime != null">
- #{createTime,jdbcType=TIMESTAMP},
- </if>
- <if test="modifiedUser != null">
- #{modifiedUser,jdbcType=CHAR},
- </if>
- <if test="modifiedTime != null">
- #{modifiedTime,jdbcType=TIMESTAMP},
- </if>
- <if test="payNo != null">
- #{payNo,jdbcType=VARCHAR},
- </if>
- </trim>
- </insert>
- <update id="updateByPrimaryKeySelective" parameterType="GoodsOrderInfo">
- update t_goods_order_info
- <set>
- <if test="fkCustomerGuid != null">
- fk_customer_guid = #{fkCustomerGuid,jdbcType=CHAR},
- </if>
- <if test="orderNo != null">
- order_no = #{orderNo,jdbcType=CHAR},
- </if>
- <if test="customerName != null">
- customer_name = #{customerName,jdbcType=VARCHAR},
- </if>
- <if test="customerType != null">
- customer_type = #{customerType,jdbcType=VARCHAR},
- </if>
- <if test="orderAmount != null">
- order_amount = #{orderAmount,jdbcType=DECIMAL},
- </if>
- <if test="orderCarbonAmount != null">
- order_carbon_amount = #{orderCarbonAmount,jdbcType=DECIMAL},
- </if>
- <if test="orderStatus != null">
- order_status = #{orderStatus,jdbcType=INTEGER},
- </if>
- <if test="state != null">
- state = #{state,jdbcType=INTEGER},
- </if>
- <if test="createUser != null">
- create_user = #{createUser,jdbcType=CHAR},
- </if>
- <if test="createTime != null">
- create_time = #{createTime,jdbcType=TIMESTAMP},
- </if>
- <if test="modifiedUser != null">
- modified_user = #{modifiedUser,jdbcType=CHAR},
- </if>
- <if test="modifiedTime != null">
- modified_time = #{modifiedTime,jdbcType=TIMESTAMP},
- </if>
- <if test="payNo != null">
- pay_no = #{payNo,jdbcType=VARCHAR},
- </if>
- </set>
- where guid = #{guid,jdbcType=CHAR}
- </update>
- <update id="updateByPrimaryKey" parameterType="GoodsOrderInfo">
- update t_goods_order_info
- set fk_customer_guid = #{fkCustomerGuid,jdbcType=CHAR},
- order_no = #{orderNo,jdbcType=CHAR},
- customer_name = #{customerName,jdbcType=VARCHAR},
- customer_type = #{customerType,jdbcType=VARCHAR},
- order_amount = #{orderAmount,jdbcType=DECIMAL},
- order_carbon_amount = #{orderCarbonAmount,jdbcType=DECIMAL},
- order_status = #{orderStatus,jdbcType=INTEGER},
- state = #{state,jdbcType=INTEGER},
- create_user = #{createUser,jdbcType=CHAR},
- create_time = #{createTime,jdbcType=TIMESTAMP},
- modified_user = #{modifiedUser,jdbcType=CHAR},
- modified_time = #{modifiedTime,jdbcType=TIMESTAMP},
- pay_no = #{payNo,jdbcType=VARCHAR}
- where guid = #{guid,jdbcType=CHAR}
- </update>
- <update id="updateOrderBelongInfo">
- update t_goods_order_info
- set fk_customer_guid = #{newId}
- where fk_customer_guid = #{oldId}
- </update>
- </mapper>
|