DemandMapper.xml 66 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704
  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="INTEGER" />
  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.DemandListBo" parameterType="java.lang.String" >
  63. select
  64. d.id, d.serial_number AS serialNumber, d.data_category AS dataCategory, d.name, d.keyword, d.info_sources AS infoSources, d.industry_category_a AS industryCategoryA,
  65. d.industry_category_b AS industryCategoryB, d.industry_category_c AS industryCategoryC, d.demand_type AS demandType, d.problem_des AS problemDes, d.technical_requirements AS technicalRequirements,
  66. d.picture_url AS pictureUrl, d.text_file_url AS textFileUrl, d.video_url AS videoUrl, d.fixed_budget AS fixedBudget, d.fixed_cycle AS fixedCycle, d.people_number AS peopleNumber,
  67. d.fixed_scheme AS fixedScheme, d.cost_escrow AS costEscrow, d.budget_cost AS budgetCost, d.validity_period as validityPeriod, d.employer_id AS employerId, d.employer_name AS employerName,
  68. d.employer_address AS employerAddress, d.employer_contacts AS employerContacts, d.employer_contacts_mobile AS employerContactsMobile, d.employer_contacts_mailbox AS employerContactsMailbox,
  69. d.contacts, d.status, d.release_status AS releaseStatus, d.release_date AS releaseDate , d.create_time AS createTime, d.principal_id AS principalId, d.deleted_sign AS deletedSign,
  70. d.audit_status AS auditStatus, d.tech_broker_id AS techBrokerId,d.boutique,d.urgent_money AS urgentMoney,d.urgent_days as urgentDays
  71. ,ifnull(t.x,0) as orderIntentionCount,ifnull(t2.x,0) as orderCount,j.easemob_name as easemobName
  72. from demand d
  73. left join jpush_easemob_account j on d.employer_id=j.uid
  74. left join (select count(0) as x,tl.commodity_id from t_order tr
  75. left join t_order_detail tl on tl.order_no=tr.order_no
  76. where order_status != 4
  77. group by tl.commodity_id) t on d.id=t.commodity_id
  78. left join (select count(0) as x,tl.commodity_id from t_order tr
  79. left join t_order_detail tl on tl.order_no=tr.order_no
  80. where tr.order_status != 4 and tr.order_status != 0
  81. group by tl.commodity_id ) t2 on d.id=t2.commodity_id
  82. where d.id = #{id,jdbcType=VARCHAR}
  83. </select>
  84. <delete id="deleteByPrimaryKey" parameterType="java.lang.String" >
  85. delete from demand
  86. where id = #{id,jdbcType=VARCHAR}
  87. </delete>
  88. <insert id="insert" parameterType="com.goafanti.common.model.Demand" >
  89. insert into demand (id, serial_number, data_category,
  90. name, keyword, info_sources,
  91. industry_category_a, industry_category_b, industry_category_c,
  92. demand_type, problem_des, technical_requirements,
  93. picture_url, text_file_url, video_url,
  94. fixed_budget, fixed_cycle, people_number,
  95. fixed_scheme, cost_escrow, budget_cost,
  96. validity_period, employer_id, employer_name,
  97. employer_address, employer_contacts, employer_contacts_mobile,
  98. employer_contacts_mailbox, contacts, status,
  99. release_status, release_date, create_time,
  100. principal_id, deleted_sign, audit_status, tech_broker_id,boutique,remark,urgent_days,urgent_money)
  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=INTEGER}, #{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})
  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="validityPeriod != null" >
  420. validity_period = #{validityPeriod,jdbcType=TIMESTAMP},
  421. </if>
  422. <if test="employerId != null" >
  423. employer_id = #{employerId,jdbcType=VARCHAR},
  424. </if>
  425. <if test="employerName != null" >
  426. employer_name = #{employerName,jdbcType=VARCHAR},
  427. </if>
  428. <if test="employerAddress != null" >
  429. employer_address = #{employerAddress,jdbcType=VARCHAR},
  430. </if>
  431. <if test="employerContacts != null" >
  432. employer_contacts = #{employerContacts,jdbcType=VARCHAR},
  433. </if>
  434. <if test="employerContactsMobile != null" >
  435. employer_contacts_mobile = #{employerContactsMobile,jdbcType=VARCHAR},
  436. </if>
  437. <if test="employerContactsMailbox != null" >
  438. employer_contacts_mailbox = #{employerContactsMailbox,jdbcType=VARCHAR},
  439. </if>
  440. <if test="contacts != null" >
  441. contacts = #{contacts,jdbcType=INTEGER},
  442. </if>
  443. <if test="status != null" >
  444. status = #{status,jdbcType=INTEGER},
  445. </if>
  446. <if test="releaseStatus != null" >
  447. release_status = #{releaseStatus,jdbcType=INTEGER},
  448. </if>
  449. <if test="releaseDate != null" >
  450. release_date = #{releaseDate,jdbcType=TIMESTAMP},
  451. </if>
  452. <if test="createTime != null" >
  453. create_time = #{createTime,jdbcType=TIMESTAMP},
  454. </if>
  455. <if test="principalId != null" >
  456. principal_id = #{principalId,jdbcType=VARCHAR},
  457. </if>
  458. <if test="deletedSign != null" >
  459. deleted_sign = #{deletedSign,jdbcType=INTEGER},
  460. </if>
  461. <if test="auditStatus != null" >
  462. audit_status = #{auditStatus,jdbcType=INTEGER},
  463. </if>
  464. <if test="techBrokerId != null" >
  465. tech_broker_id = #{techBrokerId,jdbcType=VARCHAR},
  466. </if>
  467. <if test="boutique != null">
  468. boutique = #{boutique,jdbcType=INTEGER},
  469. </if>
  470. <if test="remark != null" >
  471. remark = #{remark,jdbcType=VARCHAR},
  472. </if>
  473. <if test="urgentDays != null" >
  474. urgent_days = #{urgentDays,jdbcType=VARCHAR},
  475. </if>
  476. <if test="urgentMoney != null" >
  477. urgent_money = #{urgentMoney,jdbcType=VARCHAR},
  478. </if>
  479. </set>
  480. where id = #{id,jdbcType=VARCHAR}
  481. </update>
  482. <update id="updateByPrimaryKey" parameterType="com.goafanti.common.model.Demand" >
  483. update demand
  484. set serial_number = #{serialNumber,jdbcType=INTEGER},
  485. data_category = #{dataCategory,jdbcType=INTEGER},
  486. name = #{name,jdbcType=VARCHAR},
  487. keyword = #{keyword,jdbcType=VARCHAR},
  488. info_sources = #{infoSources,jdbcType=INTEGER},
  489. industry_category_a = #{industryCategoryA,jdbcType=INTEGER},
  490. industry_category_b = #{industryCategoryB,jdbcType=INTEGER},
  491. industry_category_c = #{industryCategoryC,jdbcType=INTEGER},
  492. demand_type = #{demandType,jdbcType=INTEGER},
  493. problem_des = #{problemDes,jdbcType=VARCHAR},
  494. technical_requirements = #{technicalRequirements,jdbcType=VARCHAR},
  495. picture_url = #{pictureUrl,jdbcType=LONGVARCHAR},
  496. text_file_url = #{textFileUrl,jdbcType=VARCHAR},
  497. video_url = #{videoUrl,jdbcType=VARCHAR},
  498. fixed_budget = #{fixedBudget,jdbcType=DECIMAL},
  499. fixed_cycle = #{fixedCycle,jdbcType=VARCHAR},
  500. people_number = #{peopleNumber,jdbcType=INTEGER},
  501. fixed_scheme = #{fixedScheme,jdbcType=VARCHAR},
  502. cost_escrow = #{costEscrow,jdbcType=DECIMAL},
  503. budget_cost = #{budgetCost,jdbcType=DECIMAL},
  504. validity_period = #{validityPeriod,jdbcType=TIMESTAMP},
  505. employer_id = #{employerId,jdbcType=VARCHAR},
  506. employer_name = #{employerName,jdbcType=VARCHAR},
  507. employer_address = #{employerAddress,jdbcType=VARCHAR},
  508. employer_contacts = #{employerContacts,jdbcType=VARCHAR},
  509. employer_contacts_mobile = #{employerContactsMobile,jdbcType=VARCHAR},
  510. employer_contacts_mailbox = #{employerContactsMailbox,jdbcType=VARCHAR},
  511. contacts = #{contacts,jdbcType=INTEGER},
  512. status = #{status,jdbcType=INTEGER},
  513. release_status = #{releaseStatus,jdbcType=INTEGER},
  514. release_date = #{releaseDate,jdbcType=TIMESTAMP},
  515. create_time = #{createTime,jdbcType=TIMESTAMP},
  516. principal_id = #{principalId,jdbcType=VARCHAR},
  517. deleted_sign = #{deletedSign,jdbcType=INTEGER},
  518. audit_status = #{auditStatus,jdbcType=INTEGER},
  519. tech_broker_id = #{techBrokerId,jdbcType=VARCHAR},
  520. boutique = #{boutique,jdbcType=INTEGER}
  521. where id = #{id,jdbcType=VARCHAR}
  522. </update>
  523. <select id="findManageUserDemandListByPage" parameterType="String" resultType="com.goafanti.demand.bo.DemandManageListBo">
  524. select
  525. d.id, d.serial_number as serialNumber, d.data_category as dataCategory,
  526. d.name, d.keyword, d.info_sources as infoSources,
  527. ui.username, d.demand_type as demandType, d.validity_period as validityPeriod,
  528. d.employer_name as employerName, ui.province, d.status, d.urgent_days as urgentDays,d.urgent_money as urgentMoney,
  529. d.release_status as releaseStatus, d.release_date as releaseDate, a.name as techBrokerId,d.create_time as createTime,
  530. d.employer_id as employerId, d.audit_status as auditStatus,d.boutique
  531. <if test="hot != null and hot == 1"><!-- 在首页 -->
  532. ,1 as hot
  533. </if>
  534. <if test="hot != null and hot == 0"><!-- 不在首页 -->
  535. ,0 as hot
  536. </if>
  537. <if test="hot==null"><!-- 无首页参数 -->
  538. ,ifnull(mm.effective,0) as hot
  539. </if>
  540. from demand d
  541. LEFT JOIN user_identity ui on d.employer_id = ui.uid
  542. LEFT JOIN admin a on a.id = d.tech_broker_id
  543. <if test="adminId != null">
  544. LEFT JOIN user u on d.employer_id = u.id
  545. </if>
  546. <if test="hot != null and hot == 1"><!-- 在首页 -->
  547. inner join marketing_management mm on d.id = mm.product_id
  548. </if>
  549. <if test="hot == null"> <!-- 无首页参数 -->
  550. left join marketing_management mm on d.id = mm.product_id
  551. </if>
  552. where d.deleted_sign = 0 and d.data_category = 0
  553. <if test="adminId != null">
  554. and (u.mid = #{adminId,jdbcType=VARCHAR}
  555. or d.principal_id = #{adminId,jdbcType=VARCHAR}
  556. or d.tech_broker_id = #{adminId,jdbcType=VARCHAR}
  557. )
  558. </if>
  559. <if test="province != null">
  560. and ui.province = #{province,jdbcType=INTEGER}
  561. </if>
  562. <if test="auditStatus != null">
  563. and d.audit_status = #{auditStatus,jdbcType=INTEGER}
  564. </if>
  565. <if test="serialNumber != null">
  566. and d.serial_number = #{serialNumber,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="username != null">
  575. and ui.username like CONCAT('%',#{username,jdbcType=VARCHAR},'%')
  576. </if>
  577. <if test="employerName != null">
  578. and d.employer_name like CONCAT('%',#{employerName,jdbcType=VARCHAR},'%')
  579. and (d.employer_id is null or d.employer_id='')
  580. </if>
  581. <if test="infoSources != null">
  582. and d.info_sources = #{infoSources,jdbcType=INTEGER}
  583. </if>
  584. <if test="demandType != null">
  585. and d.demand_type = #{demandType,jdbcType=INTEGER}
  586. </if>
  587. <if test="status != null">
  588. and d.status = #{status,jdbcType=VARCHAR}
  589. </if>
  590. <if test="releaseStatus != null">
  591. and d.release_status = #{releaseStatus,jdbcType=INTEGER}
  592. </if>
  593. <if test="vStart != null">
  594. and d.validity_period <![CDATA[ >= ]]> #{vStart,jdbcType=TIMESTAMP}
  595. </if>
  596. <if test="vEnd != null">
  597. and d.validity_period <![CDATA[ < ]]> #{vEnd,jdbcType=TIMESTAMP}
  598. </if>
  599. <if test="rStart != null">
  600. and d.release_date <![CDATA[ >= ]]> #{rStart,jdbcType=TIMESTAMP}
  601. </if>
  602. <if test="rEnd != null">
  603. and d.release_date <![CDATA[ < ]]> #{rEnd,jdbcType=TIMESTAMP}
  604. </if>
  605. <if test="cStart != null">
  606. and d.create_time <![CDATA[ > ]]> #{cStart,jdbcType=TIMESTAMP}
  607. </if>
  608. <if test="cEnd != null">
  609. and d.create_time <![CDATA[ < ]]> #{cEnd,jdbcType=TIMESTAMP}
  610. </if>
  611. <if test="boutique != null">
  612. and d.boutique = #{boutique,jdbcType=INTEGER}
  613. </if>
  614. <if test="hot != null and hot == 0"><!-- 不在首页 -->
  615. and d.id not in(select mm.product_id from marketing_management mm where mm.effective = 1)
  616. </if>
  617. <if test="hot != null and hot == 1"><!-- 在首页 -->
  618. and mm.effective = 1
  619. </if>
  620. order by d.serial_number desc
  621. <if test="page_sql!=null">
  622. ${page_sql}
  623. </if>
  624. </select>
  625. <select id ="findManageUserDemandCount" parameterType="String" resultType="java.lang.Integer">
  626. select
  627. count(1)
  628. from demand d
  629. LEFT JOIN user_identity ui on d.employer_id = ui.uid
  630. LEFT JOIN admin a on a.id = d.tech_broker_id
  631. <if test="adminId != null">
  632. LEFT JOIN user u on d.employer_id = u.id
  633. </if>
  634. <if test="hot != null and hot == 1"><!-- 在首页 -->
  635. inner join marketing_management mm on d.id = mm.product_id
  636. </if>
  637. <if test="hot == null"> <!-- 无首页参数 -->
  638. left join marketing_management mm on d.id = mm.product_id
  639. </if>
  640. where d.deleted_sign = 0 and d.data_category = 0
  641. <if test="adminId != null">
  642. and (u.mid = #{adminId,jdbcType=VARCHAR}
  643. or d.principal_id = #{adminId,jdbcType=VARCHAR}
  644. or d.tech_broker_id = #{adminId,jdbcType=VARCHAR}
  645. )
  646. </if>
  647. <if test="serialNumber != null">
  648. and d.serial_number = #{serialNumber,jdbcType=INTEGER}
  649. </if>
  650. <if test="province != null">
  651. and ui.province = #{province,jdbcType=INTEGER}
  652. </if>
  653. <if test="auditStatus != null">
  654. and d.audit_status = #{auditStatus,jdbcType=INTEGER}
  655. </if>
  656. <if test="name != null">
  657. and d.name like CONCAT('%',#{name,jdbcType=VARCHAR},'%')
  658. </if>
  659. <if test="keyword != null">
  660. and d.keyword like "%"#{keyword,jdbcType=VARCHAR}"%"
  661. </if>
  662. <if test="username != null">
  663. and ui.username like CONCAT('%',#{username,jdbcType=VARCHAR},'%')
  664. </if>
  665. <if test="employerName != null">
  666. and d.employer_name like CONCAT('%',#{employerName,jdbcType=VARCHAR},'%')
  667. and (d.employer_id is null or d.employer_id='')
  668. </if>
  669. <if test="infoSources != null">
  670. and d.info_sources = #{infoSources,jdbcType=INTEGER}
  671. </if>
  672. <if test="demandType != null">
  673. and d.demand_type = #{demandType,jdbcType=INTEGER}
  674. </if>
  675. <if test="status != null">
  676. and d.status = #{status,jdbcType=INTEGER}
  677. </if>
  678. <if test="releaseStatus != null">
  679. and d.release_status = #{releaseStatus,jdbcType=INTEGER}
  680. </if>
  681. <if test="vStart != null">
  682. and d.validity_period <![CDATA[ > ]]> #{vStart,jdbcType=TIMESTAMP}
  683. </if>
  684. <if test="vEnd != null">
  685. and d.validity_period <![CDATA[ < ]]> #{vEnd,jdbcType=TIMESTAMP}
  686. </if>
  687. <if test="rStart != null">
  688. and d.release_date <![CDATA[ > ]]> #{rStart,jdbcType=TIMESTAMP}
  689. </if>
  690. <if test="rEnd != null">
  691. and d.release_date <![CDATA[ < ]]> #{rEnd,jdbcType=TIMESTAMP}
  692. </if>
  693. <if test="cStart != null">
  694. and d.create_time <![CDATA[ > ]]> #{cStart,jdbcType=TIMESTAMP}
  695. </if>
  696. <if test="cEnd != null">
  697. and d.create_time <![CDATA[ < ]]> #{cEnd,jdbcType=TIMESTAMP}
  698. </if>
  699. <if test="boutique != null">
  700. and d.boutique = #{boutique,jdbcType=INTEGER}
  701. </if>
  702. <if test="hot != null and hot == 0"><!-- 不在首页 -->
  703. and d.id not in(select mm.product_id from marketing_management mm where mm.effective = 1)
  704. </if>
  705. <if test="hot != null and hot == 1"><!-- 在首页 -->
  706. and mm.effective = 1
  707. </if>
  708. </select>
  709. <select id="findManageOrgDemandListByPage" parameterType="String" resultType="com.goafanti.demand.bo.DemandManageListBo">
  710. select
  711. d.id, d.serial_number as serialNumber, d.data_category as dataCategory,
  712. d.name, d.keyword, d.info_sources as infoSources,
  713. oi.unit_name as username, d.demand_type as demandType, d.validity_period as validityPeriod,
  714. d.employer_name as employerName, oi.licence_province as province, d.status, d.urgent_days as urgentDays,d.urgent_money as urgentMoney,
  715. d.release_status as releaseStatus, d.release_date as releaseDate, a.name as techBrokerId,d.create_time as createTime,
  716. d.employer_id as employerId, d.audit_status as auditStatus,
  717. d.tech_broker_id as techBrokerId,d.boutique
  718. <if test="hot != null and hot == 1"><!-- 在首页 -->
  719. ,1 as hot
  720. </if>
  721. <if test="hot != null and hot == 0"><!-- 不在首页 -->
  722. ,0 as hot
  723. </if>
  724. <if test="hot==null"><!-- 无首页参数 -->
  725. ,ifnull(mm.effective,0) as hot
  726. </if>
  727. from demand d
  728. LEFT JOIN organization_identity oi on d.employer_id = oi.uid
  729. LEFT JOIN admin a on a.id = d.tech_broker_id
  730. <if test="adminId != null">
  731. LEFT JOIN user u on d.employer_id = u.id
  732. </if>
  733. <if test="hot != null and hot == 1"><!-- 在首页 -->
  734. inner join marketing_management mm on d.id = mm.product_id
  735. </if>
  736. <if test="hot == null"> <!-- 无首页参数 -->
  737. left join marketing_management mm on d.id = mm.product_id
  738. </if>
  739. where d.deleted_sign = 0 and d.data_category = 1
  740. <if test="adminId != null">
  741. and (u.mid = #{adminId,jdbcType=VARCHAR}
  742. </if>
  743. <if test="adminId != null">
  744. or d.principal_id = #{adminId,jdbcType=VARCHAR}
  745. </if>
  746. <if test="adminId != null">
  747. or d.tech_broker_id = #{adminId,jdbcType=VARCHAR}
  748. )
  749. </if>
  750. <if test="province != null">
  751. and oi.licence_province = #{province,jdbcType=INTEGER}
  752. </if>
  753. <if test="serialNumber != null">
  754. and d.serial_number = #{serialNumber,jdbcType=INTEGER}
  755. </if>
  756. <if test="auditStatus != null">
  757. and d.audit_status = #{auditStatus,jdbcType=INTEGER}
  758. </if>
  759. <if test="name != null">
  760. and d.name like CONCAT('%',#{name,jdbcType=VARCHAR},'%')
  761. </if>
  762. <if test="keyword != null">
  763. and d.keyword like CONCAT('%',#{keyword,jdbcType=VARCHAR},'%')
  764. </if>
  765. <if test="unitName != null">
  766. and oi.unit_name like CONCAT('%',#{unitName,jdbcType=VARCHAR},'%')
  767. </if>
  768. <if test="employerName != null">
  769. and d.employer_name like CONCAT('%',#{employerName,jdbcType=VARCHAR},'%')
  770. and (d.employer_id is null or d.employer_id='')
  771. </if>
  772. <if test="infoSources != null">
  773. and d.info_sources = #{infoSources,jdbcType=INTEGER}
  774. </if>
  775. <if test="demandType != null">
  776. and d.demand_type = #{demandType,jdbcType=INTEGER}
  777. </if>
  778. <if test="status != null">
  779. and d.status = #{status,jdbcType=INTEGER}
  780. </if>
  781. <if test="releaseStatus != null">
  782. and d.release_status = #{releaseStatus,jdbcType=VARCHAR}
  783. </if>
  784. <if test="vStart != null">
  785. and d.validity_period <![CDATA[ >= ]]> #{vStart,jdbcType=TIMESTAMP}
  786. </if>
  787. <if test="vEnd != null">
  788. and d.validity_period <![CDATA[ < ]]> #{vEnd,jdbcType=TIMESTAMP}
  789. </if>
  790. <if test="rStart != null">
  791. and d.release_date <![CDATA[ >= ]]> #{rStart,jdbcType=TIMESTAMP}
  792. </if>
  793. <if test="rEnd != null">
  794. and d.release_date <![CDATA[ < ]]> #{rEnd,jdbcType=TIMESTAMP}
  795. </if>
  796. <if test="cStart != null">
  797. and d.create_time <![CDATA[ > ]]> #{cStart,jdbcType=TIMESTAMP}
  798. </if>
  799. <if test="cEnd != null">
  800. and d.create_time <![CDATA[ < ]]> #{cEnd,jdbcType=TIMESTAMP}
  801. </if>
  802. <if test="boutique != null">
  803. and d.boutique = #{boutique,jdbcType=INTEGER}
  804. </if>
  805. <if test="hot != null and hot == 0"><!-- 不在首页 -->
  806. and d.id not in(select mm.product_id from marketing_management mm where mm.effective = 1)
  807. </if>
  808. <if test="hot != null and hot == 1"><!-- 在首页 -->
  809. and mm.effective = 1
  810. </if>
  811. order by d.serial_number desc
  812. <if test="page_sql!=null">
  813. ${page_sql}
  814. </if>
  815. </select>
  816. <select id ="findManageOrgDemandCount" parameterType="String" resultType="java.lang.Integer">
  817. select
  818. count(1)
  819. from demand d
  820. LEFT JOIN organization_identity oi on d.employer_id = oi.uid
  821. LEFT JOIN admin a on a.id = d.tech_broker_id
  822. <if test="adminId != null">
  823. LEFT JOIN user u on d.employer_id = u.id
  824. </if>
  825. <if test="hot != null and hot == 1"><!-- 在首页 -->
  826. inner join marketing_management mm on d.id = mm.product_id
  827. </if>
  828. <if test="hot == null"> <!-- 无首页参数 -->
  829. left join marketing_management mm on d.id = mm.product_id
  830. </if>
  831. where d.deleted_sign = 0 and d.data_category = 1
  832. <if test="adminId != null">
  833. and (u.mid = #{adminId,jdbcType=VARCHAR}
  834. </if>
  835. <if test="adminId != null">
  836. or d.principal_id = #{adminId,jdbcType=VARCHAR}
  837. </if>
  838. <if test="adminId != null">
  839. or d.tech_broker_id = #{adminId,jdbcType=VARCHAR}
  840. )
  841. </if>
  842. <if test="serialNumber != null">
  843. and d.serial_number = #{serialNumber,jdbcType=INTEGER}
  844. </if>
  845. <if test="auditStatus != null">
  846. and d.audit_status = #{auditStatus,jdbcType=INTEGER}
  847. </if>
  848. <if test="province != null">
  849. and oi.licence_province = #{province,jdbcType=INTEGER}
  850. </if>
  851. <if test="name != null">
  852. and d.name like CONCAT('%',#{name,jdbcType=VARCHAR},'%')
  853. </if>
  854. <if test="keyword != null">
  855. and d.keyword like "%"#{keyword,jdbcType=VARCHAR}"%"
  856. </if>
  857. <if test="unitName != null">
  858. and oi.unit_name like CONCAT('%',#{unitName,jdbcType=VARCHAR},'%')
  859. </if>
  860. <if test="employerName != null">
  861. and d.employer_name like CONCAT('%',#{employerName,jdbcType=VARCHAR},'%')
  862. and (d.employer_id is null or d.employer_id='')
  863. </if>
  864. <if test="infoSources != null">
  865. and d.info_sources = #{infoSources,jdbcType=INTEGER}
  866. </if>
  867. <if test="demandType != null">
  868. and d.demand_type = #{demandType,jdbcType=INTEGER}
  869. </if>
  870. <if test="status != null">
  871. and d.status = #{status,jdbcType=VARCHAR}
  872. </if>
  873. <if test="releaseStatus != null">
  874. and d.release_status = #{releaseStatus,jdbcType=VARCHAR}
  875. </if>
  876. <if test="vStart != null">
  877. and d.validity_period <![CDATA[ >= ]]> #{vStart,jdbcType=TIMESTAMP}
  878. </if>
  879. <if test="vEnd != null">
  880. and d.validity_period <![CDATA[ < ]]> #{vEnd,jdbcType=TIMESTAMP}
  881. </if>
  882. <if test="rStart != null">
  883. and d.release_date <![CDATA[ >= ]]> #{rStart,jdbcType=TIMESTAMP}
  884. </if>
  885. <if test="rEnd != null">
  886. and d.release_date <![CDATA[ < ]]> #{rEnd,jdbcType=TIMESTAMP}
  887. </if>
  888. <if test="cStart != null">
  889. and d.create_time <![CDATA[ > ]]> #{cStart,jdbcType=TIMESTAMP}
  890. </if>
  891. <if test="cEnd != null">
  892. and d.create_time <![CDATA[ < ]]> #{cEnd,jdbcType=TIMESTAMP}
  893. </if>
  894. <if test="boutique != null">
  895. and d.boutique = #{boutique,jdbcType=INTEGER}
  896. </if>
  897. <if test="hot != null and hot == 0"><!-- 不在首页 -->
  898. and d.id not in(select mm.product_id from marketing_management mm where mm.effective = 1)
  899. </if>
  900. <if test="hot != null and hot == 1"><!-- 在首页 -->
  901. and mm.effective = 1
  902. </if>
  903. </select>
  904. <select id="selectUserDemandDetail" parameterType="java.lang.String" resultType="com.goafanti.demand.bo.DemandManageDetailBo">
  905. select
  906. d.id, d.serial_number as serialNumber, d.data_category as dataCategory,
  907. d.name, d.keyword, d.info_sources as infoSources,
  908. ui.username, d.demand_type as demandType, d.validity_period as validityPeriod,
  909. ui.province, d.status, d.release_status as releaseStatus,
  910. d.release_date as releaseDate, d.principal_id as principalId, d.industry_category_a as industryCategoryA,
  911. d.industry_category_b as industryCategoryB, d.problem_des as problemDes, d.technical_requirements as technicalRequirements,
  912. d.picture_url as pictureUrl, d.text_file_url as textFileUrl, d.video_url as videoUrl,
  913. d.budget_cost as budgetCost, d.fixed_cycle as fixedCycle, d.people_number as peopleNumber,
  914. d.fixed_scheme as fixedScheme, d.cost_escrow as costEscrow, d.employer_id as employerId,
  915. u.email as mailbox, u.mobile as mobile, d.audit_status as auditStatus,
  916. d.employer_address as employerAddress, d.employer_contacts_mobile as employerContactsMobile,
  917. d.employer_contacts_mailbox as employerContactsMailbox, d.employer_name as employerName,
  918. d.tech_broker_id as techBrokerId, u.mobile as contactsName,d.urgent_days as urgentDays,d.urgent_money as urgentMoney,
  919. d.boutique,ifnull(mm.effective,0) as hot,mm.cover_img as coverImg,d.remark
  920. from demand d
  921. left join user_identity ui on ui.uid = d.employer_id
  922. left join user u on u.id = d.employer_id
  923. left join marketing_management mm on d.id = mm.product_id
  924. where d.data_category = 0 and d.id = #{id,jdbcType=VARCHAR}
  925. </select>
  926. <select id="selectOrgDemandDetail" parameterType="java.lang.String" resultType="com.goafanti.demand.bo.DemandManageDetailBo">
  927. select
  928. d.id, d.serial_number as serialNumber, d.data_category as dataCategory,
  929. d.name, d.keyword, d.info_sources as infoSources,
  930. oi.unit_name as username, d.demand_type as demandType, d.validity_period as validityPeriod,
  931. oi.licence_province as province, d.status, d.release_status as releaseStatus,
  932. d.release_date as releaseDate, d.principal_id as principalId, d.industry_category_a as industryCategoryA,
  933. d.industry_category_b as industryCategoryB, d.problem_des as problemDes, d.technical_requirements as technicalRequirements,
  934. d.picture_url as pictureUrl, d.text_file_url as textFileUrl, d.video_url as videoUrl,
  935. d.budget_cost as budgetCost, d.fixed_cycle as fixedCycle, d.people_number as peopleNumber,
  936. d.fixed_scheme as fixedScheme, d.cost_escrow as costEscrow, d.employer_id as employerId,
  937. oi.postal_address as address, u.email as mailbox, d.contacts, d.audit_status as auditStatus,
  938. d.tech_broker_id as techBrokerId,d.remark,d.urgent_days as urgentDays,d.urgent_money as urgentMoney,
  939. d.employer_address as employerAddress, d.employer_contacts_mobile as employerContactsMobile,
  940. d.employer_contacts_mailbox as employerContactsMailbox, d.employer_name as employerName,
  941. d.boutique,ifnull(mm.effective,0) as hot,mm.cover_img as coverImg
  942. from demand d
  943. left join organization_identity oi on oi.uid = d.employer_id
  944. left join user u on u.id = d.employer_id
  945. left join marketing_management mm on d.id = mm.product_id
  946. where d.data_category = 1 and d.id = #{id,jdbcType=VARCHAR}
  947. </select>
  948. <update id="batchDeleteByPrimaryKey" parameterType="java.util.List">
  949. update demand set deleted_sign = 1
  950. where id in
  951. <foreach item="item" collection="list" open="(" separator="," close=")">
  952. #{item}
  953. </foreach>
  954. </update>
  955. <update id="updateReleaseDate" parameterType="java.lang.String">
  956. update demand set release_date = null
  957. where id = #{id,jdbcType=VARCHAR}
  958. </update>
  959. <select id="findDemandListByPage" parameterType="String" resultType="com.goafanti.demand.bo.DemandListBo">
  960. select
  961. d.id, d.serial_number as serialNumber, d.data_category as dataCategory,
  962. d.name, d.keyword, d.demand_type as demandType, d.remark,d.create_time as createTime,
  963. d.validity_period as validityPeriod, d.status, d.release_status as releaseStatus, ad.name as techBrokerId,
  964. d.release_date as releaseDate, d.employer_id as employerId, d.audit_status as auditStatus
  965. from demand d
  966. LEFT JOIN admin ad on ad.id = d.tech_broker_id
  967. where d.deleted_sign = 0
  968. and d.employer_id = #{employerId, jdbcType=VARCHAR}
  969. <if test="serialNumber != null">
  970. and d.serial_number = #{serialNumber,jdbcType=INTEGER}
  971. </if>
  972. <if test="auditStatus != null">
  973. and d.audit_status = #{auditStatus,jdbcType=INTEGER}
  974. </if>
  975. <if test="name != null">
  976. and d.name like CONCAT('%',#{name,jdbcType=VARCHAR},'%')
  977. </if>
  978. <if test="keyword != null">
  979. and d.keyword like "%"#{keyword,jdbcType=VARCHAR}"%"
  980. </if>
  981. <if test="demandType != null">
  982. and d.demand_type = #{demandType,jdbcType=INTEGER}
  983. </if>
  984. <if test="status != null">
  985. and d.status = #{status,jdbcType=VARCHAR}
  986. </if>
  987. <if test="releaseStatus != null">
  988. and d.release_status = #{releaseStatus,jdbcType=VARCHAR}
  989. </if>
  990. <if test="vStart != null">
  991. and d.validity_period <![CDATA[ >= ]]> #{vStart,jdbcType=TIMESTAMP}
  992. </if>
  993. <if test="vEnd != null">
  994. and d.validity_period <![CDATA[ < ]]> #{vEnd,jdbcType=TIMESTAMP}
  995. </if>
  996. <if test="rStart != null">
  997. and d.release_date <![CDATA[ >= ]]> #{rStart,jdbcType=TIMESTAMP}
  998. </if>
  999. <if test="rEnd != null">
  1000. and d.release_date <![CDATA[ < ]]> #{rEnd,jdbcType=TIMESTAMP}
  1001. </if>
  1002. order by d.serial_number desc
  1003. <if test="page_sql!=null">
  1004. ${page_sql}
  1005. </if>
  1006. </select>
  1007. <select id="findDemandCount" parameterType="String" resultType="java.lang.Integer">
  1008. select count(1)
  1009. from demand d
  1010. where d.deleted_sign = 0
  1011. and d.employer_id = #{employerId, jdbcType=VARCHAR}
  1012. <if test="serialNumber != null">
  1013. and d.serial_number = #{serialNumber,jdbcType=INTEGER}
  1014. </if>
  1015. <if test="auditStatus != null">
  1016. and d.audit_status = #{auditStatus,jdbcType=INTEGER}
  1017. </if>
  1018. <if test="name != null">
  1019. and d.name like CONCAT('%',#{name,jdbcType=VARCHAR},'%')
  1020. </if>
  1021. <if test="keyword != null">
  1022. and d.keyword like "%"#{keyword,jdbcType=VARCHAR}"%"
  1023. </if>
  1024. <if test="demandType != null">
  1025. and d.demand_type = #{demandType,jdbcType=INTEGER}
  1026. </if>
  1027. <if test="status != null">
  1028. and d.status = #{status,jdbcType=VARCHAR}
  1029. </if>
  1030. <if test="releaseStatus != null">
  1031. and d.release_status = #{releaseStatus,jdbcType=VARCHAR}
  1032. </if>
  1033. <if test="vStart != null">
  1034. and d.validity_period <![CDATA[ >= ]]> #{vStart,jdbcType=TIMESTAMP}
  1035. </if>
  1036. <if test="vEnd != null">
  1037. and d.validity_period <![CDATA[ < ]]> #{vEnd,jdbcType=TIMESTAMP}
  1038. </if>
  1039. <if test="rStart != null">
  1040. and d.release_date <![CDATA[ >= ]]> #{rStart,jdbcType=TIMESTAMP}
  1041. </if>
  1042. <if test="rEnd != null">
  1043. and d.release_date <![CDATA[ < ]]> #{rEnd,jdbcType=TIMESTAMP}
  1044. </if>
  1045. </select>
  1046. <insert id="insertBatch" parameterType="com.goafanti.common.model.Demand">
  1047. insert into demand
  1048. (id, deleted_sign, audit_status,
  1049. status, release_status, create_time,
  1050. keyword, data_category, name,
  1051. demand_type, problem_des, employer_name,
  1052. employer_contacts, employer_contacts_mobile, employer_contacts_mailbox, info_sources,tech_broker_id,remark,urgent_days ,urgent_money)
  1053. values
  1054. <foreach item="item" index="index" collection="list" separator=",">
  1055. (
  1056. #{item.id,jdbcType=VARCHAR}, #{item.deletedSign,jdbcType=INTEGER}, #{item.auditStatus,jdbcType=INTEGER},
  1057. #{item.status,jdbcType=INTEGER}, #{item.releaseStatus,jdbcType=INTEGER}, #{item.createTime,jdbcType=TIMESTAMP},
  1058. #{item.keyword,jdbcType=VARCHAR}, #{item.dataCategory,jdbcType=INTEGER}, #{item.name,jdbcType=VARCHAR},
  1059. #{item.demandType,jdbcType=INTEGER}, #{item.problemDes,jdbcType=VARCHAR}, #{item.employerName,jdbcType=VARCHAR},
  1060. #{item.employerContacts,jdbcType=VARCHAR}, #{item.employerContactsMobile,jdbcType=VARCHAR}, #{item.employerContactsMailbox,jdbcType=VARCHAR},
  1061. #{item.infoSources,jdbcType=INTEGER},#{item.techBrokerId,jdbcType=VARCHAR},#{item.remark,jdbcType=VARCHAR},,#{item.urgentDays,jdbcType=VARCHAR},#{item.urgentMoney,jdbcType=VARCHAR}
  1062. )
  1063. </foreach>
  1064. </insert>
  1065. <select id="findSearchDemandListByPage" parameterType="String" resultType="com.goafanti.portal.bo.DemandSearchListBo">
  1066. select
  1067. d.id, d.name, d.keyword,d.data_category as dataCategory,d.picture_url as pictureUrl,
  1068. d.serial_number as serialNumber, d.data_category as dataCategory, d.industry_category_a as industryCategoryA,
  1069. d.industry_category_b as industryCategoryB, d.demand_type as demandType, d.budget_cost as budgetCost,
  1070. d.problem_des as problemDes, d.release_date as releaseDate, d.employer_name as employerName,d.boutique,
  1071. u.lvl as level
  1072. from demand d
  1073. left join user u on u.id = d.employer_id
  1074. where d.deleted_sign = 0 and d.status = 0
  1075. <if test="keyword != null">
  1076. and d.keyword like "%"#{keyword,jdbcType=VARCHAR}"%"
  1077. </if>
  1078. <if test="industryCategoryA != null">
  1079. and d.industry_category_a = #{industryCategoryA,jdbcType=INTEGER}
  1080. </if>
  1081. <if test="industryCategoryB != null">
  1082. and d.industry_category_b = #{industryCategoryB,jdbcType=INTEGER}
  1083. </if>
  1084. <if test="budgetCostLower != null">
  1085. and d.budget_cost <![CDATA[ >= ]]> #{budgetCostLower,jdbcType=DECIMAL}
  1086. </if>
  1087. <if test="budgetCostUpper != null">
  1088. and d.budget_cost <![CDATA[ <= ]]> #{budgetCostUpper,jdbcType=DECIMAL}
  1089. </if>
  1090. <if test="demandType != null">
  1091. and d.demand_type = #{demandType,jdbcType=INTEGER}
  1092. </if>
  1093. <if test="sign == 1">
  1094. and d.budget_cost is null
  1095. </if>
  1096. and d.deleted_sign = 0
  1097. and d.release_status = 1
  1098. and d.audit_status = 3
  1099. <if test="dateSort == 0">
  1100. order by d.release_date asc
  1101. </if>
  1102. <if test="dateSort == 1">
  1103. order by d.release_date desc
  1104. </if>
  1105. <if test="page_sql!=null">
  1106. ${page_sql}
  1107. </if>
  1108. </select>
  1109. <select id="findSearchDemandCount" parameterType="String" resultType="java.lang.Integer">
  1110. select
  1111. count(1)
  1112. from demand d
  1113. where d.deleted_sign = 0 and d.status = 0
  1114. <if test="keyword != null">
  1115. and d.keyword like "%"#{keyword,jdbcType=VARCHAR}"%"
  1116. </if>
  1117. <if test="industryCategoryA != null">
  1118. and d.industry_category_a = #{industryCategoryA,jdbcType=INTEGER}
  1119. </if>
  1120. <if test="industryCategoryB != null">
  1121. and d.industry_category_b = #{industryCategoryB,jdbcType=INTEGER}
  1122. </if>
  1123. <if test="budgetCostLower != null">
  1124. and d.budget_cost <![CDATA[ >= ]]> #{budgetCostLower,jdbcType=DECIMAL}
  1125. </if>
  1126. <if test="budgetCostUpper != null">
  1127. and d.budget_cost <![CDATA[ <= ]]> #{budgetCostUpper,jdbcType=DECIMAL}
  1128. </if>
  1129. <if test="demandType != null">
  1130. and d.demand_type = #{demandType,jdbcType=INTEGER}
  1131. </if>
  1132. <if test="sign == 1">
  1133. and d.budget_cost is null
  1134. </if>
  1135. and d.deleted_sign = 0
  1136. and d.release_status = 1
  1137. and d.audit_status = 3
  1138. </select>
  1139. <select id="selectDemandSearchDetail" parameterType="java.lang.String" resultType="com.goafanti.portal.bo.DemandSearchDetailBo">
  1140. select
  1141. d.id,
  1142. d.employer_name as employerName,
  1143. d.serial_number as serialNumber,
  1144. d.keyword,
  1145. d.data_category as dataCategory,
  1146. d.name,
  1147. d.industry_category_a as industryCategoryA,
  1148. d.industry_category_b as industryCategoryB,
  1149. d.demand_type as demandType,
  1150. d.budget_cost as budgetCost,
  1151. d.problem_des as problemDes,
  1152. d.release_date as releaseDate,
  1153. d.technical_requirements as technicalRequirements,
  1154. d.picture_url as pictureUrl,
  1155. d.text_file_url as textFileUrl,
  1156. d.video_url as videoUrl,
  1157. d.fixed_cycle as fixedCycle,
  1158. d.people_number as peopleNumber,
  1159. d.fixed_scheme as fixedScheme,
  1160. d.cost_escrow as costEscrow,
  1161. d.validity_period as validityPeriod,
  1162. ui.username,
  1163. oi.unit_name as unitName,
  1164. di.id as demandInterestId,
  1165. do.id as demandOrderId,
  1166. do.status as orderStatus
  1167. from demand d
  1168. left join user_identity ui on ui.uid = d.employer_id
  1169. left join organization_identity oi on oi.uid = d.employer_id
  1170. left join demand_interest di on di.demand_id = d.id and di.uid = #{0}
  1171. left join demand_order do on do.demand_id = d.id and do.uid = #{0} and do.status <![CDATA[ <> ]]> 6
  1172. where d.id = #{1}
  1173. </select>
  1174. <select id="findDemandNumByUid" parameterType="java.lang.String" resultType="java.lang.Integer">
  1175. select
  1176. count(1)
  1177. from demand
  1178. where
  1179. deleted_sign = 0
  1180. and release_status = 1
  1181. and audit_status = 3
  1182. and employer_id = #{uid,jdbcType=VARCHAR}
  1183. </select>
  1184. <select id="findPartnerDemandListByPage" parameterType="java.lang.String" resultType="com.goafanti.demand.bo.DemandPartnerListBo">
  1185. SELECT
  1186. id,
  1187. serial_number AS serialNumber,
  1188. data_category AS dataCategory,
  1189. NAME,
  1190. keyword,
  1191. release_date AS releaseDate,
  1192. demand_type AS demandType,
  1193. validity_period AS validityPeriod,
  1194. problem_des as problemDes,
  1195. industry_category_a as industryCategoryA,
  1196. industry_category_b as industryCategoryB,
  1197. budget_cost as budgetCost
  1198. FROM
  1199. demand
  1200. WHERE
  1201. audit_status = 3
  1202. AND release_status = 1
  1203. AND deleted_sign = 0
  1204. AND employer_id = #{employerId,jdbcType=VARCHAR}
  1205. </select>
  1206. <select id="findPartnerDemandCount" parameterType="java.lang.String" resultType="java.lang.Integer">
  1207. SELECT
  1208. count(1)
  1209. FROM
  1210. demand
  1211. WHERE
  1212. audit_status = 3
  1213. AND release_status = 1
  1214. AND deleted_sign = 0
  1215. AND employer_id = #{employerId,jdbcType=VARCHAR}
  1216. </select>
  1217. <select id="findUserPortalDemandDetail" parameterType="java.lang.String" resultType="com.goafanti.portal.bo.DemandPortalDetailBo">
  1218. SELECT
  1219. d.id,
  1220. d.name,
  1221. d.keyword,
  1222. d.validity_period as validityPeriod,
  1223. d.industry_category_a AS industryCategoryA,
  1224. d.picture_url as pictureUrl,
  1225. d.employer_contacts_mobile as employerContactsMobile,
  1226. d.data_category as dataCategory,
  1227. fg.name AS industryCategoryAS,
  1228. fgg.name AS industryCategorBS,
  1229. d.budget_cost AS budgetCost,
  1230. d.problem_des AS problemDes,
  1231. dg.name AS province,
  1232. dgg.name AS city,
  1233. interest.id as interestId,
  1234. d.employer_name as employerName,
  1235. u.lvl as level
  1236. FROM
  1237. demand d
  1238. LEFT JOIN `user` u on u.id = d.employer_id
  1239. LEFT JOIN user_identity ui on ui.uid = d.employer_id
  1240. LEFT JOIN district_glossory dg ON dg.id = ui.province
  1241. LEFT JOIN district_glossory dgg ON dgg.id = ui.city
  1242. LEFT JOIN field_glossory fg on fg.id = d.industry_category_a
  1243. LEFT JOIN field_glossory fgg on fgg.id = d.industry_category_b
  1244. LEFT JOIN demand_interest interest on interest.demand_id = d.id and interest.uid = #{uid,jdbcType=VARCHAR}
  1245. WHERE
  1246. d.id = #{id,jdbcType=VARCHAR}
  1247. </select>
  1248. <select id="findOrgPortalDemandDetail" parameterType="java.lang.String" resultType="com.goafanti.portal.bo.DemandPortalDetailBo">
  1249. SELECT
  1250. d.id,
  1251. d.name,
  1252. d.keyword,
  1253. d.picture_url as pictureUrl,
  1254. d.validity_period as validityPeriod,
  1255. d.employer_contacts_mobile as employerContactsMobile,
  1256. d.data_category as dataCategory,
  1257. d.industry_category_a AS industryCategoryA,
  1258. fg.name AS industryCategoryAS,
  1259. fgg.name AS industryCategoryBS,
  1260. d.budget_cost AS budgetCost,
  1261. d.problem_des AS problemDes,
  1262. dg.name AS province,
  1263. dgg.name AS city,
  1264. interest.id as interestId,
  1265. d.employer_name as employerName,
  1266. u.lvl as level
  1267. FROM
  1268. demand d
  1269. LEFT JOIN `user` u on u.id = d.employer_id
  1270. LEFT JOIN organization_identity oi on oi.uid = d.employer_id
  1271. LEFT JOIN district_glossory dg ON dg.id = oi.licence_province
  1272. LEFT JOIN district_glossory dgg ON dgg.id = oi.licence_city
  1273. LEFT JOIN field_glossory fg on fg.id = d.industry_category_a
  1274. LEFT JOIN field_glossory fgg on fgg.id = d.industry_category_b
  1275. LEFT JOIN demand_interest interest on interest.demand_id = d.id and interest.uid = #{uid,jdbcType=VARCHAR}
  1276. WHERE
  1277. d.id = #{id,jdbcType=VARCHAR}
  1278. </select>
  1279. <select id="findByIndustryCategoryA" resultType="com.goafanti.portal.bo.DemandPortalSimilarListBo">
  1280. select
  1281. d.id,
  1282. d.name,
  1283. fg.name as industryCategoryAS,
  1284. fgg.name as industryCategoryBS,
  1285. d.problem_des as problemDes,
  1286. d.budget_cost as budgetCost,
  1287. u.lvl as level
  1288. from
  1289. demand d
  1290. left join user u on u.id = d.employer_id
  1291. LEFT JOIN field_glossory fg on fg.id = d.industry_category_a
  1292. LEFT JOIN field_glossory fgg on fgg.id = d.industry_category_b
  1293. where
  1294. d.audit_status = 3
  1295. and d.release_status = 1
  1296. and d.deleted_sign = 0
  1297. and d.industry_category_a = #{industryCategoryA,jdbcType=INTEGER}
  1298. and d.id <![CDATA[ <> ]]> #{id,jdbcType=VARCHAR}
  1299. order by d.serial_number desc
  1300. limit 5
  1301. </select>
  1302. <update id="updateEmployerId" parameterType="java.lang.String" >
  1303. update demand set employer_id = null
  1304. where id = #{id,jdbcType=VARCHAR}
  1305. </update>
  1306. <select id="findBoutiqueListByPage" parameterType="java.lang.Integer" resultType="com.goafanti.portal.bo.BoutiqueListBo">
  1307. select
  1308. a.id,a.name,
  1309. b.name as industryCatalog,
  1310. a.picture_url as pictureUrl,
  1311. a.problem_des as sketch,
  1312. a.data_category as ownerType,
  1313. a.employer_name as personName
  1314. from
  1315. demand a
  1316. left join field_glossory b on a.industry_category_a = b.id
  1317. where
  1318. a.boutique = 1 and a.audit_status =3 and a.deleted_sign=0
  1319. <if test="industryCategoryA != null and industryCategoryA != ''">
  1320. and a.industry_category_a = #{industryCategoryA,jdbcType=INTEGER}
  1321. </if>
  1322. order by
  1323. a.create_time desc
  1324. <if test="page_sql!=null">
  1325. ${page_sql}
  1326. </if>
  1327. </select>
  1328. <select id="findBoutiqueCount" parameterType="java.lang.Integer" resultType="java.lang.Integer">
  1329. select
  1330. count(1)
  1331. from
  1332. demand a
  1333. left
  1334. join field_glossory b
  1335. on
  1336. a.industry_category_a = b.id
  1337. where
  1338. a.boutique = 1 and a.audit_status =3 and a.deleted_sign=0
  1339. <if test="industryCategoryA != null and industryCategoryA != ''">
  1340. and a.industry_category_a = #{industryCategoryA,jdbcType=INTEGER}
  1341. </if>
  1342. </select>
  1343. <!-- 查询需求列表 -->
  1344. <select id="selectDemandList"
  1345. resultType="com.goafanti.demand.bo.DemandListBo">
  1346. SELECT
  1347. d.id,
  1348. d.name,
  1349. d.keyword,
  1350. d.data_category as dataCategory,
  1351. d.fixed_budget as fixedbudget,
  1352. d.demand_type as demandType,
  1353. d.picture_url as pictureUrl,
  1354. d.industry_category_a AS industryCategoryA,
  1355. fg.name AS
  1356. industryCategoryAS,
  1357. fgg.name AS industryCategorBS,
  1358. d.budget_cost AS
  1359. budgetCost,
  1360. d.problem_des AS problemDes,
  1361. dg.name AS
  1362. province,
  1363. dgg.name AS
  1364. city,
  1365. d.employer_name as
  1366. employerName,
  1367. u.lvl as
  1368. level
  1369. FROM
  1370. demand d
  1371. LEFT JOIN `user` u on u.id = d.employer_id
  1372. LEFT JOIN
  1373. user_identity ui on ui.uid = d.employer_id
  1374. LEFT JOIN district_glossory
  1375. dg ON dg.id = ui.province
  1376. LEFT JOIN district_glossory dgg ON dgg.id =
  1377. ui.city
  1378. LEFT JOIN field_glossory fg on fg.id = d.industry_category_a
  1379. LEFT JOIN field_glossory fgg on fgg.id = d.industry_category_b
  1380. WHERE
  1381. <if test="_parameter!= null">
  1382. d.boutique = #{_parameter,jdbcType=INTEGER}
  1383. </if>
  1384. limit 0,30
  1385. </select>
  1386. <!-- 猜你喜欢 -->
  1387. <select id="selectCsutomerLike"
  1388. resultType="com.goafanti.demand.bo.DemandListBo">
  1389. SELECT
  1390. d.id,
  1391. d.name,
  1392. d.keyword,
  1393. d.data_category as dataCategory,
  1394. d.fixed_budget as fixedbudget,
  1395. d.demand_type as demandType,
  1396. d.picture_url as pictureUrl,
  1397. d.industry_category_a AS industryCategoryA,
  1398. fg.name AS
  1399. industryCategoryAS,
  1400. fgg.name AS industryCategorBS,
  1401. d.budget_cost AS
  1402. budgetCost,
  1403. d.problem_des AS problemDes,
  1404. dg.name AS
  1405. province,
  1406. dgg.name AS
  1407. city,
  1408. d.employer_name as
  1409. employerName,
  1410. u.lvl as
  1411. level
  1412. FROM
  1413. demand d
  1414. LEFT JOIN `user` u on u.id = d.employer_id
  1415. LEFT JOIN
  1416. user_identity ui on ui.uid = d.employer_id
  1417. LEFT JOIN district_glossory
  1418. dg ON dg.id = ui.province
  1419. LEFT JOIN district_glossory dgg ON dgg.id =
  1420. ui.city
  1421. LEFT JOIN field_glossory fg on fg.id = d.industry_category_a
  1422. LEFT JOIN field_glossory fgg on fgg.id = d.industry_category_b
  1423. LEFT JOIN demand_interest interest on interest.demand_id = d.id
  1424. where
  1425. interest.uid = #{uid,jdbcType=INTEGER}
  1426. limit 0,4
  1427. </select>
  1428. <select id="countInterest" resultType="Integer">
  1429. select count(0)
  1430. from demand_interest
  1431. where demand_id = #{demandId,jdbcType=VARCHAR}
  1432. </select>
  1433. <select id="findAppDemandListByPage" parameterType="String" resultType="com.goafanti.demand.bo.DemandListBo">
  1434. select
  1435. d.id, d.serial_number as serialNumber, d.data_category as dataCategory, d.boutique,
  1436. 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,
  1437. d.validity_period as validityPeriod, d.status, d.release_status as releaseStatus,
  1438. d.release_date as releaseDate, d.employer_id as employerId, d.audit_status as auditStatus,t.city as cityname,
  1439. 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
  1440. from demand d
  1441. left join user_identity t on d.employer_id=t.uid
  1442. left join field_glossory g on d.industry_category_a=g.id
  1443. left join field_glossory g2 on d.industry_category_b=g2.id
  1444. left join (select count(0) as countInterest ,demand_id from demand_interest
  1445. group by demand_id) t on d.id=t.demand_id
  1446. where d.deleted_sign = 0
  1447. and d.audit_status=3
  1448. <if test="employerId != null">
  1449. and d.employer_id = #{employerId, jdbcType=VARCHAR}
  1450. </if>
  1451. <if test="serialNumber != null">
  1452. and d.serial_number = #{serialNumber,jdbcType=INTEGER}
  1453. </if>
  1454. <if test="auditStatus != null">
  1455. and d.audit_status = #{auditStatus,jdbcType=INTEGER}
  1456. </if>
  1457. <if test="name != null">
  1458. and d.name like CONCAT('%',#{name,jdbcType=VARCHAR},'%')
  1459. </if>
  1460. <if test="keyword != null">
  1461. and d.keyword like "%"#{keyword,jdbcType=VARCHAR}"%"
  1462. </if>
  1463. <if test="demandType != null">
  1464. and d.demand_type = #{demandType,jdbcType=INTEGER}
  1465. </if>
  1466. <if test="industryCategoryA != null">
  1467. and d.industry_category_a = #{industryCategoryA,jdbcType=INTEGER}
  1468. </if>
  1469. <if test="status != null">
  1470. and d.status = #{status,jdbcType=VARCHAR}
  1471. </if>
  1472. <if test="releaseStatus != null">
  1473. and d.release_status = #{releaseStatus,jdbcType=VARCHAR}
  1474. </if>
  1475. <if test="vStart != null">
  1476. and d.validity_period <![CDATA[ >= ]]> #{vStart,jdbcType=TIMESTAMP}
  1477. </if>
  1478. <if test="vEnd != null">
  1479. and d.validity_period <![CDATA[ < ]]> #{vEnd,jdbcType=TIMESTAMP}
  1480. </if>
  1481. <if test="rStart != null">
  1482. and d.release_date <![CDATA[ >= ]]> #{rStart,jdbcType=TIMESTAMP}
  1483. </if>
  1484. <if test="rEnd != null">
  1485. and d.release_date <![CDATA[ < ]]> #{rEnd,jdbcType=TIMESTAMP}
  1486. </if>
  1487. order by d.boutique desc
  1488. <if test="page_sql!=null">
  1489. ${page_sql}
  1490. </if>
  1491. </select>
  1492. <select id="findAppDemandCount" parameterType="String" resultType="java.lang.Integer">
  1493. select count(1)
  1494. from demand d
  1495. where d.deleted_sign = 0
  1496. <if test="employerId != null">
  1497. and d.employer_id = #{employerId, jdbcType=VARCHAR}
  1498. </if>
  1499. <if test="serialNumber != null">
  1500. and d.serial_number = #{serialNumber,jdbcType=INTEGER}
  1501. </if>
  1502. <if test="auditStatus != null">
  1503. and d.audit_status = #{auditStatus,jdbcType=INTEGER}
  1504. </if>
  1505. <if test="industryCategoryA != null">
  1506. and d.industry_category_a = #{industryCategoryA,jdbcType=INTEGER}
  1507. </if>
  1508. <if test="name != null">
  1509. and d.name like CONCAT('%',#{name,jdbcType=VARCHAR},'%')
  1510. </if>
  1511. <if test="keyword != null">
  1512. and d.keyword like "%"#{keyword,jdbcType=VARCHAR}"%"
  1513. </if>
  1514. <if test="demandType != null">
  1515. and d.demand_type = #{demandType,jdbcType=INTEGER}
  1516. </if>
  1517. <if test="status != null">
  1518. and d.status = #{status,jdbcType=VARCHAR}
  1519. </if>
  1520. <if test="releaseStatus != null">
  1521. and d.release_status = #{releaseStatus,jdbcType=VARCHAR}
  1522. </if>
  1523. <if test="vStart != null">
  1524. and d.validity_period <![CDATA[ >= ]]> #{vStart,jdbcType=TIMESTAMP}
  1525. </if>
  1526. <if test="vEnd != null">
  1527. and d.validity_period <![CDATA[ < ]]> #{vEnd,jdbcType=TIMESTAMP}
  1528. </if>
  1529. <if test="rStart != null">
  1530. and d.release_date <![CDATA[ >= ]]> #{rStart,jdbcType=TIMESTAMP}
  1531. </if>
  1532. <if test="rEnd != null">
  1533. and d.release_date <![CDATA[ < ]]> #{rEnd,jdbcType=TIMESTAMP}
  1534. </if>
  1535. </select>
  1536. <select id="demandInterest" resultType="com.goafanti.demand.bo.DemandInterestBo">
  1537. select
  1538. d.id,d.name,di.create_time as createTime
  1539. from demand_interest di
  1540. LEFT join demand d on di.demand_id=d.id
  1541. where uid=#{uid,jdbcType=VARCHAR}
  1542. </select>
  1543. <select id="findAppMyDemandListByPage" parameterType="String" resultType="com.goafanti.demand.bo.DemandListBo">
  1544. select
  1545. d.id, d.boutique,d.name, d.audit_status as auditStatus,ifnull(t.x,0) as orderCount,
  1546. d.release_date as releaseDate,ifnull(i.y,0) as countInterest
  1547. from demand d
  1548. left join (select count(0) as x,commodity_id from t_order
  1549. where order_status != 4 and order_status != 0
  1550. group by commodity_id ) t on d.id=t.commodity_id
  1551. left join (select count(0) as y,demand_id from demand_interest
  1552. group by demand_id ) i on d.id=i.demand_id
  1553. where d.deleted_sign = 0
  1554. <if test="employerId != null">
  1555. and d.employer_id = #{employerId, jdbcType=VARCHAR}
  1556. </if>
  1557. order by d.serial_number desc
  1558. <if test="page_sql!=null">
  1559. ${page_sql}
  1560. </if>
  1561. </select>
  1562. <select id="findAppMyDemandCount" parameterType="String" resultType="java.lang.Integer">
  1563. select count(1)
  1564. from demand d
  1565. where d.deleted_sign = 0
  1566. <if test="employerId != null">
  1567. and d.employer_id = #{employerId, jdbcType=VARCHAR}
  1568. </if>
  1569. </select>
  1570. <select id="selectDemandDetail" resultMap="BaseResultMap" parameterType="java.lang.String" >
  1571. select
  1572. d.id, d.serial_number AS serialNumber, d.data_category AS serialNumber,d.name, d.keyword, d.info_sources AS infoSources, d.industry_category_a AS industryCategoryA,
  1573. d.industry_category_b AS industryCategoryB, d.industry_category_c AS industryCategoryC, d.demand_type AS demandType, d.problem_des AS problemDes, d.technical_requirements AS technicalRequirements,
  1574. d.picture_url AS pictureUrl, d.text_file_url AS textFileUrl, d.video_url AS videoUrl, d.fixed_budget AS fixedBudget, d.fixed_cycle AS fixedCycle, d.people_number AS peopleNumber,
  1575. d.fixed_scheme as fixedScheme, d.cost_escrow AS costEscrow, d.budget_cost AS budgetCost, d.validity_period AS validityPeriod, d.employer_id AS employerId, d.employer_name AS employerName,
  1576. d.employer_address as employerAddress, d.employer_contacts as employerContacts, d.employer_contacts_mobile as employerContactsMobile, d.employer_contacts_mailbox as employerContactsMailbox,
  1577. d.contacts, d.status,d.release_status as releaseStatus, d.release_date as releaseDate, d.create_time as createTime, d.principal_id as principalId, d.deleted_sign as deletedSign,j.easemob_name as easemobName,
  1578. d.audit_status as auditStatus, d.tech_broker_id as techBrokerId,d.boutique,d.urgent_money as urgentMoney,d.urgent_days as urgentDays
  1579. from demand d
  1580. left join jpush_easemob_account j on d.employer_id=j.uid
  1581. where d.id = #{id,jdbcType=VARCHAR}
  1582. </select>
  1583. <select id="findAppNewsInterestByPage" parameterType="String" resultType="com.goafanti.demand.bo.ObjectInterestListBo">
  1584. select n.id,n.title as name,n.create_time as createTime
  1585. from news_interest ni
  1586. LEFT join news n on ni.new_id=n.id
  1587. where ni.uid=#{uid,jdbcType=VARCHAR}
  1588. order by createTime desc
  1589. <if test="page_sql!=null">
  1590. ${page_sql}
  1591. </if>
  1592. </select>
  1593. <select id="findAppNewsInterestCount" parameterType="String" resultType="java.lang.Integer">
  1594. select count(1)
  1595. from news_interest ni
  1596. LEFT join news n on ni.new_id=n.id
  1597. where ni.uid=#{uid,jdbcType=VARCHAR}
  1598. </select>
  1599. <select id="findAppUserInterestByPage" parameterType="String" resultType="com.goafanti.demand.bo.ObjectInterestListBo">
  1600. select y.uid as id,y.username as name ,t.create_time as createTime
  1601. from user_interest t
  1602. left join user_identity y on t.to_uid=y.uid
  1603. where expert=1
  1604. and from_uid=#{uid,jdbcType=VARCHAR}
  1605. <if test="page_sql!=null">
  1606. ${page_sql}
  1607. </if>
  1608. </select>
  1609. <select id="findAppUserInterestCount" parameterType="String" resultType="java.lang.Integer">
  1610. select count(1)
  1611. from user_interest t
  1612. left join user_identity y on t.to_uid=y.uid
  1613. where from_uid=#{uid,jdbcType=VARCHAR}
  1614. </select>
  1615. <select id="findAppDemandInterestByPage" resultType="com.goafanti.demand.bo.ObjectInterestListBo">
  1616. select d.id ,d.name,t.create_time as createTime
  1617. from demand_interest t
  1618. left join demand d on t.demand_id=d.id
  1619. where t.uid=#{uid,jdbcType=VARCHAR}
  1620. <if test="page_sql!=null">
  1621. ${page_sql}
  1622. </if>
  1623. </select>
  1624. <select id="findAppDemandInterestCount" parameterType="String" resultType="java.lang.Integer">
  1625. select count(1)
  1626. from demand_interest t
  1627. left join demand d on t.demand_id=d.id
  1628. where uid=#{uid,jdbcType=VARCHAR}
  1629. </select>
  1630. <select id="findAppAchievementInterestByPage" parameterType="String" resultType="com.goafanti.demand.bo.ObjectInterestListBo">
  1631. select a.id ,a.name,t.create_time as createTime
  1632. from achievement_interest t
  1633. left join achievement a on t.achievement_id=a.id
  1634. where t.uid=#{uid,jdbcType=VARCHAR}
  1635. <if test="page_sql!=null">
  1636. ${page_sql}
  1637. </if>
  1638. </select>
  1639. <select id="findAppAchievementInterestCount" parameterType="String" resultType="java.lang.Integer">
  1640. select count(1)
  1641. from achievement_interest t
  1642. left join achievement a on t.achievement_id=a.id
  1643. where t.uid=#{uid,jdbcType=VARCHAR}
  1644. </select>
  1645. <select id="findAppProjectInterestByPage" parameterType="String" resultType="com.goafanti.demand.bo.ObjectInterestListBo">
  1646. select b.id ,b.bname as name,t.uid,t.create_time as createTime
  1647. from project_interest t
  1648. left join business_project b on t.project_id=b.id
  1649. where t.uid=#{uid,jdbcType=VARCHAR}
  1650. <if test="page_sql!=null">
  1651. ${page_sql}
  1652. </if>
  1653. </select>
  1654. <select id="findAppProjectInterestCount" parameterType="String" resultType="java.lang.Integer">
  1655. select count(1)
  1656. from project_interest t
  1657. left join (select id,count(0) as countInterest ,project_id from project_interest
  1658. group by project_id
  1659. ) x on t.id=x.id
  1660. left join business_project b on t.project_id=b.id
  1661. where t.uid=#{uid,jdbcType=VARCHAR}
  1662. </select>
  1663. </mapper>