三期内容优化

This commit is contained in:
2025-03-19 21:37:54 +08:00
parent aa64312441
commit ed7012e2dd
24 changed files with 671 additions and 96 deletions

View File

@@ -30,9 +30,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<update id="setFollow">
update oa_business set follow_up_status = 1 where business_id=#{businessId}
</update>
<delete id="deleteBusinessById">
delete from oa_business
<where>business_id=#{businessId}</where>
delete from oa_business where
business_id=#{businessId}
</delete>
@@ -43,6 +44,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
left join oa_product op on obp.product_id = op.product_id
${ew.getCustomSqlSegment}
</select>
<select id="getBusinessByCustomerId" resultType="com.ruoyi.oa.domain.vo.OaBusinessVo">
select * from oa_business
<where >

View File

@@ -34,8 +34,34 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectVoPageToUser" resultType="com.ruoyi.oa.domain.vo.OaCustomerVo">
select oc.customer_id, nick_name,name, follow_up_status, contact_last_time, contact_last_content, contact_next_time, owner_user_id, owner_time, deal_status, mobile, telephone, qq, wechat, oc.email, area_id, detail_address, industry_id, level, source, oc.remark,oc.create_by, oc.create_time, oc.update_by, oc.update_time, oc.del_flag from oa_customer oc
left join fad_oa.sys_user su on oc.owner_user_id = su.user_id
select oc.customer_id,
nick_name,
name,
follow_up_status,
contact_last_time,
contact_last_content,
contact_next_time,
owner_user_id,
owner_time,
deal_status,
mobile,
telephone,
qq,
wechat,
oc.email,
area_id,
detail_address,
industry_id,
level,
source,
oc.remark,
oc.create_by,
oc.create_time,
oc.update_by,
oc.update_time,
oc.del_flag
from oa_customer oc
left join fad_oa.sys_user su on oc.owner_user_id = su.user_id
${ew.getCustomSqlSegment}
</select>

View File

@@ -18,6 +18,7 @@
<result property="remark" column="remark"/>
<result property="nickName" column="nick_name"/>
<result property="punishSalary" column="punish_salary"/>
<result property="insure" column="insure"/>
</resultMap>
@@ -40,6 +41,7 @@
os.pay_time,
su.nick_name,
os.base_salary,
os.insure,
COALESCE(
SUM(
CASE
@@ -97,6 +99,7 @@
osi.reason,
osi.price,
osi.sign_time,
os.insure,
su.nick_name
FROM oa_salary os
LEFT JOIN oa_salary_item osi

View File

@@ -117,7 +117,7 @@
</select>
<select id="selectListToCost" resultType="com.ruoyi.oa.domain.vo.SysOaCostAllVo">
SELECT
sop.project_name,sop.project_num,sop.project_id,
sop.project_name,sop.project_num,sop.project_id,sop.funds,
(
SELECT COALESCE(SUM(soc.cost),0)
@@ -126,10 +126,11 @@
) 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
SELECT COALESCE(SUM(sod.price), 0)
FROM sys_oa_finance sof
JOIN sys_oa_detail sod ON sof.finance_id = sod.finance_id
WHERE sof.project_id = sop.project_id
AND sof.finance_type = 0
) AS materialCost,
(
@@ -151,74 +152,96 @@
<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()),
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()),
'materialList',
COALESCE(
(
SELECT JSON_ARRAYAGG(
JSON_OBJECT(
'detailId', CAST(d.detail_id AS CHAR),
'detailTitle', COALESCE(d.detail_title, ''),
'price', COALESCE(d.price, 0),
'financeParties', COALESCE(f.finance_parties, ''),
'remark', COALESCE(f.remark, '')
)
)
FROM sys_oa_finance f
INNER JOIN sys_oa_detail d
ON f.finance_id = d.finance_id
WHERE f.project_id = #{projectId}
AND f.finance_type = 0
),
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
'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>

View File

@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.oa.mapper.SysOaWarehouseMasterMapper">
<resultMap type="com.ruoyi.oa.domain.SysOaWarehouseMaster" id="SysOaWarehouseMasterResult">
<result property="masterId" column="master_id"/>
<result property="type" column="type"/>
<result property="projectId" column="project_id"/>
<result property="signTime" column="sign_time"/>
<result property="signUser" column="sign_user"/>
<result property="createTime" column="create_time"/>
<result property="updateTime" column="update_time"/>
<result property="createBy" column="create_by"/>
<result property="updateBy" column="update_by"/>
<result property="delFlag" column="del_flag"/>
<result property="remark" column="remark"/>
</resultMap>
</mapper>