jhprjv2/yanzhu-jh/src/main/resources/mapper/project/SurProjectMapper.xml

420 lines
29 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.yanzhu.jh.project.mapper.SurProjectMapper">
<resultMap type="SurProject" id="SurProjectResult">
<result property="id" column="id" />
<result property="deptId" column="deptId" />
<result property="projectName" column="projectName" />
<result property="projectCode" column="projectCode" />
<result property="paretProjectName" column="paretProjectName" />
<result property="paretProjectCode" column="paretProjectCode" />
<result property="simpleName" column="simpleName" />
<result property="projectType" column="projectType" />
<result property="projiectLevel" column="projiectLevel" />
<result property="projectRegional" column="projectRegional" />
<result property="projectAddress" column="projectAddress" />
<result property="projectNature" column="projectNature" />
<result property="licenceNumber" column="licenceNumber" />
<result property="projectApproval" column="projectApproval" />
<result property="projectPerson" column="projectPerson" />
<result property="projectPhone" column="projectPhone" />
<result property="longitude" column="longitude" />
<result property="latitude" column="latitude" />
<result property="projectTimeLimit" column="projectTimeLimit" />
<result property="totalInvestment" column="totalInvestment" />
<result property="floorArea" column="floorArea" />
<result property="totalOutputValue" column="totalOutputValue" />
<result property="plannedCompletionTime" column="plannedCompletionTime" />
<result property="scheduledStartTime" column="scheduledStartTime" />
<result property="actualOperatingTime" column="actualOperatingTime" />
<result property="actualCompletionTime" column="actualCompletionTime" />
<result property="contractAmount" column="contractAmount" />
<result property="paidAmount" column="paidAmount" />
<result property="onAccountAmount" column="onAccountAmount" />
<result property="projectSchedule" column="projectSchedule" />
<result property="projectSummarize" column="projectSummarize" />
<result property="isDel" column="isDel" />
<result property="projectStatus" column="projectStatus" />
<result property="servicePersonnel" column="servicePersonnel" />
<result property="supervisorPersonnel" column="supervisorPersonnel" />
<result property="generalContractor" column="generalContractor" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="remark" column="remark" />
<result property="deptName" column="dept_name" />
<result property="weightType" column="weightType" />
<result property="projectSort" column="projectSort" />
<result property="progressVisible" column="progressVisible" />
<result property="projectRegionalName" column="projectRegionalName" />
<result property="prjPlanUrl" column="prjPlanUrl"/>
<result property="prjRenderingUrl" column="prjRenderingUrl"/>
</resultMap>
<sql id="selectSurProjectVo">
select sp.id, sp.deptId, sp.projectName, sp.projectCode, sp.paretProjectName, sp.paretProjectCode, sp.simpleName, sp.projectType, sp.projiectLevel,
sp.projectRegional, sp.projectAddress, sp.projectNature, sp.licenceNumber, sp.projectApproval, sp.projectPerson, sp.projectPhone, sp.longitude,
sp.latitude, sp.projectTimeLimit, sp.totalInvestment, sp.floorArea, sp.totalOutputValue, sp.plannedCompletionTime, sp.scheduledStartTime,
sp.actualOperatingTime, sp.actualCompletionTime, sp.contractAmount, sp.paidAmount, sp.onAccountAmount, sp.projectSchedule, sp.projectSummarize,
sp.isDel, sp.projectStatus, sp.servicePersonnel, sp.supervisorPersonnel, sp.generalContractor, sp.create_by, sp.create_time, sp.update_by,
sp.update_time, sp.remark, sp.weightType, sp.projectSort, sp.progressVisible, d.dept_name,
sp.prjPlanUrl,sp.prjRenderingUrl
from sur_project sp
left join sys_dept d on d.dept_id = sp.deptId
</sql>
<select id="selectSurProjectList" parameterType="SurProject" resultMap="SurProjectResult">
select sp.id, sp.deptId, sp.projectName, sp.projectCode, sp.paretProjectName, sp.paretProjectCode, sp.simpleName, sp.projectType, sp.projiectLevel, sp.projectRegional, a.areaName as projectRegionalName, sp.projectAddress, sp.projectNature, sp.licenceNumber, sp.projectApproval, sp.projectPerson, sp.projectPhone, sp.longitude, sp.latitude, sp.projectTimeLimit, sp.totalInvestment, sp.floorArea, sp.totalOutputValue, sp.plannedCompletionTime, sp.scheduledStartTime, sp.actualOperatingTime, sp.actualCompletionTime, sp.contractAmount, sp.paidAmount, sp.onAccountAmount, sp.projectSchedule, sp.projectSummarize, sp.isDel, sp.projectStatus, sp.servicePersonnel, sp.supervisorPersonnel, sp.generalContractor, sp.create_by, sp.create_time,
sp.update_by, sp.update_time, sp.remark, sp.weightType, sp.projectSort, sp.progressVisible, d.dept_name,sp.prjPlanUrl,sp.prjRenderingUrl
from sur_project sp
left join sys_dept d on d.dept_id = sp.deptId
left join china_area a on sp.projectRegional = a.id
<!--监理单位/总包公司/分包单位-->
<if test='nowRole == "5" or nowRole == "6" or nowRole == "7"'> left join sur_project_unit_info spui on spui.projectId = sp.id</if>
<!--普通用户查询项目人员-->
<if test='nowRole == "15" or nowRole == "16" or nowRole == "17" or nowRole == "99"'> left join sur_project_userinfo spu on spu.project_id = sp.id</if>
<where>
sp.isDel = 0
<if test="deptId != null "> and sp.deptId like concat('%', #{deptId}, '%')</if>
<if test="projectName != null and projectName != ''"> and sp.projectName like concat('%', #{projectName}, '%')</if>
<if test="projectCode != null and projectCode != ''"> and sp.projectCode = #{projectCode}</if>
<if test="paretProjectName != null and paretProjectName != ''"> and sp.paretProjectName like concat('%', #{paretProjectName}, '%')</if>
<if test="paretProjectCode != null and paretProjectCode != ''"> and sp.paretProjectCode = #{paretProjectCode}</if>
<if test="simpleName != null and simpleName != ''"> and sp.simpleName like concat('%', #{simpleName}, '%')</if>
<if test="projectType != null and projectType != ''"> and sp.projectType = #{projectType}</if>
<if test="projiectLevel != null and projiectLevel != ''"> and sp.projiectLevel = #{projiectLevel}</if>
<if test="projectRegional != null and projectRegional != ''"> and sp.projectRegional = #{projectRegional}</if>
<if test="projectAddress != null and projectAddress != ''"> and sp.projectAddress = #{projectAddress}</if>
<if test="progressVisible != null and progressVisible != ''"> and sp.progressVisible = #{progressVisible}</if>
<if test="projectNature != null and projectNature != ''"> and sp.projectNature = #{projectNature}</if>
<if test="licenceNumber != null and licenceNumber != ''"> and sp.licenceNumber = #{licenceNumber}</if>
<if test="projectApproval != null and projectApproval != ''"> and sp.projectApproval = #{projectApproval}</if>
<if test="projectPerson != null and projectPerson != ''"> and sp.projectPerson = #{projectPerson}</if>
<if test="projectPhone != null and projectPhone != ''"> and sp.projectPhone = #{projectPhone}</if>
<if test="longitude != null and longitude != ''"> and sp.longitude = #{longitude}</if>
<if test="latitude != null and latitude != ''"> and sp.latitude = #{latitude}</if>
<if test="projectTimeLimit != null "> and sp.projectTimeLimit = #{projectTimeLimit}</if>
<if test="totalInvestment != null and totalInvestment != ''"> and sp.totalInvestment = #{totalInvestment}</if>
<if test="floorArea != null and floorArea != ''"> and sp.floorArea = #{floorArea}</if>
<if test="totalOutputValue != null and totalOutputValue != ''"> and sp.totalOutputValue = #{totalOutputValue}</if>
<if test="plannedCompletionTime != null and plannedCompletionTime != ''"> and sp.plannedCompletionTime = #{plannedCompletionTime}</if>
<if test="scheduledStartTime != null and scheduledStartTime != ''"> and sp.scheduledStartTime = #{scheduledStartTime}</if>
<if test="actualOperatingTime != null and actualOperatingTime != ''"> and sp.actualOperatingTime = #{actualOperatingTime}</if>
<if test="actualCompletionTime != null and actualCompletionTime != ''"> and sp.actualCompletionTime = #{actualCompletionTime}</if>
<if test="contractAmount != null and contractAmount != ''"> and sp.contractAmount = #{contractAmount}</if>
<if test="paidAmount != null and paidAmount != ''"> and sp.paidAmount = #{paidAmount}</if>
<if test="onAccountAmount != null and onAccountAmount != ''"> and sp.onAccountAmount = #{onAccountAmount}</if>
<if test="projectSchedule != null and projectSchedule != ''"> and sp.projectSchedule = #{projectSchedule}</if>
<if test="projectSummarize != null and projectSummarize != ''"> and sp.projectSummarize = #{projectSummarize}</if>
<if test="projectStatus != null and projectStatus != ''"> and sp.projectStatus = #{projectStatus}</if>
<if test="createBy != null and createBy != ''"> and sp.create_by = #{createBy}</if>
<if test="servicePersonnel != null "> and sp.servicePersonnel = #{servicePersonnel}</if>
<if test="supervisorPersonnel != null "> and sp.supervisorPersonnel = #{supervisorPersonnel}</if>
<if test="generalContractor != null "> and sp.generalContractor = #{generalContractor}</if>
<if test="weightType != null "> and sp.weightType = #{weightType}</if>
<!-- 查询条件-项目部门 -->
<if test="projectDeptId != null "> and sp.deptId = #{projectDeptId}</if>
<!--子部门数据-->
<if test='nowRole == "4"'> and sp.deptId = #{nowDept}</if>
<if test='proType != null and proType !=""'> and sp.projectType = #{proType}</if>
<!--监理单位/总包公司/分包单位查询当前关联数据-->
<if test='nowRole == "5" or nowRole == "6" or nowRole == "7"'> and spui.unitId = #{nowDept}</if>
<!--普通用户查询项目人员-->
<if test='nowRole == "15" or nowRole == "16" or nowRole == "17" or nowRole == "99"'> and spu.user_id = #{nowUser} and spu.is_del=0</if>
</where>
order by sp.projectSort ASC,sp.projectName
</select>
<select id="selectAllProjectList" resultMap="SurProjectResult">
select sp.*, d.dept_name
from sur_project sp
left join sys_dept d on d.dept_id = sp.deptId
<where>
sp.isDel = 0
and sp.projectType in ('1','4')
</where>
order by sp.projectSort ASC,sp.projectName
</select>
<select id="selectSurProjectById" parameterType="Long" resultMap="SurProjectResult">
<include refid="selectSurProjectVo"/>
where id = #{id}
order by projectType
</select>
<insert id="insertSurProject" parameterType="SurProject">
insert into sur_project
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">id,</if>
<if test="deptId != null">deptId,</if>
<if test="projectName != null">projectName,</if>
<if test="projectCode != null">projectCode,</if>
<if test="paretProjectName != null">paretProjectName,</if>
<if test="paretProjectCode != null">paretProjectCode,</if>
<if test="simpleName != null">simpleName,</if>
<if test="projectType != null">projectType,</if>
<if test="projiectLevel != null">projiectLevel,</if>
<if test="projectRegional != null">projectRegional,</if>
<if test="projectAddress != null">projectAddress,</if>
<if test="projectNature != null">projectNature,</if>
<if test="licenceNumber != null">licenceNumber,</if>
<if test="projectApproval != null">projectApproval,</if>
<if test="projectPerson != null">projectPerson,</if>
<if test="projectPhone != null">projectPhone,</if>
<if test="longitude != null">longitude,</if>
<if test="latitude != null">latitude,</if>
<if test="projectTimeLimit != null">projectTimeLimit,</if>
<if test="totalInvestment != null">totalInvestment,</if>
<if test="floorArea != null">floorArea,</if>
<if test="totalOutputValue != null">totalOutputValue,</if>
<if test="plannedCompletionTime != null">plannedCompletionTime,</if>
<if test="scheduledStartTime != null">scheduledStartTime,</if>
<if test="actualOperatingTime != null">actualOperatingTime,</if>
<if test="actualCompletionTime != null">actualCompletionTime,</if>
<if test="contractAmount != null">contractAmount,</if>
<if test="paidAmount != null">paidAmount,</if>
<if test="onAccountAmount != null">onAccountAmount,</if>
<if test="projectSchedule != null">projectSchedule,</if>
<if test="projectSummarize != null">projectSummarize,</if>
<if test="isDel != null">isDel,</if>
<if test="projectStatus != null">projectStatus,</if>
<if test="servicePersonnel != null">servicePersonnel,</if>
<if test="supervisorPersonnel != null">supervisorPersonnel,</if>
<if test="generalContractor != null">generalContractor,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="remark != null">remark,</if>
<if test="weightType != null">weightType,</if>
<if test="projectSort != null">projectSort,</if>
<if test="progressVisible != null">progressVisible,</if>
<if test="prjPlanUrl != null">prjPlanUrl,</if>
<if test="prjRenderingUrl != null">prjRenderingUrl,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},</if>
<if test="deptId != null">#{deptId},</if>
<if test="projectName != null">#{projectName},</if>
<if test="projectCode != null">#{projectCode},</if>
<if test="paretProjectName != null">#{paretProjectName},</if>
<if test="paretProjectCode != null">#{paretProjectCode},</if>
<if test="simpleName != null">#{simpleName},</if>
<if test="projectType != null">#{projectType},</if>
<if test="projiectLevel != null">#{projiectLevel},</if>
<if test="projectRegional != null">#{projectRegional},</if>
<if test="projectAddress != null">#{projectAddress},</if>
<if test="projectNature != null">#{projectNature},</if>
<if test="licenceNumber != null">#{licenceNumber},</if>
<if test="projectApproval != null">#{projectApproval},</if>
<if test="projectPerson != null">#{projectPerson},</if>
<if test="projectPhone != null">#{projectPhone},</if>
<if test="longitude != null">#{longitude},</if>
<if test="latitude != null">#{latitude},</if>
<if test="projectTimeLimit != null">#{projectTimeLimit},</if>
<if test="totalInvestment != null">#{totalInvestment},</if>
<if test="floorArea != null">#{floorArea},</if>
<if test="totalOutputValue != null">#{totalOutputValue},</if>
<if test="plannedCompletionTime != null">#{plannedCompletionTime},</if>
<if test="scheduledStartTime != null">#{scheduledStartTime},</if>
<if test="actualOperatingTime != null">#{actualOperatingTime},</if>
<if test="actualCompletionTime != null">#{actualCompletionTime},</if>
<if test="contractAmount != null">#{contractAmount},</if>
<if test="paidAmount != null">#{paidAmount},</if>
<if test="onAccountAmount != null">#{onAccountAmount},</if>
<if test="projectSchedule != null">#{projectSchedule},</if>
<if test="projectSummarize != null">#{projectSummarize},</if>
<if test="isDel != null">#{isDel},</if>
<if test="projectStatus != null">#{projectStatus},</if>
<if test="servicePersonnel != null">#{servicePersonnel},</if>
<if test="supervisorPersonnel != null">#{supervisorPersonnel},</if>
<if test="generalContractor != null">#{generalContractor},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="remark != null">#{remark},</if>
<if test="weightType != null">#{weightType},</if>
<if test="projectSort != null">#{projectSort},</if>
<if test="progressVisible != null">#{progressVisible},</if>
<if test="prjPlanUrl != null">#{prjPlanUrl},</if>
<if test="prjRenderingUrl != null">#{prjRenderingUrl},</if>
</trim>
</insert>
<update id="updateSurProject" parameterType="SurProject">
update sur_project
<trim prefix="SET" suffixOverrides=",">
<if test="deptId != null">deptId = #{deptId},</if>
<if test="projectName != null">projectName = #{projectName},</if>
<if test="projectCode != null">projectCode = #{projectCode},</if>
<if test="paretProjectName != null">paretProjectName = #{paretProjectName},</if>
<if test="paretProjectCode != null">paretProjectCode = #{paretProjectCode},</if>
<if test="simpleName != null">simpleName = #{simpleName},</if>
<if test="projectType != null">projectType = #{projectType},</if>
<if test="projiectLevel != null">projiectLevel = #{projiectLevel},</if>
<if test="projectRegional != null">projectRegional = #{projectRegional},</if>
<if test="projectAddress != null">projectAddress = #{projectAddress},</if>
<if test="projectNature != null">projectNature = #{projectNature},</if>
<if test="licenceNumber != null">licenceNumber = #{licenceNumber},</if>
<if test="projectApproval != null">projectApproval = #{projectApproval},</if>
<if test="projectPerson != null">projectPerson = #{projectPerson},</if>
<if test="projectPhone != null">projectPhone = #{projectPhone},</if>
<if test="longitude != null">longitude = #{longitude},</if>
<if test="latitude != null">latitude = #{latitude},</if>
<if test="projectTimeLimit != null">projectTimeLimit = #{projectTimeLimit},</if>
<if test="totalInvestment != null">totalInvestment = #{totalInvestment},</if>
<if test="floorArea != null">floorArea = #{floorArea},</if>
<if test="totalOutputValue != null">totalOutputValue = #{totalOutputValue},</if>
<if test="plannedCompletionTime != null">plannedCompletionTime = #{plannedCompletionTime},</if>
<if test="scheduledStartTime != null">scheduledStartTime = #{scheduledStartTime},</if>
<if test="actualOperatingTime != null">actualOperatingTime = #{actualOperatingTime},</if>
<if test="actualCompletionTime != null">actualCompletionTime = #{actualCompletionTime},</if>
<if test="contractAmount != null">contractAmount = #{contractAmount},</if>
<if test="paidAmount != null">paidAmount = #{paidAmount},</if>
<if test="onAccountAmount != null">onAccountAmount = #{onAccountAmount},</if>
<if test="projectSchedule != null">projectSchedule = #{projectSchedule},</if>
<if test="projectSummarize != null">projectSummarize = #{projectSummarize},</if>
<if test="isDel != null">isDel = #{isDel},</if>
<if test="projectStatus != null">projectStatus = #{projectStatus},</if>
<if test="servicePersonnel != null">servicePersonnel = #{servicePersonnel},</if>
<if test="supervisorPersonnel != null">supervisorPersonnel = #{supervisorPersonnel},</if>
<if test="generalContractor != null">generalContractor = #{generalContractor},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="weightType != null">weightType = #{weightType},</if>
<if test="projectSort != null">projectSort = #{projectSort},</if>
<if test="progressVisible != null">progressVisible = #{progressVisible},</if>
<if test="prjPlanUrl != null">prjPlanUrl = #{prjPlanUrl},</if>
<if test="prjRenderingUrl != null">prjRenderingUrl = #{prjRenderingUrl},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteSurProjectById" parameterType="Long">
update sur_project set isDel = 1 where id = #{id}
</delete>
<delete id="deleteSurProjectByIds" parameterType="String">
update sur_project set isDel = 1 where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<select id="groupByCategory" parameterType="SurProject" resultMap="SurProjectResult">
<if test="id==2">
SELECT b.dict_value id,b.dict_label projectName,cnt deptId FROM (
SELECT b.dict_value, b.dict_label,sum(c.money)
cnt FROM sur_project a, sys_dict_data b,sur_project_cost_output c WHERE b.dict_type='project_category' AND a.id=c.project_id AND c.cost_type=2 and c.year=#{isDel}
AND a.projectType=b.dict_value and a.isDel=0
<if test="deptId>0">AND deptid=#{deptId}</if>
<if test="proType != null and proType != ''"> and a.projectType = #{proType}</if>
GROUP BY dict_value,dict_label
) a RIGHT JOIN sys_dict_data b ON a.dict_value=b.dict_value WHERE b.dict_type='project_category' ORDER BY cnt DESC
</if>
<if test="id!=2">
SELECT b.dict_value id,b.dict_label projectName,cnt deptId FROM (
SELECT b.dict_value, b.dict_label,
<if test="id==0">COUNT(1)*10000</if>
<if test="id==1">SUM(c.totalInvestment)</if>
<if test="id==2">COUNT(1)*10000</if>
cnt FROM sur_project a, sys_dict_data b,vw_sur_project_cost_output c WHERE b.dict_type='project_category' AND a.id=c.project_id
AND a.projectType=b.dict_value and a.isDel=0
<if test="deptId>0">AND deptid=#{deptId}</if>
<if test="proType != null and proType != ''"> and projectType = #{proType}</if>
GROUP BY dict_value,dict_label
) a RIGHT JOIN sys_dict_data b ON a.dict_value=b.dict_value WHERE b.dict_type='project_category' ORDER BY cnt DESC
</if>
</select>
<select id="groupByLevel" parameterType="SurProject" resultMap="SurProjectResult">
<if test="id==2">
SELECT b.dict_value id,b.dict_label projectName,cnt deptId FROM (
SELECT b.dict_value, b.dict_label,sum(c.money) cnt
FROM sur_project a,sys_dict_data b ,sur_project_cost_output c WHERE b.dict_type='project_level' AND a.id=c.project_id AND c.cost_type=2 and c.year=#{isDel}
AND a.projiectLevel=b.dict_value and a.isDel=0
<if test="deptId>0">AND deptid=#{deptId}</if>
<if test="proType != null and proType != ''"> and projectType = #{proType}</if>
GROUP BY dict_value,dict_label
) a RIGHT JOIN sys_dict_data b ON a.dict_value=b.dict_value WHERE b.dict_type='project_level' ORDER BY cnt DESC
</if>
<if test="id!=2">
SELECT b.dict_value id,b.dict_label projectName,cnt deptId FROM (
SELECT b.dict_value, b.dict_label,
<if test="id==0">COUNT(1)*10000</if>
<if test="id==1">SUM(c.totalInvestment)</if>
cnt FROM sur_project a, sys_dict_data b ,vw_sur_project_cost_output c WHERE b.dict_type='project_level' AND a.id=c.project_id
AND a.projiectLevel=b.dict_value and a.isDel=0
<if test="deptId>0">AND deptid=#{deptId}</if>
<if test="proType != null and proType != ''"> and projectType = #{proType}</if>
GROUP BY dict_value,dict_label
) a RIGHT JOIN sys_dict_data b ON a.dict_value=b.dict_value WHERE b.dict_type='project_level' ORDER BY cnt DESC
</if>
</select>
<select id="selectProgressProjects" parameterType="SurProject" resultMap="SurProjectResult">
<include refid="selectSurProjectVo"/>
where 1=1
<if test="deptId!=0">and deptid=#{deptId}</if>
<if test="projectType != null and projectType != ''"> and projectType = #{projectType}</if>
<if test="prjIds !=null and prjIds.size()>0">
and id in
<foreach collection="prjIds" item="item" index="index" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
order by projectSort,projectName
</select>
<select id="groupByProjectCategory" parameterType="SurProject" resultMap="SurProjectResult">
SELECT d.dict_value dept_name,d.dict_label projectName,p.projectSchedule ,COUNT(p.id) deptId FROM
(SELECT * FROM sys_dict_data WHERE dict_type='project_category') d
LEFT JOIN
(SELECT projectType,IF(projectSchedule IS NULL,1,projectSchedule) projectSchedule,id FROM sur_project
WHERE isDel=0
<if test="deptId!=null and deptId>0">and deptid=#{deptId}</if>
<if test='proType != null and proType !=""'> and projectType = #{proType}</if>
<if test="projectType != null and projectType != ''"> and projectType = #{projectType}</if>
<if test="prjIds !=null and prjIds.size()>0">
and id in
<foreach collection="prjIds" item="item" index="index" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
) p
ON p.projectType=d.dict_value
GROUP BY d.dict_value,d.dict_label,p.projectSchedule
</select>
<select id="selectSurProjectListByBuser" parameterType="SurProject" resultMap="SurProjectResult">
select sp.id, sp.deptId, sp.projectName, sp.projectCode, sp.paretProjectName, sp.paretProjectCode, sp.simpleName, sp.projectType, sp.projiectLevel, sp.projectRegional, a.areaName as projectRegionalName, sp.projectAddress, sp.projectNature, sp.licenceNumber, sp.projectApproval, sp.projectPerson, sp.projectPhone, sp.longitude, sp.latitude, sp.projectTimeLimit, sp.totalInvestment, sp.floorArea, sp.totalOutputValue, sp.plannedCompletionTime, sp.scheduledStartTime, sp.actualOperatingTime, sp.actualCompletionTime, sp.contractAmount, sp.paidAmount, sp.onAccountAmount, sp.projectSchedule, sp.projectSummarize, sp.isDel, sp.projectStatus, sp.servicePersonnel, sp.supervisorPersonnel, sp.generalContractor, sp.create_by, sp.create_time, sp.update_by, sp.update_time, sp.remark, sp.weightType, sp.projectSort, sp.progressVisible, d.dept_name
from (
select * from sur_project sp where sp.isdel=0
<if test='proType != null and proType !=""'> and sp.projectType = #{proType}</if>
<if test="id!=null and id>0">
and sp.id in (select spu.project_id from sur_project_userinfo spu where spu.user_id = #{id} and spu.is_del=0)
</if>
<if test="deptId!=null and deptId>0">
and sp.id in (select spui.projectId from sur_project_unit_info spui where spui.unitId = #{deptId} and spui.del_flag=0)
</if>
<if test="prjIds !=null and prjIds.size()>0">
and sp.id in
<foreach collection="prjIds" item="item" index="index" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
) as sp
left join sys_dept d on d.dept_id = sp.deptId
left join china_area a on sp.projectRegional = a.id
</select>
</mapper>