<?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>