2022-08-11 17:14:15 +08:00
|
|
|
<?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.ghy.customer.mapper.CustomerPlaceMapper">
|
|
|
|
|
|
|
|
|
|
<resultMap type="com.ghy.customer.domain.CustomerPlace" id="CustomerPlaceResult">
|
|
|
|
|
<result property="id" column="id" />
|
|
|
|
|
<result property="name" column="name" />
|
|
|
|
|
<result property="customerId" column="customer_id" />
|
|
|
|
|
<result property="phone" column="phone" />
|
|
|
|
|
<result property="city" column="city" />
|
2022-09-01 21:12:58 +08:00
|
|
|
<result property="status" column="status" />
|
2022-08-11 17:14:15 +08:00
|
|
|
<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="remark" column="remark" />
|
|
|
|
|
</resultMap>
|
|
|
|
|
|
|
|
|
|
<sql id="selectCustomerPlaceVo">
|
2022-09-01 21:12:58 +08:00
|
|
|
select id, name, customer_id, phone, city, status, create_by, create_time, update_by, update_time, remark from customer_place
|
2022-08-11 17:14:15 +08:00
|
|
|
</sql>
|
|
|
|
|
|
2023-02-12 23:49:52 +08:00
|
|
|
|
|
|
|
|
<select id="getByCustomerIds" resultMap="CustomerPlaceResult">
|
|
|
|
|
<include refid="selectCustomerPlaceVo" />
|
|
|
|
|
<where>
|
|
|
|
|
<if test="ids != null and ids.size > 0">
|
|
|
|
|
and customer_id in
|
|
|
|
|
<foreach item="item" index="ids" collection="ids" open="(" separator="," close=")">
|
|
|
|
|
#{item}
|
|
|
|
|
</foreach>
|
|
|
|
|
</if>
|
|
|
|
|
and remark is null
|
|
|
|
|
</where>
|
|
|
|
|
</select>
|
|
|
|
|
|
2022-08-11 17:14:15 +08:00
|
|
|
<select id="selectCustomerPlaceList" parameterType="com.ghy.customer.domain.CustomerPlace" resultMap="CustomerPlaceResult">
|
|
|
|
|
<include refid="selectCustomerPlaceVo"/>
|
|
|
|
|
<where>
|
|
|
|
|
<if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
|
|
|
|
|
<if test="customerId != null "> and customer_id = #{customerId}</if>
|
|
|
|
|
<if test="phone != null and phone != ''"> and phone = #{phone}</if>
|
|
|
|
|
<if test="city != null "> and city = #{city}</if>
|
2023-01-07 22:59:07 +08:00
|
|
|
<if test="type != null and type != ''"> and type = #{type}</if>
|
2022-08-11 17:14:15 +08:00
|
|
|
</where>
|
2023-01-07 22:59:07 +08:00
|
|
|
order by create_time desc
|
2022-08-11 17:14:15 +08:00
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<select id="selectCustomerPlaceById" parameterType="String" resultMap="CustomerPlaceResult">
|
|
|
|
|
<include refid="selectCustomerPlaceVo"/>
|
|
|
|
|
where id = #{id}
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<insert id="insertCustomerPlace" parameterType="com.ghy.customer.domain.CustomerPlace" useGeneratedKeys="true" keyProperty="id">
|
|
|
|
|
insert into customer_place
|
|
|
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
|
|
|
<if test="name != null">name,</if>
|
|
|
|
|
<if test="customerId != null">customer_id,</if>
|
|
|
|
|
<if test="phone != null">phone,</if>
|
|
|
|
|
<if test="city != null">city,</if>
|
|
|
|
|
<if test="createBy != null">create_by,</if>
|
|
|
|
|
<if test="createTime != null">create_time,</if>
|
|
|
|
|
<if test="updateBy != null">update_by,</if>
|
|
|
|
|
<if test="updateTime != null">update_time,</if>
|
|
|
|
|
<if test="remark != null">remark,</if>
|
2023-01-07 22:59:07 +08:00
|
|
|
<if test="type != null">type,</if>
|
|
|
|
|
<if test="subType != null">sub_type,</if>
|
2022-08-11 17:14:15 +08:00
|
|
|
</trim>
|
|
|
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
|
|
|
<if test="name != null">#{name},</if>
|
|
|
|
|
<if test="customerId != null">#{customerId},</if>
|
|
|
|
|
<if test="phone != null">#{phone},</if>
|
|
|
|
|
<if test="city != null">#{city},</if>
|
|
|
|
|
<if test="createBy != null">#{createBy},</if>
|
|
|
|
|
<if test="createTime != null">#{createTime},</if>
|
|
|
|
|
<if test="updateBy != null">#{updateBy},</if>
|
|
|
|
|
<if test="updateTime != null">#{updateTime},</if>
|
|
|
|
|
<if test="remark != null">#{remark},</if>
|
2023-01-07 22:59:07 +08:00
|
|
|
<if test="type != null">#{type},</if>
|
|
|
|
|
<if test="subType != null">#{subType},</if>
|
2022-08-11 17:14:15 +08:00
|
|
|
</trim>
|
|
|
|
|
</insert>
|
|
|
|
|
|
|
|
|
|
<update id="updateCustomerPlace" parameterType="com.ghy.customer.domain.CustomerPlace">
|
|
|
|
|
update customer_place
|
|
|
|
|
<trim prefix="SET" suffixOverrides=",">
|
|
|
|
|
<if test="name != null">name = #{name},</if>
|
|
|
|
|
<if test="customerId != null">customer_id = #{customerId},</if>
|
|
|
|
|
<if test="phone != null">phone = #{phone},</if>
|
|
|
|
|
<if test="city != null">city = #{city},</if>
|
|
|
|
|
<if test="createBy != null">create_by = #{createBy},</if>
|
|
|
|
|
<if test="createTime != null">create_time = #{createTime},</if>
|
|
|
|
|
<if test="updateBy != null">update_by = #{updateBy},</if>
|
|
|
|
|
<if test="updateTime != null">update_time = #{updateTime},</if>
|
|
|
|
|
<if test="remark != null">remark = #{remark},</if>
|
|
|
|
|
</trim>
|
|
|
|
|
where id = #{id}
|
|
|
|
|
</update>
|
|
|
|
|
|
|
|
|
|
<delete id="deleteCustomerPlaceById" parameterType="String">
|
|
|
|
|
delete from customer_place where id = #{id}
|
|
|
|
|
</delete>
|
|
|
|
|
|
|
|
|
|
<delete id="deleteCustomerPlaceByIds" parameterType="String">
|
|
|
|
|
delete from customer_place where id in
|
|
|
|
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
|
|
|
|
#{id}
|
|
|
|
|
</foreach>
|
|
|
|
|
</delete>
|
2023-01-07 22:59:07 +08:00
|
|
|
|
2022-08-24 14:19:27 +08:00
|
|
|
<update id="changeStatus">
|
|
|
|
|
UPDATE customer_place set status = #{status}
|
|
|
|
|
WHERE id in ( #{ids} )
|
|
|
|
|
</update>
|
2022-08-11 17:14:15 +08:00
|
|
|
|
2023-01-07 22:59:07 +08:00
|
|
|
</mapper>
|