|
|
|
|
@ -294,6 +294,179 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
|
|
</foreach>
|
|
|
|
|
)
|
|
|
|
|
</select>
|
|
|
|
|
<select id="listLog" resultType="com.ruoyi.sip.domain.ProjectOrderInfo">
|
|
|
|
|
select t1.id, t1.project_id,t1.province, t1.city, t1.business_person, t1.business_email, t1.business_phone, t1.order_code, t1.currencyType,
|
|
|
|
|
t1.shipment_amount, t1.actual_purchase_amount, t1.order_end_time, t1.delivery_time, t1.company_delivery, t1.notifier,
|
|
|
|
|
t1.notifier_email, t1.notifier_phone, t1.duty, t1.duty_email, t1.duty_phone, t1.order_channel, t1.partner_code, t1.supplier,
|
|
|
|
|
t1.remark, t1.order_status, t1.create_by, t1.create_time, t1.update_by, t1.update_time,t1.partner_user_name,t1.partner_email
|
|
|
|
|
,t1.partner_phone,t1.version_code,t1.process_type,t1.process_template,t1.discount_fold,t1.notifier_address,t1.finance_status,
|
|
|
|
|
t1.delivery_status,t1.sign_status,t1.outer_status,t1.approve_time,t1.payment_method,t1.payment_ratio,t1.payment_description
|
|
|
|
|
,t2.project_code,t2.project_name,t2.province,t2.customer_name,t2.customer_code,t2.industry_type,t2.bg_property,t2.agent_code,t2.estimated_order_time
|
|
|
|
|
,t2.customer_phone,t2.customer_user_name,t2.agent_code,t2.customer_code,t2.partner_name project_partner_name
|
|
|
|
|
,t3.partner_name,t3.level,t3.system_user_id,t3.address partner_address
|
|
|
|
|
,t4.agent_name
|
|
|
|
|
,t5.user_name as duty_name
|
|
|
|
|
from project_order_info t1
|
|
|
|
|
left join project_info t2 on t1.project_id = t2.id
|
|
|
|
|
|
|
|
|
|
left join partner_info t3 on t1.partner_code=t3.partner_code
|
|
|
|
|
left join agent_info t4 on t2.agent_code=t4.agent_code
|
|
|
|
|
left join sys_user t5 on t1.duty=t5.user_id
|
|
|
|
|
inner join
|
|
|
|
|
(
|
|
|
|
|
SELECT
|
|
|
|
|
business_key,
|
|
|
|
|
max(btc.approve_time) todo_approve_time
|
|
|
|
|
FROM
|
|
|
|
|
bu_todo_completed btc
|
|
|
|
|
WHERE
|
|
|
|
|
btc.process_key IN ( 'order_approve_online', 'order_approve_offline' )
|
|
|
|
|
AND btc.approve_user = #{approveLog}
|
|
|
|
|
AND btc.task_name != '售前'
|
|
|
|
|
GROUP BY business_key
|
|
|
|
|
) t7 ON t7.business_key = t1.order_code
|
|
|
|
|
where 1=1
|
|
|
|
|
<if test="projectId != null ">and t1.project_id = #{projectId}</if>
|
|
|
|
|
<if test="projectCode != null and projectCode!='' ">and t2.project_code like
|
|
|
|
|
concat('%',#{projectCode},'%')
|
|
|
|
|
</if>
|
|
|
|
|
<if test="projectName != null and projectName!=''">and t2.project_name like concat('%',
|
|
|
|
|
#{projectName},'%')
|
|
|
|
|
</if>
|
|
|
|
|
<if test="customerName != null and customerName!=''">and t2.customer_name like
|
|
|
|
|
concat('%',#{customerName},'%')
|
|
|
|
|
</if>
|
|
|
|
|
<if test="agentName != null and agentName!=''">and t4.agent_name like concat('%',#{agentName},'%')</if>
|
|
|
|
|
<if test="financeStatus != null and financeStatus!=''">and t1.finance_status =#{financeStatus}</if>
|
|
|
|
|
<if test="province != null and province != ''">and t1.province = #{province}</if>
|
|
|
|
|
<if test="city != null and city != ''">and t1.city = #{city}</if>
|
|
|
|
|
<if test="businessPerson != null and businessPerson != ''">and t1.business_person = #{businessPerson}</if>
|
|
|
|
|
<if test="businessEmail != null and businessEmail != ''">and t1.business_email = #{businessEmail}</if>
|
|
|
|
|
<if test="businessPhone != null and businessPhone != ''">and t1.business_phone = #{businessPhone}</if>
|
|
|
|
|
<if test="orderCode != null and orderCode != ''">and t1.order_code = #{orderCode}</if>
|
|
|
|
|
<if test="currencyType != null and currencyType != ''">and t1.currencyType = #{currencyType}</if>
|
|
|
|
|
<if test="shipmentAmount != null ">and t1.shipment_amount = #{shipmentAmount}</if>
|
|
|
|
|
<if test="actualPurchaseAmount != null ">and t1.actual_purchase_amount = #{actualPurchaseAmount}</if>
|
|
|
|
|
<if test="orderEndTime != null ">and t1.order_end_time = #{orderEndTime}</if>
|
|
|
|
|
<if test="deliveryTime != null ">and t1.delivery_time = #{deliveryTime}</if>
|
|
|
|
|
<if test="companyDelivery != null and companyDelivery != ''">and t1.company_delivery = #{companyDelivery}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="notifier != null and notifier != ''">and t1.notifier = #{notifier}</if>
|
|
|
|
|
<if test="notifierEmail != null and notifierEmail != ''">and t1.notifier_email = #{notifierEmail}</if>
|
|
|
|
|
<if test="notifierPhone != null and notifierPhone != ''">and t1.notifier_phone = #{notifierPhone}</if>
|
|
|
|
|
<if test="notifierAddress != null and notifierAddress != ''">and t1.notifier_address = #{notifierAddress}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="duty != null and duty != ''">and t1.duty = #{duty}</if>
|
|
|
|
|
<if test="dutyName != null and dutyName != ''">and t5.user_name like concat('%', #{dutyName}, '%')</if>
|
|
|
|
|
<if test="dutyEmail != null and dutyEmail != ''">and t1.duty_email = #{dutyEmail}</if>
|
|
|
|
|
<if test="dutyPhone != null and dutyPhone != ''">and t1.duty_phone = #{dutyPhone}</if>
|
|
|
|
|
<if test="orderChannel != null and orderChannel != ''">and t1.order_channel = #{orderChannel}</if>
|
|
|
|
|
<if test="partnerCode != null and partnerCode != ''">and t1.partner_code = #{partnerCode}</if>
|
|
|
|
|
<if test="partnerName != null and partnerName != ''">and t3.partner_name like concat('%', #{partnerName},
|
|
|
|
|
'%')
|
|
|
|
|
</if>
|
|
|
|
|
<if test="supplier != null and supplier != ''">and t1.supplier = #{supplier}</if>
|
|
|
|
|
<if test="supplier != null and supplier != ''">and t1.supplier = #{supplier}</if>
|
|
|
|
|
<if test="orderStatus != null and orderStatus != ''">and t1.order_status = #{orderStatus}</if>
|
|
|
|
|
<if test="deliveryStatus != null and deliveryStatus != ''">and t1.delivery_status = #{deliveryStatus}</if>
|
|
|
|
|
<if test="outerStatus != null and outerStatus != ''">and t1.outer_status = #{outerStatus}</if>
|
|
|
|
|
<if test="signStatus != null and signStatus != ''">and t1.sign_status = #{signStatus}</if>
|
|
|
|
|
<if test="keyword != null and keyword != ''">and (t1.order_code like concat('%',#{keyword},'%') or
|
|
|
|
|
t2.project_name like concat('%',#{keyword},'%') or t2.customer_name like concat('%',#{keyword},'%'))
|
|
|
|
|
</if>
|
|
|
|
|
<if test="deliveryTimeStart != null or deliveryTimeEnd != null">
|
|
|
|
|
<choose>
|
|
|
|
|
<when test="deliveryTimeStart != null and deliveryTimeEnd != null">
|
|
|
|
|
and t1.delivery_time between date_format(#{deliveryTimeStart}, '%Y-%m-%d 00:00:00') and
|
|
|
|
|
date_format(#{deliveryTimeEnd}, '%Y-%m-%d 23:59:59')
|
|
|
|
|
</when>
|
|
|
|
|
<when test="deliveryTimeStart != null">
|
|
|
|
|
and t1.delivery_time <![CDATA[ >= ]]> date_format(#{deliveryTimeStart}, '%Y-%m-%d 00:00:00')
|
|
|
|
|
</when>
|
|
|
|
|
<when test="deliveryTimeEnd != null">
|
|
|
|
|
and t1.delivery_time <![CDATA[ <= ]]> date_format(#{deliveryTimeEnd}, '%Y-%m-%d 23:59:59')
|
|
|
|
|
</when>
|
|
|
|
|
|
|
|
|
|
</choose>
|
|
|
|
|
</if>
|
|
|
|
|
<if test="updateTimeStart != null or updateTimeEnd != null">
|
|
|
|
|
<choose>
|
|
|
|
|
<when test="updateTimeStart != null and updateTimeEnd != null">
|
|
|
|
|
and t1.update_time between date_format(#{updateTimeStart}, '%Y-%m-%d 00:00:00') and
|
|
|
|
|
date_format(#{updateTimeEnd}, '%Y-%m-%d 23:59:59')
|
|
|
|
|
</when>
|
|
|
|
|
<when test="updateTimeStart != null">
|
|
|
|
|
and t1.update_time <![CDATA[ >= ]]> date_format(#{updateTimeStart}, '%Y-%m-%d 00:00:00')
|
|
|
|
|
</when>
|
|
|
|
|
<when test="updateTimeEnd != null">
|
|
|
|
|
and t1.update_time <![CDATA[ <= ]]> date_format(#{updateTimeEnd}, '%Y-%m-%d 23:59:59')
|
|
|
|
|
</when>
|
|
|
|
|
|
|
|
|
|
</choose>
|
|
|
|
|
</if>
|
|
|
|
|
<if test="approveTimeStart != null or approveTimeEnd != null">
|
|
|
|
|
<choose>
|
|
|
|
|
<when test="approveTimeStart != null and approveTimeEnd != null">
|
|
|
|
|
and t1.approve_time between date_format(#{approveTimeStart}, '%Y-%m-%d 00:00:00') and
|
|
|
|
|
date_format(#{approveTimeEnd}, '%Y-%m-%d 23:59:59')
|
|
|
|
|
</when>
|
|
|
|
|
<when test="approveTimeStart != null">
|
|
|
|
|
and t1.approve_time <![CDATA[ >= ]]> date_format(#{approveTimeStart}, '%Y-%m-%d 00:00:00')
|
|
|
|
|
</when>
|
|
|
|
|
<when test="approveTimeEnd != null">
|
|
|
|
|
and t1.approve_time <![CDATA[ <= ]]> date_format(#{approveTimeEnd}, '%Y-%m-%d 23:59:59')
|
|
|
|
|
</when>
|
|
|
|
|
|
|
|
|
|
</choose>
|
|
|
|
|
</if>
|
|
|
|
|
<if test="estimatedOrderTimeStart != null or estimatedOrderTimeEnd != null">
|
|
|
|
|
<choose>
|
|
|
|
|
<when test="estimatedOrderTimeStart != null and estimatedOrderTimeEnd != null">
|
|
|
|
|
and t2.estimated_order_time between date_format(#{estimatedOrderTimeStart}, '%Y-%m-%d 00:00:00')
|
|
|
|
|
and date_format(#{estimatedOrderTimeEnd}, '%Y-%m-%d 23:59:59')
|
|
|
|
|
</when>
|
|
|
|
|
<when test="estimatedOrderTimeStart != null">
|
|
|
|
|
and t2.estimated_order_time <![CDATA[ >= ]]> date_format(#{estimatedOrderTimeStart}, '%Y-%m-%d
|
|
|
|
|
00:00:00')
|
|
|
|
|
</when>
|
|
|
|
|
<when test="estimatedOrderTimeEnd != null">
|
|
|
|
|
and t2.estimated_order_time <![CDATA[ <= ]]> date_format(#{estimatedOrderTimeEnd}, '%Y-%m-%d
|
|
|
|
|
23:59:59')
|
|
|
|
|
</when>
|
|
|
|
|
|
|
|
|
|
</choose>
|
|
|
|
|
</if>
|
|
|
|
|
<if test="orderEndTimeStart != null or orderEndTimeEnd != null">
|
|
|
|
|
<choose>
|
|
|
|
|
<when test="orderEndTimeStart != null and orderEndTimeEnd != null">
|
|
|
|
|
and t1.order_end_time between date_format(#{orderEndTimeStart}, '%Y-%m-%d 00:00:00') and
|
|
|
|
|
date_format(#{orderEndTimeEnd}, '%Y-%m-%d 23:59:59')
|
|
|
|
|
</when>
|
|
|
|
|
<when test="orderEndTimeStart != null">
|
|
|
|
|
and t1.order_end_time <![CDATA[ >= ]]> date_format(#{orderEndTimeStart}, '%Y-%m-%d 00:00:00')
|
|
|
|
|
</when>
|
|
|
|
|
<when test="orderEndTimeEnd != null">
|
|
|
|
|
and t1.order_end_time <![CDATA[ <= ]]> date_format(#{orderEndTimeEnd}, '%Y-%m-%d 23:59:59')
|
|
|
|
|
</when>
|
|
|
|
|
|
|
|
|
|
</choose>
|
|
|
|
|
</if>
|
|
|
|
|
<if test="approve!=null and approve!=''">and t1.order_code in (select business_key from bu_todo where
|
|
|
|
|
process_key in ('order_approve_online','order_approve_offline') and approve_user = #{approve} and
|
|
|
|
|
task_name != '售前')
|
|
|
|
|
</if>
|
|
|
|
|
|
|
|
|
|
<if test="productCodeList!=null and productCodeList.size>0">
|
|
|
|
|
and t1.project_id in (select distinct t2.project_id from project_product_info t2 where t2.product_bom_code
|
|
|
|
|
in
|
|
|
|
|
<foreach item="item" collection="productCodeList" separator="," open="(" close=")">
|
|
|
|
|
#{item}
|
|
|
|
|
</foreach>
|
|
|
|
|
)
|
|
|
|
|
</if>
|
|
|
|
|
${params.authSql}
|
|
|
|
|
${params.dataScope}
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<insert id="insertProjectOrderInfo" parameterType="ProjectOrderInfo" useGeneratedKeys="true" keyProperty="id">
|
|
|
|
|
|