You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
RuoYi-Vue/newstock-system/src/main/resources/mapper/newstocksystem/NewStockIndustryMapper.xml

111 lines
5.8 KiB

<?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.newstocksystem.mapper.NewStockIndustryMapper">
<resultMap type="com.ruoyi.newstocksystem.domain.NewStockIndustry" id="NewStockIndustryResult">
<id property="industryId" column="industry_id" />
<result property="industryCode" column="industry_code" />
<result property="industryName" column="industry_name" />
<result property="level" column="level" />
<result property="parentId" column="parent_id" />
<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="selectNewStockIndustryVo">
select industry_id, industry_code, industry_name, level, parent_id, create_by, create_time, update_by, update_time, remark from new_stock_industry
</sql>
<select id="selectNewStockIndustryById" parameterType="Integer" resultMap="NewStockIndustryResult">
<include refid="selectNewStockIndustryVo" />
where industry_id = #{industryId}
</select>
<select id="selectNewStockIndustryByCode" parameterType="String" resultMap="NewStockIndustryResult">
<include refid="selectNewStockIndustryVo" />
where industry_code = #{industryCode}
</select>
<select id="selectNewStockIndustryList" parameterType="com.ruoyi.newstocksystem.domain.NewStockIndustry" resultMap="NewStockIndustryResult">
<include refid="selectNewStockIndustryVo" />
<where>
<if test="industryCode != null and industryCode != ''">
and industry_code = #{industryCode}
</if>
<if test="industryName != null and industryName != ''">
and industry_name like concat('%', #{industryName}, '%')
</if>
<if test="level != null">
and level = #{level}
</if>
<if test="parentId != null">
and parent_id = #{parentId}
</if>
</where>
</select>
<insert id="insertNewStockIndustry" parameterType="com.ruoyi.newstocksystem.domain.NewStockIndustry" useGeneratedKeys="true" keyProperty="industryId">
insert into new_stock_industry
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="industryCode != null and industryCode != ''">industry_code,</if>
<if test="industryName != null and industryName != ''">industry_name,</if>
<if test="level != null">level,</if>
<if test="parentId != null">parent_id,</if>
<if test="createBy != null and createBy != ''">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null and updateBy != ''">update_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="remark != null and remark != ''">remark,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="industryCode != null and industryCode != ''">#{industryCode},</if>
<if test="industryName != null and industryName != ''">#{industryName},</if>
<if test="level != null">#{level},</if>
<if test="parentId != null">#{parentId},</if>
<if test="createBy != null and createBy != ''">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null and updateBy != ''">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="remark != null and remark != ''">#{remark},</if>
</trim>
</insert>
<update id="updateNewStockIndustry" parameterType="com.ruoyi.newstocksystem.domain.NewStockIndustry">
update new_stock_industry
<trim prefix="set" suffixOverrides=",">
<if test="industryCode != null and industryCode != ''">industry_code = #{industryCode},</if>
<if test="industryName != null and industryName != ''">industry_name = #{industryName},</if>
<if test="level != null">level = #{level},</if>
<if test="parentId != null">parent_id = #{parentId},</if>
<if test="createBy != null and createBy != ''">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="remark != null and remark != ''">remark = #{remark},</if>
</trim>
where industry_id = #{industryId}
</update>
<delete id="deleteNewStockIndustryById" parameterType="Integer">
delete from new_stock_industry where industry_id = #{industryId}
</delete>
<delete id="deleteNewStockIndustryByIds" parameterType="String">
delete from new_stock_industry where industry_id in
<foreach item="industryId" collection="array" open="(" separator="," close=")">
#{industryId}
</foreach>
</delete>
<insert id="batchInsertNewStockIndustry" parameterType="java.util.List">
insert into new_stock_industry(industry_code, industry_name, level, parent_id, create_by, create_time, update_by, update_time, remark)
values
<foreach collection="list" item="item" separator=",">
(#{item.industryCode}, #{item.industryName}, #{item.level}, #{item.parentId}, #{item.createBy}, #{item.createTime}, #{item.updateBy}, #{item.updateTime}, #{item.remark})
</foreach>
</insert>
</mapper>