2022-04-25 17:06:55 +08:00
|
|
|
<?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.ghy.order.mapper.OrderMasterMapper">
|
|
|
|
|
|
|
|
|
|
<resultMap id="OrderMasterResult" type="com.ghy.order.domain.OrderMaster">
|
|
|
|
|
<id property="id" column="id"/>
|
2022-05-24 22:26:26 +08:00
|
|
|
<result property="deptId" column="dept_id"/>
|
2022-04-25 17:06:55 +08:00
|
|
|
<result property="code" column="code"/>
|
|
|
|
|
<result property="customerId" column="customer_id"/>
|
2022-06-09 14:35:13 +08:00
|
|
|
<result property="addressId" column="address_id"/>
|
2022-04-25 17:06:55 +08:00
|
|
|
<result property="orderType" column="order_type"/>
|
|
|
|
|
<result property="orderStatus" column="order_status"/>
|
|
|
|
|
<result property="payType" column="pay_type"/>
|
|
|
|
|
<result property="payStatus" column="pay_status"/>
|
|
|
|
|
<result property="workerId" column="worker_id"/>
|
|
|
|
|
<result property="payTime" column="pay_time"/>
|
|
|
|
|
<result property="revTime" column="rev_time"/>
|
|
|
|
|
<result property="createBy" column="create_by"/>
|
|
|
|
|
<result property="createTime" column="create_time"/>
|
|
|
|
|
<result property="updateBy" column="update_by"/>
|
|
|
|
|
<result property="updateTime" column="update_time"/>
|
|
|
|
|
<result property="remark" column="remark"/>
|
|
|
|
|
</resultMap>
|
|
|
|
|
|
|
|
|
|
<sql id="selectOrderMaster">
|
|
|
|
|
SELECT id,
|
2022-05-24 22:26:26 +08:00
|
|
|
dept_id,
|
2022-04-25 17:06:55 +08:00
|
|
|
code,
|
|
|
|
|
customer_id,
|
2022-06-09 14:35:13 +08:00
|
|
|
address_id,
|
2022-04-25 17:06:55 +08:00
|
|
|
order_type,
|
|
|
|
|
order_status,
|
|
|
|
|
pay_type,
|
|
|
|
|
pay_status,
|
|
|
|
|
worker_id,
|
|
|
|
|
pay_time,
|
|
|
|
|
rev_time,
|
|
|
|
|
create_by,
|
|
|
|
|
create_time,
|
|
|
|
|
remark
|
|
|
|
|
FROM order_master
|
|
|
|
|
</sql>
|
|
|
|
|
|
|
|
|
|
<select id="selectOrderMasterList" parameterType="com.ghy.order.domain.OrderMaster" resultMap="OrderMasterResult">
|
|
|
|
|
<include refid="selectOrderMaster"/>
|
|
|
|
|
<where>
|
2022-05-24 22:26:26 +08:00
|
|
|
<if test="deptId != null and deptId != 0">
|
|
|
|
|
AND dept_id = #{deptId}
|
|
|
|
|
</if>
|
2022-04-25 17:06:55 +08:00
|
|
|
<if test="code != null and code != ''">
|
2022-05-24 22:26:26 +08:00
|
|
|
AND `code` LIKE concat('%', #{code}, '%')
|
2022-04-25 17:06:55 +08:00
|
|
|
</if>
|
|
|
|
|
<if test="customerId != null and customerId != 0">
|
|
|
|
|
AND customer_id = #{customerId}
|
|
|
|
|
</if>
|
2022-05-24 22:26:26 +08:00
|
|
|
<if test="orderType != null">
|
2022-04-25 17:06:55 +08:00
|
|
|
AND order_type = #{orderType}
|
|
|
|
|
</if>
|
2022-05-24 22:26:26 +08:00
|
|
|
<if test="orderStatus != null">
|
2022-04-25 17:06:55 +08:00
|
|
|
AND order_status = #{orderStatus}
|
|
|
|
|
</if>
|
2022-05-24 22:26:26 +08:00
|
|
|
<if test="payType != null">
|
2022-04-25 17:06:55 +08:00
|
|
|
AND pay_type = #{payType}
|
|
|
|
|
</if>
|
2022-05-24 22:26:26 +08:00
|
|
|
<if test="payStatus != null">
|
2022-04-25 17:06:55 +08:00
|
|
|
AND pay_status = #{payStatus}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="workerId != null and workerId != 0">
|
|
|
|
|
AND worker_id = #{workerId}
|
|
|
|
|
</if>
|
|
|
|
|
</where>
|
2022-06-17 23:26:26 +08:00
|
|
|
order by create_time desc;
|
2022-04-25 17:06:55 +08:00
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<select id="selectById" parameterType="long" resultMap="OrderMasterResult">
|
|
|
|
|
<include refid="selectOrderMaster"/>
|
|
|
|
|
<where>
|
|
|
|
|
<if test="orderMasterId != null and orderMasterId != 0">
|
|
|
|
|
AND id = #{orderMasterId}
|
|
|
|
|
</if>
|
|
|
|
|
</where>
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<delete id="deleteOrderMasterByIds" parameterType="Long">
|
|
|
|
|
DELETE FROM order_master WHERE id IN
|
|
|
|
|
<foreach collection="array" item="orderMasterId" open="(" separator="," close=")">
|
|
|
|
|
#{orderMasterId}
|
|
|
|
|
</foreach>
|
|
|
|
|
</delete>
|
|
|
|
|
|
|
|
|
|
<update id="updateOrderMaster" parameterType="com.ghy.order.domain.OrderMaster">
|
|
|
|
|
UPDATE order_master
|
|
|
|
|
<set>
|
|
|
|
|
<if test="code != null and code != ''">code = #{code},</if>
|
2022-05-24 22:26:26 +08:00
|
|
|
<if test="customerId != null and customerId != 0">customer_id = #{customerId},</if>
|
|
|
|
|
<if test="orderType != null">order_type = #{orderType},</if>
|
|
|
|
|
<if test="orderStatus != null">order_status = #{orderStatus},</if>
|
|
|
|
|
<if test="payType != null">pay_type = #{payType},</if>
|
|
|
|
|
<if test="payStatus != null">pay_status = #{payStatus},</if>
|
|
|
|
|
<if test="workerId != null and workerId != 0">worker_id = #{workerId},</if>
|
|
|
|
|
<if test="payTime != null">pay_time = #{payTime},</if>
|
|
|
|
|
<if test="revTime != null">rev_time = #{revTime},</if>
|
2022-04-25 17:06:55 +08:00
|
|
|
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
|
|
|
|
|
update_time = SYSDATE()
|
|
|
|
|
</set>
|
|
|
|
|
WHERE id = #{id}
|
|
|
|
|
</update>
|
|
|
|
|
|
|
|
|
|
<insert id="insertOrderMaster" parameterType="com.ghy.order.domain.OrderMaster" useGeneratedKeys="true" keyProperty="id">
|
|
|
|
|
INSERT INTO order_master(
|
2022-05-24 22:26:26 +08:00
|
|
|
<if test="deptId != null and deptId != 0">dept_id,</if>
|
|
|
|
|
<if test="code != null and code != ''">code,</if>
|
|
|
|
|
<if test="customerId != null and customerId != 0">customer_id,</if>
|
2022-06-09 14:35:13 +08:00
|
|
|
<if test="addressId != null and addressId != 0">address_id,</if>
|
2022-05-24 22:26:26 +08:00
|
|
|
<if test="orderType != null">order_type,</if>
|
|
|
|
|
<if test="orderStatus != null">order_status,</if>
|
|
|
|
|
<if test="payType != null">pay_type,</if>
|
|
|
|
|
<if test="payStatus != null">pay_status,</if>
|
|
|
|
|
<if test="workerId != null and workerId != 0">worker_id,</if>
|
|
|
|
|
<if test="payTime != null">pay_time,</if>
|
|
|
|
|
<if test="revTime != null">rev_time,</if>
|
2022-04-25 17:06:55 +08:00
|
|
|
<if test="createBy != null and createBy != ''">create_by,</if>
|
|
|
|
|
create_time
|
|
|
|
|
)VALUES(
|
2022-05-24 22:26:26 +08:00
|
|
|
<if test="deptId != null and deptId != 0">#{deptId},</if>
|
2022-05-12 14:30:06 +08:00
|
|
|
<if test="code != null">#{code},</if>
|
2022-05-24 22:26:26 +08:00
|
|
|
<if test="customerId != null and customerId != 0">#{customerId},</if>
|
2022-06-09 14:35:13 +08:00
|
|
|
<if test="addressId != null and addressId != 0">#{address_id},</if>
|
2022-05-24 22:26:26 +08:00
|
|
|
<if test="orderType != null">#{orderType},</if>
|
|
|
|
|
<if test="orderStatus != null">#{orderStatus},</if>
|
|
|
|
|
<if test="payType != null">#{payType},</if>
|
|
|
|
|
<if test="payStatus != null">#{payStatus},</if>
|
|
|
|
|
<if test="workerId != null and workerId != 0">#{workerId},</if>
|
|
|
|
|
<if test="payTime != null">#{payTime},</if>
|
|
|
|
|
<if test="revTime != null">#{revTime},</if>
|
2022-04-25 17:06:55 +08:00
|
|
|
<if test="createBy != null and createBy != ''">#{createBy},</if>
|
|
|
|
|
SYSDATE()
|
|
|
|
|
)
|
|
|
|
|
</insert>
|
|
|
|
|
|
|
|
|
|
<select id="checkOrderMasterCodeUnique" parameterType="String" resultMap="OrderMasterResult">
|
|
|
|
|
<include refid="selectOrderMaster"/>
|
|
|
|
|
WHERE `code` =#{orderMasterCode} LIMIT 1
|
|
|
|
|
</select>
|
|
|
|
|
|
2022-05-29 17:52:49 +08:00
|
|
|
<select id="selectByCode" parameterType="String" resultMap="OrderMasterResult">
|
2022-05-11 20:10:00 +08:00
|
|
|
<include refid="selectOrderMaster"/>
|
|
|
|
|
WHERE `code` = #{orderMasterCode}
|
|
|
|
|
</select>
|
|
|
|
|
|
2022-05-12 14:30:06 +08:00
|
|
|
</mapper>
|