255 lines
11 KiB
XML
255 lines
11 KiB
XML
<?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.ruoyi.sip.mapper.OrderInfoMapper">
|
|
|
|
<resultMap type="OrderInfo" id="OrderInfoResult">
|
|
<result property="id" column="id"/>
|
|
<result property="projectCode" column="project_code"/>
|
|
<result property="orderCode" column="order_code"/>
|
|
<result property="versionCode" column="version_code"/>
|
|
<result property="orderName" column="order_name"/>
|
|
<result property="customerName" column="customer_name"/>
|
|
<result property="customerContact" column="customer_contact"/>
|
|
<result property="customerPhone" column="customer_phone"/>
|
|
<result property="customerEmail" column="customer_email"/>
|
|
<result property="orderType" column="order_type"/>
|
|
<result property="orderDept" column="order_dept"/>
|
|
<result property="partenerDept" column="partener_dept"/>
|
|
<result property="orderDate" column="order_date"/>
|
|
<result property="status" column="status"/>
|
|
<result property="remark" column="remark"/>
|
|
<result property="createdAt" column="created_at"/>
|
|
<result property="updatedAt" column="updated_at"/>
|
|
<result property="deletedAt" column="deleted_at"/>
|
|
</resultMap>
|
|
|
|
<resultMap id="OrderInfoOrderListResult" type="OrderInfo" extends="OrderInfoResult">
|
|
<collection property="orderListList" ofType="OrderList" column="id" select="selectOrderListList"/>
|
|
</resultMap>
|
|
|
|
<resultMap type="OrderList" id="OrderListResult">
|
|
<result property="id" column="id"/>
|
|
<result property="orderId" column="order_id"/>
|
|
<result property="productCode" column="product_code"/>
|
|
<result property="quantity" column="quantity"/>
|
|
<result property="price" column="price"/>
|
|
<result property="amount" column="amount"/>
|
|
<result property="remark" column="remark"/>
|
|
<result property="createdAt" column="created_at"/>
|
|
<result property="updatedAt" column="updated_at"/>
|
|
<result property="deletedAt" column="deleted_at"/>
|
|
</resultMap>
|
|
|
|
<sql id="selectOrderInfoVo">
|
|
select id,
|
|
project_code,
|
|
order_code,
|
|
version_code,
|
|
order_name,
|
|
customer_name,
|
|
customer_contact,
|
|
customer_phone,
|
|
customer_email,
|
|
order_type,
|
|
order_dept,
|
|
partener_dept,
|
|
order_date,
|
|
status,
|
|
remark,
|
|
created_at,
|
|
updated_at,
|
|
deleted_at
|
|
from order_info
|
|
</sql>
|
|
|
|
<select id="selectOrderInfoList" parameterType="OrderInfo" resultMap="OrderInfoResult">
|
|
<include refid="selectOrderInfoVo"/>
|
|
<where>
|
|
and status=0
|
|
<if test="orderCode != null and orderCode != ''">and order_code like concat('%', #{orderCode}, '%')</if>
|
|
<if test="orderName != null and orderName != ''">and order_name like concat('%', #{orderName}, '%')</if>
|
|
<if test="customerName != null and customerName != ''">and customer_name like concat('%', #{customerName},
|
|
'%')
|
|
</if>
|
|
<if test="orderType != null and orderType != ''">and order_type = #{orderType}</if>
|
|
</where>
|
|
</select>
|
|
|
|
<select id="selectOrderInfoById" parameterType="Long" resultMap="OrderInfoOrderListResult">
|
|
select t1.id,
|
|
t1.project_code,
|
|
t1.order_code,
|
|
t1.version_code,
|
|
t1.order_name,
|
|
t1.customer_name,
|
|
t1.customer_contact,
|
|
t1.customer_phone,
|
|
t1.customer_email,
|
|
t1.order_type,
|
|
t1.order_dept,
|
|
t1.partener_dept,
|
|
t1.order_date,
|
|
t1.status,
|
|
t1.remark,
|
|
t1.created_at,
|
|
t1. updated_at,
|
|
t1.deleted_at,
|
|
t2.dept_name as order_dept_name,
|
|
t3.dept_name as partener_dept_name
|
|
from order_info t1
|
|
left join sys_dept t2 on t1.order_dept = t2.dept_id
|
|
left join sys_dept t3 on t1.partener_dept = t3.dept_id
|
|
where t1.id = #{id}
|
|
</select>
|
|
|
|
<select id="selectOrderListList" resultMap="OrderListResult">
|
|
select id,
|
|
order_id,
|
|
product_code,
|
|
quantity,
|
|
price,
|
|
amount,
|
|
remark,
|
|
created_at,
|
|
updated_at,
|
|
deleted_at
|
|
from order_list
|
|
where order_id = #{order_id}
|
|
and status=0
|
|
</select>
|
|
<select id="listOrderListByDeliveryId" resultMap="OrderListResult">
|
|
select id,
|
|
order_id,
|
|
product_code,
|
|
quantity,
|
|
price,
|
|
amount,
|
|
remark,
|
|
created_at,
|
|
updated_at,
|
|
deleted_at
|
|
from order_list
|
|
where order_id = (select order_id from order_delivery where id = #{deliveryId} and status=0)
|
|
and status=0
|
|
</select>
|
|
|
|
<insert id="insertOrderInfo" parameterType="OrderInfo" useGeneratedKeys="true" keyProperty="id">
|
|
insert into order_info
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
<if test="projectCode != null">project_code,</if>
|
|
<if test="orderCode != null and orderCode != ''">order_code,</if>
|
|
<if test="versionCode != null">version_code,</if>
|
|
<if test="orderName != null and orderName != ''">order_name,</if>
|
|
<if test="customerName != null and customerName != ''">customer_name,</if>
|
|
<if test="customerContact != null">customer_contact,</if>
|
|
<if test="customerPhone != null">customer_phone,</if>
|
|
<if test="customerEmail != null">customer_email,</if>
|
|
<if test="orderType != null">order_type,</if>
|
|
<if test="orderDept != null">order_dept,</if>
|
|
<if test="partenerDept != null">partener_dept,</if>
|
|
<if test="orderDate != null">order_date,</if>
|
|
<if test="status != null">status,</if>
|
|
<if test="remark != null">remark,</if>
|
|
created_at,status,
|
|
</trim>
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
<if test="projectCode != null">#{projectCode},</if>
|
|
<if test="orderCode != null and orderCode != ''">#{orderCode},</if>
|
|
<if test="versionCode != null">#{versionCode},</if>
|
|
<if test="orderName != null and orderName != ''">#{orderName},</if>
|
|
<if test="customerName != null and customerName != ''">#{customerName},</if>
|
|
<if test="customerContact != null">#{customerContact},</if>
|
|
<if test="customerPhone != null">#{customerPhone},</if>
|
|
<if test="customerEmail != null">#{customerEmail},</if>
|
|
<if test="orderType != null">#{orderType},</if>
|
|
<if test="orderDept != null">#{orderDept},</if>
|
|
<if test="partenerDept != null">#{partenerDept},</if>
|
|
<if test="orderDate != null">#{orderDate},</if>
|
|
<if test="status != null">#{status},</if>
|
|
<if test="remark != null">#{remark},</if>
|
|
NOW(),0
|
|
</trim>
|
|
</insert>
|
|
|
|
<update id="updateOrderInfo" parameterType="OrderInfo">
|
|
update order_info
|
|
<trim prefix="SET" suffixOverrides=",">
|
|
<if test="projectCode != null">project_code = #{projectCode},</if>
|
|
<if test="orderCode != null and orderCode != ''">order_code = #{orderCode},</if>
|
|
<if test="versionCode != null">version_code = #{versionCode},</if>
|
|
<if test="orderName != null and orderName != ''">order_name = #{orderName},</if>
|
|
<if test="customerName != null and customerName != ''">customer_name = #{customerName},</if>
|
|
<if test="customerContact != null">customer_contact = #{customerContact},</if>
|
|
<if test="customerPhone != null">customer_phone = #{customerPhone},</if>
|
|
<if test="customerEmail != null">customer_email = #{customerEmail},</if>
|
|
<if test="orderType != null">order_type = #{orderType},</if>
|
|
<if test="orderDept != null">order_dept = #{orderDept},</if>
|
|
<if test="partenerDept != null">partener_dept = #{partenerDept},</if>
|
|
<if test="orderDate != null">order_date = #{orderDate},</if>
|
|
<if test="status != null">status = #{status},</if>
|
|
<if test="remark != null">remark = #{remark},</if>
|
|
updated_at = NOW(),
|
|
</trim>
|
|
where id = #{id}
|
|
</update>
|
|
<update id="logicRemoveListById">
|
|
update order_list set deleted_at=NOW(), status=1 where id in
|
|
<foreach item="item" index="index" collection="list" open="(" close=")" separator=",">
|
|
#{item.id}
|
|
</foreach>
|
|
|
|
</update>
|
|
<update id="updateListBatch">
|
|
<foreach item="item" index="index" collection="list" separator=";">
|
|
update order_list
|
|
<trim prefix="SET" suffixOverrides=",">
|
|
<if test="productCode != null">product_code = #{productCode},</if>
|
|
<if test="quantity != null ">quantity = #{quantity},</if>
|
|
<if test="price != null">price = #{price},</if>
|
|
<if test="amount != null">amount = #{amount},</if>
|
|
|
|
<if test="remark != null and remark!=''">remark = #{remark},</if>
|
|
updated_at = NOW(),
|
|
</trim>
|
|
where id = #{item.id}
|
|
</foreach>
|
|
</update>
|
|
|
|
<delete id="deleteOrderInfoById" parameterType="Long">
|
|
update order_info
|
|
set deleted_at=NOW(),
|
|
status=1
|
|
where id = #{id}
|
|
</delete>
|
|
|
|
<delete id="deleteOrderInfoByIds" parameterType="String">
|
|
update order_info set deleted_at=NOW(), status=1 where id in
|
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
|
#{id}
|
|
</foreach>
|
|
</delete>
|
|
|
|
<delete id="deleteOrderListByOrderIds" parameterType="String">
|
|
update order_list set status=1,deleted_at=now() where order_id in
|
|
<foreach item="orderId" collection="array" open="(" separator="," close=")">
|
|
#{orderId}
|
|
</foreach>
|
|
</delete>
|
|
|
|
<delete id="deleteOrderListByOrderId" parameterType="Long">
|
|
delete
|
|
from order_list
|
|
where order_id = #{orderId}
|
|
</delete>
|
|
|
|
<insert id="batchOrderList">
|
|
insert into order_list( id, order_id, product_code, quantity, price, amount, remark, created_at, updated_at) values
|
|
<foreach item="item" index="index" collection="list" separator=",">
|
|
( #{item.id}, #{item.orderId}, #{item.productCode}, #{item.quantity}, #{item.price}, #{item.amount},
|
|
#{item.remark}, now(),now())
|
|
</foreach>
|
|
</insert>
|
|
|
|
</mapper> |