<?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.predict.mapper.StandardPointManagementMapper">
    
    <resultMap type="StandardPointManagement" id="StandardPointManagementResult">
        <result property="itemType"    column="item_type"    />
        <result property="itemNo"    column="item_no"    />
        <result property="itemName"    column="item_name"    />
        <result property="itemRef"    column="item_ref"    />
        <result property="note"    column="note"    />
    </resultMap>

    <sql id="selectStandardPointManagementVo">
        select item_type, item_no, item_name, item_ref, note from standard_point_management
    </sql>

    <select id="selectStandardPointManagementList" parameterType="StandardPointManagement" resultMap="StandardPointManagementResult">
        <include refid="selectStandardPointManagementVo"/>
        <where>  
            <if test="itemType != null  and itemType != ''"> and item_type like concat(concat('%', #{itemType}), '%')</if>
            <if test="itemNo != null "> and item_no = #{itemNo}</if>
            <if test="itemName != null  and itemName != ''"> and item_name like concat(concat('%', #{itemName}), '%')</if>
            <if test="itemRef != null  and itemRef != ''"> and item_ref = #{itemRef}</if>
            <if test="note != null  and note != ''"> and note = #{note}</if>
        </where>
    </select>
    
    <select id="selectStandardPointManagementById" parameterType="Long" resultMap="StandardPointManagementResult">
        <include refid="selectStandardPointManagementVo"/>
        where item_no = #{itemNo}
    </select>
        
    <insert id="insertStandardPointManagement" parameterType="StandardPointManagement">
        insert into standard_point_management
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="itemType != null">item_type,</if>
            <if test="itemNo != null">item_no,</if>
            <if test="itemName != null">item_name,</if>
            <if test="itemRef != null">item_ref,</if>
            <if test="note != null">note,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="itemType != null">#{itemType},</if>
            <if test="itemNo != null">#{itemNo},</if>
            <if test="itemName != null">#{itemName},</if>
            <if test="itemRef != null">#{itemRef},</if>
            <if test="note != null">#{note},</if>
         </trim>
    </insert>

    <update id="updateStandardPointManagement" parameterType="StandardPointManagement">
        update standard_point_management
        <trim prefix="SET" suffixOverrides=",">
            <if test="item_type != null">item_type = #{itemType},</if>
            <if test="itemName != null">item_name = #{itemName},</if>
            <if test="itemRef != null">item_ref = #{itemRef},</if>
            <if test="note != null">note = #{note},</if>
        </trim>
        where item_no = #{itemNo}
    </update>

    <delete id="deleteStandardPointManagementById" parameterType="Long">
        delete from standard_point_management where item_no = #{itemNo}
    </delete>

    <delete id="deleteStandardPointManagementByIds" parameterType="String">
        delete from standard_point_management where item_no in
        <foreach item="itemNo" collection="array" open="(" separator="," close=")">
            #{itemNo}
        </foreach>
    </delete>
</mapper>