<?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.ruoyi.cwgl.mapper.CustomerManagementMapper">
|
|
<resultMap type="com.ruoyi.cwgl.domain.CustomerManagement" id="CustomerManagementResult">
|
<result property="id" column="id" />
|
<result property="customerFullName" column="customer_full_name" />
|
<result property="customerShortName" column="customer_short_name" />
|
<result property="customerType" column="customer_type" />
|
<result property="contactPerson" column="contact_person" />
|
<result property="address" column="address" />
|
<result property="contactPhone" column="contact_phone" />
|
<result property="customerCode" column="customer_code" />
|
<result property="status" column="status" />
|
<result property="remark" column="remark" />
|
<result property="createBy" column="create_by" />
|
<result property="updateBy" column="update_by" />
|
<result property="createTime" column="create_time" />
|
<result property="updateTime" column="update_time" />
|
<result property="deleted" column="deleted" />
|
</resultMap>
|
|
<sql id="selectCustomerManagementVo">
|
select thisTab.id, thisTab.customer_full_name, thisTab.customer_short_name, thisTab.customer_type, thisTab.contact_person, thisTab.address, thisTab.contact_phone, thisTab.customer_code, thisTab.status, thisTab.remark, thisTab.create_by, thisTab.update_by, thisTab.create_time, thisTab.update_time, thisTab.deleted from customer_management AS thisTab
|
</sql>
|
<sql id="selectCustomerManagementVoCount">
|
select count(0) from customer_management as thisTab
|
</sql>
|
|
<sql id="whereCondition">
|
<if test="customerFullName != null and customerFullName != ''"> and thisTab.customer_full_name like concat('%', #{customerFullName}, '%')</if>
|
<if test="customerShortName != null and customerShortName != ''"> and thisTab.customer_short_name like concat('%', #{customerShortName}, '%')</if>
|
<if test="customerType != null and customerType != ''"> and thisTab.customer_type = #{customerType}</if>
|
<if test="contactPerson != null and contactPerson != ''"> and thisTab.contact_person = #{contactPerson}</if>
|
<if test="address != null and address != ''"> and thisTab.address = #{address}</if>
|
<if test="contactPhone != null and contactPhone != ''"> and thisTab.contact_phone = #{contactPhone}</if>
|
<if test="customerCode != null and customerCode != ''"> and thisTab.customer_code = #{customerCode}</if>
|
<if test="status != null "> and thisTab.status = #{status}</if>
|
<if test="deleted != null "> and thisTab.deleted = #{deleted}</if>
|
</sql>
|
|
<!--查询-->
|
<select id="selectCustomerManagementById" parameterType="Integer" resultMap="CustomerManagementResult">
|
<include refid="selectCustomerManagementVo"/>
|
where id = #{id}
|
</select>
|
|
<select id="selectCustomerManagementCount" parameterType="com.ruoyi.cwgl.domain.CustomerManagement" resultType="int">
|
<include refid="selectCustomerManagementVoCount"/>
|
<where>
|
<include refid="whereCondition"/>
|
</where>
|
</select>
|
|
<select id="selectCustomerManagementList" parameterType="com.ruoyi.cwgl.domain.CustomerManagement" resultMap="CustomerManagementResult">
|
<include refid="selectCustomerManagementVo"/>
|
<where>
|
<include refid="whereCondition"/>
|
</where>
|
order by thisTab.id desc
|
</select>
|
|
<!-- 新增 -->
|
<insert id="insertCustomerManagement" parameterType="com.ruoyi.cwgl.domain.CustomerManagement" useGeneratedKeys="true" keyProperty="id">
|
insert into customer_management
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
<if test="customerFullName != null and customerFullName != ''">customer_full_name,</if>
|
<if test="customerShortName != null">customer_short_name,</if>
|
<if test="customerType != null">customer_type,</if>
|
<if test="contactPerson != null">contact_person,</if>
|
<if test="address != null">address,</if>
|
<if test="contactPhone != null">contact_phone,</if>
|
<if test="customerCode != null">customer_code,</if>
|
<if test="status != null">status,</if>
|
<if test="remark != null">remark,</if>
|
<if test="createBy != null">create_by,</if>
|
<if test="updateBy != null">update_by,</if>
|
<if test="createTime != null">create_time,</if>
|
<if test="updateTime != null">update_time,</if>
|
<if test="deleted != null">deleted,</if>
|
</trim>
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
<if test="customerFullName != null and customerFullName != ''">#{customerFullName},</if>
|
<if test="customerShortName != null">#{customerShortName},</if>
|
<if test="customerType != null">#{customerType},</if>
|
<if test="contactPerson != null">#{contactPerson},</if>
|
<if test="address != null">#{address},</if>
|
<if test="contactPhone != null">#{contactPhone},</if>
|
<if test="customerCode != null">#{customerCode},</if>
|
<if test="status != null">#{status},</if>
|
<if test="remark != null">#{remark},</if>
|
<if test="createBy != null">#{createBy},</if>
|
<if test="updateBy != null">#{updateBy},</if>
|
<if test="createTime != null">#{createTime},</if>
|
<if test="updateTime != null">#{updateTime},</if>
|
<if test="deleted != null">#{deleted},</if>
|
</trim>
|
</insert>
|
|
<insert id="insertCustomerManagementBatch" parameterType="java.util.List" useGeneratedKeys="true" keyProperty="id">
|
insert into customer_management
|
<trim prefix="(" suffix=") values" suffixOverrides=",">
|
id,customer_full_name,customer_short_name,customer_type,contact_person,address,contact_phone,customer_code,status,remark,create_by,update_by,create_time,update_time,deleted,
|
</trim>
|
<foreach item="item" index="index" collection="list" separator=",">
|
<trim prefix="(" suffix=") " suffixOverrides=",">
|
#{item.id},#{item.customerFullName},#{item.customerShortName},#{item.customerType},#{item.contactPerson},#{item.address},#{item.contactPhone},#{item.customerCode},#{item.status},#{item.remark},#{item.createBy},#{item.updateBy},#{item.createTime},#{item.updateTime},#{item.deleted},
|
</trim>
|
</foreach>
|
</insert>
|
|
<!-- 修改 -->
|
<update id="updateCustomerManagement" parameterType="com.ruoyi.cwgl.domain.CustomerManagement">
|
update customer_management
|
<trim prefix="SET" suffixOverrides=",">
|
<if test="customerFullName != null and customerFullName != ''">customer_full_name = #{customerFullName},</if>
|
<if test="customerShortName != null">customer_short_name = #{customerShortName},</if>
|
<if test="customerType != null">customer_type = #{customerType},</if>
|
<if test="contactPerson != null">contact_person = #{contactPerson},</if>
|
<if test="address != null">address = #{address},</if>
|
<if test="contactPhone != null">contact_phone = #{contactPhone},</if>
|
<if test="customerCode != null">customer_code = #{customerCode},</if>
|
<if test="status != null">status = #{status},</if>
|
<if test="remark != null">remark = #{remark},</if>
|
<if test="createBy != null">create_by = #{createBy},</if>
|
<if test="updateBy != null">update_by = #{updateBy},</if>
|
<if test="createTime != null">create_time = #{createTime},</if>
|
<if test="updateTime != null">update_time = #{updateTime},</if>
|
<if test="deleted != null">deleted = #{deleted},</if>
|
</trim>
|
where id = #{id}
|
</update>
|
<!-- 修改 -->
|
<update id="updateCustomerManagementBatch" parameterType="java.util.List">
|
<foreach collection="list" item="item" index="index" separator=";">
|
update customer_management
|
<trim prefix="SET" suffixOverrides=",">
|
<if test="item.customerFullName != null and item.customerFullName != ''">customer_full_name = #{item.customerFullName},</if>
|
<if test="item.customerShortName != null">customer_short_name = #{item.customerShortName},</if>
|
<if test="item.customerType != null">customer_type = #{item.customerType},</if>
|
<if test="item.contactPerson != null">contact_person = #{item.contactPerson},</if>
|
<if test="item.address != null">address = #{item.address},</if>
|
<if test="item.contactPhone != null">contact_phone = #{item.contactPhone},</if>
|
<if test="item.customerCode != null">customer_code = #{item.customerCode},</if>
|
<if test="item.status != null">status = #{item.status},</if>
|
<if test="item.remark != null">remark = #{item.remark},</if>
|
<if test="item.createBy != null">create_by = #{item.createBy},</if>
|
<if test="item.updateBy != null">update_by = #{item.updateBy},</if>
|
<if test="item.createTime != null">create_time = #{item.createTime},</if>
|
<if test="item.updateTime != null">update_time = #{item.updateTime},</if>
|
<if test="item.deleted != null">deleted = #{item.deleted},</if>
|
</trim>
|
where id = #{item.id}
|
</foreach>
|
</update>
|
|
<!--删除-->
|
<delete id="deleteCustomerManagementById" parameterType="Integer">
|
delete from customer_management where id = #{id}
|
</delete>
|
<delete id="deleteCustomerManagementByIds" parameterType="Integer">
|
delete from customer_management where id in
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
#{id}
|
</foreach>
|
</delete>
|
|
</mapper>
|