Antiloveg 8 anni fa
parent
commit
85361654c9

+ 27 - 39
src/main/java/com/goafanti/common/mapper/TechProjectMapper.xml

@@ -364,7 +364,7 @@
   
   <select id ="findTechProjectManageListByPage" parameterType="java.lang.String" 
      resultType="com.goafanti.techproject.bo.TechProjectManageListBo">
-  	 select x.* from (select p.id, p.uid, i.licence_province as province, p.contract_id as contractId,
+  	 select p.id, p.uid, i.licence_province as province, p.contract_id as contractId,
 	        i.unit_name as unitName,  
 		    CONCAT(i.first_contacts,'  ', i.first_mobile) as firstContacts,
 		    CONCAT(i.second_contacts,'  ', i.second_mobile) as secondContacts,
@@ -372,7 +372,7 @@
 		    p.serial_number as serialNumber, p.create_time as createTime, p.approved_date as approvedDate, 
 		    p.accept_date as acceptDate, a.name as consultant, p.contacts, ad.name as founder,
 		    p.project_name as projectName, p.project_catagory as projectCatagory, p.tech_field as techField, p.state, 
-        w.id as wid, w.website, w.account_number as accountNumber, w.department, w.password, p.deleted_sign as pd, w.deleted_sign as wd
+        w.id as wid, w.website, w.account_number as accountNumber, w.department, w.password
 	  FROM  tech_project p
 		LEFT JOIN organization_identity i on i.uid = p.uid
 		LEFT JOIN admin a on p.consultant = a.id 
@@ -381,70 +381,58 @@
     <if test="principal != null">
 		left join contract_log l on p.contract_id=l.cid
 	</if>
-	 where p.deleted_sign = 0 
-	 <if test="principal != null">
+	where p.deleted_sign = 0 and w.deleted_sign = 0
+	<if test="principal != null">
 		and l.principal = #{principal,jdbcType=VARCHAR}
 	</if>
-	 <if test="principal != null">
-		group by p.id
-	</if>
-    ) x where x.wd = 0 or x.wd is null
     <if test="contractId != null">
-    	and x.contractId = #{contractId,jdbcType=VARCHAR}
+    	and p.contract_id = #{contractId,jdbcType=VARCHAR}
     </if>
       <if test="province != null">
-    	and x.province = #{province,jdbcType=VARCHAR}
+    	and i.licence_province = #{province,jdbcType=VARCHAR}
     </if>
      <if test="uid != null">
-    	and x.uid = #{uid,jdbcType=VARCHAR}
+    	and p.uid = #{uid,jdbcType=VARCHAR}
     </if>
     <if test="unitName != null" >
-    	and x.unitName like CONCAT('%', #{unitName,jdbcType=VARCHAR}, '%')  
+    	and i.unit_name like CONCAT('%', #{unitName,jdbcType=VARCHAR}, '%')  
     </if>
-    order by x.serialNumber desc
+     <if test="principal != null">
+		group by p.id
+	</if>
+    order by p.serial_number desc
    <if test="page_sql!=null">
 		${page_sql}
 	</if>
   </select>
   
   <select id="findTechProjectManageCount" resultType="java.lang.Integer" parameterType="String">
- 	select count(1) from ( select x.* from (select p.id, p.uid, i.licence_province as province, 
-	        i.unit_name as unitName,  p.contract_id as contractId,
-		    CONCAT(i.first_contacts,'  ', i.first_mobile) as firstContacts,
-		    CONCAT(i.second_contacts,'  ', i.second_mobile) as secondContacts,
-		    CONCAT(i.third_contacts,'  ', i.third_mobile) as thirdContacts, 
-		    p.serial_number as serialNumber, p.create_time as createTime, p.approved_date as approvedDate, 
-		    p.accept_date as acceptDate, a.name as consultant, p.contacts,
-		    p.project_name as projectName, p.project_catagory as projectCatagory, p.tech_field as techField, p.state,
-        w.id as wid, w.website, w.account_number as accountNumber, w.department, w.password, p.deleted_sign as pd, w.deleted_sign as wd
-	  FROM  tech_project p
+ 	select count(1)  
+	 	FROM  tech_project p
 		LEFT JOIN organization_identity i on i.uid = p.uid
-		LEFT JOIN admin a on p.consultant = a.id 
-    LEFT JOIN tech_website w on p.department = w.id 
-    <if test="principal != null">
+   		LEFT JOIN tech_website w on p.department = w.id 
+     <if test="principal != null">
 		left join contract_log l on p.contract_id=l.cid
 	</if>
-	 where p.deleted_sign = 0 
-	 <if test="principal != null">
+	where p.deleted_sign = 0 and w.deleted_sign = 0
+	<if test="principal != null">
 		and l.principal = #{principal,jdbcType=VARCHAR}
 	</if>
-	 <if test="principal != null">
-		group by p.id
-	</if> 
-    ) x where x.wd = 0 or x.wd is null
-     <if test="contractId != null">
-    	and x.contractId = #{contractId,jdbcType=VARCHAR}
+    <if test="contractId != null">
+    	and p.contract_id = #{contractId,jdbcType=VARCHAR}
     </if>
-	<if test="province != null">
-    	and x.province = #{province,jdbcType=VARCHAR}
+      <if test="province != null">
+    	and i.licence_province = #{province,jdbcType=VARCHAR}
     </if>
      <if test="uid != null">
-    	and x.uid = #{uid,jdbcType=VARCHAR}
+    	and p.uid = #{uid,jdbcType=VARCHAR}
     </if>
     <if test="unitName != null" >
-    	and x.unitName like CONCAT('%', #{unitName,jdbcType=VARCHAR}, '%')  
+    	and i.unit_name like CONCAT('%', #{unitName,jdbcType=VARCHAR}, '%')  
     </if>
-    ) y 
+     <if test="principal != null">
+		group by p.id
+	</if>
   </select>
   
   <select id="selectProjectDetail" resultType="com.goafanti.techproject.bo.TechProjectDetailBo" parameterType="java.lang.String">