|
@@ -150,6 +150,131 @@
|
|
|
created DESC
|
|
|
</select>
|
|
|
|
|
|
+ <select id="getTerminatedPage" resultType="com.dayou.vo.MajorVO">
|
|
|
+ SELECT
|
|
|
+ wfni.currentNodeId AS id,
|
|
|
+ wfni.nodeName,
|
|
|
+ wfni.productionName,
|
|
|
+ wfni.business_sub_id AS statementNo,
|
|
|
+ wfni.business_min_id AS reportNo,
|
|
|
+ m.id AS majorId,
|
|
|
+ m.created,
|
|
|
+ m.NAME,
|
|
|
+ m.order_id,
|
|
|
+ m.financial,
|
|
|
+ m.allot_type,
|
|
|
+ m.client_manager_id,
|
|
|
+ u.NAME AS clientManager,
|
|
|
+ m.principal_id,
|
|
|
+ u1.NAME AS principal,
|
|
|
+ m.department_id,
|
|
|
+ d.NAME AS department,
|
|
|
+ m.business_object_type,
|
|
|
+ m.clientele_id,
|
|
|
+ m.clientele_contact_id,
|
|
|
+ m.clientele_id AS clientele,
|
|
|
+ m.clientele_contact_id AS clienteleContact,
|
|
|
+ cc1.NAME AS cClienteleName,
|
|
|
+ cc2.NAME AS cClienteleSubName,
|
|
|
+ cl1.NAME AS cClienteleContactName,
|
|
|
+ cl1.mobile AS cMobile,
|
|
|
+ wfni.client_name,
|
|
|
+ wfni.client_tel,
|
|
|
+ wfni.evaluate_amount,
|
|
|
+ wfni.OWNER,
|
|
|
+ wfni.HANDLER,
|
|
|
+ wfni.nodeCode,
|
|
|
+ wfni.currentNodeId
|
|
|
+ FROM
|
|
|
+ major m
|
|
|
+ LEFT JOIN user u ON u.id = m.client_manager_id
|
|
|
+ LEFT JOIN user u1 ON u1.id = m.principal_id
|
|
|
+ LEFT JOIN department d ON d.id = m.department_id
|
|
|
+ INNER JOIN (
|
|
|
+ SELECT
|
|
|
+ wf.id AS currentNodeId,
|
|
|
+ wf.node_id,
|
|
|
+ wf.business_id,
|
|
|
+ wf.business_sub_id,
|
|
|
+ wf.business_min_id,
|
|
|
+ wf.state,
|
|
|
+ wn.NAME AS nodeName,
|
|
|
+ mp.NAME AS productionName,
|
|
|
+ mp.client_name,
|
|
|
+ mp.client_tel,
|
|
|
+ mp.evaluate_amount,
|
|
|
+ mp.OWNER,
|
|
|
+ u.NAME AS HANDLER,
|
|
|
+ wn.CODE AS nodeCode,
|
|
|
+ mp.client_address
|
|
|
+ FROM
|
|
|
+ work_flow_node_instance wf
|
|
|
+ LEFT JOIN work_node wn ON wn.id = wf.node_id
|
|
|
+ LEFT JOIN ( SELECT report_no, major_id, NAME, client_name,client_address, client_tel, evaluate_amount, OWNER FROM major_production WHERE deleted = 0 ) mp ON ( mp.major_id = wf.business_id AND mp.report_no = ifnull( wf.business_min_id, wf.business_sub_id ) )
|
|
|
+ LEFT JOIN work_task_record wtr ON wtr.instance_id = wf.id
|
|
|
+ LEFT JOIN user u ON u.id = wtr.handler_id
|
|
|
+ WHERE
|
|
|
+ wf.business_type = 'MAJOR_BUSINESS'
|
|
|
+ AND wf.deleted = 0
|
|
|
+ AND wf.state = 'CLOSED'
|
|
|
+ ) wfni ON wfni.business_id = m.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_linkman cl1 ON cl1.id = m.clientele_contact_id
|
|
|
+ WHERE m.deleted = 0
|
|
|
+ AND (m.principal_id = #{currentUserId} OR m.client_manager_id = #{currentUserId})
|
|
|
+ <if test="keyword!=null and keyword!='' ">
|
|
|
+ and (
|
|
|
+ m.name like concat ('%',#{keyword},'%')
|
|
|
+ or m.order_id like concat('%',#{keyword},'%')
|
|
|
+ or u.name like concat('%',#{keyword},'%')
|
|
|
+ or u1.name like concat('%',#{keyword},'%')
|
|
|
+ or cc2.name like concat('%',#{keyword},'%')
|
|
|
+ or cc1.name like concat('%',#{keyword},'%')
|
|
|
+ or cl1.name like concat('%',#{keyword},'%')
|
|
|
+ or cl1.mobile like concat('%',#{keyword},'%')
|
|
|
+ or m.business_object_type like concat('%',#{keyword},'%')
|
|
|
+ or d.name like concat('%',#{keyword},'%')
|
|
|
+ or m.allot_type like concat('%',#{keyword},'%')
|
|
|
+ or wfni.client_name like concat('%',#{keyword},'%')
|
|
|
+ or wfni.productionName like concat('%',#{keyword},'%')
|
|
|
+ or wfni.business_sub_id like concat('%',#{keyword},'%')
|
|
|
+ or wfni.owner like concat('%',#{keyword},'%')
|
|
|
+ or wfni.business_min_id like concat('%',#{keyword},'%')
|
|
|
+ or wfni.client_address like concat('%',#{keyword},'%')
|
|
|
+ or wfni.productionName like concat('%',#{keyword},'%')
|
|
|
+ )
|
|
|
+ </if>
|
|
|
+ <if test="major!=null and major.financial!=null">
|
|
|
+ and m.financial = #{major.financial}
|
|
|
+ </if>
|
|
|
+ <if test="major!=null and major.startDate!=null and major.startDate!=''">
|
|
|
+ and m.created >= #{major.startDate}
|
|
|
+ </if>
|
|
|
+ <if test="major!=null and major.endDate!=null and major.endDate!=''">
|
|
|
+ and m.created <= #{major.endDate}
|
|
|
+ </if>
|
|
|
+ <if test="major!=null and major.nodeCode!=null and major.nodeCode!=''">
|
|
|
+ and wfni.nodeCode = #{major.nodeCode}
|
|
|
+ </if>
|
|
|
+ <if test="major!=null and major.clientName!=null and major.clientName!=''">
|
|
|
+ and wfni.client_name like concat('%',#{major.clientName},'%')
|
|
|
+ </if>
|
|
|
+ <if test="major!=null and major.clientManagerId!=null ">
|
|
|
+ and m.client_manager_id = #{major.clientManagerId}
|
|
|
+ </if>
|
|
|
+ <if test="major!=null and major.principalId!=null ">
|
|
|
+ and m.principal_id = #{major.principalId}
|
|
|
+ </if>
|
|
|
+ <if test="major!=null and major.businessObjectType!=null and major.businessObjectType!=''">
|
|
|
+ and m.business_object_type = #{major.businessObjectType}
|
|
|
+ </if>
|
|
|
+ <if test="major!=null and major.departmentId!=null ">
|
|
|
+ and m.department_id = #{major.departmentId}
|
|
|
+ </if>
|
|
|
+ order by wfni.currentNodeId DESC
|
|
|
+ </select>
|
|
|
+
|
|
|
<select id="selectProduction" parameterType="java.lang.Long" resultType="com.dayou.vo.MajorProductionVO">
|
|
|
select *,sum(amount) as realAmount from (SELECT
|
|
|
mp.id,
|