emis-service/emis-biz/src/main/resources/mapper/EmisRegionMapper.xml
2023-12-14 21:08:36 +08:00

151 lines
9.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.EmisRegionMapper">
<resultMap type="EmisRegion" id="EmisRegionResult">
<result property="id" column="id" />
<result property="regionName" column="region_name" />
<result property="regionNameEn" column="region_name_en" />
<result property="shortName" column="short_name" />
<result property="parentId" column="parent_id" />
<result property="code" column="code" />
<result property="countryId" column="country_id" />
<result property="countryAreaId" column="country_area_id" />
<result property="regionType" column="region_type" />
<result property="zipCode" column="zip_code" />
<result property="remark" column="remark" />
<result property="tenantId" column="tenant_id" />
<result property="delFlag" column="del_flag" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="areaName" column="area_name" />
<result property="countryCode" column="country_code" />
<result property="countryName" column="country_name" />
</resultMap>
<sql id="selectEmisRegionVo">
select id, region_name, region_name_en, short_name, parent_id, code, country_id, country_area_id, region_type, zip_code, remark, tenant_id, del_flag, create_by, create_time, update_by, update_time, area_name, country_code, country_name from emis_region
</sql>
<select id="selectEmisRegionList" parameterType="EmisRegion" resultMap="EmisRegionResult">
<include refid="selectEmisRegionVo"/>
<where>
<if test="id != null "> and id = #{id}</if>
<if test="regionName != null and regionName != ''"> and region_name like concat('%', #{regionName}, '%')</if>
<if test="regionNameEn != null and regionNameEn != ''"> and region_name_en like concat('%', #{regionNameEn}, '%')</if>
<if test="shortName != null and shortName != ''"> and short_name like concat('%', #{shortName}, '%')</if>
<if test="parentId != null "> and parent_id = #{parentId}</if>
<if test="code != null and code != ''"> and code like concat('%', #{code}, '%')</if>
<if test="countryId != null "> and country_id = #{countryId}</if>
<if test="countryAreaId != null "> and country_area_id = #{countryAreaId}</if>
<if test="regionType != null "> and region_type = #{regionType}</if>
<if test="zipCode != null and zipCode != ''"> and zip_code like concat('%', #{zipCode}, '%')</if>
<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>
<if test="areaName != null and areaName != ''"> and area_name like concat('%', #{areaName}, '%')</if>
<if test="countryCode != null and countryCode != ''"> and country_code like concat('%', #{countryCode}, '%')</if>
<if test="countryName != null and countryName != ''"> and country_name like concat('%', #{countryName}, '%')</if>
</where>
order by id asc
</select>
<select id="selectEmisRegionById" parameterType="Integer" resultMap="EmisRegionResult">
select id, region_name, region_name_en, short_name, parent_id, code, country_id, country_area_id, region_type, zip_code, remark, tenant_id, del_flag, create_by, create_time, update_by, update_time, area_name, country_code, country_name
from emis_region a
where a.id = #{id}
</select>
<insert id="insertEmisRegion" parameterType="EmisRegion">
insert into emis_region
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">id,</if>
<if test="regionName != null and regionName != ''">region_name,</if>
<if test="regionNameEn != null and regionNameEn != ''">region_name_en,</if>
<if test="shortName != null and shortName != ''">short_name,</if>
<if test="parentId != null">parent_id,</if>
<if test="code != null and code != ''">code,</if>
<if test="countryId != null">country_id,</if>
<if test="countryAreaId != null">country_area_id,</if>
<if test="regionType != null">region_type,</if>
<if test="zipCode != null and zipCode != ''">zip_code,</if>
<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>
<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>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},</if>
<if test="regionName != null and regionName != ''">#{regionName},</if>
<if test="regionNameEn != null and regionNameEn != ''">#{regionNameEn},</if>
<if test="shortName != null and shortName != ''">#{shortName},</if>
<if test="parentId != null">#{parentId},</if>
<if test="code != null and code != ''">#{code},</if>
<if test="countryId != null">#{countryId},</if>
<if test="countryAreaId != null">#{countryAreaId},</if>
<if test="regionType != null">#{regionType},</if>
<if test="zipCode != null and zipCode != ''">#{zipCode},</if>
<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>
<if test="areaName != null and areaName != ''">#{areaName},</if>
<if test="countryCode != null and countryCode != ''">#{countryCode},</if>
<if test="countryName != null and countryName != ''">#{countryName},</if>
</trim>
</insert>
<update id="updateEmisRegion" parameterType="EmisRegion">
update emis_region
<trim prefix="SET" suffixOverrides=",">
<if test="regionName != null and regionName != ''">region_name = #{regionName},</if>
<if test="regionNameEn != null and regionNameEn != ''">region_name_en = #{regionNameEn},</if>
<if test="shortName != null and shortName != ''">short_name = #{shortName},</if>
<if test="parentId != null">parent_id = #{parentId},</if>
<if test="code != null and code != ''">code = #{code},</if>
<if test="countryId != null">country_id = #{countryId},</if>
<if test="countryAreaId != null">country_area_id = #{countryAreaId},</if>
<if test="regionType != null">region_type = #{regionType},</if>
<if test="zipCode != null and zipCode != ''">zip_code = #{zipCode},</if>
<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>
<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>
</trim>
where id = #{id}
</update>
<delete id="deleteEmisRegionById" parameterType="Integer">
delete from emis_region where id = #{id}
</delete>
<delete id="deleteEmisRegionByIds" parameterType="String">
delete from emis_region where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>