|
@@ -394,80 +394,83 @@
|
|
( SELECT count(*) FROM major_production WHERE deleted = 0 AND repertory_state = 0 ) AS inWarehouseCount
|
|
( SELECT count(*) FROM major_production WHERE deleted = 0 AND repertory_state = 0 ) AS inWarehouseCount
|
|
</select>
|
|
</select>
|
|
|
|
|
|
- <select id="xPage" parameterType="com.dayou.vo.MajorVO" 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 (
|
|
|
|
|
|
+ <sql id="majorPageSql">
|
|
SELECT
|
|
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
|
|
|
|
|
|
+ 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
|
|
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 = 'PENDING'
|
|
|
|
- ) 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
|
|
|
|
|
|
+ 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 = 'PENDING'
|
|
|
|
+ ) 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
|
|
WHERE
|
|
- m.deleted = 0
|
|
|
|
|
|
+ m.deleted = 0
|
|
|
|
+ </sql>
|
|
|
|
|
|
|
|
+ <select id="xPage" parameterType="com.dayou.vo.MajorVO" resultType="com.dayou.vo.MajorVO">
|
|
|
|
+ <include refid="majorPageSql" />
|
|
<if test="keyword!=null and keyword!='' ">
|
|
<if test="keyword!=null and keyword!='' ">
|
|
and (
|
|
and (
|
|
m.name like concat ('%',#{keyword},'%')
|
|
m.name like concat ('%',#{keyword},'%')
|
|
@@ -511,27 +514,169 @@
|
|
<if test="major!=null and major.principalId!=null ">
|
|
<if test="major!=null and major.principalId!=null ">
|
|
and m.principal_id = #{major.principalId}
|
|
and m.principal_id = #{major.principalId}
|
|
</if>
|
|
</if>
|
|
|
|
+ <if test="major!=null and major.departmentId!=null ">
|
|
|
|
+ and m.department_id = #{major.departmentId}
|
|
|
|
+ </if>
|
|
<if test="major!=null and major.businessObjectType!=null and major.businessObjectType!=''">
|
|
<if test="major!=null and major.businessObjectType!=null and major.businessObjectType!=''">
|
|
and m.business_object_type = #{major.businessObjectType}
|
|
and m.business_object_type = #{major.businessObjectType}
|
|
</if>
|
|
</if>
|
|
|
|
+ <if test="major!=null and major.userIds!=null and major.userIds.size!=0">
|
|
|
|
+ and (
|
|
|
|
+ m.principal_id in
|
|
|
|
+ <foreach collection="major.userIds" open="(" close=")" separator="," item="userId">#{userId}
|
|
|
|
+ </foreach>
|
|
|
|
+ or
|
|
|
|
+ m.client_manager_id in
|
|
|
|
+ <foreach collection="
|
|
|
|
+ major.userIds" open="(" close=")" separator="," item="userId">#{userId}
|
|
|
|
+ </foreach>
|
|
|
|
+ or JSON_CONTAINS(
|
|
|
|
+ JSON_EXTRACT(m.members, '$[*]'),CAST(#{currentUserId} AS CHAR))
|
|
|
|
+ )
|
|
|
|
+ </if>
|
|
|
|
+ order by wfni.currentNodeId DESC
|
|
|
|
+ </select>
|
|
|
|
+
|
|
|
|
+ <select id="pgLeaderPage" parameterType="com.dayou.vo.MajorVO" resultType="com.dayou.vo.MajorVO">
|
|
|
|
+ <include refid="majorPageSql" />
|
|
|
|
+ <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.nodeId!=null">
|
|
|
|
+ and wfni.node_id = #{major.nodeId}
|
|
|
|
+ </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.principalId!=null ">
|
|
|
|
+ and m.principal_id = #{major.principalId}
|
|
|
|
+ </if>
|
|
<if test="major!=null and major.departmentId!=null ">
|
|
<if test="major!=null and major.departmentId!=null ">
|
|
and m.department_id = #{major.departmentId}
|
|
and m.department_id = #{major.departmentId}
|
|
</if>
|
|
</if>
|
|
- <if test="major!=null and major.userIds!=null and major.userIds.size!=0">
|
|
|
|
- and (
|
|
|
|
- m.principal_id in
|
|
|
|
- <foreach collection="major.userIds" open="(" close=")" separator="," item="userId">
|
|
|
|
- #{userId}
|
|
|
|
- </foreach>
|
|
|
|
- or
|
|
|
|
- m.client_manager_id in
|
|
|
|
- <foreach collection="major.userIds" open="(" close=")" separator="," item="userId">
|
|
|
|
- #{userId}
|
|
|
|
- </foreach>
|
|
|
|
- or JSON_CONTAINS(JSON_EXTRACT(m.members, '$[*]'),CAST(#{currentUserId} AS CHAR))
|
|
|
|
|
|
+ <if test="major!=null and major.businessObjectType!=null and major.businessObjectType!=''">
|
|
|
|
+ and m.business_object_type = #{major.businessObjectType}
|
|
|
|
+ </if>
|
|
|
|
+ order by wfni.currentNodeId DESC
|
|
|
|
+ </select>
|
|
|
|
|
|
|
|
+ <select id="scNonFinancePage" parameterType="com.dayou.vo.MajorVO" resultType="com.dayou.vo.MajorVO">
|
|
|
|
+ <include refid="majorPageSql" />
|
|
|
|
+ and m.financial = 0
|
|
|
|
+ <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>
|
|
|
|
+ <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.nodeId!=null">
|
|
|
|
+ and wfni.node_id = #{major.nodeId}
|
|
|
|
+ </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.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>
|
|
|
|
+ order by wfni.currentNodeId DESC
|
|
|
|
+ </select>
|
|
|
|
+
|
|
|
|
+ <select id="scFinancePage" parameterType="com.dayou.vo.MajorVO" resultType="com.dayou.vo.MajorVO">
|
|
|
|
+ <include refid="majorPageSql" />
|
|
|
|
+ and m.financial = 1
|
|
|
|
+ <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.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.nodeId!=null">
|
|
|
|
+ and wfni.node_id = #{major.nodeId}
|
|
|
|
+ </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.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>
|
|
order by wfni.currentNodeId DESC
|
|
order by wfni.currentNodeId DESC
|
|
</select>
|
|
</select>
|
|
|
|
|
|
@@ -617,4 +762,26 @@
|
|
left join customer_linkman cl2 on cl2.id = m.terminal_clientele_contact_id where m.id =#{id}
|
|
left join customer_linkman cl2 on cl2.id = m.terminal_clientele_contact_id where m.id =#{id}
|
|
|
|
|
|
</select>
|
|
</select>
|
|
|
|
+
|
|
|
|
+ <select id="getDepartmentOrderOverStock" parameterType="java.lang.Long" resultType="java.lang.Integer">
|
|
|
|
+ SELECT
|
|
|
|
+ count(*)
|
|
|
|
+ FROM
|
|
|
|
+ major
|
|
|
|
+ WHERE
|
|
|
|
+ id IN (
|
|
|
|
+ SELECT
|
|
|
|
+ business_id
|
|
|
|
+ FROM
|
|
|
|
+ work_flow_node_instance
|
|
|
|
+ WHERE
|
|
|
|
+ flow_id = 6
|
|
|
|
+ AND business_type = 'MAJOR_BUSINESS'
|
|
|
|
+ AND deleted = 0
|
|
|
|
+ AND state = 'PENDING'
|
|
|
|
+ AND node_id IN ( 55, 56, 57, 58, 59 ))
|
|
|
|
+ AND deleted = 0
|
|
|
|
+ AND allot_type = '轮单'
|
|
|
|
+ AND department_id = #{departmentId}
|
|
|
|
+ </select>
|
|
</mapper>
|
|
</mapper>
|