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

86 lines
3.8 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.QuoteCraftMapper">
<resultMap type="QuoteCraft" id="QuoteCraftResult">
<result property="id" column="id" />
<result property="goodId" column="good_id" />
<result property="typeId" column="type_id" />
<result property="title" column="title" />
<result property="price" column="price" />
<result property="unit" column="unit" />
<result property="createdAt" column="created_at" />
<result property="updatedAt" column="updated_at" />
</resultMap>
<sql id="selectQuoteCraftVo">
select id, good_id, type_id, title, price, unit, created_at, updated_at from quote_craft
</sql>
<select id="selectQuoteCraftList" parameterType="QuoteCraft" resultMap="QuoteCraftResult">
<include refid="selectQuoteCraftVo"/>
<where>
<if test="goodId != null and goodId != ''"> and good_id like concat('%', #{goodId}, '%')</if>
<if test="typeId != null and typeId != ''"> and type_id = #{typeId}</if>
<if test="title != null and title != ''"> and title like concat('%', #{title}, '%')</if>
<if test="price != null "> and price = #{price}</if>
<if test="unit != null and unit != ''"> and unit = #{unit}</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="selectQuoteCraftById" parameterType="Long" resultMap="QuoteCraftResult">
<include refid="selectQuoteCraftVo"/>
where id = #{id}
</select>
<insert id="insertQuoteCraft" parameterType="QuoteCraft" useGeneratedKeys="true" keyProperty="id">
insert into quote_craft
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="goodId != null and goodId != ''">good_id,</if>
<if test="typeId != null and typeId != ''">type_id,</if>
<if test="title != null and title != ''">title,</if>
<if test="price != null">price,</if>
<if test="unit != null and unit != ''">unit,</if>
created_at,
updated_at
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="goodId != null and goodId != ''">#{goodId},</if>
<if test="typeId != null and typeId != ''">#{typeId},</if>
<if test="title != null and title != ''">#{title},</if>
<if test="price != null">#{price},</if>
<if test="unit != null and unit != ''">#{unit},</if>
NOW(),
NOW()
</trim>
</insert>
<update id="updateQuoteCraft" parameterType="QuoteCraft">
update quote_craft
<trim prefix="SET" suffixOverrides=",">
<if test="goodId != null and goodId != ''">good_id = #{goodId},</if>
<if test="typeId != null and typeId != ''">type_id = #{typeId},</if>
<if test="title != null and title != ''">title = #{title},</if>
<if test="price != null">price = #{price},</if>
<if test="unit != null and unit != ''">unit = #{unit},</if>
updated_at = NOW()
</trim>
where id = #{id}
</update>
<delete id="deleteQuoteCraftById" parameterType="Long">
delete from quote_craft where id = #{id}
</delete>
<delete id="deleteQuoteCraftByIds" parameterType="String">
delete from quote_craft where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>