159 lines
8.7 KiB
XML
159 lines
8.7 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" />
|
|
</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 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
|
|
where 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}
|
|
</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>
|
|
|
|
<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">
|
|
delete from order_list 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, deleted_at) values
|
|
<foreach item="item" index="index" collection="list" separator=",">
|
|
( #{item.id}, #{item.orderId}, #{item.productCode}, #{item.quantity}, #{item.price}, #{item.amount}, #{item.remark}, #{item.createdAt}, #{item.updatedAt}, #{item.deletedAt})
|
|
</foreach>
|
|
</insert>
|
|
|
|
</mapper> |