<?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.index.mapper.IndexVMapper">

	<resultMap type="IndexV" id="IndexVResult">
		<result property="id" column="id" />
		<result property="name" column="name" />
		<result property="formula" column="formula" />
		<result property="formula0" column="formula0" />
		<result property="others" column="others" />
		<result property="year" column="year" />
		<result property="unit" column="unit" />
		<result property="illustration" column="illustration" />
		<result property="remark" column="remark" />
		<result property="delFlag" column="del_flag" />
		<result property="createBy" column="create_by" />
		<result property="createTime" column="create_time" />
		<result property="updateBy" column="update_by" />
		<result property="updateTime" column="update_time" />
	</resultMap>

	<sql id="selectIndexVVo">
		select id, name, formula, formula0, year, unit,
		illustration,others,
		remark,
		del_flag, create_by,
		create_time, update_by,
		update_time from
		index_v
	</sql>

	<select id="selectIndexVList" parameterType="IndexV"
		resultMap="IndexVResult">
		<include refid="selectIndexVVo" />
		<where>
			<if test="name != null  and name != ''"> and name like concat('%', #{name}, '%')</if>
			<if test="formula != null  and formula != ''"> and formula like concat('%', #{formula}, '%')</if>
			<if test="illustration != null  and illustration != ''"> and illustration like concat('%', #{illustration}, '%')</if>
		</where>
		order by create_time
	</select>

	<select id="selectIndexVById" parameterType="Long"
		resultMap="IndexVResult">
		<include refid="selectIndexVVo" />
		where id = #{id}
	</select>

	<insert id="insertIndexV" parameterType="IndexV"
		useGeneratedKeys="true" keyProperty="id">
		insert into index_v
		<trim prefix="(" suffix=")" suffixOverrides=",">
			<if test="name != null">name,</if>
			<if test="formula != null">formula,</if>
			<if test="formula0 != null">formula0,</if>
			<if test="year != null">year,</if>
			<if test="unit != null">unit,</if>
			<if test="others != null">others,</if>
			<if test="illustration != null">illustration,</if>
			<if test="remark != null">remark,</if>
			<if test="delFlag != null">del_flag,</if>
			<if test="createBy != null">create_by,</if>
			<if test="createTime != null">create_time,</if>
			<if test="updateBy != null">update_by,</if>
			<if test="updateTime != null">update_time,</if>
		</trim>
		<trim prefix="values (" suffix=")" suffixOverrides=",">
			<if test="name != null">#{name},</if>
			<if test="formula != null">#{formula},</if>
			<if test="formula0 != null">#{formula0},</if>
			<if test="year != null">#{year},</if>
			<if test="unit != null">#{unit},</if>
			<if test="others != null">#{others},</if>
			<if test="illustration != null">#{illustration},</if>
			<if test="remark != null">#{remark},</if>
			<if test="delFlag != null">#{delFlag},</if>
			<if test="createBy != null">#{createBy},</if>
			<if test="createTime != null">#{createTime},</if>
			<if test="updateBy != null">#{updateBy},</if>
			<if test="updateTime != null">#{updateTime},</if>
		</trim>
	</insert>

	<update id="updateIndexV" parameterType="IndexV">
		update index_v
		<trim prefix="SET" suffixOverrides=",">
			<if test="name != null">name = #{name},</if>
			<if test="formula != null">formula = #{formula},</if>
			<if test="formula0 != null">formula0 = #{formula0},</if>
			<if test="year != null">year = #{year},</if>
			<if test="unit != null">unit = #{unit},</if>
			<if test="others != null">others = #{others},</if>
			<if test="illustration != null">illustration = #{illustration},</if>
			<if test="remark != null">remark = #{remark},</if>
			<if test="delFlag != null">del_flag = #{delFlag},</if>
			<if test="createBy != null">create_by = #{createBy},</if>
			<if test="createTime != null">create_time = #{createTime},</if>
			<if test="updateBy != null">update_by = #{updateBy},</if>
			<if test="updateTime != null">update_time = #{updateTime},</if>
		</trim>
		where id = #{id}
	</update>

	<delete id="deleteIndexVById" parameterType="Long">
		delete from index_v
		where id = #{id}
	</delete>

	<delete id="deleteIndexVByIds" parameterType="String">
		delete from index_v where id in
		<foreach item="id" collection="array" open="(" separator=","
			close=")">
			#{id}
		</foreach>
	</delete>

</mapper>