136 lines
8.6 KiB
XML
136 lines
8.6 KiB
XML
<?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.xdadan.erp.emis.mapper.EmisSpecialZoneAddressMatchMapper">
|
|
|
|
<resultMap type="EmisSpecialZoneAddressMatch" id="EmisSpecialZoneAddressMatchResult" extends="com.xdadan.erp.emis.mapper.EmisBaseMapper.EmisBaseResult">
|
|
<result property="id" column="id" />
|
|
<result property="countryCode" column="country_code" />
|
|
<result property="provinceCode" column="province_code" />
|
|
<result property="specialZoneName" column="special_zone_name" />
|
|
<result property="specialZoneTag" column="special_zone_tag" />
|
|
<!-- 通过关联查询返回国家名称和省份名称 -->
|
|
<association property="countryName" column="country_code" select="com.xdadan.erp.emis.mapper.EmisBaseMapper.selectCountryNameByCode" fetchType="lazy"/>
|
|
<association property="provinceName" column="province_code" select="com.xdadan.erp.emis.mapper.EmisBaseMapper.selectRegionNameByCode" fetchType="lazy"/>
|
|
</resultMap>
|
|
|
|
<sql id="selectEmisSpecialZoneAddressMatchVo">
|
|
select id, country_code, province_code, special_zone_name, special_zone_tag, remark, del_flag, create_by, create_time, update_by, update_time, create_site, update_site from emis_special_zone_address_match
|
|
</sql>
|
|
|
|
<select id="selectEmisSpecialZoneAddressMatchList" parameterType="EmisSpecialZoneAddressMatch" resultMap="EmisSpecialZoneAddressMatchResult">
|
|
<include refid="selectEmisSpecialZoneAddressMatchVo"/>
|
|
<where>
|
|
del_flag='0'
|
|
<if test="id != null "> and id = #{id}</if>
|
|
<if test="countryCode != null and countryCode != ''"> and country_code = #{countryCode}</if>
|
|
<if test="provinceCode != null and provinceCode != ''"> and province_code = #{provinceCode}</if>
|
|
<if test="specialZoneName != null and specialZoneName != ''"> and special_zone_name like concat('%', #{specialZoneName}, '%')</if>
|
|
<if test="specialZoneTag != null and specialZoneTag != ''"> and special_zone_tag like concat('%', #{specialZoneTag}, '%')</if>
|
|
<if test="remark != null and remark != ''"> and remark like concat('%', #{remark}, '%')</if>
|
|
<if test="delFlag != null and delFlag != ''"> and del_flag = #{delFlag}</if>
|
|
<if test="createBy != null and createBy != ''"> and create_by like concat('%', #{createBy}, '%')</if>
|
|
<if test="createTime != null "> and create_time = #{createTime}</if>
|
|
<if test="updateBy != null and updateBy != ''"> and update_by like concat('%', #{updateBy}, '%')</if>
|
|
<if test="updateTime != null "> and update_time = #{updateTime}</if>
|
|
<if test="createSite != null and createSite != ''"> and create_site like concat('%', #{createSite}, '%')</if>
|
|
<if test="updateSite != null and updateSite != ''"> and update_site like concat('%', #{updateSite}, '%')</if>
|
|
</where>
|
|
<choose>
|
|
<when test="params.orderBy != null and params.orderBy != ''">
|
|
order by ${params.orderBy}
|
|
</when>
|
|
<otherwise>
|
|
order by create_time desc
|
|
</otherwise>
|
|
</choose>
|
|
</select>
|
|
|
|
<select id="checkUnique" parameterType="EmisSpecialZoneAddressMatch" resultType="int">
|
|
select count(1) from emis_special_zone_address_match
|
|
where del_flag='0'
|
|
and special_zone_tag = #{specialZoneTag}
|
|
<if test="id != null"> and id != #{id}</if>
|
|
limit 1
|
|
</select>
|
|
|
|
<select id="selectEmisSpecialZoneAddressMatchById" parameterType="Long" resultMap="EmisSpecialZoneAddressMatchResult">
|
|
select id, country_code, province_code, special_zone_name, special_zone_tag, remark, del_flag, create_by, create_time, update_by, update_time, create_site, update_site
|
|
from emis_special_zone_address_match a
|
|
where a.id = #{id} and a.del_flag='0'
|
|
</select>
|
|
|
|
<select id="selectByNormalizedAddress" parameterType="String" resultMap="EmisSpecialZoneAddressMatchResult">
|
|
select id, country_code, province_code, special_zone_name, special_zone_tag, remark, del_flag, create_by, create_time, update_by, update_time, create_site, update_site
|
|
from emis_special_zone_address_match a
|
|
where a.del_flag = '0'
|
|
and #{normalizedAddress} like concat('%', upper(replace(replace(replace(a.special_zone_tag, ' ', ''), char(160), ''), char(12288), '')), '%')
|
|
limit 1
|
|
</select>
|
|
|
|
<insert id="insertEmisSpecialZoneAddressMatch" parameterType="EmisSpecialZoneAddressMatch" useGeneratedKeys="true" keyProperty="id">
|
|
insert into emis_special_zone_address_match
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
<if test="id != null">id,</if>
|
|
<if test="countryCode != null and countryCode != ''">country_code,</if>
|
|
<if test="provinceCode != null and provinceCode != ''">province_code,</if>
|
|
<if test="specialZoneName != null and specialZoneName != ''">special_zone_name,</if>
|
|
<if test="specialZoneTag != null and specialZoneTag != ''">special_zone_tag,</if>
|
|
<if test="remark != null and remark != ''">remark,</if>
|
|
<if test="delFlag != null and delFlag != ''">del_flag,</if>
|
|
<if test="createBy != null and createBy != ''">create_by,</if>
|
|
<if test="createTime != null">create_time,</if>
|
|
<if test="updateBy != null and updateBy != ''">update_by,</if>
|
|
<if test="updateTime != null">update_time,</if>
|
|
<if test="createSite != null and createSite != ''">create_site,</if>
|
|
<if test="updateSite != null and updateSite != ''">update_site,</if>
|
|
</trim>
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
<if test="id != null">#{id},</if>
|
|
<if test="countryCode != null and countryCode != ''">#{countryCode},</if>
|
|
<if test="provinceCode != null and provinceCode != ''">#{provinceCode},</if>
|
|
<if test="specialZoneName != null and specialZoneName != ''">#{specialZoneName},</if>
|
|
<if test="specialZoneTag != null and specialZoneTag != ''">#{specialZoneTag},</if>
|
|
<if test="remark != null and remark != ''">#{remark},</if>
|
|
<if test="delFlag != null and delFlag != ''">#{delFlag},</if>
|
|
<if test="createBy != null and createBy != ''">#{createBy},</if>
|
|
<if test="createTime != null">#{createTime},</if>
|
|
<if test="updateBy != null and updateBy != ''">#{updateBy},</if>
|
|
<if test="updateTime != null">#{updateTime},</if>
|
|
<if test="createSite != null and createSite != ''">#{createSite},</if>
|
|
<if test="updateSite != null and updateSite != ''">#{updateSite},</if>
|
|
</trim>
|
|
</insert>
|
|
|
|
<update id="updateEmisSpecialZoneAddressMatch" parameterType="EmisSpecialZoneAddressMatch">
|
|
update emis_special_zone_address_match
|
|
<trim prefix="SET" suffixOverrides=",">
|
|
<if test="countryCode != null and countryCode != ''">country_code = #{countryCode},</if>
|
|
<if test="provinceCode != null and provinceCode != ''">province_code = #{provinceCode},</if>
|
|
<if test="specialZoneName != null and specialZoneName != ''">special_zone_name = #{specialZoneName},</if>
|
|
<if test="specialZoneTag != null and specialZoneTag != ''">special_zone_tag = #{specialZoneTag},</if>
|
|
<if test="remark != null and remark != ''">remark = #{remark},</if>
|
|
<if test="delFlag != null and delFlag != ''">del_flag = #{delFlag},</if>
|
|
<if test="createBy != null and createBy != ''">create_by = #{createBy},</if>
|
|
<if test="createTime != null">create_time = #{createTime},</if>
|
|
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
|
|
<if test="updateTime != null">update_time = #{updateTime},</if>
|
|
<if test="createSite != null and createSite != ''">create_site = #{createSite},</if>
|
|
<if test="updateSite != null and updateSite != ''">update_site = #{updateSite},</if>
|
|
</trim>
|
|
where id = #{id}
|
|
</update>
|
|
|
|
<delete id="deleteEmisSpecialZoneAddressMatchById" parameterType="Long">
|
|
update emis_special_zone_address_match set del_flag='1' where id = #{id}
|
|
</delete>
|
|
|
|
<delete id="deleteEmisSpecialZoneAddressMatchByIds" parameterType="String">
|
|
update emis_special_zone_address_match set del_flag='1' where id in
|
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
|
#{id}
|
|
</foreach>
|
|
</delete>
|
|
</mapper>
|