|
@@ -414,7 +414,7 @@
|
|
|
order by bus.created DESC ,bus.orderCreated DESC
|
|
|
</select>
|
|
|
|
|
|
- <!--获取资产评估人员提成申报列表-->
|
|
|
+ <!--获取资产市场人员提成申报列表-->
|
|
|
<select id="assetsMarketDeclarePage" resultType="com.dayou.vo.CommissionDeclareVO">
|
|
|
SELECT
|
|
|
bus.*,
|
|
@@ -504,66 +504,124 @@
|
|
|
order by bus.created DESC ,bus.orderCreated DESC
|
|
|
</select>
|
|
|
|
|
|
- <!--资产待办绩效申报列表-->
|
|
|
- <select id="assetsTodoCheckPage" resultType="com.dayou.vo.CommissionDeclareTodoCheckVO">
|
|
|
+ <!--资产绩效提成申报待办result-->
|
|
|
+ <resultMap id="assetsDeclareTodoCheckMap" type="com.dayou.vo.CommissionDeclareTodoCheckVO">
|
|
|
+ <id property="id" column="id"></id>
|
|
|
+ <result property="taskId" column="taskId"></result>
|
|
|
+ <result property="currentNodeId" column="currentNodeId"></result>
|
|
|
+ <result property="businessId" column="business_id"></result>
|
|
|
+ <result property="businessType" column="business_type"></result>
|
|
|
+ <result property="orderName" column="orderName"></result>
|
|
|
+ <result property="name" column="name"></result>
|
|
|
+ <result property="reportNo" column="report_no"></result>
|
|
|
+ <result property="orderId" column="order_id"></result>
|
|
|
+ <result property="nodeName" column="nodeName"></result>
|
|
|
+ <result property="nodeCode" column="nodeCode"></result>
|
|
|
+ <result property="handler" column="handler"></result>
|
|
|
+ <result property="declareUser" column="declareUser"></result>
|
|
|
+ <result property="businessCate" column="businessCate"></result>
|
|
|
+ <result property="userType" column="userType"></result>
|
|
|
+ <result property="ratio" column="ratio"></result>
|
|
|
+ <result property="created" column="created"></result>
|
|
|
+ <result property="prodId" column="prodId"></result>
|
|
|
+ <result property="assetsId" column="assetsId"></result>
|
|
|
+ <association property="assetsSimple" column="{assetsId=assetsId,prodId=prodId}" javaType="com.dayou.dto.AssetsDeclareSimpleDTO"
|
|
|
+ select="selectAssetsSimple" ></association>
|
|
|
+ </resultMap>
|
|
|
+
|
|
|
+ <!--查询资产绩效提成申报流程信息-->
|
|
|
+ <sql id="getAssetsTodoCheck">
|
|
|
SELECT
|
|
|
- wfni.id,
|
|
|
- wtr.id AS taskId,
|
|
|
- wfni.id AS currentNodeId,
|
|
|
- wfni.business_id,
|
|
|
- wfni.business_type,
|
|
|
- assetsInfo.orderName,
|
|
|
- assetsInfo.assets_name,
|
|
|
- assetsInfo.reportNo,
|
|
|
- assetsInfo.order_id,
|
|
|
- wfni.NAME AS nodeName,
|
|
|
- wfni.CODE AS nodeCode,
|
|
|
+ t.*,
|
|
|
u.NAME AS handler,
|
|
|
- u1.name as declareUser,
|
|
|
- dd.name as businessCate,
|
|
|
- (case bcr.user_type when 'MARKETER' then '市场人员' when 'EVALUATOR' then '评估人员' else '--' end) as userType,
|
|
|
- bcr.min_ratio as ratio,
|
|
|
- cd.created,
|
|
|
- assetsInfo.prodId
|
|
|
+ u1.NAME AS declareUser,
|
|
|
+ dd.NAME AS businessCate,
|
|
|
+ ( CASE bcr.user_type WHEN 'MARKETER' THEN '市场人员' WHEN 'EVALUATOR' THEN '评估人员' ELSE '--' END ) AS userType,
|
|
|
+ bcr.min_ratio AS ratio
|
|
|
FROM
|
|
|
- work_task_record wtr
|
|
|
- INNER JOIN (
|
|
|
+ (
|
|
|
SELECT
|
|
|
- wn.NAME,
|
|
|
- wn.CODE,
|
|
|
wfni.id,
|
|
|
+ wtr.id AS taskId,
|
|
|
+ wfni.id AS currentNodeId,
|
|
|
wfni.business_id,
|
|
|
- wfni.state,
|
|
|
- wfni.business_type
|
|
|
+ wfni.business_type,
|
|
|
+ wfni.NAME AS nodeName,
|
|
|
+ wfni.CODE AS nodeCode,
|
|
|
+ cd.assetsId,
|
|
|
+ cd.production_id as prodId,
|
|
|
+ cd.id AS cId,
|
|
|
+ wtr.handler_id,
|
|
|
+ cd.commission_rate_id,
|
|
|
+ cd.declare_user_id,
|
|
|
+ cd.created
|
|
|
FROM
|
|
|
- work_flow_node_instance wfni
|
|
|
- LEFT JOIN work_node wn ON wn.id = wfni.node_id
|
|
|
+ work_task_record wtr
|
|
|
+ INNER JOIN (
|
|
|
+ SELECT
|
|
|
+ wn.NAME,
|
|
|
+ wn.CODE,
|
|
|
+ wfni.id,
|
|
|
+ wfni.business_id,
|
|
|
+ wfni.state,
|
|
|
+ wfni.business_type
|
|
|
+ FROM
|
|
|
+ work_flow_node_instance wfni
|
|
|
+ LEFT JOIN work_node wn ON wn.id = wfni.node_id
|
|
|
+ WHERE
|
|
|
+ wfni.business_type IN ( 'COMMISSION_DECLARE_ASSET_MARKET', 'COMMISSION_DECLARE_ASSET_EVALUATE' )
|
|
|
+ AND wfni.state = 'PENDING'
|
|
|
+ AND wfni.deleted = 0
|
|
|
+ AND wn.deleted = 0
|
|
|
+ ) wfni ON wtr.instance_id = wfni.id
|
|
|
+ INNER JOIN (
|
|
|
+ SELECT id, production_id, business_id AS assetsId, commission_rate_id, declare_result, declare_user_id, created
|
|
|
+ FROM commission_declare
|
|
|
+ WHERE deleted = 0 AND declare_result = '审核中'
|
|
|
+ ) cd ON cd.id = wfni.business_id
|
|
|
WHERE
|
|
|
- wfni.business_type IN ( 'COMMISSION_DECLARE_ASSET_MARKET', 'COMMISSION_DECLARE_ASSET_EVALUATE' )
|
|
|
- AND wfni.state = 'PENDING'
|
|
|
- AND wfni.deleted = 0
|
|
|
- AND wn.deleted = 0
|
|
|
- ) wfni ON wtr.instance_id = wfni.id
|
|
|
- INNER JOIN ( SELECT id, ifnull( production_id, business_id ) AS xId, commission_rate_id, declare_result, declare_user_id,created FROM commission_declare WHERE deleted = 0 ) cd ON cd.id = wfni.business_id
|
|
|
- LEFT JOIN (
|
|
|
- SELECT
|
|
|
- ifnull( ap.id, assets.id ) AS aId,
|
|
|
- assets.NAME AS orderName,
|
|
|
- assets.order_id,
|
|
|
- ap.assets_name,
|
|
|
- ap.production_no AS reportNo ,
|
|
|
- ap.id as prodId
|
|
|
- FROM
|
|
|
- assets
|
|
|
- LEFT JOIN ( SELECT id, assets_name, business_id, production_no FROM assets_production WHERE deleted = 0 ) ap ON assets.id = ap.business_id
|
|
|
- ) assetsInfo ON assetsInfo.aId = cd.xId
|
|
|
- LEFT JOIN user u ON u.id = wtr.handler_id
|
|
|
- left join business_commission_rate bcr on bcr.id = cd.commission_rate_id
|
|
|
- left join dict_data dd on dd.id = bcr.business_cate_id
|
|
|
- left join user u1 on u1.id = cd.declare_user_id
|
|
|
- WHERE
|
|
|
- wtr.handler_id = #{checkVO.handlerId}
|
|
|
- AND u.deleted = 0
|
|
|
- AND wtr.deleted = 0
|
|
|
+ wtr.handler_id = #{checkVO.handlerId}
|
|
|
+ ) t
|
|
|
+ LEFT JOIN user u ON u.id = t.handler_id
|
|
|
+ LEFT JOIN business_commission_rate bcr ON bcr.id = t.commission_rate_id
|
|
|
+ LEFT JOIN dict_data dd ON dd.id = bcr.business_cate_id
|
|
|
+ LEFT JOIN user u1 ON u1.id = t.declare_user_id
|
|
|
+ </sql>
|
|
|
+
|
|
|
+ <!--查询资产绩效提成申报关联项目信息-->
|
|
|
+ <select id="selectAssetsSimple" resultType="com.dayou.dto.AssetsDeclareSimpleDTO">
|
|
|
+ <if test="assetsId!=null and prodId!=null">
|
|
|
+ SELECT
|
|
|
+ assets.id as assetsId,
|
|
|
+ assets.NAME AS orderName,
|
|
|
+ assets.order_id as orderId,
|
|
|
+ ap.production_no as reportNo,
|
|
|
+ ap.id as prodId
|
|
|
+ FROM
|
|
|
+ assets
|
|
|
+ LEFT JOIN ( SELECT id, business_id, production_no FROM assets_production WHERE deleted = 0 ) ap ON
|
|
|
+ assets.id = ap.business_id
|
|
|
+ where assets.id = #{assetsId} and ap.id= #{prodId}
|
|
|
+ </if>
|
|
|
+ <if test="assetsId!=null and prodId==null">
|
|
|
+ SELECT
|
|
|
+ assets.id as assetsId,
|
|
|
+ assets.NAME AS orderName,
|
|
|
+ assets.order_id as orderId
|
|
|
+ FROM
|
|
|
+ assets
|
|
|
+ where assets.id = #{assetsId}
|
|
|
+ </if>
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <!--资产待办绩效申报列表-->
|
|
|
+ <select id="assetsTodoCheckPage" resultType="com.dayou.vo.CommissionDeclareTodoCheckVO" resultMap="assetsDeclareTodoCheckMap">
|
|
|
+ <include refid="getAssetsTodoCheck" />
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <!--资产待办绩效申报集合-->
|
|
|
+ <select id="assetsTodoCheckList" resultType="com.dayou.vo.CommissionDeclareTodoCheckVO" resultMap="assetsDeclareTodoCheckMap">
|
|
|
+ <include refid="getAssetsTodoCheck" />
|
|
|
+ LIMIT 8
|
|
|
</select>
|
|
|
</mapper>
|