javacodeadmin/ruoyi-system/src/main/resources/mapper/system/IntegralOrderMapper.xml

131 lines
7.0 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.system.mapper.IntegralOrderMapper">
<resultMap type="IntegralOrder" id="IntegralOrderResult">
<result property="id" column="id" />
<result property="orderId" column="order_id" />
<result property="uid" column="uid" />
<result property="userName" column="user_name" />
<result property="userPhone" column="user_phone" />
<result property="userAddress" column="user_address" />
<result property="productId" column="product_id" />
<result property="sku" column="sku" />
<result property="num" column="num" />
<result property="price" column="price" />
<result property="totalPrice" column="total_price" />
<result property="status" column="status" />
<result property="deliveryId" column="delivery_id" />
<result property="deliveryNum" column="delivery_num" />
<result property="mark" column="mark" />
<result property="createdAt" column="created_at" />
<result property="updatedAt" column="updated_at" />
</resultMap>
<sql id="selectIntegralOrderVo">
select id, order_id, uid, user_name, user_phone, user_address, product_id, sku, num, price, total_price, status, delivery_id, delivery_num, mark, created_at, updated_at from integral_order
</sql>
<select id="selectIntegralOrderList" parameterType="IntegralOrder" resultMap="IntegralOrderResult">
<include refid="selectIntegralOrderVo"/>
<where>
<if test="orderId != null and orderId != ''"> and order_id = #{orderId}</if>
<if test="uid != null "> and uid = #{uid}</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="userAddress != null and userAddress != ''"> and user_address = #{userAddress}</if>
<if test="productId != null "> and product_id = #{productId}</if>
<if test="sku != null and sku != ''"> and sku = #{sku}</if>
<if test="num != null "> and num = #{num}</if>
<if test="price != null "> and price = #{price}</if>
<if test="totalPrice != null "> and total_price = #{totalPrice}</if>
<if test="status != null and status != ''"> and status = #{status}</if>
<if test="deliveryId != null "> and delivery_id = #{deliveryId}</if>
<if test="deliveryNum != null and deliveryNum != ''"> and delivery_num = #{deliveryNum}</if>
<if test="mark != null and mark != ''"> and mark = #{mark}</if>
<if test="createdAt != null "> and created_at = #{createdAt}</if>
<if test="updatedAt != null "> and updated_at = #{updatedAt}</if>
</where>
order by id desc
</select>
<select id="selectIntegralOrderById" parameterType="Long" resultMap="IntegralOrderResult">
<include refid="selectIntegralOrderVo"/>
where id = #{id}
</select>
<insert id="insertIntegralOrder" parameterType="IntegralOrder" useGeneratedKeys="true" keyProperty="id">
insert into integral_order
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="orderId != null and orderId != ''">order_id,</if>
<if test="uid != null">uid,</if>
<if test="userName != null and userName != ''">user_name,</if>
<if test="userPhone != null and userPhone != ''">user_phone,</if>
<if test="userAddress != null and userAddress != ''">user_address,</if>
<if test="productId != null">product_id,</if>
<if test="sku != null and sku != ''">sku,</if>
<if test="num != null">num,</if>
<if test="price != null">price,</if>
<if test="totalPrice != null">total_price,</if>
<if test="status != null and status != ''">status,</if>
<if test="deliveryId != null">delivery_id,</if>
<if test="deliveryNum != null">delivery_num,</if>
<if test="mark != null">mark,</if>
created_at,
updated_at,
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="orderId != null and orderId != ''">#{orderId},</if>
<if test="uid != null">#{uid},</if>
<if test="userName != null and userName != ''">#{userName},</if>
<if test="userPhone != null and userPhone != ''">#{userPhone},</if>
<if test="userAddress != null and userAddress != ''">#{userAddress},</if>
<if test="productId != null">#{productId},</if>
<if test="sku != null and sku != ''">#{sku},</if>
<if test="num != null">#{num},</if>
<if test="price != null">#{price},</if>
<if test="totalPrice != null">#{totalPrice},</if>
<if test="status != null and status != ''">#{status},</if>
<if test="deliveryId != null">#{deliveryId},</if>
<if test="deliveryNum != null">#{deliveryNum},</if>
<if test="mark != null">#{mark},</if>
NOW(),
NOW()
</trim>
</insert>
<update id="updateIntegralOrder" parameterType="IntegralOrder">
update integral_order
<trim prefix="SET" suffixOverrides=",">
<if test="orderId != null and orderId != ''">order_id = #{orderId},</if>
<if test="uid != null">uid = #{uid},</if>
<if test="userName != null and userName != ''">user_name = #{userName},</if>
<if test="userPhone != null and userPhone != ''">user_phone = #{userPhone},</if>
<if test="userAddress != null and userAddress != ''">user_address = #{userAddress},</if>
<if test="productId != null">product_id = #{productId},</if>
<if test="sku != null and sku != ''">sku = #{sku},</if>
<if test="num != null">num = #{num},</if>
<if test="price != null">price = #{price},</if>
<if test="totalPrice != null">total_price = #{totalPrice},</if>
<if test="status != null and status != ''">status = #{status},</if>
<if test="deliveryId != null">delivery_id = #{deliveryId},</if>
<if test="deliveryNum != null">delivery_num = #{deliveryNum},</if>
<if test="mark != null">mark = #{mark},</if>
updated_at = NOW()
</trim>
where id = #{id}
</update>
<delete id="deleteIntegralOrderById" parameterType="Long">
delete from integral_order where id = #{id}
</delete>
<delete id="deleteIntegralOrderByIds" parameterType="String">
delete from integral_order where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>