ZindustryInfoMapper.xml 3.05 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.zindustryInfo.mapper.ZindustryInfoMapper">
    
    <resultMap type="ZindustryInfo" id="ZindustryInfoResult">
        <result property="id"    column="id"    />
        <result property="name"    column="name"    />
        <result property="parentId"    column="parent_id"    />
        <result property="garade"    column="garade"    />
        <result property="status"    column="status"    />
    </resultMap>
	
	<sql id="selectZindustryInfoVo">
        select id, name, parent_id, garade, status from zindustry_info
    </sql>
	
    <select id="selectZindustryInfoList" parameterType="ZindustryInfo" resultMap="ZindustryInfoResult">
        <include refid="selectZindustryInfoVo"/>
        <where>  
            <if test="id != null "> and id = #{id}</if>
            <if test="name != null  and name != '' "> and name = #{name}</if>
            <if test="parentId != null "> and parent_id = #{parentId}</if>
            <if test="garade != null "> and garade = #{garade}</if>
            <if test="status != null  and status != '' "> and status = #{status}</if>
        </where>
    </select>
    
    <select id="selectZindustryInfoById" parameterType="Integer" resultMap="ZindustryInfoResult">
        <include refid="selectZindustryInfoVo"/>
        where id = #{id}
    </select>
        
    <insert id="insertZindustryInfo" parameterType="ZindustryInfo" useGeneratedKeys="true" keyProperty="id">
        insert into zindustry_info
		<trim prefix="(" suffix=")" suffixOverrides=",">
			<if test="name != null  and name != ''  ">name,</if>
			<if test="parentId != null  ">parent_id,</if>
			<if test="garade != null  ">garade,</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="parentId != null  ">#{parentId},</if>
			<if test="garade != null  ">#{garade},</if>
			<if test="status != null  and status != ''  ">#{status},</if>
         </trim>
    </insert>
	 
    <update id="updateZindustryInfo" parameterType="ZindustryInfo">
        update zindustry_info
        <trim prefix="SET" suffixOverrides=",">
            <if test="name != null  and name != ''  ">name = #{name},</if>
            <if test="parentId != null  ">parent_id = #{parentId},</if>
            <if test="garade != null  ">garade = #{garade},</if>
            <if test="status != null  and status != ''  ">status = #{status},</if>
        </trim>
        where id = #{id}
    </update>

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