|
@@ -0,0 +1,246 @@
|
|
|
+<?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.jeeplus.modules.projectrecord.dao.ProjectImplementEarlyDao">
|
|
|
+
|
|
|
+ <sql id="projectRecordsColumns">
|
|
|
+ a.id AS "id",
|
|
|
+ a.create_by AS "createBy.id",
|
|
|
+ a.create_date AS "createDate",
|
|
|
+ a.update_by AS "updateBy.id",
|
|
|
+ a.update_date AS "updateDate",
|
|
|
+ a.del_flag AS "delFlag",
|
|
|
+ a.contract_id AS "workContractInfo.id",
|
|
|
+ a.project_id AS "projectId",
|
|
|
+ a.project_name AS "projectName",
|
|
|
+ a.scale_type AS "scaleType",
|
|
|
+ a.scale_unit AS "scaleUnit",
|
|
|
+ a.scale_quantity AS "scaleQuantity",
|
|
|
+ a.area_id AS "area.id",
|
|
|
+ a.project_site AS "projectSite",
|
|
|
+ a.project_desc AS "projectDesc",
|
|
|
+ a.remarks AS "remarks",
|
|
|
+ a.status AS "projectStatus",
|
|
|
+ a.process_instance_id AS "processInstanceId",
|
|
|
+ a.company_id AS "company.id",
|
|
|
+ a.office_id AS "office.id",
|
|
|
+ a.alter_process_id AS "alterProcessId",
|
|
|
+ area.name AS "area.name",
|
|
|
+ a.province,
|
|
|
+ a.city,
|
|
|
+ a.area_name AS "county",
|
|
|
+ a.project_structure AS "projectStructure",
|
|
|
+ a.on_ground_num AS "onGroundNum",
|
|
|
+ a.under_ground_num AS "underGroundNum",
|
|
|
+ a.building_scale AS "buildingScale",
|
|
|
+ a.measuring_unit AS "measuringUnit",
|
|
|
+ a.project_use AS "projectUse",
|
|
|
+ a.install_fees AS "installFees",
|
|
|
+ a.building_fees AS "buildingFees",
|
|
|
+ a.building_percent AS "buildingPercent",
|
|
|
+ a.install_percent AS "installPercent",
|
|
|
+ a.unit_fees AS "unitFees",
|
|
|
+ a.building_unit_fees AS "buildingUnitFees",
|
|
|
+ a.install_unit_fees AS "installUnitFees",
|
|
|
+ a.total_fees AS "totalFees",
|
|
|
+ a.type_id As "projectTypeId"
|
|
|
+ </sql>
|
|
|
+
|
|
|
+ <sql id="projectRecordsJoins">
|
|
|
+ LEFT JOIN sys_area area ON area.id = a.area_id
|
|
|
+ </sql>
|
|
|
+
|
|
|
+ <select id="getProjectRecodesList" resultType="ProjectImplementEarly" >
|
|
|
+ SELECT
|
|
|
+ <include refid="projectRecordsColumns"/>
|
|
|
+ ,
|
|
|
+ wci.name AS "workContractInfo.name",
|
|
|
+ wct.id AS "workContractInfo.client.id",
|
|
|
+ wct.name AS "workContractInfo.client.name",
|
|
|
+ o.top_company AS "office.name",
|
|
|
+ dsu.name as "projectRegistrant",
|
|
|
+ pci.id as projectContentId
|
|
|
+ FROM rural_project_records a
|
|
|
+ <include refid="projectRecordsJoins"/>
|
|
|
+ LEFT JOIN work_project_user w on a.id = w.project_id
|
|
|
+ LEFT JOIN project_content_info pci on pci.project_id = a.id
|
|
|
+ LEFT JOIN sys_user su on w.user_id = su.id
|
|
|
+ LEFT JOIN sys_user dsu on a.create_by = dsu.id
|
|
|
+ LEFT JOIN work_project_user w1 on a.id = w1.project_id
|
|
|
+ LEFT JOIN work_contract_info wci on a.contract_id = wci.id
|
|
|
+ LEFT JOIN work_client_info wct on wci.client_id = wct.id
|
|
|
+ LEFT JOIN sys_office o ON o.id = a.office_id
|
|
|
+ <where>
|
|
|
+ a.status = 5
|
|
|
+ AND a.del_flag = 0
|
|
|
+ <if test="projectId != null and projectId != ''">
|
|
|
+ AND a.project_id like concat('%',#{projectId},'%')
|
|
|
+ </if>
|
|
|
+ <if test="projectName != null and projectName != ''">
|
|
|
+ AND a.project_name like concat(concat('%',#{projectName}),'%')
|
|
|
+ </if>
|
|
|
+ <if test="scaleType != null and scaleType != ''">
|
|
|
+ AND a.scale_type = #{scaleType}
|
|
|
+ </if>
|
|
|
+ <if test="scaleUnit != null and scaleUnit != ''">
|
|
|
+ AND a.scale_unit = #{scaleUnit}
|
|
|
+ </if>
|
|
|
+ <if test="scaleQuantity != null and scaleQuantity != ''">
|
|
|
+ AND a.scale_quantity = #{scaleQuantity}
|
|
|
+ </if>
|
|
|
+ <if test="projectSite != null and projectSite != ''">
|
|
|
+ AND a.project_site LIKE concat('%',#{projectSite},'%')
|
|
|
+ </if>
|
|
|
+ <if test="remarks != null and remarks != ''">
|
|
|
+ AND a.remarks LIKE concat('%',#{remarks},'%')
|
|
|
+ </if>
|
|
|
+ <if test="projectDesc != null and projectDesc != ''">
|
|
|
+ AND a.project_desc LIKE concat('%',#{projectDesc},'%')
|
|
|
+ </if>
|
|
|
+ <if test="area != null and area.id != null and area.id != ''">
|
|
|
+ AND a.area_id = #{area.id}
|
|
|
+ </if>
|
|
|
+ <if test="workContractInfo !=null and workContractInfo.name !=null and workContractInfo.name !=''">
|
|
|
+ AND wci.name like concat(concat('%',#{workContractInfo.name}),'%')
|
|
|
+ </if>
|
|
|
+ <if test="workContractInfo !=null and workContractInfo.contractNum !=null and workContractInfo.contractNum !=''">
|
|
|
+ AND wci.contract_num like concat(concat('%',#{workContractInfo.contractNum}),'%')
|
|
|
+ </if>
|
|
|
+ <if test="workContractInfo !=null and workContractInfo.contractPrice !=null and workContractInfo.contractPrice !=''">
|
|
|
+ AND wci.contract_price = #{workContractInfo.contractPrice}
|
|
|
+ </if>
|
|
|
+ <if test="workContractInfo !=null and workContractInfo.contractType !=null and workContractInfo.contractType !=''">
|
|
|
+ AND wci.contract_type = #{workContractInfo.contractType}
|
|
|
+ </if>
|
|
|
+ <if test="workContractInfo!=null and workContractInfo.client !=null and workContractInfo.client.name !=null and workContractInfo.client.name !=''">
|
|
|
+ AND wct.name like concat(concat('%',#{workContractInfo.client.name}),'%')
|
|
|
+ </if>
|
|
|
+ <if test="leaderNameStr !=null and leaderNameStr !=''">
|
|
|
+ AND su.name like concat(concat('%',#{leaderNameStr}),'%') AND w.is_master = '1' AND w.del_flag='0'
|
|
|
+ </if>
|
|
|
+ <if test="beginDate !=null">
|
|
|
+ AND a.create_date >= #{beginDate}
|
|
|
+ </if>
|
|
|
+ <if test="endDate !=null">
|
|
|
+ AND a.create_date < #{endDate}
|
|
|
+ </if>
|
|
|
+ <if test="projectType !=null and projectType !=''">
|
|
|
+ AND a.project_type = #{projectType}
|
|
|
+ </if>
|
|
|
+ <if test="sqlMap.dsf !=null and sqlMap.dsf!=''">
|
|
|
+ AND ((w1.user_id = #{currentUser.id} AND w1.del_flag='0' AND a.company_id = #{currentUser.company.id} )${sqlMap.dsf} )
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ GROUP BY a.id
|
|
|
+ <choose>
|
|
|
+ <when test="page !=null and page.orderBy != null and page.orderBy != ''">
|
|
|
+ ORDER BY ${page.orderBy}
|
|
|
+ </when>
|
|
|
+ <otherwise>
|
|
|
+ ORDER BY a.update_date DESC
|
|
|
+ </otherwise>
|
|
|
+ </choose>
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="getProjectRecodesCount" resultType="int" >
|
|
|
+ SELECT count(DISTINCT a.id)
|
|
|
+ FROM rural_project_records a
|
|
|
+ <if test="leaderNameStr !=null and leaderNameStr !=''">
|
|
|
+ LEFT JOIN work_project_user w on a.id = w.project_id
|
|
|
+ LEFT JOIN sys_user su on w.user_id = su.id
|
|
|
+ </if>
|
|
|
+ LEFT JOIN work_project_user w1 on a.id = w1.project_id
|
|
|
+ <if test="workContractInfo !=null">
|
|
|
+ LEFT JOIN work_contract_info wci on a.contract_id = wci.id
|
|
|
+ </if>
|
|
|
+ <if test="workContractInfo!=null and workContractInfo.client !=null and workContractInfo.client.name !=null and workContractInfo.client.name !=''">
|
|
|
+ LEFT JOIN work_client_info wct on wci.client_id = wct.id
|
|
|
+ </if>
|
|
|
+ <where>
|
|
|
+ a.status = 5
|
|
|
+ AND a.del_flag = 0
|
|
|
+ <if test="projectId != null and projectId != ''">
|
|
|
+ AND a.project_id like concat('%',#{projectId},'%')
|
|
|
+ </if>
|
|
|
+ <if test="projectName != null and projectName != ''">
|
|
|
+ AND a.project_name like concat(concat('%',#{projectName}),'%')
|
|
|
+ </if>
|
|
|
+ <if test="scaleType != null and scaleType != ''">
|
|
|
+ AND a.scale_type = #{scaleType}
|
|
|
+ </if>
|
|
|
+ <if test="scaleUnit != null and scaleUnit != ''">
|
|
|
+ AND a.scale_unit = #{scaleUnit}
|
|
|
+ </if>
|
|
|
+ <if test="scaleQuantity != null and scaleQuantity != ''">
|
|
|
+ AND a.scale_quantity = #{scaleQuantity}
|
|
|
+ </if>
|
|
|
+ <if test="projectSite != null and projectSite != ''">
|
|
|
+ AND a.project_site LIKE concat('%',#{projectSite},'%')
|
|
|
+ </if>
|
|
|
+ <if test="remarks != null and remarks != ''">
|
|
|
+ AND a.remarks LIKE concat('%',#{remarks},'%')
|
|
|
+ </if>
|
|
|
+ <if test="projectDesc != null and projectDesc != ''">
|
|
|
+ AND a.project_desc LIKE concat('%',#{projectDesc},'%')
|
|
|
+ </if>
|
|
|
+ <if test="area != null and area.id != null and area.id != ''">
|
|
|
+ AND a.area_id = #{area.id}
|
|
|
+ </if>
|
|
|
+ <if test="workContractInfo !=null and workContractInfo.name !=null and workContractInfo.name !=''">
|
|
|
+ AND wci.name like concat(concat('%',#{workContractInfo.name}),'%')
|
|
|
+ </if>
|
|
|
+ <if test="workContractInfo !=null and workContractInfo.contractNum !=null and workContractInfo.contractNum !=''">
|
|
|
+ AND wci.contract_num like concat(concat('%',#{workContractInfo.contractNum}),'%')
|
|
|
+ </if>
|
|
|
+ <if test="workContractInfo !=null and workContractInfo.contractPrice !=null and workContractInfo.contractPrice !=''">
|
|
|
+ AND wci.contract_price = #{workContractInfo.contractPrice}
|
|
|
+ </if>
|
|
|
+ <if test="workContractInfo !=null and workContractInfo.contractType !=null and workContractInfo.contractType !=''">
|
|
|
+ AND wci.contract_type = #{workContractInfo.contractType}
|
|
|
+ </if>
|
|
|
+ <if test="workContractInfo!=null and workContractInfo.client !=null and workContractInfo.client.name !=null and workContractInfo.client.name !=''">
|
|
|
+ AND wct.name like concat(concat('%',#{workContractInfo.client.name}),'%')
|
|
|
+ </if>
|
|
|
+ <if test="leaderNameStr !=null and leaderNameStr !=''">
|
|
|
+ AND su.name like concat(concat('%',#{leaderNameStr}),'%') AND w.is_master = '1' AND w.del_flag='0'
|
|
|
+ </if>
|
|
|
+ <if test="beginDate !=null">
|
|
|
+ AND a.create_date >= #{beginDate}
|
|
|
+ </if>
|
|
|
+ <if test="endDate !=null">
|
|
|
+ AND a.create_date < #{endDate}
|
|
|
+ </if>
|
|
|
+ <if test="projectType !=null and projectType !=''">
|
|
|
+ AND a.project_type = #{projectType}
|
|
|
+ </if>
|
|
|
+ <if test="sqlMap.dsf !=null and sqlMap.dsf!=''">
|
|
|
+ AND ((w1.user_id = #{currentUser.id} AND w1.del_flag='0' AND a.company_id = #{currentUser.company.id})${sqlMap.dsf} )
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <insert id="saveProjectAndAttachmentContact">
|
|
|
+ insert into project_attachment_info (project_id, attachment_id)
|
|
|
+ values
|
|
|
+ (#{projectId}, #{attachmentId})
|
|
|
+ </insert>
|
|
|
+
|
|
|
+ <insert id="saveProjectContrntAndReport">
|
|
|
+ insert into project_content_report (content_id, report_id)
|
|
|
+ values
|
|
|
+ (#{contentId}, #{reportId})
|
|
|
+ </insert>
|
|
|
+
|
|
|
+ <select id="getProjectContrntAndReport" resultType="java.lang.Integer">
|
|
|
+ select count(1) as count from project_content_report where content_id = #{contentId} and report_id = #{reportId}
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <insert id="saveProjectContrntAndBasedId">
|
|
|
+ insert into project_content_based_relation (content_id, based_id)
|
|
|
+ values
|
|
|
+ (#{contentId}, #{basedId})
|
|
|
+ </insert>
|
|
|
+
|
|
|
+ <delete id="delProjectContrntAndBasedId">
|
|
|
+ delete from project_content_based_relation where content_id = #{contentId} and based_id = #{basedId}
|
|
|
+ </delete>
|
|
|
+</mapper>
|