|
@@ -270,7 +270,9 @@
|
|
|
<result column="businessId" property="businessId" />
|
|
|
<result column="order_id" property="orderId" />
|
|
|
<result column="orderName" property="orderName" />
|
|
|
+ <result column="production" property="production" />
|
|
|
<result column="productionNo" property="productionNo" />
|
|
|
+ <result column="evaluate_amount" property="evaluateAmount" />
|
|
|
<result column="if_save_file" property="ifSaveFile" />
|
|
|
<result column="principal" property="principal" />
|
|
|
<result column="clientManager" property="clientManager" />
|
|
@@ -282,6 +284,10 @@
|
|
|
<result column="orderFundId" property="orderFundId" />
|
|
|
<result column="should_amount" property="shouldAmount" />
|
|
|
<result column="real_amount" property="realAmount" />
|
|
|
+ <result column="shouldAmount" property="shouldAmount" />
|
|
|
+ <result column="orderShouldAmount" property="orderShouldAmount" />
|
|
|
+ <result column="orderRealAmount" property="orderRealAmount" />
|
|
|
+ <result column="productionFundId" property="productionFundId" />
|
|
|
<result column="created" property="created" />
|
|
|
<result column="remark" property="remark" />
|
|
|
<result column="mDeclareResult" property="mDeclareResult" />
|
|
@@ -313,7 +319,9 @@
|
|
|
m.order_id,
|
|
|
m.name as orderName,
|
|
|
mp.report_no as productionNo,
|
|
|
+ mp.production,
|
|
|
mp.if_save_file,
|
|
|
+ mp.evaluate_amount,
|
|
|
u.name as principal,
|
|
|
u1.name as clientManager,
|
|
|
cc.name as clienteleName,
|
|
@@ -323,21 +331,26 @@
|
|
|
m.owner,
|
|
|
m.created,
|
|
|
orf.id as orderFundId,
|
|
|
- orf.should_amount,
|
|
|
- orf.real_amount,
|
|
|
- orf.remark,
|
|
|
+ orf.should_amount as orderShouldAmount,
|
|
|
+ orf.real_amount as orderRealAmount,
|
|
|
+ pf.remark,
|
|
|
+ pf.id as productionFundId,
|
|
|
+ pf.real_amount,
|
|
|
+ pf.production_should_amount as shouldAmount,
|
|
|
( SELECT declare_result FROM commission_declare WHERE business_id = m.id AND production_id IS NULL AND business_type = 'COMMISSION_DECLARE_MAJOR_MARKET' AND deleted = 0 ) as mDeclareResult,
|
|
|
( SELECT declare_result FROM commission_declare WHERE business_id = m.id AND production_id IS NULL AND business_type = 'COMMISSION_DECLARE_MAJOR_EVALUATE' AND deleted = 0 ) as eDeclareResult
|
|
|
FROM
|
|
|
major m
|
|
|
- left join major_production mp on mp.major_id = m.id
|
|
|
+ left join (select id,major_id,report_no,evaluate_amount,production,if_save_file from major_production where deleted = 0 ) mp on mp.major_id = m.id
|
|
|
left join user u on u.id = m.principal_id
|
|
|
left join user u1 on u1.id = m.client_manager_id
|
|
|
left join customer_company cc on cc.id = m.clientele_id
|
|
|
left join customer_company cc1 on cc1.id = m.clientele_sub_id
|
|
|
left join customer_linkman cl on cl.id = m.clientele_contact_id
|
|
|
left join (select * from order_fund where business_type ='MAJOR_BUSINESS' and deleted = 0) orf on orf.business_id = m.id
|
|
|
-</sql>
|
|
|
+ left join (select * from production_fund where business_type = 'MAJOR_BUSINESS' and deleted = 0) pf on (pf.business_id = m.id and pf.production_no = mp.report_no)
|
|
|
+
|
|
|
+ </sql>
|
|
|
|
|
|
<select id="myOrder" parameterType="com.dayou.vo.MajorOrderVO" resultMap="myOrderMap">
|
|
|
<include refid="myMajorOrder" />
|
|
@@ -357,6 +370,7 @@
|
|
|
or orf.should_amount like concat('%',#{keyword},'%')
|
|
|
or orf.real_amount like concat('%',#{keyword},'%')
|
|
|
or orf.remark like concat('%',#{keyword},'%')
|
|
|
+ or mp.report_no like concat('%',#{keyword},'%')
|
|
|
)
|
|
|
</if>
|
|
|
<if test="vo!=null and vo.principalId!=null and vo.principalId!=''">
|
|
@@ -380,6 +394,12 @@
|
|
|
<if test="vo!=null and vo.endDate!=null and vo.endDate!=''">
|
|
|
and m.created <= #{vo.endDate}
|
|
|
</if>
|
|
|
+ <if test="vo!=null and vo.production!=null and vo.production!='ORDER'">
|
|
|
+ AND mp.production = #{vo.production}
|
|
|
+ </if>
|
|
|
+ <if test="vo!=null and vo.production!=null and vo.production=='ORDER'">
|
|
|
+ AND mp.id is null
|
|
|
+ </if>
|
|
|
order by m.created DESC
|
|
|
</select>
|
|
|
|
|
@@ -439,11 +459,17 @@
|
|
|
mp.if_save_file,
|
|
|
mp.save_file_date,
|
|
|
mp.delivery,
|
|
|
- `of`.should_amount AS orderShouldAmount
|
|
|
+ `of`.should_amount AS orderShouldAmount,
|
|
|
+ pf.production_should_amount as shouldAmount,
|
|
|
+ m.order_id,
|
|
|
+ m.name as orderName,
|
|
|
+ m.id as businessId,
|
|
|
+ `of`.id as orderFundId
|
|
|
FROM
|
|
|
major_production mp
|
|
|
- LEFT JOIN ( SELECT id, business_id, production_no, real_amount, production_type FROM production_fund WHERE business_type = 'MAJOR_BUSINESS' AND deleted = 0 ) pf ON ( mp.major_id = pf.business_id AND mp.report_no = pf.production_no AND mp.production = pf.production_type )
|
|
|
- LEFT JOIN (SELECT business_id,should_amount FROM order_fund WHERE business_type = 'MAJOR_BUSINESS' AND deleted = 0) AS `of` ON mp.major_id = `of`.business_id
|
|
|
+ left join major m on m.id =mp.major_id
|
|
|
+ LEFT JOIN ( SELECT id, business_id, production_no, real_amount, production_type,production_should_amount FROM production_fund WHERE business_type = 'MAJOR_BUSINESS' AND deleted = 0 ) pf ON ( mp.major_id = pf.business_id AND mp.report_no = pf.production_no AND mp.production = pf.production_type )
|
|
|
+ LEFT JOIN (SELECT id,business_id,should_amount FROM order_fund WHERE business_type = 'MAJOR_BUSINESS' AND deleted = 0) AS `of` ON mp.major_id = `of`.business_id
|
|
|
WHERE
|
|
|
mp.major_id = #{majorId} and mp.deleted = 0
|
|
|
|
|
@@ -588,10 +614,10 @@
|
|
|
u1.NAME AS clientManager,
|
|
|
cc.NAME AS clienteleName,
|
|
|
orf.id AS orderFundId,
|
|
|
- orf.should_amount,
|
|
|
+ orf.should_amount as orderShouldAmount,
|
|
|
+ off.production_should_amount as shouldAmount,
|
|
|
off.id as productionFundId,
|
|
|
off.real_amount,
|
|
|
- off.standard_amount,
|
|
|
ifnull(( SELECT declare_result FROM commission_declare WHERE business_id = m.id AND production_id = mp.id AND business_type = 'COMMISSION_DECLARE_MAJOR_MARKET' AND deleted = 0 ),
|
|
|
( SELECT declare_result FROM commission_declare WHERE business_id = m.id and production_id is null AND business_type = 'COMMISSION_DECLARE_MAJOR_MARKET' AND deleted = 0 )) as mDeclareResult,
|
|
|
ifnull(( SELECT declare_result FROM commission_declare WHERE business_id = m.id AND production_id = mp.id AND business_type = 'COMMISSION_DECLARE_MAJOR_EVALUATE' AND deleted = 0 ),
|