ZproductInfoMapper.xml 2.75 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.zproductInfo.mapper.ZproductInfoMapper">
    
    <resultMap type="ZproductInfo" id="ZproductInfoResult">
        <result property="id"    column="id"    />
        <result property="name"    column="name"    />
        <result property="code"    column="code"    />
        <result property="status"    column="status"    />
    </resultMap>
	
	<sql id="selectZproductInfoVo">
        select id, name, code, status from zproduct_info
    </sql>
	
    <select id="selectZproductInfoList" parameterType="ZproductInfo" resultMap="ZproductInfoResult">
        <include refid="selectZproductInfoVo"/>
        <where>  
            <if test="id != null "> and id = #{id}</if>
            <if test="name != null  and name != '' "> and name = #{name}</if>
            <if test="code != null  and code != '' "> and code = #{code}</if>
            <if test="status != null  and status != '' "> and status = #{status}</if>
        </where>
    </select>
    
    <select id="selectZproductInfoById" parameterType="Integer" resultMap="ZproductInfoResult">
        <include refid="selectZproductInfoVo"/>
        where id = #{id}
    </select>
        
    <insert id="insertZproductInfo" parameterType="ZproductInfo" useGeneratedKeys="true" keyProperty="id">
        insert into zproduct_info
		<trim prefix="(" suffix=")" suffixOverrides=",">
			<if test="name != null  and name != ''  ">name,</if>
			<if test="code != null  and code != ''  ">code,</if>
			<if test="status != null  and status != ''  ">status,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
			<if test="name != null  and name != ''  ">#{name},</if>
			<if test="code != null  and code != ''  ">#{code},</if>
			<if test="status != null  and status != ''  ">#{status},</if>
         </trim>
    </insert>
	 
    <update id="updateZproductInfo" parameterType="ZproductInfo">
        update zproduct_info
        <trim prefix="SET" suffixOverrides=",">
            <if test="name != null  and name != ''  ">name = #{name},</if>
            <if test="code != null  and code != ''  ">code = #{code},</if>
            <if test="status != null  and status != ''  ">status = #{status},</if>
        </trim>
        where id = #{id}
    </update>

	<delete id="deleteZproductInfoById" parameterType="Integer">
        delete from zproduct_info where id = #{id}
    </delete>
	
    <delete id="deleteZproductInfoByIds" parameterType="String">
        delete from zproduct_info where id in 
        <foreach item="id" collection="array" open="(" separator="," close=")">
            #{id}
        </foreach>
    </delete>
    
</mapper>