DemandMapper.xml 51 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243
  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,
  670. employer_id,demand_type, problem_des,
  671. employer_name,employer_contacts, employer_contacts_mobile,
  672. employer_contacts_mailbox, info_sources,tech_broker_id,
  673. remark,urgent_days ,urgent_money,
  674. is_hot,industry_category_a,industry_category_b
  675. )
  676. values
  677. <foreach item="item" index="index" collection="list" separator=",">
  678. (
  679. #{item.id,jdbcType=VARCHAR}, #{item.deletedSign,jdbcType=INTEGER}, #{item.auditStatus,jdbcType=INTEGER},
  680. #{item.status,jdbcType=INTEGER}, #{item.releaseStatus,jdbcType=INTEGER}, #{item.createTime,jdbcType=TIMESTAMP},
  681. #{item.keyword,jdbcType=VARCHAR}, #{item.dataCategory,jdbcType=INTEGER}, #{item.name,jdbcType=VARCHAR},
  682. #{item.employerId,jdbcType=VARCHAR},#{item.demandType,jdbcType=INTEGER}, #{item.problemDes,jdbcType=VARCHAR},
  683. #{item.employerName,jdbcType=VARCHAR},#{item.employerContacts,jdbcType=VARCHAR},#{item.employerContactsMobile,jdbcType=VARCHAR},
  684. #{item.employerContactsMailbox,jdbcType=VARCHAR},#{item.infoSources,jdbcType=INTEGER},#{item.techBrokerId,jdbcType=VARCHAR},
  685. #{item.remark,jdbcType=VARCHAR},#{item.urgentDays,jdbcType=VARCHAR},#{item.urgentMoney,jdbcType=VARCHAR},
  686. #{item.isHot,jdbcType=INTEGER},#{item.industryCategoryA,jdbcType=INTEGER},#{item.industryCategoryB,jdbcType=INTEGER}
  687. )
  688. </foreach>
  689. </insert>
  690. <select id="findUserPortalDemandDetail" parameterType="java.lang.String" resultType="com.goafanti.portal.bo.DemandPortalDetailBo">
  691. SELECT
  692. d.id,
  693. d.name,
  694. d.keyword,
  695. d.validity_period as validityPeriod,
  696. d.industry_category_a AS industryCategoryA,
  697. d.picture_url as pictureUrl,
  698. d.employer_contacts_mobile as employerContactsMobile,
  699. d.data_category as dataCategory,
  700. fg.name AS industryCategoryAS,
  701. fgg.name AS industryCategorBS,
  702. d.budget_cost AS budgetCost,
  703. d.problem_des AS problemDes,
  704. dg.name AS province,
  705. dgg.name AS city,
  706. interest.id as interestId,
  707. d.employer_name as employerName,
  708. u.lvl as level,
  709. d.is_hot as isHot
  710. FROM
  711. demand d
  712. LEFT JOIN `user` u on u.id = d.employer_id
  713. LEFT JOIN user_identity ui on ui.uid = d.employer_id
  714. LEFT JOIN district_glossory dg ON dg.id = ui.province
  715. LEFT JOIN district_glossory dgg ON dgg.id = ui.city
  716. LEFT JOIN field_glossory fg on fg.id = d.industry_category_a
  717. LEFT JOIN field_glossory fgg on fgg.id = d.industry_category_b
  718. LEFT JOIN demand_interest interest on interest.demand_id = d.id and interest.uid = #{uid,jdbcType=VARCHAR}
  719. WHERE
  720. d.id = #{id,jdbcType=VARCHAR}
  721. </select>
  722. <select id="findOrgPortalDemandDetail" parameterType="java.lang.String" resultType="com.goafanti.portal.bo.DemandPortalDetailBo">
  723. SELECT
  724. d.id,
  725. d.name,
  726. d.keyword,
  727. d.picture_url as pictureUrl,
  728. d.validity_period as validityPeriod,
  729. d.employer_contacts_mobile as employerContactsMobile,
  730. d.data_category as dataCategory,
  731. d.industry_category_a AS industryCategoryA,
  732. fg.name AS industryCategoryAS,
  733. fgg.name AS industryCategoryBS,
  734. d.budget_cost AS budgetCost,
  735. d.problem_des AS problemDes,
  736. dg.name AS province,
  737. dgg.name AS city,
  738. interest.id as interestId,
  739. d.employer_name as employerName,
  740. u.lvl as level
  741. FROM
  742. demand d
  743. LEFT JOIN `user` u on u.id = d.employer_id
  744. LEFT JOIN organization_identity oi on oi.uid = d.employer_id
  745. LEFT JOIN district_glossory dg ON dg.id = oi.licence_province
  746. LEFT JOIN district_glossory dgg ON dgg.id = oi.licence_city
  747. LEFT JOIN field_glossory fg on fg.id = d.industry_category_a
  748. LEFT JOIN field_glossory fgg on fgg.id = d.industry_category_b
  749. LEFT JOIN demand_interest interest on interest.demand_id = d.id and interest.uid = #{uid,jdbcType=VARCHAR}
  750. WHERE
  751. d.id = #{id,jdbcType=VARCHAR}
  752. </select>
  753. <select id="selectDemandListByPage" resultType="com.goafanti.demand.bo.DemandListBo">
  754. select
  755. a.id,
  756. a.serial_number as serialNumber,
  757. a.name,
  758. a.status,
  759. a.demand_type as demandType,
  760. a.audit_status as auditStatus,
  761. a.create_time as createTime,
  762. a.release_date as releaseDate,
  763. a.budget_cost as budgetCost,
  764. b.identify_name as employerName,
  765. a.is_hot as isHot,
  766. a.is_urgent as isUrgent
  767. from demand a left join user b on a.employer_id = b.id
  768. where a.info_sources=1
  769. and a.deleted_sign=0
  770. <if test="employerId != null">
  771. and a.employer_id = #{employerId,jdbcType=VARCHAR}
  772. </if>
  773. <if test="startDate != null">
  774. and a.release_date <![CDATA[ >= ]]> #{startDate,jdbcType=TIMESTAMP}
  775. </if>
  776. <if test="endDate != null">
  777. and a.release_date <![CDATA[ <= ]]> #{endDate,jdbcType=TIMESTAMP}
  778. </if>
  779. <if test="createStartDate != null">
  780. and a.create_time <![CDATA[ >= ]]> #{createStartDate,jdbcType=TIMESTAMP}
  781. </if>
  782. <if test="createEndDate != null">
  783. and a.create_time <![CDATA[ <= ]]> #{createEndDate,jdbcType=TIMESTAMP}
  784. </if>
  785. <if test="name != null">
  786. and a.name like concat('%',#{name,jdbcType=VARCHAR},'%')
  787. </if>
  788. <if test="demandType != null">
  789. and a.demand_type = #{demandType,jdbcType=INTEGER}
  790. </if>
  791. <if test="auditStatus != null">
  792. and a.audit_status = #{auditStatus,jdbcType=INTEGER}
  793. </if>
  794. <if test="status != null">
  795. and a.status = #{status,jdbcType=INTEGER}
  796. </if>
  797. <if test="identifyName != null">
  798. and b.identify_name like concat('%',#{identifyName,jdbcType=VARCHAR},'%')
  799. </if>
  800. order by a.release_date desc
  801. <if test="page_sql!=null">
  802. ${page_sql}
  803. </if>
  804. </select>
  805. <select id="selectDemandListCount" resultType="java.lang.Integer">
  806. select
  807. count(0)
  808. from demand a left join user b on a.employer_id = b.id
  809. where a.info_sources=1
  810. and a.deleted_sign=0
  811. <if test="employerId != null">
  812. and a.employer_id = #{employerId,jdbcType=VARCHAR}
  813. </if>
  814. <if test="startDate != null">
  815. and a.release_date <![CDATA[ >= ]]> #{startDate,jdbcType=TIMESTAMP}
  816. </if>
  817. <if test="endDate != null">
  818. and a.release_date <![CDATA[ <= ]]> #{endDate,jdbcType=TIMESTAMP}
  819. </if>
  820. <if test="createStartDate != null">
  821. and a.create_time <![CDATA[ >= ]]> #{createStartDate,jdbcType=TIMESTAMP}
  822. </if>
  823. <if test="createEndDate != null">
  824. and a.create_time <![CDATA[ <= ]]> #{createEndDate,jdbcType=TIMESTAMP}
  825. </if>
  826. <if test="name != null">
  827. and a.name like concat('%',#{name,jdbcType=VARCHAR},'%')
  828. </if>
  829. <if test="demandType != null">
  830. and a.demand_type = #{demandType,jdbcType=INTEGER}
  831. </if>
  832. <if test="auditStatus != null">
  833. and a.audit_status = #{auditStatus,jdbcType=INTEGER}
  834. </if>
  835. <if test="status != null">
  836. and a.status = #{status,jdbcType=INTEGER}
  837. </if>
  838. <if test="identifyName != null">
  839. and b.identify_name like concat('%',#{identifyName,jdbcType=VARCHAR},'%')
  840. </if>
  841. </select>
  842. <select id="countInterest" resultType="Integer">
  843. select count(0)
  844. from demand_interest
  845. where demand_id = #{demandId,jdbcType=VARCHAR}
  846. </select>
  847. <select id="findAppMyDemandListByPage" parameterType="String" resultType="com.goafanti.demand.bo.AppDemandBo">
  848. select
  849. d.id, d.boutique,d.name, d.audit_status as auditStatus,d.release_date as releaseDate,
  850. d.create_time as createTime,ifnull(i.y,0) as interestCount,
  851. if(isnull(a.demand_id),0,1) as interest
  852. from demand d
  853. left join (select count(0) as y,demand_id from demand_interest
  854. group by demand_id ) i on d.id=i.demand_id
  855. left join (select demand_id from demand_interest where uid=#{employerId, jdbcType=VARCHAR}) a on d.id=a.demand_id
  856. where d.deleted_sign = 0 and d.info_sources=1
  857. <if test="employerId != null">
  858. and d.employer_id = #{employerId, jdbcType=VARCHAR}
  859. </if>
  860. order by d.serial_number desc
  861. <if test="page_sql!=null">
  862. ${page_sql}
  863. </if>
  864. </select>
  865. <select id="findAppMyDemandCount" parameterType="String" resultType="java.lang.Integer">
  866. select count(*)
  867. from demand d
  868. where d.deleted_sign = 0
  869. <if test="employerId != null">
  870. and d.employer_id = #{employerId, jdbcType=VARCHAR}
  871. </if>
  872. </select>
  873. <select id="selectDemandDetail" resultType="com.goafanti.demand.bo.DemandDetailBo" parameterType="java.lang.String" >
  874. select
  875. id,
  876. name,
  877. problem_des as problemDes,
  878. industry_category_a as industryCategoryA,
  879. industry_category_b as industryCategoryB,
  880. industry_category_c as industryCategoryC,
  881. demand_type as demandType,
  882. research_type as researchType,
  883. budget_cost as budgetCost,
  884. crowd_cost as crowdCost,
  885. is_hot as isHot,
  886. is_urgent as isUrgent,
  887. urgent_money as urgentMoney,
  888. urgent_days as urgentDays,
  889. status,
  890. keyword,
  891. picture_url as pictureUrl,
  892. audit_status as auditStatus,
  893. audit_info as auditInfo,
  894. picture_url_min as pictureUrlMin
  895. from
  896. demand
  897. where id = #{id,jdbcType=VARCHAR}
  898. </select>
  899. <select id="findAppNewsInterestByPage" parameterType="String" resultType="com.goafanti.demand.bo.ObjectInterestListBo">
  900. select n.id,n.title as name,n.create_time as createTime
  901. from news_interest ni
  902. LEFT join news n on ni.new_id=n.id
  903. where ni.uid=#{uid,jdbcType=VARCHAR}
  904. order by createTime desc
  905. <if test="page_sql!=null">
  906. ${page_sql}
  907. </if>
  908. </select>
  909. <select id="findAppNewsInterestCount" parameterType="String" resultType="java.lang.Integer">
  910. select count(1)
  911. from news_interest ni
  912. LEFT join news n on ni.new_id=n.id
  913. where ni.uid=#{uid,jdbcType=VARCHAR}
  914. </select>
  915. <select id="findAppUserInterestByPage" parameterType="String" resultType="com.goafanti.demand.bo.ObjectInterestListBo">
  916. select y.uid as id,y.username as name ,t.create_time as createTime
  917. from user_interest t
  918. left join user_identity y on t.to_uid=y.uid
  919. where expert=1
  920. and from_uid=#{uid,jdbcType=VARCHAR}
  921. <if test="page_sql!=null">
  922. ${page_sql}
  923. </if>
  924. </select>
  925. <select id="findAppUserInterestCount" parameterType="String" resultType="java.lang.Integer">
  926. select count(1)
  927. from user_interest t
  928. left join user_identity y on t.to_uid=y.uid
  929. where expert=1
  930. and from_uid=#{uid,jdbcType=VARCHAR}
  931. </select>
  932. <select id="findAppCounselorInterestByPage" parameterType="String" resultType="com.goafanti.demand.bo.ObjectInterestListBo">
  933. select y.uid as id,y.username as name ,t.create_time as createTime
  934. from user_interest t
  935. left join user_identity y on t.to_uid=y.uid
  936. where expert=2
  937. and from_uid=#{uid,jdbcType=VARCHAR}
  938. <if test="page_sql!=null">
  939. ${page_sql}
  940. </if>
  941. </select>
  942. <select id="findAppCounselorInterestCount" parameterType="String" resultType="java.lang.Integer">
  943. select count(1)
  944. from user_interest t
  945. left join user_identity y on t.to_uid=y.uid
  946. where expert=2
  947. and from_uid=#{uid,jdbcType=VARCHAR}
  948. </select>
  949. <select id="findAppDemandInterestByPage" resultType="com.goafanti.demand.bo.ObjectInterestListBo">
  950. select d.id ,d.name,t.create_time as createTime
  951. from demand_interest t
  952. left join demand d on t.demand_id=d.id
  953. where t.uid=#{uid,jdbcType=VARCHAR}
  954. <if test="page_sql!=null">
  955. ${page_sql}
  956. </if>
  957. </select>
  958. <select id="findAppDemandInterestCount" parameterType="String" resultType="java.lang.Integer">
  959. select count(1)
  960. from demand_interest t
  961. left join demand d on t.demand_id=d.id
  962. where uid=#{uid,jdbcType=VARCHAR}
  963. </select>
  964. <select id="findAppAchievementInterestByPage" parameterType="String" resultType="com.goafanti.demand.bo.ObjectInterestListBo">
  965. select a.id ,a.name,t.create_time as createTime
  966. from achievement_interest t
  967. left join achievement a on t.achievement_id=a.id
  968. where t.uid=#{uid,jdbcType=VARCHAR}
  969. <if test="page_sql!=null">
  970. ${page_sql}
  971. </if>
  972. </select>
  973. <select id="findAppAchievementInterestCount" parameterType="String" resultType="java.lang.Integer">
  974. select count(1)
  975. from achievement_interest t
  976. left join achievement a on t.achievement_id=a.id
  977. where t.uid=#{uid,jdbcType=VARCHAR}
  978. </select>
  979. <select id="findAppProjectInterestByPage" parameterType="String" resultType="com.goafanti.demand.bo.ObjectInterestListBo">
  980. select b.id ,b.bname as name,t.uid,t.create_time as createTime
  981. from project_interest t
  982. left join business_project b on t.project_id=b.id
  983. where t.uid=#{uid,jdbcType=VARCHAR}
  984. <if test="page_sql!=null">
  985. ${page_sql}
  986. </if>
  987. </select>
  988. <select id="findAppProjectInterestCount" parameterType="String" resultType="java.lang.Integer">
  989. select count(1)
  990. from project_interest t
  991. left join business_project b on t.project_id=b.id
  992. where t.uid=#{uid,jdbcType=VARCHAR}
  993. </select>
  994. <select id="getAppHomeRecommended" resultType="com.goafanti.demand.bo.DemandRecommended">
  995. select dp.demand_id as id,d.name,d.demand_type as demandType,d.problem_des as introduction,d.picture_url as pictureUrl,
  996. d.urgent_days as urgentDays,d.urgent_money as urgentMoney,d.industry_category_a as industryCategoryA,
  997. d.industry_category_b as industryCategoryB,f1.name as fieldA,f2.name as fieldB,d.boutique
  998. from demand_publish dp
  999. left join demand d on dp.demand_id = d.id
  1000. left join field_glossory f1 on d.industry_category_a=f1.id
  1001. left join field_glossory f2 on d.industry_category_b=f2.id
  1002. where
  1003. dp.publish_client = '1'
  1004. and dp.publish_page = 'W01'
  1005. order by
  1006. dp.if_top,
  1007. dp.top_number,
  1008. dp.show_number asc limit 0,
  1009. 6
  1010. </select>
  1011. <select id="selectRecentDemand" resultType="com.goafanti.demand.bo.DemandListBo">
  1012. 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
  1013. ,fg.name as industryCategory1,fgg.name as industryCategory2,problem_des as problemDes,d.picture_url as pictureUrl
  1014. from demand d
  1015. left join industry_category fg on fg.id=d.industry_category_a
  1016. left join industry_category fgg on fgg.id=d.industry_category_b
  1017. left join branch_information branchInfo on INSTR(#{1},branchInfo.domain_name)>0
  1018. left join demand_publish dp on dp.demand_id=d.id and dp.publish_platform=branchInfo.id
  1019. 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
  1020. order by release_date desc limit #{0}
  1021. </select>
  1022. <select id="selectCompanyDemand" resultType="com.goafanti.demand.bo.DemandListBo">
  1023. select d.name,picture_url as pictureUrl,d.id ,data_category as dataCategory
  1024. from demand d
  1025. left join branch_information branchInfo on INSTR(#{1},branchInfo.domain_name)>0
  1026. left join demand_publish dp on dp.demand_id=d.id and dp.publish_platform=branchInfo.id
  1027. 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
  1028. order by release_date desc limit #{0}
  1029. </select>
  1030. <select id="getUrgentDemand" resultType="com.goafanti.demand.bo.DemandListBo">
  1031. 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,
  1032. data_category as dataCategory,validity_period as validityPeriod
  1033. from demand d
  1034. left join branch_information branchInfo on INSTR(#{1},branchInfo.domain_name)>0
  1035. left join demand_publish dp on dp.demand_id=d.id and dp.publish_platform=branchInfo.id
  1036. 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
  1037. order by release_date desc limit #{0}
  1038. </select>
  1039. <select id="getHotDemand" resultType="com.goafanti.demand.bo.DemandListBo">
  1040. select d.name,release_date as releaseDate,d.id,problem_des as problemDes,
  1041. research_type as researchType,budget_cost as fundForPersonnel,crowd_cost as fundForCrowd,demand_type as demandType,
  1042. d.picture_url as pictureUrl,d.picture_url_min as pictureUrlMin,
  1043. data_category as dataCategory,validity_period as validityPeriod
  1044. from demand d
  1045. left join demand_publish dp on dp.demand_id=d.id
  1046. where d.audit_status=2 and info_sources=1 and dp.demand_id=d.id
  1047. and dp.publish_page =#{2}
  1048. <if test="#{3} != null">
  1049. and d.deleted_sign = #{3}
  1050. </if>
  1051. order by release_date desc limit #{0}
  1052. </select>
  1053. <select id="getAreaDemand" resultType="com.goafanti.demand.bo.DemandListBo">
  1054. select name,picture_url as pictureUrl ,problem_des as problemDes , data_category as dataCategory,d.id from demand d
  1055. left join branch_information branchInfo on INSTR(#{1},branchInfo.domain_name)>0
  1056. left join demand_publish dp on dp.demand_id=d.id and dp.publish_platform=branchInfo.id
  1057. 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
  1058. order by release_date desc limit #{0}
  1059. </select>
  1060. <select id="getProLearnStudyDemand" resultType="com.goafanti.demand.bo.DemandListBo">
  1061. 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
  1062. left join industry_category fg on fg.id=d.industry_category_a
  1063. left join industry_category fgg on fgg.id=d.industry_category_b
  1064. left join branch_information branchInfo on INSTR(#{1},branchInfo.domain_name)>0
  1065. left join demand_publish dp on dp.demand_id=d.id and dp.publish_platform=branchInfo.id
  1066. 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
  1067. order by release_date desc limit #{0}
  1068. </select>
  1069. <select id="getFundCrowdDemand" resultType="com.goafanti.demand.bo.DemandListBo">
  1070. 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
  1071. left join branch_information branchInfo on INSTR(#{1},branchInfo.domain_name)>0
  1072. left join demand_publish dp on dp.demand_id=d.id and dp.publish_platform=branchInfo.id
  1073. 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
  1074. order by release_date
  1075. desc limit #{0}
  1076. </select>
  1077. <select id="getPersonnelDemand" resultType="com.goafanti.demand.bo.DemandListBo">
  1078. select d.name,picture_url as pictureUrl ,problem_des as problemDes ,d.id,data_category as dataCategory,budget_cost as fundForPersonnel from demand d
  1079. left join branch_information branchInfo on INSTR(#{1},branchInfo.domain_name)>0
  1080. left join demand_publish dp on dp.demand_id=d.id and dp.publish_platform=branchInfo.id
  1081. 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
  1082. order by release_date desc limit #{0}
  1083. </select>
  1084. <select id="getDemandDetail" resultType="com.goafanti.demand.bo.DemandListBo">
  1085. 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,
  1086. fg.name as industryCategory1,fgg.name as industryCategory2,u.identify_name as employerName
  1087. from demand d
  1088. left join industry_category fg on fg.id=d.industry_category_a
  1089. left join industry_category fgg on fgg.id=d.industry_category_b
  1090. left join user u on u.id=d.employer_id
  1091. where d.id=#{0}
  1092. </select>
  1093. <select id="getBoutiqueDemandList" resultType="com.goafanti.demand.bo.DemandListBo">
  1094. select d.id,d.name,picture_url as picture_url,data_category as dataCategory,problem_des as problemDes
  1095. from demand d
  1096. left join branch_information branchInfo on INSTR(#{1},branchInfo.domain_name)>0
  1097. left join demand_publish dp on dp.demand_id=d.id and dp.publish_platform=branchInfo.id
  1098. 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
  1099. order by release_date desc limit #{0}
  1100. </select>
  1101. <select id="listMyDemand" resultType="com.goafanti.portal.bo.DemandSearchListBo">
  1102. select
  1103. id,
  1104. serial_number as serialNumber,
  1105. name,
  1106. demand_type as demandType,
  1107. audit_status as auditStatus,
  1108. create_time as createTime
  1109. from
  1110. demand
  1111. where
  1112. info_sources=1 and
  1113. employer_id = #{uid,jdbcType=VARCHAR}
  1114. <if test="status != null">
  1115. and status = #{status,jdbcType=INTEGER}
  1116. </if>
  1117. <if test="name != null">
  1118. and name = #{name,jdbcType=VARCHAR}
  1119. </if>
  1120. <if test="startDate != null">
  1121. and create_time <![CDATA[ > ]]> #{startDate,jdbcType=VARCHAR}
  1122. </if>
  1123. <if test="endDate != null">
  1124. and create_time <![CDATA[ < ]]> #{endDate,jdbcType=VARCHAR}
  1125. </if>
  1126. </select>
  1127. <select id="searchDemandList" resultType="com.goafanti.demand.bo.DemandListBo">
  1128. 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,
  1129. industry_category_a as industryCategoryA,industry_category_b as industryCategoryB,ic.name as industryCategory1,icc.name as industryCategory2,a.release_date as releaseDate
  1130. from demand a
  1131. left join industry_category ic on ic.id=a.industry_category_a
  1132. left join industry_category icc on icc.id=a.industry_category_b
  1133. where info_sources=1 and audit_status=2
  1134. <if test="industryCategoryA!=null">
  1135. and a.industry_category_a =#{industryCategoryA,jdbcType=INTEGER}
  1136. </if>
  1137. <if test="industryCategoryB!=null">
  1138. and a.industry_category_b=#{industryCategoryB,jdbcType=INTEGER}
  1139. </if>
  1140. <if test="name !=null">
  1141. and a.name like concat("%",#{name,jdbcType=VARCHAR},"%")
  1142. </if>
  1143. <if test="deletedSign !=null">
  1144. and a.deleted_sign = #{deletedSign,jdbcType=INTEGER}
  1145. </if>
  1146. order by a.release_date
  1147. <if test="page_sql !=null">
  1148. ${page_sql}
  1149. </if>
  1150. </select>
  1151. <select id="searchDemandCount" resultType="java.lang.Integer">
  1152. select count(0) from demand a
  1153. where info_sources=1 and audit_status=2
  1154. <if test="industryCategoryA!=null">
  1155. and a.industry_category_a =#{industryCategoryA,jdbcType=INTEGER}
  1156. </if>
  1157. <if test="industryCategoryB!=null">
  1158. and a.industry_category_b=#{industryCategoryB,jdbcType=INTEGER}
  1159. </if>
  1160. <if test="name !=null">
  1161. and a.name like concat("%",#{name,jdbcType=VARCHAR},"%")
  1162. </if>
  1163. <if test="deletedSign !=null">
  1164. and a.deleted_sign = #{deletedSign,jdbcType=INTEGER}
  1165. </if>
  1166. </select>
  1167. <select id="findInterestedDemand" resultType="com.goafanti.demand.bo.DemandListBo">
  1168. 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,
  1169. industry_category_a as industryCategoryA,industry_category_b as industryCategoryB,a.release_date as releaseDate,problem_des as problemDes
  1170. from demand a
  1171. left join demand_interest di on di.demand_id=a.id
  1172. where di.uid=#{uid,jdbcType=VARCHAR}
  1173. <if test="page_sql !=null">
  1174. ${page_sql}
  1175. </if>
  1176. </select>
  1177. <select id="findInterestedDemandCount" resultType="java.lang.Integer">
  1178. select count(0)
  1179. from demand a
  1180. left join demand_interest di on di.demand_id=a.id
  1181. where di.uid=#{uid,jdbcType=VARCHAR}
  1182. </select>
  1183. <select id="MyCollectionDemandList" resultType="com.goafanti.common.bo.MyCollection">
  1184. select a.id,a.name,a.problem_des as introduction,b.name as fieidA,ifnull(c.x,0) as interestCount,
  1185. a.is_urgent as textA
  1186. from demand a
  1187. left join demand_interest di on di.demand_id=a.id
  1188. left join industry_category b on a.industry_category_a= b.id
  1189. left join (select demand_id,count(*) as x from demand_interest GROUP by demand_id) c
  1190. on c.demand_id=a.id
  1191. where a.deleted_sign=0
  1192. and di.uid= #{uid,jdbcType=VARCHAR}
  1193. order by di.create_time desc
  1194. <if test="page_sql !=null">
  1195. ${page_sql}
  1196. </if>
  1197. </select>
  1198. <select id="MyCollectionDemandCount" resultType="java.lang.Integer">
  1199. select count(0)
  1200. from demand a
  1201. left join demand_interest di on di.demand_id=a.id
  1202. where a.deleted_sign=0
  1203. and di.uid= #{uid,jdbcType=VARCHAR}
  1204. </select>
  1205. </mapper>