TCityLevelRegionMapper.xml 3.36 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85
<?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.zehong.system.mapper.TCityLevelRegionMapper">
    
    <resultMap type="TCityLevelRegion" id="TCityLevelRegionResult">
        <result property="fId"    column="f_id"    />
        <result property="fCityCode"    column="f_city_code"    />
        <result property="fName"    column="f_name"    />
        <result property="fSeq"    column="f_seq"    />
    </resultMap>

    <sql id="selectTCityLevelRegionVo">
        select f_id, f_city_code, f_name, f_seq from t_city_level_region
    </sql>

    <select id="selectTCityLevelRegionList" parameterType="TCityLevelRegion" resultMap="TCityLevelRegionResult">
        <include refid="selectTCityLevelRegionVo"/>
        <where>  
            <if test="fCityCode != null  and fCityCode != ''"> and f_city_code = #{fCityCode}</if>
            <if test="fName != null  and fName != ''"> and f_name like concat('%', #{fName}, '%')</if>
            <if test="fSeq != null "> and f_seq = #{fSeq}</if>
        </where>
    </select>
    
    <select id="selectTCityLevelRegionById" parameterType="Long" resultMap="TCityLevelRegionResult">
        <include refid="selectTCityLevelRegionVo"/>
        where f_id = #{fId}
    </select>
        
    <insert id="insertTCityLevelRegion" parameterType="TCityLevelRegion">
        insert into t_city_level_region
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="fId != null">f_id,</if>
            <if test="fCityCode != null and fCityCode != ''">f_city_code,</if>
            <if test="fName != null and fName != ''">f_name,</if>
            <if test="fSeq != null">f_seq,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="fId != null">#{fId},</if>
            <if test="fCityCode != null and fCityCode != ''">#{fCityCode},</if>
            <if test="fName != null and fName != ''">#{fName},</if>
            <if test="fSeq != null">#{fSeq},</if>
         </trim>
    </insert>

    <update id="updateTCityLevelRegion" parameterType="TCityLevelRegion">
        update t_city_level_region
        <trim prefix="SET" suffixOverrides=",">
            <if test="fCityCode != null and fCityCode != ''">f_city_code = #{fCityCode},</if>
            <if test="fName != null and fName != ''">f_name = #{fName},</if>
            <if test="fSeq != null">f_seq = #{fSeq},</if>
        </trim>
        where f_id = #{fId}
    </update>

    <delete id="deleteTCityLevelRegionById" parameterType="Long">
        delete from t_city_level_region where f_id = #{fId}
    </delete>

    <delete id="deleteTCityLevelRegionByIds" parameterType="String">
        delete from t_city_level_region where f_id in 
        <foreach item="fId" collection="array" open="(" separator="," close=")">
            #{fId}
        </foreach>
    </delete>

    <insert id="batchInsertTCityLevelRegion" parameterType="TCityLevelRegion">
        insert into t_city_level_region(
            f_id,
            f_city_code,
            f_name,
            f_seq
        )VALUES
        <foreach collection="list" separator="," item="item">
            (
                #{item.fId},
                #{item.fCityCode},
                #{item.fName},
                #{item.fSeq}
            )
        </foreach>
    </insert>
</mapper>