UPDATE inspection_work_node
SET status = '0', deal_user_id = null, deal_user_name = null, deal_images = null, remark = null
WHERE id = #{id} AND inspection_info_id = #{inspectionInfoId}
UPDATE inspection_work_node
SET status = '0', deal_user_id = null, deal_user_name = null, deal_images = null, remark = null
WHERE id in (
#{item.id}
)
SELECT wn.*,ip.project_name AS projectName
FROM inspection_work_node wn
LEFT JOIN inspection_project ip ON ip.id = wn.project_id
WHERE wn.inspection_info_id = #{inspectionId}
ORDER BY wn.order_num ASC
SELECT
node.id AS node_id,
node.project_id,
proj.project_name AS projectName, -- Assuming there's a project name in the inspection project table
node.deal_user_name AS handlerName,
IFNULL(royalty.royalty_amount, 0) / 100 AS royaltyAmount,
node.update_time AS node_create_time,
node.update_time AS royalty_create_time
FROM
inspection_work_node AS node
LEFT JOIN
system_users AS users
ON node.deal_user_id = users.id
LEFT JOIN
inspection_project AS proj -- Assuming this is the table for project details
ON node.project_id = proj.id
LEFT JOIN
inspection_info AS info
ON node.inspection_info_id = info.id
LEFT JOIN
order_info orders
ON info.inspection_order_id = orders.id
LEFT JOIN
inspection_project_royalty AS royalty
ON node.project_id = royalty.project_id and orders.goods_id = royalty.goods_id
node.status = '2' AND info.status = '1'
AND node.create_time = #{inspectionWorkNode.createTime}
AND node.project_id = #{inspectionWorkNode.projectId}
AND node.deal_user_id = #{inspectionWorkNode.dealUserId}
AND node.deal_user_name LIKE CONCAT('%', #{inspectionWorkNode.dealUserName} , '%')
AND DATE_FORMAT(info.end_time, '%Y-%m') = #{inspectionWorkNode.rescueStartMonth}
AND info.end_time BETWEEN #{inspectionWorkNode.rescueStart} AND #{inspectionWorkNode.rescueEnd}
ORDER BY
info.end_time DESC;
SELECT
IFNULL(SUM(IFNULL(royalty.royalty_amount, 0) / 100 ),0)AS royaltyAmountSum
FROM
inspection_work_node AS node
LEFT JOIN
system_users AS users
ON node.deal_user_id = users.id
LEFT JOIN
inspection_project AS proj -- Assuming this is the table for project details
ON node.project_id = proj.id
LEFT JOIN
inspection_info AS info
ON node.inspection_info_id = info.id
LEFT JOIN
order_info orders
ON info.inspection_order_id = orders.id
LEFT JOIN
inspection_project_royalty AS royalty
ON node.project_id = royalty.project_id and orders.goods_id = royalty.goods_id
node.status = '2' AND info.status = '1'
AND node.create_time = #{inspectionWorkNode.createTime}
AND node.project_id = #{inspectionWorkNode.projectId}
AND node.deal_user_id = #{inspectionWorkNode.dealUserId}
AND node.deal_user_name LIKE CONCAT('%', #{inspectionWorkNode.dealUserName} , '%')
AND DATE_FORMAT(info.end_time, '%Y-%m') = #{inspectionWorkNode.rescueStartMonth}
AND info.end_time BETWEEN #{inspectionWorkNode.rescueStart} AND #{inspectionWorkNode.rescueEnd}
ORDER BY
node.create_time DESC;