91 lines
4.7 KiB
XML
91 lines
4.7 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.bonus.smartsite.basic.mapper.BmCompanyAddressMapper">
|
|
<resultMap type="com.bonus.smartsite.basic.domain.BmCompanyAddress" id="BmCompanyAddressResult">
|
|
<result property="id" column="id" />
|
|
<result property="companyId" column="company_id" />
|
|
<result property="provinceCode" column="province_code" />
|
|
<result property="provinceName" column="province_name" />
|
|
<result property="cityCode" column="city_code" />
|
|
<result property="cityName" column="city_name" />
|
|
<result property="areaCode" column="area_code" />
|
|
<result property="areaName" column="area_name" />
|
|
<result property="address" column="address" />
|
|
<result property="createTime" column="create_time" />
|
|
<result property="updateTime" column="update_time" />
|
|
</resultMap>
|
|
|
|
<sql id="selectBmCompanyAddressVo">
|
|
select bca.id, bca.company_id, bca.province_code, bca.city_code, bca.area_code, bca.address, bca.create_time, bca.update_time,
|
|
b.name as area_name, b1.name as province_name, b2.name as city_name
|
|
from bm_company_address bca
|
|
LEFT JOIN base_address b ON b.code = bca.area_code
|
|
LEFT JOIN base_address b1 on bca.province_code = b1.code
|
|
LEFT JOIN base_address b2 on bca.city_code = b2.code
|
|
</sql>
|
|
|
|
<select id="selectBmCompanyAddressList" parameterType="com.bonus.smartsite.basic.domain.BmCompanyAddress" resultMap="BmCompanyAddressResult">
|
|
<include refid="selectBmCompanyAddressVo"/>
|
|
<where>
|
|
<if test="companyId != null "> and bca.company_id = #{companyId}</if>
|
|
<if test="provinceCode != null "> and bca.province_code = #{provinceCode}</if>
|
|
<if test="cityCode != null "> and bca.city_code = #{cityCode}</if>
|
|
<if test="areaCode != null "> and bca.area_code = #{areaCode}</if>
|
|
<if test="address != null and address != ''"> and bca.address = #{address}</if>
|
|
</where>
|
|
</select>
|
|
|
|
<select id="selectBmCompanyAddressById" parameterType="Long" resultMap="BmCompanyAddressResult">
|
|
<include refid="selectBmCompanyAddressVo"/>
|
|
where bca.id = #{id}
|
|
</select>
|
|
|
|
<insert id="insertBmCompanyAddress" parameterType="com.bonus.smartsite.basic.domain.BmCompanyAddress" useGeneratedKeys="true" keyProperty="id">
|
|
insert into bm_company_address
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
<if test="companyId != null">company_id,</if>
|
|
<if test="provinceCode != null">province_code,</if>
|
|
<if test="cityCode != null">city_code,</if>
|
|
<if test="areaCode != null">area_code,</if>
|
|
<if test="address != null">address,</if>
|
|
<if test="createTime != null">create_time,</if>
|
|
<if test="updateTime != null">update_time,</if>
|
|
</trim>
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
<if test="companyId != null">#{companyId},</if>
|
|
<if test="provinceCode != null">#{provinceCode},</if>
|
|
<if test="cityCode != null">#{cityCode},</if>
|
|
<if test="areaCode != null">#{areaCode},</if>
|
|
<if test="address != null">#{address},</if>
|
|
<if test="createTime != null">#{createTime},</if>
|
|
<if test="updateTime != null">#{updateTime},</if>
|
|
</trim>
|
|
</insert>
|
|
|
|
<update id="updateBmCompanyAddress" parameterType="com.bonus.smartsite.basic.domain.BmCompanyAddress">
|
|
update bm_company_address
|
|
<trim prefix="SET" suffixOverrides=",">
|
|
<if test="companyId != null">company_id = #{companyId},</if>
|
|
<if test="provinceCode != null">province_code = #{provinceCode},</if>
|
|
<if test="cityCode != null">city_code = #{cityCode},</if>
|
|
<if test="areaCode != null">area_code = #{areaCode},</if>
|
|
<if test="address != null">address = #{address},</if>
|
|
<if test="createTime != null">create_time = #{createTime},</if>
|
|
<if test="updateTime != null">update_time = #{updateTime},</if>
|
|
</trim>
|
|
where id = #{id}
|
|
</update>
|
|
|
|
<delete id="deleteBmCompanyAddressById" parameterType="Long">
|
|
delete from bm_company_address where id = #{id}
|
|
</delete>
|
|
|
|
<delete id="deleteBmCompanyAddressByIds" parameterType="String">
|
|
delete from bm_company_address where id in
|
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
|
#{id}
|
|
</foreach>
|
|
</delete>
|
|
</mapper> |