173 lines
8.0 KiB
XML
173 lines
8.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.BsGoodsMapper">
|
|
|
|
<resultMap type="BsGoods" id="BsGoodsResult">
|
|
<result property="id" column="id" />
|
|
<result property="name" column="name" />
|
|
<result property="cover" column="cover" />
|
|
<result property="technicalTypeId" column="technical_type_id" />
|
|
<result property="designTypeId" column="design_type_id" />
|
|
<result property="price" column="price" />
|
|
<result property="introduction" column="introduction" />
|
|
<result property="details" column="details" />
|
|
<result property="video" column="video" />
|
|
<result property="help" column="help" />
|
|
<result property="resource" column="resource" />
|
|
<result property="createTime" column="create_time" />
|
|
</resultMap>
|
|
|
|
|
|
<resultMap type="BsGoodsVO" id="BsGoodsVOResult">
|
|
<result property="id" column="id" />
|
|
<result property="name" column="name" />
|
|
<result property="cover" column="cover" />
|
|
<result property="price" column="price" />
|
|
<result property="introduction" column="introduction" />
|
|
<result property="details" column="details" />
|
|
<result property="video" column="video" />
|
|
<result property="help" column="help" />
|
|
<result property="resource" column="resource" />
|
|
<result property="createName" column="create_name" />
|
|
<result property="createTime" column="create_time" />
|
|
<result property="designName" column="designName" />
|
|
<result property="technicalName" column="technicalName" />
|
|
|
|
|
|
</resultMap>
|
|
|
|
<sql id="selectBsGoodsVo">
|
|
select id, name, cover, technical_type_id, design_type_id, price, introduction, details, resource, create_id, create_time, video, help from bs_goods
|
|
</sql>
|
|
|
|
<select id="selectBsGoodsList" parameterType="BsGoods" resultMap="BsGoodsResult">
|
|
<include refid="selectBsGoodsVo"/>
|
|
<where>
|
|
<if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
|
|
<if test="cover != null and cover != ''"> and cover = #{cover}</if>
|
|
<if test="technicalTypeId != null "> and technical_type_id = #{technicalTypeId}</if>
|
|
<if test="designTypeId != null "> and design_type_id like concat('%', #{designTypeId}, '%')</if>
|
|
<if test="price != null and price != ''"> and price = #{price}</if>
|
|
<if test="introduction != null and introduction != ''"> and introduction = #{introduction}</if>
|
|
<if test="details != null and details != ''"> and details = #{details}</if>
|
|
<if test="resource != null and resource != ''"> and resource = #{resource}</if>
|
|
</where>
|
|
</select>
|
|
|
|
<select id="selectBsGoodsById" parameterType="Long" resultMap="BsGoodsResult">
|
|
<include refid="selectBsGoodsVo"/>
|
|
where id = #{id}
|
|
</select>
|
|
|
|
<insert id="insertBsGoods" parameterType="BsGoods">
|
|
insert into bs_goods
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
<if test="id != null">id,</if>
|
|
<if test="name != null">name,</if>
|
|
<if test="cover != null">cover,</if>
|
|
<if test="technicalTypeId != null">technical_type_id,</if>
|
|
<if test="designTypeId != null">design_type_id,</if>
|
|
<if test="price != null">price,</if>
|
|
<if test="introduction != null">introduction,</if>
|
|
<if test="details != null">details,</if>
|
|
<if test="video != null">video,</if>
|
|
<if test="help != null">help,</if>
|
|
<if test="resource != null">resource,</if>
|
|
<if test="createId != null">create_id,</if>
|
|
<if test="createTime != null">create_time,</if>
|
|
</trim>
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
<if test="id != null">#{id},</if>
|
|
<if test="name != null">#{name},</if>
|
|
<if test="cover != null">#{cover},</if>
|
|
<if test="technicalTypeId != null">#{technicalTypeId},</if>
|
|
<if test="designTypeId != null">#{designTypeId},</if>
|
|
<if test="price != null">#{price},</if>
|
|
<if test="introduction != null">#{introduction},</if>
|
|
<if test="details != null">#{details},</if>
|
|
<if test="video != null">#{video},</if>
|
|
<if test="help != null">#{help},</if>
|
|
<if test="resource != null">#{resource},</if>
|
|
<if test="createId != null">#{createId},</if>
|
|
<if test="createTime != null">#{createTime},</if>
|
|
</trim>
|
|
</insert>
|
|
|
|
<update id="updateBsGoods" parameterType="BsGoods">
|
|
update bs_goods
|
|
<trim prefix="SET" suffixOverrides=",">
|
|
<if test="name != null">name = #{name},</if>
|
|
<if test="cover != null">cover = #{cover},</if>
|
|
<if test="technicalTypeId != null">technical_type_id = #{technicalTypeId},</if>
|
|
<if test="designTypeId != null">design_type_id = #{designTypeId},</if>
|
|
<if test="price != null">price = #{price},</if>
|
|
<if test="introduction != null">introduction = #{introduction},</if>
|
|
<if test="details != null">details = #{details},</if>
|
|
<if test="video != null">video = #{video},</if>
|
|
<if test="help != null">help = #{help},</if>
|
|
<if test="resource != null">resource = #{resource},</if>
|
|
<if test="createId != null">create_id = #{createId},</if>
|
|
<if test="createTime != null">create_time = #{createTime},</if>
|
|
</trim>
|
|
where id = #{id}
|
|
</update>
|
|
|
|
<delete id="deleteBsGoodsById" parameterType="Long">
|
|
delete from bs_goods where id = #{id}
|
|
</delete>
|
|
|
|
<delete id="deleteBsGoodsByIds" parameterType="String">
|
|
delete from bs_goods where id in
|
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
|
#{id}
|
|
</foreach>
|
|
</delete>
|
|
|
|
<select id="selectByGoodsName" resultType="com.ruoyi.system.domain.BsGoods">
|
|
SELECT * FROM bs_goods WHERE name = #{name}
|
|
</select>
|
|
|
|
|
|
|
|
<select id="selectAllList" parameterType="com.ruoyi.system.domain.dto.BsGoodDTO" resultMap="BsGoodsVOResult">
|
|
SELECT
|
|
bg.id,
|
|
bg.name,
|
|
bg.cover,
|
|
bg.price,
|
|
bg.introduction,
|
|
bg.details,
|
|
bg.video,
|
|
bg.help,
|
|
bg.resource,
|
|
bg.create_time,
|
|
bg.design_type_id,
|
|
bdt.name AS designName,
|
|
bg.technical_type_id,
|
|
btt.name AS technicalName
|
|
FROM
|
|
bs_goods AS bg
|
|
|
|
LEFT JOIN
|
|
bs_design_type AS bdt ON bdt.type = bg.design_type_id
|
|
LEFT JOIN
|
|
bs_technical_type AS btt ON btt.number = bg.technical_type_id
|
|
<where>
|
|
<if test="name != null and name != ''"> AND bg.name LIKE CONCAT('%', #{name}, '%') </if>
|
|
<if test="cover != null and cover != ''"> AND bg.cover = #{cover} </if>
|
|
<if test="technicalName != null"> AND btt.name LIKE CONCAT('%', #{technicalName}, '%') </if>
|
|
<if test="designName != null"> AND bdt.name LIKE CONCAT('%', #{designName}, '%') </if>
|
|
<if test="price != null and price != ''"> AND bg.price = #{price} </if>
|
|
<if test="introduction != null and introduction != ''"> AND bg.introduction = #{introduction} </if>
|
|
<if test="details != null and details != ''"> AND bg.details = #{details} </if>
|
|
<if test="video != null and video != ''"> AND bg.video = #{video} </if>
|
|
<if test="help != null and help != ''"> AND bg.help = #{help} </if>
|
|
<if test="resource != null and resource != ''"> AND bg.resource = #{resource} </if>
|
|
<if test="technicalTypeId != null and technicalTypeId != ''"> AND bg.technical_type_id = #{technicalTypeId} </if>
|
|
<if test="designTypeId != null and designTypeId != ''"> AND bg.design_type_id = #{designTypeId} </if>
|
|
</where>
|
|
</select>
|
|
</mapper>
|