|
@@ -104,68 +104,76 @@
|
|
WHERE
|
|
WHERE
|
|
id IN ( SELECT post_id FROM user_post WHERE user_id = u.id ))) AS marketDepartment
|
|
id IN ( SELECT post_id FROM user_post WHERE user_id = u.id ))) AS marketDepartment
|
|
FROM
|
|
FROM
|
|
-
|
|
|
|
- finance_claim fc inner join
|
|
|
|
- (
|
|
|
|
|
|
+ finance_claim fc
|
|
|
|
+ INNER JOIN (
|
|
SELECT
|
|
SELECT
|
|
p.order_fund_id oId,
|
|
p.order_fund_id oId,
|
|
p.id AS pId,
|
|
p.id AS pId,
|
|
p.business_id,
|
|
p.business_id,
|
|
-
|
|
|
|
p.production_no,
|
|
p.production_no,
|
|
- p.production_should_amount as shouldAmount
|
|
|
|
|
|
+ p.production_should_amount AS shouldAmount
|
|
FROM
|
|
FROM
|
|
production_fund p
|
|
production_fund p
|
|
WHERE
|
|
WHERE
|
|
p.business_type = 'MAJOR_BUSINESS'
|
|
p.business_type = 'MAJOR_BUSINESS'
|
|
- and p.real_amount is not null
|
|
|
|
- AND p.deleted = 0
|
|
|
|
- ) f
|
|
|
|
- ON
|
|
|
|
-
|
|
|
|
- ( fc.order_fund_id = f.oId and fc.production_fund_id = f.pId)
|
|
|
|
|
|
|
|
|
|
+ AND p.deleted = 0
|
|
|
|
+ ) f ON ( fc.order_fund_id = f.oId AND fc.production_fund_id = f.pId )
|
|
LEFT JOIN major m ON f.business_id = m.id
|
|
LEFT JOIN major m ON f.business_id = m.id
|
|
|
|
+
|
|
|
|
+ LEFT JOIN finance_real_fund frf ON frf.id = fc.real_fund_id
|
|
|
|
+ LEFT JOIN (
|
|
|
|
+ SELECT
|
|
|
|
+ mpp.major_id,
|
|
|
|
+ mpp.report_no,
|
|
|
|
+ mpp.production,
|
|
|
|
+ mpp.evaluate_amount,
|
|
|
|
+ mpp.if_save_file,
|
|
|
|
+ mpp.NAME
|
|
|
|
+ FROM
|
|
|
|
+ major_production mpp
|
|
|
|
+ LEFT JOIN ( SELECT production_no, production_type, real_amount FROM production_fund WHERE business_type = 'MAJOR_BUSINESS' AND deleted = 0 ) ppf ON ( mpp.report_no = ppf.production_no AND mpp.production = ppf.production_type )
|
|
|
|
+ WHERE
|
|
|
|
+ ppf.real_amount IS NOT NULL
|
|
|
|
+ ) mp ON ( mp.major_id = m.id AND mp.report_no = f.production_no )
|
|
|
|
+ LEFT JOIN user u2 ON u2.id = fc.claim_user_id
|
|
LEFT JOIN user u ON u.id = m.client_manager_id
|
|
LEFT JOIN user u ON u.id = m.client_manager_id
|
|
LEFT JOIN user u1 ON u1.id = m.principal_id
|
|
LEFT JOIN user u1 ON u1.id = m.principal_id
|
|
LEFT JOIN department d ON d.id = m.department_id
|
|
LEFT JOIN department d ON d.id = m.department_id
|
|
LEFT JOIN customer_company cc1 ON cc1.id = m.clientele_id
|
|
LEFT JOIN customer_company cc1 ON cc1.id = m.clientele_id
|
|
LEFT JOIN customer_company cc2 ON cc2.id = m.clientele_sub_id
|
|
LEFT JOIN customer_company cc2 ON cc2.id = m.clientele_sub_id
|
|
LEFT JOIN customer_linkman cl1 ON cl1.id = m.clientele_contact_id
|
|
LEFT JOIN customer_linkman cl1 ON cl1.id = m.clientele_contact_id
|
|
- LEFT JOIN finance_real_fund frf ON frf.id = fc.real_fund_id
|
|
|
|
- LEFT JOIN ( SELECT mpp.major_id, mpp.report_no,mpp.production, mpp.evaluate_amount, mpp.if_save_file, mpp.NAME FROM major_production
|
|
|
|
- mpp left join ( select production_no , production_type,real_amount from production_fund where business_type = 'MAJOR_BUSINESS' and deleted = 0) ppf
|
|
|
|
- on (mpp.report_no = ppf.production_no and mpp.production = ppf.production_type)
|
|
|
|
- WHERE ppf.real_amount is not null ) mp ON ( mp.major_id = m.id AND mp.report_no = f.production_no )
|
|
|
|
- LEFT JOIN user u2 ON u2.id = fc.claim_user_id
|
|
|
|
- <if test="keyword!=null and keyword!='' ">
|
|
|
|
- and (
|
|
|
|
- f.order_id like concat ('%',#{keyword},'%')
|
|
|
|
- or f.production_no like concat ('%',#{keyword},'%')
|
|
|
|
- or u1.name like concat ('%',#{keyword},'%')
|
|
|
|
- or fc.claim_amount = #{keyword}
|
|
|
|
- or u2.NAME like concat ('%',#{keyword},'%')
|
|
|
|
- )
|
|
|
|
- </if>
|
|
|
|
|
|
+ <where>
|
|
|
|
+ <if test="keyword!=null and keyword!='' ">
|
|
|
|
+ and (
|
|
|
|
+ m.order_id like concat ('%',#{keyword},'%')
|
|
|
|
+ or f.production_no like concat ('%',#{keyword},'%')
|
|
|
|
+ or u1.name like concat ('%',#{keyword},'%')
|
|
|
|
+ or fc.claim_amount = #{keyword}
|
|
|
|
+ or u2.NAME like concat ('%',#{keyword},'%')
|
|
|
|
+ )
|
|
|
|
+ </if>
|
|
|
|
+
|
|
|
|
+ <if test="majorStat!=null and majorStat.startDate!=null and majorStat.startDate!='' ">
|
|
|
|
+ and fc.claim_datetime >= #{majorStat.startDate}
|
|
|
|
+ </if>
|
|
|
|
+ <if test="majorStat!=null and majorStat.endDate!=null and majorStat.endDate!='' ">
|
|
|
|
+ and fc.claim_datetime <= #{majorStat.endDate}
|
|
|
|
+ </if>
|
|
|
|
+ <if test="majorStat!=null and majorStat.payStartDate!=null and majorStat.payStartDate!='' ">
|
|
|
|
+ and frf.pay_datetime >= #{majorStat.payStartDate}
|
|
|
|
+ </if>
|
|
|
|
+ <if test="majorStat!=null and majorStat.payEndDate!=null and majorStat.payEndDate!='' ">
|
|
|
|
+ and frf.pay_datetime <= #{majorStat.payEndDate}
|
|
|
|
+ </if>
|
|
|
|
+ <if test="majorStat!=null and majorStat.ifSaveFile!=null ">
|
|
|
|
+ and mp.if_save_file = #{majorStat.ifSaveFile}
|
|
|
|
+ </if>
|
|
|
|
+ <if test="majorStat!=null and majorStat.financial!=null ">
|
|
|
|
+ and m.financial = #{majorStat.financial}
|
|
|
|
+ </if>
|
|
|
|
+ </where>
|
|
|
|
|
|
- <if test="majorStat!=null and majorStat.startDate!=null and majorStat.startDate!='' ">
|
|
|
|
- and fc.claim_datetime >= #{majorStat.startDate}
|
|
|
|
- </if>
|
|
|
|
- <if test="majorStat!=null and majorStat.endDate!=null and majorStat.endDate!='' ">
|
|
|
|
- and fc.claim_datetime <= #{majorStat.endDate}
|
|
|
|
- </if>
|
|
|
|
- <if test="majorStat!=null and majorStat.payStartDate!=null and majorStat.payStartDate!='' ">
|
|
|
|
- and frf.pay_datetime >= #{majorStat.payStartDate}
|
|
|
|
- </if>
|
|
|
|
- <if test="majorStat!=null and majorStat.payEndDate!=null and majorStat.payEndDate!='' ">
|
|
|
|
- and frf.pay_datetime <= #{majorStat.payEndDate}
|
|
|
|
- </if>
|
|
|
|
- <if test="majorStat!=null and majorStat.ifSaveFile!=null ">
|
|
|
|
- and mp.if_save_file = #{majorStat.ifSaveFile}
|
|
|
|
- </if>
|
|
|
|
- <if test="majorStat!=null and majorStat.financial!=null ">
|
|
|
|
- and m.financial = #{majorStat.financial}
|
|
|
|
- </if>
|
|
|
|
</sql>
|
|
</sql>
|
|
<select id="majorStat" parameterType="com.dayou.vo.RealFundMajorStatVO" resultType="com.dayou.vo.RealFundMajorStatVO">
|
|
<select id="majorStat" parameterType="com.dayou.vo.RealFundMajorStatVO" resultType="com.dayou.vo.RealFundMajorStatVO">
|
|
<include refid="majorStatQuery" />
|
|
<include refid="majorStatQuery" />
|