| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234 |
- <?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.fs.his.mapper.FsIntegralOrderMapper">
- <resultMap type="FsIntegralOrder" id="FsIntegralOrderResult">
- <result property="orderId" column="order_id" />
- <result property="orderCode" column="order_code" />
- <result property="userId" column="user_id" />
- <result property="userName" column="user_name" />
- <result property="userPhone" column="user_phone" />
- <result property="userAddress" column="user_address" />
- <result property="itemJson" column="item_json" />
- <result property="integral" column="integral" />
- <result property="payMoney" column="pay_money" />
- <result property="isPay" column="is_pay" />
- <result property="payTime" column="pay_time" />
- <result property="payType" column="pay_type" />
- <result property="status" column="status" />
- <result property="deliveryCode" column="delivery_code" />
- <result property="deliveryName" column="delivery_name" />
- <result property="deliverySn" column="delivery_sn" />
- <result property="deliveryTime" column="delivery_time" />
- <result property="createTime" column="create_time" />
- <result property="remark" column="remark" />
- <result property="barCode" column="bar_code" />
- <result property="loginAccount" column="login_account" />
- </resultMap>
- <sql id="selectFsIntegralOrderVo">
- select order_id, order_code, user_id,bar_code, user_name, user_phone, user_address, item_json, integral,pay_money,is_pay,pay_time,pay_type, status, delivery_code, delivery_name, delivery_sn, delivery_time, create_time,qw_user_id,company_user_id,company_id,remark,login_account from fs_integral_order
- </sql>
- <select id="selectFsIntegralOrderList" parameterType="FsIntegralOrder" resultMap="FsIntegralOrderResult">
- <include refid="selectFsIntegralOrderVo"/>
- <where>
- <if test="orderCode != null and orderCode != ''"> and order_code = #{orderCode}</if>
- <if test="userName != null and userName != ''"> and user_name like concat('%', #{userName}, '%')</if>
- <if test="userPhone != null and userPhone != ''"> and user_phone = #{userPhone}</if>
- <if test="integral != null and integral != ''"> and integral = #{integral}</if>
- <if test="payMoney != null and payMoney != ''"> and pay_money = #{payMoney}</if>
- <if test="isPay != null and isPay != ''"> and is_pay = #{isPay}</if>
- <if test="payTime != null and payTime != ''"> and pay_time = #{payTime}</if>
- <if test="payType != null and payType != ''"> and pay_type = #{payType}</if>
- <if test="status != null and status != ''"> and status = #{status}</if>
- <if test="deliverySn != null and deliverySn != ''"> and delivery_sn like concat('%', #{deliverySn}, '%')</if>
- <if test="qwUserId != null and qwUserId != ''"> and qw_user_id = #{qwUserId}</if>
- <if test="companyUserId != null and companyUserId != ''"> and company_user_id = #{companyUserId}</if>
- <if test="companyId != null and companyId != ''"> and company_id = #{companyId}</if>
- <if test="createTime != null "> and create_time = #{createTime}</if>
- </where>
- </select>
- <select id="selectFsIntegralOrderByOrderId" parameterType="Long" resultMap="FsIntegralOrderResult">
- <include refid="selectFsIntegralOrderVo"/>
- where order_id = #{orderId}
- </select>
- <select id="findOrderByIds" resultType="com.fs.his.domain.FsIntegralOrder">
- SELECT * FROM fs_integral_order
- WHERE order_id IN
- <foreach collection="orderIds" item="orderId" open="(" close=")" separator=",">
- #{orderId}
- </foreach>
- </select>
- <select id="selectFsIntegralOrderListJn" resultType="com.fs.his.vo.FsIntegralOrderListVO">
- SELECT
- fio.order_id,
- fio.order_code,
- fio.user_id,
- fio.user_name,
- fio.user_phone,
- fio.user_address,
- fio.item_json,
- fio.integral,
- fio.pay_money,
- fio.is_pay,
- fio.pay_time,
- fio.pay_type,
- fio.`STATUS`,
- fio.delivery_code,
- fio.delivery_name,
- fio.delivery_sn,
- fio.delivery_time,
- fio.create_time,
- fio.qw_user_id,
- fio.company_user_id,
- fio.company_id,
- fio.remark,
- fio.login_account,
- fiod.erp_phone
- FROM
- fs_integral_order fio
- LEFT JOIN fs_integral_order_df fiod
- ON fiod.order_id = fio.order_id
- WHERE
- 1 = 1
- <!-- 订单编码精确查询 -->
- <if test="orderCode != null and orderCode != ''"> AND fio.order_code = #{orderCode} </if>
- <!-- 用户名模糊查询 -->
- <if test="userName != null and userName != ''"> AND fio.user_name LIKE CONCAT('%', #{userName}, '%') </if>
- <!-- 用户手机号精确查询 -->
- <if test="userPhone != null and userPhone != ''"> AND fio.user_phone = #{userPhone} </if>
- <!-- 积分精确查询 -->
- <if test="integral != null and integral != ''"> AND fio.integral = #{integral} </if>
- <!-- 支付金额精确查询 -->
- <if test="payMoney != null and payMoney != ''"> AND fio.pay_money = #{payMoney} </if>
- <!-- 支付状态精确查询 -->
- <if test="isPay != null and isPay != ''"> AND fio.is_pay = #{isPay} </if>
- <!-- 支付时间精确查询 -->
- <if test="payTime != null and payTime != ''"> AND fio.pay_time = #{payTime} </if>
- <!-- 支付类型精确查询 -->
- <if test="payType != null and payType != ''"> AND fio.pay_type = #{payType} </if>
- <!-- 订单状态精确查询 -->
- <if test="status != null and status != ''"> AND fio.status = #{status} </if>
- <!-- 快递单号模糊查询 -->
- <if test="deliverySn != null and deliverySn != ''"> AND fio.delivery_sn LIKE CONCAT('%', #{deliverySn}, '%') </if>
- <!-- 企微用户ID精确查询 -->
- <if test="qwUserId != null and qwUserId != ''"> AND fio.qw_user_id = #{qwUserId} </if>
- <!-- 公司用户ID精确查询 -->
- <if test="companyUserId != null and companyUserId != ''"> AND fio.company_user_id = #{companyUserId} </if>
- <!-- 公司ID精确查询 -->
- <if test="companyId != null and companyId != ''"> AND fio.company_id = #{companyId} </if>
- <!-- 创建时间范围查询(开始时间) -->
- <if test="sTime != null"> AND DATE(fio.create_time) >= DATE(#{sTime}) </if>
- <!-- 创建时间范围查询(结束时间) -->
- <if test="eTime != null"> AND DATE(fio.create_time) <= DATE(#{eTime}) </if>
- <if test="loginAccount != null and loginAccount !=''"> AND fio.login_account = #{loginAccount} </if>
- <if test="isPush != null"> AND COALESCE(fiod.is_push, 0) = 0 </if>
- ORDER BY
- fio.order_id DESC
- </select>
- <insert id="insertFsIntegralOrder" parameterType="FsIntegralOrder" useGeneratedKeys="true" keyProperty="orderId">
- insert into fs_integral_order
- <trim prefix="(" suffix=")" suffixOverrides=",">
- <if test="orderCode != null">order_code,</if>
- <if test="userId != null">user_id,</if>
- <if test="userName != null">user_name,</if>
- <if test="userPhone != null">user_phone,</if>
- <if test="userAddress != null">user_address,</if>
- <if test="itemJson != null">item_json,</if>
- <if test="integral != null">integral,</if>
- <if test="payMoney != null">pay_money,</if>
- <if test="isPay != null">is_pay,</if>
- <if test="payTime != null">pay_time,</if>
- <if test="payType != null">pay_type,</if>
- <if test="status != null and status != ''">status,</if>
- <if test="deliveryCode != null">delivery_code,</if>
- <if test="deliveryName != null">delivery_name,</if>
- <if test="deliverySn != null">delivery_sn,</if>
- <if test="deliveryTime != null">delivery_time,</if>
- <if test="createTime != null">create_time,</if>
- <if test="remark != null">remark,</if>
- <if test="barCode != null">bar_code,</if>
- <if test="qwUserId != null">qw_user_id,</if>
- <if test="companyUserId != null">company_user_id,</if>
- <if test="companyId != null">company_id,</if>
- </trim>
- <trim prefix="values (" suffix=")" suffixOverrides=",">
- <if test="orderId != null">#{orderId},</if>
- <if test="orderCode != null">#{orderCode},</if>
- <if test="userId != null">#{userId},</if>
- <if test="userName != null">#{userName},</if>
- <if test="userPhone != null">#{userPhone},</if>
- <if test="userAddress != null">#{userAddress},</if>
- <if test="itemJson != null">#{itemJson},</if>
- <if test="integral != null">#{integral},</if>
- <if test="payMoney != null">#{payMoney},</if>
- <if test="isPay != null">#{isPay},</if>
- <if test="payTime != null">#{payTime},</if>
- <if test="payType != null">#{payType},</if>
- <if test="status != null and status != ''">#{status},</if>
- <if test="deliveryCode != null">#{deliveryCode},</if>
- <if test="deliveryName != null">#{deliveryName},</if>
- <if test="deliverySn != null">#{deliverySn},</if>
- <if test="deliveryTime != null">#{deliveryTime},</if>
- <if test="createTime != null">#{createTime},</if>
- <if test="remark != null">#{remark},</if>
- <if test="barCode != null">#{barCode},</if>
- <if test="qwUserId != null">#{qwUserId},</if>
- <if test="companyUserId != null">#{companyUserId},</if>
- <if test="companyId != null">#{companyId},</if>
- </trim>
- </insert>
- <update id="updateFsIntegralOrder" parameterType="FsIntegralOrder">
- update fs_integral_order
- <trim prefix="SET" suffixOverrides=",">
- <if test="orderCode != null">order_code = #{orderCode},</if>
- <if test="userId != null">user_id = #{userId},</if>
- <if test="userName != null">user_name = #{userName},</if>
- <if test="userPhone != null">user_phone = #{userPhone},</if>
- <if test="userAddress != null">user_address = #{userAddress},</if>
- <if test="itemJson != null">item_json = #{itemJson},</if>
- <if test="integral != null">integral = #{integral},</if>
- <if test="payMoney != null">pay_money = #{payMoney},</if>
- <if test="isPay != null">is_pay = #{isPay},</if>
- <if test="payTime != null">pay_time = #{payTime},</if>
- <if test="payType != null">pay_type = #{payType},</if>
- <if test="status != null and status != ''">status = #{status},</if>
- <if test="deliveryCode != null">delivery_code = #{deliveryCode},</if>
- <if test="deliveryName != null">delivery_name = #{deliveryName},</if>
- <if test="deliverySn != null">delivery_sn = #{deliverySn},</if>
- <if test="deliveryTime != null">delivery_time = #{deliveryTime},</if>
- <if test="createTime != null">create_time = #{createTime},</if>
- <if test="remark != null">remark = #{remark},</if>
- <if test="barCode != null">bar_code = #{barCode},</if>
- <if test="loginAccount != '' and loginAccount != null">login_account = #{loginAccount},</if>
- </trim>
- where order_id = #{orderId}
- </update>
- <delete id="deleteFsIntegralOrderByOrderId" parameterType="Long">
- delete from fs_integral_order where order_id = #{orderId}
- </delete>
- <delete id="deleteFsIntegralOrderByOrderIds" parameterType="String">
- delete from fs_integral_order where order_id in
- <foreach item="orderId" collection="array" open="(" separator="," close=")">
- #{orderId}
- </foreach>
- </delete>
- <update id="cancelOrder" parameterType="FsIntegralOrder">
- update fs_integral_order set status = -1
- where order_id = #{orderId}
- </update>
- <update id="finishOrder">
- UPDATE fs_integral_order
- SET status = 3
- WHERE order_id = #{orderId}
- AND status = #{oldStatus}
- </update>
- </mapper>
|