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

117 lines
5.5 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.OrderCommentMapper">
<resultMap type="OrderComment" id="OrderCommentResult">
<result property="id" column="id" />
<result property="oid" column="oid" />
<result property="orderId" column="order_id" />
<result property="productId" column="product_id" />
<result property="uid" column="uid" />
<result property="images" column="images" />
<result property="content" column="content" />
<result property="num" column="num" />
<result property="numType" column="num_type" />
<result property="status" column="status" />
<result property="workerId" column="worker_id" />
<result property="createdAt" column="created_at" />
<result property="updatedAt" column="updated_at" />
</resultMap>
<sql id="selectOrderCommentVo">
select id, oid, order_id, product_id, uid, images, content, num, num_type, status, worker_id, created_at, updated_at from order_comment
</sql>
<select id="selectCountOrderCommentByOid" parameterType="Long" resultType="Integer">
select count(0) from order_comment where oid= #{oid}
</select>
<select id="selectOrderCommentByOid" parameterType="long" resultMap="OrderCommentResult">
select * from order_comment where oid= #{oid}
</select>
<select id="selectOrderCommentList" parameterType="OrderComment" resultMap="OrderCommentResult">
<include refid="selectOrderCommentVo"/>
<where>
<if test="oid != null "> and oid = #{oid}</if>
<if test="orderId != null and orderId != ''"> and order_id = #{orderId}</if>
<if test="productId != null "> and product_id = #{productId}</if>
<if test="uid != null "> and uid = #{uid}</if>
<if test="images != null and images != ''"> and images = #{images}</if>
<if test="content != null and content != ''"> and content = #{content}</if>
<if test="num != null "> and num = #{num}</if>
<if test="numType != null "> and num_type = #{numType}</if>
<if test="status != null "> and status = #{status}</if>
<if test="workerId != null "> and worker_id = #{workerId}</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="selectOrderCommentById" parameterType="Long" resultMap="OrderCommentResult">
<include refid="selectOrderCommentVo"/>
where id = #{id}
</select>
<insert id="insertOrderComment" parameterType="OrderComment" useGeneratedKeys="true" keyProperty="id">
insert into order_comment
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="oid != null">oid,</if>
<if test="orderId != null and orderId != ''">order_id,</if>
<if test="productId != null">product_id,</if>
<if test="uid != null">uid,</if>
<if test="images != null">images,</if>
<if test="content != null and content != ''">content,</if>
<if test="num != null">num,</if>
<if test="numType != null">num_type,</if>
<if test="status != null">status,</if>
<if test="workerId != null">worker_id,</if>
created_at,
updated_at
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="oid != null">#{oid},</if>
<if test="orderId != null and orderId != ''">#{orderId},</if>
<if test="productId != null">#{productId},</if>
<if test="uid != null">#{uid},</if>
<if test="images != null">#{images},</if>
<if test="content != null and content != ''">#{content},</if>
<if test="num != null">#{num},</if>
<if test="numType != null">#{numType},</if>
<if test="status != null">#{status},</if>
<if test="workerId != null">#{workerId},</if>
NOW(),
NOW()
</trim>
</insert>
<update id="updateOrderComment" parameterType="OrderComment">
update order_comment
<trim prefix="SET" suffixOverrides=",">
<if test="oid != null">oid = #{oid},</if>
<if test="orderId != null and orderId != ''">order_id = #{orderId},</if>
<if test="productId != null">product_id = #{productId},</if>
<if test="uid != null">uid = #{uid},</if>
<if test="images != null">images = #{images},</if>
<if test="content != null and content != ''">content = #{content},</if>
<if test="num != null">num = #{num},</if>
<if test="numType != null">num_type = #{numType},</if>
<if test="status != null">status = #{status},</if>
<if test="workerId != null">worker_id = #{workerId},</if>
updated_at = NOW()
</trim>
where id = #{id}
</update>
<delete id="deleteOrderCommentById" parameterType="Long">
delete from order_comment where id = #{id}
</delete>
<delete id="deleteOrderCommentByIds" parameterType="String">
delete from order_comment where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>