SifadictMapper.xml 2.48 KB
<?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.lhcredit.project.business.sifadict.mapper.SifadictMapper">
    
    <resultMap type="Sifadict" id="SifadictResult">
        <result property="id"    column="id"    />
        <result property="level"    column="level"    />
        <result property="money"    column="money"    />
    </resultMap>
	
	<sql id="selectSifadictVo">
        select id, level, money from sifadict
    </sql>
	
    <select id="selectSifadictList" parameterType="Sifadict" resultMap="SifadictResult">
        <include refid="selectSifadictVo"/>
        <where>  
            <if test="id != null "> and id = #{id}</if>
            <if test="level != null  and level != '' "> and `level` = #{level}</if>
            <if test="money != null  and money != '' "> and money = #{money}</if>
        </where>
    </select>
    
    <select id="selectSifadictById" parameterType="Integer" resultMap="SifadictResult">
        <include refid="selectSifadictVo"/>
        where id = #{id}
    </select>
        
    <insert id="insertSifadict" parameterType="Sifadict" useGeneratedKeys="true" keyProperty="id">
        insert into sifadict
		<trim prefix="(" suffix=")" suffixOverrides=",">
			<if test="level != null  and level != ''  ">`level`,</if>
			<if test="money != null  and money != ''  ">money,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
			<if test="level != null  and level != ''  ">#{level},</if>
			<if test="money != null  and money != ''  ">#{money},</if>
         </trim>
    </insert>
	 
    <update id="updateSifadict" parameterType="Sifadict">
        update sifadict
        <trim prefix="SET" suffixOverrides=",">
            <if test="level != null  and level != ''  ">`level` = #{level},</if>
            <if test="money != null  and money != ''  ">money = #{money},</if>
        </trim>
        where id = #{id}
    </update>

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

    <select id="selectSifadictByLevel" resultType="String">
        select  money from sifadict
        where `level` = #{level}
    </select>
</mapper>