<?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.TCountyLevelRegionMapper"> <resultMap type="TCountyLevelRegion" id="TCountyLevelRegionResult"> <result property="fId" column="f_id" /> <result property="fCityId" column="f_city_id" /> <result property="fCountyCode" column="f_county_code" /> <result property="fName" column="f_name" /> <result property="fIsMajor" column="f_is_major" /> <result property="seq" column="f_seq" /> </resultMap> <sql id="selectTCountyLevelRegionVo"> select f_id, f_city_id, f_county_code, f_name, f_is_major ,f_seq from t_county_level_region </sql> <select id="selectTCountyLevelRegionList" parameterType="TCountyLevelRegion" resultMap="TCountyLevelRegionResult"> <include refid="selectTCountyLevelRegionVo"/> <where> <if test="fCityId != null "> and f_city_id = #{fCityId}</if> <if test="fCountyCode != null and fCountyCode != ''"> and f_county_code = #{fCountyCode}</if> <if test="fName != null and fName != ''"> and f_name like concat('%', #{fName}, '%')</if> <if test="fIsMajor != null "> and f_is_major = #{fIsMajor}</if> </where> </select> <select id="queryByCountyCodes" resultMap="TCountyLevelRegionResult"> <include refid="selectTCountyLevelRegionVo"></include> where f_county_code in <foreach collection="list" index="i" item="item" open="(" separator="," close=")"> #{item} </foreach> </select> <select id="queryByCityId" resultMap="TCountyLevelRegionResult"> <include refid="selectTCountyLevelRegionVo"/> where f_city_id = #{fCityId} </select> <select id="selectTCountyLevelRegionById" parameterType="Long" resultMap="TCountyLevelRegionResult"> <include refid="selectTCountyLevelRegionVo"/> where f_id = #{fId} </select> <insert id="insertTCountyLevelRegion" parameterType="TCountyLevelRegion"> insert into t_county_level_region <trim prefix="(" suffix=")" suffixOverrides=","> <if test="fId != null">f_id,</if> <if test="fCityId != null">f_city_id,</if> <if test="fCountyCode != null and fCountyCode != ''">f_county_code,</if> <if test="fName != null and fName != ''">f_name,</if> <if test="fIsMajor != null">f_is_major,</if> <if test="seq != null">f_seq,</if> </trim> <trim prefix="values (" suffix=")" suffixOverrides=","> <if test="fId != null">#{fId},</if> <if test="fCityId != null">#{fCityId},</if> <if test="fCountyCode != null and fCountyCode != ''">#{fCountyCode},</if> <if test="fName != null and fName != ''">#{fName},</if> <if test="fIsMajor != null">#{fIsMajor},</if> <if test="seq != null">#{seq},</if> </trim> </insert> <update id="updateTCountyLevelRegion" parameterType="TCountyLevelRegion"> update t_county_level_region <trim prefix="SET" suffixOverrides=","> <if test="fCityId != null">f_city_id = #{fCityId},</if> <if test="fCountyCode != null and fCountyCode != ''">f_county_code = #{fCountyCode},</if> <if test="fName != null and fName != ''">f_name = #{fName},</if> <if test="fIsMajor != null">f_is_major = #{fIsMajor},</if> </trim> where f_id = #{fId} </update> <delete id="deleteTCountyLevelRegionById" parameterType="Long"> delete from t_county_level_region where f_id = #{fId} </delete> <delete id="deleteTCountyLevelRegionByIds" parameterType="String"> delete from t_county_level_region where f_id in <foreach item="fId" collection="array" open="(" separator="," close=")"> #{fId} </foreach> </delete> <insert id="batchInsertTCountyLevelRegion" parameterType="TCountyLevelRegion"> insert into t_county_level_region( f_id, f_city_id, f_county_code, f_name, f_is_major, f_sql )VALUES <foreach collection="list" separator="," item="item"> ( #{item.fId}, #{item.fCityId}, #{item.fCountyCode}, #{item.fName}, #{item.fIsMajor}, #{item.sql} ) </foreach> </insert> </mapper>