ZareaInfoMapper.xml 3.64 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.zareaInfo.mapper.ZareaInfoMapper">
    
    <resultMap type="ZareaInfo" id="ZareaInfoResult">
        <result property="id"    column="id"    />
        <result property="cId"    column="c_id"    />
        <result property="cName"    column="c_name"    />
        <result property="cDesc"    column="c_desc"    />
        <result property="parentId"    column="parent_id"    />
        <result property="cType"    column="c_type"    />
        <result property="status"    column="status"    />
    </resultMap>
	
	<sql id="selectZareaInfoVo">
        select id, c_id, c_name, c_desc, parent_id, c_type ,status from zarea_info
    </sql>
	
    <select id="selectZareaInfoList" parameterType="ZareaInfo" resultMap="ZareaInfoResult">
        <include refid="selectZareaInfoVo"/>
        <where>  
            <if test="id != null "> and id = #{id}</if>
            <if test="cId != null "> and c_id = #{cId}</if>
            <if test="cName != null  and cName != '' "> and c_name = #{cName}</if>
            <if test="cDesc != null  and cDesc != '' "> and c_desc = #{cDesc}</if>
            <if test="parentId != null "> and parent_id = #{parentId}</if>
            <if test="cType != null  and cType != '' "> and c_type = #{cType}</if>
            <if test="status != null  and status != '' "> and status = #{status}</if>
        </where>
    </select>
    
    <select id="selectZareaInfoById" parameterType="Integer" resultMap="ZareaInfoResult">
        <include refid="selectZareaInfoVo"/>
        where id = #{id}
    </select>
        
    <insert id="insertZareaInfo" parameterType="ZareaInfo" useGeneratedKeys="true" keyProperty="id">
        insert into zarea_info
		<trim prefix="(" suffix=")" suffixOverrides=",">
			<if test="cId != null  ">c_id,</if>
			<if test="cName != null  and cName != ''  ">c_name,</if>
			<if test="cDesc != null  and cDesc != ''  ">c_desc,</if>
			<if test="parentId != null  ">parent_id,</if>
			<if test="cType != null  and cType != ''  ">c_type,</if>
			<if test="status != null  and status != ''  ">status,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
			<if test="cId != null  ">#{cId},</if>
			<if test="cName != null  and cName != ''  ">#{cName},</if>
			<if test="cDesc != null  and cDesc != ''  ">#{cDesc},</if>
			<if test="parentId != null  ">#{parentId},</if>
			<if test="cType != null  and cType != ''  ">#{cType},</if>
			<if test="status != null  and status != ''  ">#{status},</if>
         </trim>
    </insert>
	 
    <update id="updateZareaInfo" parameterType="ZareaInfo">
        update zarea_info
        <trim prefix="SET" suffixOverrides=",">
            <if test="cId != null  ">c_id = #{cId},</if>
            <if test="cName != null  and cName != ''  ">c_name = #{cName},</if>
            <if test="cDesc != null  and cDesc != ''  ">c_desc = #{cDesc},</if>
            <if test="parentId != null  ">parent_id = #{parentId},</if>
            <if test="cType != null  and cType != ''  ">c_type = #{cType},</if>
            <if test="status != null  and status != ''  ">status = #{status},</if>
        </trim>
        where id = #{id}
    </update>

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