2024-07-07 21:09:28 +08:00
|
|
|
<?xml version="1.0" encoding="UTF-8" ?>
|
|
|
|
|
<!DOCTYPE mapper
|
2025-02-15 10:45:23 +08:00
|
|
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
|
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
2024-07-07 21:09:28 +08:00
|
|
|
<mapper namespace="com.ruoyi.oa.mapper.SysOaProjectMapper">
|
|
|
|
|
|
|
|
|
|
<resultMap type="com.ruoyi.oa.domain.SysOaProject" id="SysOaProjectResult">
|
|
|
|
|
<result property="projectId" column="project_id"/>
|
|
|
|
|
<result property="projectName" column="project_name"/>
|
|
|
|
|
<result property="projectNum" column="project_num"/>
|
|
|
|
|
<result property="projectType" column="project_type"/>
|
|
|
|
|
<result property="address" column="address"/>
|
|
|
|
|
<result property="funds" column="funds"/>
|
|
|
|
|
<result property="functionary" column="functionary"/>
|
|
|
|
|
<result property="beginTime" column="begin_time"/>
|
|
|
|
|
<result property="finishTime" column="finish_time"/>
|
|
|
|
|
<result property="delivery" column="delivery"/>
|
|
|
|
|
<result property="guarantee" column="guarantee"/>
|
|
|
|
|
<result property="introduction" column="introduction"/>
|
|
|
|
|
<result property="projectGrade" column="project_grade"/>
|
|
|
|
|
<result property="projectStatus" column="project_status"/>
|
|
|
|
|
<result property="contractId" column="contract_id"/>
|
|
|
|
|
<result property="invoiceName" column="invoice_name"/>
|
|
|
|
|
<result property="invoiceNumber" column="invoice_number"/>
|
|
|
|
|
<result property="invoiceAddress" column="invoice_address"/>
|
|
|
|
|
<result property="invoiceBank" column="invoice_bank"/>
|
|
|
|
|
<result property="accessory" column="accessory"/>
|
|
|
|
|
<result property="bail" column="bail"/>
|
|
|
|
|
<result property="remark" column="remark"/>
|
|
|
|
|
<result property="createBy" column="create_by"/>
|
|
|
|
|
<result property="createTime" column="create_time"/>
|
|
|
|
|
<result property="updateBy" column="update_by"/>
|
|
|
|
|
<result property="updateTime" column="update_time"/>
|
|
|
|
|
</resultMap>
|
|
|
|
|
|
2024-11-16 20:08:00 +08:00
|
|
|
<resultMap type="com.ruoyi.oa.domain.vo.SysOaProjectVo" id="SysOaProjectVoResult">
|
|
|
|
|
<result property="projectId" column="project_id"/>
|
|
|
|
|
<result property="projectName" column="project_name"/>
|
|
|
|
|
<result property="projectNum" column="project_num"/>
|
|
|
|
|
<result property="projectType" column="project_type"/>
|
|
|
|
|
<result property="address" column="address"/>
|
|
|
|
|
<result property="funds" column="funds"/>
|
|
|
|
|
<result property="functionary" column="functionary"/>
|
|
|
|
|
<result property="beginTime" column="begin_time"/>
|
|
|
|
|
<result property="finishTime" column="finish_time"/>
|
|
|
|
|
<result property="delivery" column="delivery"/>
|
|
|
|
|
<result property="guarantee" column="guarantee"/>
|
|
|
|
|
<result property="introduction" column="introduction"/>
|
|
|
|
|
<result property="projectGrade" column="project_grade"/>
|
|
|
|
|
<result property="projectStatus" column="project_status"/>
|
|
|
|
|
<result property="contractId" column="contract_id"/>
|
|
|
|
|
<result property="invoiceName" column="invoice_name"/>
|
|
|
|
|
<result property="invoiceNumber" column="invoice_number"/>
|
|
|
|
|
<result property="invoiceAddress" column="invoice_address"/>
|
|
|
|
|
<result property="invoiceBank" column="invoice_bank"/>
|
|
|
|
|
<result property="accessory" column="accessory"/>
|
|
|
|
|
<result property="bail" column="bail"/>
|
|
|
|
|
<result property="remark" column="remark"/>
|
|
|
|
|
<result property="createBy" column="create_by"/>
|
|
|
|
|
<result property="createTime" column="create_time"/>
|
|
|
|
|
<result property="count" column="count"/>
|
2024-12-16 11:27:43 +08:00
|
|
|
<result property="laborCost" column="labor_cost"/>
|
|
|
|
|
|
2024-11-16 20:08:00 +08:00
|
|
|
</resultMap>
|
|
|
|
|
|
2024-07-07 21:09:28 +08:00
|
|
|
|
2024-11-06 14:50:00 +08:00
|
|
|
<resultMap type="com.ruoyi.oa.domain.vo.SysOaOutWarehouseListVo" id="SysOaOutWarehouseListVoResult">
|
|
|
|
|
<result property="projectId" column="project_id"/>
|
|
|
|
|
<result property="projectName" column="project_name"/>
|
|
|
|
|
<result property="projectName" column="create_time"/>
|
|
|
|
|
<association property="outWarehouseVoList" javaType="java.util.List" resultMap="outWarehouseResult"/>
|
|
|
|
|
</resultMap>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<resultMap type="com.ruoyi.oa.domain.vo.SysOaOutWarehouseVo" id="outWarehouseResult">
|
|
|
|
|
<result property="id" column="soow_id"/>
|
|
|
|
|
<result property="amount" column="amount"/>
|
|
|
|
|
<result property="warehouseId" column="warehouse_id"/>
|
|
|
|
|
<result property="warehouseName" column="name"/>
|
|
|
|
|
<result property="createTime" column="out_create_time"/>
|
|
|
|
|
</resultMap>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<select id="selectPageOutList" resultMap="SysOaOutWarehouseListVoResult">
|
2025-02-15 10:45:23 +08:00
|
|
|
select sop.project_id,
|
|
|
|
|
project_name,
|
|
|
|
|
soow.warehouse_id,
|
|
|
|
|
soow.id as soow_id,
|
|
|
|
|
soow.amount,
|
|
|
|
|
soow.create_time as out_create_time,
|
|
|
|
|
sow.name
|
2024-11-06 14:50:00 +08:00
|
|
|
from sys_oa_project sop
|
|
|
|
|
left join sys_oa_out_warehouse soow on soow.project_id = sop.project_id
|
|
|
|
|
left join sys_oa_warehouse sow on sow.id = soow.warehouse_id
|
|
|
|
|
${ew.getCustomSqlSegment}
|
|
|
|
|
</select>
|
|
|
|
|
|
2024-12-16 11:27:43 +08:00
|
|
|
<select id="getProjectDataByMonth" resultType="com.ruoyi.oa.domain.vo.SysOaProjectVo">
|
2025-02-15 10:45:23 +08:00
|
|
|
select sum(soa.day_length + soa.hour / 8) as labor_cost, color, sop.project_name
|
|
|
|
|
from sys_oa_project sop
|
|
|
|
|
left join sys_oa_attendance soa on sop.project_id = soa.project_id
|
2024-12-16 11:27:43 +08:00
|
|
|
where soa.create_time between #{firstDay} and #{lastDay}
|
2025-02-15 10:45:23 +08:00
|
|
|
and soa.del_flag = '0'
|
2024-12-16 11:27:43 +08:00
|
|
|
group by sop.project_id
|
|
|
|
|
</select>
|
2024-11-16 20:08:00 +08:00
|
|
|
|
2024-12-30 16:44:53 +08:00
|
|
|
<select id="getProjectDataByMonthAndDate" resultType="com.ruoyi.oa.domain.vo.SysOaProjectVo">
|
2025-02-15 10:45:23 +08:00
|
|
|
select sum(soa.day_length + soa.hour / 8) as labor_cost,
|
|
|
|
|
color,
|
|
|
|
|
sop.project_name,
|
|
|
|
|
date_format(soa.create_time, '%Y-%m-%d') as create_time
|
|
|
|
|
from sys_oa_project sop
|
|
|
|
|
left join sys_oa_attendance soa on sop.project_id = soa.project_id
|
2024-12-30 16:44:53 +08:00
|
|
|
where soa.create_time between #{firstDay} and #{lastDay}
|
|
|
|
|
and soa.del_flag = '0'
|
|
|
|
|
group by sop.project_id,create_time
|
|
|
|
|
</select>
|
2025-03-10 21:02:00 +08:00
|
|
|
<select id="selectListToCost" resultType="com.ruoyi.oa.domain.vo.SysOaCostAllVo">
|
|
|
|
|
SELECT
|
|
|
|
|
sop.project_name,sop.project_num,sop.project_id,
|
|
|
|
|
|
|
|
|
|
(
|
|
|
|
|
SELECT COALESCE(SUM(soc.cost),0)
|
|
|
|
|
FROM sys_oa_claim soc
|
|
|
|
|
WHERE soc.project_id = sop.project_id
|
|
|
|
|
) AS claimCost,
|
|
|
|
|
|
|
|
|
|
(
|
|
|
|
|
SELECT COALESCE(SUM(soow.amount * sow.price),0)
|
|
|
|
|
FROM sys_oa_out_warehouse soow
|
|
|
|
|
JOIN sys_oa_warehouse sow ON soow.id = sow.id
|
|
|
|
|
WHERE soow.project_id = sop.project_id
|
|
|
|
|
) AS materialCost,
|
|
|
|
|
|
|
|
|
|
(
|
|
|
|
|
SELECT COALESCE(ROUND(SUM((soa.day_length * 9 + soa.hour) / 9),1), 0)
|
|
|
|
|
FROM sys_oa_attendance soa
|
|
|
|
|
WHERE soa.project_id = sop.project_id
|
|
|
|
|
) AS peopleDay,
|
|
|
|
|
|
|
|
|
|
(
|
|
|
|
|
SELECT COALESCE(SUM(ROUND((soa.day_length * 9 + soa.hour) / 9, 1) * su.labor_cost),0)
|
|
|
|
|
FROM sys_oa_attendance soa
|
|
|
|
|
JOIN sys_user su ON soa.user_id = su.user_id
|
|
|
|
|
WHERE soa.project_id = sop.project_id
|
|
|
|
|
) AS userCost
|
|
|
|
|
FROM sys_oa_project sop
|
|
|
|
|
${ew.getCustomSqlSegment}
|
|
|
|
|
|
|
|
|
|
</select>
|
2024-12-30 16:44:53 +08:00
|
|
|
|
|
|
|
|
|
2025-03-13 00:03:59 +08:00
|
|
|
<select id="selectProjectDetails" parameterType="Long" resultType="java.util.Map">
|
|
|
|
|
SELECT
|
|
|
|
|
JSON_OBJECT(
|
|
|
|
|
'userCostList', COALESCE((
|
|
|
|
|
SELECT JSON_ARRAYAGG(
|
|
|
|
|
JSON_OBJECT(
|
|
|
|
|
'userId', CAST(uc.userId AS CHAR),
|
|
|
|
|
'nickName', COALESCE(uc.nickName, ''),
|
|
|
|
|
'laborCost', ROUND(COALESCE(uc.laborCost, 0),1),
|
|
|
|
|
'attendenceNum', ROUND(COALESCE(uc.attendenceNum, 0),1)
|
|
|
|
|
)
|
|
|
|
|
)
|
|
|
|
|
FROM (
|
|
|
|
|
SELECT
|
|
|
|
|
a.user_id AS userId,
|
|
|
|
|
u.nick_name AS nickName,
|
|
|
|
|
COALESCE(SUM(ROUND((a.day_length * 9 + a.hour) / 9,1) * u.labor_cost), 0) AS laborCost,
|
|
|
|
|
COALESCE(ROUND(SUM((a.day_length * 9 + a.hour) / 9),1), 0) AS attendenceNum
|
|
|
|
|
FROM sys_oa_attendance a
|
|
|
|
|
INNER JOIN sys_user u ON a.user_id = u.user_id
|
|
|
|
|
WHERE a.project_id = #{projectId} AND a.del_flag = 0
|
|
|
|
|
GROUP BY a.user_id
|
|
|
|
|
) uc
|
|
|
|
|
), JSON_ARRAY()),
|
|
|
|
|
|
|
|
|
|
'materialList', COALESCE((
|
|
|
|
|
SELECT JSON_ARRAYAGG(
|
|
|
|
|
JSON_OBJECT(
|
|
|
|
|
'materialId', CAST(ml.materialId AS CHAR),
|
|
|
|
|
'name', COALESCE(ml.name, ''),
|
|
|
|
|
'price', COALESCE(ml.price, 0),
|
|
|
|
|
'amount', COALESCE(ml.amount, 0)
|
|
|
|
|
)
|
|
|
|
|
)
|
|
|
|
|
FROM (
|
|
|
|
|
SELECT
|
|
|
|
|
ow.id AS materialId,
|
|
|
|
|
COALESCE(w.name, '') AS name,
|
|
|
|
|
COALESCE(w.price, 0) AS price,
|
|
|
|
|
COALESCE(ow.amount, 0) AS amount
|
|
|
|
|
FROM sys_oa_out_warehouse ow
|
|
|
|
|
INNER JOIN sys_oa_warehouse w ON ow.warehouse_id = w.id
|
|
|
|
|
WHERE ow.project_id = #{projectId} AND ow.del_flag = 0
|
|
|
|
|
) ml
|
|
|
|
|
), JSON_ARRAY()),
|
|
|
|
|
|
|
|
|
|
'claimList', COALESCE((
|
|
|
|
|
SELECT JSON_ARRAYAGG(
|
|
|
|
|
JSON_OBJECT(
|
|
|
|
|
'claimId', CAST(cl.claimId AS CHAR),
|
|
|
|
|
'nickName', COALESCE(cl.nickName, ''),
|
|
|
|
|
'cost', COALESCE(cl.cost, 0),
|
|
|
|
|
'remark', COALESCE(cl.remark, '')
|
|
|
|
|
)
|
|
|
|
|
)
|
|
|
|
|
FROM (
|
|
|
|
|
SELECT
|
|
|
|
|
c.claim_id AS claimId,
|
|
|
|
|
COALESCE(u.nick_name, '') AS nickName,
|
|
|
|
|
COALESCE(c.cost, 0) AS cost,
|
|
|
|
|
COALESCE(c.remark, '') AS remark
|
|
|
|
|
FROM sys_oa_claim c
|
|
|
|
|
INNER JOIN sys_user u ON c.user_id = u.user_id
|
|
|
|
|
WHERE c.project_id = #{projectId} AND c.del_flag = 0
|
|
|
|
|
) cl
|
|
|
|
|
), JSON_ARRAY())
|
|
|
|
|
) AS data
|
|
|
|
|
FROM sys_oa_project p
|
|
|
|
|
WHERE p.project_id = #{projectId}
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
|
2024-07-07 21:09:28 +08:00
|
|
|
</mapper>
|