|
|
@@ -1,59 +1,72 @@
|
|
|
<?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">
|
|
|
+ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
+ "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
|
|
<mapper namespace="com.ruoyi.logistics.mapper.BizAddressBookMapper">
|
|
|
-
|
|
|
+
|
|
|
<resultMap type="com.ruoyi.logistics.domain.BizAddressBook" id="BizAddressBookResult">
|
|
|
- <result property="addressId" column="address_id" />
|
|
|
- <result property="companyName" column="company_name" />
|
|
|
- <result property="contactName" column="contact_name" />
|
|
|
- <result property="contactPhone" column="contact_phone" />
|
|
|
- <result property="provinceName" column="province_name" />
|
|
|
- <result property="cityName" column="city_name" />
|
|
|
- <result property="countyName" column="county_name" />
|
|
|
- <result property="detailedAddress" column="detailed_address" />
|
|
|
- <result property="defaultFlag" column="default_flag" />
|
|
|
- <result property="deptId" column="dept_id" />
|
|
|
- <result property="userId" column="user_id" />
|
|
|
- <result property="remark" column="remark" />
|
|
|
- <result property="delFlag" column="del_flag" />
|
|
|
- <result property="createTime" column="create_time" />
|
|
|
- <result property="updateTime" column="update_time" />
|
|
|
- <result property="createBy" column="create_by" />
|
|
|
- <result property="updateBy" column="update_by" />
|
|
|
+ <result property="addressId" column="address_id"/>
|
|
|
+ <result property="companyName" column="company_name"/>
|
|
|
+ <result property="contactName" column="contact_name"/>
|
|
|
+ <result property="contactPhone" column="contact_phone"/>
|
|
|
+ <result property="provinceName" column="province_name"/>
|
|
|
+ <result property="cityName" column="city_name"/>
|
|
|
+ <result property="countyName" column="county_name"/>
|
|
|
+ <result property="detailedAddress" column="detailed_address"/>
|
|
|
+ <result property="defaultFlag" column="default_flag"/>
|
|
|
+ <result property="deptId" column="dept_id"/>
|
|
|
+ <result property="userId" column="user_id"/>
|
|
|
+ <result property="remark" column="remark"/>
|
|
|
+ <result property="delFlag" column="del_flag"/>
|
|
|
+ <result property="createTime" column="create_time"/>
|
|
|
+ <result property="updateTime" column="update_time"/>
|
|
|
+ <result property="createBy" column="create_by"/>
|
|
|
+ <result property="updateBy" column="update_by"/>
|
|
|
</resultMap>
|
|
|
|
|
|
<sql id="selectBizAddressBookVo">
|
|
|
- select address_id, company_name, contact_name, contact_phone, province_name, city_name, county_name, detailed_address, default_flag, dept_id, user_id, remark, del_flag, create_time, update_time, create_by, update_by from biz_address_book
|
|
|
+ select address_id, company_name, contact_name, contact_phone, province_name, city_name, county_name,
|
|
|
+ detailed_address, default_flag, dept_id, user_id, remark, del_flag, create_time, update_time, create_by,
|
|
|
+ update_by from biz_address_book
|
|
|
</sql>
|
|
|
|
|
|
- <select id="selectBizAddressBookList" parameterType="com.ruoyi.logistics.domain.BizAddressBook" resultMap="BizAddressBookResult">
|
|
|
+ <select id="selectBizAddressBookList" parameterType="com.ruoyi.logistics.domain.BizAddressBook"
|
|
|
+ resultMap="BizAddressBookResult">
|
|
|
<include refid="selectBizAddressBookVo"/>
|
|
|
- <where>
|
|
|
- <if test="companyName != null and companyName != ''"> and company_name like concat('%', #{companyName}, '%')</if>
|
|
|
- <if test="contactName != null and contactName != ''"> and contact_name like concat('%', #{contactName}, '%')</if>
|
|
|
- <if test="contactPhone != null and contactPhone != ''"> and contact_phone = #{contactPhone}</if>
|
|
|
- <if test="provinceName != null and provinceName != ''"> and province_name like concat('%', #{provinceName}, '%')</if>
|
|
|
- <if test="cityName != null and cityName != ''"> and city_name like concat('%', #{cityName}, '%')</if>
|
|
|
- <if test="countyName != null and countyName != ''"> and county_name like concat('%', #{countyName}, '%')</if>
|
|
|
- <if test="detailedAddress != null and detailedAddress != ''"> and detailed_address = #{detailedAddress}</if>
|
|
|
- <if test="defaultFlag != null and defaultFlag != ''"> and default_flag = #{defaultFlag}</if>
|
|
|
- <if test="deptId != null "> and dept_id = #{deptId}</if>
|
|
|
- <if test="userId != null "> and user_id = #{userId}</if>
|
|
|
- <if test="searchKeyword != null and searchKeyword != ''"> and (contact_name like concat('%', #{searchKeyword}, '%') or
|
|
|
- contact_phone like concat('%', #{searchKeyword}, '%') or
|
|
|
- detailed_address like concat('%', #{searchKeyword}, '%'))</if>
|
|
|
+ <where>
|
|
|
+ <if test="companyName != null and companyName != ''">and company_name like concat('%', #{companyName},
|
|
|
+ '%')
|
|
|
+ </if>
|
|
|
+ <if test="contactName != null and contactName != ''">and contact_name like concat('%', #{contactName},
|
|
|
+ '%')
|
|
|
+ </if>
|
|
|
+ <if test="contactPhone != null and contactPhone != ''">and contact_phone = #{contactPhone}</if>
|
|
|
+ <if test="provinceName != null and provinceName != ''">and province_name like concat('%', #{provinceName},
|
|
|
+ '%')
|
|
|
+ </if>
|
|
|
+ <if test="cityName != null and cityName != ''">and city_name like concat('%', #{cityName}, '%')</if>
|
|
|
+ <if test="countyName != null and countyName != ''">and county_name like concat('%', #{countyName}, '%')
|
|
|
+ </if>
|
|
|
+ <if test="detailedAddress != null and detailedAddress != ''">and detailed_address = #{detailedAddress}</if>
|
|
|
+ <if test="defaultFlag != null and defaultFlag != ''">and default_flag = #{defaultFlag}</if>
|
|
|
+ <if test="deptId != null ">and dept_id = #{deptId}</if>
|
|
|
+ <if test="userId != null ">and user_id = #{userId}</if>
|
|
|
+ <if test="searchKeyword != null and searchKeyword != ''">and (contact_name like concat('%',
|
|
|
+ #{searchKeyword}, '%') or
|
|
|
+ contact_phone like concat('%', #{searchKeyword}, '%') or
|
|
|
+ detailed_address like concat('%', #{searchKeyword}, '%'))
|
|
|
+ </if>
|
|
|
</where>
|
|
|
order by default_flag desc, create_time desc
|
|
|
</select>
|
|
|
-
|
|
|
+
|
|
|
<select id="selectBizAddressBookByAddressId" parameterType="Long" resultMap="BizAddressBookResult">
|
|
|
<include refid="selectBizAddressBookVo"/>
|
|
|
where address_id = #{addressId}
|
|
|
</select>
|
|
|
|
|
|
- <insert id="insertBizAddressBook" parameterType="com.ruoyi.logistics.domain.BizAddressBook" useGeneratedKeys="true" keyProperty="addressId">
|
|
|
+ <insert id="insertBizAddressBook" parameterType="com.ruoyi.logistics.domain.BizAddressBook" useGeneratedKeys="true"
|
|
|
+ keyProperty="addressId">
|
|
|
insert into biz_address_book
|
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
|
<if test="companyName != null">company_name,</if>
|
|
|
@@ -72,7 +85,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
<if test="updateTime != null">update_time,</if>
|
|
|
<if test="createBy != null">create_by,</if>
|
|
|
<if test="updateBy != null">update_by,</if>
|
|
|
- </trim>
|
|
|
+ </trim>
|
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
|
<if test="companyName != null">#{companyName},</if>
|
|
|
<if test="contactName != null">#{contactName},</if>
|
|
|
@@ -90,9 +103,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
<if test="updateTime != null">#{updateTime},</if>
|
|
|
<if test="createBy != null">#{createBy},</if>
|
|
|
<if test="updateBy != null">#{updateBy},</if>
|
|
|
- </trim>
|
|
|
+ </trim>
|
|
|
</insert>
|
|
|
|
|
|
+
|
|
|
<update id="updateBizAddressBook" parameterType="com.ruoyi.logistics.domain.BizAddressBook">
|
|
|
update biz_address_book
|
|
|
<trim prefix="SET" suffixOverrides=",">
|
|
|
@@ -121,7 +135,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
</delete>
|
|
|
|
|
|
<delete id="deleteBizAddressBookByAddressIds" parameterType="String">
|
|
|
- delete from biz_address_book where address_id in
|
|
|
+ delete from biz_address_book where address_id in
|
|
|
<foreach item="addressId" collection="array" open="(" separator="," close=")">
|
|
|
#{addressId}
|
|
|
</foreach>
|
|
|
@@ -131,11 +145,73 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
update biz_address_book set default_flag = '0' where user_id = #{userId} and default_flag = 1
|
|
|
</update>
|
|
|
|
|
|
- <select id="selectDefaultAddressBook" parameterType="com.ruoyi.logistics.domain.BizAddressBook" resultMap="BizAddressBookResult">
|
|
|
+ <select id="selectDefaultAddressBook" parameterType="com.ruoyi.logistics.domain.BizAddressBook"
|
|
|
+ resultMap="BizAddressBookResult">
|
|
|
<include refid="selectBizAddressBookVo"/>
|
|
|
<where>
|
|
|
- <if test="userId != null "> and user_id = #{userId}</if>
|
|
|
- <if test="defaultFlag != null "> and default_flag = #{defaultFlag}</if>
|
|
|
+ <if test="userId != null ">and user_id = #{userId}</if>
|
|
|
+ <if test="defaultFlag != null ">and default_flag = #{defaultFlag}</if>
|
|
|
</where>
|
|
|
</select>
|
|
|
+ <select id="getBizAddressBookList" resultType="com.ruoyi.logistics.domain.BizAddressBook" resultMap="BizAddressBookResult">
|
|
|
+ select address_id, company_name, contact_name, contact_phone, province_name, city_name, county_name,
|
|
|
+ detailed_address, default_flag, dept_id, user_id, remark, del_flag, create_time, update_time, create_by,
|
|
|
+ update_by from biz_address_book
|
|
|
+ <where>
|
|
|
+ 1=1
|
|
|
+ <if test="contactNameSet != null and contactNameSet.size() > 0">
|
|
|
+ <foreach item="contactName" collection="contactNameSet" separator="," open="and contact_name in ("
|
|
|
+ close=")">
|
|
|
+ #{contactName}
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
+ <if test="contactPhoneSet != null and contactPhoneSet.size() > 0">
|
|
|
+ <foreach item="contactPhone" collection="contactPhoneSet" separator="," open="and contact_phone in ("
|
|
|
+ close=")">
|
|
|
+ #{contactPhone}
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
+ <if test="provinceNameSet != null and provinceNameSet.size() > 0">
|
|
|
+ <foreach item="provinceName" collection="provinceNameSet" separator="," open="and province_name in ("
|
|
|
+ close=")">
|
|
|
+ #{provinceName}
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
+ <if test="cityNameSet != null and cityNameSet.size() > 0">
|
|
|
+ <foreach item="cityName" collection="cityNameSet" separator="," open="and city_name in ("
|
|
|
+ close=")">
|
|
|
+ #{cityName}
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
+ <if test="countyNameSet != null and countyNameSet.size() > 0">
|
|
|
+ <foreach item="countyName" collection="countyNameSet" separator="," open="and county_name in ("
|
|
|
+ close=")">
|
|
|
+ #{countyName}
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
+ <if test="addressSet != null and addressSet.size() > 0">
|
|
|
+ <foreach item="address" collection="addressSet" separator="," open="and detailed_address in ("
|
|
|
+ close=")">
|
|
|
+ #{address}
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
+ <if test="defaultFlageSet != null and defaultFlageSet.size() > 0">
|
|
|
+ <foreach item="defaultFlage" collection="defaultFlageSet" separator="," open="and default_flag in ("
|
|
|
+ close=")">
|
|
|
+ #{defaultFlage}
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
+
|
|
|
+ </where>
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <insert id="insertBatch">
|
|
|
+ insert into biz_address_book (company_name, contact_name, contact_phone, province_name, city_name, county_name, detailed_address, default_flag, dept_id, user_id, remark, del_flag, create_time, update_time, create_by, update_by)
|
|
|
+ values
|
|
|
+ <foreach item="item" index="index" collection="list" separator=",">
|
|
|
+ (#{item.companyName}, #{item.contactName}, #{item.contactPhone}, #{item.provinceName}, #{item.cityName}, #{item.countyName}, #{item.detailedAddress}, #{item.defaultFlag}, #{item.deptId}, #{item.userId}, #{item.remark}, #{item.delFlag}, #{item.createTime}, #{item.updateTime}, #{item.createBy}, #{item.updateBy})
|
|
|
+ </foreach>
|
|
|
+ </insert>
|
|
|
+
|
|
|
+
|
|
|
</mapper>
|