DemandMapper.xml 85 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169
  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.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,d.contacts,d.contact_mobile as contactMobile
  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,contact_mobile)
  101. values (#{id,jdbcType=VARCHAR}, #{serialNumber,jdbcType=INTEGER}, #{dataCategory,jdbcType=INTEGER},
  102. #{name,jdbcType=VARCHAR}, #{keyword,jdbcType=VARCHAR}, #{infoSources,jdbcType=INTEGER},
  103. #{industryCategoryA,jdbcType=INTEGER}, #{industryCategoryB,jdbcType=INTEGER}, #{industryCategoryC,jdbcType=INTEGER},
  104. #{demandType,jdbcType=INTEGER}, #{problemDes,jdbcType=VARCHAR}, #{technicalRequirements,jdbcType=VARCHAR},
  105. #{pictureUrl,jdbcType=LONGVARCHAR}, #{textFileUrl,jdbcType=VARCHAR}, #{videoUrl,jdbcType=VARCHAR},
  106. #{fixedBudget,jdbcType=DECIMAL}, #{fixedCycle,jdbcType=VARCHAR}, #{peopleNumber,jdbcType=INTEGER},
  107. #{fixedScheme,jdbcType=VARCHAR}, #{costEscrow,jdbcType=DECIMAL}, #{budgetCost,jdbcType=DECIMAL},
  108. #{validityPeriod,jdbcType=TIMESTAMP}, #{employerId,jdbcType=VARCHAR}, #{employerName,jdbcType=VARCHAR},
  109. #{employerAddress,jdbcType=VARCHAR}, #{employerContacts,jdbcType=VARCHAR}, #{employerContactsMobile,jdbcType=VARCHAR},
  110. #{employerContactsMailbox,jdbcType=VARCHAR}, #{contacts,jdbcType=VARCHAR}, #{status,jdbcType=INTEGER},
  111. #{releaseStatus,jdbcType=INTEGER}, #{releaseDate,jdbcType=TIMESTAMP}, #{createTime,jdbcType=TIMESTAMP},
  112. #{principalId,jdbcType=VARCHAR}, #{deletedSign,jdbcType=INTEGER}, #{auditStatus,jdbcType=INTEGER},
  113. #{techBrokerId,jdbcType=VARCHAR},#{boutique,jdbcType=INTEGER},#{remark,jdbcType=VARCHAR},#{urgentDays,jdbcType=VARCHAR},#{urgentMoney,jdbcType=VARCHAR},#{contactMobile,jdbcType=VARCHAR})
  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=VARCHAR},
  442. </if>
  443. <if test="contactMobile != null" >
  444. contact_mobile = #{contactMobile ,jdbcType=VARCHAR},
  445. </if>
  446. <if test="status != null" >
  447. status = #{status,jdbcType=INTEGER},
  448. </if>
  449. <if test="releaseStatus != null" >
  450. release_status = #{releaseStatus,jdbcType=INTEGER},
  451. </if>
  452. <if test="releaseDate != null" >
  453. release_date = #{releaseDate,jdbcType=TIMESTAMP},
  454. </if>
  455. <if test="createTime != null" >
  456. create_time = #{createTime,jdbcType=TIMESTAMP},
  457. </if>
  458. <if test="principalId != null" >
  459. principal_id = #{principalId,jdbcType=VARCHAR},
  460. </if>
  461. <if test="deletedSign != null" >
  462. deleted_sign = #{deletedSign,jdbcType=INTEGER},
  463. </if>
  464. <if test="auditStatus != null" >
  465. audit_status = #{auditStatus,jdbcType=INTEGER},
  466. </if>
  467. <if test="techBrokerId != null" >
  468. tech_broker_id = #{techBrokerId,jdbcType=VARCHAR},
  469. </if>
  470. <if test="boutique != null">
  471. boutique = #{boutique,jdbcType=INTEGER},
  472. </if>
  473. <if test="remark != null" >
  474. remark = #{remark,jdbcType=VARCHAR},
  475. </if>
  476. <if test="urgentDays != null" >
  477. urgent_days = #{urgentDays,jdbcType=VARCHAR},
  478. </if>
  479. <if test="urgentMoney != null" >
  480. urgent_money = #{urgentMoney,jdbcType=VARCHAR},
  481. </if>
  482. </set>
  483. where id = #{id,jdbcType=VARCHAR}
  484. </update>
  485. <update id="updateByPrimaryKey" parameterType="com.goafanti.common.model.Demand" >
  486. update demand
  487. set serial_number = #{serialNumber,jdbcType=INTEGER},
  488. data_category = #{dataCategory,jdbcType=INTEGER},
  489. name = #{name,jdbcType=VARCHAR},
  490. keyword = #{keyword,jdbcType=VARCHAR},
  491. info_sources = #{infoSources,jdbcType=INTEGER},
  492. industry_category_a = #{industryCategoryA,jdbcType=INTEGER},
  493. industry_category_b = #{industryCategoryB,jdbcType=INTEGER},
  494. industry_category_c = #{industryCategoryC,jdbcType=INTEGER},
  495. demand_type = #{demandType,jdbcType=INTEGER},
  496. problem_des = #{problemDes,jdbcType=VARCHAR},
  497. technical_requirements = #{technicalRequirements,jdbcType=VARCHAR},
  498. picture_url = #{pictureUrl,jdbcType=LONGVARCHAR},
  499. text_file_url = #{textFileUrl,jdbcType=VARCHAR},
  500. video_url = #{videoUrl,jdbcType=VARCHAR},
  501. fixed_budget = #{fixedBudget,jdbcType=DECIMAL},
  502. fixed_cycle = #{fixedCycle,jdbcType=VARCHAR},
  503. people_number = #{peopleNumber,jdbcType=INTEGER},
  504. fixed_scheme = #{fixedScheme,jdbcType=VARCHAR},
  505. cost_escrow = #{costEscrow,jdbcType=DECIMAL},
  506. budget_cost = #{budgetCost,jdbcType=DECIMAL},
  507. validity_period = #{validityPeriod,jdbcType=TIMESTAMP},
  508. employer_id = #{employerId,jdbcType=VARCHAR},
  509. employer_name = #{employerName,jdbcType=VARCHAR},
  510. employer_address = #{employerAddress,jdbcType=VARCHAR},
  511. employer_contacts = #{employerContacts,jdbcType=VARCHAR},
  512. employer_contacts_mobile = #{employerContactsMobile,jdbcType=VARCHAR},
  513. employer_contacts_mailbox = #{employerContactsMailbox,jdbcType=VARCHAR},
  514. contacts = #{contacts,jdbcType=INTEGER},
  515. status = #{status,jdbcType=INTEGER},
  516. release_status = #{releaseStatus,jdbcType=INTEGER},
  517. release_date = #{releaseDate,jdbcType=TIMESTAMP},
  518. create_time = #{createTime,jdbcType=TIMESTAMP},
  519. principal_id = #{principalId,jdbcType=VARCHAR},
  520. deleted_sign = #{deletedSign,jdbcType=INTEGER},
  521. audit_status = #{auditStatus,jdbcType=INTEGER},
  522. tech_broker_id = #{techBrokerId,jdbcType=VARCHAR},
  523. boutique = #{boutique,jdbcType=INTEGER}
  524. where id = #{id,jdbcType=VARCHAR}
  525. </update>
  526. <select id="findManageUserDemandListByPage" parameterType="String" resultType="com.goafanti.demand.bo.DemandManageListBo">
  527. select
  528. d.id, d.serial_number as serialNumber, d.data_category as dataCategory,
  529. d.name, d.keyword, d.info_sources as infoSources,
  530. ui.username, d.demand_type as demandType, d.validity_period as validityPeriod,
  531. d.employer_name as employerName, ui.province, d.status, d.urgent_days as urgentDays,d.urgent_money as urgentMoney,
  532. d.release_status as releaseStatus, d.release_date as releaseDate, a.name as techBrokerId,d.create_time as createTime,
  533. d.employer_id as employerId, d.audit_status as auditStatus,d.boutique
  534. <if test="hot != null and hot == 1"><!-- 在首页 -->
  535. ,1 as hot
  536. </if>
  537. <if test="hot != null and hot == 0"><!-- 不在首页 -->
  538. ,0 as hot
  539. </if>
  540. <if test="hot==null"><!-- 无首页参数 -->
  541. ,ifnull(mm.effective,0) as hot
  542. </if>
  543. from demand d
  544. LEFT JOIN user_identity ui on d.employer_id = ui.uid
  545. LEFT JOIN admin a on a.id = d.tech_broker_id
  546. <if test="adminId != null">
  547. LEFT JOIN user u on d.employer_id = u.id
  548. </if>
  549. <if test="hot != null and hot == 1"><!-- 在首页 -->
  550. inner join marketing_management mm on d.id = mm.product_id
  551. </if>
  552. <if test="hot == null"> <!-- 无首页参数 -->
  553. left join marketing_management mm on d.id = mm.product_id
  554. </if>
  555. where d.deleted_sign = 0 and d.data_category = 0
  556. <if test="adminId != null">
  557. and (u.mid = #{adminId,jdbcType=VARCHAR}
  558. or d.principal_id = #{adminId,jdbcType=VARCHAR}
  559. or d.tech_broker_id = #{adminId,jdbcType=VARCHAR}
  560. )
  561. </if>
  562. <if test="province != null">
  563. and ui.province = #{province,jdbcType=INTEGER}
  564. </if>
  565. <if test="auditStatus != null">
  566. and d.audit_status = #{auditStatus,jdbcType=INTEGER}
  567. </if>
  568. <if test="serialNumber != null">
  569. and d.serial_number = #{serialNumber,jdbcType=INTEGER}
  570. </if>
  571. <if test="name != null">
  572. and d.name like CONCAT('%',#{name,jdbcType=VARCHAR},'%')
  573. </if>
  574. <if test="keyword != null">
  575. and d.keyword like "%"#{keyword,jdbcType=VARCHAR}"%"
  576. </if>
  577. <if test="username != null">
  578. and ui.username like CONCAT('%',#{username,jdbcType=VARCHAR},'%')
  579. </if>
  580. <if test="employerName != null">
  581. and d.employer_name like CONCAT('%',#{employerName,jdbcType=VARCHAR},'%')
  582. and (d.employer_id is null or d.employer_id='')
  583. </if>
  584. <if test="infoSources != null">
  585. and d.info_sources = #{infoSources,jdbcType=INTEGER}
  586. </if>
  587. <if test="demandType != null">
  588. and d.demand_type = #{demandType,jdbcType=INTEGER}
  589. </if>
  590. <if test="status != null">
  591. and d.status = #{status,jdbcType=VARCHAR}
  592. </if>
  593. <if test="releaseStatus != null">
  594. and d.release_status = #{releaseStatus,jdbcType=INTEGER}
  595. </if>
  596. <if test="vStart != null">
  597. and d.validity_period <![CDATA[ >= ]]> #{vStart,jdbcType=TIMESTAMP}
  598. </if>
  599. <if test="vEnd != null">
  600. and d.validity_period <![CDATA[ < ]]> #{vEnd,jdbcType=TIMESTAMP}
  601. </if>
  602. <if test="rStart != null">
  603. and d.release_date <![CDATA[ >= ]]> #{rStart,jdbcType=TIMESTAMP}
  604. </if>
  605. <if test="rEnd != null">
  606. and d.release_date <![CDATA[ < ]]> #{rEnd,jdbcType=TIMESTAMP}
  607. </if>
  608. <if test="cStart != null">
  609. and d.create_time <![CDATA[ > ]]> #{cStart,jdbcType=TIMESTAMP}
  610. </if>
  611. <if test="cEnd != null">
  612. and d.create_time <![CDATA[ < ]]> #{cEnd,jdbcType=TIMESTAMP}
  613. </if>
  614. <if test="boutique != null">
  615. and d.boutique = #{boutique,jdbcType=INTEGER}
  616. </if>
  617. <if test="hot != null and hot == 0"><!-- 不在首页 -->
  618. and d.id not in(select mm.product_id from marketing_management mm where mm.effective = 1)
  619. </if>
  620. <if test="hot != null and hot == 1"><!-- 在首页 -->
  621. and mm.effective = 1
  622. </if>
  623. order by d.serial_number desc
  624. <if test="page_sql!=null">
  625. ${page_sql}
  626. </if>
  627. </select>
  628. <select id ="findManageUserDemandCount" parameterType="String" resultType="java.lang.Integer">
  629. select
  630. count(1)
  631. from demand d
  632. LEFT JOIN user_identity ui on d.employer_id = ui.uid
  633. LEFT JOIN admin a on a.id = d.tech_broker_id
  634. <if test="adminId != null">
  635. LEFT JOIN user u on d.employer_id = u.id
  636. </if>
  637. <if test="hot != null and hot == 1"><!-- 在首页 -->
  638. inner join marketing_management mm on d.id = mm.product_id
  639. </if>
  640. <if test="hot == null"> <!-- 无首页参数 -->
  641. left join marketing_management mm on d.id = mm.product_id
  642. </if>
  643. where d.deleted_sign = 0 and d.data_category = 0
  644. <if test="adminId != null">
  645. and (u.mid = #{adminId,jdbcType=VARCHAR}
  646. or d.principal_id = #{adminId,jdbcType=VARCHAR}
  647. or d.tech_broker_id = #{adminId,jdbcType=VARCHAR}
  648. )
  649. </if>
  650. <if test="serialNumber != null">
  651. and d.serial_number = #{serialNumber,jdbcType=INTEGER}
  652. </if>
  653. <if test="province != null">
  654. and ui.province = #{province,jdbcType=INTEGER}
  655. </if>
  656. <if test="auditStatus != null">
  657. and d.audit_status = #{auditStatus,jdbcType=INTEGER}
  658. </if>
  659. <if test="name != null">
  660. and d.name like CONCAT('%',#{name,jdbcType=VARCHAR},'%')
  661. </if>
  662. <if test="keyword != null">
  663. and d.keyword like "%"#{keyword,jdbcType=VARCHAR}"%"
  664. </if>
  665. <if test="username != null">
  666. and ui.username like CONCAT('%',#{username,jdbcType=VARCHAR},'%')
  667. </if>
  668. <if test="employerName != null">
  669. and d.employer_name like CONCAT('%',#{employerName,jdbcType=VARCHAR},'%')
  670. and (d.employer_id is null or d.employer_id='')
  671. </if>
  672. <if test="infoSources != null">
  673. and d.info_sources = #{infoSources,jdbcType=INTEGER}
  674. </if>
  675. <if test="demandType != null">
  676. and d.demand_type = #{demandType,jdbcType=INTEGER}
  677. </if>
  678. <if test="status != null">
  679. and d.status = #{status,jdbcType=INTEGER}
  680. </if>
  681. <if test="releaseStatus != null">
  682. and d.release_status = #{releaseStatus,jdbcType=INTEGER}
  683. </if>
  684. <if test="vStart != null">
  685. and d.validity_period <![CDATA[ > ]]> #{vStart,jdbcType=TIMESTAMP}
  686. </if>
  687. <if test="vEnd != null">
  688. and d.validity_period <![CDATA[ < ]]> #{vEnd,jdbcType=TIMESTAMP}
  689. </if>
  690. <if test="rStart != null">
  691. and d.release_date <![CDATA[ > ]]> #{rStart,jdbcType=TIMESTAMP}
  692. </if>
  693. <if test="rEnd != null">
  694. and d.release_date <![CDATA[ < ]]> #{rEnd,jdbcType=TIMESTAMP}
  695. </if>
  696. <if test="cStart != null">
  697. and d.create_time <![CDATA[ > ]]> #{cStart,jdbcType=TIMESTAMP}
  698. </if>
  699. <if test="cEnd != null">
  700. and d.create_time <![CDATA[ < ]]> #{cEnd,jdbcType=TIMESTAMP}
  701. </if>
  702. <if test="boutique != null">
  703. and d.boutique = #{boutique,jdbcType=INTEGER}
  704. </if>
  705. <if test="hot != null and hot == 0"><!-- 不在首页 -->
  706. and d.id not in(select mm.product_id from marketing_management mm where mm.effective = 1)
  707. </if>
  708. <if test="hot != null and hot == 1"><!-- 在首页 -->
  709. and mm.effective = 1
  710. </if>
  711. </select>
  712. <select id="findManageOrgDemandListByPage" parameterType="String" resultType="com.goafanti.demand.bo.DemandManageListBo">
  713. select
  714. d.id, d.serial_number as serialNumber, d.data_category as dataCategory,
  715. d.name, d.keyword, d.info_sources as infoSources,
  716. d.demand_type as demandType, d.validity_period as validityPeriod,
  717. d.employer_name as employerName,d.status, d.urgent_days as urgentDays,d.urgent_money as urgentMoney,
  718. d.release_status as releaseStatus, d.release_date as releaseDate, a.name as techBrokerId,d.create_time as createTime,
  719. d.employer_id as employerId, d.audit_status as auditStatus,
  720. d.tech_broker_id as techBrokerIdd,d.boutique
  721. <if test="hot != null and hot == 1"><!-- 在首页 -->
  722. ,1 as hot
  723. </if>
  724. <if test="hot != null and hot == 0"><!-- 不在首页 -->
  725. ,0 as hot
  726. </if>
  727. <if test="hot==null"><!-- 无首页参数 -->
  728. ,ifnull(mm.effective,0) as hot
  729. </if>
  730. from demand d
  731. LEFT JOIN admin a on a.id = d.tech_broker_id
  732. <if test="hot != null and hot == 1"><!-- 在首页 -->
  733. inner join marketing_management mm on d.id = mm.product_id
  734. </if>
  735. <if test="hot == null"> <!-- 无首页参数 -->
  736. left join marketing_management mm on d.id = mm.product_id
  737. </if>
  738. where d.deleted_sign = 0
  739. <if test="recordPerson != null">
  740. and a.name= #{recordPerson,jdbcType=VARCHAR}
  741. </if>
  742. <if test="dataCategory != null">
  743. and d.data_category = #{dataCategory,jdbcType=VARCHAR}
  744. </if>
  745. <if test="serialNumber != null">
  746. and d.serial_number = #{serialNumber,jdbcType=INTEGER}
  747. </if>
  748. <if test="auditStatus != null">
  749. and d.audit_status = #{auditStatus,jdbcType=INTEGER}
  750. </if>
  751. <if test="name != null">
  752. and d.name like CONCAT('%',#{name,jdbcType=VARCHAR},'%')
  753. </if>
  754. <if test="keyword != null">
  755. and d.keyword like CONCAT('%',#{keyword,jdbcType=VARCHAR},'%')
  756. </if>
  757. <if test="employerName != null">
  758. and d.employer_name like CONCAT('%',#{employerName,jdbcType=VARCHAR},'%')
  759. and (d.employer_id is null or d.employer_id='')
  760. </if>
  761. <if test="infoSources != null">
  762. and d.info_sources = #{infoSources,jdbcType=INTEGER}
  763. </if>
  764. <if test="demandType != null">
  765. and d.demand_type = #{demandType,jdbcType=INTEGER}
  766. </if>
  767. <if test="status != null">
  768. and d.status = #{status,jdbcType=INTEGER}
  769. </if>
  770. <if test="releaseStatus != null">
  771. and d.release_status = #{releaseStatus,jdbcType=VARCHAR}
  772. </if>
  773. <if test="vStart != null">
  774. and d.validity_period <![CDATA[ >= ]]> #{vStart,jdbcType=TIMESTAMP}
  775. </if>
  776. <if test="vEnd != null">
  777. and d.validity_period <![CDATA[ < ]]> #{vEnd,jdbcType=TIMESTAMP}
  778. </if>
  779. <if test="rStart != null">
  780. and d.release_date <![CDATA[ >= ]]> #{rStart,jdbcType=TIMESTAMP}
  781. </if>
  782. <if test="rEnd != null">
  783. and d.release_date <![CDATA[ < ]]> #{rEnd,jdbcType=TIMESTAMP}
  784. </if>
  785. <if test="cStart != null">
  786. and d.create_time <![CDATA[ > ]]> #{cStart,jdbcType=TIMESTAMP}
  787. </if>
  788. <if test="cEnd != null">
  789. and d.create_time <![CDATA[ < ]]> #{cEnd,jdbcType=TIMESTAMP}
  790. </if>
  791. <if test="boutique != null">
  792. and d.boutique = #{boutique,jdbcType=INTEGER}
  793. </if>
  794. <if test="hot != null and hot == 0"><!-- 不在首页 -->
  795. and d.id not in(select mm.product_id from marketing_management mm where mm.effective = 1)
  796. </if>
  797. <if test="hot != null and hot == 1"><!-- 在首页 -->
  798. and mm.effective = 1
  799. </if>
  800. order by d.serial_number desc
  801. <if test="page_sql!=null">
  802. ${page_sql}
  803. </if>
  804. </select>
  805. <select id ="findManageOrgDemandCount" parameterType="String" resultType="java.lang.Integer">
  806. select
  807. count(1)
  808. from demand d
  809. <!-- LEFT JOIN organization_identity oi on d.employer_id = oi.uid -->
  810. LEFT JOIN admin a on a.id = d.tech_broker_id
  811. <if test="hot != null and hot == 1"><!-- 在首页 -->
  812. inner join marketing_management mm on d.id = mm.product_id
  813. </if>
  814. <if test="hot == null"> <!-- 无首页参数 -->
  815. left join marketing_management mm on d.id = mm.product_id
  816. </if>
  817. where d.deleted_sign = 0
  818. <if test="recordPerson != null">
  819. and a.name= #{recordPerson,jdbcType=VARCHAR}
  820. </if>
  821. <if test="dataCategory != null">
  822. and d.data_category = #{dataCategory,jdbcType=VARCHAR}
  823. </if>
  824. <if test="serialNumber != null">
  825. and d.serial_number = #{serialNumber,jdbcType=INTEGER}
  826. </if>
  827. <if test="auditStatus != null">
  828. and d.audit_status = #{auditStatus,jdbcType=INTEGER}
  829. </if>
  830. <if test="name != null">
  831. and d.name like CONCAT('%',#{name,jdbcType=VARCHAR},'%')
  832. </if>
  833. <if test="keyword != null">
  834. and d.keyword like "%"#{keyword,jdbcType=VARCHAR}"%"
  835. </if>
  836. <if test="employerName != null">
  837. and d.employer_name like CONCAT('%',#{employerName,jdbcType=VARCHAR},'%')
  838. and (d.employer_id is null or d.employer_id='')
  839. </if>
  840. <if test="infoSources != null">
  841. and d.info_sources = #{infoSources,jdbcType=INTEGER}
  842. </if>
  843. <if test="demandType != null">
  844. and d.demand_type = #{demandType,jdbcType=INTEGER}
  845. </if>
  846. <if test="status != null">
  847. and d.status = #{status,jdbcType=VARCHAR}
  848. </if>
  849. <if test="releaseStatus != null">
  850. and d.release_status = #{releaseStatus,jdbcType=VARCHAR}
  851. </if>
  852. <if test="vStart != null">
  853. and d.validity_period <![CDATA[ >= ]]> #{vStart,jdbcType=TIMESTAMP}
  854. </if>
  855. <if test="vEnd != null">
  856. and d.validity_period <![CDATA[ < ]]> #{vEnd,jdbcType=TIMESTAMP}
  857. </if>
  858. <if test="rStart != null">
  859. and d.release_date <![CDATA[ >= ]]> #{rStart,jdbcType=TIMESTAMP}
  860. </if>
  861. <if test="rEnd != null">
  862. and d.release_date <![CDATA[ < ]]> #{rEnd,jdbcType=TIMESTAMP}
  863. </if>
  864. <if test="cStart != null">
  865. and d.create_time <![CDATA[ > ]]> #{cStart,jdbcType=TIMESTAMP}
  866. </if>
  867. <if test="cEnd != null">
  868. and d.create_time <![CDATA[ < ]]> #{cEnd,jdbcType=TIMESTAMP}
  869. </if>
  870. <if test="boutique != null">
  871. and d.boutique = #{boutique,jdbcType=INTEGER}
  872. </if>
  873. <if test="hot != null and hot == 0"><!-- 不在首页 -->
  874. and d.id not in(select mm.product_id from marketing_management mm where mm.effective = 1)
  875. </if>
  876. <if test="hot != null and hot == 1"><!-- 在首页 -->
  877. and mm.effective = 1
  878. </if>
  879. </select>
  880. <select id="selectUserDemandDetail" parameterType="java.lang.String" resultType="com.goafanti.demand.bo.DemandManageDetailBo">
  881. select
  882. d.id, d.serial_number as serialNumber, d.data_category as dataCategory,
  883. d.name, d.keyword, d.info_sources as infoSources,
  884. ui.username, d.demand_type as demandType, d.validity_period as validityPeriod,
  885. ui.province, d.status, d.release_status as releaseStatus,
  886. d.release_date as releaseDate, d.principal_id as principalId, d.industry_category_a as industryCategoryA,
  887. d.industry_category_b as industryCategoryB, d.problem_des as problemDes, d.technical_requirements as technicalRequirements,
  888. d.picture_url as pictureUrl, d.text_file_url as textFileUrl, d.video_url as videoUrl,
  889. d.budget_cost as budgetCost, d.fixed_cycle as fixedCycle, d.people_number as peopleNumber,
  890. d.fixed_scheme as fixedScheme, d.cost_escrow as costEscrow, d.employer_id as employerId,
  891. u.email as mailbox, u.mobile as mobile, d.audit_status as auditStatus,
  892. d.employer_address as employerAddress, d.employer_contacts_mobile as employerContactsMobile,
  893. d.employer_contacts_mailbox as employerContactsMailbox, d.employer_name as employerName,
  894. d.tech_broker_id as techBrokerId, u.mobile as contactsName,d.urgent_days as urgentDays,d.urgent_money as urgentMoney,
  895. d.boutique,ifnull(mm.effective,0) as hot,mm.cover_img as coverImg,d.remark,d.contacts,d.contact_mobile as contactMobile
  896. from demand d
  897. left join user_identity ui on ui.uid = d.employer_id
  898. left join user u on u.id = d.employer_id
  899. left join marketing_management mm on d.id = mm.product_id
  900. where d.data_category = 0 and d.id = #{id,jdbcType=VARCHAR}
  901. </select>
  902. <select id="selectOrgDemandDetail" parameterType="java.lang.String" resultType="com.goafanti.demand.bo.DemandManageDetailBo">
  903. select
  904. d.id, d.serial_number as serialNumber, d.data_category as dataCategory,
  905. d.name, d.keyword, d.info_sources as infoSources,
  906. oi.unit_name as username, d.demand_type as demandType, d.validity_period as validityPeriod,
  907. oi.licence_province as province, d.status, d.release_status as releaseStatus,
  908. d.release_date as releaseDate, d.principal_id as principalId, d.industry_category_a as industryCategoryA,
  909. d.industry_category_b as industryCategoryB, d.problem_des as problemDes, d.technical_requirements as technicalRequirements,
  910. d.picture_url as pictureUrl, d.text_file_url as textFileUrl, d.video_url as videoUrl,
  911. d.budget_cost as budgetCost, d.fixed_cycle as fixedCycle, d.people_number as peopleNumber,
  912. d.fixed_scheme as fixedScheme, d.cost_escrow as costEscrow, d.employer_id as employerId,
  913. oi.postal_address as address, u.email as mailbox, d.contacts, d.audit_status as auditStatus,
  914. d.tech_broker_id as techBrokerId,d.remark,d.urgent_days as urgentDays,d.urgent_money as urgentMoney,
  915. d.employer_address as employerAddress, d.employer_contacts_mobile as employerContactsMobile,
  916. d.employer_contacts_mailbox as employerContactsMailbox, d.employer_name as employerName,
  917. d.boutique,ifnull(mm.effective,0) as hot,mm.cover_img as coverImg,d.contacts,d.contact_mobile as contactMobile
  918. from demand d
  919. left join organization_identity oi on oi.uid = d.employer_id
  920. left join user u on u.id = d.employer_id
  921. left join marketing_management mm on d.id = mm.product_id
  922. where <!-- d.data_category = 1 and --> d.id = #{id,jdbcType=VARCHAR}
  923. </select>
  924. <update id="batchDeleteByPrimaryKey" parameterType="java.util.List">
  925. update demand set deleted_sign = 1
  926. where id in
  927. <foreach item="item" collection="list" open="(" separator="," close=")">
  928. #{item}
  929. </foreach>
  930. </update>
  931. <update id="updateReleaseDate" parameterType="java.lang.String">
  932. update demand set release_date = null
  933. where id = #{id,jdbcType=VARCHAR}
  934. </update>
  935. <select id="findDemandListByPage" parameterType="String" resultType="com.goafanti.demand.bo.DemandListBo">
  936. select
  937. d.id, d.serial_number as serialNumber, d.data_category as dataCategory,
  938. d.name, d.keyword, d.demand_type as demandType, d.remark,d.create_time as createTime,
  939. d.validity_period as validityPeriod, d.status, d.release_status as releaseStatus, ad.name as techBrokerId,
  940. d.release_date as releaseDate, d.employer_id as employerId, d.audit_status as auditStatus
  941. from demand d
  942. LEFT JOIN admin ad on ad.id = d.tech_broker_id
  943. where d.deleted_sign = 0
  944. and d.employer_id = #{employerId, jdbcType=VARCHAR}
  945. <if test="serialNumber != null">
  946. and d.serial_number = #{serialNumber,jdbcType=INTEGER}
  947. </if>
  948. <if test="auditStatus != null">
  949. and d.audit_status = #{auditStatus,jdbcType=INTEGER}
  950. </if>
  951. <if test="name != null">
  952. and d.name like CONCAT('%',#{name,jdbcType=VARCHAR},'%')
  953. </if>
  954. <if test="keyword != null">
  955. and d.keyword like "%"#{keyword,jdbcType=VARCHAR}"%"
  956. </if>
  957. <if test="demandType != null">
  958. and d.demand_type = #{demandType,jdbcType=INTEGER}
  959. </if>
  960. <if test="status != null">
  961. and d.status = #{status,jdbcType=VARCHAR}
  962. </if>
  963. <if test="releaseStatus != null">
  964. and d.release_status = #{releaseStatus,jdbcType=VARCHAR}
  965. </if>
  966. <if test="vStart != null">
  967. and d.validity_period <![CDATA[ >= ]]> #{vStart,jdbcType=TIMESTAMP}
  968. </if>
  969. <if test="vEnd != null">
  970. and d.validity_period <![CDATA[ < ]]> #{vEnd,jdbcType=TIMESTAMP}
  971. </if>
  972. <if test="rStart != null">
  973. and d.release_date <![CDATA[ >= ]]> #{rStart,jdbcType=TIMESTAMP}
  974. </if>
  975. <if test="rEnd != null">
  976. and d.release_date <![CDATA[ < ]]> #{rEnd,jdbcType=TIMESTAMP}
  977. </if>
  978. order by d.serial_number desc
  979. <if test="page_sql!=null">
  980. ${page_sql}
  981. </if>
  982. </select>
  983. <select id="findDemandCount" parameterType="String" resultType="java.lang.Integer">
  984. select count(1)
  985. from demand d
  986. where d.deleted_sign = 0
  987. and d.employer_id = #{employerId, jdbcType=VARCHAR}
  988. <if test="serialNumber != null">
  989. and d.serial_number = #{serialNumber,jdbcType=INTEGER}
  990. </if>
  991. <if test="auditStatus != null">
  992. and d.audit_status = #{auditStatus,jdbcType=INTEGER}
  993. </if>
  994. <if test="name != null">
  995. and d.name like CONCAT('%',#{name,jdbcType=VARCHAR},'%')
  996. </if>
  997. <if test="keyword != null">
  998. and d.keyword like "%"#{keyword,jdbcType=VARCHAR}"%"
  999. </if>
  1000. <if test="demandType != null">
  1001. and d.demand_type = #{demandType,jdbcType=INTEGER}
  1002. </if>
  1003. <if test="status != null">
  1004. and d.status = #{status,jdbcType=VARCHAR}
  1005. </if>
  1006. <if test="releaseStatus != null">
  1007. and d.release_status = #{releaseStatus,jdbcType=VARCHAR}
  1008. </if>
  1009. <if test="vStart != null">
  1010. and d.validity_period <![CDATA[ >= ]]> #{vStart,jdbcType=TIMESTAMP}
  1011. </if>
  1012. <if test="vEnd != null">
  1013. and d.validity_period <![CDATA[ < ]]> #{vEnd,jdbcType=TIMESTAMP}
  1014. </if>
  1015. <if test="rStart != null">
  1016. and d.release_date <![CDATA[ >= ]]> #{rStart,jdbcType=TIMESTAMP}
  1017. </if>
  1018. <if test="rEnd != null">
  1019. and d.release_date <![CDATA[ < ]]> #{rEnd,jdbcType=TIMESTAMP}
  1020. </if>
  1021. </select>
  1022. <insert id="insertBatch" parameterType="com.goafanti.common.model.Demand">
  1023. insert into demand
  1024. (id, deleted_sign, audit_status,
  1025. status, release_status, create_time,
  1026. keyword, data_category, name,
  1027. demand_type, problem_des, employer_name,
  1028. employer_contacts, employer_contacts_mobile, employer_contacts_mailbox, info_sources,tech_broker_id,remark,urgent_days ,urgent_money)
  1029. values
  1030. <foreach item="item" index="index" collection="list" separator=",">
  1031. (
  1032. #{item.id,jdbcType=VARCHAR}, #{item.deletedSign,jdbcType=INTEGER}, #{item.auditStatus,jdbcType=INTEGER},
  1033. #{item.status,jdbcType=INTEGER}, #{item.releaseStatus,jdbcType=INTEGER}, #{item.createTime,jdbcType=TIMESTAMP},
  1034. #{item.keyword,jdbcType=VARCHAR}, #{item.dataCategory,jdbcType=INTEGER}, #{item.name,jdbcType=VARCHAR},
  1035. #{item.demandType,jdbcType=INTEGER}, #{item.problemDes,jdbcType=VARCHAR}, #{item.employerName,jdbcType=VARCHAR},
  1036. #{item.employerContacts,jdbcType=VARCHAR}, #{item.employerContactsMobile,jdbcType=VARCHAR}, #{item.employerContactsMailbox,jdbcType=VARCHAR},
  1037. #{item.infoSources,jdbcType=INTEGER},#{item.techBrokerId,jdbcType=VARCHAR},#{item.remark,jdbcType=VARCHAR},,#{item.urgentDays,jdbcType=VARCHAR},#{item.urgentMoney,jdbcType=VARCHAR}
  1038. )
  1039. </foreach>
  1040. </insert>
  1041. <select id="findSearchDemandListByPage" parameterType="String" resultType="com.goafanti.portal.bo.DemandSearchListBo">
  1042. select
  1043. d.id, d.name, d.keyword,d.data_category as dataCategory,d.picture_url as pictureUrl,
  1044. d.serial_number as serialNumber, d.data_category as dataCategory, d.industry_category_a as industryCategoryA,
  1045. d.industry_category_b as industryCategoryB, d.demand_type as demandType, d.budget_cost as budgetCost,
  1046. d.problem_des as problemDes, d.release_date as releaseDate, d.employer_name as employerName,d.boutique,
  1047. u.lvl as level,dp.publish_page,dp.publish_platform,dp.publish_client,dp.if_top,dp.top_number,dp.show_number
  1048. from demand d
  1049. right join demand_publish dp on d.id=dp.demand_id
  1050. left join branch_information bi on bi.id=dp.publish_platform
  1051. left join user u on u.id = d.employer_id
  1052. where d.deleted_sign = 0 and d.status = 0
  1053. and dp.publish_client=0
  1054. and dp.publish_page='W02'
  1055. and bi.domain_name like "%"#{url,jdbcType=VARCHAR}"%"
  1056. <if test="keyword != null">
  1057. and d.keyword like "%"#{keyword,jdbcType=VARCHAR}"%"
  1058. </if>
  1059. <if test="industryCategoryA != null">
  1060. and d.industry_category_a = #{industryCategoryA,jdbcType=INTEGER}
  1061. </if>
  1062. <if test="industryCategoryB != null">
  1063. and d.industry_category_b = #{industryCategoryB,jdbcType=INTEGER}
  1064. </if>
  1065. <if test="budgetCostLower != null">
  1066. and d.budget_cost <![CDATA[ >= ]]> #{budgetCostLower,jdbcType=DECIMAL}
  1067. </if>
  1068. <if test="budgetCostUpper != null">
  1069. and d.budget_cost <![CDATA[ <= ]]> #{budgetCostUpper,jdbcType=DECIMAL}
  1070. </if>
  1071. <if test="demandType != null">
  1072. and d.demand_type = #{demandType,jdbcType=INTEGER}
  1073. </if>
  1074. <if test="sign == 1">
  1075. and d.budget_cost is null
  1076. </if>
  1077. and d.deleted_sign = 0
  1078. and d.audit_status = 3
  1079. <if test="dateSort == 0">
  1080. order by dp.if_top,dp.top_number,dp.show_number,d.release_date asc
  1081. </if>
  1082. <if test="dateSort == 1">
  1083. order by dp.if_top asc,dp.top_number asc,dp.show_number asc,d.release_date desc
  1084. </if>
  1085. <if test="page_sql!=null">
  1086. ${page_sql}
  1087. </if>
  1088. </select>
  1089. <select id="findSearchDemandCount" parameterType="String" resultType="java.lang.Integer">
  1090. select
  1091. count(1)
  1092. from demand d
  1093. right join demand_publish dp on d.id=dp.demand_id
  1094. left join user u on u.id = d.employer_id
  1095. where d.deleted_sign = 0 and d.status = 0
  1096. and dp.publish_client=0
  1097. and dp.publish_page='W02'
  1098. and bi.domain_name like "%"#{url,jdbcType=VARCHAR}"%"
  1099. <if test="keyword != null">
  1100. and d.keyword like "%"#{keyword,jdbcType=VARCHAR}"%"
  1101. </if>
  1102. <if test="industryCategoryA != null">
  1103. and d.industry_category_a = #{industryCategoryA,jdbcType=INTEGER}
  1104. </if>
  1105. <if test="industryCategoryB != null">
  1106. and d.industry_category_b = #{industryCategoryB,jdbcType=INTEGER}
  1107. </if>
  1108. <if test="budgetCostLower != null">
  1109. and d.budget_cost <![CDATA[ >= ]]> #{budgetCostLower,jdbcType=DECIMAL}
  1110. </if>
  1111. <if test="budgetCostUpper != null">
  1112. and d.budget_cost <![CDATA[ <= ]]> #{budgetCostUpper,jdbcType=DECIMAL}
  1113. </if>
  1114. <if test="demandType != null">
  1115. and d.demand_type = #{demandType,jdbcType=INTEGER}
  1116. </if>
  1117. <if test="sign == 1">
  1118. and d.budget_cost is null
  1119. </if>
  1120. </select>
  1121. <select id="selectDemandSearchDetail" parameterType="java.lang.String" resultType="com.goafanti.portal.bo.DemandSearchDetailBo">
  1122. select
  1123. d.id,
  1124. d.employer_name as employerName,
  1125. d.serial_number as serialNumber,
  1126. d.keyword,
  1127. d.data_category as dataCategory,
  1128. d.name,
  1129. d.industry_category_a as industryCategoryA,
  1130. d.industry_category_b as industryCategoryB,
  1131. d.demand_type as demandType,
  1132. d.budget_cost as budgetCost,
  1133. d.problem_des as problemDes,
  1134. d.release_date as releaseDate,
  1135. d.technical_requirements as technicalRequirements,
  1136. d.picture_url as pictureUrl,
  1137. d.text_file_url as textFileUrl,
  1138. d.video_url as videoUrl,
  1139. d.fixed_cycle as fixedCycle,
  1140. d.people_number as peopleNumber,
  1141. d.fixed_scheme as fixedScheme,
  1142. d.cost_escrow as costEscrow,
  1143. d.validity_period as validityPeriod,
  1144. ui.username,
  1145. oi.unit_name as unitName,
  1146. di.id as demandInterestId,
  1147. do.id as demandOrderId,
  1148. do.status as orderStatus
  1149. from demand d
  1150. left join user_identity ui on ui.uid = d.employer_id
  1151. left join organization_identity oi on oi.uid = d.employer_id
  1152. left join demand_interest di on di.demand_id = d.id and di.uid = #{0}
  1153. left join demand_order do on do.demand_id = d.id and do.uid = #{0} and do.status <![CDATA[ <> ]]> 6
  1154. where d.id = #{1}
  1155. </select>
  1156. <select id="findDemandNumByUid" parameterType="java.lang.String" resultType="java.lang.Integer">
  1157. select
  1158. count(1)
  1159. from demand
  1160. where
  1161. deleted_sign = 0
  1162. and release_status = 1
  1163. and audit_status = 3
  1164. and employer_id = #{uid,jdbcType=VARCHAR}
  1165. </select>
  1166. <select id="findPartnerDemandListByPage" parameterType="java.lang.String" resultType="com.goafanti.demand.bo.DemandPartnerListBo">
  1167. SELECT
  1168. id,
  1169. serial_number AS serialNumber,
  1170. data_category AS dataCategory,
  1171. NAME,
  1172. keyword,
  1173. release_date AS releaseDate,
  1174. demand_type AS demandType,
  1175. validity_period AS validityPeriod,
  1176. problem_des as problemDes,
  1177. industry_category_a as industryCategoryA,
  1178. industry_category_b as industryCategoryB,
  1179. budget_cost as budgetCost
  1180. FROM
  1181. demand
  1182. WHERE
  1183. audit_status = 3
  1184. AND release_status = 1
  1185. AND deleted_sign = 0
  1186. AND employer_id = #{employerId,jdbcType=VARCHAR}
  1187. </select>
  1188. <select id="findPartnerDemandCount" parameterType="java.lang.String" resultType="java.lang.Integer">
  1189. SELECT
  1190. count(1)
  1191. FROM
  1192. demand
  1193. WHERE
  1194. audit_status = 3
  1195. AND release_status = 1
  1196. AND deleted_sign = 0
  1197. AND employer_id = #{employerId,jdbcType=VARCHAR}
  1198. </select>
  1199. <select id="findUserPortalDemandDetail" parameterType="java.lang.String" resultType="com.goafanti.portal.bo.DemandPortalDetailBo">
  1200. SELECT
  1201. d.id,
  1202. d.name,
  1203. d.keyword,
  1204. d.validity_period as validityPeriod,
  1205. d.industry_category_a AS industryCategoryA,
  1206. d.picture_url as pictureUrl,
  1207. d.employer_contacts_mobile as employerContactsMobile,
  1208. d.data_category as dataCategory,
  1209. fg.name AS industryCategoryAS,
  1210. fgg.name AS industryCategorBS,
  1211. d.budget_cost AS budgetCost,
  1212. d.problem_des AS problemDes,
  1213. dg.name AS province,
  1214. dgg.name AS city,
  1215. interest.id as interestId,
  1216. d.employer_name as employerName,
  1217. u.lvl as level
  1218. FROM
  1219. demand d
  1220. LEFT JOIN `user` u on u.id = d.employer_id
  1221. LEFT JOIN user_identity ui on ui.uid = d.employer_id
  1222. LEFT JOIN district_glossory dg ON dg.id = ui.province
  1223. LEFT JOIN district_glossory dgg ON dgg.id = ui.city
  1224. LEFT JOIN field_glossory fg on fg.id = d.industry_category_a
  1225. LEFT JOIN field_glossory fgg on fgg.id = d.industry_category_b
  1226. LEFT JOIN demand_interest interest on interest.demand_id = d.id and interest.uid = #{uid,jdbcType=VARCHAR}
  1227. WHERE
  1228. d.id = #{id,jdbcType=VARCHAR}
  1229. </select>
  1230. <select id="findOrgPortalDemandDetail" parameterType="java.lang.String" resultType="com.goafanti.portal.bo.DemandPortalDetailBo">
  1231. SELECT
  1232. d.id,
  1233. d.name,
  1234. d.keyword,
  1235. d.picture_url as pictureUrl,
  1236. d.validity_period as validityPeriod,
  1237. d.employer_contacts_mobile as employerContactsMobile,
  1238. d.data_category as dataCategory,
  1239. d.industry_category_a AS industryCategoryA,
  1240. fg.name AS industryCategoryAS,
  1241. fgg.name AS industryCategoryBS,
  1242. d.budget_cost AS budgetCost,
  1243. d.problem_des AS problemDes,
  1244. dg.name AS province,
  1245. dgg.name AS city,
  1246. interest.id as interestId,
  1247. d.employer_name as employerName,
  1248. u.lvl as level
  1249. FROM
  1250. demand d
  1251. LEFT JOIN `user` u on u.id = d.employer_id
  1252. LEFT JOIN organization_identity oi on oi.uid = d.employer_id
  1253. LEFT JOIN district_glossory dg ON dg.id = oi.licence_province
  1254. LEFT JOIN district_glossory dgg ON dgg.id = oi.licence_city
  1255. LEFT JOIN field_glossory fg on fg.id = d.industry_category_a
  1256. LEFT JOIN field_glossory fgg on fgg.id = d.industry_category_b
  1257. LEFT JOIN demand_interest interest on interest.demand_id = d.id and interest.uid = #{uid,jdbcType=VARCHAR}
  1258. WHERE
  1259. d.id = #{id,jdbcType=VARCHAR}
  1260. </select>
  1261. <select id="findByIndustryCategoryA" resultType="com.goafanti.portal.bo.DemandPortalSimilarListBo">
  1262. select
  1263. d.id,
  1264. d.name,
  1265. fg.name as industryCategoryAS,
  1266. fgg.name as industryCategoryBS,
  1267. d.problem_des as problemDes,
  1268. d.budget_cost as budgetCost,
  1269. u.lvl as level
  1270. from
  1271. demand d
  1272. left join user u on u.id = d.employer_id
  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. where
  1276. d.audit_status = 3
  1277. and d.release_status = 1
  1278. and d.deleted_sign = 0
  1279. and d.industry_category_a = #{industryCategoryA,jdbcType=INTEGER}
  1280. and d.id <![CDATA[ <> ]]> #{id,jdbcType=VARCHAR}
  1281. order by d.serial_number desc
  1282. limit 5
  1283. </select>
  1284. <update id="updateEmployerId" parameterType="java.lang.String" >
  1285. update demand set employer_id = null
  1286. where id = #{id,jdbcType=VARCHAR}
  1287. </update>
  1288. <select id="findBoutiqueListByPage" parameterType="java.lang.Integer" resultType="com.goafanti.portal.bo.BoutiqueListBo">
  1289. select
  1290. a.id,a.name,
  1291. b.name as industryCatalog,
  1292. a.picture_url as pictureUrl,
  1293. a.problem_des as sketch,
  1294. a.data_category as ownerType,
  1295. a.employer_name as personName
  1296. from
  1297. demand a
  1298. left join field_glossory b on a.industry_category_a = b.id
  1299. where
  1300. a.boutique = 1 and a.audit_status =3 and a.deleted_sign=0
  1301. <if test="industryCategoryA != null and industryCategoryA != ''">
  1302. and a.industry_category_a = #{industryCategoryA,jdbcType=INTEGER}
  1303. </if>
  1304. order by
  1305. a.create_time desc
  1306. <if test="page_sql!=null">
  1307. ${page_sql}
  1308. </if>
  1309. </select>
  1310. <select id="findBoutiqueCount" parameterType="java.lang.Integer" resultType="java.lang.Integer">
  1311. select
  1312. count(1)
  1313. from
  1314. demand a
  1315. left
  1316. join field_glossory b
  1317. on
  1318. a.industry_category_a = b.id
  1319. where
  1320. a.boutique = 1 and a.audit_status =3 and a.deleted_sign=0
  1321. <if test="industryCategoryA != null and industryCategoryA != ''">
  1322. and a.industry_category_a = #{industryCategoryA,jdbcType=INTEGER}
  1323. </if>
  1324. </select>
  1325. <!-- 查询需求列表 -->
  1326. <select id="selectDemandList"
  1327. resultType="com.goafanti.demand.bo.DemandListBo">
  1328. SELECT
  1329. d.id,
  1330. d.name,
  1331. d.keyword,
  1332. d.data_category as dataCategory,
  1333. d.fixed_budget as fixedbudget,
  1334. d.demand_type as demandType,
  1335. d.picture_url as pictureUrl,
  1336. d.industry_category_a AS industryCategoryA,
  1337. fg.name AS
  1338. industryCategoryAS,
  1339. fgg.name AS industryCategorBS,
  1340. d.budget_cost AS
  1341. budgetCost,
  1342. d.problem_des AS problemDes,
  1343. dg.name AS
  1344. province,
  1345. dgg.name AS
  1346. city,
  1347. d.employer_name as
  1348. employerName,
  1349. u.lvl as
  1350. level
  1351. FROM
  1352. demand d
  1353. LEFT JOIN `user` u on u.id = d.employer_id
  1354. LEFT JOIN
  1355. user_identity ui on ui.uid = d.employer_id
  1356. LEFT JOIN district_glossory
  1357. dg ON dg.id = ui.province
  1358. LEFT JOIN district_glossory dgg ON dgg.id =
  1359. ui.city
  1360. LEFT JOIN field_glossory fg on fg.id = d.industry_category_a
  1361. LEFT JOIN field_glossory fgg on fgg.id = d.industry_category_b
  1362. WHERE
  1363. <if test="_parameter!= null">
  1364. d.boutique = #{_parameter,jdbcType=INTEGER}
  1365. </if>
  1366. limit 0,30
  1367. </select>
  1368. <!-- 猜你喜欢 -->
  1369. <select id="selectCsutomerLike"
  1370. resultType="com.goafanti.demand.bo.DemandListBo">
  1371. SELECT
  1372. d.id,
  1373. d.name,
  1374. d.keyword,
  1375. d.data_category as dataCategory,
  1376. d.fixed_budget as fixedbudget,
  1377. d.demand_type as demandType,
  1378. d.picture_url as pictureUrl,
  1379. d.industry_category_a AS industryCategoryA,
  1380. fg.name AS
  1381. industryCategoryAS,
  1382. fgg.name AS industryCategorBS,
  1383. d.budget_cost AS
  1384. budgetCost,
  1385. d.problem_des AS problemDes,
  1386. dg.name AS
  1387. province,
  1388. dgg.name AS
  1389. city,
  1390. d.employer_name as
  1391. employerName,
  1392. u.lvl as
  1393. level
  1394. FROM
  1395. demand d
  1396. LEFT JOIN `user` u on u.id = d.employer_id
  1397. LEFT JOIN
  1398. user_identity ui on ui.uid = d.employer_id
  1399. LEFT JOIN district_glossory
  1400. dg ON dg.id = ui.province
  1401. LEFT JOIN district_glossory dgg ON dgg.id =
  1402. ui.city
  1403. LEFT JOIN field_glossory fg on fg.id = d.industry_category_a
  1404. LEFT JOIN field_glossory fgg on fgg.id = d.industry_category_b
  1405. LEFT JOIN demand_interest interest on interest.demand_id = d.id
  1406. where
  1407. interest.uid = #{uid,jdbcType=INTEGER}
  1408. limit 0,4
  1409. </select>
  1410. <select id="countInterest" resultType="Integer">
  1411. select count(0)
  1412. from demand_interest
  1413. where demand_id = #{demandId,jdbcType=VARCHAR}
  1414. </select>
  1415. <select id="findAppDemandListByPage" parameterType="String" resultType="com.goafanti.demand.bo.DemandListBo">
  1416. select
  1417. d.id, d.serial_number as serialNumber, d.data_category as dataCategory, d.boutique,
  1418. 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,
  1419. d.validity_period as validityPeriod, d.status, d.release_status as releaseStatus,
  1420. d.release_date as releaseDate, d.employer_id as employerId, d.audit_status as auditStatus,t.city as cityname,
  1421. 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
  1422. from demand d
  1423. left join user_identity t on d.employer_id=t.uid
  1424. left join field_glossory g on d.industry_category_a=g.id
  1425. left join field_glossory g2 on d.industry_category_b=g2.id
  1426. left join (select count(0) as countInterest ,demand_id from demand_interest
  1427. group by demand_id) t on d.id=t.demand_id
  1428. where d.deleted_sign = 0
  1429. and d.audit_status=3
  1430. <if test="employerId != null">
  1431. and d.employer_id = #{employerId, jdbcType=VARCHAR}
  1432. </if>
  1433. <if test="serialNumber != null">
  1434. and d.serial_number = #{serialNumber,jdbcType=INTEGER}
  1435. </if>
  1436. <if test="auditStatus != null">
  1437. and d.audit_status = #{auditStatus,jdbcType=INTEGER}
  1438. </if>
  1439. <if test="name != null">
  1440. and d.name like CONCAT('%',#{name,jdbcType=VARCHAR},'%')
  1441. </if>
  1442. <if test="keyword != null">
  1443. and d.keyword like "%"#{keyword,jdbcType=VARCHAR}"%"
  1444. </if>
  1445. <if test="demandType != null">
  1446. and d.demand_type = #{demandType,jdbcType=INTEGER}
  1447. </if>
  1448. <if test="industryCategoryA != null">
  1449. and d.industry_category_a = #{industryCategoryA,jdbcType=INTEGER}
  1450. </if>
  1451. <if test="status != null">
  1452. and d.status = #{status,jdbcType=VARCHAR}
  1453. </if>
  1454. <if test="releaseStatus != null">
  1455. and d.release_status = #{releaseStatus,jdbcType=VARCHAR}
  1456. </if>
  1457. <if test="vStart != null">
  1458. and d.validity_period <![CDATA[ >= ]]> #{vStart,jdbcType=TIMESTAMP}
  1459. </if>
  1460. <if test="vEnd != null">
  1461. and d.validity_period <![CDATA[ < ]]> #{vEnd,jdbcType=TIMESTAMP}
  1462. </if>
  1463. <if test="rStart != null">
  1464. and d.release_date <![CDATA[ >= ]]> #{rStart,jdbcType=TIMESTAMP}
  1465. </if>
  1466. <if test="rEnd != null">
  1467. and d.release_date <![CDATA[ < ]]> #{rEnd,jdbcType=TIMESTAMP}
  1468. </if>
  1469. order by d.boutique desc
  1470. <if test="page_sql!=null">
  1471. ${page_sql}
  1472. </if>
  1473. </select>
  1474. <select id="findAppDemandCount" parameterType="String" resultType="java.lang.Integer">
  1475. select count(1)
  1476. from demand d
  1477. where d.deleted_sign = 0
  1478. <if test="employerId != null">
  1479. and d.employer_id = #{employerId, jdbcType=VARCHAR}
  1480. </if>
  1481. <if test="serialNumber != null">
  1482. and d.serial_number = #{serialNumber,jdbcType=INTEGER}
  1483. </if>
  1484. <if test="auditStatus != null">
  1485. and d.audit_status = #{auditStatus,jdbcType=INTEGER}
  1486. </if>
  1487. <if test="industryCategoryA != null">
  1488. and d.industry_category_a = #{industryCategoryA,jdbcType=INTEGER}
  1489. </if>
  1490. <if test="name != null">
  1491. and d.name like CONCAT('%',#{name,jdbcType=VARCHAR},'%')
  1492. </if>
  1493. <if test="keyword != null">
  1494. and d.keyword like "%"#{keyword,jdbcType=VARCHAR}"%"
  1495. </if>
  1496. <if test="demandType != null">
  1497. and d.demand_type = #{demandType,jdbcType=INTEGER}
  1498. </if>
  1499. <if test="status != null">
  1500. and d.status = #{status,jdbcType=VARCHAR}
  1501. </if>
  1502. <if test="releaseStatus != null">
  1503. and d.release_status = #{releaseStatus,jdbcType=VARCHAR}
  1504. </if>
  1505. <if test="vStart != null">
  1506. and d.validity_period <![CDATA[ >= ]]> #{vStart,jdbcType=TIMESTAMP}
  1507. </if>
  1508. <if test="vEnd != null">
  1509. and d.validity_period <![CDATA[ < ]]> #{vEnd,jdbcType=TIMESTAMP}
  1510. </if>
  1511. <if test="rStart != null">
  1512. and d.release_date <![CDATA[ >= ]]> #{rStart,jdbcType=TIMESTAMP}
  1513. </if>
  1514. <if test="rEnd != null">
  1515. and d.release_date <![CDATA[ < ]]> #{rEnd,jdbcType=TIMESTAMP}
  1516. </if>
  1517. </select>
  1518. <select id="demandInterest" resultType="com.goafanti.demand.bo.DemandInterestBo">
  1519. select
  1520. d.id,d.name,di.create_time as createTime
  1521. from demand_interest di
  1522. LEFT join demand d on di.demand_id=d.id
  1523. where uid=#{uid,jdbcType=VARCHAR}
  1524. </select>
  1525. <select id="findAppMyDemandListByPage" parameterType="String" resultType="com.goafanti.demand.bo.DemandListBo">
  1526. select
  1527. d.id, d.boutique,d.name, d.audit_status as auditStatus,ifnull(t.x,0) as orderCount,
  1528. d.release_date as releaseDate,d.create_time as createTime,ifnull(i.y,0) as countInterest
  1529. from demand d
  1530. left join (select count(0) as x,tl.commodity_id from t_order tr
  1531. left join t_order_detail tl on tl.order_no=tr.order_no
  1532. where tr.order_status != 4 and tr.order_status != 0
  1533. group by tl.commodity_id ) t on d.id=t.commodity_id
  1534. left join (select count(0) as y,demand_id from demand_interest
  1535. group by demand_id ) i on d.id=i.demand_id
  1536. where d.deleted_sign = 0
  1537. <if test="employerId != null">
  1538. and d.employer_id = #{employerId, jdbcType=VARCHAR}
  1539. </if>
  1540. order by d.serial_number desc
  1541. <if test="page_sql!=null">
  1542. ${page_sql}
  1543. </if>
  1544. </select>
  1545. <select id="findAppMyDemandCount" parameterType="String" resultType="java.lang.Integer">
  1546. select count(1)
  1547. from demand d
  1548. where d.deleted_sign = 0
  1549. <if test="employerId != null">
  1550. and d.employer_id = #{employerId, jdbcType=VARCHAR}
  1551. </if>
  1552. </select>
  1553. <select id="selectDemandDetail" resultMap="BaseResultMap" parameterType="java.lang.String" >
  1554. select
  1555. 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,
  1556. 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,
  1557. 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,
  1558. 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,
  1559. d.employer_address as employerAddress, d.employer_contacts as employerContacts, d.employer_contacts_mobile as employerContactsMobile, d.employer_contacts_mailbox as employerContactsMailbox,
  1560. 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,
  1561. d.audit_status as auditStatus, d.tech_broker_id as techBrokerId,d.boutique,d.urgent_money as urgentMoney,d.urgent_days as urgentDays
  1562. from demand d
  1563. left join jpush_easemob_account j on d.employer_id=j.uid
  1564. where d.id = #{id,jdbcType=VARCHAR}
  1565. </select>
  1566. <select id="findAppNewsInterestByPage" parameterType="String" resultType="com.goafanti.demand.bo.ObjectInterestListBo">
  1567. select n.id,n.title as name,n.create_time as createTime
  1568. from news_interest ni
  1569. LEFT join news n on ni.new_id=n.id
  1570. where ni.uid=#{uid,jdbcType=VARCHAR}
  1571. order by createTime desc
  1572. <if test="page_sql!=null">
  1573. ${page_sql}
  1574. </if>
  1575. </select>
  1576. <select id="findAppNewsInterestCount" parameterType="String" resultType="java.lang.Integer">
  1577. select count(1)
  1578. from news_interest ni
  1579. LEFT join news n on ni.new_id=n.id
  1580. where ni.uid=#{uid,jdbcType=VARCHAR}
  1581. </select>
  1582. <select id="findAppUserInterestByPage" parameterType="String" resultType="com.goafanti.demand.bo.ObjectInterestListBo">
  1583. select y.uid as id,y.username as name ,t.create_time as createTime
  1584. from user_interest t
  1585. left join user_identity y on t.to_uid=y.uid
  1586. where expert=1
  1587. and from_uid=#{uid,jdbcType=VARCHAR}
  1588. <if test="page_sql!=null">
  1589. ${page_sql}
  1590. </if>
  1591. </select>
  1592. <select id="findAppUserInterestCount" parameterType="String" resultType="java.lang.Integer">
  1593. select count(1)
  1594. from user_interest t
  1595. left join user_identity y on t.to_uid=y.uid
  1596. where expert=1
  1597. and from_uid=#{uid,jdbcType=VARCHAR}
  1598. </select>
  1599. <select id="findAppCounselorInterestByPage" 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=2
  1604. and from_uid=#{uid,jdbcType=VARCHAR}
  1605. <if test="page_sql!=null">
  1606. ${page_sql}
  1607. </if>
  1608. </select>
  1609. <select id="findAppCounselorInterestCount" 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 expert=2
  1614. and from_uid=#{uid,jdbcType=VARCHAR}
  1615. </select>
  1616. <select id="findAppDemandInterestByPage" resultType="com.goafanti.demand.bo.ObjectInterestListBo">
  1617. select d.id ,d.name,t.create_time as createTime
  1618. from demand_interest t
  1619. left join demand d on t.demand_id=d.id
  1620. where t.uid=#{uid,jdbcType=VARCHAR}
  1621. <if test="page_sql!=null">
  1622. ${page_sql}
  1623. </if>
  1624. </select>
  1625. <select id="findAppDemandInterestCount" parameterType="String" resultType="java.lang.Integer">
  1626. select count(1)
  1627. from demand_interest t
  1628. left join demand d on t.demand_id=d.id
  1629. where uid=#{uid,jdbcType=VARCHAR}
  1630. </select>
  1631. <select id="findAppAchievementInterestByPage" parameterType="String" resultType="com.goafanti.demand.bo.ObjectInterestListBo">
  1632. select a.id ,a.name,t.create_time as createTime
  1633. from achievement_interest t
  1634. left join achievement a on t.achievement_id=a.id
  1635. where t.uid=#{uid,jdbcType=VARCHAR}
  1636. <if test="page_sql!=null">
  1637. ${page_sql}
  1638. </if>
  1639. </select>
  1640. <select id="findAppAchievementInterestCount" parameterType="String" resultType="java.lang.Integer">
  1641. select count(1)
  1642. from achievement_interest t
  1643. left join achievement a on t.achievement_id=a.id
  1644. where t.uid=#{uid,jdbcType=VARCHAR}
  1645. </select>
  1646. <select id="findAppProjectInterestByPage" parameterType="String" resultType="com.goafanti.demand.bo.ObjectInterestListBo">
  1647. select b.id ,b.bname as name,t.uid,t.create_time as createTime
  1648. from project_interest t
  1649. left join business_project b on t.project_id=b.id
  1650. where t.uid=#{uid,jdbcType=VARCHAR}
  1651. <if test="page_sql!=null">
  1652. ${page_sql}
  1653. </if>
  1654. </select>
  1655. <select id="findAppProjectInterestCount" parameterType="String" resultType="java.lang.Integer">
  1656. select count(1)
  1657. from project_interest t
  1658. left join business_project b on t.project_id=b.id
  1659. where t.uid=#{uid,jdbcType=VARCHAR}
  1660. </select>
  1661. <select id="findMyDemandListByPage" parameterType="String" resultType="com.goafanti.demand.bo.DemandManageListBo">
  1662. select
  1663. d.id, d.serial_number as serialNumber, d.data_category as dataCategory,
  1664. d.name, d.keyword, d.info_sources as infoSources,
  1665. <!-- oi.unit_name as username, --> d.demand_type as demandType, d.validity_period as validityPeriod,
  1666. d.employer_name as employerName, <!-- oi.licence_province as province, --> d.status, d.urgent_days as urgentDays,d.urgent_money as urgentMoney,
  1667. d.release_status as releaseStatus, d.release_date as releaseDate, a.name as techBrokerId,d.create_time as createTime,
  1668. d.employer_id as employerId, d.audit_status as auditStatus,
  1669. d.tech_broker_id as techBrokerId,d.boutique
  1670. <if test="hot != null and hot == 1"><!-- 在首页 -->
  1671. ,1 as hot
  1672. </if>
  1673. <if test="hot != null and hot == 0"><!-- 不在首页 -->
  1674. ,0 as hot
  1675. </if>
  1676. <if test="hot==null"><!-- 无首页参数 -->
  1677. ,ifnull(mm.effective,0) as hot
  1678. </if>
  1679. from demand d
  1680. <!-- LEFT JOIN organization_identity oi on d.employer_id = oi.uid -->
  1681. LEFT JOIN admin a on a.id = d.tech_broker_id
  1682. <if test="adminId != null">
  1683. LEFT JOIN user u on d.employer_id = u.id
  1684. </if>
  1685. <if test="hot != null and hot == 1"><!-- 在首页 -->
  1686. inner join marketing_management mm on d.id = mm.product_id
  1687. </if>
  1688. <if test="hot == null"> <!-- 无首页参数 -->
  1689. left join marketing_management mm on d.id = mm.product_id
  1690. </if>
  1691. where d.deleted_sign = 0
  1692. <if test="techBrokerId != null">
  1693. and d.tech_broker_id = #{techBrokerId,jdbcType=VARCHAR}
  1694. </if>
  1695. <if test="dataCategory != null">
  1696. and d.data_category = #{dataCategory,jdbcType=VARCHAR}
  1697. </if>
  1698. <if test="adminId != null">
  1699. and (u.mid = #{adminId,jdbcType=VARCHAR}
  1700. </if>
  1701. <if test="adminId != null">
  1702. or d.principal_id = #{adminId,jdbcType=VARCHAR}
  1703. </if>
  1704. <if test="adminId != null">
  1705. or d.tech_broker_id = #{adminId,jdbcType=VARCHAR}
  1706. )
  1707. </if>
  1708. <!-- <if test="province != null">
  1709. and oi.licence_province = #{province,jdbcType=INTEGER}
  1710. </if> -->
  1711. <if test="serialNumber != null">
  1712. and d.serial_number = #{serialNumber,jdbcType=INTEGER}
  1713. </if>
  1714. <if test="auditStatus != null">
  1715. and d.audit_status = #{auditStatus,jdbcType=INTEGER}
  1716. </if>
  1717. <if test="name != null">
  1718. and d.name like CONCAT('%',#{name,jdbcType=VARCHAR},'%')
  1719. </if>
  1720. <if test="keyword != null">
  1721. and d.keyword like CONCAT('%',#{keyword,jdbcType=VARCHAR},'%')
  1722. </if>
  1723. <!-- <if test="unitName != null">
  1724. and oi.unit_name like CONCAT('%',#{unitName,jdbcType=VARCHAR},'%')
  1725. </if> -->
  1726. <if test="employerName != null">
  1727. and d.employer_name like CONCAT('%',#{employerName,jdbcType=VARCHAR},'%')
  1728. and (d.employer_id is null or d.employer_id='')
  1729. </if>
  1730. <if test="infoSources != null">
  1731. and d.info_sources = #{infoSources,jdbcType=INTEGER}
  1732. </if>
  1733. <if test="demandType != null">
  1734. and d.demand_type = #{demandType,jdbcType=INTEGER}
  1735. </if>
  1736. <if test="status != null">
  1737. and d.status = #{status,jdbcType=INTEGER}
  1738. </if>
  1739. <if test="releaseStatus != null">
  1740. and d.release_status = #{releaseStatus,jdbcType=VARCHAR}
  1741. </if>
  1742. <if test="vStart != null">
  1743. and d.validity_period <![CDATA[ >= ]]> #{vStart,jdbcType=TIMESTAMP}
  1744. </if>
  1745. <if test="vEnd != null">
  1746. and d.validity_period <![CDATA[ < ]]> #{vEnd,jdbcType=TIMESTAMP}
  1747. </if>
  1748. <if test="rStart != null">
  1749. and d.release_date <![CDATA[ >= ]]> #{rStart,jdbcType=TIMESTAMP}
  1750. </if>
  1751. <if test="rEnd != null">
  1752. and d.release_date <![CDATA[ < ]]> #{rEnd,jdbcType=TIMESTAMP}
  1753. </if>
  1754. <if test="cStart != null">
  1755. and d.create_time <![CDATA[ > ]]> #{cStart,jdbcType=TIMESTAMP}
  1756. </if>
  1757. <if test="cEnd != null">
  1758. and d.create_time <![CDATA[ < ]]> #{cEnd,jdbcType=TIMESTAMP}
  1759. </if>
  1760. <if test="boutique != null">
  1761. and d.boutique = #{boutique,jdbcType=INTEGER}
  1762. </if>
  1763. <if test="hot != null and hot == 0"><!-- 不在首页 -->
  1764. and d.id not in(select mm.product_id from marketing_management mm where mm.effective = 1)
  1765. </if>
  1766. <if test="hot != null and hot == 1"><!-- 在首页 -->
  1767. and mm.effective = 1
  1768. </if>
  1769. order by d.serial_number desc
  1770. <if test="page_sql!=null">
  1771. ${page_sql}
  1772. </if>
  1773. </select>
  1774. <select id ="findMyDemandCount" parameterType="String" resultType="java.lang.Integer">
  1775. select
  1776. count(1)
  1777. from demand d
  1778. <!-- LEFT JOIN organization_identity oi on d.employer_id = oi.uid -->
  1779. LEFT JOIN admin a on a.id = d.tech_broker_id
  1780. <if test="adminId != null">
  1781. LEFT JOIN user u on d.employer_id = u.id
  1782. </if>
  1783. <if test="hot != null and hot == 1"><!-- 在首页 -->
  1784. inner join marketing_management mm on d.id = mm.product_id
  1785. </if>
  1786. <if test="hot == null"> <!-- 无首页参数 -->
  1787. left join marketing_management mm on d.id = mm.product_id
  1788. </if>
  1789. where d.deleted_sign = 0
  1790. <if test="techBrokerId != null">
  1791. and d.tech_broker_id = #{techBrokerId,jdbcType=VARCHAR}
  1792. </if>
  1793. <if test="dataCategory != null">
  1794. and d.data_category = #{dataCategory,jdbcType=VARCHAR}
  1795. </if>
  1796. <if test="adminId != null">
  1797. and (u.mid = #{adminId,jdbcType=VARCHAR}
  1798. </if>
  1799. <if test="adminId != null">
  1800. or d.principal_id = #{adminId,jdbcType=VARCHAR}
  1801. </if>
  1802. <if test="adminId != null">
  1803. or d.tech_broker_id = #{adminId,jdbcType=VARCHAR}
  1804. )
  1805. </if>
  1806. <if test="serialNumber != null">
  1807. and d.serial_number = #{serialNumber,jdbcType=INTEGER}
  1808. </if>
  1809. <if test="auditStatus != null">
  1810. and d.audit_status = #{auditStatus,jdbcType=INTEGER}
  1811. </if>
  1812. <!-- <if test="province != null">
  1813. and oi.licence_province = #{province,jdbcType=INTEGER}
  1814. </if> -->
  1815. <if test="name != null">
  1816. and d.name like CONCAT('%',#{name,jdbcType=VARCHAR},'%')
  1817. </if>
  1818. <if test="keyword != null">
  1819. and d.keyword like "%"#{keyword,jdbcType=VARCHAR}"%"
  1820. </if>
  1821. <!-- <if test="unitName != null">
  1822. and oi.unit_name like CONCAT('%',#{unitName,jdbcType=VARCHAR},'%')
  1823. </if> -->
  1824. <if test="employerName != null">
  1825. and d.employer_name like CONCAT('%',#{employerName,jdbcType=VARCHAR},'%')
  1826. and (d.employer_id is null or d.employer_id='')
  1827. </if>
  1828. <if test="infoSources != null">
  1829. and d.info_sources = #{infoSources,jdbcType=INTEGER}
  1830. </if>
  1831. <if test="demandType != null">
  1832. and d.demand_type = #{demandType,jdbcType=INTEGER}
  1833. </if>
  1834. <if test="status != null">
  1835. and d.status = #{status,jdbcType=VARCHAR}
  1836. </if>
  1837. <if test="releaseStatus != null">
  1838. and d.release_status = #{releaseStatus,jdbcType=VARCHAR}
  1839. </if>
  1840. <if test="vStart != null">
  1841. and d.validity_period <![CDATA[ >= ]]> #{vStart,jdbcType=TIMESTAMP}
  1842. </if>
  1843. <if test="vEnd != null">
  1844. and d.validity_period <![CDATA[ < ]]> #{vEnd,jdbcType=TIMESTAMP}
  1845. </if>
  1846. <if test="rStart != null">
  1847. and d.release_date <![CDATA[ >= ]]> #{rStart,jdbcType=TIMESTAMP}
  1848. </if>
  1849. <if test="rEnd != null">
  1850. and d.release_date <![CDATA[ < ]]> #{rEnd,jdbcType=TIMESTAMP}
  1851. </if>
  1852. <if test="cStart != null">
  1853. and d.create_time <![CDATA[ > ]]> #{cStart,jdbcType=TIMESTAMP}
  1854. </if>
  1855. <if test="cEnd != null">
  1856. and d.create_time <![CDATA[ < ]]> #{cEnd,jdbcType=TIMESTAMP}
  1857. </if>
  1858. <if test="boutique != null">
  1859. and d.boutique = #{boutique,jdbcType=INTEGER}
  1860. </if>
  1861. <if test="hot != null and hot == 0"><!-- 不在首页 -->
  1862. and d.id not in(select mm.product_id from marketing_management mm where mm.effective = 1)
  1863. </if>
  1864. <if test="hot != null and hot == 1"><!-- 在首页 -->
  1865. and mm.effective = 1
  1866. </if>
  1867. </select>
  1868. <select id="findManageDemandListByPage" parameterType="String" resultType="com.goafanti.demand.bo.DemandManageListBo">
  1869. select
  1870. d.id, d.serial_number as serialNumber, d.data_category as dataCategory,
  1871. d.name, d.keyword, d.info_sources as infoSources,
  1872. <!-- oi.unit_name as username, --> d.demand_type as demandType, d.validity_period as validityPeriod,
  1873. d.employer_name as employerName, <!-- oi.licence_province as province, --> d.status, d.urgent_days as urgentDays,d.urgent_money as urgentMoney,
  1874. d.release_status as releaseStatus, d.release_date as releaseDate, a.name as techBrokerId,d.create_time as createTime,
  1875. d.employer_id as employerId, d.audit_status as auditStatus,
  1876. d.tech_broker_id as techBrokerId,d.boutique
  1877. <if test="hot != null and hot == 1"><!-- 在首页 -->
  1878. ,1 as hot
  1879. </if>
  1880. <if test="hot != null and hot == 0"><!-- 不在首页 -->
  1881. ,0 as hot
  1882. </if>
  1883. <if test="hot==null"><!-- 无首页参数 -->
  1884. ,ifnull(mm.effective,0) as hot
  1885. </if>
  1886. from demand d
  1887. <!-- LEFT JOIN organization_identity oi on d.employer_id = oi.uid -->
  1888. LEFT JOIN admin a on a.id = d.tech_broker_id
  1889. LEFT JOIN department_management dm on dm.id = a.department_id
  1890. <if test="hot != null and hot == 1"><!-- 在首页 -->
  1891. inner join marketing_management mm on d.id = mm.product_id
  1892. </if>
  1893. <if test="hot == null"> <!-- 无首页参数 -->
  1894. left join marketing_management mm on d.id = mm.product_id
  1895. </if>
  1896. where d.deleted_sign = 0
  1897. <if test="recordPerson != null">
  1898. and a.name = #{recordPerson,jdbcType=VARCHAR}
  1899. </if>
  1900. <if test="techBrokerId != null">
  1901. and (d.tech_broker_id = #{techBrokerId,jdbcType=VARCHAR} or a.department_id=(select department_id from admin where id=#{techBrokerId,jdbcType=VARCHAR}))
  1902. </if>
  1903. <if test="dataCategory != null">
  1904. and d.data_category = #{dataCategory,jdbcType=VARCHAR}
  1905. </if>
  1906. <!-- <if test="province != null">
  1907. and oi.licence_province = #{province,jdbcType=INTEGER}
  1908. </if> -->
  1909. <if test="serialNumber != null">
  1910. and d.serial_number = #{serialNumber,jdbcType=INTEGER}
  1911. </if>
  1912. <if test="auditStatus != null">
  1913. and d.audit_status = #{auditStatus,jdbcType=INTEGER}
  1914. </if>
  1915. <if test="name != null">
  1916. and d.name like CONCAT('%',#{name,jdbcType=VARCHAR},'%')
  1917. </if>
  1918. <if test="keyword != null">
  1919. and d.keyword like CONCAT('%',#{keyword,jdbcType=VARCHAR},'%')
  1920. </if>
  1921. <!-- <if test="unitName != null">
  1922. and oi.unit_name like CONCAT('%',#{unitName,jdbcType=VARCHAR},'%')
  1923. </if> -->
  1924. <if test="employerName != null">
  1925. and d.employer_name like CONCAT('%',#{employerName,jdbcType=VARCHAR},'%')
  1926. and (d.employer_id is null or d.employer_id='')
  1927. </if>
  1928. <if test="infoSources != null">
  1929. and d.info_sources = #{infoSources,jdbcType=INTEGER}
  1930. </if>
  1931. <if test="demandType != null">
  1932. and d.demand_type = #{demandType,jdbcType=INTEGER}
  1933. </if>
  1934. <if test="status != null">
  1935. and d.status = #{status,jdbcType=INTEGER}
  1936. </if>
  1937. <if test="releaseStatus != null">
  1938. and d.release_status = #{releaseStatus,jdbcType=VARCHAR}
  1939. </if>
  1940. <if test="vStart != null">
  1941. and d.validity_period <![CDATA[ >= ]]> #{vStart,jdbcType=TIMESTAMP}
  1942. </if>
  1943. <if test="vEnd != null">
  1944. and d.validity_period <![CDATA[ < ]]> #{vEnd,jdbcType=TIMESTAMP}
  1945. </if>
  1946. <if test="rStart != null">
  1947. and d.release_date <![CDATA[ >= ]]> #{rStart,jdbcType=TIMESTAMP}
  1948. </if>
  1949. <if test="rEnd != null">
  1950. and d.release_date <![CDATA[ < ]]> #{rEnd,jdbcType=TIMESTAMP}
  1951. </if>
  1952. <if test="cStart != null">
  1953. and d.create_time <![CDATA[ > ]]> #{cStart,jdbcType=TIMESTAMP}
  1954. </if>
  1955. <if test="cEnd != null">
  1956. and d.create_time <![CDATA[ < ]]> #{cEnd,jdbcType=TIMESTAMP}
  1957. </if>
  1958. <if test="boutique != null">
  1959. and d.boutique = #{boutique,jdbcType=INTEGER}
  1960. </if>
  1961. <if test="hot != null and hot == 0"><!-- 不在首页 -->
  1962. and d.id not in(select mm.product_id from marketing_management mm where mm.effective = 1)
  1963. </if>
  1964. <if test="hot != null and hot == 1"><!-- 在首页 -->
  1965. and mm.effective = 1
  1966. </if>
  1967. order by d.serial_number desc
  1968. <if test="page_sql!=null">
  1969. ${page_sql}
  1970. </if>
  1971. </select>
  1972. <select id ="findManagegDemandCount" parameterType="String" resultType="java.lang.Integer">
  1973. select
  1974. count(1)
  1975. from demand d
  1976. <!-- LEFT JOIN organization_identity oi on d.employer_id = oi.uid -->
  1977. LEFT JOIN admin a on a.id = d.tech_broker_id
  1978. LEFT JOIN department_management dm on dm.id = a.department_id
  1979. <if test="hot != null and hot == 1"><!-- 在首页 -->
  1980. inner join marketing_management mm on d.id = mm.product_id
  1981. </if>
  1982. <if test="hot == null"> <!-- 无首页参数 -->
  1983. left join marketing_management mm on d.id = mm.product_id
  1984. </if>
  1985. where d.deleted_sign = 0
  1986. <if test="recordPerson != null">
  1987. and a.name = #{recordPerson,jdbcType=VARCHAR}
  1988. </if>
  1989. <if test="techBrokerId != null">
  1990. and (d.tech_broker_id = #{techBrokerId,jdbcType=VARCHAR} or a.department_id=(select department_id from admin where id=#{techBrokerId,jdbcType=VARCHAR}))
  1991. </if>
  1992. <if test="dataCategory != null">
  1993. and d.data_category = #{dataCategory,jdbcType=VARCHAR}
  1994. </if>
  1995. <if test="serialNumber != null">
  1996. and d.serial_number = #{serialNumber,jdbcType=INTEGER}
  1997. </if>
  1998. <if test="auditStatus != null">
  1999. and d.audit_status = #{auditStatus,jdbcType=INTEGER}
  2000. </if>
  2001. <!-- <if test="province != null">
  2002. and oi.licence_province = #{province,jdbcType=INTEGER}
  2003. </if> -->
  2004. <if test="name != null">
  2005. and d.name like CONCAT('%',#{name,jdbcType=VARCHAR},'%')
  2006. </if>
  2007. <if test="keyword != null">
  2008. and d.keyword like "%"#{keyword,jdbcType=VARCHAR}"%"
  2009. </if>
  2010. <!-- <if test="unitName != null">
  2011. and oi.unit_name like CONCAT('%',#{unitName,jdbcType=VARCHAR},'%')
  2012. </if> -->
  2013. <if test="employerName != null">
  2014. and d.employer_name like CONCAT('%',#{employerName,jdbcType=VARCHAR},'%')
  2015. and (d.employer_id is null or d.employer_id='')
  2016. </if>
  2017. <if test="infoSources != null">
  2018. and d.info_sources = #{infoSources,jdbcType=INTEGER}
  2019. </if>
  2020. <if test="demandType != null">
  2021. and d.demand_type = #{demandType,jdbcType=INTEGER}
  2022. </if>
  2023. <if test="status != null">
  2024. and d.status = #{status,jdbcType=VARCHAR}
  2025. </if>
  2026. <if test="releaseStatus != null">
  2027. and d.release_status = #{releaseStatus,jdbcType=VARCHAR}
  2028. </if>
  2029. <if test="vStart != null">
  2030. and d.validity_period <![CDATA[ >= ]]> #{vStart,jdbcType=TIMESTAMP}
  2031. </if>
  2032. <if test="vEnd != null">
  2033. and d.validity_period <![CDATA[ < ]]> #{vEnd,jdbcType=TIMESTAMP}
  2034. </if>
  2035. <if test="rStart != null">
  2036. and d.release_date <![CDATA[ >= ]]> #{rStart,jdbcType=TIMESTAMP}
  2037. </if>
  2038. <if test="rEnd != null">
  2039. and d.release_date <![CDATA[ < ]]> #{rEnd,jdbcType=TIMESTAMP}
  2040. </if>
  2041. <if test="cStart != null">
  2042. and d.create_time <![CDATA[ > ]]> #{cStart,jdbcType=TIMESTAMP}
  2043. </if>
  2044. <if test="cEnd != null">
  2045. and d.create_time <![CDATA[ < ]]> #{cEnd,jdbcType=TIMESTAMP}
  2046. </if>
  2047. <if test="boutique != null">
  2048. and d.boutique = #{boutique,jdbcType=INTEGER}
  2049. </if>
  2050. <if test="hot != null and hot == 0"><!-- 不在首页 -->
  2051. and d.id not in(select mm.product_id from marketing_management mm where mm.effective = 1)
  2052. </if>
  2053. <if test="hot != null and hot == 1"><!-- 在首页 -->
  2054. and mm.effective = 1
  2055. </if>
  2056. </select>
  2057. <select id="getAppHomeRecommended" resultType="com.goafanti.demand.bo.DemandRecommended">
  2058. select dp.demand_id as id,d.name,d.demand_type as demandType,d.problem_des as introduction,d.picture_url as pictureUrl,
  2059. d.urgent_days as urgentDays,d.urgent_money as urgentMoney,d.industry_category_a as industryCategoryA,
  2060. d.industry_category_b as industryCategoryB,f1.name as fieldA,f2.name as fieldB,d.boutique
  2061. from demand_publish dp
  2062. left join demand d on dp.demand_id = d.id
  2063. left join field_glossory f1 on d.industry_category_a=f1.id
  2064. left join field_glossory f2 on d.industry_category_b=f2.id
  2065. where
  2066. dp.publish_client = '1'
  2067. and dp.publish_page = 'W01'
  2068. order by
  2069. dp.if_top,
  2070. dp.top_number,
  2071. dp.show_number asc limit 0,
  2072. 6
  2073. </select>
  2074. <select id="selectDemandFollow" resultType="com.goafanti.common.model.Demand">
  2075. select d.id,d.employer_name as employerName,d.name,d.employer_contacts_mobile as employerContactsMobile,
  2076. d.employer_contacts_mailbox as employerContactsMailbox,d.create_time as createTime,a.name as techBrokerId
  2077. from demand d
  2078. left join admin a on a.id=d.tech_broker_id
  2079. where d.id=#{id,jdbcType=VARCHAR}
  2080. </select>
  2081. <select id="selectRecentDemand" resultType="com.goafanti.demand.bo.DemandListBo">
  2082. select name,employer_name as employerName,id ,release_date as releaseDate,demand_type as demandType from demand where audit_status=2 order by release_date desc LIMIT 5
  2083. </select>
  2084. <select id="selectCompanyDemand" resultType="com.goafanti.demand.bo.DemandListBo">
  2085. select name,picture_url as pictureUrl,id from demand d where d.data_category=1 and d.audit_status=2 order by release_date desc
  2086. </select>
  2087. <select id="getUrgentDemand" resultType="com.goafanti.demand.bo.DemandListBo">
  2088. select name,release_date as releaseDate,id,problem_des as problemDes,research_type as researchType,budget_cost as fundForPersonnel,crowd_cost as fundForCrowd,demand_type as demandType,
  2089. validity_period as validityPeriod
  2090. from demand d where d.is_urgent=1 and d.audit_status=2 order by release_date desc
  2091. </select>
  2092. <select id="getHotDemand" resultType="com.goafanti.demand.bo.DemandListBo">
  2093. select name,release_date as releaseDate,id,problem_des as problemDes,research_type as researchType,budget_cost as fundForPersonnel,crowd_cost as fundForCrowd,demand_type as demandType,
  2094. validity_period as validityPeriod
  2095. from demand d where d.is_hot=1 and d.audit_status=2 order by release_date desc
  2096. </select>
  2097. <select id="getAreaDemand" resultType="com.goafanti.demand.bo.DemandListBo">
  2098. select name,picture_url as pictureUrl ,problem_des as problemDes ,id from demand d where d.demand_type=4 and d.audit_status=2 order by release_date desc
  2099. </select>
  2100. <select id="getProLearnStudyDemand" resultType="com.goafanti.demand.bo.DemandListBo">
  2101. select d.name as name,picture_url as pictureUrl ,problem_des as problemDes,employer_name as employerName,d.id,fg.name as industryCategory1,fgg.name as industryCategory2 from demand d
  2102. left join aft.field_glossory fg on fg.id=d.industry_category_a
  2103. left join aft.field_glossory fgg on fgg.id=d.industry_category_b
  2104. where d.demand_type=2 and d.audit_status=2 order by release_date desc
  2105. </select>
  2106. <select id="getFundCrowdDemand" resultType="com.goafanti.demand.bo.DemandListBo">
  2107. select name,picture_url as pictureUrl ,problem_des as problemDes ,id,crowd_cost as fundForCrowd,research_type as researchType from demand d where d.demand_type=3 and d.audit_status=2 order by release_date desc
  2108. </select>
  2109. <select id="getPersonnelDemand" resultType="com.goafanti.demand.bo.DemandListBo">
  2110. select name,picture_url as pictureUrl ,problem_des as problemDes ,id,budget_cost as fundForPersonnel from demand d where d.demand_type=5 and d.audit_status=2 order by release_date desc
  2111. </select>
  2112. </mapper>