FreemarketMapper.xml 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  3. <mapper namespace="cn.chinaunicom.omniFlowNetCompute.mapper.FreemarketMapper">
  4. <resultMap type="cn.chinaunicom.omniFlowNetCompute.domain.Freemarket" id="FreemarketResult">
  5. <id property="id" column="id" />
  6. <result property="announcementType" column="announcement_type" />
  7. <result property="announcementTitle" column="announcement_title" />
  8. <result property="projectCode" column="project_code" />
  9. <result property="isRelevant" column="is_relevant" />
  10. <result property="purchaseUnit" column="purchase_unit" />
  11. <result property="finalUser" column="final_user" />
  12. <result property="naturalCustomerId" column="natural_customer_id" />
  13. <result property="customerGroup" column="customer_group" />
  14. <result property="category" column="category" />
  15. <result property="projectName" column="project_name" />
  16. <result property="tenderAgent" column="tender_agent" />
  17. <result property="tenderAgentPhone" column="tender_agent_phone" />
  18. <result property="matchKeywords" column="match_keywords" />
  19. <result property="bidDocumentDeadline" column="bid_document_deadline" />
  20. <result property="bidOpeningDate" column="bid_opening_date" />
  21. <result property="announcementUrl" column="announcement_url" />
  22. <result property="jianyuUrl" column="jianyu_url" />
  23. <result property="budget" column="budget" />
  24. <result property="tenderInfoPublishTime" column="tender_info_publish_time" />
  25. <result property="branchCompany" column="branch_company" />
  26. <result property="industry" column="industry" />
  27. <result property="businessCategory" column="business_category" />
  28. <result property="businessDemand" column="business_demand" />
  29. <result property="opportunityId" column="opportunity_id" />
  30. <result property="isParticipate" column="is_participate" />
  31. <result property="notParticipateReason" column="not_participate_reason" />
  32. <result property="isAware" column="is_aware" />
  33. <result property="rbgLabel" column="rbg_label" />
  34. <result property="discardApprovalNumber" column="discard_approval_number" />
  35. <result property="publishTime" column="publish_time" />
  36. <result property="createTime" column="create_time" />
  37. <result property="updateTime" column="update_time" />
  38. <result property="dataSource" column="data_source" />
  39. </resultMap>
  40. <!-- 共享的ResultMap,两个Mapper都可以引用 -->
  41. <resultMap type="cn.chinaunicom.omniFlowNetCompute.pojo.OpportunityFreemarketVO"
  42. id="OpportunityFreemarketResult">
  43. <!-- ========== Opportunity 字段映射 ========== -->
  44. <result property="oppId" column="opp_id" />
  45. <result property="opportunityCode" column="opportunity_code" />
  46. <result property="opportunityName" column="opportunity_name" />
  47. <result property="oppNaturalCustomerId" column="opp_natural_customer_id" />
  48. <result property="oppNaturalCustomerName" column="opp_natural_customer_name" />
  49. <result property="estimatedContractAmount" column="estimated_contract_amount" />
  50. <result property="estimatedSignDate" column="estimated_sign_date" />
  51. <result property="opportunityOwner" column="opportunity_owner" />
  52. <result property="opportunityUnit" column="opportunity_unit" />
  53. <result property="supportPerson" column="support_person" />
  54. <result property="supportUnit" column="support_unit" />
  55. <result property="customerRequirement" column="customer_requirement" />
  56. <result property="supportDepartment" column="support_department" />
  57. <result property="customerFundSource" column="customer_fund_source" />
  58. <result property="fillTime" column="fill_time" />
  59. <result property="opportunityStage" column="opportunity_stage" />
  60. <result property="establishTime" column="establish_time" />
  61. <!-- ========== Freemarket 字段映射 ========== -->
  62. <result property="fmId" column="fm_id" />
  63. <result property="announcementType" column="announcement_type" />
  64. <result property="announcementTitle" column="announcement_title" />
  65. <result property="projectCode" column="project_code" />
  66. <result property="isRelevant" column="is_relevant" />
  67. <result property="purchaseUnit" column="purchase_unit" />
  68. <result property="finalUser" column="final_user" />
  69. <result property="fmNaturalCustomerId" column="fm_natural_customer_id" />
  70. <result property="customerGroup" column="customer_group" />
  71. <result property="category" column="category" />
  72. <result property="projectName" column="project_name" />
  73. <result property="tenderAgent" column="tender_agent" />
  74. <result property="tenderAgentPhone" column="tender_agent_phone" />
  75. <result property="matchKeywords" column="match_keywords" />
  76. <result property="bidDocumentDeadline" column="bid_document_deadline" />
  77. <result property="bidOpeningDate" column="bid_opening_date" />
  78. <result property="announcementUrl" column="announcement_url" />
  79. <result property="jianyuUrl" column="jianyu_url" />
  80. <result property="budget" column="budget" />
  81. <result property="tenderInfoPublishTime" column="tender_info_publish_time" />
  82. <result property="branchCompany" column="branch_company" />
  83. <result property="industry" column="industry" />
  84. <result property="businessCategory" column="business_category" />
  85. <result property="businessDemand" column="business_demand" />
  86. <result property="opportunityId" column="opportunity_id" />
  87. <result property="isParticipate" column="is_participate" />
  88. <result property="notParticipateReason" column="not_participate_reason" />
  89. <result property="isAware" column="is_aware" />
  90. <result property="rbgLabel" column="rbg_label" />
  91. <result property="discardApprovalNumber" column="discard_approval_number" />
  92. <result property="publishTime" column="publish_time" />
  93. <result property="fmCreateTime" column="fm_create_time" />
  94. <result property="fmUpdateTime" column="fm_update_time" />
  95. </resultMap>
  96. <!-- 通用查询字段 -->
  97. <sql id="Base_Column_List">
  98. id, announcement_type, announcement_title, project_code, is_relevant, purchase_unit, final_user,
  99. natural_customer_id, customer_group, category, project_name, tender_agent, tender_agent_phone,
  100. match_keywords, bid_document_deadline, bid_opening_date, announcement_url, jianyu_url, budget,
  101. tender_info_publish_time, branch_company, industry, business_category, business_demand,
  102. opportunity_id, is_participate, not_participate_reason, is_aware, rbg_label, discard_approval_number,
  103. publish_time, create_time, update_time, data_source
  104. </sql>
  105. <!-- ========== 核心SQL 1:详情页查询 - 根据主键ID查询单条详情数据 ========== -->
  106. <select id="selectById" parameterType="java.lang.Long" resultMap="FreemarketResult">
  107. SELECT
  108. <include refid="Base_Column_List"/>
  109. FROM project_announcement
  110. WHERE id = #{id}
  111. </select>
  112. <!-- ========== 核心SQL 2:列表页查询 - 分页+多条件模糊查询(最常用) ========== -->
  113. <select id="selectPageByCondition" parameterType="cn.chinaunicom.omniFlowNetCompute.domain.Freemarket" resultMap="FreemarketResult">
  114. SELECT
  115. <include refid="Base_Column_List"/>
  116. FROM freemarket
  117. WHERE 1=1
  118. <!-- 公告标题 模糊查询 -->
  119. <if test="announcementTitle != null and announcementTitle != ''">
  120. AND announcement_title LIKE CONCAT('%',#{announcementTitle},'%')
  121. </if>
  122. <!-- 项目编号 精准查询 -->
  123. <if test="projectName != null and projectName != ''">
  124. AND project_name LIKE CONCAT('%',#{projectName},'%')
  125. </if>
  126. <!-- 是否相关 精准查询 -->
  127. <if test="isRelevant != null">
  128. AND is_relevant = #{isRelevant}
  129. </if>
  130. <!-- 分公司 -->
  131. <if test="branchCompany != null and branchCompany != ''">
  132. AND branch_company = #{branchCompany}
  133. </if>
  134. <!-- 是否参与 精准查询 -->
  135. <if test="isParticipate != null">
  136. AND is_participate = #{isParticipate}
  137. </if>
  138. <if test="category != null and category != '' ">
  139. AND category = #{category}
  140. </if>
  141. <if test="dataSource != null and dataSource != '' ">
  142. AND data_source = #{dataSource}
  143. </if>
  144. <if test="announcementType != null and announcementType != ''">
  145. AND announcement_type = #{announcementType}
  146. </if>
  147. <if test="customerGroup != null and customerGroup != ''">
  148. AND customer_group = #{customerGroup}
  149. </if>
  150. <if test="bidOpeningDateStart != null and bidOpeningDateEnd != null">
  151. AND bid_opening_date BETWEEN #{bidOpeningDateStart} AND #{bidOpeningDateEnd}
  152. </if>
  153. <if test="publishTimeStart != null and publishTimeEnd != null">
  154. AND publish_time BETWEEN #{publishTimeStart} AND #{publishTimeEnd}
  155. </if>
  156. <if test="createTimeStart != null and createTimeEnd != null">
  157. AND create_time BETWEEN #{createTimeStart} AND #{createTimeEnd}
  158. </if>
  159. <!-- 排序:按创建时间倒序,最新的在前面 -->
  160. ORDER BY create_time DESC
  161. </select>
  162. <select id="selectFreemarketById" parameterType="Long"
  163. resultMap="OpportunityFreemarketResult">
  164. SELECT
  165. f.id as fm_id,
  166. f.announcement_type,
  167. f.announcement_title,
  168. f.project_code,
  169. f.is_relevant,
  170. f.purchase_unit,
  171. f.final_user,
  172. f.natural_customer_id as fm_natural_customer_id,
  173. f.customer_group,
  174. f.category,
  175. f.project_name,
  176. f.tender_agent,
  177. f.tender_agent_phone,
  178. f.match_keywords,
  179. f.bid_document_deadline,
  180. f.bid_opening_date,
  181. f.announcement_url,
  182. f.jianyu_url,
  183. f.budget,
  184. f.tender_info_publish_time,
  185. f.branch_company,
  186. f.industry,
  187. f.business_category,
  188. f.business_demand,
  189. f.opportunity_id,
  190. f.is_participate,
  191. f.not_participate_reason,
  192. f.is_aware,
  193. f.rbg_label,
  194. f.discard_approval_number,
  195. f.publish_time,
  196. f.create_time as fm_create_time,
  197. f.update_time as fm_update_time,
  198. f.data_source as dataSource,
  199. o.id as opp_id,
  200. o.opportunity_code,
  201. o.opportunity_name,
  202. o.natural_customer_id as opp_natural_customer_id,
  203. o.natural_customer_name as opp_natural_customer_name,
  204. o.estimated_contract_amount,
  205. o.estimated_sign_date,
  206. o.opportunity_owner,
  207. o.opportunity_unit,
  208. o.support_person,
  209. o.support_unit,
  210. o.customer_requirement,
  211. o.support_department,
  212. o.customer_fund_source,
  213. o.fill_time,
  214. o.opportunity_stage,
  215. o.establish_time
  216. FROM freemarket f
  217. LEFT JOIN opportunity o ON f.opportunity_id = o.id
  218. WHERE f.id = #{id}
  219. </select>
  220. <insert id="insertFreemarket" parameterType="cn.chinaunicom.omniFlowNetCompute.domain.Freemarket" useGeneratedKeys="true" keyProperty="id">
  221. insert into freemarket (
  222. announcement_type,
  223. announcement_title,
  224. project_code,
  225. is_relevant,
  226. purchase_unit,
  227. final_user,
  228. natural_customer_id,
  229. customer_group,
  230. category,
  231. project_name,
  232. tender_agent,
  233. tender_agent_phone,
  234. match_keywords,
  235. bid_document_deadline,
  236. bid_opening_date,
  237. announcement_url,
  238. jianyu_url,
  239. budget,
  240. tender_info_publish_time,
  241. branch_company,
  242. industry,
  243. business_category,
  244. business_demand,
  245. opportunity_id,
  246. is_participate,
  247. not_participate_reason,
  248. is_aware,
  249. rbg_label,
  250. discard_approval_number,
  251. publish_time
  252. ) values (
  253. #{announcementType},
  254. #{announcementTitle},
  255. #{projectCode},
  256. #{isRelevant},
  257. #{purchaseUnit},
  258. #{finalUser},
  259. #{naturalCustomerId},
  260. #{customerGroup},
  261. #{category},
  262. #{projectName},
  263. #{tenderAgent},
  264. #{tenderAgentPhone},
  265. #{matchKeywords},
  266. #{bidDocumentDeadline},
  267. #{bidOpeningDate},
  268. #{announcementUrl},
  269. #{jianyuUrl},
  270. #{budget},
  271. #{tenderInfoPublishTime},
  272. #{branchCompany},
  273. #{industry},
  274. #{businessCategory},
  275. #{businessDemand},
  276. #{opportunityId},
  277. #{isParticipate},
  278. #{notParticipateReason},
  279. #{isAware},
  280. #{rbgLabel},
  281. #{discardApprovalNumber},
  282. #{publishTime}
  283. )
  284. </insert>
  285. <update id="updateFreemarket" parameterType="cn.chinaunicom.omniFlowNetCompute.domain.Freemarket">
  286. update freemarket
  287. <set>
  288. <if test="announcementType != null">announcement_type = #{announcementType},</if>
  289. <if test="announcementTitle != null">announcement_title = #{announcementTitle},</if>
  290. <if test="projectCode != null">project_code = #{projectCode},</if>
  291. <if test="isRelevant != null">is_relevant = #{isRelevant},</if>
  292. <if test="purchaseUnit != null">purchase_unit = #{purchaseUnit},</if>
  293. <if test="finalUser != null">final_user = #{finalUser},</if>
  294. <if test="naturalCustomerId != null">natural_customer_id = #{naturalCustomerId},</if>
  295. <if test="customerGroup != null">customer_group = #{customerGroup},</if>
  296. <if test="category != null">category = #{category},</if>
  297. <if test="projectName != null">project_name = #{projectName},</if>
  298. <if test="tenderAgent != null">tender_agent = #{tenderAgent},</if>
  299. <if test="tenderAgentPhone != null">tender_agent_phone = #{tenderAgentPhone},</if>
  300. <if test="matchKeywords != null">match_keywords = #{matchKeywords},</if>
  301. <if test="bidDocumentDeadline != null">bid_document_deadline = #{bidDocumentDeadline},</if>
  302. <if test="bidOpeningDate != null">bid_opening_date = #{bidOpeningDate},</if>
  303. <if test="announcementUrl != null">announcement_url = #{announcementUrl},</if>
  304. <if test="jianyuUrl != null">jianyu_url = #{jianyuUrl},</if>
  305. <if test="budget != null">budget = #{budget},</if>
  306. <if test="tenderInfoPublishTime != null">tender_info_publish_time = #{tenderInfoPublishTime},</if>
  307. <if test="branchCompany != null">branch_company = #{branchCompany},</if>
  308. <if test="industry != null">industry = #{industry},</if>
  309. <if test="businessCategory != null">business_category = #{businessCategory},</if>
  310. <if test="businessDemand != null">business_demand = #{businessDemand},</if>
  311. <if test="opportunityId != null">opportunity_id = #{opportunityId},</if>
  312. <if test="isParticipate != null">is_participate = #{isParticipate},</if>
  313. <if test="notParticipateReason != null">not_participate_reason = #{notParticipateReason},</if>
  314. <if test="isAware != null">is_aware = #{isAware},</if>
  315. <if test="rbgLabel != null">rbg_label = #{rbgLabel},</if>
  316. <if test="discardApprovalNumber != null">discard_approval_number = #{discardApprovalNumber},</if>
  317. <if test="publishTime != null">publish_time = #{publishTime},</if>
  318. </set>
  319. where id = #{id}
  320. </update>
  321. <delete id="deleteFreemarketById" parameterType="Long">
  322. delete from freemarket where id = #{id}
  323. </delete>
  324. <delete id="deleteFreemarketByIds" parameterType="Long">
  325. delete from freemarket where id in
  326. <foreach item="id" collection="array" open="(" separator="," close=")">
  327. #{id}
  328. </foreach>
  329. </delete>
  330. </mapper>