DemandMapper.xml 52 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241
  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="com.goafanti.common.dao.DemandMapper" >
  4. <resultMap id="BaseResultMap" type="com.goafanti.common.model.Demand" >
  5. <id column="id" property="id" jdbcType="VARCHAR" />
  6. <result column="serial_number" property="serialNumber" jdbcType="INTEGER" />
  7. <result column="data_category" property="dataCategory" jdbcType="INTEGER" />
  8. <result column="name" property="name" jdbcType="VARCHAR" />
  9. <result column="keyword" property="keyword" jdbcType="VARCHAR" />
  10. <result column="info_sources" property="infoSources" jdbcType="INTEGER" />
  11. <result column="industry_category_a" property="industryCategoryA" jdbcType="INTEGER" />
  12. <result column="industry_category_b" property="industryCategoryB" jdbcType="INTEGER" />
  13. <result column="industry_category_c" property="industryCategoryC" jdbcType="INTEGER" />
  14. <result column="demand_type" property="demandType" jdbcType="INTEGER" />
  15. <result column="problem_des" property="problemDes" jdbcType="LONGVARCHAR" />
  16. <result column="technical_requirements" property="technicalRequirements" jdbcType="VARCHAR" />
  17. <result column="picture_url" property="pictureUrl" jdbcType="LONGVARCHAR" />
  18. <result column="text_file_url" property="textFileUrl" jdbcType="VARCHAR" />
  19. <result column="video_url" property="videoUrl" jdbcType="VARCHAR" />
  20. <result column="fixed_budget" property="fixedBudget" jdbcType="DECIMAL" />
  21. <result column="fixed_cycle" property="fixedCycle" jdbcType="VARCHAR" />
  22. <result column="people_number" property="peopleNumber" jdbcType="INTEGER" />
  23. <result column="fixed_scheme" property="fixedScheme" jdbcType="VARCHAR" />
  24. <result column="cost_escrow" property="costEscrow" jdbcType="DECIMAL" />
  25. <result column="budget_cost" property="budgetCost" jdbcType="DECIMAL" />
  26. <result column="validity_period" property="validityPeriod" jdbcType="TIMESTAMP" />
  27. <result column="employer_id" property="employerId" jdbcType="VARCHAR" />
  28. <result column="employer_name" property="employerName" jdbcType="VARCHAR" />
  29. <result column="employer_address" property="employerAddress" jdbcType="VARCHAR" />
  30. <result column="employer_contacts" property="employerContacts" jdbcType="VARCHAR" />
  31. <result column="employer_contacts_mobile" property="employerContactsMobile" jdbcType="VARCHAR" />
  32. <result column="employer_contacts_mailbox" property="employerContactsMailbox" jdbcType="VARCHAR" />
  33. <result column="contacts" property="contacts" jdbcType="VARCHAR" />
  34. <result column="status" property="status" jdbcType="INTEGER" />
  35. <result column="release_status" property="releaseStatus" jdbcType="INTEGER" />
  36. <result column="release_date" property="releaseDate" jdbcType="TIMESTAMP" />
  37. <result column="create_time" property="createTime" jdbcType="TIMESTAMP" />
  38. <result column="principal_id" property="principalId" jdbcType="VARCHAR" />
  39. <result column="deleted_sign" property="deletedSign" jdbcType="INTEGER" />
  40. <result column="audit_status" property="auditStatus" jdbcType="INTEGER" />
  41. <result column="tech_broker_id" property="techBrokerId" jdbcType="VARCHAR" />
  42. <result column="boutique" property="boutique" jdbcType="INTEGER" />
  43. <result column="uid" property="uid" jdbcType="VARCHAR" />
  44. <result column="urgent_days" property="urgentDays" jdbcType="INTEGER" />
  45. <result column="urgent_money" property="urgentMoney" jdbcType="DECIMAL" />
  46. <result column="picture_url_min" property="pictureUrlMin" jdbcType="VARCHAR" />
  47. </resultMap>
  48. <sql id="Base_Column_List" >
  49. id, serial_number, data_category, name, keyword, info_sources, industry_category_a,
  50. industry_category_b, industry_category_c, demand_type, problem_des, technical_requirements,
  51. picture_url, text_file_url, video_url, fixed_budget, fixed_cycle, people_number,
  52. fixed_scheme, cost_escrow, budget_cost, validity_period, employer_id, employer_name,
  53. employer_address, employer_contacts, employer_contacts_mobile, employer_contacts_mailbox,
  54. contacts, status, release_status, release_date, create_time, principal_id, deleted_sign,
  55. audit_status, tech_broker_id,boutique,urgent_money,urgent_days,picture_url_min
  56. </sql>
  57. <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.String" >
  58. select
  59. <include refid="Base_Column_List" />
  60. from demand
  61. where id = #{id,jdbcType=VARCHAR}
  62. </select>
  63. <select id="selectAppByPrimaryKey" resultType="com.goafanti.demand.bo.AppDemandBo" parameterType="java.lang.String" >
  64. select
  65. d.id, d.serial_number AS serialNumber, d.data_category AS dataCategory, d.name, d.keyword,d.budget_cost as budgetCost,
  66. d.info_sources AS infoSources, d.industry_category_a AS fieldA,d.industry_category_b AS fieldB,f.name as field1,
  67. f2.name as field2,d.is_hot as isHot,d.release_date as releaseDate,d.demand_type as demandType,d.name,
  68. d.problem_des as problemDes,d.picture_url as pictureUrl,d.release_status as releaseStatus,d.audit_status as auditStatus,
  69. d.fixed_budget as fixedBudget,d.crowd_cost as crowdCost,ifnull(i.y,0) as interestCount,if(isnull(a.demand_id),0,1) as interest,ifnull(t.count,0) as orderCount,
  70. d.picture_url_min as pictureUrlMin,us.nickname as ownerName,us.mobile as ownerMobile
  71. from demand d
  72. left join `user` us on d.employer_id=us.id
  73. left join (select b.commodity_id as id,count(*) as count from jt_order a left join jt_order_detail b on a.order_no=b.order_no
  74. GROUP by b.commodity_id) t on d.id=t.id
  75. left join (select count(0) as y,demand_id from demand_interest
  76. group by demand_id ) i on d.id=i.demand_id
  77. left join (select demand_id from demand_interest where uid=#{uid,jdbcType=VARCHAR} group by demand_id) a on d.id=a.demand_id
  78. left join industry_category f on d.industry_category_a=f.id
  79. left join industry_category f2 on d.industry_category_b=f2.id
  80. where d.deleted_sign=0 and d.info_sources=1
  81. and d.id = #{id,jdbcType=VARCHAR}
  82. </select>
  83. <delete id="deleteByPrimaryKey" parameterType="java.lang.String" >
  84. delete from demand
  85. where id = #{id,jdbcType=VARCHAR}
  86. </delete>
  87. <insert id="insert" parameterType="com.goafanti.common.model.Demand" >
  88. insert into demand (id, serial_number, data_category,
  89. name, keyword, info_sources,
  90. industry_category_a, industry_category_b, industry_category_c,
  91. demand_type, problem_des, technical_requirements,
  92. picture_url, text_file_url, video_url,
  93. fixed_budget, fixed_cycle, people_number,
  94. fixed_scheme, cost_escrow, budget_cost,
  95. validity_period, employer_id, employer_name,
  96. employer_address, employer_contacts, employer_contacts_mobile,
  97. employer_contacts_mailbox, contacts, status,
  98. release_status, release_date, create_time,
  99. principal_id, deleted_sign, audit_status, tech_broker_id,boutique,remark,urgent_days,urgent_money,contact_mobile,crowd_cost,
  100. is_hot,is_urgent,research_type,picture_url_min)
  101. values (#{id,jdbcType=VARCHAR}, #{serialNumber,jdbcType=INTEGER}, #{dataCategory,jdbcType=INTEGER},
  102. #{name,jdbcType=VARCHAR}, #{keyword,jdbcType=VARCHAR}, #{infoSources,jdbcType=INTEGER},
  103. #{industryCategoryA,jdbcType=INTEGER}, #{industryCategoryB,jdbcType=INTEGER}, #{industryCategoryC,jdbcType=INTEGER},
  104. #{demandType,jdbcType=INTEGER}, #{problemDes,jdbcType=VARCHAR}, #{technicalRequirements,jdbcType=VARCHAR},
  105. #{pictureUrl,jdbcType=LONGVARCHAR}, #{textFileUrl,jdbcType=VARCHAR}, #{videoUrl,jdbcType=VARCHAR},
  106. #{fixedBudget,jdbcType=DECIMAL}, #{fixedCycle,jdbcType=VARCHAR}, #{peopleNumber,jdbcType=INTEGER},
  107. #{fixedScheme,jdbcType=VARCHAR}, #{costEscrow,jdbcType=DECIMAL}, #{budgetCost,jdbcType=DECIMAL},
  108. #{validityPeriod,jdbcType=TIMESTAMP}, #{employerId,jdbcType=VARCHAR}, #{employerName,jdbcType=VARCHAR},
  109. #{employerAddress,jdbcType=VARCHAR}, #{employerContacts,jdbcType=VARCHAR}, #{employerContactsMobile,jdbcType=VARCHAR},
  110. #{employerContactsMailbox,jdbcType=VARCHAR}, #{contacts,jdbcType=VARCHAR}, #{status,jdbcType=INTEGER},
  111. #{releaseStatus,jdbcType=INTEGER}, #{releaseDate,jdbcType=TIMESTAMP}, #{createTime,jdbcType=TIMESTAMP},
  112. #{principalId,jdbcType=VARCHAR}, #{deletedSign,jdbcType=INTEGER}, #{auditStatus,jdbcType=INTEGER},
  113. #{techBrokerId,jdbcType=VARCHAR},#{boutique,jdbcType=INTEGER},#{remark,jdbcType=VARCHAR},#{urgentDays,jdbcType=VARCHAR},#{urgentMoney,jdbcType=VARCHAR},#{contactMobile,jdbcType=VARCHAR},#{crowdCost,jdbcType=DECIMAL},
  114. #{isHot,jdbcType=INTEGER},#{isUrgent,jdbcType=INTEGER},#{researchType,jdbcType=INTEGER},#{pictureUrlMin,jdbcType=VARCHAR})
  115. </insert>
  116. <insert id="insertSelective" parameterType="com.goafanti.common.model.Demand" >
  117. insert into demand
  118. <trim prefix="(" suffix=")" suffixOverrides="," >
  119. <if test="id != null" >
  120. id,
  121. </if>
  122. <if test="serialNumber != null" >
  123. serial_number,
  124. </if>
  125. <if test="dataCategory != null" >
  126. data_category,
  127. </if>
  128. <if test="name != null" >
  129. name,
  130. </if>
  131. <if test="keyword != null" >
  132. keyword,
  133. </if>
  134. <if test="infoSources != null" >
  135. info_sources,
  136. </if>
  137. <if test="industryCategoryA != null" >
  138. industry_category_a,
  139. </if>
  140. <if test="industryCategoryB != null" >
  141. industry_category_b,
  142. </if>
  143. <if test="industryCategoryC != null" >
  144. industry_category_c,
  145. </if>
  146. <if test="demandType != null" >
  147. demand_type,
  148. </if>
  149. <if test="problemDes != null" >
  150. problem_des,
  151. </if>
  152. <if test="technicalRequirements != null" >
  153. technical_requirements,
  154. </if>
  155. <if test="pictureUrl != null" >
  156. picture_url,
  157. </if>
  158. <if test="textFileUrl != null" >
  159. text_file_url,
  160. </if>
  161. <if test="videoUrl != null" >
  162. video_url,
  163. </if>
  164. <if test="fixedBudget != null" >
  165. fixed_budget,
  166. </if>
  167. <if test="fixedCycle != null" >
  168. fixed_cycle,
  169. </if>
  170. <if test="peopleNumber != null" >
  171. people_number,
  172. </if>
  173. <if test="fixedScheme != null" >
  174. fixed_scheme,
  175. </if>
  176. <if test="costEscrow != null" >
  177. cost_escrow,
  178. </if>
  179. <if test="budgetCost != null" >
  180. budget_cost,
  181. </if>
  182. <if test="validityPeriod != null" >
  183. validity_period,
  184. </if>
  185. <if test="employerId != null" >
  186. employer_id,
  187. </if>
  188. <if test="employerName != null" >
  189. employer_name,
  190. </if>
  191. <if test="employerAddress != null" >
  192. employer_address,
  193. </if>
  194. <if test="employerContacts != null" >
  195. employer_contacts,
  196. </if>
  197. <if test="employerContactsMobile != null" >
  198. employer_contacts_mobile,
  199. </if>
  200. <if test="employerContactsMailbox != null" >
  201. employer_contacts_mailbox,
  202. </if>
  203. <if test="contacts != null" >
  204. contacts,
  205. </if>
  206. <if test="status != null" >
  207. status,
  208. </if>
  209. <if test="releaseStatus != null" >
  210. release_status,
  211. </if>
  212. <if test="releaseDate != null" >
  213. release_date,
  214. </if>
  215. <if test="createTime != null" >
  216. create_time,
  217. </if>
  218. <if test="principalId != null" >
  219. principal_id,
  220. </if>
  221. <if test="deletedSign != null" >
  222. deleted_sign,
  223. </if>
  224. <if test="auditStatus != null" >
  225. audit_status,
  226. </if>
  227. <if test="techBrokerId != null" >
  228. tech_broker_id,
  229. </if>
  230. <if test="boutique != null" >
  231. boutique,
  232. </if>
  233. <if test="remark != null" >
  234. remark,
  235. </if>
  236. <if test="pictureUrlMin != null" >
  237. picture_url_min,
  238. </if>
  239. </trim>
  240. <trim prefix="values (" suffix=")" suffixOverrides="," >
  241. <if test="id != null" >
  242. #{id,jdbcType=VARCHAR},
  243. </if>
  244. <if test="serialNumber != null" >
  245. #{serialNumber,jdbcType=INTEGER},
  246. </if>
  247. <if test="dataCategory != null" >
  248. #{dataCategory,jdbcType=INTEGER},
  249. </if>
  250. <if test="name != null" >
  251. #{name,jdbcType=VARCHAR},
  252. </if>
  253. <if test="keyword != null" >
  254. #{keyword,jdbcType=VARCHAR},
  255. </if>
  256. <if test="infoSources != null" >
  257. #{infoSources,jdbcType=INTEGER},
  258. </if>
  259. <if test="industryCategoryA != null" >
  260. #{industryCategoryA,jdbcType=INTEGER},
  261. </if>
  262. <if test="industryCategoryB != null" >
  263. #{industryCategoryB,jdbcType=INTEGER},
  264. </if>
  265. <if test="industryCategoryC != null" >
  266. #{industryCategoryC,jdbcType=INTEGER},
  267. </if>
  268. <if test="demandType != null" >
  269. #{demandType,jdbcType=INTEGER},
  270. </if>
  271. <if test="problemDes != null" >
  272. #{problemDes,jdbcType=VARCHAR},
  273. </if>
  274. <if test="technicalRequirements != null" >
  275. #{technicalRequirements,jdbcType=VARCHAR},
  276. </if>
  277. <if test="pictureUrl != null" >
  278. #{pictureUrl,jdbcType=LONGVARCHAR},
  279. </if>
  280. <if test="textFileUrl != null" >
  281. #{textFileUrl,jdbcType=VARCHAR},
  282. </if>
  283. <if test="videoUrl != null" >
  284. #{videoUrl,jdbcType=VARCHAR},
  285. </if>
  286. <if test="fixedBudget != null" >
  287. #{fixedBudget,jdbcType=DECIMAL},
  288. </if>
  289. <if test="fixedCycle != null" >
  290. #{fixedCycle,jdbcType=VARCHAR},
  291. </if>
  292. <if test="peopleNumber != null" >
  293. #{peopleNumber,jdbcType=INTEGER},
  294. </if>
  295. <if test="fixedScheme != null" >
  296. #{fixedScheme,jdbcType=VARCHAR},
  297. </if>
  298. <if test="costEscrow != null" >
  299. #{costEscrow,jdbcType=DECIMAL},
  300. </if>
  301. <if test="budgetCost != null" >
  302. #{budgetCost,jdbcType=DECIMAL},
  303. </if>
  304. <if test="validityPeriod != null" >
  305. #{validityPeriod,jdbcType=TIMESTAMP},
  306. </if>
  307. <if test="employerId != null" >
  308. #{employerId,jdbcType=VARCHAR},
  309. </if>
  310. <if test="employerName != null" >
  311. #{employerName,jdbcType=VARCHAR},
  312. </if>
  313. <if test="employerAddress != null" >
  314. #{employerAddress,jdbcType=VARCHAR},
  315. </if>
  316. <if test="employerContacts != null" >
  317. #{employerContacts,jdbcType=VARCHAR},
  318. </if>
  319. <if test="employerContactsMobile != null" >
  320. #{employerContactsMobile,jdbcType=VARCHAR},
  321. </if>
  322. <if test="employerContactsMailbox != null" >
  323. #{employerContactsMailbox,jdbcType=VARCHAR},
  324. </if>
  325. <if test="contacts != null" >
  326. #{contacts,jdbcType=INTEGER},
  327. </if>
  328. <if test="status != null" >
  329. #{status,jdbcType=INTEGER},
  330. </if>
  331. <if test="releaseStatus != null" >
  332. #{releaseStatus,jdbcType=INTEGER},
  333. </if>
  334. <if test="releaseDate != null" >
  335. #{releaseDate,jdbcType=TIMESTAMP},
  336. </if>
  337. <if test="createTime != null" >
  338. #{createTime,jdbcType=TIMESTAMP},
  339. </if>
  340. <if test="principalId != null" >
  341. #{principalId,jdbcType=VARCHAR},
  342. </if>
  343. <if test="deletedSign != null" >
  344. #{deletedSign,jdbcType=INTEGER},
  345. </if>
  346. <if test="auditStatus != null" >
  347. #{auditStatus,jdbcType=INTEGER},
  348. </if>
  349. <if test="techBrokerId != null" >
  350. #{techBrokerId,jdbcType=VARCHAR},
  351. </if>
  352. <if test="boutique != null" >
  353. #{boutique,jdbcType=INTEGER},
  354. </if>
  355. <if test="remark != null" >
  356. #{remark,jdbcType=VARCHAR},
  357. </if>
  358. <if test="pictureUrlMin != null" >
  359. #{pictureUrlMin,jdbcType=VARCHAR},
  360. </if>
  361. </trim>
  362. </insert>
  363. <update id="updateByPrimaryKeySelective" parameterType="com.goafanti.common.model.Demand" >
  364. update demand
  365. <set >
  366. <if test="serialNumber != null" >
  367. serial_number = #{serialNumber,jdbcType=INTEGER},
  368. </if>
  369. <if test="dataCategory != null" >
  370. data_category = #{dataCategory,jdbcType=INTEGER},
  371. </if>
  372. <if test="name != null" >
  373. name = #{name,jdbcType=VARCHAR},
  374. </if>
  375. <if test="keyword != null" >
  376. keyword = #{keyword,jdbcType=VARCHAR},
  377. </if>
  378. <if test="infoSources != null" >
  379. info_sources = #{infoSources,jdbcType=INTEGER},
  380. </if>
  381. <if test="industryCategoryA != null" >
  382. industry_category_a = #{industryCategoryA,jdbcType=INTEGER},
  383. </if>
  384. <if test="industryCategoryB != null" >
  385. industry_category_b = #{industryCategoryB,jdbcType=INTEGER},
  386. </if>
  387. <if test="industryCategoryC != null" >
  388. industry_category_c = #{industryCategoryC,jdbcType=INTEGER},
  389. </if>
  390. <if test="demandType != null" >
  391. demand_type = #{demandType,jdbcType=INTEGER},
  392. </if>
  393. <if test="problemDes != null" >
  394. problem_des = #{problemDes,jdbcType=VARCHAR},
  395. </if>
  396. <if test="technicalRequirements != null" >
  397. technical_requirements = #{technicalRequirements,jdbcType=VARCHAR},
  398. </if>
  399. <if test="pictureUrl != null" >
  400. picture_url = #{pictureUrl,jdbcType=LONGVARCHAR},
  401. </if>
  402. <if test="textFileUrl != null" >
  403. text_file_url = #{textFileUrl,jdbcType=VARCHAR},
  404. </if>
  405. <if test="videoUrl != null" >
  406. video_url = #{videoUrl,jdbcType=VARCHAR},
  407. </if>
  408. <if test="fixedBudget != null" >
  409. fixed_budget = #{fixedBudget,jdbcType=DECIMAL},
  410. </if>
  411. <if test="fixedCycle != null" >
  412. fixed_cycle = #{fixedCycle,jdbcType=VARCHAR},
  413. </if>
  414. <if test="peopleNumber != null" >
  415. people_number = #{peopleNumber,jdbcType=INTEGER},
  416. </if>
  417. <if test="fixedScheme != null" >
  418. fixed_scheme = #{fixedScheme,jdbcType=VARCHAR},
  419. </if>
  420. <if test="costEscrow != null" >
  421. cost_escrow = #{costEscrow,jdbcType=DECIMAL},
  422. </if>
  423. <if test="budgetCost != null" >
  424. budget_cost = #{budgetCost,jdbcType=DECIMAL},
  425. </if>
  426. <if test="budgetCost == 0" >
  427. budget_cost = null,
  428. </if>
  429. <if test="validityPeriod != null" >
  430. validity_period = #{validityPeriod,jdbcType=TIMESTAMP},
  431. </if>
  432. <if test="employerId != null" >
  433. employer_id = #{employerId,jdbcType=VARCHAR},
  434. </if>
  435. <if test="employerName != null" >
  436. employer_name = #{employerName,jdbcType=VARCHAR},
  437. </if>
  438. <if test="employerAddress != null" >
  439. employer_address = #{employerAddress,jdbcType=VARCHAR},
  440. </if>
  441. <if test="employerContacts != null" >
  442. employer_contacts = #{employerContacts,jdbcType=VARCHAR},
  443. </if>
  444. <if test="employerContactsMobile != null" >
  445. employer_contacts_mobile = #{employerContactsMobile,jdbcType=VARCHAR},
  446. </if>
  447. <if test="employerContactsMailbox != null" >
  448. employer_contacts_mailbox = #{employerContactsMailbox,jdbcType=VARCHAR},
  449. </if>
  450. <if test="contacts != null" >
  451. contacts = #{contacts,jdbcType=VARCHAR},
  452. </if>
  453. <if test="contactMobile != null" >
  454. contact_mobile = #{contactMobile ,jdbcType=VARCHAR},
  455. </if>
  456. <if test="status != null" >
  457. status = #{status,jdbcType=INTEGER},
  458. </if>
  459. <if test="releaseStatus != null" >
  460. release_status = #{releaseStatus,jdbcType=INTEGER},
  461. </if>
  462. <if test="releaseDate != null" >
  463. release_date = #{releaseDate,jdbcType=TIMESTAMP},
  464. </if>
  465. <if test="createTime != null" >
  466. create_time = #{createTime,jdbcType=TIMESTAMP},
  467. </if>
  468. <if test="principalId != null" >
  469. principal_id = #{principalId,jdbcType=VARCHAR},
  470. </if>
  471. <if test="deletedSign != null" >
  472. deleted_sign = #{deletedSign,jdbcType=INTEGER},
  473. </if>
  474. <if test="auditStatus != null" >
  475. audit_status = #{auditStatus,jdbcType=INTEGER},
  476. </if>
  477. <if test="techBrokerId != null" >
  478. tech_broker_id = #{techBrokerId,jdbcType=VARCHAR},
  479. </if>
  480. <if test="boutique != null">
  481. boutique = #{boutique,jdbcType=INTEGER},
  482. </if>
  483. <if test="remark != null" >
  484. remark = #{remark,jdbcType=VARCHAR},
  485. </if>
  486. <if test="isUrgent != null">
  487. is_urgent = #{isUrgent,jdbcType=INTEGER},
  488. </if>
  489. <if test="urgentDays != null" >
  490. urgent_days = #{urgentDays,jdbcType=INTEGER},
  491. </if>
  492. <if test="urgentMoney != null" >
  493. urgent_money = #{urgentMoney,jdbcType=VARCHAR},
  494. </if>
  495. <if test="researchType != null">
  496. research_type = #{researchType,jdbcType=VARCHAR},
  497. </if>
  498. <if test="crowdCost!=null">
  499. crowd_cost=#{crowdCost,jdbcType=DECIMAL},
  500. </if>
  501. <if test="isHot!=null">
  502. is_hot=#{isHot,jdbcType=INTEGER},
  503. </if>
  504. <if test="auditInfo!=null">
  505. audit_info=#{auditInfo,jdbcType=VARCHAR},
  506. </if>
  507. <if test="pictureUrlMin !=null">
  508. picture_url_min=#{pictureUrlMin,jdbcType=VARCHAR},
  509. </if>
  510. </set>
  511. where id = #{id,jdbcType=VARCHAR}
  512. </update>
  513. <update id="updateByPrimaryKey" parameterType="com.goafanti.common.model.Demand" >
  514. update demand
  515. set serial_number = #{serialNumber,jdbcType=INTEGER},
  516. data_category = #{dataCategory,jdbcType=INTEGER},
  517. name = #{name,jdbcType=VARCHAR},
  518. keyword = #{keyword,jdbcType=VARCHAR},
  519. info_sources = #{infoSources,jdbcType=INTEGER},
  520. industry_category_a = #{industryCategoryA,jdbcType=INTEGER},
  521. industry_category_b = #{industryCategoryB,jdbcType=INTEGER},
  522. industry_category_c = #{industryCategoryC,jdbcType=INTEGER},
  523. demand_type = #{demandType,jdbcType=INTEGER},
  524. problem_des = #{problemDes,jdbcType=VARCHAR},
  525. technical_requirements = #{technicalRequirements,jdbcType=VARCHAR},
  526. picture_url = #{pictureUrl,jdbcType=LONGVARCHAR},
  527. text_file_url = #{textFileUrl,jdbcType=VARCHAR},
  528. video_url = #{videoUrl,jdbcType=VARCHAR},
  529. fixed_budget = #{fixedBudget,jdbcType=DECIMAL},
  530. fixed_cycle = #{fixedCycle,jdbcType=VARCHAR},
  531. people_number = #{peopleNumber,jdbcType=INTEGER},
  532. fixed_scheme = #{fixedScheme,jdbcType=VARCHAR},
  533. cost_escrow = #{costEscrow,jdbcType=DECIMAL},
  534. budget_cost = #{budgetCost,jdbcType=DECIMAL},
  535. validity_period = #{validityPeriod,jdbcType=TIMESTAMP},
  536. employer_id = #{employerId,jdbcType=VARCHAR},
  537. employer_name = #{employerName,jdbcType=VARCHAR},
  538. employer_address = #{employerAddress,jdbcType=VARCHAR},
  539. employer_contacts = #{employerContacts,jdbcType=VARCHAR},
  540. employer_contacts_mobile = #{employerContactsMobile,jdbcType=VARCHAR},
  541. employer_contacts_mailbox = #{employerContactsMailbox,jdbcType=VARCHAR},
  542. contacts = #{contacts,jdbcType=INTEGER},
  543. status = #{status,jdbcType=INTEGER},
  544. release_status = #{releaseStatus,jdbcType=INTEGER},
  545. release_date = #{releaseDate,jdbcType=TIMESTAMP},
  546. create_time = #{createTime,jdbcType=TIMESTAMP},
  547. principal_id = #{principalId,jdbcType=VARCHAR},
  548. deleted_sign = #{deletedSign,jdbcType=INTEGER},
  549. audit_status = #{auditStatus,jdbcType=INTEGER},
  550. tech_broker_id = #{techBrokerId,jdbcType=VARCHAR},
  551. boutique = #{boutique,jdbcType=INTEGER},
  552. picture_url_min=#{pictureUrlMin,jdbcType=VARCHAR}
  553. where id = #{id,jdbcType=VARCHAR}
  554. </update>
  555. <select id="findAppDemandListByPage" parameterType="String" resultType="com.goafanti.demand.bo.DemandListBo">
  556. select
  557. d.id,d.name, d.keyword, d.is_urgent as isUrgent, d.demand_type as demandType, d.industry_category_a as industryCategoryA, d.industry_category_b as industryCategoryB,
  558. d.validity_period as validityPeriod, d.status, d.release_status as releaseStatus,d.release_date as releaseDate, d.employer_id as employerId,
  559. d.audit_status as auditStatus,d.urgent_money as urgentMoney,d.urgent_days as urgentDays,d.problem_des as problemDes,
  560. ifnull(t.countInterest,0) as interestCount,if(isnull(y.demand_id),0,1) as interested,
  561. g.name as industryCategory1,g2.name as industryCategory2
  562. from demand d
  563. left join user_identity t on d.employer_id=t.uid
  564. left join industry_category g on d.industry_category_a=g.id
  565. left join industry_category g2 on d.industry_category_b=g2.id
  566. left join (select count(0) as countInterest ,demand_id from demand_interest
  567. group by demand_id) t on d.id=t.demand_id
  568. left join (select demand_id from demand_interest where uid= #{uid,jdbcType=VARCHAR} group by demand_id) y on d.id=y.demand_id
  569. where d.deleted_sign = 0 and d.audit_status=2 and d.info_sources=1
  570. <if test="employerId != null">
  571. and d.employer_id = #{employerId, jdbcType=VARCHAR}
  572. </if>
  573. <if test="serialNumber != null">
  574. and d.serial_number = #{serialNumber,jdbcType=INTEGER}
  575. </if>
  576. <if test="auditStatus != null">
  577. and d.audit_status = #{auditStatus,jdbcType=INTEGER}
  578. </if>
  579. <if test="name != null">
  580. and d.name like CONCAT('%',#{name,jdbcType=VARCHAR},'%')
  581. </if>
  582. <if test="keyword != null">
  583. and d.keyword like "%"#{keyword,jdbcType=VARCHAR}"%"
  584. </if>
  585. <if test="demandType != null">
  586. and d.demand_type = #{demandType,jdbcType=INTEGER}
  587. </if>
  588. <if test="industryCategoryA != null">
  589. and d.industry_category_a = #{industryCategoryA,jdbcType=INTEGER}
  590. </if>
  591. <if test="status != null">
  592. and d.status = #{status,jdbcType=VARCHAR}
  593. </if>
  594. <if test="releaseStatus != null">
  595. and d.release_status = #{releaseStatus,jdbcType=VARCHAR}
  596. </if>
  597. <if test="vStart != null">
  598. and d.validity_period <![CDATA[ >= ]]> #{vStart,jdbcType=TIMESTAMP}
  599. </if>
  600. <if test="vEnd != null">
  601. and d.validity_period <![CDATA[ < ]]> #{vEnd,jdbcType=TIMESTAMP}
  602. </if>
  603. <if test="rStart != null">
  604. and d.release_date <![CDATA[ >= ]]> #{rStart,jdbcType=TIMESTAMP}
  605. </if>
  606. <if test="rEnd != null">
  607. and d.release_date <![CDATA[ < ]]> #{rEnd,jdbcType=TIMESTAMP}
  608. </if>
  609. order by d.release_date desc
  610. <if test="page_sql!=null">
  611. ${page_sql}
  612. </if>
  613. </select>
  614. <select id="findAppDemandCount" parameterType="String" resultType="java.lang.Integer">
  615. select count(1)
  616. from demand d
  617. where d.deleted_sign = 0 and d.audit_status=2 and d.info_sources=1
  618. <if test="employerId != null">
  619. and d.employer_id = #{employerId, jdbcType=VARCHAR}
  620. </if>
  621. <if test="serialNumber != null">
  622. and d.serial_number = #{serialNumber,jdbcType=INTEGER}
  623. </if>
  624. <if test="auditStatus != null">
  625. and d.audit_status = #{auditStatus,jdbcType=INTEGER}
  626. </if>
  627. <if test="industryCategoryA != null">
  628. and d.industry_category_a = #{industryCategoryA,jdbcType=INTEGER}
  629. </if>
  630. <if test="name != null">
  631. and d.name like CONCAT('%',#{name,jdbcType=VARCHAR},'%')
  632. </if>
  633. <if test="keyword != null">
  634. and d.keyword like "%"#{keyword,jdbcType=VARCHAR}"%"
  635. </if>
  636. <if test="demandType != null">
  637. and d.demand_type = #{demandType,jdbcType=INTEGER}
  638. </if>
  639. <if test="status != null">
  640. and d.status = #{status,jdbcType=VARCHAR}
  641. </if>
  642. <if test="releaseStatus != null">
  643. and d.release_status = #{releaseStatus,jdbcType=VARCHAR}
  644. </if>
  645. <if test="vStart != null">
  646. and d.validity_period <![CDATA[ >= ]]> #{vStart,jdbcType=TIMESTAMP}
  647. </if>
  648. <if test="vEnd != null">
  649. and d.validity_period <![CDATA[ < ]]> #{vEnd,jdbcType=TIMESTAMP}
  650. </if>
  651. <if test="rStart != null">
  652. and d.release_date <![CDATA[ >= ]]> #{rStart,jdbcType=TIMESTAMP}
  653. </if>
  654. <if test="rEnd != null">
  655. and d.release_date <![CDATA[ < ]]> #{rEnd,jdbcType=TIMESTAMP}
  656. </if>
  657. </select>
  658. <update id="batchDeleteByPrimaryKey" parameterType="java.util.List">
  659. update demand set deleted_sign = 1
  660. where id in
  661. <foreach item="item" collection="list" open="(" separator="," close=")">
  662. #{item}
  663. </foreach>
  664. </update>
  665. <insert id="insertBatch" parameterType="com.goafanti.common.model.Demand">
  666. insert into demand
  667. (id, deleted_sign, audit_status,
  668. status, release_status, create_time,
  669. keyword, data_category, name,employer_id,
  670. demand_type, problem_des, employer_name,
  671. employer_contacts, employer_contacts_mobile,
  672. employer_contacts_mailbox, info_sources,tech_broker_id,remark,urgent_days ,urgent_money,is_hot)
  673. values
  674. <foreach item="item" index="index" collection="list" separator=",">
  675. (
  676. #{item.id,jdbcType=VARCHAR}, #{item.deletedSign,jdbcType=INTEGER}, #{item.auditStatus,jdbcType=INTEGER},
  677. #{item.status,jdbcType=INTEGER}, #{item.releaseStatus,jdbcType=INTEGER}, #{item.createTime,jdbcType=TIMESTAMP},
  678. #{item.keyword,jdbcType=VARCHAR}, #{item.dataCategory,jdbcType=INTEGER}, #{item.name,jdbcType=VARCHAR},#{item.employerId,jdbcType=VARCHAR},
  679. #{item.demandType,jdbcType=INTEGER}, #{item.problemDes,jdbcType=VARCHAR}, #{item.employerName,jdbcType=VARCHAR},
  680. #{item.employerContacts,jdbcType=VARCHAR}, #{item.employerContactsMobile,jdbcType=VARCHAR}, #{item.employerContactsMailbox,jdbcType=VARCHAR},
  681. #{item.infoSources,jdbcType=INTEGER},#{item.techBrokerId,jdbcType=VARCHAR},#{item.remark,jdbcType=VARCHAR},#{item.urgentDays,jdbcType=VARCHAR},
  682. #{item.urgentMoney,jdbcType=VARCHAR},#{item.isHot,jdbcType=INTEGER}
  683. )
  684. </foreach>
  685. </insert>
  686. <select id="findUserPortalDemandDetail" parameterType="java.lang.String" resultType="com.goafanti.portal.bo.DemandPortalDetailBo">
  687. SELECT
  688. d.id,
  689. d.name,
  690. d.keyword,
  691. d.validity_period as validityPeriod,
  692. d.industry_category_a AS industryCategoryA,
  693. d.picture_url as pictureUrl,
  694. d.employer_contacts_mobile as employerContactsMobile,
  695. d.data_category as dataCategory,
  696. fg.name AS industryCategoryAS,
  697. fgg.name AS industryCategorBS,
  698. d.budget_cost AS budgetCost,
  699. d.problem_des AS problemDes,
  700. dg.name AS province,
  701. dgg.name AS city,
  702. interest.id as interestId,
  703. d.employer_name as employerName,
  704. u.lvl as level,
  705. d.is_hot as isHot
  706. FROM
  707. demand d
  708. LEFT JOIN `user` u on u.id = d.employer_id
  709. LEFT JOIN user_identity ui on ui.uid = d.employer_id
  710. LEFT JOIN district_glossory dg ON dg.id = ui.province
  711. LEFT JOIN district_glossory dgg ON dgg.id = ui.city
  712. LEFT JOIN field_glossory fg on fg.id = d.industry_category_a
  713. LEFT JOIN field_glossory fgg on fgg.id = d.industry_category_b
  714. LEFT JOIN demand_interest interest on interest.demand_id = d.id and interest.uid = #{uid,jdbcType=VARCHAR}
  715. WHERE
  716. d.id = #{id,jdbcType=VARCHAR}
  717. </select>
  718. <select id="findOrgPortalDemandDetail" parameterType="java.lang.String" resultType="com.goafanti.portal.bo.DemandPortalDetailBo">
  719. SELECT
  720. d.id,
  721. d.name,
  722. d.keyword,
  723. d.picture_url as pictureUrl,
  724. d.validity_period as validityPeriod,
  725. d.employer_contacts_mobile as employerContactsMobile,
  726. d.data_category as dataCategory,
  727. d.industry_category_a AS industryCategoryA,
  728. fg.name AS industryCategoryAS,
  729. fgg.name AS industryCategoryBS,
  730. d.budget_cost AS budgetCost,
  731. d.problem_des AS problemDes,
  732. dg.name AS province,
  733. dgg.name AS city,
  734. interest.id as interestId,
  735. d.employer_name as employerName,
  736. u.lvl as level
  737. FROM
  738. demand d
  739. LEFT JOIN `user` u on u.id = d.employer_id
  740. LEFT JOIN organization_identity oi on oi.uid = d.employer_id
  741. LEFT JOIN district_glossory dg ON dg.id = oi.licence_province
  742. LEFT JOIN district_glossory dgg ON dgg.id = oi.licence_city
  743. LEFT JOIN field_glossory fg on fg.id = d.industry_category_a
  744. LEFT JOIN field_glossory fgg on fgg.id = d.industry_category_b
  745. LEFT JOIN demand_interest interest on interest.demand_id = d.id and interest.uid = #{uid,jdbcType=VARCHAR}
  746. WHERE
  747. d.id = #{id,jdbcType=VARCHAR}
  748. </select>
  749. <select id="selectDemandListByPage" resultType="com.goafanti.demand.bo.DemandListBo">
  750. select
  751. a.id,
  752. a.serial_number as serialNumber,
  753. a.name,
  754. a.status,
  755. a.demand_type as demandType,
  756. a.audit_status as auditStatus,
  757. a.create_time as createTime,
  758. a.release_date as releaseDate,
  759. a.budget_cost as budgetCost,
  760. b.identify_name as employerName,
  761. a.is_hot as isHot,
  762. a.is_urgent as isUrgent
  763. from demand a left join user b on a.employer_id = b.id
  764. where a.info_sources=1
  765. and a.deleted_sign=0
  766. <if test="employerId != null">
  767. and a.employer_id = #{employerId,jdbcType=VARCHAR}
  768. </if>
  769. <if test="startDate != null">
  770. and a.release_date <![CDATA[ >= ]]> #{startDate,jdbcType=TIMESTAMP}
  771. </if>
  772. <if test="endDate != null">
  773. and a.release_date <![CDATA[ <= ]]> #{endDate,jdbcType=TIMESTAMP}
  774. </if>
  775. <if test="createStartDate != null">
  776. and a.create_time <![CDATA[ >= ]]> #{createStartDate,jdbcType=TIMESTAMP}
  777. </if>
  778. <if test="createEndDate != null">
  779. and a.create_time <![CDATA[ <= ]]> #{createEndDate,jdbcType=TIMESTAMP}
  780. </if>
  781. <if test="name != null">
  782. and a.name like concat('%',#{name,jdbcType=VARCHAR},'%')
  783. </if>
  784. <if test="demandType != null">
  785. and a.demand_type = #{demandType,jdbcType=INTEGER}
  786. </if>
  787. <if test="auditStatus != null">
  788. and a.audit_status = #{auditStatus,jdbcType=INTEGER}
  789. </if>
  790. <if test="status != null">
  791. and a.status = #{status,jdbcType=INTEGER}
  792. </if>
  793. <if test="identifyName != null">
  794. and b.identify_name like concat('%',#{identifyName,jdbcType=VARCHAR},'%')
  795. </if>
  796. order by a.release_date desc
  797. <if test="page_sql!=null">
  798. ${page_sql}
  799. </if>
  800. </select>
  801. <select id="selectDemandListCount" resultType="java.lang.Integer">
  802. select
  803. count(0)
  804. from demand a left join user b on a.employer_id = b.id
  805. where a.info_sources=1
  806. and a.deleted_sign=0
  807. <if test="employerId != null">
  808. and a.employer_id = #{employerId,jdbcType=VARCHAR}
  809. </if>
  810. <if test="startDate != null">
  811. and a.release_date <![CDATA[ >= ]]> #{startDate,jdbcType=TIMESTAMP}
  812. </if>
  813. <if test="endDate != null">
  814. and a.release_date <![CDATA[ <= ]]> #{endDate,jdbcType=TIMESTAMP}
  815. </if>
  816. <if test="createStartDate != null">
  817. and a.create_time <![CDATA[ >= ]]> #{createStartDate,jdbcType=TIMESTAMP}
  818. </if>
  819. <if test="createEndDate != null">
  820. and a.create_time <![CDATA[ <= ]]> #{createEndDate,jdbcType=TIMESTAMP}
  821. </if>
  822. <if test="name != null">
  823. and a.name like concat('%',#{name,jdbcType=VARCHAR},'%')
  824. </if>
  825. <if test="demandType != null">
  826. and a.demand_type = #{demandType,jdbcType=INTEGER}
  827. </if>
  828. <if test="auditStatus != null">
  829. and a.audit_status = #{auditStatus,jdbcType=INTEGER}
  830. </if>
  831. <if test="status != null">
  832. and a.status = #{status,jdbcType=INTEGER}
  833. </if>
  834. <if test="identifyName != null">
  835. and b.identify_name like concat('%',#{identifyName,jdbcType=VARCHAR},'%')
  836. </if>
  837. </select>
  838. <select id="countInterest" resultType="Integer">
  839. select count(0)
  840. from demand_interest
  841. where demand_id = #{demandId,jdbcType=VARCHAR}
  842. </select>
  843. <select id="findAppMyDemandListByPage" parameterType="String" resultType="com.goafanti.demand.bo.AppDemandBo">
  844. select
  845. d.id, d.boutique,d.name, d.audit_status as auditStatus,d.release_date as releaseDate,
  846. d.create_time as createTime,ifnull(i.y,0) as interestCount,
  847. if(isnull(a.demand_id),0,1) as interest
  848. from demand d
  849. left join (select count(0) as y,demand_id from demand_interest
  850. group by demand_id ) i on d.id=i.demand_id
  851. left join (select demand_id from demand_interest where uid=#{employerId, jdbcType=VARCHAR}) a on d.id=a.demand_id
  852. where d.deleted_sign = 0 and d.info_sources=1
  853. <if test="employerId != null">
  854. and d.employer_id = #{employerId, jdbcType=VARCHAR}
  855. </if>
  856. order by d.serial_number desc
  857. <if test="page_sql!=null">
  858. ${page_sql}
  859. </if>
  860. </select>
  861. <select id="findAppMyDemandCount" parameterType="String" resultType="java.lang.Integer">
  862. select count(*)
  863. from demand d
  864. where d.deleted_sign = 0
  865. <if test="employerId != null">
  866. and d.employer_id = #{employerId, jdbcType=VARCHAR}
  867. </if>
  868. </select>
  869. <select id="selectDemandDetail" resultType="com.goafanti.demand.bo.DemandDetailBo" parameterType="java.lang.String" >
  870. select
  871. id,
  872. name,
  873. problem_des as problemDes,
  874. industry_category_a as industryCategoryA,
  875. industry_category_b as industryCategoryB,
  876. industry_category_c as industryCategoryC,
  877. demand_type as demandType,
  878. research_type as researchType,
  879. budget_cost as budgetCost,
  880. crowd_cost as crowdCost,
  881. is_hot as isHot,
  882. is_urgent as isUrgent,
  883. urgent_money as urgentMoney,
  884. urgent_days as urgentDays,
  885. status,
  886. keyword,
  887. picture_url as pictureUrl,
  888. audit_status as auditStatus,
  889. audit_info as auditInfo,
  890. picture_url_min as pictureUrlMin
  891. from
  892. demand
  893. where id = #{id,jdbcType=VARCHAR}
  894. </select>
  895. <select id="findAppNewsInterestByPage" parameterType="String" resultType="com.goafanti.demand.bo.ObjectInterestListBo">
  896. select n.id,n.title as name,n.create_time as createTime
  897. from news_interest ni
  898. LEFT join news n on ni.new_id=n.id
  899. where ni.uid=#{uid,jdbcType=VARCHAR}
  900. order by createTime desc
  901. <if test="page_sql!=null">
  902. ${page_sql}
  903. </if>
  904. </select>
  905. <select id="findAppNewsInterestCount" parameterType="String" resultType="java.lang.Integer">
  906. select count(1)
  907. from news_interest ni
  908. LEFT join news n on ni.new_id=n.id
  909. where ni.uid=#{uid,jdbcType=VARCHAR}
  910. </select>
  911. <select id="findAppUserInterestByPage" parameterType="String" resultType="com.goafanti.demand.bo.ObjectInterestListBo">
  912. select y.uid as id,y.username as name ,t.create_time as createTime
  913. from user_interest t
  914. left join user_identity y on t.to_uid=y.uid
  915. where expert=1
  916. and from_uid=#{uid,jdbcType=VARCHAR}
  917. <if test="page_sql!=null">
  918. ${page_sql}
  919. </if>
  920. </select>
  921. <select id="findAppUserInterestCount" parameterType="String" resultType="java.lang.Integer">
  922. select count(1)
  923. from user_interest t
  924. left join user_identity y on t.to_uid=y.uid
  925. where expert=1
  926. and from_uid=#{uid,jdbcType=VARCHAR}
  927. </select>
  928. <select id="findAppCounselorInterestByPage" parameterType="String" resultType="com.goafanti.demand.bo.ObjectInterestListBo">
  929. select y.uid as id,y.username as name ,t.create_time as createTime
  930. from user_interest t
  931. left join user_identity y on t.to_uid=y.uid
  932. where expert=2
  933. and from_uid=#{uid,jdbcType=VARCHAR}
  934. <if test="page_sql!=null">
  935. ${page_sql}
  936. </if>
  937. </select>
  938. <select id="findAppCounselorInterestCount" parameterType="String" resultType="java.lang.Integer">
  939. select count(1)
  940. from user_interest t
  941. left join user_identity y on t.to_uid=y.uid
  942. where expert=2
  943. and from_uid=#{uid,jdbcType=VARCHAR}
  944. </select>
  945. <select id="findAppDemandInterestByPage" resultType="com.goafanti.demand.bo.ObjectInterestListBo">
  946. select d.id ,d.name,t.create_time as createTime
  947. from demand_interest t
  948. left join demand d on t.demand_id=d.id
  949. where t.uid=#{uid,jdbcType=VARCHAR}
  950. <if test="page_sql!=null">
  951. ${page_sql}
  952. </if>
  953. </select>
  954. <select id="findAppDemandInterestCount" parameterType="String" resultType="java.lang.Integer">
  955. select count(1)
  956. from demand_interest t
  957. left join demand d on t.demand_id=d.id
  958. where uid=#{uid,jdbcType=VARCHAR}
  959. </select>
  960. <select id="findAppAchievementInterestByPage" parameterType="String" resultType="com.goafanti.demand.bo.ObjectInterestListBo">
  961. select a.id ,a.name,t.create_time as createTime
  962. from achievement_interest t
  963. left join achievement a on t.achievement_id=a.id
  964. where t.uid=#{uid,jdbcType=VARCHAR}
  965. <if test="page_sql!=null">
  966. ${page_sql}
  967. </if>
  968. </select>
  969. <select id="findAppAchievementInterestCount" parameterType="String" resultType="java.lang.Integer">
  970. select count(1)
  971. from achievement_interest t
  972. left join achievement a on t.achievement_id=a.id
  973. where t.uid=#{uid,jdbcType=VARCHAR}
  974. </select>
  975. <select id="findAppProjectInterestByPage" parameterType="String" resultType="com.goafanti.demand.bo.ObjectInterestListBo">
  976. select b.id ,b.bname as name,t.uid,t.create_time as createTime
  977. from project_interest t
  978. left join business_project b on t.project_id=b.id
  979. where t.uid=#{uid,jdbcType=VARCHAR}
  980. <if test="page_sql!=null">
  981. ${page_sql}
  982. </if>
  983. </select>
  984. <select id="findAppProjectInterestCount" parameterType="String" resultType="java.lang.Integer">
  985. select count(1)
  986. from project_interest t
  987. left join business_project b on t.project_id=b.id
  988. where t.uid=#{uid,jdbcType=VARCHAR}
  989. </select>
  990. <select id="getAppHomeRecommended" resultType="com.goafanti.demand.bo.DemandRecommended">
  991. select dp.demand_id as id,d.name,d.demand_type as demandType,d.problem_des as introduction,d.picture_url as pictureUrl,
  992. d.urgent_days as urgentDays,d.urgent_money as urgentMoney,d.industry_category_a as industryCategoryA,
  993. d.industry_category_b as industryCategoryB,f1.name as fieldA,f2.name as fieldB,d.boutique
  994. from demand_publish dp
  995. left join demand d on dp.demand_id = d.id
  996. left join field_glossory f1 on d.industry_category_a=f1.id
  997. left join field_glossory f2 on d.industry_category_b=f2.id
  998. where
  999. dp.publish_client = '1'
  1000. and dp.publish_page = 'W01'
  1001. order by
  1002. dp.if_top,
  1003. dp.top_number,
  1004. dp.show_number asc limit 0,
  1005. 6
  1006. </select>
  1007. <select id="selectRecentDemand" resultType="com.goafanti.demand.bo.DemandListBo">
  1008. select d.name,employer_name as employerName,d.id ,data_category as dataCategory,release_date as releaseDate,demand_type as demandType,budget_cost as budgetCost
  1009. ,fg.name as industryCategory1,fgg.name as industryCategory2,problem_des as problemDes,d.picture_url as pictureUrl
  1010. from demand d
  1011. left join industry_category fg on fg.id=d.industry_category_a
  1012. left join industry_category fgg on fgg.id=d.industry_category_b
  1013. left join branch_information branchInfo on INSTR(#{1},branchInfo.domain_name)>0
  1014. left join demand_publish dp on dp.demand_id=d.id and dp.publish_platform=branchInfo.id
  1015. where audit_status=2 and info_sources=1 and dp.demand_id=d.id and dp.publish_platform=branchInfo.id and instr(dp.publish_page,#{2})>0
  1016. order by release_date desc limit #{0}
  1017. </select>
  1018. <select id="selectCompanyDemand" resultType="com.goafanti.demand.bo.DemandListBo">
  1019. select d.name,picture_url as pictureUrl,d.id ,data_category as dataCategory
  1020. from demand d
  1021. left join branch_information branchInfo on INSTR(#{1},branchInfo.domain_name)>0
  1022. left join demand_publish dp on dp.demand_id=d.id and dp.publish_platform=branchInfo.id
  1023. where d.demand_type=0 and info_sources=1 and d.audit_status=2 and dp.demand_id=d.id and dp.publish_platform=branchInfo.id and instr(dp.publish_page,#{2})>0
  1024. order by release_date desc limit #{0}
  1025. </select>
  1026. <select id="getUrgentDemand" resultType="com.goafanti.demand.bo.DemandListBo">
  1027. select name,release_date as releaseDate,d.id,problem_des as problemDes,research_type as researchType,budget_cost as fundForPersonnel,crowd_cost as fundForCrowd,demand_type as demandType,
  1028. data_category as dataCategory,validity_period as validityPeriod
  1029. from demand d
  1030. left join branch_information branchInfo on INSTR(#{1},branchInfo.domain_name)>0
  1031. left join demand_publish dp on dp.demand_id=d.id and dp.publish_platform=branchInfo.id
  1032. where d.is_urgent=1 and d.audit_status=2 and info_sources=1 and dp.demand_id=d.id and dp.publish_platform=branchInfo.id and instr(dp.publish_page,#{2})>0
  1033. order by release_date desc limit #{0}
  1034. </select>
  1035. <select id="getHotDemand" resultType="com.goafanti.demand.bo.DemandListBo">
  1036. select d.name,release_date as releaseDate,d.id,problem_des as problemDes,
  1037. research_type as researchType,budget_cost as fundForPersonnel,crowd_cost as fundForCrowd,demand_type as demandType,
  1038. fg.name as industryCategory1,fgg.name as industryCategory2,d.picture_url as pictureUrl,d.picture_url_min as pictureUrlMin,
  1039. data_category as dataCategory,validity_period as validityPeriod
  1040. from demand d
  1041. left join industry_category fg on fg.id=d.industry_category_a
  1042. left join industry_category fgg on fgg.id=d.industry_category_b
  1043. left join branch_information branchInfo on INSTR(#{1},branchInfo.domain_name)>0
  1044. left join demand_publish dp on dp.demand_id=d.id and dp.publish_platform=branchInfo.id
  1045. where d.audit_status=2 and info_sources=1 and dp.demand_id=d.id and dp.publish_platform=branchInfo.id and instr(dp.publish_page,#{2})>0
  1046. <if test="#{3} != null">
  1047. and d.deleted_sign = #{3}
  1048. </if>
  1049. order by release_date desc limit #{0}
  1050. </select>
  1051. <select id="getAreaDemand" resultType="com.goafanti.demand.bo.DemandListBo">
  1052. select name,picture_url as pictureUrl ,problem_des as problemDes , data_category as dataCategory,d.id from demand d
  1053. left join branch_information branchInfo on INSTR(#{1},branchInfo.domain_name)>0
  1054. left join demand_publish dp on dp.demand_id=d.id and dp.publish_platform=branchInfo.id
  1055. where d.demand_type=4 and d.audit_status=2 and info_sources=1 and dp.demand_id=d.id and dp.publish_platform=branchInfo.id and instr(dp.publish_page,#{2})>0
  1056. order by release_date desc limit #{0}
  1057. </select>
  1058. <select id="getProLearnStudyDemand" resultType="com.goafanti.demand.bo.DemandListBo">
  1059. select d.name as name,picture_url as pictureUrl ,problem_des as problemDes,employer_name as employerName,d.id,fg.name as industryCategory1,data_category as dataCategory,fgg.name as industryCategory2 from demand d
  1060. left join industry_category fg on fg.id=d.industry_category_a
  1061. left join industry_category fgg on fgg.id=d.industry_category_b
  1062. left join branch_information branchInfo on INSTR(#{1},branchInfo.domain_name)>0
  1063. left join demand_publish dp on dp.demand_id=d.id and dp.publish_platform=branchInfo.id
  1064. where d.demand_type=2 and d.audit_status=2 and info_sources=1 and dp.demand_id=d.id and dp.publish_platform=branchInfo.id and instr(dp.publish_page,#{2})>0
  1065. order by release_date desc limit #{0}
  1066. </select>
  1067. <select id="getFundCrowdDemand" resultType="com.goafanti.demand.bo.DemandListBo">
  1068. select d.name,picture_url as pictureUrl ,problem_des as problemDes ,d.id,crowd_cost as fundForCrowd,data_category as dataCategory,research_type as researchType from demand d
  1069. left join branch_information branchInfo on INSTR(#{1},branchInfo.domain_name)>0
  1070. left join demand_publish dp on dp.demand_id=d.id and dp.publish_platform=branchInfo.id
  1071. where d.demand_type=3 and d.audit_status=2 and info_sources=1 and dp.demand_id=d.id and dp.publish_platform=branchInfo.id and instr(dp.publish_page,#{2})>0
  1072. order by release_date
  1073. desc limit #{0}
  1074. </select>
  1075. <select id="getPersonnelDemand" resultType="com.goafanti.demand.bo.DemandListBo">
  1076. select d.name,picture_url as pictureUrl ,problem_des as problemDes ,d.id,data_category as dataCategory,budget_cost as fundForPersonnel from demand d
  1077. left join branch_information branchInfo on INSTR(#{1},branchInfo.domain_name)>0
  1078. left join demand_publish dp on dp.demand_id=d.id and dp.publish_platform=branchInfo.id
  1079. where d.demand_type=5 and d.audit_status=2 and info_sources=1 and dp.demand_id=d.id and dp.publish_platform=branchInfo.id and instr(dp.publish_page,#{2})>0
  1080. order by release_date desc limit #{0}
  1081. </select>
  1082. <select id="getDemandDetail" resultType="com.goafanti.demand.bo.DemandListBo">
  1083. select d.name,d.budget_cost as budgetCost,d.validity_period as validityPeriod,data_category as dataCategory,d.picture_url as pictureUrl,problem_des as problemDes,
  1084. fg.name as industryCategory1,fgg.name as industryCategory2,u.identify_name as employerName
  1085. from demand d
  1086. left join industry_category fg on fg.id=d.industry_category_a
  1087. left join industry_category fgg on fgg.id=d.industry_category_b
  1088. left join user u on u.id=d.employer_id
  1089. where d.id=#{0}
  1090. </select>
  1091. <select id="getBoutiqueDemandList" resultType="com.goafanti.demand.bo.DemandListBo">
  1092. select d.id,d.name,picture_url as picture_url,data_category as dataCategory,problem_des as problemDes
  1093. from demand d
  1094. left join branch_information branchInfo on INSTR(#{1},branchInfo.domain_name)>0
  1095. left join demand_publish dp on dp.demand_id=d.id and dp.publish_platform=branchInfo.id
  1096. where info_sources=1 and d.boutique=1 and dp.demand_id=d.id and dp.publish_platform=branchInfo.id and instr(dp.publish_page,#{2})>0
  1097. order by release_date desc limit #{0}
  1098. </select>
  1099. <select id="listMyDemand" resultType="com.goafanti.portal.bo.DemandSearchListBo">
  1100. select
  1101. id,
  1102. serial_number as serialNumber,
  1103. name,
  1104. demand_type as demandType,
  1105. audit_status as auditStatus,
  1106. create_time as createTime
  1107. from
  1108. demand
  1109. where
  1110. info_sources=1 and
  1111. employer_id = #{uid,jdbcType=VARCHAR}
  1112. <if test="status != null">
  1113. and status = #{status,jdbcType=INTEGER}
  1114. </if>
  1115. <if test="name != null">
  1116. and name = #{name,jdbcType=VARCHAR}
  1117. </if>
  1118. <if test="startDate != null">
  1119. and create_time <![CDATA[ > ]]> #{startDate,jdbcType=VARCHAR}
  1120. </if>
  1121. <if test="endDate != null">
  1122. and create_time <![CDATA[ < ]]> #{endDate,jdbcType=VARCHAR}
  1123. </if>
  1124. </select>
  1125. <select id="searchDemandList" resultType="com.goafanti.demand.bo.DemandListBo">
  1126. select a.name,a.id,create_time as createTime ,picture_url as pictureUrl,data_category as dataCategory,is_hot as isHot,demand_type as demandType,
  1127. industry_category_a as industryCategoryA,industry_category_b as industryCategoryB,ic.name as industryCategory1,icc.name as industryCategory2,a.release_date as releaseDate
  1128. from demand a
  1129. left join industry_category ic on ic.id=a.industry_category_a
  1130. left join industry_category icc on icc.id=a.industry_category_b
  1131. where info_sources=1 and audit_status=2
  1132. <if test="industryCategoryA!=null">
  1133. and a.industry_category_a =#{industryCategoryA,jdbcType=INTEGER}
  1134. </if>
  1135. <if test="industryCategoryB!=null">
  1136. and a.industry_category_b=#{industryCategoryB,jdbcType=INTEGER}
  1137. </if>
  1138. <if test="name !=null">
  1139. and a.name like concat("%",#{name,jdbcType=VARCHAR},"%")
  1140. </if>
  1141. <if test="deletedSign !=null">
  1142. and a.deleted_sign = #{deletedSign,jdbcType=INTEGER}
  1143. </if>
  1144. order by a.release_date
  1145. <if test="page_sql !=null">
  1146. ${page_sql}
  1147. </if>
  1148. </select>
  1149. <select id="searchDemandCount" resultType="java.lang.Integer">
  1150. select count(0) from demand a
  1151. where info_sources=1 and audit_status=2
  1152. <if test="industryCategoryA!=null">
  1153. and a.industry_category_a =#{industryCategoryA,jdbcType=INTEGER}
  1154. </if>
  1155. <if test="industryCategoryB!=null">
  1156. and a.industry_category_b=#{industryCategoryB,jdbcType=INTEGER}
  1157. </if>
  1158. <if test="name !=null">
  1159. and a.name like concat("%",#{name,jdbcType=VARCHAR},"%")
  1160. </if>
  1161. <if test="deletedSign !=null">
  1162. and a.deleted_sign = #{deletedSign,jdbcType=INTEGER}
  1163. </if>
  1164. </select>
  1165. <select id="findInterestedDemand" resultType="com.goafanti.demand.bo.DemandListBo">
  1166. select a.name,a.id,a.create_time as createTime ,picture_url as pictureUrl,data_category as dataCategory,is_hot as isHot,demand_type as demandType,
  1167. industry_category_a as industryCategoryA,industry_category_b as industryCategoryB,a.release_date as releaseDate,problem_des as problemDes
  1168. from demand a
  1169. left join demand_interest di on di.demand_id=a.id
  1170. where di.uid=#{uid,jdbcType=VARCHAR}
  1171. <if test="page_sql !=null">
  1172. ${page_sql}
  1173. </if>
  1174. </select>
  1175. <select id="findInterestedDemandCount" resultType="java.lang.Integer">
  1176. select count(0)
  1177. from demand a
  1178. left join demand_interest di on di.demand_id=a.id
  1179. where di.uid=#{uid,jdbcType=VARCHAR}
  1180. </select>
  1181. <select id="MyCollectionDemandList" resultType="com.goafanti.common.bo.MyCollection">
  1182. select a.id,a.name,a.problem_des as introduction,b.name as fieidA,ifnull(c.x,0) as interestCount,
  1183. a.is_urgent as textA
  1184. from demand a
  1185. left join demand_interest di on di.demand_id=a.id
  1186. left join industry_category b on a.industry_category_a= b.id
  1187. left join (select demand_id,count(*) as x from demand_interest GROUP by demand_id) c
  1188. on c.demand_id=a.id
  1189. where a.deleted_sign=0
  1190. and di.uid= #{uid,jdbcType=VARCHAR}
  1191. order by di.create_time desc
  1192. <if test="page_sql !=null">
  1193. ${page_sql}
  1194. </if>
  1195. </select>
  1196. <select id="MyCollectionDemandCount" resultType="java.lang.Integer">
  1197. select count(0)
  1198. from demand a
  1199. left join demand_interest di on di.demand_id=a.id
  1200. where a.deleted_sign=0
  1201. and di.uid= #{uid,jdbcType=VARCHAR}
  1202. </select>
  1203. </mapper>