233 lines
12 KiB
XML
233 lines
12 KiB
XML
<?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.securitycontrol.background.mapper.ISignProMapper">
|
|
<!--新增/修改 项目-->
|
|
<insert id="addOrUpdateProject">
|
|
<if test="type == 1">
|
|
INSERT INTO tb_jj_project
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
<if test="id != null and id != ''">id,</if>
|
|
<if test="proName != null and proName!=''">pro_name,</if>
|
|
<if test="proNo != null and proNo!=''">pro_no,</if>
|
|
<if test="orgId != null and orgId!=''">org_id,</if>
|
|
<if test="vlotage != null and vlotage!=''">vlotage,</if>
|
|
<if test="proType != null and proType!=''">pro_type,</if>
|
|
del_flag,
|
|
<if test="constructionNature != null and constructionNature!=''">construction_nature,</if>
|
|
<if test="planNature != null and planNature!=''">plan_nature,</if>
|
|
<if test="line != null and line!=''">line,</if>
|
|
<if test="power != null and power!=''">power,</if>
|
|
<if test="planStartTime != null and planStartTime!=''">plan_start_time,</if>
|
|
<if test="planEndTime != null and planEndTime!=''">plan_end_time,</if>
|
|
<if test="startTime != null and startTime!=''">start_time,</if>
|
|
<if test="endTime != null and endTime!=''">end_time,</if>
|
|
<if test="tcTime != null and tcTime!=''">tc_time,</if>
|
|
</trim>
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
<if test="id != null and id != ''">#{id},</if>
|
|
<if test="proName != null and proName!=''">#{proName},</if>
|
|
<if test="proNo != null and proNo!=''">#{proNo},</if>
|
|
<if test="orgId != null and orgId!=''">#{orgId},</if>
|
|
<if test="vlotage != null and vlotage != ''">#{vlotage},</if>
|
|
<if test="proType != null and proType!=''">#{proType},</if>
|
|
0,
|
|
<if test="constructionNature != null and constructionNature!=''">#{constructionNature},</if>
|
|
<if test="planNature != null and planNature!=''">#{planNature},</if>
|
|
<if test="line != null and line!=''">#{line},</if>
|
|
<if test="power != null and power!=''">#{power},</if>
|
|
<if test="planStartTime != null and planStartTime!=''">#{planStartTime},</if>
|
|
<if test="planEndTime != null and planEndTime!=''">#{planEndTime},</if>
|
|
<if test="startTime != null and startTime!=''">#{startTime},</if>
|
|
<if test="endTime != null and endTime!=''">#{endTime},</if>
|
|
<if test="tcTime != null and tcTime!=''">#{tcTime},</if>
|
|
</trim>
|
|
</if>
|
|
<if test="type == 2">
|
|
UPDATE tb_jj_project SET pro_name = #{proName},pro_no = #{proNo},org_id = #{orgId},vlotage = #{vlotage},
|
|
pro_type = #{proType},construction_nature = #{constructionNature},plan_nature = #{planNature},line = #{line},
|
|
power = #{power},plan_start_time = #{planStartTime},plan_end_time = #{planEndTime},start_time = #{startTime},
|
|
end_time = #{endTime},tc_time = #{tcTime} WHERE id = #{id}
|
|
</if>
|
|
</insert>
|
|
<!--新增/修改单项工程-->
|
|
<insert id="addOrUpdateSignProject">
|
|
<if test="type == 1">
|
|
INSERT INTO tb_sign_project
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
<if test="id != null and id != ''">id,</if>
|
|
<if test="singleName != null and singleName!=''">single_name,</if>
|
|
<if test="signleNo != null and signleNo!=''">signle_no,</if>
|
|
<if test="wbsCode != null and wbsCode!=''">wbs_code,</if>
|
|
<if test="proNo != null and proNo!=''">project_no,</if>
|
|
<if test="singleDesc != null and singleDesc!=''">single_desc,</if>
|
|
del_flag,
|
|
<if test="volLevel != null and volLevel!=''">vol_level,</if>
|
|
<if test="lineLength != null and lineLength!=''">line_length,</if>
|
|
<if test="subsCap != null and subsCap!=''">subs_cap,</if>
|
|
<if test="proType != null and proType!=''">pro_type,</if>
|
|
<if test="subsType != null and subsType!=''">subs_type,</if>
|
|
<if test="estimateType != null and estimateType!=''">estimate_type,</if>
|
|
<if test="orgId != null and orgId!=''">org_id,</if>
|
|
<if test="startDate != null and startDate!=''">start_date,</if>
|
|
<if test="endDate != null and endDate!=''">end_date,</if>
|
|
<if test="completeDate != null and completeDate!=''">complete_date,</if>
|
|
</trim>
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
<if test="id != null and id != ''">#{id},</if>
|
|
<if test="singleName != null and singleName!=''">#{singleName},</if>
|
|
<if test="signleNo != null and signleNo!=''">#{signleNo},</if>
|
|
<if test="wbsCode != null and wbsCode!=''">#{wbsCode},</if>
|
|
<if test="proNo != null and proNo != ''">#{proNo},</if>
|
|
<if test="singleDesc != null and singleDesc!=''">#{singleDesc},</if>
|
|
0,
|
|
<if test="volLevel != null and volLevel!=''">#{volLevel},</if>
|
|
<if test="lineLength != null and lineLength!=''">#{lineLength},</if>
|
|
<if test="subsCap != null and subsCap!=''">#{subsCap},</if>
|
|
<if test="proType != null and proType!=''">#{proType},</if>
|
|
<if test="subsType != null and subsType!=''">#{subsType},</if>
|
|
<if test="estimateType != null and estimateType!=''">#{estimateType},</if>
|
|
<if test="orgId != null and orgId!=''">#{orgId},</if>
|
|
<if test="startDate != null and startDate!=''">#{startDate},</if>
|
|
<if test="endDate != null and endDate!=''">#{endDate},</if>
|
|
<if test="completeDate != null and completeDate!=''">#{completeDate},</if>
|
|
</trim>
|
|
</if>
|
|
<if test="type == 2">
|
|
UPDATE tb_sign_project SET single_name = #{singleName},signle_no = #{signleNo},wbs_code = #{wbsCode},project_no = #{proNo},
|
|
single_desc = #{singleDesc},vol_level = #{volLevel},line_length = #{lineLength},subs_cap = #{subsCap},pro_type = #{proType},
|
|
subs_type = #{subsType},estimate_type = #{estimateType},org_id = #{orgId},start_date = #{startDate},end_date = #{endDate},
|
|
complete_date = #{completeDate} WHERE id = #{id}
|
|
</if>
|
|
</insert>
|
|
<!--删除项目-->
|
|
<update id="delProjectById">
|
|
UPDATE tb_jj_project SET del_flag = 1 WHERE id = #{id}
|
|
</update>
|
|
<!--删除单项工程-->
|
|
<update id="delSignProById">
|
|
UPDATE tb_sign_project SET del_flag = 1 WHERE id = #{id}
|
|
</update>
|
|
|
|
<!--获取项目列表-->
|
|
<select id="getProLists" resultType="com.securitycontrol.entity.background.vo.ProjectVo">
|
|
SELECT tjp.id,
|
|
tjp.pro_name AS proName,
|
|
tjp.pro_no AS proNo,
|
|
sb.city_name AS orgName,
|
|
tjp.construction_nature AS constructionNature,
|
|
tjp.plan_nature AS planNature,
|
|
tjp.line,
|
|
tjp.power,
|
|
tjp.plan_start_time AS planStartTime,
|
|
tjp.plan_end_time AS planEndTime,
|
|
tjp.start_time AS startTime,
|
|
tjp.end_time AS endTime,
|
|
tjp.tc_time AS tcTime,
|
|
sd.dict_name AS vlotage
|
|
FROM tb_jj_project tjp
|
|
LEFT JOIN sys_build sb ON tjp.org_id = sb.org_id
|
|
LEFT JOIN sys_dict sd on tjp.vlotage = sd.dict_code AND sd.del_flag = 0
|
|
WHERE tjp.del_flag = 0
|
|
<if test="keyWord!=null and keyWord!=''">
|
|
AND (
|
|
INSTR(tjp.pro_name,#{keyWord}) > 0 OR
|
|
INSTR(tjp.pro_no,#{keyWord}) > 0
|
|
)
|
|
</if>
|
|
</select>
|
|
<!--项目工程/单项工程是否存在-->
|
|
<select id="isProject" resultType="java.lang.Integer">
|
|
<if test="id == null or id == ''">
|
|
SELECT COUNT(*) FROM tb_jj_project tp WHERE pro_no = #{proNo} AND del_flag = 0
|
|
</if>
|
|
<if test="id != null and id != ''">
|
|
SELECT COUNT(*) FROM tb_jj_project tp WHERE pro_no = #{proNo} AND id != #{id} AND del_flag = 0
|
|
</if>
|
|
</select>
|
|
<!--项目详情-->
|
|
<select id="getProjectById" resultType="com.securitycontrol.entity.background.vo.ProjectVo">
|
|
SELECT tjp.id,
|
|
tjp.pro_name AS proName,
|
|
tjp.pro_no AS proNo,
|
|
tjp.org_id AS orgId,
|
|
tjp.vlotage AS vlotage,
|
|
tjp.construction_nature AS constructionNature,
|
|
tjp.plan_nature AS planNature,
|
|
tjp.line,
|
|
tjp.power,
|
|
tjp.plan_start_time AS planStartTime,
|
|
tjp.plan_end_time AS planEndTime,
|
|
tjp.start_time AS startTime,
|
|
tjp.end_time AS endTime,
|
|
tjp.tc_time AS tcTime
|
|
FROM tb_jj_project tjp
|
|
WHERE tjp.id = #{id}
|
|
</select>
|
|
<!--项目包含是否单项工程-->
|
|
<select id="isHasChildPro" resultType="java.lang.Integer">
|
|
SELECT COUNT(*) FROM tb_sign_project WHERE project_no = #{proNo} AND del_flag = 0
|
|
</select>
|
|
<!--单项工程列表-->
|
|
<select id="getSignProLists" resultType="com.securitycontrol.entity.background.vo.SignProVo">
|
|
SELECT tsp.id,
|
|
tsp.single_name AS singleName,
|
|
tjp.pro_name AS projectName,
|
|
tsp.project_no AS proNo,
|
|
tsp.single_desc AS singleDesc,
|
|
sd.dict_name AS volLevel,
|
|
tsp.line_length AS lineLength,
|
|
tsp.subs_cap AS subsCap,
|
|
CASE tsp.pro_type WHEN '1' THEN '变电' WHEN '2' THEN '线路' END AS proType,
|
|
CASE tsp.subs_type WHEN '1' THEN '土建' WHEN '2' THEN '电气' WHEN '3' THEN '变电' END AS subsType,
|
|
tsp.estimate_type AS estimateType,
|
|
tsp.start_date AS startDate,
|
|
tsp.end_date AS endDate,
|
|
tsp.complete_date AS completeDate,
|
|
sb.city_name AS orgName,
|
|
tsp.signle_no AS signleNo
|
|
FROM tb_sign_project tsp
|
|
LEFT JOIN sys_build sb ON tsp.org_id = sb.org_id
|
|
LEFT JOIN tb_jj_project tjp ON tsp.project_no = tjp.pro_no AND tjp.del_flag = 0
|
|
LEFT JOIN sys_dict sd on tsp.vol_level = sd.dict_code AND sd.del_flag = 0
|
|
WHERE tsp.del_flag = 0
|
|
<if test="keyWord!=null and keyWord!=''">
|
|
AND (
|
|
INSTR(tsp.single_name,#{keyWord}) > 0 OR
|
|
INSTR(tsp.signle_no,#{keyWord}) > 0
|
|
)
|
|
</if>
|
|
</select>
|
|
<!--单项工程是否存在-->
|
|
<select id="isSignPro" resultType="java.lang.Integer">
|
|
<if test="id == null or id == ''">
|
|
SELECT COUNT(*) FROM tb_sign_project tsp WHERE signle_no = #{signleNo} AND del_flag = 0
|
|
</if>
|
|
<if test="id != null and id != ''">
|
|
SELECT COUNT(*) FROM tb_sign_project tsp WHERE signle_no = #{signleNo} AND id != #{id} AND del_flag = 0
|
|
</if>
|
|
</select>
|
|
<!--单项工程详情-->
|
|
<select id="getSignProById" resultType="com.securitycontrol.entity.background.vo.SignProVo">
|
|
SELECT tsp.id,
|
|
tsp.single_name AS singleName,
|
|
tsp.project_no AS proNo,
|
|
tsp.single_desc AS singleDesc,
|
|
tsp.vol_level AS volLevel,
|
|
tsp.line_length AS lineLength,
|
|
tsp.subs_cap AS subsCap,
|
|
tsp.pro_type AS proType,
|
|
tsp.subs_type AS subsType,
|
|
tsp.estimate_type AS estimateType,
|
|
tsp.start_date AS startDate,
|
|
tsp.end_date AS endDate,
|
|
tsp.complete_date AS completeDate,
|
|
tsp.org_id AS orgId,
|
|
tsp.signle_no AS signleNo
|
|
FROM tb_sign_project tsp
|
|
WHERE tsp.id = #{id}
|
|
</select>
|
|
<!--单项工程是否包含标段工程-->
|
|
<select id="isHasBidChildPro" resultType="java.lang.Integer">
|
|
SELECT COUNT(*) FROM tb_project tp WHERE del_flag = 0 AND sign_code = #{signNo}
|
|
</select>
|
|
</mapper> |