DemandMapper.xml 49 KB

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