2023-11-27 04:50:09 +00:00
<?xml version="1.0" encoding="UTF-8" ?>
< !DOCTYPE mapper
2023-12-13 05:52:14 +00:00
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
2023-11-27 04:50:09 +00:00
<mapper namespace= "com.xdadan.erp.emis.mapper.EmisRegionMapper" >
2023-12-13 05:52:14 +00:00
2024-06-02 02:57:46 +00:00
<resultMap type= "EmisRegion" id= "EmisRegionResult" extends= "com.xdadan.erp.emis.mapper.EmisBaseMapper.EmisBaseResult" >
2024-07-15 02:11:48 +00:00
2023-11-27 04:50:09 +00:00
<result property= "id" column= "id" />
2024-04-11 04:31:24 +00:00
<result property= "regionCode" column= "region_code" />
2023-11-27 04:50:09 +00:00
<result property= "regionName" column= "region_name" />
<result property= "regionNameEn" column= "region_name_en" />
<result property= "regionType" column= "region_type" />
2024-04-11 04:31:24 +00:00
<result property= "shortName" column= "short_name" />
<result property= "parentCode" column= "parent_code" />
<result property= "areaId" column= "area_id" />
2024-07-15 02:11:48 +00:00
<result property= "sendAreaId" column= "send_area_id" />
2024-04-11 04:31:24 +00:00
<result property= "countryCode" column= "country_code" />
2023-11-27 04:50:09 +00:00
<result property= "zipCode" column= "zip_code" />
2024-04-11 04:31:24 +00:00
<result property= "orderNum" column= "order_num" />
2024-06-02 02:57:46 +00:00
2024-04-19 10:37:18 +00:00
<!-- <result property="countryName" column="country_name" /> -->
2024-06-02 01:10:24 +00:00
<association property= "countryName" column= "country_code" select= "com.xdadan.erp.emis.mapper.EmisBaseMapper.selectCountryNameByCode" />
2024-06-26 14:41:51 +00:00
<association property= "areaName" column= "area_id" select= "com.xdadan.erp.emis.mapper.EmisBaseMapper.selectAreaNameById" />
2024-07-15 02:11:48 +00:00
<association property= "sendAreaName" column= "send_area_id" select= "com.xdadan.erp.emis.mapper.EmisBaseMapper.selectAreaNameById" />
2024-04-19 10:37:18 +00:00
2023-11-27 04:50:09 +00:00
</resultMap>
<sql id= "selectEmisRegionVo" >
2024-07-15 02:32:46 +00:00
select id, region_code, region_name, region_name_en, region_type, short_name, parent_code, area_id, send_area_id, area_name, country_code, country_name, zip_code, order_num, remark, tenant_id, del_flag, create_by, create_time, update_by, update_time, create_site, update_site from emis_region
2023-11-27 04:50:09 +00:00
</sql>
2024-04-19 10:37:18 +00:00
2023-11-27 04:50:09 +00:00
<select id= "selectEmisRegionList" parameterType= "EmisRegion" resultMap= "EmisRegionResult" >
<include refid= "selectEmisRegionVo" />
2023-12-13 05:52:14 +00:00
<where >
2023-11-27 04:50:09 +00:00
<if test= "id != null " > and id = #{id}</if>
2024-04-15 10:18:38 +00:00
<if test= "regionCode != null and regionCode != ''" > and region_code=#{regionCode}</if>
2024-07-31 01:02:59 +00:00
<if test= "regionName != null and regionName != ''" > and ( region_name like concat('%', #{regionName}, '%') or region_name_en like concat('%', #{regionName}, '%') )</if>
<if test= "regionNameEn != null and regionNameEn != ''" > and ( region_name like concat('%', #{regionNameEn}, '%') or region_name_en like concat('%', #{regionNameEn}, '%') ) </if>
2023-11-27 04:50:09 +00:00
<if test= "regionType != null " > and region_type = #{regionType}</if>
2024-04-11 04:31:24 +00:00
<if test= "shortName != null and shortName != ''" > and short_name like concat('%', #{shortName}, '%')</if>
2024-04-18 12:23:17 +00:00
<if test= "parentCode != null and parentCode != ''" > and parent_code=#{parentCode}</if>
2024-07-15 02:32:46 +00:00
<if test= "sendAreaId != null " > and send_area_id = #{sendAreaId}</if>
2024-04-11 04:31:24 +00:00
<if test= "areaId != null " > and area_id = #{areaId}</if>
<if test= "areaName != null and areaName != ''" > and area_name like concat('%', #{areaName}, '%')</if>
2024-04-18 12:23:17 +00:00
<if test= "countryCode != null and countryCode != ''" > and country_code=#{countryCode}</if>
2024-04-11 04:31:24 +00:00
<if test= "countryName != null and countryName != ''" > and country_name like concat('%', #{countryName}, '%')</if>
2023-11-27 04:50:09 +00:00
<if test= "zipCode != null and zipCode != ''" > and zip_code like concat('%', #{zipCode}, '%')</if>
2024-04-11 04:31:24 +00:00
<if test= "orderNum != null " > and order_num = #{orderNum}</if>
2023-11-27 04:50:09 +00:00
<if test= "remark != null and remark != ''" > and remark like concat('%', #{remark}, '%')</if>
<if test= "tenantId != null and tenantId != ''" > and tenant_id like concat('%', #{tenantId}, '%')</if>
<if test= "delFlag != null and delFlag != ''" > and del_flag like concat('%', #{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>
2024-04-11 04:31:24 +00:00
<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>
2023-11-27 04:50:09 +00:00
</where>
2024-04-11 04:31:24 +00:00
order by create_time desc
2023-11-27 04:50:09 +00:00
</select>
2023-12-13 05:52:14 +00:00
2024-04-11 04:31:24 +00:00
<select id= "selectEmisRegionById" parameterType= "Long" resultMap= "EmisRegionResult" >
2024-07-15 02:32:46 +00:00
select id, region_code, region_name, region_name_en, region_type, short_name, parent_code, area_id, send_area_id, area_name, country_code, country_name, zip_code, order_num, remark, tenant_id, del_flag, create_by, create_time, update_by, update_time, create_site, update_site
2023-11-27 04:50:09 +00:00
from emis_region a
where a.id = #{id}
</select>
2023-12-13 05:52:14 +00:00
2024-07-15 02:32:46 +00:00
<insert id= "insertEmisRegion" parameterType= "EmisRegion" useGeneratedKeys= "true" keyProperty= "id" >
2023-11-27 04:50:09 +00:00
insert into emis_region
<trim prefix= "(" suffix= ")" suffixOverrides= "," >
<if test= "id != null" > id,</if>
2024-04-11 04:31:24 +00:00
<if test= "regionCode != null and regionCode != ''" > region_code,</if>
2023-11-27 04:50:09 +00:00
<if test= "regionName != null and regionName != ''" > region_name,</if>
<if test= "regionNameEn != null and regionNameEn != ''" > region_name_en,</if>
<if test= "regionType != null" > region_type,</if>
2024-04-11 04:31:24 +00:00
<if test= "shortName != null and shortName != ''" > short_name,</if>
<if test= "parentCode != null and parentCode != ''" > parent_code,</if>
<if test= "areaId != null" > area_id,</if>
2024-07-15 02:32:46 +00:00
<if test= "sendAreaId != null" > send_area_id,</if>
2024-04-11 04:31:24 +00:00
<if test= "areaName != null and areaName != ''" > area_name,</if>
<if test= "countryCode != null and countryCode != ''" > country_code,</if>
<if test= "countryName != null and countryName != ''" > country_name,</if>
2023-11-27 04:50:09 +00:00
<if test= "zipCode != null and zipCode != ''" > zip_code,</if>
2024-04-11 04:31:24 +00:00
<if test= "orderNum != null" > order_num,</if>
2023-11-27 04:50:09 +00:00
<if test= "remark != null and remark != ''" > remark,</if>
<if test= "tenantId != null and tenantId != ''" > tenant_id,</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>
2024-04-11 04:31:24 +00:00
<if test= "createSite != null and createSite != ''" > create_site,</if>
<if test= "updateSite != null and updateSite != ''" > update_site,</if>
2023-12-13 05:52:14 +00:00
</trim>
2023-11-27 04:50:09 +00:00
<trim prefix= "values (" suffix= ")" suffixOverrides= "," >
<if test= "id != null" > #{id},</if>
2024-04-11 04:31:24 +00:00
<if test= "regionCode != null and regionCode != ''" > #{regionCode},</if>
2023-11-27 04:50:09 +00:00
<if test= "regionName != null and regionName != ''" > #{regionName},</if>
<if test= "regionNameEn != null and regionNameEn != ''" > #{regionNameEn},</if>
<if test= "regionType != null" > #{regionType},</if>
2024-04-11 04:31:24 +00:00
<if test= "shortName != null and shortName != ''" > #{shortName},</if>
<if test= "parentCode != null and parentCode != ''" > #{parentCode},</if>
<if test= "areaId != null" > #{areaId},</if>
2024-07-15 02:32:46 +00:00
<if test= "sendAreaId != null" > #{sendAreaId},</if>
2024-04-11 04:31:24 +00:00
<if test= "areaName != null and areaName != ''" > #{areaName},</if>
<if test= "countryCode != null and countryCode != ''" > #{countryCode},</if>
<if test= "countryName != null and countryName != ''" > #{countryName},</if>
2023-11-27 04:50:09 +00:00
<if test= "zipCode != null and zipCode != ''" > #{zipCode},</if>
2024-04-11 04:31:24 +00:00
<if test= "orderNum != null" > #{orderNum},</if>
2023-11-27 04:50:09 +00:00
<if test= "remark != null and remark != ''" > #{remark},</if>
<if test= "tenantId != null and tenantId != ''" > #{tenantId},</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>
2024-04-11 04:31:24 +00:00
<if test= "createSite != null and createSite != ''" > #{createSite},</if>
<if test= "updateSite != null and updateSite != ''" > #{updateSite},</if>
2023-12-13 05:52:14 +00:00
</trim>
2023-11-27 04:50:09 +00:00
</insert>
<update id= "updateEmisRegion" parameterType= "EmisRegion" >
update emis_region
<trim prefix= "SET" suffixOverrides= "," >
2024-04-11 04:31:24 +00:00
<if test= "regionCode != null and regionCode != ''" > region_code = #{regionCode},</if>
2023-11-27 04:50:09 +00:00
<if test= "regionName != null and regionName != ''" > region_name = #{regionName},</if>
<if test= "regionNameEn != null and regionNameEn != ''" > region_name_en = #{regionNameEn},</if>
<if test= "regionType != null" > region_type = #{regionType},</if>
2024-04-11 04:31:24 +00:00
<if test= "shortName != null and shortName != ''" > short_name = #{shortName},</if>
<if test= "parentCode != null and parentCode != ''" > parent_code = #{parentCode},</if>
2024-07-15 02:32:46 +00:00
<if test= "areaId != null" > area_id = #{areaId},</if>
<if test= "sendAreaId != null" > send_area_id = #{sendAreaId},</if>
2024-04-11 04:31:24 +00:00
<if test= "areaName != null and areaName != ''" > area_name = #{areaName},</if>
<if test= "countryCode != null and countryCode != ''" > country_code = #{countryCode},</if>
<if test= "countryName != null and countryName != ''" > country_name = #{countryName},</if>
2023-11-27 04:50:09 +00:00
<if test= "zipCode != null and zipCode != ''" > zip_code = #{zipCode},</if>
2024-04-11 04:31:24 +00:00
<if test= "orderNum != null" > order_num = #{orderNum},</if>
2023-11-27 04:50:09 +00:00
<if test= "remark != null and remark != ''" > remark = #{remark},</if>
<if test= "tenantId != null and tenantId != ''" > tenant_id = #{tenantId},</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>
2024-04-11 04:31:24 +00:00
<if test= "createSite != null and createSite != ''" > create_site = #{createSite},</if>
<if test= "updateSite != null and updateSite != ''" > update_site = #{updateSite},</if>
2023-11-27 04:50:09 +00:00
</trim>
where id = #{id}
</update>
2024-04-11 04:31:24 +00:00
<delete id= "deleteEmisRegionById" parameterType= "Long" >
2023-11-27 04:50:09 +00:00
delete from emis_region where id = #{id}
</delete>
<delete id= "deleteEmisRegionByIds" parameterType= "String" >
2023-12-13 05:52:14 +00:00
delete from emis_region where id in
2023-11-27 04:50:09 +00:00
<foreach item= "id" collection= "array" open= "(" separator= "," close= ")" >
#{id}
</foreach>
</delete>
</mapper>