You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
421 lines
15 KiB
XML
421 lines
15 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="org.dromara.oa.crm.mapper.CrmQuoteInfoMapper">
|
|
<resultMap type="org.dromara.oa.crm.domain.vo.CrmQuoteInfoVo" id="CrmQuoteInfoResult">
|
|
</resultMap>
|
|
|
|
<select id="selectCustomCrmQuoteInfoVoList" resultMap="CrmQuoteInfoResult">
|
|
select t.quote_id, t.tenant_id, t.quote_code, t.quote_name, t.quote_round, t.quote_category,
|
|
t.quote_type, t.business_direction, t.quote_dept_id, t.quote_date, t.valid_from, t.valid_days, t.valid_to,
|
|
t.delivery_period, t.delivery_method, t.payment_method, t.currency_type, t.tax_included_info, t.tax_rate, t.total_price, t.total_before_tax,
|
|
t.total_tax, t.total_including_tax, t.customer_contact_id, t.customer_contact_name, t.customer_contact_phone, t.customer_contact_email,
|
|
t.supplier_contact_id, t.supplier_contact_name, t.supplier_contact_phone, t.supplier_contact_email, t.project_id, t.template_id, t.oss_id, t.quote_status,
|
|
t.flow_status, t.remark,
|
|
ci.customer_name as customerName,
|
|
s.supplier_name as supplierName,
|
|
d.dept_name as deptName,
|
|
u3.nick_name as createName,
|
|
t.del_flag, t.create_dept, t.create_by, t.create_time, t.update_by, t.update_time
|
|
from crm_quote_info t
|
|
left join sys_user u3 on t.create_by = u3.user_id
|
|
left join sys_dept d on d.dept_id = t.quote_dept_id
|
|
left join crm_customer_contact cc on t.customer_contact_id = cc.contact_id
|
|
left join crm_customer_info ci on ci.customer_id = cc.customer_id
|
|
left join crm_supplier_info s on s.supplier_id = t.supplier_contact_id
|
|
<where>
|
|
<if test="ew != null and ew.sqlSegment != null and ew.sqlSegment != ''">
|
|
AND ${ew.sqlSegment}
|
|
</if>
|
|
</where>
|
|
</select>
|
|
|
|
<!-- 根据ID查询详情 -->
|
|
<select id="selectCustomCrmQuoteInfoVoById" resultMap="CrmQuoteInfoResult">
|
|
select t.quote_id, t.tenant_id, t.quote_code, t.quote_name, t.quote_round, t.quote_category, t.quote_type, t.business_direction, t.quote_dept_id, t.quote_date, t.valid_from, t.valid_days, t.valid_to, t.delivery_period, t.delivery_method, t.payment_method, t.currency_type, t.tax_included_info, t.tax_rate, t.total_price, t.total_before_tax, t.total_tax, t.total_including_tax, t.customer_contact_id, t.customer_contact_name, t.customer_contact_phone, t.customer_contact_email, t.supplier_contact_id, t.supplier_contact_name, t.supplier_contact_phone, t.supplier_contact_email, t.project_id, t.template_id, t.oss_id, t.quote_status, t.flow_status, t.remark, t.del_flag, t.create_dept, t.create_by, t.create_time, t.update_by, t.update_time
|
|
from crm_quote_info t
|
|
where t.quote_id = #{quoteId}
|
|
</select>
|
|
|
|
<!-- 批量查询 - 根据ID列表 -->
|
|
<select id="selectCustomCrmQuoteInfoVoByIds" resultMap="CrmQuoteInfoResult">
|
|
select t.quote_id, t.tenant_id, t.quote_code, t.quote_name, t.quote_round, t.quote_category,
|
|
t.quote_type, t.business_direction, t.quote_dept_id, t.quote_date, t.valid_from, t.valid_days,
|
|
t.valid_to, t.delivery_period, t.delivery_method, t.payment_method, t.currency_type, t.tax_included_info,
|
|
t.tax_rate, t.total_price, t.total_before_tax, t.total_tax, t.total_including_tax, t.customer_contact_id, t.customer_contact_name, t.customer_contact_phone, t.customer_contact_email, t.supplier_contact_id, t.supplier_contact_name, t.supplier_contact_phone, t.supplier_contact_email, t.project_id, t.template_id, t.oss_id, t.quote_status, t.flow_status, t.remark, t.del_flag, t.create_dept, t.create_by, t.create_time, t.update_by, t.update_time
|
|
from crm_quote_info t
|
|
where t.quote_id in
|
|
<foreach collection="ids" item="id" open="(" separator="," close=")">
|
|
#{id}
|
|
</foreach>
|
|
</select>
|
|
|
|
<!-- 统计查询 -->
|
|
<select id="countCustomCrmQuoteInfo" resultType="java.lang.Long">
|
|
select count(1) from crm_quote_info t
|
|
<where>
|
|
<if test="ew != null and ew.sqlSegment != null and ew.sqlSegment != ''">
|
|
AND ${ew.sqlSegment}
|
|
</if>
|
|
</where>
|
|
</select>
|
|
|
|
<!-- 分页查询(带自定义条件) -->
|
|
<select id="selectCustomCrmQuoteInfoVoPage" resultMap="CrmQuoteInfoResult">
|
|
select quote_id, tenant_id, quote_code, quote_name, quote_round, quote_category, quote_type, business_direction, quote_dept_id, quote_date, valid_from, valid_days, valid_to, delivery_period, delivery_method, payment_method, currency_type, tax_included_info, tax_rate, total_price, total_before_tax, total_tax, total_including_tax, customer_contact_id, customer_contact_name, customer_contact_phone, customer_contact_email, supplier_contact_id, supplier_contact_name, supplier_contact_phone, supplier_contact_email, project_id, template_id, oss_id, quote_status, flow_status, remark, del_flag, create_dept, create_by, create_time, update_by, update_time
|
|
from crm_quote_info t
|
|
<where>
|
|
<if test="ew != null and ew.sqlSegment != null and ew.sqlSegment != ''">
|
|
AND ${ew.sqlSegment}
|
|
</if>
|
|
</where>
|
|
</select>
|
|
|
|
<!-- 批量插入 -->
|
|
<insert id="batchInsertCrmQuoteInfo">
|
|
insert into crm_quote_info(
|
|
tenant_id,
|
|
|
|
quote_code,
|
|
|
|
quote_name,
|
|
|
|
quote_round,
|
|
|
|
quote_category,
|
|
|
|
quote_type,
|
|
|
|
business_direction,
|
|
|
|
quote_dept_id,
|
|
|
|
quote_date,
|
|
|
|
valid_from,
|
|
|
|
valid_days,
|
|
|
|
valid_to,
|
|
|
|
delivery_period,
|
|
|
|
delivery_method,
|
|
|
|
payment_method,
|
|
|
|
currency_type,
|
|
|
|
tax_included_info,
|
|
|
|
tax_rate,
|
|
|
|
total_price,
|
|
|
|
total_before_tax,
|
|
|
|
total_tax,
|
|
|
|
total_including_tax,
|
|
|
|
customer_contact_id,
|
|
|
|
customer_contact_name,
|
|
|
|
customer_contact_phone,
|
|
|
|
customer_contact_email,
|
|
|
|
supplier_contact_id,
|
|
|
|
supplier_contact_name,
|
|
|
|
supplier_contact_phone,
|
|
|
|
supplier_contact_email,
|
|
|
|
project_id,
|
|
|
|
template_id,
|
|
|
|
oss_id,
|
|
|
|
quote_status,
|
|
|
|
flow_status,
|
|
|
|
remark,
|
|
|
|
del_flag,
|
|
|
|
create_dept,
|
|
|
|
create_by,
|
|
|
|
create_time,
|
|
|
|
update_by,
|
|
|
|
update_time
|
|
|
|
)
|
|
values
|
|
<foreach collection="list" item="item" separator=",">
|
|
(
|
|
#{item.tenantId},
|
|
|
|
#{item.quoteCode},
|
|
|
|
#{item.quoteName},
|
|
|
|
#{item.quoteRound},
|
|
|
|
#{item.quoteCategory},
|
|
|
|
#{item.quoteType},
|
|
|
|
#{item.businessDirection},
|
|
|
|
#{item.quoteDeptId},
|
|
|
|
#{item.quoteDate},
|
|
|
|
#{item.validFrom},
|
|
|
|
#{item.validDays},
|
|
|
|
#{item.validTo},
|
|
|
|
#{item.deliveryPeriod},
|
|
|
|
#{item.deliveryMethod},
|
|
|
|
#{item.paymentMethod},
|
|
|
|
#{item.currencyType},
|
|
|
|
#{item.taxIncludedInfo},
|
|
|
|
#{item.taxRate},
|
|
|
|
#{item.totalPrice},
|
|
|
|
#{item.totalBeforeTax},
|
|
|
|
#{item.totalTax},
|
|
|
|
#{item.totalIncludingTax},
|
|
|
|
#{item.customerContactId},
|
|
|
|
#{item.customerContactName},
|
|
|
|
#{item.customerContactPhone},
|
|
|
|
#{item.customerContactEmail},
|
|
|
|
#{item.supplierContactId},
|
|
|
|
#{item.supplierContactName},
|
|
|
|
#{item.supplierContactPhone},
|
|
|
|
#{item.supplierContactEmail},
|
|
|
|
#{item.projectId},
|
|
|
|
#{item.templateId},
|
|
|
|
#{item.ossId},
|
|
|
|
#{item.quoteStatus},
|
|
|
|
#{item.flowStatus},
|
|
|
|
#{item.remark},
|
|
|
|
#{item.delFlag},
|
|
|
|
#{item.createDept},
|
|
|
|
#{item.createBy},
|
|
|
|
#{item.createTime},
|
|
|
|
#{item.updateBy},
|
|
|
|
#{item.updateTime}
|
|
|
|
)
|
|
</foreach>
|
|
</insert>
|
|
|
|
<!-- 批量更新 -->
|
|
<update id="batchUpdateCrmQuoteInfo">
|
|
<foreach collection="list" item="item" separator=";">
|
|
update crm_quote_info
|
|
<set>
|
|
<if test="item.tenantId != null and item.tenantId != ''">
|
|
tenant_id = #{item.tenantId},
|
|
</if>
|
|
<if test="item.quoteCode != null and item.quoteCode != ''">
|
|
quote_code = #{item.quoteCode},
|
|
</if>
|
|
<if test="item.quoteName != null and item.quoteName != ''">
|
|
quote_name = #{item.quoteName},
|
|
</if>
|
|
<if test="item.quoteRound != null">
|
|
quote_round = #{item.quoteRound},
|
|
</if>
|
|
<if test="item.quoteCategory != null and item.quoteCategory != ''">
|
|
quote_category = #{item.quoteCategory},
|
|
</if>
|
|
<if test="item.quoteType != null and item.quoteType != ''">
|
|
quote_type = #{item.quoteType},
|
|
</if>
|
|
<if test="item.businessDirection != null and item.businessDirection != ''">
|
|
business_direction = #{item.businessDirection},
|
|
</if>
|
|
<if test="item.quoteDeptId != null">
|
|
quote_dept_id = #{item.quoteDeptId},
|
|
</if>
|
|
<if test="item.quoteDate != null">
|
|
quote_date = #{item.quoteDate},
|
|
</if>
|
|
<if test="item.validFrom != null">
|
|
valid_from = #{item.validFrom},
|
|
</if>
|
|
<if test="item.validDays != null">
|
|
valid_days = #{item.validDays},
|
|
</if>
|
|
<if test="item.validTo != null">
|
|
valid_to = #{item.validTo},
|
|
</if>
|
|
<if test="item.deliveryPeriod != null">
|
|
delivery_period = #{item.deliveryPeriod},
|
|
</if>
|
|
<if test="item.deliveryMethod != null and item.deliveryMethod != ''">
|
|
delivery_method = #{item.deliveryMethod},
|
|
</if>
|
|
<if test="item.paymentMethod != null and item.paymentMethod != ''">
|
|
payment_method = #{item.paymentMethod},
|
|
</if>
|
|
<if test="item.currencyType != null and item.currencyType != ''">
|
|
currency_type = #{item.currencyType},
|
|
</if>
|
|
<if test="item.taxIncludedInfo != null and item.taxIncludedInfo != ''">
|
|
tax_included_info = #{item.taxIncludedInfo},
|
|
</if>
|
|
<if test="item.taxRate != null">
|
|
tax_rate = #{item.taxRate},
|
|
</if>
|
|
<if test="item.totalPrice != null">
|
|
total_price = #{item.totalPrice},
|
|
</if>
|
|
<if test="item.totalBeforeTax != null">
|
|
total_before_tax = #{item.totalBeforeTax},
|
|
</if>
|
|
<if test="item.totalTax != null">
|
|
total_tax = #{item.totalTax},
|
|
</if>
|
|
<if test="item.totalIncludingTax != null">
|
|
total_including_tax = #{item.totalIncludingTax},
|
|
</if>
|
|
<if test="item.customerContactId != null">
|
|
customer_contact_id = #{item.customerContactId},
|
|
</if>
|
|
<if test="item.customerContactName != null and item.customerContactName != ''">
|
|
customer_contact_name = #{item.customerContactName},
|
|
</if>
|
|
<if test="item.customerContactPhone != null and item.customerContactPhone != ''">
|
|
customer_contact_phone = #{item.customerContactPhone},
|
|
</if>
|
|
<if test="item.customerContactEmail != null and item.customerContactEmail != ''">
|
|
customer_contact_email = #{item.customerContactEmail},
|
|
</if>
|
|
<if test="item.supplierContactId != null">
|
|
supplier_contact_id = #{item.supplierContactId},
|
|
</if>
|
|
<if test="item.supplierContactName != null and item.supplierContactName != ''">
|
|
supplier_contact_name = #{item.supplierContactName},
|
|
</if>
|
|
<if test="item.supplierContactPhone != null and item.supplierContactPhone != ''">
|
|
supplier_contact_phone = #{item.supplierContactPhone},
|
|
</if>
|
|
<if test="item.supplierContactEmail != null and item.supplierContactEmail != ''">
|
|
supplier_contact_email = #{item.supplierContactEmail},
|
|
</if>
|
|
<if test="item.projectId != null">
|
|
project_id = #{item.projectId},
|
|
</if>
|
|
<if test="item.templateId != null">
|
|
template_id = #{item.templateId},
|
|
</if>
|
|
<if test="item.ossId != null and item.ossId != ''">
|
|
oss_id = #{item.ossId},
|
|
</if>
|
|
<if test="item.quoteStatus != null and item.quoteStatus != ''">
|
|
quote_status = #{item.quoteStatus},
|
|
</if>
|
|
<if test="item.flowStatus != null and item.flowStatus != ''">
|
|
flow_status = #{item.flowStatus},
|
|
</if>
|
|
<if test="item.remark != null and item.remark != ''">
|
|
remark = #{item.remark},
|
|
</if>
|
|
<if test="item.delFlag != null and item.delFlag != ''">
|
|
del_flag = #{item.delFlag},
|
|
</if>
|
|
<if test="item.createDept != null">
|
|
create_dept = #{item.createDept},
|
|
</if>
|
|
<if test="item.createBy != null">
|
|
create_by = #{item.createBy},
|
|
</if>
|
|
<if test="item.createTime != null">
|
|
create_time = #{item.createTime},
|
|
</if>
|
|
<if test="item.updateBy != null">
|
|
update_by = #{item.updateBy},
|
|
</if>
|
|
<if test="item.updateTime != null">
|
|
update_time = #{item.updateTime}
|
|
</if>
|
|
</set>
|
|
where quote_id = #{item.quoteId}
|
|
</foreach>
|
|
</update>
|
|
|
|
<!-- 根据自定义条件删除 -->
|
|
<delete id="deleteCustomCrmQuoteInfo">
|
|
delete from crm_quote_info
|
|
<where>
|
|
<if test="ew != null and ew.sqlSegment != null and ew.sqlSegment != ''">
|
|
AND ${ew.sqlSegment}
|
|
</if>
|
|
</where>
|
|
</delete>
|
|
|
|
<!-- 根据ID列表批量删除 -->
|
|
<delete id="deleteCustomCrmQuoteInfoByIds">
|
|
delete from crm_quote_info
|
|
where quote_id in
|
|
<foreach collection="ids" item="id" open="(" separator="," close=")">
|
|
#{id}
|
|
</foreach>
|
|
</delete>
|
|
|
|
<!-- 检查是否存在 -->
|
|
<select id="existsCrmQuoteInfo" resultType="java.lang.Boolean">
|
|
select count(1) > 0 from crm_quote_info t
|
|
<where>
|
|
<if test="ew != null and ew.sqlSegment != null and ew.sqlSegment != ''">
|
|
AND ${ew.sqlSegment}
|
|
</if>
|
|
</where>
|
|
</select>
|
|
|
|
|
|
</mapper>
|