Browse Source

解决冲突

zou_ht 8 years ago
parent
commit
d468f09bf4
1 changed files with 363 additions and 1 deletions
  1. 363 1
      src/main/java/com/goafanti/common/mapper/DemandMapper.xml

+ 363 - 1
src/main/java/com/goafanti/common/mapper/DemandMapper.xml

@@ -652,7 +652,7 @@
 		</if>
 		order by d.serial_number desc
 		<if test="page_sql!=null">
-			${page_sql}
+			${page_sql}
 		</if>
 	</select>
 
@@ -1306,6 +1306,368 @@
 	<select id="findPartnerDemandListByPage" parameterType="java.lang.String"
 		resultType="com.goafanti.demand.bo.DemandPartnerListBo">
 		SELECT
+=======
+	</if>
+  </select>
+  
+  <select id ="findManageOrgDemandCount" parameterType="String" resultType="java.lang.Integer">
+  		select 
+	 count(1)
+	from  demand d 
+	LEFT JOIN organization_identity oi on d.employer_id = oi.uid
+	LEFT JOIN admin a on a.id = d.tech_broker_id
+	<if test="adminId != null">
+		LEFT JOIN user u on d.employer_id = u.id
+	</if>
+	where d.deleted_sign = 0 and d.data_category = 1
+	<if test="adminId != null">
+		and (u.mid = #{adminId,jdbcType=VARCHAR}
+	</if>
+	<if test="adminId != null">
+		or  d.principal_id = #{adminId,jdbcType=VARCHAR}
+	</if>
+	<if test="adminId != null">
+		or  d.tech_broker_id = #{adminId,jdbcType=VARCHAR}
+		)
+	</if>
+	<if test="serialNumber != null">
+		and  d.serial_number = #{serialNumber,jdbcType=INTEGER}
+	</if>
+	<if test="auditStatus != null">
+		and  d.audit_status = #{auditStatus,jdbcType=INTEGER}
+	</if>
+	<if test="province != null">
+		and  oi.licence_province = #{province,jdbcType=INTEGER}
+	</if>
+	<if test="name != null">
+		and  d.name like CONCAT('%',#{name,jdbcType=VARCHAR},'%')
+	</if>
+	<if test="keyword != null">
+		and  d.keyword like "%"#{keyword,jdbcType=VARCHAR}"%"
+	</if>
+	<if test="unitName != null">
+		and  oi.unit_name like CONCAT('%',#{unitName,jdbcType=VARCHAR},'%')
+	</if>
+	<if test="employerName != null">
+		and  d.employer_name like CONCAT('%',#{employerName,jdbcType=VARCHAR},'%')
+		and  (d.employer_id is null or d.employer_id='')
+	</if>
+	<if test="infoSources != null">
+		and  d.info_sources = #{infoSources,jdbcType=INTEGER}
+	</if>
+	<if test="demandType != null">
+		and  d.demand_type = #{demandType,jdbcType=INTEGER}
+	</if>
+	<if test="status != null">
+		and  d.status = #{status,jdbcType=VARCHAR}
+	</if>
+	<if test="releaseStatus != null">
+		and  d.release_status = #{releaseStatus,jdbcType=VARCHAR}
+	</if>
+	<if test="vStart != null">
+	   and d.validity_period <![CDATA[ >= ]]> #{vStart,jdbcType=TIMESTAMP}
+	</if>
+	<if test="vEnd != null">
+	   and d.validity_period <![CDATA[ < ]]> #{vEnd,jdbcType=TIMESTAMP}
+	</if>
+	<if test="rStart != null">
+       and	d.release_date <![CDATA[ >= ]]> #{rStart,jdbcType=TIMESTAMP}
+	</if>
+	<if test="rEnd != null">
+	   and d.release_date <![CDATA[ < ]]> #{rEnd,jdbcType=TIMESTAMP}
+	</if>
+  </select>
+  
+  <select id="selectUserDemandDetail" parameterType="java.lang.String" resultType="com.goafanti.demand.bo.DemandManageDetailBo">
+  	select 
+  		d.id, d.serial_number as serialNumber, d.data_category as dataCategory,
+  		d.name, d.keyword, d.info_sources as infoSources,
+  		ui.username, d.demand_type as demandType, d.validity_period as validityPeriod,
+  		ui.province, d.status, d.release_status as releaseStatus,
+  		d.release_date as releaseDate, d.principal_id as principalId, d.industry_category_a as industryCategoryA,
+  		d.industry_category_b as industryCategoryB, d.problem_des as problemDes, d.technical_requirements as technicalRequirements,
+  		d.picture_url as pictureUrl, d.text_file_url as textFileUrl, d.video_url as videoUrl,
+  		d.budget_cost as budgetCost, d.fixed_cycle as fixedCycle, d.people_number as peopleNumber,
+  		d.fixed_scheme as fixedScheme, d.cost_escrow as costEscrow, d.employer_id as employerId,
+  		info.postal_address as address, u.email as mailbox,  u.mobile as mobile, d.audit_status as auditStatus,
+  		d.employer_address as employerAddress, d.employer_contacts_mobile as employerContactsMobile,
+  		d.employer_contacts_mailbox as employerContactsMailbox, d.employer_name as employerName,
+  		d.tech_broker_id as techBrokerId,  u.mobile as contactsName
+  	from demand d 
+  	left join user_identity ui on ui.uid = d.employer_id
+  	left join user_info info on info.uid = d.employer_id
+  	left join user u on u.id = d.employer_id
+  	where d.data_category = 0 and d.id = #{id,jdbcType=VARCHAR}
+  </select>
+  
+  
+   <select id="selectOrgDemandDetail" parameterType="java.lang.String" resultType="com.goafanti.demand.bo.DemandManageDetailBo">
+  	select 
+  		d.id, d.serial_number as serialNumber, d.data_category as dataCategory,
+  		d.name, d.keyword, d.info_sources as infoSources,
+  		oi.unit_name as username, d.demand_type as demandType, d.validity_period as validityPeriod,
+  		oi.licence_province as province, d.status, d.release_status as releaseStatus,
+  		d.release_date as releaseDate, d.principal_id as principalId, d.industry_category_a as industryCategoryA,
+  		d.industry_category_b as industryCategoryB, d.problem_des as problemDes, d.technical_requirements as technicalRequirements,
+  		d.picture_url as pictureUrl, d.text_file_url as textFileUrl, d.video_url as videoUrl,
+  		d.budget_cost as budgetCost, d.fixed_cycle as fixedCycle, d.people_number as peopleNumber,
+  		d.fixed_scheme as fixedScheme, d.cost_escrow as costEscrow, d.employer_id as employerId,
+  		oi.postal_address as address, u.email as mailbox,  d.contacts, d.audit_status as auditStatus,
+  		d.tech_broker_id as techBrokerId,
+  		d.employer_address as employerAddress, d.employer_contacts_mobile as employerContactsMobile,
+  		d.employer_contacts_mailbox as employerContactsMailbox, d.employer_name as employerName,d.boutique
+  	from demand d 
+  	left join organization_identity oi on oi.uid = d.employer_id
+  	left join user u on u.id = d.employer_id
+  	where d.data_category = 1 and d.id = #{id,jdbcType=VARCHAR}
+  </select>
+  
+  <update id="batchDeleteByPrimaryKey" parameterType="java.util.List">
+  	update demand set deleted_sign = 1
+  	where  id in 
+	<foreach item="item"  collection="list" open="(" separator="," close=")">
+		#{item}
+	</foreach>
+  </update>
+  
+  <update id="updateReleaseDate" parameterType="java.lang.String">
+  	update demand set release_date = null
+  	where id = #{id,jdbcType=VARCHAR}
+  </update>
+  
+  <select id="findDemandListByPage" parameterType="String" resultType="com.goafanti.demand.bo.DemandListBo">
+  		select 
+	  d.id, d.serial_number as serialNumber, d.data_category as dataCategory, 
+	  d.name, d.keyword, d.demand_type as demandType, 
+	  d.validity_period as validityPeriod, d.status, d.release_status as releaseStatus, 
+	  d.release_date as releaseDate, d.employer_id as employerId, d.audit_status as auditStatus
+	from  demand d 
+	where d.deleted_sign = 0 
+	and d.employer_id = #{employerId, jdbcType=VARCHAR}
+	<if test="serialNumber != null">
+		and  d.serial_number = #{serialNumber,jdbcType=INTEGER}
+	</if>
+	<if test="auditStatus != null">
+		and  d.audit_status = #{auditStatus,jdbcType=INTEGER}
+	</if>
+	<if test="name != null">
+		and  d.name like CONCAT('%',#{name,jdbcType=VARCHAR},'%')
+	</if>
+	<if test="keyword != null">
+		and  d.keyword like "%"#{keyword,jdbcType=VARCHAR}"%"
+	</if>
+	<if test="demandType != null">
+		and  d.demand_type = #{demandType,jdbcType=INTEGER}
+	</if>
+	<if test="status != null">
+		and  d.status = #{status,jdbcType=VARCHAR}
+	</if>
+	<if test="releaseStatus != null">
+		and  d.release_status = #{releaseStatus,jdbcType=VARCHAR}
+	</if>
+	<if test="vStart != null">
+	   and d.validity_period <![CDATA[ >= ]]> #{vStart,jdbcType=TIMESTAMP}
+	</if>
+	<if test="vEnd != null">
+	   and d.validity_period <![CDATA[ < ]]> #{vEnd,jdbcType=TIMESTAMP}
+	</if>
+	<if test="rStart != null">
+       and	d.release_date <![CDATA[ >= ]]> #{rStart,jdbcType=TIMESTAMP}
+	</if>
+	<if test="rEnd != null">
+	   and d.release_date <![CDATA[ < ]]> #{rEnd,jdbcType=TIMESTAMP}
+	</if>
+  	order by d.serial_number desc
+  	<if test="page_sql!=null">
+		${page_sql}
+	</if>
+  </select>
+  
+  <select id="findDemandCount" parameterType="String" resultType="java.lang.Integer">
+  		select count(1)
+	from  demand d 
+	where d.deleted_sign = 0 
+	and d.employer_id = #{employerId, jdbcType=VARCHAR}
+	<if test="serialNumber != null">
+		and  d.serial_number = #{serialNumber,jdbcType=INTEGER}
+	</if>
+	<if test="auditStatus != null">
+		and  d.audit_status = #{auditStatus,jdbcType=INTEGER}
+	</if>
+	<if test="name != null">
+		and  d.name like CONCAT('%',#{name,jdbcType=VARCHAR},'%')
+	</if>
+	<if test="keyword != null">
+		and  d.keyword like "%"#{keyword,jdbcType=VARCHAR}"%"
+	</if>
+	<if test="demandType != null">
+		and  d.demand_type = #{demandType,jdbcType=INTEGER}
+	</if>
+	<if test="status != null">
+		and  d.status = #{status,jdbcType=VARCHAR}
+	</if>
+	<if test="releaseStatus != null">
+		and  d.release_status = #{releaseStatus,jdbcType=VARCHAR}
+	</if>
+	<if test="vStart != null">
+	   and d.validity_period <![CDATA[ >= ]]> #{vStart,jdbcType=TIMESTAMP}
+	</if>
+	<if test="vEnd != null">
+	   and d.validity_period <![CDATA[ < ]]> #{vEnd,jdbcType=TIMESTAMP}
+	</if>
+	<if test="rStart != null">
+       and	d.release_date <![CDATA[ >= ]]> #{rStart,jdbcType=TIMESTAMP}
+	</if>
+	<if test="rEnd != null">
+	   and  d.release_date <![CDATA[ < ]]> #{rEnd,jdbcType=TIMESTAMP}
+	</if>
+  </select>
+  
+  <insert id="insertBatch" parameterType="com.goafanti.common.model.Demand">
+    insert into demand 
+    	(id, deleted_sign, audit_status, 
+    	status, release_status, create_time, 
+    	keyword, data_category, name,
+    	demand_type, problem_des, employer_name,
+    	employer_contacts, employer_contacts_mobile, employer_contacts_mailbox, info_sources)
+    values 
+    <foreach item="item" index="index" collection="list" separator=",">
+      (
+      	#{item.id,jdbcType=VARCHAR}, #{item.deletedSign,jdbcType=INTEGER}, #{item.auditStatus,jdbcType=INTEGER},
+      	#{item.status,jdbcType=INTEGER}, #{item.releaseStatus,jdbcType=INTEGER}, #{item.createTime,jdbcType=TIMESTAMP},
+      	#{item.keyword,jdbcType=VARCHAR}, #{item.dataCategory,jdbcType=INTEGER}, #{item.name,jdbcType=VARCHAR},
+      	#{item.demandType,jdbcType=INTEGER}, #{item.problemDes,jdbcType=VARCHAR}, #{item.employerName,jdbcType=VARCHAR},
+      	#{item.employerContacts,jdbcType=VARCHAR}, #{item.employerContactsMobile,jdbcType=VARCHAR}, #{item.employerContactsMailbox,jdbcType=VARCHAR},
+      	#{item.infoSources,jdbcType=INTEGER}
+      )
+    </foreach>
+  </insert>
+  
+  <select id="findSearchDemandListByPage" parameterType="String" resultType="com.goafanti.portal.bo.DemandSearchListBo">
+  	select 
+	  		d.id, d.name, d.keyword,
+	  		d.serial_number as serialNumber, d.data_category as dataCategory, d.industry_category_a as industryCategoryA,
+	  		d.industry_category_b as industryCategoryB, d.demand_type as demandType, d.budget_cost as budgetCost,
+	  		d.problem_des as problemDes, d.release_date as releaseDate, d.employer_name as employerName,
+	  	 u.lvl as level
+  		from demand d
+  		left join user u on u.id = d.employer_id
+  		where d.deleted_sign = 0 and d.status = 0
+  		<if test="keyword != null">
+  			and d.keyword like "%"#{keyword,jdbcType=VARCHAR}"%"
+  		</if>
+  		<if test="industryCategoryA != null">
+  			and d.industry_category_a = #{industryCategoryA,jdbcType=INTEGER}
+  		</if>
+  		<if test="industryCategoryB != null">
+  			and d.industry_category_b = #{industryCategoryB,jdbcType=INTEGER}
+  		</if>
+  		<if test="budgetCostLower != null">
+  			and d.budget_cost <![CDATA[ >= ]]> #{budgetCostLower,jdbcType=DECIMAL}
+  		</if>
+  		<if test="budgetCostUpper != null">
+  			and d.budget_cost <![CDATA[ <= ]]> #{budgetCostUpper,jdbcType=DECIMAL}
+  		</if>
+  		<if test="demandType != null">
+  			and d.demand_type = #{demandType,jdbcType=INTEGER}
+  		</if>
+  		<if test="sign == 1">
+  			and d.budget_cost is null
+  		</if>
+  		and d.deleted_sign = 0 
+  		and d.release_status = 1
+  		and d.audit_status = 3
+  		<if test="dateSort == 0">
+  			order by d.release_date asc
+  		</if>
+  		<if test="dateSort == 1">
+  			order by d.release_date desc
+  		</if>
+  	<if test="page_sql!=null">
+		${page_sql}
+	</if>
+  </select>
+  
+  <select id="findSearchDemandCount" parameterType="String" resultType="java.lang.Integer">
+  	select 
+  		count(1)
+  	from demand d
+  	where d.deleted_sign = 0 and d.status = 0
+  	<if test="keyword != null">
+  			and d.keyword like "%"#{keyword,jdbcType=VARCHAR}"%"
+  		</if>
+  		<if test="industryCategoryA != null">
+  			and d.industry_category_a = #{industryCategoryA,jdbcType=INTEGER}
+  		</if>
+  		<if test="industryCategoryB != null">
+  			and d.industry_category_b = #{industryCategoryB,jdbcType=INTEGER}
+  		</if>
+  		<if test="budgetCostLower != null">
+  			and d.budget_cost <![CDATA[ >= ]]> #{budgetCostLower,jdbcType=DECIMAL}
+  		</if>
+  		<if test="budgetCostUpper != null">
+  			and d.budget_cost <![CDATA[ <= ]]> #{budgetCostUpper,jdbcType=DECIMAL}
+  		</if>
+  		<if test="demandType != null">
+  			and d.demand_type = #{demandType,jdbcType=INTEGER}
+  		</if>
+  		<if test="sign == 1">
+  			and d.budget_cost is null
+  		</if>
+  		and d.deleted_sign = 0 
+  		and d.release_status = 1
+  		and d.audit_status = 3
+  </select>
+  
+  <select id="selectDemandSearchDetail" parameterType="java.lang.String" resultType="com.goafanti.portal.bo.DemandSearchDetailBo"> 
+  	select 
+  		d.id, 
+  		d.employer_name as employerName,
+  		d.serial_number as serialNumber, 
+  		d.keyword, 
+  		d.data_category as dataCategory, 
+  		d.name, 
+  		d.industry_category_a as industryCategoryA,
+  		d.industry_category_b as industryCategoryB, 
+  		d.demand_type as demandType, 
+  		d.budget_cost as budgetCost,
+  		d.problem_des as problemDes, 
+  		d.release_date as releaseDate, 
+  		d.technical_requirements as technicalRequirements,
+  		d.picture_url as pictureUrl, 
+  		d.text_file_url as textFileUrl, 
+  		d.video_url as videoUrl,
+  		d.fixed_cycle as fixedCycle, 
+  		d.people_number as peopleNumber, 
+  		d.fixed_scheme as fixedScheme,
+  		d.cost_escrow as costEscrow, 
+  		d.validity_period as validityPeriod, 
+  		ui.username,
+  		oi.unit_name as unitName, 
+  		di.id as demandInterestId, 
+  		do.id as demandOrderId, 
+  		do.status as orderStatus
+  	from demand d
+  	left join user_identity ui on ui.uid = d.employer_id
+  	left join organization_identity oi on oi.uid = d.employer_id
+  	left join demand_interest di on di.demand_id = d.id and di.uid = #{0}
+  	left join demand_order do on do.demand_id = d.id and do.uid = #{0} and do.status <![CDATA[ <> ]]> 6
+  	where d.id = #{1}
+  </select>
+  
+  <select id="findDemandNumByUid" parameterType="java.lang.String" resultType="java.lang.Integer">
+  	select 
+  		count(1)
+  	from demand
+  	where 
+  		deleted_sign = 0
+  	and release_status = 1
+  	and audit_status = 3
+  	and employer_id = #{uid,jdbcType=VARCHAR}
+  </select>
+  
+  <select id="findPartnerDemandListByPage" parameterType="java.lang.String" resultType="com.goafanti.demand.bo.DemandPartnerListBo">
+		SELECT
 		id,
 		serial_number AS serialNumber,
 		data_category AS