138 lines
6.9 KiB
XML
138 lines
6.9 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.HuayangProductMapper">
|
|
|
|
<resultMap type="com.ruoyi.system.domain.HuayangProduct" id="HuayangProductResult">
|
|
<result property="productId" column="product_id" />
|
|
<result property="productName" column="product_name" />
|
|
<result property="categoryId" column="category_id" />
|
|
<result property="categoryName" column="category_name" />
|
|
<result property="productImages" column="product_images" />
|
|
<result property="qualificationImages" column="qualification_images" />
|
|
<result property="productDesc" column="product_desc" />
|
|
<result property="productPrice" column="product_price" />
|
|
<result property="sortOrder" column="sort_order" />
|
|
<result property="status" column="status" />
|
|
<result property="isHome" column="is_home" />
|
|
<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="selectHuayangProductVo">
|
|
SELECT p.product_id, p.product_name, p.category_id, c.category_name,
|
|
p.product_images, p.qualification_images, p.product_desc, p.product_price,
|
|
p.sort_order, p.status, p.is_home, p.create_by, p.create_time,
|
|
p.update_by, p.update_time, p.remark
|
|
FROM huayang_product p
|
|
LEFT JOIN huayang_product_category c ON p.category_id = c.category_id
|
|
</sql>
|
|
|
|
<select id="selectHuayangProductList" parameterType="com.ruoyi.system.domain.HuayangProduct" resultMap="HuayangProductResult">
|
|
<include refid="selectHuayangProductVo"/>
|
|
<where>
|
|
<if test="productName != null and productName != ''">
|
|
AND p.product_name LIKE CONCAT('%', #{productName}, '%')
|
|
</if>
|
|
<if test="categoryId != null">
|
|
AND p.category_id = #{categoryId}
|
|
</if>
|
|
<if test="status != null and status != ''">
|
|
AND p.status = #{status}
|
|
</if>
|
|
<if test="isHome != null and isHome != ''">
|
|
AND p.is_home = #{isHome}
|
|
</if>
|
|
</where>
|
|
ORDER BY p.sort_order ASC, p.product_id ASC
|
|
</select>
|
|
|
|
<select id="selectHuayangProductPublicList" resultMap="HuayangProductResult">
|
|
SELECT p.product_id, p.product_name, p.category_id, c.category_name,
|
|
p.product_images, p.qualification_images, p.product_desc, p.product_price,
|
|
p.sort_order, p.status, p.is_home
|
|
FROM huayang_product p
|
|
LEFT JOIN huayang_product_category c ON p.category_id = c.category_id
|
|
WHERE p.status = '0'
|
|
<if test="categoryId != null">
|
|
AND p.category_id = #{categoryId}
|
|
</if>
|
|
<if test="keyword != null and keyword != ''">
|
|
AND p.product_name LIKE CONCAT('%', #{keyword}, '%')
|
|
</if>
|
|
ORDER BY p.sort_order ASC, p.product_id ASC
|
|
</select>
|
|
|
|
<select id="selectHuayangProductById" parameterType="Long" resultMap="HuayangProductResult">
|
|
<include refid="selectHuayangProductVo"/>
|
|
WHERE p.product_id = #{productId}
|
|
</select>
|
|
|
|
<insert id="insertHuayangProduct" parameterType="com.ruoyi.system.domain.HuayangProduct" useGeneratedKeys="true" keyProperty="productId">
|
|
INSERT INTO huayang_product
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
<if test="productName != null and productName != ''">product_name,</if>
|
|
<if test="categoryId != null">category_id,</if>
|
|
<if test="productImages != null">product_images,</if>
|
|
<if test="qualificationImages != null">qualification_images,</if>
|
|
<if test="productDesc != null">product_desc,</if>
|
|
<if test="productPrice != null">product_price,</if>
|
|
<if test="sortOrder != null">sort_order,</if>
|
|
<if test="status != null">status,</if>
|
|
<if test="isHome != null">is_home,</if>
|
|
<if test="createBy != null">create_by,</if>
|
|
<if test="createTime != null">create_time,</if>
|
|
<if test="remark != null">remark,</if>
|
|
</trim>
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
<if test="productName != null and productName != ''">#{productName},</if>
|
|
<if test="categoryId != null">#{categoryId},</if>
|
|
<if test="productImages != null">#{productImages},</if>
|
|
<if test="qualificationImages != null">#{qualificationImages},</if>
|
|
<if test="productDesc != null">#{productDesc},</if>
|
|
<if test="productPrice != null">#{productPrice},</if>
|
|
<if test="sortOrder != null">#{sortOrder},</if>
|
|
<if test="status != null">#{status},</if>
|
|
<if test="isHome != null">#{isHome},</if>
|
|
<if test="createBy != null">#{createBy},</if>
|
|
<if test="createTime != null">#{createTime},</if>
|
|
<if test="remark != null">#{remark},</if>
|
|
</trim>
|
|
</insert>
|
|
|
|
<update id="updateHuayangProduct" parameterType="com.ruoyi.system.domain.HuayangProduct">
|
|
UPDATE huayang_product
|
|
<trim prefix="SET" suffixOverrides=",">
|
|
<if test="productName != null and productName != ''">product_name = #{productName},</if>
|
|
<if test="categoryId != null">category_id = #{categoryId},</if>
|
|
<if test="productImages != null">product_images = #{productImages},</if>
|
|
<if test="qualificationImages != null">qualification_images = #{qualificationImages},</if>
|
|
<if test="productDesc != null">product_desc = #{productDesc},</if>
|
|
<if test="productPrice != null">product_price = #{productPrice},</if>
|
|
<if test="sortOrder != null">sort_order = #{sortOrder},</if>
|
|
<if test="status != null">status = #{status},</if>
|
|
<if test="isHome != null">is_home = #{isHome},</if>
|
|
<if test="updateBy != null">update_by = #{updateBy},</if>
|
|
<if test="updateTime != null">update_time = #{updateTime},</if>
|
|
<if test="remark != null">remark = #{remark},</if>
|
|
</trim>
|
|
WHERE product_id = #{productId}
|
|
</update>
|
|
|
|
<delete id="deleteHuayangProductById" parameterType="Long">
|
|
DELETE FROM huayang_product WHERE product_id = #{productId}
|
|
</delete>
|
|
|
|
<delete id="deleteHuayangProductByIds" parameterType="Long">
|
|
DELETE FROM huayang_product WHERE product_id IN
|
|
<foreach item="productId" collection="array" open="(" separator="," close=")">
|
|
#{productId}
|
|
</foreach>
|
|
</delete>
|
|
|
|
</mapper>
|