cpxt-server/cpxt-system/src/main/resources/mapper/biz/BizCustomerShopMapper.xml

108 lines
5.4 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.cpxt.biz.mapper.BizCustomerShopMapper">
<resultMap type="BizCustomerShop" id="BizCustomerShopResult">
<result property="id" column="id" />
<result property="customerId" column="customer_id" />
<result property="customerName" column="customer_name" />
<result property="name" column="name" />
<result property="linkman" column="linkman" />
<result property="linkphone" column="linkphone" />
<result property="address" column="address" />
<result property="lng" column="lng" />
<result property="lat" column="lat" />
<result property="status" column="status" />
<result property="createTime" column="create_time" />
<result property="updateTime" column="update_time" />
<result property="remark" column="remark" />
</resultMap>
<sql id="selectBizCustomerShopVo">
select id, customer_id, customer_name, name, linkman, linkphone, address, lng, lat, status, create_time, update_time, remark from biz_customer_shop
</sql>
<select id="selectBizCustomerShopList" parameterType="BizCustomerShop" resultMap="BizCustomerShopResult">
<include refid="selectBizCustomerShopVo"/>
<where>
<if test="customerId != null "> and customer_id = #{customerId}</if>
<if test="customerName != null and customerName != ''"> and customer_name like concat('%', #{customerName}, '%')</if>
<if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
<if test="linkman != null and linkman != ''"> and linkman = #{linkman}</if>
<if test="linkphone != null and linkphone != ''"> and linkphone = #{linkphone}</if>
<if test="address != null and address != ''"> and address = #{address}</if>
<if test="lng != null "> and lng = #{lng}</if>
<if test="lat != null "> and lat = #{lat}</if>
<if test="status != null "> and status = #{status}</if>
</where>
</select>
<select id="selectBizCustomerShopById" parameterType="Long" resultMap="BizCustomerShopResult">
<include refid="selectBizCustomerShopVo"/>
where id = #{id}
</select>
<insert id="insertBizCustomerShop" parameterType="BizCustomerShop" useGeneratedKeys="true" keyProperty="id">
insert into biz_customer_shop
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="customerId != null">customer_id,</if>
<if test="customerName != null">customer_name,</if>
<if test="name != null">name,</if>
<if test="linkman != null">linkman,</if>
<if test="linkphone != null">linkphone,</if>
<if test="address != null">address,</if>
<if test="lng != null">lng,</if>
<if test="lat != null">lat,</if>
<if test="status != null">status,</if>
<if test="createTime != null">create_time,</if>
<if test="updateTime != null">update_time,</if>
<if test="remark != null">remark,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="customerId != null">#{customerId},</if>
<if test="customerName != null">#{customerName},</if>
<if test="name != null">#{name},</if>
<if test="linkman != null">#{linkman},</if>
<if test="linkphone != null">#{linkphone},</if>
<if test="address != null">#{address},</if>
<if test="lng != null">#{lng},</if>
<if test="lat != null">#{lat},</if>
<if test="status != null">#{status},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="remark != null">#{remark},</if>
</trim>
</insert>
<update id="updateBizCustomerShop" parameterType="BizCustomerShop">
update biz_customer_shop
<trim prefix="SET" suffixOverrides=",">
<if test="customerId != null">customer_id = #{customerId},</if>
<if test="customerName != null">customer_name = #{customerName},</if>
<if test="name != null">name = #{name},</if>
<if test="linkman != null">linkman = #{linkman},</if>
<if test="linkphone != null">linkphone = #{linkphone},</if>
<if test="address != null">address = #{address},</if>
<if test="lng != null">lng = #{lng},</if>
<if test="lat != null">lat = #{lat},</if>
<if test="status != null">status = #{status},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="remark != null">remark = #{remark},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteBizCustomerShopById" parameterType="Long">
delete from biz_customer_shop where id = #{id}
</delete>
<delete id="deleteBizCustomerShopByIds" parameterType="String">
delete from biz_customer_shop where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>