修改
客户/供应商 子表分开,id改回自增
This commit is contained in:
@@ -68,9 +68,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectBmsCustomerByCustomerId" parameterType="String" resultMap="BmsCustomerResult">
|
||||
<select id="selectBmsCustomerByCustomerId" parameterType="Long" resultMap="BmsCustomerResult">
|
||||
<include refid="selectBmsCustomerVo"/>
|
||||
where customer_id = #{customerId}
|
||||
where customer_id = #{customerId} and del_flag = '0'
|
||||
</select>
|
||||
|
||||
<resultMap type="com.ruoyi.customer.customerinfo.domain.BmsCustomerAttachment" id="BmsCustomerAttachmentResult">
|
||||
@@ -161,21 +161,20 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
where attachment_id = #{attachmentId}
|
||||
</update>
|
||||
|
||||
<delete id="deleteBmsCustomerAttachmentByCustomerId" parameterType="String">
|
||||
<delete id="deleteBmsCustomerAttachmentByCustomerId" parameterType="Long">
|
||||
update bms_customer_attachment set del_flag = '2' where customer_id = #{customerId}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteBmsCustomerAttachmentByAttachmentIds" parameterType="String">
|
||||
update bms_customer_attachment set del_flag = '2' where attachment_id in
|
||||
<foreach item="attachmentId" collection="array" open="(" separator="," close=")">
|
||||
<foreach item="attachmentId" collection="attachmentIds" open="(" separator="," close=")">
|
||||
#{attachmentId}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
<insert id="insertBmsCustomer" parameterType="BmsCustomer">
|
||||
<insert id="insertBmsCustomer" parameterType="BmsCustomer" useGeneratedKeys="true" keyProperty="customerId">
|
||||
insert into bms_customer
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
customer_id,
|
||||
<if test="customerCode != null and customerCode != ''">customer_code,</if>
|
||||
<if test="customerName != null and customerName != ''">customer_name,</if>
|
||||
<if test="customerCodeDw != null">customer_code_dw,</if>
|
||||
@@ -206,7 +205,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="delFlag != null">del_flag,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
#{customerId},
|
||||
<if test="customerCode != null and customerCode != ''">#{customerCode},</if>
|
||||
<if test="customerName != null and customerName != ''">#{customerName},</if>
|
||||
<if test="customerCodeDw != null">#{customerCodeDw},</if>
|
||||
@@ -273,13 +271,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
where customer_id = #{customerId}
|
||||
</update>
|
||||
|
||||
<delete id="deleteBmsCustomerByCustomerId" parameterType="String">
|
||||
delete from bms_customer where customer_id = #{customerId}
|
||||
<delete id="deleteBmsCustomerByCustomerId" parameterType="Long">
|
||||
update bms_customer set del_flag = '2' where customer_id = #{customerId}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteBmsCustomerByCustomerIds" parameterType="String">
|
||||
delete from bms_customer where customer_id in
|
||||
<foreach item="customerId" collection="array" open="(" separator="," close=")">
|
||||
<delete id="deleteBmsCustomerByCustomerIds" parameterType="Long">
|
||||
update bms_customer set del_flag = '2' where customer_id in
|
||||
<foreach item="customerId" collection="customerIds" open="(" separator="," close=")">
|
||||
#{customerId}
|
||||
</foreach>
|
||||
</delete>
|
||||
@@ -463,11 +461,149 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
where company_id = #{companyId}
|
||||
</update>
|
||||
|
||||
<delete id="deleteBmsCustomerCompanyByCustomerId" parameterType="String">
|
||||
<delete id="deleteBmsCustomerCompanyByCustomerId" parameterType="Long">
|
||||
update bms_customer_company set del_flag = '2' where customer_id = #{customerId}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteBmsCustomerCompanyByCompanyId" parameterType="Long">
|
||||
update bms_customer_company set del_flag = '2' where company_id = #{companyId}
|
||||
</delete>
|
||||
|
||||
<!-- ========== bms_customer_contact 子表 ========== -->
|
||||
<resultMap type="com.ruoyi.customer.customerinfo.domain.BmsCustomerContact" id="BmsCustomerContactResult">
|
||||
<result property="contactId" column="contact_id" />
|
||||
<result property="customerId" column="customer_id" />
|
||||
<result property="contactName" column="contact_name" />
|
||||
<result property="position" column="position" />
|
||||
<result property="department" column="department" />
|
||||
<result property="phone" column="phone" />
|
||||
<result property="landline" column="landline" />
|
||||
<result property="email" column="email" />
|
||||
<result property="wechat" column="wechat" />
|
||||
<result property="qq" column="qq" />
|
||||
<result property="country" column="country" />
|
||||
<result property="province" column="province" />
|
||||
<result property="city" column="city" />
|
||||
<result property="district" column="district" />
|
||||
<result property="contactAddress" column="contact_address" />
|
||||
<result property="postalCode" column="postal_code" />
|
||||
<result property="isDefault" column="is_default" />
|
||||
<result property="contactType" column="contact_type" />
|
||||
<result property="sortOrder" column="sort_order" />
|
||||
<result property="remark" column="remark" />
|
||||
<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="delFlag" column="del_flag" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectBmsCustomerContactVo">
|
||||
select contact_id, customer_id, contact_name, position, department, phone, landline, email, wechat, qq, country, province, city, district, contact_address, postal_code, is_default, contact_type, sort_order, remark, create_by, create_time, update_by, update_time, del_flag from bms_customer_contact
|
||||
</sql>
|
||||
|
||||
<select id="selectBmsCustomerContactList" parameterType="com.ruoyi.customer.customerinfo.domain.BmsCustomerContact" resultMap="BmsCustomerContactResult">
|
||||
<include refid="selectBmsCustomerContactVo"/>
|
||||
<where>
|
||||
<if test="customerId != null"> and customer_id = #{customerId}</if>
|
||||
<if test="contactName != null and contactName != ''"> and contact_name like concat('%', #{contactName}, '%')</if>
|
||||
<if test="phone != null and phone != ''"> and phone = #{phone}</if>
|
||||
<if test="contactType != null and contactType != ''"> and contact_type = #{contactType}</if>
|
||||
and del_flag = '0'
|
||||
</where>
|
||||
order by sort_order asc, contact_id asc
|
||||
</select>
|
||||
|
||||
<select id="selectBmsCustomerContactByContactId" parameterType="Long" resultMap="BmsCustomerContactResult">
|
||||
<include refid="selectBmsCustomerContactVo"/>
|
||||
where contact_id = #{contactId} and del_flag = '0'
|
||||
</select>
|
||||
|
||||
<insert id="insertBmsCustomerContact" parameterType="com.ruoyi.customer.customerinfo.domain.BmsCustomerContact" useGeneratedKeys="true" keyProperty="contactId">
|
||||
insert into bms_customer_contact
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="customerId != null">customer_id,</if>
|
||||
<if test="contactName != null">contact_name,</if>
|
||||
<if test="position != null">position,</if>
|
||||
<if test="department != null">department,</if>
|
||||
<if test="phone != null">phone,</if>
|
||||
<if test="landline != null">landline,</if>
|
||||
<if test="email != null">email,</if>
|
||||
<if test="wechat != null">wechat,</if>
|
||||
<if test="qq != null">qq,</if>
|
||||
<if test="country != null">country,</if>
|
||||
<if test="province != null">province,</if>
|
||||
<if test="city != null">city,</if>
|
||||
<if test="district != null">district,</if>
|
||||
<if test="contactAddress != null">contact_address,</if>
|
||||
<if test="postalCode != null">postal_code,</if>
|
||||
<if test="isDefault != null">is_default,</if>
|
||||
<if test="contactType != null">contact_type,</if>
|
||||
<if test="sortOrder != null">sort_order,</if>
|
||||
<if test="remark != null">remark,</if>
|
||||
<if test="createBy != null">create_by,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
<if test="delFlag != null">del_flag,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="customerId != null">#{customerId},</if>
|
||||
<if test="contactName != null">#{contactName},</if>
|
||||
<if test="position != null">#{position},</if>
|
||||
<if test="department != null">#{department},</if>
|
||||
<if test="phone != null">#{phone},</if>
|
||||
<if test="landline != null">#{landline},</if>
|
||||
<if test="email != null">#{email},</if>
|
||||
<if test="wechat != null">#{wechat},</if>
|
||||
<if test="qq != null">#{qq},</if>
|
||||
<if test="country != null">#{country},</if>
|
||||
<if test="province != null">#{province},</if>
|
||||
<if test="city != null">#{city},</if>
|
||||
<if test="district != null">#{district},</if>
|
||||
<if test="contactAddress != null">#{contactAddress},</if>
|
||||
<if test="postalCode != null">#{postalCode},</if>
|
||||
<if test="isDefault != null">#{isDefault},</if>
|
||||
<if test="contactType != null">#{contactType},</if>
|
||||
<if test="sortOrder != null">#{sortOrder},</if>
|
||||
<if test="remark != null">#{remark},</if>
|
||||
<if test="createBy != null">#{createBy},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
<if test="delFlag != null">#{delFlag},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateBmsCustomerContact" parameterType="com.ruoyi.customer.customerinfo.domain.BmsCustomerContact">
|
||||
update bms_customer_contact
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="customerId != null">customer_id = #{customerId},</if>
|
||||
<if test="contactName != null">contact_name = #{contactName},</if>
|
||||
<if test="position != null">position = #{position},</if>
|
||||
<if test="department != null">department = #{department},</if>
|
||||
<if test="phone != null">phone = #{phone},</if>
|
||||
<if test="landline != null">landline = #{landline},</if>
|
||||
<if test="email != null">email = #{email},</if>
|
||||
<if test="wechat != null">wechat = #{wechat},</if>
|
||||
<if test="qq != null">qq = #{qq},</if>
|
||||
<if test="country != null">country = #{country},</if>
|
||||
<if test="province != null">province = #{province},</if>
|
||||
<if test="city != null">city = #{city},</if>
|
||||
<if test="district != null">district = #{district},</if>
|
||||
<if test="contactAddress != null">contact_address = #{contactAddress},</if>
|
||||
<if test="postalCode != null">postal_code = #{postalCode},</if>
|
||||
<if test="isDefault != null">is_default = #{isDefault},</if>
|
||||
<if test="contactType != null">contact_type = #{contactType},</if>
|
||||
<if test="sortOrder != null">sort_order = #{sortOrder},</if>
|
||||
<if test="remark != null">remark = #{remark},</if>
|
||||
<if test="updateBy != null">update_by = #{updateBy},</if>
|
||||
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||
</trim>
|
||||
where contact_id = #{contactId}
|
||||
</update>
|
||||
|
||||
<delete id="deleteBmsCustomerContactByCustomerId" parameterType="Long">
|
||||
update bms_customer_contact set del_flag = '2' where customer_id = #{customerId}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteBmsCustomerContactByContactId" parameterType="Long">
|
||||
update bms_customer_contact set del_flag = '2' where contact_id = #{contactId}
|
||||
</delete>
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user