1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517105181051910520105211052210523105241052510526105271052810529105301053110532105331053410535105361053710538105391054010541105421054310544105451054610547105481054910550105511055210553105541055510556105571055810559105601056110562105631056410565105661056710568105691057010571105721057310574105751057610577105781057910580105811058210583105841058510586105871058810589105901059110592105931059410595105961059710598105991060010601106021060310604106051060610607106081060910610106111061210613106141061510616106171061810619106201062110622106231062410625106261062710628106291063010631106321063310634106351063610637106381063910640106411064210643106441064510646106471064810649106501065110652106531065410655106561065710658106591066010661106621066310664106651066610667106681066910670106711067210673106741067510676106771067810679106801068110682106831068410685106861068710688106891069010691106921069310694106951069610697106981069910700107011070210703107041070510706107071070810709107101071110712107131071410715107161071710718107191072010721107221072310724107251072610727107281072910730107311073210733107341073510736107371073810739107401074110742107431074410745107461074710748107491075010751107521075310754107551075610757107581075910760107611076210763107641076510766107671076810769107701077110772107731077410775107761077710778107791078010781107821078310784107851078610787107881078910790107911079210793107941079510796107971079810799108001080110802108031080410805108061080710808108091081010811108121081310814108151081610817108181081910820108211082210823108241082510826108271082810829108301083110832108331083410835108361083710838108391084010841108421084310844108451084610847108481084910850108511085210853108541085510856108571085810859108601086110862108631086410865108661086710868108691087010871108721087310874108751087610877108781087910880108811088210883108841088510886108871088810889108901089110892108931089410895108961089710898108991090010901109021090310904109051090610907109081090910910109111091210913109141091510916109171091810919109201092110922109231092410925109261092710928109291093010931109321093310934109351093610937109381093910940109411094210943109441094510946109471094810949109501095110952109531095410955109561095710958109591096010961109621096310964109651096610967109681096910970109711097210973109741097510976109771097810979109801098110982109831098410985109861098710988109891099010991109921099310994109951099610997109981099911000110011100211003110041100511006110071100811009110101101111012110131101411015110161101711018110191102011021110221102311024110251102611027110281102911030110311103211033110341103511036110371103811039110401104111042110431104411045110461104711048110491105011051110521105311054110551105611057110581105911060110611106211063110641106511066110671106811069110701107111072110731107411075110761107711078110791108011081110821108311084110851108611087110881108911090110911109211093110941109511096110971109811099111001110111102111031110411105111061110711108111091111011111111121111311114111151111611117111181111911120111211112211123111241112511126111271112811129111301113111132111331113411135111361113711138111391114011141111421114311144111451114611147111481114911150111511115211153111541115511156111571115811159111601116111162111631116411165111661116711168111691117011171111721117311174111751117611177111781117911180111811118211183111841118511186111871118811189111901119111192111931119411195111961119711198111991120011201112021120311204112051120611207112081120911210112111121211213112141121511216112171121811219112201122111222112231122411225112261122711228112291123011231112321123311234112351123611237112381123911240112411124211243112441124511246112471124811249112501125111252112531125411255112561125711258112591126011261112621126311264112651126611267112681126911270112711127211273112741127511276112771127811279112801128111282112831128411285112861128711288112891129011291112921129311294112951129611297112981129911300113011130211303113041130511306113071130811309113101131111312113131131411315113161131711318113191132011321113221132311324113251132611327113281132911330113311133211333113341133511336113371133811339113401134111342113431134411345113461134711348113491135011351113521135311354113551135611357113581135911360113611136211363113641136511366113671136811369113701137111372113731137411375113761137711378113791138011381113821138311384113851138611387113881138911390113911139211393113941139511396113971139811399114001140111402114031140411405114061140711408114091141011411114121141311414114151141611417114181141911420114211142211423114241142511426114271142811429114301143111432114331143411435114361143711438114391144011441114421144311444114451144611447114481144911450114511145211453114541145511456114571145811459114601146111462114631146411465114661146711468114691147011471114721147311474114751147611477114781147911480114811148211483114841148511486114871148811489114901149111492114931149411495114961149711498114991150011501115021150311504115051150611507115081150911510115111151211513115141151511516115171151811519115201152111522115231152411525115261152711528115291153011531115321153311534115351153611537115381153911540115411154211543115441154511546115471154811549115501155111552115531155411555115561155711558115591156011561115621156311564115651156611567115681156911570115711157211573115741157511576115771157811579115801158111582115831158411585115861158711588115891159011591115921159311594115951159611597115981159911600116011160211603116041160511606116071160811609116101161111612116131161411615116161161711618116191162011621116221162311624116251162611627116281162911630116311163211633116341163511636116371163811639116401164111642116431164411645116461164711648116491165011651116521165311654116551165611657116581165911660116611166211663116641166511666116671166811669116701167111672116731167411675116761167711678116791168011681116821168311684116851168611687116881168911690116911169211693116941169511696116971169811699117001170111702117031170411705117061170711708117091171011711117121171311714117151171611717117181171911720117211172211723117241172511726117271172811729117301173111732117331173411735117361173711738117391174011741117421174311744117451174611747117481174911750117511175211753117541175511756117571175811759117601176111762117631176411765117661176711768117691177011771117721177311774117751177611777117781177911780117811178211783117841178511786117871178811789117901179111792117931179411795117961179711798117991180011801118021180311804118051180611807118081180911810118111181211813118141181511816118171181811819118201182111822118231182411825118261182711828118291183011831118321183311834118351183611837118381183911840118411184211843118441184511846118471184811849118501185111852118531185411855118561185711858118591186011861118621186311864118651186611867118681186911870118711187211873118741187511876118771187811879118801188111882118831188411885118861188711888118891189011891118921189311894118951189611897118981189911900119011190211903119041190511906119071190811909119101191111912119131191411915119161191711918119191192011921119221192311924119251192611927119281192911930119311193211933119341193511936119371193811939119401194111942119431194411945119461194711948119491195011951119521195311954119551195611957119581195911960119611196211963119641196511966119671196811969119701197111972119731197411975119761197711978119791198011981119821198311984119851198611987119881198911990119911199211993119941199511996119971199811999120001200112002120031200412005120061200712008120091201012011120121201312014120151201612017120181201912020120211202212023120241202512026120271202812029120301203112032120331203412035120361203712038120391204012041120421204312044120451204612047120481204912050120511205212053120541205512056120571205812059120601206112062120631206412065120661206712068120691207012071120721207312074120751207612077120781207912080120811208212083120841208512086120871208812089120901209112092120931209412095120961209712098120991210012101121021210312104121051210612107121081210912110121111211212113121141211512116121171211812119121201212112122121231212412125121261212712128121291213012131121321213312134121351213612137121381213912140121411214212143121441214512146121471214812149121501215112152121531215412155121561215712158121591216012161121621216312164121651216612167121681216912170121711217212173121741217512176121771217812179121801218112182121831218412185121861218712188121891219012191121921219312194121951219612197121981219912200122011220212203122041220512206122071220812209122101221112212122131221412215122161221712218122191222012221122221222312224122251222612227122281222912230122311223212233122341223512236122371223812239122401224112242122431224412245122461224712248122491225012251122521225312254122551225612257122581225912260122611226212263122641226512266122671226812269122701227112272122731227412275122761227712278122791228012281122821228312284122851228612287122881228912290122911229212293122941229512296122971229812299123001230112302123031230412305123061230712308123091231012311123121231312314123151231612317123181231912320123211232212323123241232512326123271232812329123301233112332123331233412335123361233712338123391234012341123421234312344123451234612347123481234912350123511235212353123541235512356123571235812359123601236112362123631236412365123661236712368123691237012371123721237312374123751237612377123781237912380123811238212383123841238512386123871238812389123901239112392123931239412395123961239712398123991240012401124021240312404124051240612407124081240912410124111241212413124141241512416124171241812419124201242112422124231242412425124261242712428124291243012431124321243312434124351243612437124381243912440124411244212443124441244512446124471244812449124501245112452124531245412455124561245712458124591246012461124621246312464124651246612467124681246912470124711247212473124741247512476124771247812479124801248112482124831248412485124861248712488124891249012491124921249312494124951249612497124981249912500125011250212503125041250512506125071250812509125101251112512125131251412515125161251712518125191252012521125221252312524125251252612527125281252912530125311253212533125341253512536125371253812539125401254112542125431254412545125461254712548125491255012551125521255312554125551255612557125581255912560125611256212563125641256512566125671256812569125701257112572125731257412575125761257712578125791258012581125821258312584125851258612587125881258912590125911259212593125941259512596125971259812599126001260112602126031260412605126061260712608126091261012611126121261312614126151261612617126181261912620126211262212623126241262512626126271262812629126301263112632126331263412635126361263712638126391264012641126421264312644126451264612647126481264912650126511265212653126541265512656126571265812659126601266112662126631266412665126661266712668126691267012671126721267312674126751267612677126781267912680126811268212683126841268512686126871268812689126901269112692126931269412695126961269712698126991270012701127021270312704127051270612707127081270912710127111271212713127141271512716127171271812719127201272112722127231272412725127261272712728127291273012731127321273312734127351273612737127381273912740127411274212743127441274512746127471274812749127501275112752127531275412755127561275712758127591276012761127621276312764127651276612767127681276912770127711277212773127741277512776127771277812779127801278112782127831278412785127861278712788127891279012791127921279312794127951279612797127981279912800128011280212803128041280512806128071280812809128101281112812128131281412815128161281712818128191282012821128221282312824128251282612827128281282912830128311283212833128341283512836128371283812839128401284112842128431284412845128461284712848128491285012851128521285312854128551285612857128581285912860128611286212863128641286512866128671286812869128701287112872128731287412875128761287712878128791288012881128821288312884128851288612887128881288912890128911289212893128941289512896128971289812899129001290112902129031290412905129061290712908129091291012911129121291312914129151291612917129181291912920129211292212923129241292512926129271292812929129301293112932129331293412935129361293712938129391294012941129421294312944129451294612947129481294912950129511295212953129541295512956129571295812959129601296112962129631296412965129661296712968129691297012971129721297312974129751297612977129781297912980129811298212983129841298512986129871298812989129901299112992129931299412995129961299712998129991300013001130021300313004130051300613007130081300913010130111301213013130141301513016130171301813019130201302113022130231302413025130261302713028130291303013031130321303313034130351303613037130381303913040130411304213043130441304513046130471304813049130501305113052130531305413055130561305713058130591306013061130621306313064130651306613067130681306913070130711307213073130741307513076130771307813079130801308113082130831308413085130861308713088130891309013091130921309313094130951309613097130981309913100131011310213103131041310513106131071310813109131101311113112131131311413115131161311713118131191312013121131221312313124131251312613127131281312913130131311313213133131341313513136131371313813139131401314113142131431314413145131461314713148131491315013151131521315313154131551315613157131581315913160131611316213163131641316513166131671316813169131701317113172131731317413175131761317713178131791318013181131821318313184131851318613187131881318913190131911319213193131941319513196131971319813199132001320113202132031320413205132061320713208132091321013211132121321313214132151321613217132181321913220132211322213223132241322513226132271322813229132301323113232132331323413235132361323713238132391324013241132421324313244132451324613247132481324913250132511325213253132541325513256132571325813259132601326113262132631326413265132661326713268132691327013271132721327313274132751327613277132781327913280132811328213283132841328513286132871328813289132901329113292132931329413295132961329713298132991330013301133021330313304133051330613307133081330913310133111331213313133141331513316133171331813319133201332113322133231332413325133261332713328133291333013331133321333313334133351333613337133381333913340133411334213343133441334513346133471334813349133501335113352133531335413355133561335713358133591336013361133621336313364133651336613367133681336913370133711337213373133741337513376133771337813379133801338113382133831338413385133861338713388133891339013391133921339313394133951339613397133981339913400134011340213403134041340513406134071340813409134101341113412134131341413415134161341713418134191342013421134221342313424134251342613427134281342913430134311343213433134341343513436134371343813439134401344113442134431344413445134461344713448134491345013451134521345313454134551345613457134581345913460134611346213463134641346513466134671346813469134701347113472134731347413475134761347713478134791348013481134821348313484134851348613487134881348913490134911349213493134941349513496134971349813499135001350113502135031350413505135061350713508135091351013511135121351313514135151351613517135181351913520135211352213523135241352513526135271352813529135301353113532135331353413535135361353713538135391354013541135421354313544135451354613547135481354913550135511355213553135541355513556135571355813559135601356113562135631356413565135661356713568135691357013571135721357313574135751357613577135781357913580135811358213583135841358513586135871358813589135901359113592135931359413595135961359713598135991360013601136021360313604136051360613607136081360913610136111361213613136141361513616136171361813619136201362113622136231362413625136261362713628136291363013631136321363313634136351363613637136381363913640136411364213643136441364513646136471364813649136501365113652136531365413655136561365713658136591366013661136621366313664136651366613667136681366913670136711367213673136741367513676136771367813679136801368113682136831368413685136861368713688136891369013691136921369313694136951369613697136981369913700137011370213703137041370513706137071370813709137101371113712137131371413715137161371713718137191372013721137221372313724137251372613727137281372913730137311373213733137341373513736137371373813739137401374113742137431374413745137461374713748137491375013751137521375313754137551375613757137581375913760137611376213763137641376513766137671376813769137701377113772137731377413775137761377713778137791378013781137821378313784137851378613787137881378913790137911379213793137941379513796137971379813799138001380113802138031380413805138061380713808138091381013811138121381313814138151381613817138181381913820138211382213823138241382513826138271382813829138301383113832138331383413835138361383713838138391384013841138421384313844138451384613847138481384913850138511385213853138541385513856138571385813859138601386113862138631386413865138661386713868138691387013871138721387313874138751387613877138781387913880138811388213883138841388513886138871388813889138901389113892138931389413895138961389713898138991390013901139021390313904139051390613907139081390913910139111391213913139141391513916139171391813919139201392113922139231392413925139261392713928139291393013931139321393313934139351393613937139381393913940139411394213943139441394513946139471394813949139501395113952139531395413955139561395713958139591396013961139621396313964139651396613967139681396913970139711397213973139741397513976139771397813979139801398113982139831398413985139861398713988139891399013991139921399313994139951399613997139981399914000140011400214003140041400514006140071400814009140101401114012140131401414015140161401714018140191402014021140221402314024140251402614027140281402914030140311403214033140341403514036140371403814039140401404114042140431404414045140461404714048140491405014051140521405314054140551405614057140581405914060140611406214063140641406514066140671406814069140701407114072140731407414075140761407714078140791408014081140821408314084140851408614087140881408914090140911409214093140941409514096140971409814099141001410114102141031410414105141061410714108141091411014111141121411314114141151411614117141181411914120141211412214123141241412514126141271412814129141301413114132141331413414135141361413714138141391414014141141421414314144141451414614147141481414914150141511415214153141541415514156141571415814159141601416114162141631416414165141661416714168141691417014171141721417314174141751417614177141781417914180141811418214183141841418514186141871418814189141901419114192141931419414195141961419714198141991420014201142021420314204142051420614207142081420914210142111421214213142141421514216142171421814219142201422114222142231422414225142261422714228142291423014231142321423314234142351423614237142381423914240142411424214243142441424514246142471424814249142501425114252142531425414255142561425714258142591426014261142621426314264142651426614267142681426914270142711427214273142741427514276142771427814279142801428114282142831428414285142861428714288142891429014291142921429314294142951429614297142981429914300143011430214303143041430514306143071430814309143101431114312143131431414315143161431714318143191432014321143221432314324143251432614327143281432914330143311433214333143341433514336143371433814339143401434114342143431434414345143461434714348143491435014351143521435314354143551435614357143581435914360143611436214363143641436514366143671436814369143701437114372143731437414375143761437714378143791438014381143821438314384143851438614387143881438914390143911439214393143941439514396143971439814399144001440114402144031440414405144061440714408144091441014411144121441314414144151441614417144181441914420144211442214423144241442514426144271442814429144301443114432144331443414435144361443714438144391444014441144421444314444144451444614447144481444914450144511445214453144541445514456144571445814459144601446114462144631446414465144661446714468144691447014471144721447314474144751447614477144781447914480144811448214483144841448514486144871448814489144901449114492144931449414495144961449714498144991450014501145021450314504145051450614507145081450914510145111451214513145141451514516145171451814519145201452114522145231452414525145261452714528145291453014531145321453314534145351453614537145381453914540145411454214543145441454514546145471454814549145501455114552145531455414555145561455714558145591456014561145621456314564145651456614567145681456914570145711457214573145741457514576145771457814579145801458114582145831458414585145861458714588145891459014591145921459314594145951459614597145981459914600146011460214603146041460514606146071460814609146101461114612146131461414615146161461714618146191462014621146221462314624146251462614627146281462914630146311463214633146341463514636146371463814639146401464114642146431464414645146461464714648146491465014651146521465314654146551465614657146581465914660146611466214663146641466514666146671466814669146701467114672146731467414675146761467714678146791468014681146821468314684146851468614687146881468914690146911469214693146941469514696146971469814699147001470114702147031470414705147061470714708147091471014711147121471314714147151471614717147181471914720147211472214723147241472514726147271472814729147301473114732147331473414735147361473714738147391474014741147421474314744147451474614747147481474914750147511475214753147541475514756147571475814759147601476114762147631476414765147661476714768147691477014771147721477314774147751477614777147781477914780147811478214783147841478514786147871478814789147901479114792147931479414795147961479714798147991480014801148021480314804148051480614807148081480914810148111481214813148141481514816148171481814819148201482114822148231482414825148261482714828148291483014831148321483314834148351483614837148381483914840148411484214843148441484514846148471484814849148501485114852148531485414855148561485714858148591486014861148621486314864148651486614867148681486914870148711487214873148741487514876148771487814879148801488114882148831488414885148861488714888148891489014891148921489314894148951489614897148981489914900149011490214903149041490514906149071490814909149101491114912149131491414915149161491714918149191492014921149221492314924149251492614927149281492914930149311493214933149341493514936149371493814939149401494114942149431494414945149461494714948149491495014951149521495314954149551495614957149581495914960149611496214963149641496514966149671496814969149701497114972149731497414975149761497714978149791498014981149821498314984149851498614987149881498914990149911499214993149941499514996149971499814999150001500115002150031500415005150061500715008150091501015011150121501315014150151501615017150181501915020150211502215023150241502515026150271502815029150301503115032150331503415035150361503715038150391504015041150421504315044150451504615047150481504915050150511505215053150541505515056150571505815059150601506115062150631506415065150661506715068150691507015071150721507315074150751507615077150781507915080150811508215083150841508515086150871508815089150901509115092150931509415095150961509715098150991510015101151021510315104151051510615107151081510915110151111511215113151141511515116151171511815119151201512115122151231512415125151261512715128151291513015131151321513315134151351513615137151381513915140151411514215143151441514515146151471514815149151501515115152151531515415155151561515715158151591516015161151621516315164151651516615167151681516915170151711517215173151741517515176151771517815179151801518115182151831518415185151861518715188151891519015191151921519315194151951519615197151981519915200152011520215203152041520515206152071520815209152101521115212152131521415215152161521715218152191522015221152221522315224152251522615227152281522915230152311523215233152341523515236152371523815239152401524115242152431524415245152461524715248152491525015251152521525315254152551525615257152581525915260152611526215263152641526515266152671526815269152701527115272152731527415275152761527715278152791528015281152821528315284152851528615287152881528915290152911529215293152941529515296152971529815299153001530115302153031530415305153061530715308153091531015311153121531315314153151531615317153181531915320153211532215323153241532515326153271532815329153301533115332153331533415335153361533715338153391534015341153421534315344153451534615347153481534915350153511535215353153541535515356153571535815359153601536115362153631536415365153661536715368153691537015371153721537315374153751537615377153781537915380153811538215383153841538515386153871538815389153901539115392153931539415395153961539715398153991540015401154021540315404154051540615407154081540915410154111541215413154141541515416154171541815419154201542115422154231542415425154261542715428154291543015431154321543315434154351543615437154381543915440154411544215443154441544515446154471544815449154501545115452154531545415455154561545715458154591546015461154621546315464154651546615467154681546915470154711547215473154741547515476154771547815479154801548115482154831548415485154861548715488154891549015491154921549315494154951549615497154981549915500155011550215503155041550515506155071550815509155101551115512155131551415515155161551715518155191552015521155221552315524155251552615527155281552915530155311553215533155341553515536155371553815539155401554115542155431554415545155461554715548155491555015551155521555315554155551555615557155581555915560155611556215563155641556515566155671556815569155701557115572155731557415575155761557715578155791558015581155821558315584155851558615587155881558915590155911559215593155941559515596155971559815599156001560115602156031560415605156061560715608156091561015611156121561315614156151561615617156181561915620156211562215623156241562515626156271562815629156301563115632156331563415635156361563715638156391564015641156421564315644156451564615647156481564915650156511565215653156541565515656156571565815659156601566115662156631566415665156661566715668156691567015671156721567315674156751567615677156781567915680156811568215683156841568515686156871568815689156901569115692156931569415695156961569715698156991570015701157021570315704157051570615707157081570915710157111571215713157141571515716157171571815719157201572115722157231572415725157261572715728157291573015731157321573315734157351573615737157381573915740157411574215743157441574515746157471574815749157501575115752157531575415755157561575715758157591576015761157621576315764157651576615767157681576915770157711577215773157741577515776157771577815779157801578115782157831578415785157861578715788157891579015791157921579315794157951579615797157981579915800158011580215803158041580515806158071580815809158101581115812158131581415815158161581715818158191582015821158221582315824158251582615827158281582915830158311583215833158341583515836158371583815839158401584115842158431584415845158461584715848158491585015851158521585315854158551585615857158581585915860158611586215863158641586515866158671586815869158701587115872158731587415875158761587715878158791588015881158821588315884158851588615887158881588915890158911589215893158941589515896158971589815899159001590115902159031590415905159061590715908159091591015911159121591315914159151591615917159181591915920159211592215923159241592515926159271592815929159301593115932159331593415935159361593715938159391594015941159421594315944159451594615947159481594915950159511595215953159541595515956159571595815959159601596115962159631596415965159661596715968159691597015971159721597315974159751597615977159781597915980159811598215983159841598515986159871598815989159901599115992159931599415995159961599715998159991600016001160021600316004160051600616007160081600916010160111601216013160141601516016160171601816019160201602116022160231602416025160261602716028160291603016031160321603316034160351603616037160381603916040160411604216043160441604516046160471604816049160501605116052160531605416055160561605716058160591606016061160621606316064160651606616067160681606916070160711607216073160741607516076160771607816079160801608116082160831608416085160861608716088160891609016091160921609316094160951609616097160981609916100161011610216103161041610516106161071610816109161101611116112161131611416115161161611716118161191612016121161221612316124161251612616127161281612916130161311613216133161341613516136161371613816139161401614116142161431614416145161461614716148161491615016151161521615316154161551615616157161581615916160161611616216163161641616516166161671616816169161701617116172161731617416175161761617716178161791618016181161821618316184161851618616187161881618916190161911619216193161941619516196161971619816199162001620116202162031620416205162061620716208162091621016211162121621316214162151621616217162181621916220162211622216223162241622516226162271622816229162301623116232162331623416235162361623716238162391624016241162421624316244162451624616247162481624916250162511625216253162541625516256162571625816259162601626116262162631626416265162661626716268162691627016271162721627316274162751627616277162781627916280162811628216283162841628516286162871628816289162901629116292162931629416295162961629716298162991630016301163021630316304163051630616307163081630916310163111631216313163141631516316163171631816319163201632116322163231632416325163261632716328163291633016331163321633316334163351633616337163381633916340163411634216343163441634516346163471634816349163501635116352163531635416355163561635716358163591636016361163621636316364163651636616367163681636916370163711637216373163741637516376163771637816379163801638116382163831638416385163861638716388163891639016391163921639316394163951639616397163981639916400164011640216403164041640516406164071640816409164101641116412164131641416415164161641716418164191642016421164221642316424164251642616427164281642916430164311643216433164341643516436164371643816439164401644116442164431644416445164461644716448164491645016451164521645316454164551645616457164581645916460164611646216463164641646516466164671646816469164701647116472164731647416475164761647716478164791648016481164821648316484164851648616487164881648916490164911649216493164941649516496164971649816499165001650116502165031650416505165061650716508165091651016511165121651316514165151651616517165181651916520165211652216523165241652516526165271652816529165301653116532165331653416535165361653716538165391654016541165421654316544165451654616547165481654916550165511655216553165541655516556165571655816559165601656116562165631656416565165661656716568165691657016571165721657316574165751657616577165781657916580165811658216583165841658516586165871658816589165901659116592165931659416595165961659716598165991660016601166021660316604166051660616607166081660916610166111661216613166141661516616166171661816619166201662116622166231662416625166261662716628166291663016631166321663316634166351663616637166381663916640166411664216643166441664516646166471664816649166501665116652166531665416655166561665716658166591666016661166621666316664166651666616667166681666916670166711667216673166741667516676166771667816679166801668116682166831668416685166861668716688166891669016691166921669316694166951669616697166981669916700167011670216703167041670516706167071670816709167101671116712167131671416715167161671716718167191672016721167221672316724167251672616727167281672916730167311673216733167341673516736167371673816739167401674116742167431674416745167461674716748167491675016751167521675316754167551675616757167581675916760167611676216763167641676516766167671676816769167701677116772167731677416775167761677716778167791678016781167821678316784167851678616787167881678916790167911679216793167941679516796167971679816799168001680116802168031680416805168061680716808168091681016811168121681316814168151681616817168181681916820168211682216823168241682516826168271682816829168301683116832168331683416835168361683716838168391684016841168421684316844168451684616847168481684916850168511685216853168541685516856168571685816859168601686116862168631686416865168661686716868168691687016871168721687316874168751687616877168781687916880168811688216883168841688516886168871688816889168901689116892168931689416895168961689716898168991690016901169021690316904169051690616907169081690916910169111691216913169141691516916169171691816919169201692116922169231692416925169261692716928169291693016931169321693316934169351693616937169381693916940169411694216943169441694516946169471694816949169501695116952169531695416955169561695716958169591696016961169621696316964169651696616967169681696916970169711697216973169741697516976169771697816979169801698116982169831698416985169861698716988169891699016991169921699316994169951699616997169981699917000170011700217003170041700517006170071700817009170101701117012170131701417015170161701717018170191702017021170221702317024170251702617027170281702917030170311703217033170341703517036170371703817039170401704117042170431704417045170461704717048170491705017051170521705317054170551705617057170581705917060170611706217063170641706517066170671706817069170701707117072170731707417075170761707717078170791708017081170821708317084170851708617087170881708917090170911709217093170941709517096170971709817099171001710117102171031710417105171061710717108171091711017111171121711317114171151711617117171181711917120171211712217123171241712517126171271712817129171301713117132171331713417135171361713717138171391714017141171421714317144171451714617147171481714917150171511715217153171541715517156171571715817159171601716117162171631716417165171661716717168171691717017171171721717317174171751717617177171781717917180171811718217183171841718517186171871718817189171901719117192171931719417195171961719717198171991720017201172021720317204172051720617207172081720917210172111721217213172141721517216172171721817219172201722117222172231722417225172261722717228172291723017231172321723317234172351723617237172381723917240172411724217243172441724517246172471724817249172501725117252172531725417255172561725717258172591726017261172621726317264172651726617267172681726917270172711727217273172741727517276172771727817279172801728117282172831728417285172861728717288172891729017291172921729317294172951729617297172981729917300173011730217303173041730517306173071730817309173101731117312173131731417315173161731717318173191732017321173221732317324173251732617327173281732917330173311733217333173341733517336173371733817339173401734117342173431734417345173461734717348173491735017351173521735317354173551735617357173581735917360173611736217363173641736517366173671736817369173701737117372173731737417375173761737717378173791738017381173821738317384173851738617387173881738917390173911739217393173941739517396173971739817399174001740117402174031740417405174061740717408174091741017411174121741317414174151741617417174181741917420174211742217423174241742517426174271742817429174301743117432174331743417435174361743717438174391744017441174421744317444174451744617447174481744917450174511745217453174541745517456174571745817459174601746117462174631746417465174661746717468174691747017471174721747317474174751747617477174781747917480174811748217483174841748517486174871748817489174901749117492174931749417495174961749717498174991750017501175021750317504175051750617507175081750917510175111751217513175141751517516175171751817519175201752117522175231752417525175261752717528175291753017531175321753317534175351753617537175381753917540175411754217543175441754517546175471754817549175501755117552175531755417555175561755717558175591756017561175621756317564175651756617567175681756917570175711757217573175741757517576175771757817579175801758117582175831758417585175861758717588175891759017591175921759317594175951759617597175981759917600176011760217603176041760517606176071760817609176101761117612176131761417615176161761717618176191762017621176221762317624176251762617627176281762917630176311763217633176341763517636176371763817639176401764117642176431764417645176461764717648176491765017651176521765317654176551765617657176581765917660176611766217663176641766517666176671766817669176701767117672176731767417675176761767717678176791768017681176821768317684176851768617687176881768917690176911769217693176941769517696176971769817699177001770117702177031770417705177061770717708177091771017711177121771317714177151771617717177181771917720177211772217723177241772517726177271772817729177301773117732177331773417735177361773717738177391774017741177421774317744177451774617747177481774917750177511775217753177541775517756177571775817759177601776117762177631776417765177661776717768177691777017771177721777317774177751777617777177781777917780177811778217783177841778517786177871778817789177901779117792177931779417795177961779717798177991780017801178021780317804178051780617807178081780917810178111781217813178141781517816178171781817819178201782117822178231782417825178261782717828178291783017831178321783317834178351783617837178381783917840178411784217843178441784517846178471784817849178501785117852178531785417855178561785717858178591786017861178621786317864178651786617867178681786917870178711787217873178741787517876178771787817879178801788117882178831788417885178861788717888178891789017891178921789317894178951789617897178981789917900179011790217903179041790517906179071790817909179101791117912179131791417915179161791717918179191792017921179221792317924179251792617927179281792917930179311793217933179341793517936179371793817939179401794117942179431794417945179461794717948179491795017951179521795317954179551795617957179581795917960179611796217963179641796517966179671796817969179701797117972179731797417975179761797717978179791798017981179821798317984179851798617987179881798917990179911799217993179941799517996179971799817999180001800118002180031800418005180061800718008180091801018011180121801318014180151801618017180181801918020180211802218023180241802518026180271802818029180301803118032180331803418035180361803718038180391804018041180421804318044180451804618047180481804918050180511805218053180541805518056180571805818059180601806118062180631806418065180661806718068180691807018071180721807318074180751807618077180781807918080180811808218083180841808518086180871808818089180901809118092180931809418095180961809718098180991810018101181021810318104181051810618107181081810918110181111811218113181141811518116181171811818119181201812118122181231812418125181261812718128181291813018131181321813318134181351813618137181381813918140181411814218143181441814518146181471814818149181501815118152181531815418155181561815718158181591816018161181621816318164181651816618167181681816918170181711817218173181741817518176181771817818179181801818118182181831818418185181861818718188181891819018191181921819318194181951819618197181981819918200182011820218203182041820518206182071820818209182101821118212182131821418215182161821718218182191822018221182221822318224182251822618227182281822918230182311823218233182341823518236182371823818239182401824118242182431824418245182461824718248182491825018251182521825318254182551825618257182581825918260182611826218263182641826518266182671826818269182701827118272182731827418275182761827718278182791828018281182821828318284182851828618287182881828918290182911829218293182941829518296182971829818299183001830118302183031830418305183061830718308183091831018311183121831318314183151831618317183181831918320183211832218323183241832518326183271832818329183301833118332183331833418335183361833718338183391834018341183421834318344183451834618347183481834918350183511835218353183541835518356183571835818359183601836118362183631836418365183661836718368183691837018371183721837318374183751837618377183781837918380183811838218383183841838518386183871838818389183901839118392183931839418395183961839718398183991840018401184021840318404184051840618407184081840918410184111841218413184141841518416184171841818419184201842118422184231842418425184261842718428184291843018431184321843318434184351843618437184381843918440184411844218443184441844518446184471844818449184501845118452184531845418455184561845718458184591846018461184621846318464184651846618467184681846918470184711847218473184741847518476184771847818479184801848118482184831848418485184861848718488184891849018491184921849318494184951849618497184981849918500185011850218503185041850518506185071850818509185101851118512185131851418515185161851718518185191852018521185221852318524185251852618527185281852918530185311853218533185341853518536185371853818539185401854118542185431854418545185461854718548185491855018551185521855318554185551855618557185581855918560185611856218563185641856518566185671856818569185701857118572185731857418575185761857718578185791858018581185821858318584185851858618587185881858918590185911859218593185941859518596185971859818599186001860118602186031860418605186061860718608186091861018611186121861318614186151861618617186181861918620186211862218623186241862518626186271862818629186301863118632186331863418635186361863718638186391864018641186421864318644186451864618647186481864918650186511865218653186541865518656186571865818659186601866118662186631866418665186661866718668186691867018671186721867318674186751867618677186781867918680186811868218683186841868518686186871868818689186901869118692186931869418695186961869718698186991870018701187021870318704187051870618707187081870918710187111871218713187141871518716187171871818719187201872118722187231872418725187261872718728187291873018731187321873318734187351873618737187381873918740187411874218743187441874518746187471874818749187501875118752187531875418755187561875718758187591876018761187621876318764187651876618767187681876918770187711877218773187741877518776187771877818779187801878118782187831878418785187861878718788187891879018791187921879318794187951879618797187981879918800188011880218803188041880518806188071880818809188101881118812188131881418815188161881718818188191882018821188221882318824188251882618827188281882918830188311883218833188341883518836188371883818839188401884118842188431884418845188461884718848188491885018851188521885318854188551885618857188581885918860188611886218863188641886518866188671886818869188701887118872188731887418875188761887718878188791888018881188821888318884188851888618887188881888918890188911889218893188941889518896188971889818899189001890118902189031890418905189061890718908189091891018911189121891318914189151891618917189181891918920189211892218923189241892518926189271892818929189301893118932189331893418935189361893718938189391894018941189421894318944189451894618947189481894918950189511895218953189541895518956189571895818959189601896118962189631896418965189661896718968189691897018971189721897318974189751897618977189781897918980189811898218983189841898518986189871898818989189901899118992189931899418995189961899718998189991900019001190021900319004190051900619007190081900919010190111901219013190141901519016190171901819019190201902119022190231902419025190261902719028190291903019031190321903319034190351903619037190381903919040190411904219043190441904519046190471904819049190501905119052190531905419055190561905719058190591906019061190621906319064190651906619067190681906919070190711907219073190741907519076190771907819079190801908119082190831908419085190861908719088190891909019091190921909319094190951909619097190981909919100191011910219103191041910519106191071910819109191101911119112191131911419115191161911719118191191912019121191221912319124191251912619127191281912919130191311913219133191341913519136191371913819139191401914119142191431914419145191461914719148191491915019151191521915319154191551915619157191581915919160191611916219163191641916519166191671916819169191701917119172191731917419175191761917719178191791918019181191821918319184191851918619187191881918919190191911919219193191941919519196191971919819199192001920119202192031920419205192061920719208192091921019211192121921319214192151921619217192181921919220192211922219223192241922519226192271922819229192301923119232192331923419235192361923719238192391924019241192421924319244192451924619247192481924919250192511925219253192541925519256192571925819259192601926119262192631926419265192661926719268192691927019271192721927319274192751927619277192781927919280192811928219283192841928519286192871928819289192901929119292192931929419295192961929719298192991930019301193021930319304193051930619307193081930919310193111931219313193141931519316193171931819319193201932119322193231932419325193261932719328193291933019331193321933319334193351933619337193381933919340193411934219343193441934519346193471934819349193501935119352193531935419355193561935719358193591936019361193621936319364193651936619367193681936919370193711937219373193741937519376193771937819379193801938119382193831938419385193861938719388193891939019391193921939319394193951939619397193981939919400194011940219403194041940519406194071940819409194101941119412194131941419415194161941719418194191942019421194221942319424194251942619427194281942919430194311943219433194341943519436194371943819439194401944119442194431944419445194461944719448194491945019451194521945319454194551945619457194581945919460194611946219463194641946519466194671946819469194701947119472194731947419475194761947719478194791948019481194821948319484194851948619487194881948919490194911949219493194941949519496194971949819499195001950119502195031950419505195061950719508195091951019511195121951319514195151951619517195181951919520195211952219523195241952519526195271952819529195301953119532195331953419535195361953719538195391954019541195421954319544195451954619547195481954919550195511955219553195541955519556195571955819559195601956119562195631956419565195661956719568195691957019571195721957319574195751957619577195781957919580195811958219583195841958519586195871958819589195901959119592195931959419595195961959719598195991960019601196021960319604196051960619607196081960919610196111961219613196141961519616196171961819619196201962119622196231962419625196261962719628196291963019631196321963319634196351963619637196381963919640196411964219643196441964519646196471964819649196501965119652196531965419655196561965719658196591966019661196621966319664196651966619667196681966919670196711967219673196741967519676196771967819679196801968119682196831968419685196861968719688196891969019691196921969319694196951969619697196981969919700197011970219703197041970519706197071970819709197101971119712197131971419715197161971719718197191972019721197221972319724197251972619727197281972919730197311973219733197341973519736197371973819739197401974119742197431974419745197461974719748197491975019751197521975319754197551975619757197581975919760197611976219763197641976519766197671976819769197701977119772197731977419775197761977719778197791978019781197821978319784197851978619787197881978919790197911979219793197941979519796197971979819799198001980119802198031980419805198061980719808198091981019811198121981319814198151981619817198181981919820198211982219823198241982519826198271982819829198301983119832198331983419835198361983719838198391984019841198421984319844198451984619847198481984919850198511985219853198541985519856198571985819859198601986119862198631986419865198661986719868198691987019871198721987319874198751987619877198781987919880198811988219883198841988519886198871988819889198901989119892198931989419895198961989719898198991990019901199021990319904199051990619907199081990919910199111991219913199141991519916199171991819919199201992119922199231992419925199261992719928199291993019931199321993319934199351993619937199381993919940199411994219943199441994519946199471994819949199501995119952199531995419955199561995719958199591996019961199621996319964199651996619967199681996919970199711997219973199741997519976199771997819979199801998119982199831998419985199861998719988199891999019991199921999319994199951999619997199981999920000200012000220003200042000520006200072000820009200102001120012200132001420015200162001720018200192002020021200222002320024200252002620027200282002920030200312003220033200342003520036200372003820039200402004120042200432004420045200462004720048200492005020051200522005320054200552005620057200582005920060200612006220063200642006520066200672006820069200702007120072200732007420075200762007720078200792008020081200822008320084200852008620087200882008920090200912009220093200942009520096200972009820099201002010120102201032010420105201062010720108201092011020111201122011320114201152011620117201182011920120201212012220123201242012520126201272012820129201302013120132201332013420135201362013720138201392014020141201422014320144201452014620147201482014920150201512015220153201542015520156201572015820159201602016120162201632016420165201662016720168201692017020171201722017320174201752017620177201782017920180201812018220183201842018520186201872018820189201902019120192201932019420195201962019720198201992020020201202022020320204202052020620207202082020920210202112021220213202142021520216202172021820219202202022120222202232022420225202262022720228202292023020231202322023320234202352023620237202382023920240202412024220243202442024520246202472024820249202502025120252202532025420255202562025720258202592026020261202622026320264202652026620267202682026920270202712027220273202742027520276202772027820279202802028120282202832028420285202862028720288202892029020291202922029320294202952029620297202982029920300203012030220303203042030520306203072030820309203102031120312203132031420315203162031720318203192032020321203222032320324203252032620327203282032920330203312033220333203342033520336203372033820339203402034120342203432034420345203462034720348203492035020351203522035320354203552035620357203582035920360203612036220363203642036520366203672036820369203702037120372203732037420375203762037720378203792038020381203822038320384203852038620387203882038920390203912039220393203942039520396203972039820399204002040120402204032040420405204062040720408204092041020411204122041320414204152041620417204182041920420204212042220423204242042520426204272042820429204302043120432204332043420435204362043720438204392044020441204422044320444204452044620447204482044920450204512045220453204542045520456204572045820459204602046120462204632046420465204662046720468204692047020471204722047320474204752047620477204782047920480204812048220483204842048520486204872048820489204902049120492204932049420495204962049720498204992050020501205022050320504205052050620507205082050920510205112051220513205142051520516205172051820519205202052120522205232052420525205262052720528205292053020531205322053320534205352053620537205382053920540205412054220543205442054520546205472054820549205502055120552205532055420555205562055720558205592056020561205622056320564205652056620567205682056920570205712057220573205742057520576205772057820579205802058120582205832058420585205862058720588205892059020591205922059320594205952059620597205982059920600206012060220603206042060520606206072060820609206102061120612206132061420615206162061720618206192062020621206222062320624206252062620627206282062920630206312063220633206342063520636206372063820639206402064120642206432064420645206462064720648206492065020651206522065320654206552065620657206582065920660206612066220663206642066520666206672066820669206702067120672206732067420675206762067720678206792068020681206822068320684206852068620687206882068920690206912069220693206942069520696206972069820699207002070120702207032070420705207062070720708207092071020711207122071320714207152071620717207182071920720207212072220723207242072520726207272072820729207302073120732207332073420735207362073720738207392074020741207422074320744207452074620747207482074920750207512075220753207542075520756207572075820759207602076120762207632076420765207662076720768207692077020771207722077320774207752077620777207782077920780207812078220783207842078520786207872078820789207902079120792207932079420795207962079720798207992080020801208022080320804208052080620807208082080920810208112081220813208142081520816208172081820819208202082120822208232082420825208262082720828208292083020831208322083320834208352083620837208382083920840208412084220843208442084520846208472084820849208502085120852208532085420855208562085720858208592086020861208622086320864208652086620867208682086920870208712087220873208742087520876208772087820879208802088120882208832088420885208862088720888208892089020891208922089320894208952089620897208982089920900209012090220903209042090520906209072090820909209102091120912209132091420915209162091720918209192092020921209222092320924209252092620927209282092920930209312093220933209342093520936209372093820939209402094120942209432094420945209462094720948209492095020951209522095320954209552095620957209582095920960209612096220963209642096520966209672096820969209702097120972209732097420975209762097720978209792098020981209822098320984209852098620987209882098920990209912099220993209942099520996209972099820999210002100121002210032100421005210062100721008210092101021011210122101321014210152101621017210182101921020210212102221023210242102521026210272102821029210302103121032210332103421035210362103721038210392104021041210422104321044210452104621047210482104921050210512105221053210542105521056210572105821059210602106121062210632106421065210662106721068210692107021071210722107321074210752107621077210782107921080210812108221083210842108521086210872108821089210902109121092210932109421095210962109721098210992110021101211022110321104211052110621107211082110921110211112111221113211142111521116211172111821119211202112121122211232112421125211262112721128211292113021131211322113321134211352113621137211382113921140211412114221143211442114521146211472114821149211502115121152211532115421155211562115721158211592116021161211622116321164211652116621167211682116921170211712117221173211742117521176211772117821179211802118121182211832118421185211862118721188211892119021191211922119321194211952119621197211982119921200212012120221203212042120521206212072120821209212102121121212212132121421215212162121721218212192122021221212222122321224212252122621227212282122921230212312123221233212342123521236212372123821239212402124121242212432124421245212462124721248212492125021251212522125321254212552125621257212582125921260212612126221263212642126521266212672126821269212702127121272212732127421275212762127721278212792128021281212822128321284212852128621287212882128921290212912129221293212942129521296212972129821299213002130121302213032130421305213062130721308213092131021311213122131321314213152131621317213182131921320213212132221323213242132521326213272132821329213302133121332213332133421335213362133721338213392134021341213422134321344213452134621347213482134921350213512135221353213542135521356213572135821359213602136121362213632136421365213662136721368213692137021371213722137321374213752137621377213782137921380213812138221383213842138521386213872138821389213902139121392213932139421395213962139721398213992140021401214022140321404214052140621407214082140921410214112141221413214142141521416214172141821419214202142121422214232142421425214262142721428214292143021431214322143321434214352143621437214382143921440214412144221443214442144521446214472144821449214502145121452214532145421455214562145721458214592146021461214622146321464214652146621467214682146921470214712147221473214742147521476214772147821479214802148121482214832148421485214862148721488214892149021491214922149321494214952149621497214982149921500215012150221503215042150521506215072150821509215102151121512215132151421515215162151721518215192152021521215222152321524215252152621527215282152921530215312153221533215342153521536215372153821539215402154121542215432154421545215462154721548215492155021551215522155321554215552155621557215582155921560215612156221563215642156521566215672156821569215702157121572215732157421575215762157721578215792158021581215822158321584215852158621587215882158921590215912159221593215942159521596215972159821599216002160121602216032160421605216062160721608216092161021611216122161321614216152161621617216182161921620216212162221623216242162521626216272162821629216302163121632216332163421635216362163721638216392164021641216422164321644216452164621647216482164921650216512165221653216542165521656216572165821659216602166121662216632166421665216662166721668216692167021671216722167321674216752167621677216782167921680216812168221683216842168521686216872168821689216902169121692216932169421695216962169721698216992170021701217022170321704217052170621707217082170921710217112171221713217142171521716217172171821719217202172121722217232172421725217262172721728217292173021731217322173321734217352173621737217382173921740217412174221743217442174521746217472174821749217502175121752217532175421755217562175721758217592176021761217622176321764217652176621767217682176921770217712177221773217742177521776217772177821779217802178121782217832178421785217862178721788217892179021791217922179321794217952179621797217982179921800218012180221803218042180521806218072180821809218102181121812218132181421815218162181721818218192182021821218222182321824218252182621827218282182921830218312183221833218342183521836218372183821839218402184121842218432184421845218462184721848218492185021851218522185321854218552185621857218582185921860218612186221863218642186521866218672186821869218702187121872218732187421875218762187721878218792188021881218822188321884218852188621887218882188921890218912189221893218942189521896218972189821899219002190121902219032190421905219062190721908219092191021911219122191321914219152191621917219182191921920219212192221923219242192521926219272192821929219302193121932219332193421935219362193721938219392194021941219422194321944219452194621947219482194921950219512195221953219542195521956219572195821959219602196121962219632196421965219662196721968219692197021971219722197321974219752197621977219782197921980219812198221983219842198521986219872198821989219902199121992219932199421995219962199721998219992200022001220022200322004220052200622007220082200922010220112201222013220142201522016220172201822019220202202122022220232202422025220262202722028220292203022031220322203322034220352203622037220382203922040220412204222043220442204522046220472204822049220502205122052220532205422055220562205722058220592206022061220622206322064220652206622067220682206922070220712207222073220742207522076220772207822079220802208122082220832208422085220862208722088220892209022091220922209322094220952209622097220982209922100221012210222103221042210522106221072210822109221102211122112221132211422115221162211722118221192212022121221222212322124221252212622127221282212922130221312213222133221342213522136221372213822139221402214122142221432214422145221462214722148221492215022151221522215322154221552215622157221582215922160221612216222163221642216522166221672216822169221702217122172221732217422175221762217722178221792218022181221822218322184221852218622187221882218922190221912219222193221942219522196221972219822199222002220122202222032220422205222062220722208222092221022211222122221322214222152221622217222182221922220222212222222223222242222522226222272222822229222302223122232222332223422235222362223722238222392224022241222422224322244222452224622247222482224922250222512225222253222542225522256222572225822259222602226122262222632226422265222662226722268222692227022271222722227322274222752227622277222782227922280222812228222283222842228522286222872228822289222902229122292222932229422295222962229722298222992230022301223022230322304223052230622307223082230922310223112231222313223142231522316223172231822319223202232122322223232232422325223262232722328223292233022331223322233322334223352233622337223382233922340223412234222343223442234522346223472234822349223502235122352223532235422355223562235722358223592236022361223622236322364223652236622367223682236922370223712237222373223742237522376223772237822379223802238122382223832238422385223862238722388223892239022391223922239322394223952239622397223982239922400224012240222403224042240522406224072240822409224102241122412224132241422415224162241722418224192242022421224222242322424224252242622427224282242922430224312243222433224342243522436224372243822439224402244122442224432244422445224462244722448224492245022451224522245322454224552245622457224582245922460224612246222463224642246522466224672246822469224702247122472224732247422475224762247722478224792248022481224822248322484224852248622487224882248922490224912249222493224942249522496224972249822499225002250122502225032250422505225062250722508225092251022511225122251322514225152251622517225182251922520225212252222523225242252522526225272252822529225302253122532225332253422535225362253722538225392254022541225422254322544225452254622547225482254922550225512255222553225542255522556225572255822559225602256122562225632256422565225662256722568225692257022571225722257322574225752257622577225782257922580225812258222583225842258522586225872258822589225902259122592225932259422595225962259722598225992260022601226022260322604226052260622607226082260922610226112261222613226142261522616226172261822619226202262122622226232262422625226262262722628226292263022631226322263322634226352263622637226382263922640226412264222643226442264522646226472264822649226502265122652226532265422655226562265722658226592266022661226622266322664226652266622667226682266922670226712267222673226742267522676226772267822679226802268122682226832268422685226862268722688226892269022691226922269322694226952269622697226982269922700227012270222703227042270522706227072270822709227102271122712227132271422715227162271722718227192272022721227222272322724227252272622727227282272922730227312273222733227342273522736227372273822739227402274122742227432274422745227462274722748227492275022751227522275322754227552275622757227582275922760227612276222763227642276522766227672276822769227702277122772227732277422775227762277722778227792278022781227822278322784227852278622787227882278922790227912279222793227942279522796227972279822799228002280122802228032280422805228062280722808228092281022811228122281322814228152281622817228182281922820228212282222823228242282522826228272282822829228302283122832228332283422835228362283722838228392284022841228422284322844228452284622847228482284922850228512285222853228542285522856228572285822859228602286122862228632286422865228662286722868228692287022871228722287322874228752287622877228782287922880228812288222883228842288522886228872288822889228902289122892228932289422895228962289722898228992290022901229022290322904229052290622907229082290922910229112291222913229142291522916229172291822919229202292122922229232292422925229262292722928229292293022931229322293322934229352293622937229382293922940229412294222943229442294522946229472294822949229502295122952229532295422955229562295722958229592296022961229622296322964229652296622967229682296922970229712297222973229742297522976229772297822979229802298122982229832298422985229862298722988229892299022991229922299322994229952299622997229982299923000230012300223003230042300523006230072300823009230102301123012230132301423015230162301723018230192302023021230222302323024230252302623027230282302923030230312303223033230342303523036230372303823039230402304123042230432304423045230462304723048230492305023051230522305323054230552305623057230582305923060230612306223063230642306523066230672306823069230702307123072230732307423075230762307723078230792308023081230822308323084230852308623087230882308923090230912309223093230942309523096230972309823099231002310123102231032310423105231062310723108231092311023111231122311323114231152311623117231182311923120231212312223123231242312523126231272312823129231302313123132231332313423135231362313723138231392314023141231422314323144231452314623147231482314923150231512315223153231542315523156231572315823159231602316123162231632316423165231662316723168231692317023171231722317323174231752317623177231782317923180231812318223183231842318523186231872318823189231902319123192231932319423195231962319723198231992320023201232022320323204232052320623207232082320923210232112321223213232142321523216232172321823219232202322123222232232322423225232262322723228232292323023231232322323323234232352323623237232382323923240232412324223243232442324523246232472324823249232502325123252232532325423255232562325723258232592326023261232622326323264232652326623267232682326923270232712327223273232742327523276232772327823279232802328123282232832328423285232862328723288232892329023291232922329323294232952329623297232982329923300233012330223303233042330523306233072330823309233102331123312233132331423315233162331723318233192332023321233222332323324233252332623327233282332923330233312333223333233342333523336233372333823339233402334123342233432334423345233462334723348233492335023351233522335323354233552335623357233582335923360233612336223363233642336523366233672336823369233702337123372233732337423375233762337723378233792338023381233822338323384233852338623387233882338923390233912339223393233942339523396233972339823399234002340123402234032340423405234062340723408234092341023411234122341323414234152341623417234182341923420234212342223423234242342523426234272342823429234302343123432234332343423435234362343723438234392344023441234422344323444234452344623447234482344923450234512345223453234542345523456234572345823459234602346123462234632346423465234662346723468234692347023471234722347323474234752347623477234782347923480234812348223483234842348523486234872348823489234902349123492234932349423495234962349723498234992350023501235022350323504235052350623507235082350923510235112351223513235142351523516235172351823519235202352123522235232352423525235262352723528235292353023531235322353323534235352353623537235382353923540235412354223543235442354523546235472354823549235502355123552235532355423555235562355723558235592356023561235622356323564235652356623567235682356923570235712357223573235742357523576235772357823579235802358123582235832358423585235862358723588235892359023591235922359323594235952359623597235982359923600236012360223603236042360523606236072360823609236102361123612236132361423615236162361723618236192362023621236222362323624236252362623627236282362923630236312363223633236342363523636236372363823639236402364123642236432364423645236462364723648236492365023651236522365323654236552365623657236582365923660236612366223663236642366523666236672366823669236702367123672236732367423675236762367723678236792368023681236822368323684236852368623687236882368923690236912369223693236942369523696236972369823699237002370123702237032370423705237062370723708237092371023711237122371323714237152371623717237182371923720237212372223723237242372523726237272372823729237302373123732237332373423735237362373723738237392374023741237422374323744237452374623747237482374923750237512375223753237542375523756237572375823759237602376123762237632376423765237662376723768237692377023771237722377323774237752377623777237782377923780237812378223783237842378523786237872378823789237902379123792237932379423795237962379723798237992380023801238022380323804238052380623807238082380923810238112381223813238142381523816238172381823819238202382123822238232382423825238262382723828238292383023831238322383323834238352383623837238382383923840238412384223843238442384523846238472384823849238502385123852238532385423855238562385723858238592386023861238622386323864238652386623867238682386923870238712387223873238742387523876238772387823879238802388123882238832388423885238862388723888238892389023891238922389323894238952389623897238982389923900239012390223903239042390523906239072390823909239102391123912239132391423915239162391723918239192392023921239222392323924239252392623927239282392923930239312393223933239342393523936239372393823939239402394123942239432394423945239462394723948239492395023951239522395323954239552395623957239582395923960239612396223963239642396523966239672396823969239702397123972239732397423975239762397723978239792398023981239822398323984239852398623987239882398923990239912399223993239942399523996239972399823999240002400124002240032400424005240062400724008240092401024011240122401324014240152401624017240182401924020240212402224023240242402524026240272402824029240302403124032240332403424035240362403724038240392404024041240422404324044240452404624047240482404924050240512405224053240542405524056240572405824059240602406124062240632406424065240662406724068240692407024071240722407324074240752407624077240782407924080240812408224083240842408524086240872408824089240902409124092240932409424095240962409724098240992410024101241022410324104241052410624107241082410924110241112411224113241142411524116241172411824119241202412124122241232412424125241262412724128241292413024131241322413324134241352413624137241382413924140241412414224143241442414524146241472414824149241502415124152241532415424155241562415724158241592416024161241622416324164241652416624167241682416924170241712417224173241742417524176241772417824179241802418124182241832418424185241862418724188241892419024191241922419324194241952419624197241982419924200242012420224203242042420524206242072420824209242102421124212242132421424215242162421724218242192422024221242222422324224242252422624227242282422924230242312423224233242342423524236242372423824239242402424124242242432424424245242462424724248242492425024251242522425324254242552425624257242582425924260242612426224263242642426524266242672426824269242702427124272242732427424275242762427724278242792428024281242822428324284242852428624287242882428924290242912429224293242942429524296242972429824299243002430124302243032430424305243062430724308243092431024311243122431324314243152431624317243182431924320243212432224323243242432524326243272432824329243302433124332243332433424335243362433724338243392434024341243422434324344243452434624347243482434924350243512435224353243542435524356243572435824359243602436124362243632436424365243662436724368243692437024371243722437324374243752437624377243782437924380243812438224383243842438524386243872438824389243902439124392243932439424395243962439724398243992440024401244022440324404244052440624407244082440924410244112441224413244142441524416244172441824419244202442124422244232442424425244262442724428244292443024431244322443324434244352443624437244382443924440244412444224443244442444524446244472444824449244502445124452244532445424455244562445724458244592446024461244622446324464244652446624467244682446924470244712447224473244742447524476244772447824479244802448124482244832448424485244862448724488244892449024491244922449324494244952449624497244982449924500245012450224503245042450524506245072450824509245102451124512245132451424515245162451724518245192452024521245222452324524245252452624527245282452924530245312453224533245342453524536245372453824539245402454124542245432454424545245462454724548245492455024551245522455324554245552455624557245582455924560245612456224563245642456524566245672456824569245702457124572245732457424575245762457724578245792458024581245822458324584245852458624587245882458924590245912459224593245942459524596245972459824599246002460124602246032460424605246062460724608246092461024611246122461324614246152461624617246182461924620246212462224623246242462524626246272462824629246302463124632246332463424635246362463724638246392464024641246422464324644246452464624647246482464924650246512465224653246542465524656246572465824659246602466124662246632466424665246662466724668246692467024671246722467324674246752467624677246782467924680246812468224683246842468524686246872468824689246902469124692246932469424695246962469724698246992470024701247022470324704247052470624707247082470924710247112471224713247142471524716247172471824719247202472124722247232472424725247262472724728247292473024731247322473324734247352473624737247382473924740247412474224743247442474524746247472474824749247502475124752247532475424755247562475724758247592476024761247622476324764247652476624767247682476924770247712477224773247742477524776247772477824779247802478124782247832478424785247862478724788247892479024791247922479324794247952479624797247982479924800248012480224803248042480524806248072480824809248102481124812248132481424815248162481724818248192482024821248222482324824248252482624827248282482924830248312483224833248342483524836248372483824839248402484124842248432484424845248462484724848248492485024851248522485324854248552485624857248582485924860248612486224863248642486524866248672486824869248702487124872248732487424875248762487724878248792488024881248822488324884248852488624887248882488924890248912489224893248942489524896248972489824899249002490124902249032490424905249062490724908249092491024911249122491324914249152491624917249182491924920249212492224923249242492524926249272492824929249302493124932249332493424935249362493724938249392494024941249422494324944249452494624947249482494924950249512495224953249542495524956249572495824959249602496124962249632496424965249662496724968249692497024971249722497324974249752497624977249782497924980249812498224983249842498524986249872498824989249902499124992249932499424995249962499724998249992500025001250022500325004250052500625007250082500925010250112501225013250142501525016250172501825019250202502125022250232502425025250262502725028250292503025031250322503325034250352503625037250382503925040250412504225043250442504525046250472504825049250502505125052250532505425055250562505725058250592506025061250622506325064250652506625067250682506925070250712507225073250742507525076250772507825079250802508125082250832508425085250862508725088250892509025091250922509325094250952509625097250982509925100251012510225103251042510525106251072510825109251102511125112251132511425115251162511725118251192512025121251222512325124251252512625127251282512925130251312513225133251342513525136251372513825139251402514125142251432514425145251462514725148251492515025151251522515325154251552515625157251582515925160251612516225163251642516525166251672516825169251702517125172251732517425175251762517725178251792518025181251822518325184251852518625187251882518925190251912519225193251942519525196251972519825199252002520125202252032520425205252062520725208252092521025211252122521325214252152521625217252182521925220252212522225223252242522525226252272522825229252302523125232252332523425235252362523725238252392524025241252422524325244252452524625247252482524925250252512525225253252542525525256252572525825259252602526125262252632526425265252662526725268252692527025271252722527325274252752527625277252782527925280252812528225283252842528525286252872528825289252902529125292252932529425295252962529725298252992530025301253022530325304253052530625307253082530925310253112531225313253142531525316253172531825319253202532125322253232532425325253262532725328253292533025331253322533325334253352533625337253382533925340253412534225343253442534525346253472534825349253502535125352253532535425355253562535725358253592536025361253622536325364253652536625367253682536925370253712537225373253742537525376253772537825379253802538125382253832538425385253862538725388253892539025391253922539325394253952539625397253982539925400254012540225403254042540525406254072540825409254102541125412254132541425415254162541725418254192542025421254222542325424254252542625427254282542925430254312543225433254342543525436254372543825439254402544125442254432544425445254462544725448254492545025451254522545325454254552545625457254582545925460254612546225463254642546525466254672546825469254702547125472254732547425475254762547725478254792548025481254822548325484254852548625487254882548925490254912549225493254942549525496254972549825499255002550125502255032550425505255062550725508255092551025511255122551325514255152551625517255182551925520255212552225523255242552525526255272552825529255302553125532255332553425535255362553725538255392554025541255422554325544255452554625547255482554925550255512555225553255542555525556255572555825559255602556125562255632556425565255662556725568255692557025571255722557325574255752557625577255782557925580255812558225583255842558525586255872558825589255902559125592255932559425595255962559725598255992560025601256022560325604256052560625607256082560925610256112561225613256142561525616256172561825619256202562125622256232562425625256262562725628256292563025631256322563325634256352563625637256382563925640256412564225643256442564525646256472564825649256502565125652256532565425655256562565725658256592566025661256622566325664256652566625667256682566925670256712567225673256742567525676256772567825679256802568125682256832568425685256862568725688256892569025691256922569325694256952569625697256982569925700257012570225703257042570525706257072570825709257102571125712257132571425715257162571725718257192572025721257222572325724257252572625727257282572925730257312573225733257342573525736257372573825739257402574125742257432574425745257462574725748257492575025751257522575325754257552575625757257582575925760257612576225763257642576525766257672576825769257702577125772257732577425775257762577725778257792578025781257822578325784257852578625787257882578925790257912579225793257942579525796257972579825799258002580125802258032580425805258062580725808258092581025811258122581325814258152581625817258182581925820258212582225823258242582525826258272582825829258302583125832258332583425835258362583725838258392584025841258422584325844258452584625847258482584925850258512585225853258542585525856258572585825859258602586125862258632586425865258662586725868258692587025871258722587325874258752587625877258782587925880258812588225883258842588525886258872588825889258902589125892258932589425895258962589725898258992590025901259022590325904259052590625907259082590925910259112591225913259142591525916259172591825919259202592125922259232592425925259262592725928259292593025931259322593325934259352593625937259382593925940259412594225943259442594525946259472594825949259502595125952259532595425955259562595725958259592596025961259622596325964259652596625967259682596925970259712597225973259742597525976259772597825979259802598125982259832598425985259862598725988259892599025991259922599325994259952599625997259982599926000260012600226003260042600526006260072600826009260102601126012260132601426015260162601726018260192602026021260222602326024260252602626027260282602926030260312603226033260342603526036260372603826039260402604126042260432604426045260462604726048260492605026051260522605326054260552605626057260582605926060260612606226063260642606526066260672606826069260702607126072260732607426075260762607726078260792608026081260822608326084260852608626087260882608926090260912609226093260942609526096260972609826099261002610126102261032610426105261062610726108261092611026111261122611326114261152611626117261182611926120261212612226123261242612526126261272612826129261302613126132261332613426135261362613726138261392614026141261422614326144261452614626147261482614926150261512615226153261542615526156261572615826159261602616126162261632616426165261662616726168261692617026171261722617326174261752617626177261782617926180261812618226183261842618526186261872618826189261902619126192261932619426195261962619726198261992620026201262022620326204262052620626207262082620926210262112621226213262142621526216262172621826219262202622126222262232622426225262262622726228262292623026231262322623326234262352623626237262382623926240262412624226243262442624526246262472624826249262502625126252262532625426255262562625726258262592626026261262622626326264262652626626267262682626926270262712627226273262742627526276262772627826279262802628126282262832628426285262862628726288262892629026291262922629326294262952629626297262982629926300263012630226303263042630526306263072630826309263102631126312263132631426315263162631726318263192632026321263222632326324263252632626327263282632926330263312633226333263342633526336263372633826339263402634126342263432634426345263462634726348263492635026351263522635326354263552635626357263582635926360263612636226363263642636526366263672636826369263702637126372263732637426375263762637726378263792638026381263822638326384263852638626387263882638926390263912639226393263942639526396263972639826399264002640126402264032640426405264062640726408264092641026411264122641326414264152641626417264182641926420264212642226423264242642526426264272642826429264302643126432264332643426435264362643726438264392644026441264422644326444264452644626447264482644926450264512645226453264542645526456264572645826459264602646126462264632646426465264662646726468264692647026471264722647326474264752647626477264782647926480264812648226483264842648526486264872648826489264902649126492264932649426495264962649726498264992650026501265022650326504265052650626507265082650926510265112651226513265142651526516265172651826519265202652126522265232652426525265262652726528265292653026531265322653326534265352653626537265382653926540265412654226543265442654526546265472654826549265502655126552265532655426555265562655726558265592656026561265622656326564265652656626567265682656926570265712657226573265742657526576265772657826579265802658126582265832658426585265862658726588265892659026591265922659326594265952659626597265982659926600266012660226603266042660526606266072660826609266102661126612266132661426615266162661726618266192662026621266222662326624266252662626627266282662926630266312663226633266342663526636266372663826639266402664126642266432664426645266462664726648266492665026651266522665326654266552665626657266582665926660266612666226663266642666526666266672666826669266702667126672266732667426675266762667726678266792668026681266822668326684266852668626687266882668926690266912669226693266942669526696266972669826699267002670126702267032670426705267062670726708267092671026711267122671326714267152671626717267182671926720267212672226723267242672526726267272672826729267302673126732267332673426735267362673726738267392674026741267422674326744267452674626747267482674926750267512675226753267542675526756267572675826759267602676126762267632676426765267662676726768267692677026771267722677326774267752677626777267782677926780267812678226783267842678526786267872678826789267902679126792267932679426795267962679726798267992680026801268022680326804268052680626807268082680926810268112681226813268142681526816268172681826819268202682126822268232682426825268262682726828268292683026831268322683326834268352683626837268382683926840268412684226843268442684526846268472684826849268502685126852268532685426855268562685726858268592686026861268622686326864268652686626867268682686926870268712687226873268742687526876268772687826879268802688126882268832688426885268862688726888268892689026891268922689326894268952689626897268982689926900269012690226903269042690526906269072690826909269102691126912269132691426915269162691726918269192692026921269222692326924269252692626927269282692926930269312693226933269342693526936269372693826939269402694126942269432694426945269462694726948269492695026951269522695326954269552695626957269582695926960269612696226963269642696526966269672696826969269702697126972269732697426975269762697726978269792698026981269822698326984269852698626987269882698926990269912699226993269942699526996269972699826999270002700127002270032700427005270062700727008270092701027011270122701327014270152701627017270182701927020270212702227023270242702527026270272702827029270302703127032270332703427035270362703727038270392704027041270422704327044270452704627047270482704927050270512705227053270542705527056270572705827059270602706127062270632706427065270662706727068270692707027071270722707327074270752707627077270782707927080270812708227083270842708527086270872708827089270902709127092270932709427095270962709727098270992710027101271022710327104271052710627107271082710927110271112711227113271142711527116271172711827119271202712127122271232712427125271262712727128271292713027131271322713327134271352713627137271382713927140271412714227143271442714527146271472714827149271502715127152271532715427155271562715727158271592716027161271622716327164271652716627167271682716927170271712717227173271742717527176271772717827179271802718127182271832718427185271862718727188271892719027191271922719327194271952719627197271982719927200272012720227203272042720527206272072720827209272102721127212272132721427215272162721727218272192722027221272222722327224272252722627227272282722927230272312723227233272342723527236272372723827239272402724127242272432724427245272462724727248272492725027251272522725327254272552725627257272582725927260272612726227263272642726527266272672726827269272702727127272272732727427275272762727727278272792728027281272822728327284272852728627287272882728927290272912729227293272942729527296272972729827299273002730127302273032730427305273062730727308273092731027311273122731327314273152731627317273182731927320273212732227323273242732527326273272732827329273302733127332273332733427335273362733727338273392734027341273422734327344273452734627347273482734927350273512735227353273542735527356273572735827359273602736127362273632736427365273662736727368273692737027371273722737327374273752737627377273782737927380273812738227383273842738527386273872738827389273902739127392273932739427395273962739727398273992740027401274022740327404274052740627407274082740927410274112741227413274142741527416274172741827419274202742127422274232742427425274262742727428274292743027431274322743327434274352743627437274382743927440274412744227443274442744527446274472744827449274502745127452274532745427455274562745727458274592746027461274622746327464274652746627467274682746927470274712747227473 |
- /****** Object: StoredProcedure [dbo].[mblPaByExchangeSelect] Script Date: 2018/12/13 19:07:52 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- CREATE PROCEDURE [dbo].[mblPaByExchangeSelect]
- (
- @paMainId INT
- )
- AS
- BEGIN
- SELECT
- (SELECT COUNT(*) FROM ExJobApply WITH(NOLOCK) WHERE cvMainId IN(SELECT id FROM cvMain WITH(NOLOCK) WHERE paMainId = @paMainId)) AS JobApplyNumber,
- (SELECT COUNT(*) FROM paFavorate WITH(NOLOCK) WHERE paMainId = @paMainId) AS FavorateNumber,
- (SELECT COUNT(*) FROM caCvViewLog WITH(NOLOCK) WHERE cvMainId IN(SELECT id FROM cvMain WITH(NOLOCK) WHERE paMainId = @paMainId)) AS cvViewNumber
- END
- set ANSI_NULLS ON
- set QUOTED_IDENTIFIER ON
- GO
- /****** Object: StoredProcedure [dbo].[mblPaFavorateBatchDelete] Script Date: 2018/12/13 19:07:52 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- CREATE PROCEDURE [dbo].[mblPaFavorateBatchDelete]
- (
- @AllID VARCHAR(1000),
- @paMainID INT
- )
- AS
- BEGIN TRY
- --生成临时表
- DECLARE @t AS TABLE(ID INT)
- INSERT INTO @t
- SELECT * FROM dbo.fnSplit(@AllID, ',')
-
- DELETE FROM paFavorate WHERE JobID IN(SELECT ID FROM @t) AND paMainID=@paMainID
- END TRY
- BEGIN CATCH
- GOTO ERR
- END CATCH
- RETURN 1
- ERR:
- BEGIN
- RETURN 0
- END
- GO
- /****** Object: StoredProcedure [dbo].[mblPaFavorateSelect] Script Date: 2018/12/13 19:07:52 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- CREATE PROCEDURE [dbo].[mblPaFavorateSelect]
- (
- @WHERE VARCHAR(1000),
- @Order VARCHAR(100)
- )
- AS
- BEGIN
- BEGIN TRY
- SET @Where = dbo.SafeSql(@Where)
- SET @ORDER = dbo.SafeSql(@Order)
- IF LEN(@ORDER)=0
- SET @ORDER = 'a.ID DESC '
- DECLARE @SQL AS VARCHAR(2000)
- SET @SQL='SELECT a.ID,a.paMainID,a.JobID,a.AddDate,a.Remark,b.Name as JobName,b.IssueDate,
- b.IssueEND,b.dcRegionID,b.IsDelete, c.Name as cpName,c.ID as cpID,c.HasLicence,c.IsAgent,
- c.Membertype,d.FullName Region
- FROM paFavorate a WITH(NOLOCK) Inner Join Job b WITH(NOLOCK) ON a.JobID=b.ID
- Inner Join cpMain c WITH(NOLOCK) ON b.cpMainID=c.ID
- INNER JOIN dcRegion d ON d.ID=b.dcRegionID '
- IF LEN(@WHERE)>0
- SET @SQL=@SQL + ' WHERE '+ @WHERE
- IF LEN(@ORDER)>0
- SET @SQL=@SQL + ' ORDER BY '+@ORDER
- EXEC(@SQL)
- END TRY
- BEGIN CATCH
- END CATCH
- END
- GO
- /****** Object: StoredProcedure [dbo].[mblPaFeedBackInsert] Script Date: 2018/12/13 19:07:53 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- CREATE PROCEDURE [dbo].[mblPaFeedBackInsert]
- (
- @Content NVARCHAR(200),
- @Version VARCHAR(50),
- @paMainID INT,
- @Name VARCHAR(50),
- @Telephone VARCHAR(11),
- @Email VARCHAR(50)
- )
- AS
- BEGIN
- INSERT INTO mblFeedBack(Content,Version,paMainID,Name,Mobile,Email) VALUES(@Content,@Version,@paMainID,@Name,@Telephone,@Email)
- END
- GO
- /****** Object: StoredProcedure [dbo].[mblpaGetPasswordLogByPamainIDUpdate] Script Date: 2018/12/13 19:07:53 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- --#####################################################
- --创建时间:2014.11.6
- --创建人:Nick
- --说明:重置密码
- --#####################################################
- CREATE PROCEDURE [dbo].[mblpaGetPasswordLogByPamainIDUpdate]
- (
- @PaMainID INT
- )
- AS
- BEGIN
- UPDATE paGetPasswordLog SET IsReset=1
- WHERE AskNo=(
- SELECT TOP 1 AskNo
- FROM paGetPasswordLog WITH(NOLOCK)
- WHERE pamainID = @PaMainID
- ORDER BY ID DESC
- )
- END
- GO
- /****** Object: StoredProcedure [dbo].[mblpaIOSBindDelete] Script Date: 2018/12/13 19:07:53 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- CREATE PROCEDURE [dbo].[mblpaIOSBindDelete]
- (
- @paMainID INT,
- @UniqueID VARCHAR(100)
- )
- AS
- BEGIN
- DELETE FROM paIOSBind WHERE UniqueID = @UniqueID
- END
- GO
- /****** Object: StoredProcedure [dbo].[mblpaIOSBindInsert] Script Date: 2018/12/13 19:07:53 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- CREATE PROCEDURE [dbo].[mblpaIOSBindInsert]
- (
- @paMainID INT,
- @UniqueID VARCHAR(100),
- @ClientType TINYINT
- )
- AS
- BEGIN TRY
- IF LEN(ISNULL(@UniqueID,'')) = 0
- RETURN
- IF NOT EXISTS(SELECT 1 FROM paIOSBind WITH(NOLOCK) WHERE PaMainID = @paMainID AND UniqueID = @UniqueID AND ClientType = @ClientType)
- BEGIN
- INSERT INTO paIOSBind VALUES(@paMainID,@UniqueID,GETDATE(),@ClientType)
- RETURN 1
- END
- ELSE
- BEGIN
- RETURN 0
- END
- END TRY
- BEGIN CATCH
- RETURN 0
- END CATCH
- GO
- /****** Object: StoredProcedure [dbo].[mblpaLoginContactByIDSelect] Script Date: 2018/12/13 19:07:53 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- --#####################################################
- --创建时间:2014.11.6
- --创建人:Nick
- --说明:获取第三方登录的用户信息
- --#####################################################
- CREATE PROCEDURE [dbo].[mblpaLoginContactByIDSelect]
- (
- @Openid VARCHAR(100)
- )
- AS
- BEGIN
- SELECT TOP 1 b.ID,b.UserName,b.PassWord
- FROM paLoginContact a WITH(NOLOCK), paMain b WITH(NOLOCK)
- WHERE a.paMainID = b.ID
- AND a.OpenID = @Openid
- AND a.OpenID > ''
- ORDER BY a.AddDate DESC
- END
- GO
- /****** Object: StoredProcedure [dbo].[mblpaLoginContactByOpenIDSelect] Script Date: 2018/12/13 19:07:53 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- --#####################################################
- --创建时间:2014.11.06
- --创建人:Nick
- --说明:根据微信号得到微信绑定信息
- --#####################################################
- CREATE PROCEDURE [dbo].[mblpaLoginContactByOpenIDSelect]
- (
- @OpenID VARCHAR(50)
- )
- AS
- BEGIN TRY
- SELECT a.*,b.UserName
- FROM paLoginContact a,pamain b
- WHERE a.openid=@OpenID
- AND a.ContactType=4
- AND a.PamainID = b.ID
- END TRY
- BEGIN CATCH
- RETURN 0
- END CATCH
- GO
- /****** Object: StoredProcedure [dbo].[mblPaLoginContactDelete] Script Date: 2018/12/13 19:07:54 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- --#####################################################
- --创建时间:2014.11.4
- --创建人:Nick
- --说明:删除绑定信息
- --#####################################################
- CREATE PROCEDURE [dbo].[mblPaLoginContactDelete]
- (
- @OpenID VARCHAR(50)
- )
- AS
- BEGIN
- DECLARE @paMainId INT
- SELECT @paMainId = paMainId FROM PaLoginContact WHERE OpenID = @OpenID AND ContactType = 4
- DELETE FROM PaLoginContact WHERE OpenID = @OpenID AND ContactType = 4
- UPDATE paMain SET IsUseYourFood = 0 WHERE id = @paMainId AND isUseYourFood = 1
- END
- GO
- /****** Object: StoredProcedure [dbo].[mblPaMainByCvIDSelect] Script Date: 2018/12/13 19:07:54 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- --#####################################################
- --创建时间:2014.11.06
- --创建人:Nick
- --说明:获取个人用户信息
- --#####################################################
- CREATE PROCEDURE [dbo].[mblPaMainByCvIDSelect]
- (
- @cvMainID INT
- )
- AS
- BEGIN TRY
- SELECT a.mobile,a.Gender,a.id,dbo.GetPaOnlineStatus(a.id) IsOnline,name
- FROM pamain a
- WHERE id IN (
- SELECT pamainid
- FROM cvmain
- WHERE id=@cvMainID)
- END TRY
- BEGIN CATCH
- RETURN 0
- END CATCH
- GO
- /****** Object: StoredProcedure [dbo].[mblPaMainByIDSelect] Script Date: 2018/12/13 19:07:54 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- --#####################################################
- --创建时间:2014.11.6
- --创建人:Nick
- --说明:获取注册时间
- --#####################################################
- CREATE PROCEDURE [dbo].[mblPaMainByIDSelect]
- (
- @ID INT
- )
- AS
- BEGIN
- SELECT AddDate,name FROM paMain WITH(NOLOCK) WHERE ID=@ID
- END
- GO
- /****** Object: StoredProcedure [dbo].[mblPaMainRegisterModeUpdate] Script Date: 2018/12/13 19:07:54 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- --#####################################################
- --创建时间:2014.11.6
- --创建人:Nick
- --说明:修改mode
- --#####################################################
- CREATE PROCEDURE [dbo].[mblPaMainRegisterModeUpdate]
- (
- @RegisterMode INT,
- @ID INT
- )
- AS
- BEGIN
- UPDATE pamain SET RegisterMode=@RegisterMode WHERE id=@ID
- END
- GO
- /****** Object: StoredProcedure [dbo].[mblPaMainSelect] Script Date: 2018/12/13 19:07:54 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- CREATE PROCEDURE [dbo].[mblPaMainSelect]
- @ID INT
- AS
- BEGIN
- SELECT 1 dcCareerStatus,a.*, b.FullName LiveRegion, c.FullName GrowRegion, d.FullName AccountRegion, ISNULL(e.Description,'目前处于离职状态,可即刻上岗') CareerStatus, f.PhotoProcessed,
- (SELECT TOP 1 LoginIP FROM paLoginLog WITH(NOLOCK) WHERE paLoginLog.paMainID = a.ID ORDER BY ID DESC) AS LastLoginIP,
- (SELECT COUNT(1) FROM paLoginLog WITH(NOLOCK) WHERE paLoginLog.paMainID = a.ID AND AddDate > CONVERT(VARCHAR(10), GETDATE(), 120)) AS TodayLoginNum
- FROM paMain a WITH(NOLOCK INDEX(PK_paMain))
- LEFT JOIN dcRegion b WITH(NOLOCK) ON a.LivePlace=b.ID
- LEFT JOIN dcRegion c WITH(NOLOCK) ON a.GrowPlace=c.ID
- LEFT JOIN dcRegion d WITH(NOLOCK) ON a.AccountPlace=d.ID
- LEFT JOIN dcCareerStatus e WITH(NOLOCK) ON a.dcCareerStatus=e.ID
- LEFT JOIN paPhoto f WITH(NOLOCK) ON a.HasPhoto<2 AND a.ID=f.paMainID
- WHERE a.ID=@ID
- END
- GO
- /****** Object: StoredProcedure [dbo].[mblPaMainUpdate] Script Date: 2018/12/13 19:07:54 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- --修改harry 2018-7-5 处理liveplace等
- CREATE PROCEDURE [dbo].[mblPaMainUpdate]
- (
- @paMainID INT,
- @cvMainID INT,
- @Name VARCHAR(30),
- @Gender BIT,
- @BirthDay INT,
- @LivePlace VARCHAR(6),
- @AccountPlace VARCHAR(6),
- @GrowPlace VARCHAR(6),
- @Mobile VARCHAR(13),
- @dcCareerStatus TINYINT,
- @IP VARCHAR(39)
- )
- AS
- IF ISNULL(@paMainID, 0) = 0
- RETURN -1
- IF dbo.TrimNULL(@Name) IS NULL
- RETURN -1
- IF dbo.TrimNULL(@Mobile) IS NULL
- RETURN -1
- IF CHARINDEX(' ', @LivePlace) >2
- BEGIN
- SET @LivePlace=substring(@LivePlace,1,charindex(' ',@LivePlace)-1)
- END
- IF CHARINDEX(' ', @AccountPlace) >2
- BEGIN
- SET @AccountPlace=substring(@AccountPlace,1,charindex(' ',@AccountPlace)-1)
- END
- IF CHARINDEX(' ', @GrowPlace) >2
- BEGIN
- SET @GrowPlace=substring(@GrowPlace,1,charindex(' ',@GrowPlace)-1)
- END
- IF EXISTS(SELECT 'x' FROM Person_BLACK WITH(NOLOCK) WHERE Mobile = @Mobile)
- BEGIN
- ----有黑名单,则增加拒绝次数
- UPDATE Person_Black SET RefuseCount = RefuseCount + 1 WHERE Mobile = @Mobile
- RETURN -1
- END
- BEGIN TRAN
- BEGIN TRY
- DECLARE @NameOld AS VARCHAR(12)
- DECLARE @MobileOld AS VARCHAR(13)
- DECLARE @Modify AS INT
- -- @Modify=-1未修改需审核项, @Modify=0修改中文项目; @Modify=1修改了英文项目
- SET @Modify=-1
- --获得原始数据
- SELECT @NameOld=Name,@MobileOld=Mobile
- FROM paMain WITH(NOLOCK INDEX(PK_paMain))
- WHERE ID = @paMainID
- DECLARE @CNAME AS VARCHAR(12)
- SET @CNAME = @Name
- IF @BirthDay!=0
- BEGIN
- UPDATE paMain
- SET Name=@CNAME,
- Gender=@Gender,
- BirthDay=@BirthDay,
- LivePlace=@LivePlace,
- AccountPlace=@AccountPlace,
- GrowPlace=@GrowPlace,
- Mobile=@Mobile,
- dcCareerStatus=@dcCareerStatus,
- LastModifyDate=GETDATE()
- WHERE ID=@paMainID
-
- END
-
- --保存到bsCvModify,姓名
- IF ISNULL(@NameOld, '') <> @CNAME
- BEGIN
- DELETE FROM bsCvModify WHERE paMainID = @paMainID AND Location = 'ac1'
- INSERT INTO bsCvModify(paMainID,Location,ColValue) VALUES(@paMainID,'ac1',@CNAME)
- SET @Modify=0
- INSERT INTO paOperationLog (paMainID, Operation, Details, IP)
- VALUES(@paMainID, 30,'更新姓名,原姓名:<' + ISNULL(@NameOld, '') + '>;新姓名:<' + @CName + '>', @IP)
- END
- --手机号码
- IF ISNULL(@MobileOld, '') <> @Mobile
- BEGIN
- DELETE FROM bsCvModify WHERE paMainID = @paMainID AND Location = 'ac4'
- --INSERT INTO bsCvModify(paMainID,Location,ColValue) VALUES(@paMainID,'ac4',@Mobile)
- --SET @Modify=0
- INSERT INTO paOperationLog (paMainID, Operation, Details, IP)
- VALUES(@paMainID, 35,'更新手机号,原手机号:<' + ISNULL(@MobileOld, '') + '>;新手机号:<' + @Mobile + '>', @IP)
- END
-
- ----修改cvMain.cvLevel
- UPDATE cvMain SET cvLevel='11' + RIGHT(cvLevel,8) WHERE paMainID = @paMainID
- --1小时内不重复刷新,防止刷新排名
- UPDATE cvmain SET RefreshDate = GETDATE() WHERE ID=@cvMainID AND DATEADD(HOUR, 1, RefreshDate) < GETDATE() AND paMainID = @paMainID
- ----12小时内只保留一次修改记录
- DELETE FROM paOperationLog WHERE paMainID=@paMainID AND Operation=11 AND AddDate>GETDATE()-0.5
- INSERT INTO paOperationLog (paMainID,Operation,Details,IP) VALUES(@paMainID,11,'更新基本信息成功。',@IP)
- END TRY
- BEGIN CATCH
- GOTO ERR
- END CATCH
- COMMIT TRAN
- RETURN 1
- ERR:
- BEGIN
- ROLLBACK TRAN
- RETURN 0
- END
- GO
- /****** Object: StoredProcedure [dbo].[mblPaMainUpdate20171110] Script Date: 2018/12/13 19:07:55 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- --修改harry 2018-7-5 处理liveplace等
- CREATE PROCEDURE [dbo].[mblPaMainUpdate20171110]
- (
- @paMainID INT,
- @cvMainID INT,
- @Name VARCHAR(30),
- @Gender BIT,
- @BirthDay INT,
- @LivePlace VARCHAR(6),
- @AccountPlace VARCHAR(6),
- @GrowPlace VARCHAR(6),
- @Mobile VARCHAR(13),
- @dcCareerStatus TINYINT,
- @IP VARCHAR(39),
- @dcMapPlaceID INT
- )
- AS
- IF ISNULL(@paMainID, 0) = 0
- RETURN -1
- IF dbo.TrimNULL(@Name) IS NULL
- RETURN -1
- IF dbo.TrimNULL(@Mobile) IS NULL
- RETURN -1
- IF EXISTS(SELECT 'x' FROM Person_BLACK WITH(NOLOCK) WHERE Mobile = @Mobile)
- BEGIN
- ----有黑名单,则增加拒绝次数
- UPDATE Person_Black SET RefuseCount = RefuseCount + 1 WHERE Mobile = @Mobile
- RETURN -1
- END
- BEGIN TRAN
- BEGIN TRY
-
- IF CHARINDEX(' ', @LivePlace) >2
- BEGIN
- SET @LivePlace=substring(@LivePlace,1,charindex(' ',@LivePlace)-1)
- END
- IF CHARINDEX(' ', @AccountPlace) >2
- BEGIN
- SET @AccountPlace=substring(@AccountPlace,1,charindex(' ',@AccountPlace)-1)
- END
- IF CHARINDEX(' ', @GrowPlace) >2
- BEGIN
- SET @GrowPlace=substring(@GrowPlace,1,charindex(' ',@GrowPlace)-1)
- END
-
-
- DECLARE @NameOld AS VARCHAR(12)
- DECLARE @MobileOld AS VARCHAR(13)
- DECLARE @Modify AS INT
- -- @Modify=-1未修改需审核项, @Modify=0修改中文项目; @Modify=1修改了英文项目
- SET @Modify=-1
- --获得原始数据
- SELECT @NameOld=Name,@MobileOld=Mobile
- FROM paMain WITH(NOLOCK INDEX(PK_paMain))
- WHERE ID = @paMainID
- DECLARE @CNAME AS VARCHAR(12)
- SET @CNAME = @Name
- UPDATE paMain
- SET Name=@CNAME,
- Gender=@Gender,
- BirthDay=@BirthDay,
- LivePlace=@LivePlace,
- AccountPlace=@AccountPlace,
- GrowPlace=@GrowPlace,
- Mobile=@Mobile,
- dcMapPlaceID=@dcMapPlaceID,
- --dcCareerStatus#@dcCareerStatus,
- LastModifyDate=GETDATE()
- WHERE ID=@paMainID
-
- --保存到bsCvModify,姓名
- IF ISNULL(@NameOld, '') <> @CNAME
- BEGIN
- DELETE FROM bsCvModify WHERE paMainID = @paMainID AND Location = 'ac1'
- INSERT INTO bsCvModify(paMainID,Location,ColValue) VALUES(@paMainID,'ac1',@CNAME)
- SET @Modify=0
- INSERT INTO paOperationLog (paMainID, Operation, Details, IP)
- VALUES(@paMainID, 30,'更新姓名,原姓名:<' + ISNULL(@NameOld, '') + '>;新姓名:<' + @CName + '>', @IP)
- END
- --手机号码
- IF ISNULL(@MobileOld, '') <> @Mobile
- BEGIN
- DELETE FROM bsCvModify WHERE paMainID = @paMainID AND Location = 'ac4'
- --INSERT INTO bsCvModify(paMainID,Location,ColValue) VALUES(@paMainID,'ac4',@Mobile)
- --SET @Modify=0
- INSERT INTO paOperationLog (paMainID, Operation, Details, IP)
- VALUES(@paMainID, 35,'更新手机号,原手机号:<' + ISNULL(@MobileOld, '') + '>;新手机号:<' + @Mobile + '>', @IP)
- END
-
- ----修改cvMain.cvLevel
- UPDATE cvMain SET cvLevel='11' + RIGHT(cvLevel,8) WHERE paMainID = @paMainID
- --1小时内不重复刷新,防止刷新排名
- UPDATE cvmain SET RefreshDate = GETDATE() WHERE ID=@cvMainID AND DATEADD(HOUR, 1, RefreshDate) < GETDATE() AND paMainID = @paMainID
- ----12小时内只保留一次修改记录
- DELETE FROM paOperationLog WHERE paMainID=@paMainID AND Operation=11 AND AddDate>GETDATE()-0.5
- INSERT INTO paOperationLog (paMainID,Operation,Details,IP) VALUES(@paMainID,11,'更新基本信息成功。',@IP)
- END TRY
- BEGIN CATCH
- GOTO ERR
- END CATCH
- COMMIT TRAN
- RETURN 1
- ERR:
- BEGIN
- ROLLBACK TRAN
- RETURN 0
- END
- GO
- /****** Object: StoredProcedure [dbo].[mblPaPageViewLogByNoViewSelect] Script Date: 2018/12/13 19:07:55 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- CREATE PROCEDURE [dbo].[mblPaPageViewLogByNoViewSelect]
- (
- @PaMainID INT,
- @PageType INT --页面类型1 页脚 2 Notice页面
- )
- AS
- SET NOCOUNT ON
- IF @paMainID = 0
- RETURN
- BEGIN
- IF NOT EXISTS(SELECT 'x' FROM paPageViewLog WITH(NOLOCK) WHERE paMainId = @PaMainID)
- BEGIN
- INSERT INTO paPageViewLog(paMainId,addDate,InterviewDate,IntentionDate,ViewLogDate,AttentionDate,YourFoodDate,ApplyReplyDate)
- VALUES(@PaMainID, GETDATE() - 10, GETDATE() - 10, GETDATE() - 10, GETDATE() - 10, GETDATE() - 10, GETDATE() - 10, GETDATE() - 10)
- --RETURN
- END
-
- DECLARE @AddDate DATETIME, @InterviewDate DATETIME, @IntentionDate DATETIME,
- @ViewLogDate DATETIME, @AttentionDate DATETIME, @YourFoodDate DATETIME,
- @ApplyReplyDate DATETIME, @ChangeCount INT, @CvViewLogCount INT,
- @YourFoodCount INT,@JobAppliedCount INT, @InterviewCount INT,
- @CpInvitationCount INT, @ChatCount INT
-
- SELECT @AddDate = AddDate, @InterviewDate = ISNULL(InterviewDate, GETDATE() - 10),
- @IntentionDate = ISNULL(IntentionDate, GETDATE() - 10),
- @ViewLogDate = ISNULL(ViewLogDate, GETDATE() - 10),
- @AttentionDate = ISNULL(AttentionDate, GETDATE() - 10),
- @YourFoodDate = ISNULL(YourFoodDate, GETDATE() - 10),
- @ApplyReplyDate = ISNULL(ApplyReplyDate, GETDATE() - 10),
- @ChangeCount = ISNULL(MyAttentionCount, 0),
- @CvViewLogCount = ISNULL(CvViewLogCount, 0),
- @YourFoodCount = ISNULL(YourFoodCount, 0),
- @JobAppliedCount = ISNULL(JobAppliedCount, 0),
- @InterviewCount = ISNULL(InterviewCount, 0),
- @CpInvitationCount = ISNULL(CpInvitationCount, 0),
- @ChatCount = ISNULL(ChatCount, 0)
- FROM paPageViewLog WITH(NOLOCK)
- WHERE paMainId = @PaMainID
-
- SELECT ID
- INTO #TCvIDs
- FROM cvMain WITH(NOLOCK)
- WHERE paMainID = @PaMainID
-
- --更新时间超过1个小时的,重新计算提醒内容
- IF GETDATE() > DATEADD(MINUTE, 60, @AddDate) --60分钟内的不重新生成
- BEGIN
- --我的关注
- SELECT AttentionID, AttentionType
- INTO #TAttention
- FROM PaAttention WITH(NOLOCK)
- WHERE PaMainID = @PaMainID
-
- --职位有更新数量
- SELECT @ChangeCount = COUNT(1)
- FROM Job WITH(NOLOCK)
- WHERE CpMainID IN (SELECT AttentionID
- FROM #TAttention WHERE AttentionType = 1)
- AND AddDate > @AttentionDate
-
- SELECT @ChangeCount = COUNT(1) + @ChangeCount
- FROM Job WITH(NOLOCK)
- WHERE ID IN (SELECT AttentionID
- FROM #TAttention WHERE AttentionType = 2)
- AND IssueEnd > @AttentionDate
- AND IssueEnd < GETDATE()
-
- --新环境照片数量
- SELECT @ChangeCount = COUNT(1) + @ChangeCount
- FROM cpImage WITH(NOLOCK)
- WHERE cpMainID IN (SELECT AttentionID FROM #TAttention WHERE AttentionType = 1)
- AND ImgType = 3
- AND CheckDate > @AttentionDate
- AND HasPassed = 1
- --删除临时表
- DROP TABLE #TAttention
-
-
- --更新简历浏览量
- SELECT @CvViewLogCount = COUNT(1)
- FROM caCvViewLog WITH(NOLOCK)
- WHERE cvMainID IN(SELECT ID FROM #TCvIDs)
- AND AddDate > @ViewLogDate
-
- --更新你的菜儿数量
- SELECT @YourFoodCount=COUNT(1)
- FROM PaJobCompare WITH(NOLOCK)
- WHERE PaMainID = @PaMainID
- AND AddDate > @YourFoodDate
-
- --申请的职位
- SELECT @JobAppliedCount=count(1)
- FROM exJobApply a WITH(NOLOCK)
- WHERE a.cvMainID IN(
- SELECT ID FROM #TCvIDs
- )
- AND a.ReplyDate > @ApplyReplyDate
-
- --面试通知
- SELECT @InterviewCount=COUNT(1)
- FROM exInterview a WITH(NOLOCK)
- WHERE a.cvMainID IN(
- SELECT ID FROM #TCvIDs
- )
- AND a.AddDate > @InterviewDate
- --应聘邀请
- SELECT @CpInvitationCount=COUNT(1)
- FROM caCvIntention a WITH(NOLOCK)
- WHERE a.cvMainID IN(
- SELECT ID FROM #TCvIDs
- )
- AND a.AddDate > @IntentionDate
- --聊天记录
- SELECT @ChatCount=COUNT(1)
- FROM ChatOnlineLog a WITH(NOLOCK)
- LEFT JOIN ChatOnline b WITH(NOLOCK) ON a.ChatOnlineID = b.ID
- WHERE b.cvMainID IN(
- SELECT ID FROM #TCvIDs
- )
- AND a.IsViewed = 0
- AND a.SenderType = 1
- --更新添加时间
- UPDATE paPageViewLog
- SET AddDate = GETDATE(),
- MyAttentionCount = @ChangeCount,
- CvViewLogCount = @CvViewLogCount,
- YourFoodCount = @YourFoodCount,
- JobAppliedCount =@JobAppliedCount,
- InterviewCount=@InterviewCount,
- CpInvitationCount=@CpInvitationCount,
- ChatCount = @ChatCount
- WHERE paMainId = @PaMainID
- END
- SELECT * FROM paPageViewLog WHERE paMainId = @PaMainID --查询表内容
-
- IF @PageType = 2 --通知页面-页脚不查询其他表内容
- BEGIN --通知页面
- --申请的职位
- IF @JobAppliedCount > 0
- SELECT TOP 1 a.Reply, a.ReplyDate, c.Name cpName
- FROM exJobApply a WITH(NOLOCK)
- LEFT JOIN Job b WITH(NOLOCK) ON b.ID = a.JobID
- LEFT JOIN CpMain c WITH(NOLOCK) ON c.ID = b.CpMainID
- WHERE a.cvMainID IN(
- SELECT ID FROM #TCvIDs
- )
- AND a.ReplyDate > @ApplyReplyDate
- ORDER BY a.ReplyDate DESC
- ELSE
- SELECT TOP 0 ''Reply,'' ReplyDate,'' cpName
-
- --面试通知
- IF @InterviewCount>0
- SELECT TOP 1 c.Name cpName, a.AddDate
- FROM exInterview a WITH(NOLOCK)
- LEFT JOIN Job b WITH(NOLOCK) ON b.ID = a.JobID
- LEFT JOIN CpMain c WITH(NOLOCK) ON c.ID = b.CpMainID
- WHERE a.cvMainID IN(
- SELECT ID FROM #TCvIDs
- )
- AND a.AddDate > @InterviewDate
- ORDER BY a.AddDate DESC
- ELSE
- SELECT TOP 0 '' cpName,'' AddDate
-
- --应聘邀请
- IF @CpInvitationCount > 0
- SELECT TOP 1 c.Name CpName, b.Name JobName, a.AddDate
- FROM caCvIntention a WITH(NOLOCK)
- LEFT JOIN Job b WITH(NOLOCK) ON b.ID = a.JobID
- LEFT JOIN CpMain c WITH(NOLOCK) ON c.ID = b.CpMainID
- WHERE a.cvMainID IN(
- SELECT ID FROM #TCvIDs
- )
- AND a.AddDate > @IntentionDate
- ORDER BY a.AddDate DESC
- ELSE
- SELECT TOP 0 '' CpName,'' JobName,'' AddDate
-
- --聊天记录
- IF @ChatCount > 0
- SELECT TOP 1 a.Message, a.AddDate, d.Name CpName
- FROM ChatOnlineLog a WITH(NOLOCK)
- LEFT JOIN ChatOnline b WITH(NOLOCK) ON a.ChatOnlineID = b.ID
- LEFT JOIN caMain c WITH(NOLOCK) ON c.ID = b.caMainID
- LEFT JOIN cpMain d WITH(NOLOCK) ON d.ID = c.cpMainID
- WHERE b.cvMainID IN(SELECT ID FROM #TCvIDs)
- AND a.IsViewed = 0
- AND a.SenderType = 1
- AND b.AddDate > GETDATE() - 7
- ORDER BY a.AddDate Desc
- ELSE
- SELECT TOP 0 '' [Message],'' AddDate,''CpName
-
- --谁在关注我
- IF @CvViewLogCount > 0
- SELECT TOP 1 c.Name CpName, a.AddDate
- FROM caCvViewLog a WITH(NOLOCK)
- INNER JOIN caMain b WITH(NOLOCK) ON a.caMainID = b.ID
- INNER JOIN cpMain c WITH(NOLOCK) ON b.cpMainID = c.ID
- WHERE a.cvMainID IN(SELECT ID FROM #TCvIDs)
- ORDER BY a.AddDate DESC
- ELSE
- SELECT TOP 0 '' AddDate,''CpName
- IF @ChangeCount > 0
- BEGIN
- SELECT AttentionID, AttentionType
- INTO #TAttention2
- FROM PaAttention WITH(NOLOCK)
- WHERE PaMainID = @PaMainID
- CREATE TABLE #TAttentionModify
- (
- ModifyDesc NVARCHAR(100),
- ModifyDate DATETIME
- )
- --企业新增职位了
- INSERT INTO #TAttentionModify(ModifyDesc,ModifyDate)
- SELECT TOP 1 '您关注的企业“' + b.Name + '”发布了新的职位' ModifyDesc,AddDate
- FROM Job a WITH(NOLOCK)
- LEFT JOIN CpMain b WITH(NOLOCK) ON b.ID = a.CpMainID
- WHERE CpMainID IN (SELECT AttentionID FROM #TAttention2 WHERE AttentionType = 1)
- ORDER BY AddDate DESC
-
- --职位截止
- INSERT INTO #TAttentionModify(ModifyDesc,ModifyDate)
- SELECT TOP 1 '您关注的职位“' + Name + '”已经过期' ModifyDesc,IssueEnd
- FROM Job WITH(NOLOCK)
- WHERE ID IN (SELECT AttentionID FROM #TAttention2 WHERE AttentionType = 2)
- AND IssueEnd < GETDATE()
- ORDER BY IssueEnd DESC
- INSERT INTO #TAttentionModify(ModifyDesc,ModifyDate)
- SELECT TOP 1 '您关注的企业“' + b.Name + '”上传了新的环境照片' ModifyDesc,CheckDate
- FROM cpImage a WITH(NOLOCK)
- LEFT JOIN CpMain b WITH(NOLOCK) ON b.ID = a.CpMainID
- WHERE cpMainID IN (SELECT AttentionID FROM #TAttention2 WHERE AttentionType = 1)
- AND ImgType = 3
- AND HasPassed = 1
- ORDER BY CheckDate DESC
- SELECT TOP 1 *
- FROM #TAttentionModify
- ORDER BY ModifyDate DESC
- DROP TABLE #TAttention2
- DROP TABLE #TAttentionModify
- END
- ELSE
- BEGIN
- SELECT TOP 0 '' ModifyDesc,'' ModifyDate
- END
- IF @YourFoodCount > 0
- BEGIN
- SELECT TOP 1 AddDate
- FROM paYourfood WITH(NOLOCK)
- WHERE PaMainID = @PaMainID
- ORDER BY AddDate DESC
- END
- ELSE
- BEGIN
- SELECT TOP 0 '' AddDate
- END
- END
- DROP TABLE #TCvIDs
- END
- GO
- /****** Object: StoredProcedure [dbo].[mblpaPhotoInsert] Script Date: 2018/12/13 19:07:56 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- CREATE PROCEDURE [dbo].[mblpaPhotoInsert]
- @paMainID INT,
- @Photo VARCHAR(50)
- AS
- BEGIN TRAN
- BEGIN TRY
- DELETE FROM paPhoto WHERE paMainID=@paMainID
- UPDATE paMain SET HasPhoto=0 WHERE ID=@paMainID
- INSERT INTO paPhoto (paMainID,Photo,PhotoProcessed) VALUES(@paMainID,@Photo,@Photo)
- INSERT INTO paOperationLog (paMainID,Operation,Details,IP)
- VALUES(@paMainID,40,'更新照片', '')
- END TRY
- BEGIN CATCH
- GOTO ERR
- END CATCH
- COMMIT TRAN
- RETURN 1
- ERR:
- BEGIN
- ROLLBACK TRAN
- RETURN 0
- END
- GO
- /****** Object: StoredProcedure [dbo].[mblPaPushLogSelect] Script Date: 2018/12/13 19:07:56 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- --读取未推送的消息
- --Lucifer 20160217
- --修改Harry 2018-6-11 增加企业推送9,10,11,12,13
- CREATE PROCEDURE [dbo].[mblPaPushLogSelect]
- AS
- BEGIN
- SELECT TOP 0 a.ID, a.PushMessage, a.PushType, a.DetailID, b.UniqueID, b.ClientType
- INTO #t
- FROM paPushLog a WITH(NOLOCK), paIOSBind b WITH(NOLOCK)
- WHERE a.paMainID = b.paMainID
- AND a.PushDate IS NULL
- AND a.AddDate > DATEADD(MINUTE, -20, GETDATE())
-
- --企业
- INSERT INTO #t
- SELECT TOP 130 a.ID, a.PushMessage, a.PushType, a.DetailID, b.UniqueID, b.ClientType
- FROM paPushLog a WITH(NOLOCK), caIOSBind b WITH(NOLOCK)
- WHERE a.paMainID = b.caMainID
- AND a.PushDate IS NULL
- AND a.AddDate > DATEADD(MINUTE, -20, GETDATE())
- AND PushType IN(9,10,11,12,13)
- ORDER BY a.Id DESC
-
- --个人
- INSERT INTO #t
- SELECT TOP 130 a.ID, a.PushMessage, a.PushType, a.DetailID, b.UniqueID, b.ClientType
- FROM paPushLog a WITH(NOLOCK), paIOSBind b WITH(NOLOCK)
- WHERE a.paMainID = b.paMainID
- AND a.PushDate IS NULL
- --AND a.paMainID IN(26537325, 12222868, 26502145, 26533836)
- AND a.AddDate > DATEADD(MINUTE, -20, GETDATE())
- AND PushType NOT IN(9,10,11,12,13)
- ORDER BY a.Id DESC
- SELECT * FROM #t
- drop table #t
- END
- GO
- /****** Object: StoredProcedure [dbo].[mblPaPushLogUpdate] Script Date: 2018/12/13 19:07:56 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- --将推送的加上推送时间
- --Lucifer 20160217
- CREATE PROCEDURE [dbo].[mblPaPushLogUpdate]
- (
- @ID INT
- )
- AS
- BEGIN TRY
- UPDATE paPushLog SET PushDate = GETDATE() WHERE ID = @ID
- END TRY
- BEGIN CATCH
- END CATCH
- GO
- /****** Object: StoredProcedure [dbo].[mblProjectErrorLogInsert] Script Date: 2018/12/13 19:07:56 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- --#####################################################
- --创建时间:2014.11.7
- --创建人:Nick
- --说明:提交崩溃,错误日志信息
- --#####################################################
- CREATE PROCEDURE [dbo].[mblProjectErrorLogInsert]
- (
- @ProjectType VARCHAR(20),
- @ErrorType VARCHAR(20),
- @AccountID VARCHAR(20),
- @ErrorLog VARCHAR(MAX),
- @Ip VARCHAR(20)
- )
- AS
- BEGIN
- INSERT INTO ProjectErrorLog VALUES(@ProjectType,@ErrorType,@Ip,@AccountID,'','',@ErrorLog,GETDATE())
- END
- GO
- /****** Object: StoredProcedure [dbo].[mblProvinceSelect] Script Date: 2018/12/13 19:07:56 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- --#####################################################
- --创建时间:2014.11.7
- --创建人:Nick
- --说明:获取省份
- --#####################################################
- CREATE PROCEDURE [dbo].[mblProvinceSelect]
- AS
- BEGIN
- SELECT * FROM dcProvince WITH(NOLOCK)
- END
- GO
- /****** Object: StoredProcedure [dbo].[mblQlrcNewsByIDSelect] Script Date: 2018/12/13 19:07:57 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- --#####################################################
- --创建时间:2014.11.06
- --创建人:Nick
- --说明:获取新闻内容
- --#####################################################
- CREATE PROCEDURE [dbo].[mblQlrcNewsByIDSelect]
- (
- @ID INT
- )
- AS
- BEGIN TRY
- SELECT TOP 1 id,title,refreshdate,Appendix,AppendixName,Label tag,author,ViewNumber_All ViewNumber,
- REPLACE(REPLACE(REPLACE(Content,'</p><p style=\"text-indent:2em\">','<br> <br> '),'</p><p>','<br> <br>'),'<p style=\"text-indent:2em\">',' ') Content
- FROM QlrcNews WITH(NOLOCK) WHERE ID=@ID
- END TRY
- BEGIN CATCH
- RETURN 0
- END CATCH
- GO
- /****** Object: StoredProcedure [dbo].[mblQlrcNewsByProvinceIDSelect] Script Date: 2018/12/13 19:07:57 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- --#####################################################
- --创建时间:2014.11.06
- --创建人:Nick
- --说明:最新热点7条
- --#####################################################
- CREATE PROCEDURE [dbo].[mblQlrcNewsByProvinceIDSelect]
- (
- @ProvinceID INT
- )
- AS
- BEGIN TRY
- SELECT TOP 7 * FROM qlrcnews
- WHERE VersionId=@ProvinceID AND smallImg!=''
- ORDER BY announcedate DESC
- END TRY
- BEGIN CATCH
- RETURN 0
- END CATCH
- GO
- /****** Object: StoredProcedure [dbo].[mblQlrcNewsMobileByIDSelect] Script Date: 2018/12/13 19:07:57 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- --#####################################################
- --创建时间:2014.11.06
- --创建人:Nick
- --说明:获取新闻内容
- --#####################################################
- CREATE PROCEDURE [dbo].[mblQlrcNewsMobileByIDSelect]
- (
- @ID INT
- )
- AS
- BEGIN
- SELECT TOP 1 id, title, refreshdate, Appendix, AppendixName, author, ViewNumber_All ViewNumber, Label, Content, VersionId
- FROM QlrcNews WITH(NOLOCK)
- WHERE ID = @ID
- END
- GO
- /****** Object: StoredProcedure [dbo].[mblRecruitmentByBeginTimeSelect] Script Date: 2018/12/13 19:07:57 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- --#####################################################
- --创建时间:2014.11.7
- --创建人:Nick
- --说明:返回在指定该日期内举办招聘会的场馆,不重复
- --#####################################################
- CREATE PROCEDURE [dbo].[mblRecruitmentByBeginTimeSelect]
- (
- @ProvinceID INT,
- @STime VARCHAR(500)
- )
- AS
- BEGIN
- DECLARE @SQL VARCHAR(MAX)
- SET @SQL = '
- SELECT DISTINCT TOP 500 b.id ,b.PlaceName
- FROM [MarketDb]..[Recruitment] a, [MarketDb]..[RmPlace] b
- WHERE a.RecruitmentPlaceId=b.id AND a.IsPause=0
- AND b.dcRegionID LIKE '''+CONVERT(VARCHAR(6),@ProvinceID)+'%''
- ' + @STime
- PRINT (@SQL)
- EXEC (@SQL)
- END
- GO
- /****** Object: StoredProcedure [dbo].[mblRecruitmentByProvinceIDSelect] Script Date: 2018/12/13 19:07:57 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- --#####################################################
- --创建时间:2014.11.7
- --创建人:John
- --说明:企业客户端获取招聘会列表
- --#####################################################
- CREATE PROCEDURE [dbo].[mblRecruitmentByProvinceIDSelect]
- (
- @ProvinceID VARCHAR(6)
- )
- AS
- BEGIN
- SELECT TOP 100 a.ID,RecruitmentName,BeginDate,PlaceName
- FROM Recruitment a WITH(NOLOCK),RecruitmentPlace b WITH(NOLOCK)
- WHERE RecruitmentPlaceID = b.ID
- AND CityID LIKE @ProvinceID + '%'
- AND EndDate > GETDATE()
- AND IsPause = 0
- ORDER BY IsCompanyTop DESC, orderby, a.ID DESC
- END
- GO
- /****** Object: StoredProcedure [dbo].[mblRecruitmentList] Script Date: 2018/12/13 19:07:57 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- CREATE PROCEDURE [dbo].[mblRecruitmentList]
- (
- @dcProvinceID AS SMALLINT,
- @PageNum AS INT,
- @PageSize AS INT
- )
- AS
- BEGIN
- SELECT *
- FROM RecruitmentList
- WHERE ProvinceID = @dcProvinceID
- AND Rows BETWEEN (@PageNum - 1) * @PageSize + 1
- AND @PageNum * @PageSize
- ORDER BY Rows
- END
- GO
- /****** Object: StoredProcedure [dbo].[mblRecruitmentList0715] Script Date: 2018/12/13 19:07:57 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- CREATE PROCEDURE [dbo].[mblRecruitmentList0715]
- (
- @dcProvinceID AS SMALLINT,
- @PageNum AS INT,
- @PageSize AS INT
- )
- AS
- BEGIN
- DECLARE @COUNT INT
- SELECT @COUNT = COUNT(*)
- FROM Recruitment a, dcRegion b, RecruitmentPlace c, RecruitmentDept d
- WHERE d.ID = a.RecruitmentDeptID AND d.ID <> 1767 AND b.ID = c.dcRegionID AND a.RecruitmentPlaceId = c.id
- AND LEFT(c.dcRegionID, 2) = @dcProvinceID AND EndDate>GETDATE() AND a.IsPause = 0 AND Len(ManagerUserID)>0
-
- IF @COUNT > 200
- SET @COUNT = 200
- SELECT *, @COUNT AS cnt
- FROM (SELECT TOP 200 ROW_NUMBER() OVER(ORDER BY OrderBy, a.EndDate) AS Rows, a.ID, a.RecruitmentName, a.EndDate, a.BeginDate, c.PlaceName, c.Address, b.Description City
- FROM Recruitment a, dcRegion b, RecruitmentPlace c, RecruitmentDept d
- WHERE d.ID = a.RecruitmentDeptID AND d.ID<>1767 AND b.ID = c.dcRegionID AND a.RecruitmentPlaceId = c.id
- AND LEFT(c.dcRegionID, 2) = @dcProvinceID AND EndDate>GETDATE() AND a.IsPause = 0 AND LEN(ManagerUserID)>0
- ) AS a
- WHERE a.Rows BETWEEN (@PageNum - 1) * @PageSize + 1 AND @PageNum * @PageSize ORDER BY Rows
- END
- GO
- /****** Object: StoredProcedure [dbo].[mblRmInvitationCodeByCodeSelect] Script Date: 2018/12/13 19:07:58 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- --#####################################################
- --创建时间:2014.11.7
- --创建人:Nick
- --说明:获取招聘会邀请码
- --#####################################################
- CREATE PROCEDURE [dbo].[mblRmInvitationCodeByCodeSelect]
- (
- @Code VARCHAR(50)
- )
- AS
- BEGIN
- SELECT * FROM MarketDB..RmInvitationCode WITH(NOLOCK)
- WHERE AddDate>DateAdd(Month,1,Getdate()) AND Code = @Code
- END
- GO
- /****** Object: StoredProcedure [dbo].[mblRmInvitationCodeByIDUpdate] Script Date: 2018/12/13 19:07:58 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- --#####################################################
- --创建时间:2014.11.7
- --创建人:Nick
- --说明:获取招聘会邀请码
- --#####################################################
- CREATE PROCEDURE [dbo].[mblRmInvitationCodeByIDUpdate]
- (
- @ID INT,
- @Mobile VARCHAR(20)
- )
- AS
- BEGIN
- UPDATE MarketDB..RmInvitationCode SET Mobile=@Mobile WHERE ID=@ID
- END
- GO
- /****** Object: StoredProcedure [dbo].[mblRmInvitationCodeByPaMainIDSelect] Script Date: 2018/12/13 19:07:58 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- --#####################################################
- --创建时间:2014.11.06
- --创建人:Nick
- --说明:获取应聘邀请列表
- --#####################################################
- CREATE PROCEDURE [dbo].[mblRmInvitationCodeByPaMainIDSelect]
- (
- @Mobile VARCHAR(20),
- @PamainID INT,
- @Type INT
- )
- AS
- BEGIN TRY
- IF @Type = 1
- BEGIN
- SELECT TOP 1 ID,code
- FROM MarketDB..RmInvitationCode WITH(NOLOCK)
- WHERE AddDate>DateAdd(Month,-1,Getdate())
- AND (mobile=@Mobile OR paMainID=@PamainID)
- ORDER BY ID DESC
- END
- ELSE
- BEGIN
- SELECT TOP 1 ID,code
- FROM MarketDB..RmInvitationCode WITH(NOLOCK)
- WHERE AddDate>CONVERT(VARCHAR(10),Getdate(),120)
- AND AddDate<dateAdd(n,-10,Getdate())
- AND (mobile=@Mobile OR paMainID=@PamainID)
- ORDER BY ID DESC
- END
- END TRY
- BEGIN CATCH
- RETURN 0
- END CATCH
- GO
- /****** Object: StoredProcedure [dbo].[mblRmInvitationCodeInsert] Script Date: 2018/12/13 19:07:58 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- --#####################################################
- --创建时间:2014.11.7
- --创建人:Nick
- --说明:插入招聘会邀请码
- --#####################################################
- CREATE PROCEDURE [dbo].[mblRmInvitationCodeInsert]
- (
- @paMainID INT,
- @mobile VARCHAR(20),
- @code VARCHAR(20)
- )
- AS
- BEGIN
- INSERT INTO MarketDB..RmInvitationCode(paMainID,Mobile,code) VALUES(@paMainID,@mobile,@code)
- END
- GO
- /****** Object: StoredProcedure [dbo].[mblSchoolNewsList] Script Date: 2018/12/13 19:07:58 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- --修改显示招聘简章显示全部(过期和非过期的)top 200 Harry 2015-7-15
- CREATE PROCEDURE [dbo].[mblSchoolNewsList]
- (
- @dcProvinceID AS SMALLINT,
- @PageNum AS INT,
- @PageSize AS INT
- )
- AS
- BEGIN
- DECLARE @COUNT INT
- SELECT @COUNT = COUNT(1)
- FROM marketdb..CampusBrochure a WITH(nolock),
- marketdb..CampusBrochureSite b WITH(nolock)
- WHERE a.id = b.CampusBrochure and b.dcSubSiteID = @dcProvinceID
- IF @COUNT > 200
- SET @COUNT = 200
-
- SELECT *,@COUNT AS cnt
- FROM (SELECT TOP 200 ROW_NUMBER() OVER(ORDER BY EndDate DESC, CASE a.id WHEN 7866 THEN 1 WHEN 7865 THEN 1 WHEN 7870 THEN 1 ELSE 2 END ,a.OrderBy ,AddDate desc) AS Rows,
- a.id,a.Title,0 IsHot
- FROM marketdb..CampusBrochure a WITH(NOLOCK),
- marketdb..CampusBrochureSite b WITH(nolock)
- WHERE a.id = b.CampusBrochure AND b.dcSubSiteID = @dcProvinceID
- ) AS a
- WHERE a.Rows BETWEEN (@PageNum-1) * @PageSize + 1 AND @PageNum * @PageSize ORDER BY Rows
- END
- GO
- /****** Object: StoredProcedure [dbo].[mblSearchHistoryInsert] Script Date: 2018/12/13 19:07:58 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- CREATE PROCEDURE [dbo].[mblSearchHistoryInsert]
- (
- @paMainId INT,
- @Title VARCHAR(50),
- @dcRegionId int,
- @dcIndustryId int,
- @dcJobTypeId int
- )
- AS
- BEGIN TRY
- INSERT INTO mblSearchHistory(paMainId, Title, dcRegionId, dcIndustryId, dcJobTypeId)
- VALUES(@paMainId, @Title, @dcRegionId, @dcIndustryId, @dcJobTypeId)
- RETURN 1
- END TRY
- BEGIN CATCH
- RETURN 0
- END CATCH
- set ANSI_NULLS ON
- set QUOTED_IDENTIFIER ON
- GO
- /****** Object: StoredProcedure [dbo].[mblSearchHistorySelect] Script Date: 2018/12/13 19:07:59 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- CREATE PROCEDURE [dbo].[mblSearchHistorySelect]
- (
- @paMainId int
- )
- AS
- BEGIN
- SELECT TOP 30 * FROM mblSearchHistory WITH(NOLOCK) WHERE paMainId = @paMainId ORDER BY AddDate DESC
- END
- GO
- /****** Object: StoredProcedure [dbo].[mblSearchKeywordByKeyWordSelect] Script Date: 2018/12/13 19:07:59 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- --#####################################################
- --创建时间:2014.11.06
- --创建人:Nick
- --说明:获取关键词
- --#####################################################
- CREATE PROCEDURE [dbo].[mblSearchKeywordByKeyWordSelect]
- (
- @key VARCHAR(200)
- )
- AS
- BEGIN TRY
- SELECT TOP 10 KeyType,KeyWord,KeyWordPinYin,SearchResult,SearchType
- FROM searchdb..SearchKeyword WITH(NOLOCK)
- WHERE (KeyWord LIKE @key+'%' OR KeyWordPinYin LIKE @key+'%')
- ORDER BY SearchNumber DESC
- END TRY
- BEGIN CATCH
- RETURN 0
- END CATCH
- GO
- /****** Object: StoredProcedure [dbo].[mblSpreadRefererLogSessionUpdate] Script Date: 2018/12/13 19:07:59 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- --#####################################################
- --创建时间:2014.11.7
- --创建人:John
- --说明:更新sessionid,因为是主站跳转到m站的
- --#####################################################
- CREATE PROCEDURE [dbo].[mblSpreadRefererLogSessionUpdate]
- (
- @Id INT,
- @sessionId VARCHAR(30)
- )
- AS
- BEGIN
- UPDATE SpreadRefererLog SET VisitType = 2, SessionId = @sessionId
- WHERE VisitType = 1 AND RefererDate > DATEADD(MINUTE, -12, GETDATE()) AND SpreadLoginLogid = @Id
- END
- GO
- /****** Object: StoredProcedure [dbo].[mblWeixinSave] Script Date: 2018/12/13 19:07:59 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- CREATE PROCEDURE [dbo].[mblWeixinSave]
- (
- @Content NVARCHAR(300),
- @Lat VARCHAR(20),
- @Lng VARCHAR(20),
- @FromUserName VARCHAR(50)
- )
- AS
- BEGIN TRY
- SET @Content = dbo.SafeSql(@Content)
- DELETE FROM wxMessage WHERE FromUserName=@FromUserName
- IF ISNULL(@Content,'')=''
- BEGIN
- INSERT INTO wxMessage(FromUserName,Lat,Lng,Content) VALUES
- (@FromUserName,@Lat,@Lng,@Content)
- END
- ELSE
- BEGIN
- DECLARE @dcRegionID INT, @KeyWord NVARCHAR(20), @c NVARCHAR(50)
- IF @Content LIKE '% %'
- SET @c = LEFT(@Content, CHARINDEX(' ', @Content) - 1)
- ELSE
- SET @c = @Content
- SELECT TOP 1 @dcRegionID = ID FROM dcRegion WITH(NOLOCK)
- WHERE CHARINDEX(Abbr, @c)>0
- ORDER BY ID DESC
- IF ISNULL(@dcRegionID,0)=0
- RETURN 0
- SELECT @KeyWord=REPLACE(REPLACE(@Content,MapbarName,''),REPLACE(MapbarName,'市',''),'') FROM dcRegion WITH(NOLOCK) WHERE ID=@dcRegionID
- SELECT @KeyWord=REPLACE(REPLACE(REPLACE(@KeyWord,Description,''),REPLACE(Description,'市',''),''),REPLACE(Description,'区',''),'') FROM dcRegion WITH(NOLOCK) WHERE ID=@dcRegionID
- SELECT @KeyWord=REPLACE(REPLACE(@KeyWord,LEFT(FullName,CHARINDEX('省',FullName)),''),REPLACE(LEFT(FullName,CHARINDEX('省',FullName)),'省',''),'') FROM dcRegion WITH(NOLOCK) WHERE ID=@dcRegionID
- SELECT @KeyWord=REPLACE(@KeyWord,' ','')
- SELECT @KeyWord=REPLACE(@KeyWord,'+','')
- INSERT INTO wxMessage(FromUserName,dcRegionID,KeyWord,Content) VALUES
- (@FromUserName,@dcRegionID,@KeyWord,@Content)
- END
- RETURN 1
- END TRY
- BEGIN CATCH
- RETURN 0
- END CATCH
- GO
- /****** Object: StoredProcedure [dbo].[mblWeixinServiceSave] Script Date: 2018/12/13 19:07:59 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- CREATE PROCEDURE [dbo].[mblWeixinServiceSave]
- (
- @Content NVARCHAR(50),
- @Lat VARCHAR(20),
- @Lng VARCHAR(20),
- @FromUserName VARCHAR(50),
- @ProvinceID int
- )
- AS
- BEGIN TRY
- IF(@Content<>'推荐职位')
- BEGIN
- DELETE FROM wxMessage WHERE FromUserName=@FromUserName AND CONTENT <>'推荐职位'
- END
- ELSE
- BEGIN
- DELETE FROM wxMessage WHERE FromUserName=@FromUserName
- END
- IF ISNULL(@Content,'')='' OR @Content='推荐职位'
- BEGIN
- INSERT INTO wxMessage(FromUserName,Lat,Lng,Content) VALUES
- (@FromUserName,@Lat,@Lng,@Content)
- END
- ELSE
- BEGIN
- DECLARE @dcRegionID INT,@KeyWord NVARCHAR(20)
- SELECT TOP 1 @dcRegionID=ID FROM dcRegion WITH(NOLOCK) WHERE
- CHARINDEX(Description,@Content)>0 OR
- CHARINDEX(REPLACE(Description,'市',''),@Content)>0 OR
- CHARINDEX(REPLACE(Description,'省',''),@Content)>0
- ORDER BY ID DESC
- IF ISNULL(@dcRegionID,0)=0
- SELECT @dcRegionID = @ProvinceID
- SELECT @KeyWord=REPLACE(REPLACE(@Content,MapbarName,''),REPLACE(MapbarName,'市',''),'') FROM dcRegion WITH(NOLOCK) WHERE ID=@dcRegionID
- SELECT @KeyWord=REPLACE(REPLACE(REPLACE(@KeyWord,Description,''),REPLACE(Description,'市',''),''),REPLACE(Description,'区',''),'') FROM dcRegion WITH(NOLOCK) WHERE ID=@dcRegionID
- SELECT @KeyWord=REPLACE(REPLACE(@KeyWord,LEFT(FullName,CHARINDEX('省',FullName)),''),REPLACE(LEFT(FullName,CHARINDEX('省',FullName)),'省',''),'') FROM dcRegion WITH(NOLOCK) WHERE ID=@dcRegionID
- SELECT @KeyWord=REPLACE(@KeyWord,' ','')
- SELECT @KeyWord=REPLACE(@KeyWord,'+','')
- INSERT INTO wxMessage(FromUserName,dcRegionID,KeyWord,Content) VALUES
- (@FromUserName,@dcRegionID,@KeyWord,@Content)
- END
- RETURN 1
- END TRY
- BEGIN CATCH
- RETURN 0
- END CATCH
- GO
- /****** Object: StoredProcedure [dbo].[mblWxMessageSendSelect] Script Date: 2018/12/13 19:07:59 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- --#####################################################
- --创建时间:2015.2.26
- --创建人:Nick
- --说明:获取提醒信息
- --#####################################################
- CREATE PROCEDURE [dbo].[mblWxMessageSendSelect]
- AS
- BEGIN
- SET NOCOUNT ON
- SELECT senddate,a.ID,c.ID PaMainID,a.Message ContentText,b.OpenID,c.Name,e.ProvinceId,d.Token,e.AppID, e.AppSecret,f.No AS TemplateNo
- FROM WxMessageSend a WITH(NOLOCK),WxFans b WITH(NOLOCK),PaMain c WITH(NOLOCK),dcWxtoken d WITH(NOLOCK), wxServiceNo e,WxTemplateno f
- WHERE a.SendDate IS NULL
- AND a.WxFansID = b.id
- AND b.Status = 2
- AND b.PaMainID = c.ID
- AND c.IsWeiXinNotice = 1
- AND b.wxServiceNoId = e.ID
- AND e.ProvinceId = d.dcProvinceId
- AND a.WxTemplatenoID = f.ID
- ORDER BY a.ID DESC
- SET NOCOUNT OFF
- END
- GO
- /****** Object: StoredProcedure [dbo].[mblWXQrImageByIDUpdate] Script Date: 2018/12/13 19:08:00 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- --#####################################################
- --创建时间:2014.11.7
- --创建人:Nick
- --说明:根据ID修改WXQrImage
- --#####################################################
- CREATE PROCEDURE [dbo].[mblWXQrImageByIDUpdate]
- (
- @ID INT,
- @Status INT,
- @OpenID VARCHAR(50)
- )
- AS
- BEGIN
- UPDATE WXQrImage
- SET Status = @Status, paMainID=(
- SELECT TOP 1 paMainID
- FROM palogincontact WITH(NOLOCK)
- WHERE ContactType=4
- AND Openid=@OpenID
- ORDER BY id DESC
- ) WHERE ID=@ID
- END
- GO
- /****** Object: StoredProcedure [dbo].[mblWXQrImageByIDUpdateNew] Script Date: 2018/12/13 19:08:00 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- --#####################################################
- --创建时间:2016.4.7
- --创建人:Lucifer
- --说明:根据ID修改WXQrImage
- --#####################################################
- CREATE PROCEDURE [dbo].[mblWXQrImageByIDUpdateNew]
- (
- @ID INT,
- @Status INT,
- @OpenID VARCHAR(50),
- @ContactType INT
- )
- AS
- BEGIN
- UPDATE WXQrImage
- SET Status = @Status,
- paMainID = (
- SELECT TOP 1 paMainID
- FROM paLoginContact WITH(NOLOCK)
- WHERE ContactType = @ContactType
- AND Openid = @OpenID
- ORDER BY id DESC)
- WHERE ID = @ID
- END
- GO
- /****** Object: StoredProcedure [dbo].[mblWXQRIMAGEByOpenIDSelect] Script Date: 2018/12/13 19:08:01 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- --#####################################################
- --创建时间:2014.11.7
- --创建人:Nick
- --说明:根据ID查询WXQRIMAGE
- --#####################################################
- CREATE PROCEDURE [dbo].[mblWXQRIMAGEByOpenIDSelect]
- (
- @OpenID VARCHAR(50)
- )
- AS
- INSERT INTO ProcLog SELECT 'mblWXQRIMAGEByOpenIDSelect', '', GETDATE()
- BEGIN
- SELECT TOP 1 *
- FROM WXQRIMAGE
- WHERE openid=@OpenID
- AND pamainid IS NULL
- ORDER BY id DESC
- END
- GO
- /****** Object: StoredProcedure [dbo].[mblWXQrImageStatusUpdate] Script Date: 2018/12/13 19:08:01 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- --#####################################################
- --创建时间:2014.11.7
- --创建人:Nick
- --说明:修改 WXQrImage 状态
- --#####################################################
- CREATE PROCEDURE [dbo].[mblWXQrImageStatusUpdate]
- (
- @ID INT,
- @Status INT,
- @OpenID VARCHAR(50)
- )
- AS
- INSERT INTO ProcLog SELECT 'mblWXQrImageStatusUpdate', @OpenID, GETDATE()
- BEGIN
- UPDATE WXQrImage
- SET status=@Status
- WHERE ID=@ID
- AND paMainID=(
- SELECT TOP 1 paMainID
- FROM palogincontact WITH(NOLOCK)
- WHERE ContactType=4
- AND Openid=@OpenID
- )
- END
- GO
- /****** Object: StoredProcedure [dbo].[p_killspid] Script Date: 2018/12/13 19:08:01 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- CREATE procedure [dbo].[p_killspid]
- (
- @dbname varchar(200) --要关闭进程的数据库名
- )
- as
- begin
- declare @sql nvarchar(500)
- declare @spid nvarchar(20)
- declare #tb cursor for
- select spid=cast(spid as varchar(20)) from master..sysprocesses where dbid=db_id(@dbname)
- open #tb
- fetch next from #tb into @spid
- while @@fetch_status=0
- begin
- print 'exec(kill ' + @spid + ') '
- exec('kill '+@spid)
- fetch next from #tb into @spid
- end
- close #tb
- deallocate #tb
- end
- GO
- /****** Object: StoredProcedure [dbo].[paCvTagsByCvMainIDSelect] Script Date: 2018/12/13 19:08:01 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- --个人标签查询 Peter 2017-1-13
- CREATE PROCEDURE [dbo].[paCvTagsByCvMainIDSelect]
- (
- @paMainID INT,
- @cvMainID INT
- )
- AS
- BEGIN
- SELECT *
- FROM CvTags WITH(NOLOCK)
- WHERE cvMainID = @cvMainID
- AND EXISTS(
- SELECT 'x'
- FROM cvMain
- WHERE paMainID = @paMainID
- AND id = @cvMainID)
- END
- GO
- /****** Object: StoredProcedure [dbo].[paCvTagsSave] Script Date: 2018/12/13 19:08:01 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- --个人标签保存 Peter 2017-1-13
- CREATE PROCEDURE [dbo].[paCvTagsSave]
- (
- @paMainID INT,
- @cvMainID INT,
- @Tags NVARCHAR(1000)
- )
- AS
- BEGIN
- IF NOT EXISTS(SELECT 'x' FROM cvMain WHERE paMainID = @paMainID AND id = @cvMainID)
- BEGIN
- RETURN -1
- END
-
- DECLARE @TagsCount INT
-
- SELECT @TagsCount = COUNT(1)
- FROM dbo.fnSplit(@Tags,'@')
-
- IF @TagsCount > 10
- BEGIN
- RETURN 0
- END
-
- DELETE FROM cvTags WHERE cvMainID = @cvMainID
-
- CREATE TABLE #T(
- cvMainID INT,
- Tag NVARCHAR(20),
- VerifyDate SMALLDATETIME
- )
-
- INSERT INTO #T(cvMainID,Tag)
- SELECT @cvMainID cvMainID,a Tag
- FROM dbo.fnSplit(@Tags,'@')
-
- UPDATE #T
- SET VerifyDate = GETDATE()
- WHERE EXISTS(SELECT 'x' FROM paTagsMain WHERE Tag = #T.Tag)
-
- INSERT INTO cvTags(cvMainID,Tags,VerifyDate)
- SELECT *
- FROM #T
-
- DROP TABLE #T
-
- RETURN 1
- END
- GO
- /****** Object: StoredProcedure [dbo].[paJobByWeixinSelect] Script Date: 2018/12/13 19:08:01 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- CREATE PROCEDURE [dbo].[paJobByWeixinSelect]
- (
- @FromUserName VARCHAR(50)
- )
- AS
- --return
- SET NOCOUNT ON
- BEGIN TRY
- SET @FromUserName = dbo.SafeSql(@FromUserName)
-
- DECLARE @dcRegionID INT,@KeyWord NVARCHAR(20),
- @Lng DECIMAL(8,5),@Lat DECIMAL(8,5),@Distance INT,
- @KeyType TINYINT, @ValidJobNumber INT, @PageNumber SMALLINT
- SELECT @dcRegionID=dcRegionID,@KeyWord=KeyWord,
- @Lng=Lng,@Lat=Lat,@PageNumber=PageNumber
- FROM wxMessage WITH(NOLOCK) WHERE FromUserName=@FromUserName
- UPDATE wxMessage SET PageNumber=PageNumber+1 WHERE FromUserName=@FromUserName
- SELECT @KeyWord = dbo.SafeSQL(ISNULL(@KeyWord, '')),
- @KeyType = 2,
- @Distance = 5000,
- @PageNumber = ISNULL(@PageNumber, 1),
- @dcRegionID = ISNULL(@dcRegionID, 0),
- @Lng = ISNULL(@Lng, 0),
- @Lat = ISNULL(@Lat, 0)
- IF @dcRegionID = 0 AND @Lng = 0 AND @Lat = 0
- RETURN
- DECLARE @paSearchConditionID AS INT,
- @MinId AS INT,
- @PageSize AS TINYINT,
- @TableID AS TINYINT
- SELECT @paSearchConditionID = 0, @PageSize = 8 --每页的行数
-
- ----搜索60分钟前的数据
- SELECT TOP 1 @paSearchConditionID=ID FROM SearchDB..paSearchCondition WITH(NOLOCK)
- WHERE JobType=''
- AND JobPlace=@dcRegionID AND ISNULL(Industry,'')='' AND ISNULL(Education,'')=''
- AND ISNULL(Experience,'')='' AND ISNULL(Salary,'')='' AND ISNULL(IsNegotiable,'')=''
- AND ISNULL(EmployType,'')='' AND KeyWord=@KeyWord AND KeyType=@KeyType
- AND ISNULL(CompanySizeID,'')='' AND Lng=@Lng AND Lat=@Lat
- ORDER BY ID DESC
- IF ISNULL(@paSearchConditionID, 0) = 0
- BEGIN
- GOTO SelectReset --无数据,重新搜索
- END
- ELSE
- BEGIN
- SELECT @TableID = @paSearchConditionID % 4
- GOTO GetRecordSet --从临时结果中提取数据
- END
- SelectReset:
- --从job中搜索数据
- BEGIN TRAN
- DECLARE @SQL AS VARCHAR(8000)
- DECLARE @WHERE AS VARCHAR(8000)
- DECLARE @FROM AS VARCHAR(1000)
- ----记录查询条件
- INSERT INTO SearchDB..paSearchCondition(SessionID, LogTime, JobType, JobPlace, Industry, Education, Experience,
- Salary, IsNegotiable, EmployType, CompanySizeID, KeyWord, KeyType, ReuseNumber, Lng, Lat, Distance)
- VALUES(1, GETDATE(), '', @dcRegionID, '', '', '', '', '', '', '', @KeyWord, @KeyType, 0, @Lng, @Lat, @Distance)
- SET @paSearchConditionID = @@IDENTITY
- SELECT @TableID = @paSearchConditionID % 4
- ----建立临时表
- CREATE TABLE #Job(
- RowID INT IDENTITY(1, 1),
- ID INT NOT NULL,
- dcJobTypeID SMALLINT NOT NULL,
- dcJobTypeIDMinor SMALLINT NULL,
- dcSalaryID TINYINT NOT NULL,
- dcRegionID VARCHAR(6) NULL,
- dcEducationID TINYINT NOT NULL,
- MinExperience TINYINT NOT NULL,
- RefreshDate SMALLDATETIME NULL
- )
- ------刷新时间,根据刷新时间编号计算
- ----生成插入临时表的Sql语句
- SET @SQL='
- INSERT INTO #Job
- SELECT a.ID, a.dcJobTypeID,
- a.dcJobTypeIDMinor, a.dcSalaryID,
- a.dcRegionID, a.dcEducationID, a.MinExperience,
- a.IssueDate'
- SET @FROM = '
- FROM JobPublish a WITH(NOLOCK)
- INNER JOIN cpMainPublish b WITH(NOLOCK) ON a.cpMainID=b.ID'
- ----职位有效,单位新有效
- SET @WHERE = '
- WHERE a.Valid = 1
- AND b.Valid = 1'
- ----需要增加全文索引的关键字查询
- IF @KeyWord LIKE '% %'
- BEGIN
- SET @KeyWord = REPLACE(@KeyWord, ' ', ' ')
- SET @KeyWord = REPLACE(@KeyWord, ' ', ' ')
- SET @KeyWord = REPLACE(@KeyWord, ' ', ' ')
- SET @KeyWord = '"' + REPLACE(@KeyWord, ' ', '" OR "') + '"'
- END
- IF LEN(@KeyWord) > 0
- BEGIN
- IF @KeyType = 2
- SET @FROM = @FROM + '
- INNER JOIN CONTAINSTABLE(JobPublish, *, ''' + @KeyWord + ''', 1000000) AS KeyJob
- ON a.ID = KeyJob.[Key]'
- END
- ---地区
- IF @dcRegionID > 0
- SET @WHERE = @WHERE + '
- AND a.dcRegionID Like ''' + CONVERT(VARCHAR(6),@dcRegionID) + '%'''
- IF @Lng > 0 AND @Lat > 0
- BEGIN
- DECLARE @Degree AS DECIMAL(8,5),@LBLng AS DECIMAL(8,5),@LBLat AS DECIMAL(8,5),
- @RTLng AS DECIMAL(8,5),@RTLat AS DECIMAL(8,5)
- SET @Degree = @Distance / 100000.0;
- SET @LBLng = @Lng - @Degree
- SET @LBLat = @Lat - @Degree
- SET @RTLng = @Lng + @Degree
- SET @RTLat = @Lat + @Degree
- SET @WHERE = @WHERE + '
- AND a.Lng BETWEEN ' + CONVERT(VARCHAR,@LBLng) + ' AND ' + CONVERT(VARCHAR,@RTLng) + '
- AND a.Lat BETWEEN ' + CONVERT(VARCHAR,@LBLat) + ' AND ' + CONVERT(VARCHAR,@RTLat)
- END
- SET @SQL = @SQL + @FROM + @WHERE
-
- SET @SQL=@SQL + ' ORDER BY a.RefreshDate DESC, a.ID'
- ----把符合条件的职位全部列出
- --PRINT @SQL
- EXEC(@SQL)
-
- SET @ValidJobNumber = @@ROWCOUNT
- ----记录查询结果总数
- UPDATE SearchDB..paSearchCondition SET ValidJobNumber=@ValidJobNumber, SQl=@SQL WHERE ID=@paSearchConditionID
-
- ----插入JobType数据
- DECLARE @TitleValue AS INT, @TopRows AS INT, @AllRows AS INT
- IF (@TableID = 0)
- BEGIN
- INSERT INTO SearchDB..paSearchCount_0(paSearchConditionID, Title, TitleId, TitleValue)
- SELECT @paSearchConditionID, 'JobType', dcJobTypeID, COUNT(*) FROM #Job WITH(NOLOCK)
- GROUP BY dcJobTypeID ORDER BY dcJobTypeID
- ----计算全部某职位类别,2, 4位的数据
- UPDATE a SET a.TitleValue = b.TitleValue
- FROM SearchDB..paSearchCount_0 a WITH(NOLOCK),
- (SELECT LEFT(TitleID, 2) TitleID, SUM(TitleValue) TitleValue
- FROM SearchDB..paSearchCount_0 WITH(NOLOCK)
- WHERE paSearchConditionID = @paSearchConditionID AND Title = 'JobType'
- GROUP BY LEFT(TitleID, 2)) b
- WHERE a.TitleId = b.TitleID
- AND a.paSearchConditionID = @paSearchConditionID AND a.Title = 'JobType'
- ----写入TitleDesc
- UPDATE a SET a.TitleDesc = b.Description
- FROM SearchDB..paSearchCount_0 a WITH(NOLOCK), dcJobType b WITH(NOLOCK)
- WHERE a.TitleID = b.ID AND a.paSearchConditionID = @paSearchConditionID
- AND a.Title = 'JobType'
-
- INSERT INTO SearchDB..paSearchCount_0(paSearchConditionID, Title, TitleId, TitleValue)
- SELECT @paSearchConditionID, 'Salary', dcSalaryID, COUNT(*) FROM #Job WITH(NOLOCK)
- GROUP BY dcSalaryID ORDER BY dcSalaryID
- INSERT INTO SearchDB..paSearchCount_0(paSearchConditionID, Title, TitleId, TitleValue)
- SELECT @paSearchConditionID, 'Region', dcRegionID, COUNT(*) FROM #Job WITH(NOLOCK)
- GROUP BY dcRegionID ORDER BY dcRegionID
- ----计算全部地区,2位的数据
- UPDATE a SET a.TitleValue = b.TitleValue
- FROM SearchDB..paSearchCount_0 a WITH(NOLOCK),
- (SELECT LEFT(TitleID, 2) TitleID, SUM(TitleValue) TitleValue
- FROM SearchDB..paSearchCount_0 WITH(NOLOCK)
- WHERE paSearchConditionID = @paSearchConditionID AND Title = 'Region'
- GROUP BY LEFT(TitleID, 2)) b
- WHERE a.TitleId = b.TitleID
- AND a.paSearchConditionID = @paSearchConditionID AND a.Title = 'Region'
- ----计算全部地区,4位的数据
- UPDATE a SET a.TitleValue = b.TitleValue
- FROM SearchDB..paSearchCount_0 a WITH(NOLOCK), (
- SELECT LEFT(TitleID, 4) TitleID, SUM(TitleValue) TitleValue
- FROM SearchDB..paSearchCount_0 WITH(NOLOCK)
- WHERE paSearchConditionID = @paSearchConditionID AND Title = 'Region'
- AND LEN(TitleID) >3
- GROUP BY LEFT(TitleID, 4)) b
- WHERE a.TitleId = b.TitleID
- AND a.paSearchConditionID = @paSearchConditionID AND a.Title = 'Region'
- ----写入TitleDesc
- UPDATE a SET a.TitleDesc = b.Description
- FROM SearchDB..paSearchCount_0 a WITH(NOLOCK), dcRegion b WITH(NOLOCK)
- WHERE a.TitleID = b.ID AND a.paSearchConditionID = @paSearchConditionID
- AND a.Title = 'Region'
- INSERT INTO SearchDB..paSearchCount_0(paSearchConditionID, Title, TitleId, TitleValue)
- SELECT @paSearchConditionID, 'Education', dcEducationID, COUNT(*) FROM #Job WITH(NOLOCK)
- GROUP BY dcEducationID ORDER BY dcEducationID
- --学历 高中、中专、中级合并
- SELECT @TitleValue = SUM(TitleValue) FROM SearchDB..paSearchCount_0 WITH(NOLOCK)
- WHERE paSearchConditionID = @paSearchConditionID
- AND Title = 'Education' AND TitleID IN(2, 3, 4)
- IF @TitleValue IS NOT NULL
- BEGIN
- IF EXISTS(SELECT 'X' FROM SearchDB..paSearchCount_0 WITH(NOLOCK) WHERE paSearchConditionID = @paSearchConditionID AND Title = 'Education' AND TitleID = 2)
- UPDATE SearchDB..paSearchCount_0 SET TitleValue = @TitleValue
- WHERE paSearchConditionID = @paSearchConditionID
- AND Title = 'Education' AND TitleID = 2
- ELSE
- INSERT INTO SearchDB..paSearchCount_0(paSearchConditionID, Title, TitleId, TitleValue) VALUES
- (@paSearchConditionID, 'Education', 2, @TitleValue)
- DELETE FROM SearchDB..paSearchCount_0
- WHERE paSearchConditionID = @paSearchConditionID
- AND Title = 'Education' AND TitleID IN(3, 4)
- END
- INSERT INTO SearchDB..paSearchCount_0(paSearchConditionID, Title, TitleId, TitleValue)
- SELECT @paSearchConditionID, 'Experience', MinExperience, COUNT(*) FROM #Job WITH(NOLOCK)
- GROUP BY MinExperience ORDER BY MinExperience
-
- INSERT INTO SearchDB..paSearchJobID_0(paSearchConditionID, JobId, IsTop)
- SELECT Top 3 @paSearchConditionID,Balance,1
- FROM caOrder WITH(NOLOCK), (SELECT TOP 2000 ID FROM #Job WITH(NOLOCK)) b
- WHERE caOrder.OrderType = 12 AND BeginDate<GETDATE() AND EndDate>GETDATE() AND b.ID = caOrder.Balance ORDER BY OpenDate DESC
- SET @TopRows = @@ROWCOUNT
- INSERT INTO SearchDB..paSearchJobID_0(paSearchConditionID, JobId, IsTop)
- SELECT TOP 2000 @paSearchConditionID, ID, 0 FROM #Job WITH(NOLOCK)
- SET @AllRows = @@ROWCOUNT
- IF @TopRows = 0 AND @AllRows > 100
- UPDATE SearchDB..paSearchJobID_0 SET IsTop = 1
- WHERE paSearchConditionID = @paSearchConditionID
- AND ID IN (SELECT TOP 3 ID FROM SearchDB..paSearchJobID_0 WITH(NOLOCK) WHERE paSearchConditionID = @paSearchConditionID)
- END
- ELSE IF (@TableId = 1)
- BEGIN
- INSERT INTO SearchDB..paSearchCount_1(paSearchConditionID, Title, TitleId, TitleValue)
- SELECT @paSearchConditionID, 'JobType', dcJobTypeID, COUNT(*) FROM #Job WITH(NOLOCK)
- GROUP BY dcJobTypeID ORDER BY dcJobTypeID
- ----计算全部某职位类别,2, 4位的数据
- UPDATE a SET a.TitleValue = b.TitleValue
- FROM SearchDB..paSearchCount_1 a WITH(NOLOCK),
- (SELECT LEFT(TitleID, 2) TitleID, SUM(TitleValue) TitleValue
- FROM SearchDB..paSearchCount_1 WITH(NOLOCK)
- WHERE paSearchConditionID = @paSearchConditionID AND Title = 'JobType'
- GROUP BY LEFT(TitleID, 2)) b
- WHERE a.TitleId = b.TitleID
- AND a.paSearchConditionID = @paSearchConditionID AND a.Title = 'JobType'
- ----写入TitleDesc
- UPDATE a SET a.TitleDesc = b.Description
- FROM SearchDB..paSearchCount_1 a WITH(NOLOCK), dcJobType b WITH(NOLOCK)
- WHERE a.TitleID = b.ID AND a.paSearchConditionID = @paSearchConditionID
- AND a.Title = 'JobType'
-
- INSERT INTO SearchDB..paSearchCount_1(paSearchConditionID, Title, TitleId, TitleValue)
- SELECT @paSearchConditionID, 'Salary', dcSalaryID, COUNT(*) FROM #Job WITH(NOLOCK)
- GROUP BY dcSalaryID ORDER BY dcSalaryID
- INSERT INTO SearchDB..paSearchCount_1(paSearchConditionID, Title, TitleId, TitleValue)
- SELECT @paSearchConditionID, 'Region', dcRegionID, COUNT(*) FROM #Job WITH(NOLOCK)
- GROUP BY dcRegionID ORDER BY dcRegionID
- ----计算全部地区,2位的数据
- UPDATE a SET a.TitleValue = b.TitleValue
- FROM SearchDB..paSearchCount_1 a WITH(NOLOCK),
- (SELECT LEFT(TitleID, 2) TitleID, SUM(TitleValue) TitleValue
- FROM SearchDB..paSearchCount_1 WITH(NOLOCK)
- WHERE paSearchConditionID = @paSearchConditionID AND Title = 'Region'
- GROUP BY LEFT(TitleID, 2)) b
- WHERE a.TitleId = b.TitleID
- AND a.paSearchConditionID = @paSearchConditionID AND a.Title = 'Region'
- ----计算全部地区,4位的数据
- UPDATE a SET a.TitleValue = b.TitleValue
- FROM SearchDB..paSearchCount_1 a WITH(NOLOCK), (
- SELECT LEFT(TitleID, 4) TitleID, SUM(TitleValue) TitleValue
- FROM SearchDB..paSearchCount_1 WITH(NOLOCK)
- WHERE paSearchConditionID = @paSearchConditionID AND Title = 'Region'
- AND LEN(TitleID) >3
- GROUP BY LEFT(TitleID, 4)) b
- WHERE a.TitleId = b.TitleID
- AND a.paSearchConditionID = @paSearchConditionID AND a.Title = 'Region'
- ----写入TitleDesc
- UPDATE a SET a.TitleDesc = b.Description
- FROM SearchDB..paSearchCount_1 a WITH(NOLOCK), dcRegion b WITH(NOLOCK)
- WHERE a.TitleID = b.ID AND a.paSearchConditionID = @paSearchConditionID
- AND a.Title = 'Region'
- INSERT INTO SearchDB..paSearchCount_1(paSearchConditionID, Title, TitleId, TitleValue)
- SELECT @paSearchConditionID, 'Education', dcEducationID, COUNT(*) FROM #Job WITH(NOLOCK)
- GROUP BY dcEducationID ORDER BY dcEducationID
- --学历 高中、中专、中级合并
- SELECT @TitleValue = SUM(TitleValue) FROM SearchDB..paSearchCount_1 WITH(NOLOCK)
- WHERE paSearchConditionID = @paSearchConditionID
- AND Title = 'Education' AND TitleID IN(2, 3, 4)
- IF @TitleValue IS NOT NULL
- BEGIN
- IF EXISTS(SELECT 'X' FROM SearchDB..paSearchCount_1 WITH(NOLOCK) WHERE paSearchConditionID = @paSearchConditionID AND Title = 'Education' AND TitleID = 2)
- UPDATE SearchDB..paSearchCount_1 SET TitleValue = @TitleValue
- WHERE paSearchConditionID = @paSearchConditionID
- AND Title = 'Education' AND TitleID = 2
- ELSE
- INSERT INTO SearchDB..paSearchCount_1(paSearchConditionID, Title, TitleId, TitleValue) VALUES
- (@paSearchConditionID, 'Education', 2, @TitleValue)
- DELETE FROM SearchDB..paSearchCount_1
- WHERE paSearchConditionID = @paSearchConditionID
- AND Title = 'Education' AND TitleID IN(3, 4)
- END
- INSERT INTO SearchDB..paSearchCount_1(paSearchConditionID, Title, TitleId, TitleValue)
- SELECT @paSearchConditionID, 'Experience', MinExperience, COUNT(*) FROM #Job WITH(NOLOCK)
- GROUP BY MinExperience ORDER BY MinExperience
-
- INSERT INTO SearchDB..paSearchJobID_1(paSearchConditionID, JobId, IsTop)
- SELECT Top 3 @paSearchConditionID,Balance,1
- FROM caOrder WITH(NOLOCK), (SELECT TOP 2000 ID FROM #Job WITH(NOLOCK)) b
- WHERE caOrder.OrderType = 12 AND BeginDate<GETDATE() AND EndDate>GETDATE() AND b.ID = caOrder.Balance ORDER BY OpenDate DESC
- SET @TopRows = @@ROWCOUNT
- INSERT INTO SearchDB..paSearchJobID_1(paSearchConditionID, JobId, IsTop)
- SELECT TOP 2000 @paSearchConditionID, ID, 0 FROM #Job WITH(NOLOCK)
- SET @AllRows = @@ROWCOUNT
- IF @TopRows = 0 AND @AllRows > 100
- UPDATE SearchDB..paSearchJobID_1 SET IsTop = 1
- WHERE paSearchConditionID = @paSearchConditionID
- AND ID IN (SELECT TOP 3 ID FROM SearchDB..paSearchJobID_1 WITH(NOLOCK) WHERE paSearchConditionID = @paSearchConditionID)
- END
- ELSE IF (@TableId = 2)
- BEGIN
- INSERT INTO SearchDB..paSearchCount_2(paSearchConditionID, Title, TitleId, TitleValue)
- SELECT @paSearchConditionID, 'JobType', dcJobTypeID, COUNT(*) FROM #Job WITH(NOLOCK)
- GROUP BY dcJobTypeID ORDER BY dcJobTypeID
- ----计算全部某职位类别,2, 4位的数据
- UPDATE a SET a.TitleValue = b.TitleValue
- FROM SearchDB..paSearchCount_2 a WITH(NOLOCK),
- (SELECT LEFT(TitleID, 2) TitleID, SUM(TitleValue) TitleValue
- FROM SearchDB..paSearchCount_2 WITH(NOLOCK)
- WHERE paSearchConditionID = @paSearchConditionID AND Title = 'JobType'
- GROUP BY LEFT(TitleID, 2)) b
- WHERE a.TitleId = b.TitleID
- AND a.paSearchConditionID = @paSearchConditionID AND a.Title = 'JobType'
- ----写入TitleDesc
- UPDATE a SET a.TitleDesc = b.Description
- FROM SearchDB..paSearchCount_2 a WITH(NOLOCK), dcJobType b WITH(NOLOCK)
- WHERE a.TitleID = b.ID AND a.paSearchConditionID = @paSearchConditionID
- AND a.Title = 'JobType'
-
- INSERT INTO SearchDB..paSearchCount_2(paSearchConditionID, Title, TitleId, TitleValue)
- SELECT @paSearchConditionID, 'Salary', dcSalaryID, COUNT(*) FROM #Job WITH(NOLOCK)
- GROUP BY dcSalaryID ORDER BY dcSalaryID
- INSERT INTO SearchDB..paSearchCount_2(paSearchConditionID, Title, TitleId, TitleValue)
- SELECT @paSearchConditionID, 'Region', dcRegionID, COUNT(*) FROM #Job WITH(NOLOCK)
- GROUP BY dcRegionID ORDER BY dcRegionID
- ----计算全部地区,2位的数据
- UPDATE a SET a.TitleValue = b.TitleValue
- FROM SearchDB..paSearchCount_2 a WITH(NOLOCK),
- (SELECT LEFT(TitleID, 2) TitleID, SUM(TitleValue) TitleValue
- FROM SearchDB..paSearchCount_2 WITH(NOLOCK)
- WHERE paSearchConditionID = @paSearchConditionID AND Title = 'Region'
- GROUP BY LEFT(TitleID, 2)) b
- WHERE a.TitleId = b.TitleID
- AND a.paSearchConditionID = @paSearchConditionID AND a.Title = 'Region'
- ----计算全部地区,4位的数据
- UPDATE a SET a.TitleValue = b.TitleValue
- FROM SearchDB..paSearchCount_2 a WITH(NOLOCK), (
- SELECT LEFT(TitleID, 4) TitleID, SUM(TitleValue) TitleValue
- FROM SearchDB..paSearchCount_2 WITH(NOLOCK)
- WHERE paSearchConditionID = @paSearchConditionID AND Title = 'Region'
- AND LEN(TitleID) >3
- GROUP BY LEFT(TitleID, 4)) b
- WHERE a.TitleId = b.TitleID
- AND a.paSearchConditionID = @paSearchConditionID AND a.Title = 'Region'
- ----写入TitleDesc
- UPDATE a SET a.TitleDesc = b.Description
- FROM SearchDB..paSearchCount_2 a WITH(NOLOCK), dcRegion b WITH(NOLOCK)
- WHERE a.TitleID = b.ID AND a.paSearchConditionID = @paSearchConditionID
- AND a.Title = 'Region'
- INSERT INTO SearchDB..paSearchCount_2(paSearchConditionID, Title, TitleId, TitleValue)
- SELECT @paSearchConditionID, 'Education', dcEducationID, COUNT(*) FROM #Job WITH(NOLOCK)
- GROUP BY dcEducationID ORDER BY dcEducationID
- --学历 高中、中专、中级合并
- SELECT @TitleValue = SUM(TitleValue) FROM SearchDB..paSearchCount_2 WITH(NOLOCK)
- WHERE paSearchConditionID = @paSearchConditionID
- AND Title = 'Education' AND TitleID IN(2, 3, 4)
- IF @TitleValue IS NOT NULL
- BEGIN
- IF EXISTS(SELECT 'X' FROM SearchDB..paSearchCount_2 WITH(NOLOCK) WHERE paSearchConditionID = @paSearchConditionID AND Title = 'Education' AND TitleID = 2)
- UPDATE SearchDB..paSearchCount_2 SET TitleValue = @TitleValue
- WHERE paSearchConditionID = @paSearchConditionID
- AND Title = 'Education' AND TitleID = 2
- ELSE
- INSERT INTO SearchDB..paSearchCount_2(paSearchConditionID, Title, TitleId, TitleValue) VALUES
- (@paSearchConditionID, 'Education', 2, @TitleValue)
- DELETE FROM SearchDB..paSearchCount_2
- WHERE paSearchConditionID = @paSearchConditionID
- AND Title = 'Education' AND TitleID IN(3, 4)
- END
- INSERT INTO SearchDB..paSearchCount_2(paSearchConditionID, Title, TitleId, TitleValue)
- SELECT @paSearchConditionID, 'Experience', MinExperience, COUNT(*) FROM #Job WITH(NOLOCK)
- GROUP BY MinExperience ORDER BY MinExperience
- INSERT INTO SearchDB..paSearchJobID_2(paSearchConditionID, JobId, IsTop)
- SELECT Top 3 @paSearchConditionID,Balance,1
- FROM caOrder WITH(NOLOCK), (SELECT TOP 2000 ID FROM #Job WITH(NOLOCK)) b
- WHERE caOrder.OrderType = 12 AND BeginDate<GETDATE() AND EndDate>GETDATE() AND b.ID = caOrder.Balance ORDER BY OpenDate DESC
- SET @TopRows = @@ROWCOUNT
- INSERT INTO SearchDB..paSearchJobID_2(paSearchConditionID, JobId, IsTop)
- SELECT TOP 2000 @paSearchConditionID, ID, 0 FROM #Job WITH(NOLOCK)
- SET @AllRows = @@ROWCOUNT
- IF @TopRows = 0 AND @AllRows > 100
- UPDATE SearchDB..paSearchJobID_2 SET IsTop = 1
- WHERE paSearchConditionID = @paSearchConditionID
- AND ID IN (SELECT TOP 3 ID FROM SearchDB..paSearchJobID_2 WITH(NOLOCK) WHERE paSearchConditionID = @paSearchConditionID)
- END
- ELSE IF (@TableId = 3)
- BEGIN
- INSERT INTO SearchDB..paSearchCount_3(paSearchConditionID, Title, TitleId, TitleValue)
- SELECT @paSearchConditionID, 'JobType', dcJobTypeID, COUNT(*) FROM #Job WITH(NOLOCK)
- GROUP BY dcJobTypeID ORDER BY dcJobTypeID
- ----计算全部某职位类别,2, 4位的数据
- UPDATE a SET a.TitleValue = b.TitleValue
- FROM SearchDB..paSearchCount_3 a WITH(NOLOCK),
- (SELECT LEFT(TitleID, 2) TitleID, SUM(TitleValue) TitleValue
- FROM SearchDB..paSearchCount_3 WITH(NOLOCK)
- WHERE paSearchConditionID = @paSearchConditionID AND Title = 'JobType'
- GROUP BY LEFT(TitleID, 2)) b
- WHERE a.TitleId = b.TitleID
- AND a.paSearchConditionID = @paSearchConditionID AND a.Title = 'JobType'
- ----写入TitleDesc
- UPDATE a SET a.TitleDesc = b.Description
- FROM SearchDB..paSearchCount_3 a WITH(NOLOCK), dcJobType b WITH(NOLOCK)
- WHERE a.TitleID = b.ID AND a.paSearchConditionID = @paSearchConditionID
- AND a.Title = 'JobType'
-
- INSERT INTO SearchDB..paSearchCount_3(paSearchConditionID, Title, TitleId, TitleValue)
- SELECT @paSearchConditionID, 'Salary', dcSalaryID, COUNT(*) FROM #Job WITH(NOLOCK)
- GROUP BY dcSalaryID ORDER BY dcSalaryID
- INSERT INTO SearchDB..paSearchCount_3(paSearchConditionID, Title, TitleId, TitleValue)
- SELECT @paSearchConditionID, 'Region', dcRegionID, COUNT(*) FROM #Job WITH(NOLOCK)
- GROUP BY dcRegionID ORDER BY dcRegionID
- ----计算全部地区,2位的数据
- UPDATE a SET a.TitleValue = b.TitleValue
- FROM SearchDB..paSearchCount_3 a WITH(NOLOCK),
- (SELECT LEFT(TitleID, 2) TitleID, SUM(TitleValue) TitleValue
- FROM SearchDB..paSearchCount_3 WITH(NOLOCK)
- WHERE paSearchConditionID = @paSearchConditionID AND Title = 'Region'
- GROUP BY LEFT(TitleID, 2)) b
- WHERE a.TitleId = b.TitleID
- AND a.paSearchConditionID = @paSearchConditionID AND a.Title = 'Region'
- ----计算全部地区,4位的数据
- UPDATE a SET a.TitleValue = b.TitleValue
- FROM SearchDB..paSearchCount_3 a WITH(NOLOCK), (
- SELECT LEFT(TitleID, 4) TitleID, SUM(TitleValue) TitleValue
- FROM SearchDB..paSearchCount_3 WITH(NOLOCK)
- WHERE paSearchConditionID = @paSearchConditionID AND Title = 'Region'
- AND LEN(TitleID) >3
- GROUP BY LEFT(TitleID, 4)) b
- WHERE a.TitleId = b.TitleID
- AND a.paSearchConditionID = @paSearchConditionID AND a.Title = 'Region'
- ----写入TitleDesc
- UPDATE a SET a.TitleDesc = b.Description
- FROM SearchDB..paSearchCount_3 a WITH(NOLOCK), dcRegion b WITH(NOLOCK)
- WHERE a.TitleID = b.ID AND a.paSearchConditionID = @paSearchConditionID
- AND a.Title = 'Region'
- INSERT INTO SearchDB..paSearchCount_3(paSearchConditionID, Title, TitleId, TitleValue)
- SELECT @paSearchConditionID, 'Education', dcEducationID, COUNT(*) FROM #Job WITH(NOLOCK)
- GROUP BY dcEducationID ORDER BY dcEducationID
- --学历 高中、中专、中级合并
- SELECT @TitleValue = SUM(TitleValue) FROM SearchDB..paSearchCount_3 WITH(NOLOCK)
- WHERE paSearchConditionID = @paSearchConditionID
- AND Title = 'Education' AND TitleID IN(2, 3, 4)
- IF @TitleValue IS NOT NULL
- BEGIN
- IF EXISTS(SELECT 'X' FROM SearchDB..paSearchCount_3 WITH(NOLOCK) WHERE paSearchConditionID = @paSearchConditionID AND Title = 'Education' AND TitleID = 2)
- UPDATE SearchDB..paSearchCount_3 SET TitleValue = @TitleValue
- WHERE paSearchConditionID = @paSearchConditionID
- AND Title = 'Education' AND TitleID = 2
- ELSE
- INSERT INTO SearchDB..paSearchCount_3(paSearchConditionID, Title, TitleId, TitleValue) VALUES
- (@paSearchConditionID, 'Education', 2, @TitleValue)
- DELETE FROM SearchDB..paSearchCount_3
- WHERE paSearchConditionID = @paSearchConditionID
- AND Title = 'Education' AND TitleID IN(3, 4)
- END
- INSERT INTO SearchDB..paSearchCount_3(paSearchConditionID, Title, TitleId, TitleValue)
- SELECT @paSearchConditionID, 'Experience', MinExperience, COUNT(*) FROM #Job WITH(NOLOCK)
- GROUP BY MinExperience ORDER BY MinExperience
-
- INSERT INTO SearchDB..paSearchJobID_3(paSearchConditionID, JobId, IsTop)
- SELECT Top 3 @paSearchConditionID,Balance,1
- FROM caOrder WITH(NOLOCK), (SELECT TOP 2000 ID FROM #Job WITH(NOLOCK)) b
- WHERE caOrder.OrderType = 12 AND BeginDate<GETDATE() AND EndDate>GETDATE() AND b.ID = caOrder.Balance ORDER BY OpenDate DESC
- SET @TopRows = @@ROWCOUNT
- INSERT INTO SearchDB..paSearchJobID_3(paSearchConditionID, JobId, IsTop)
- SELECT TOP 2000 @paSearchConditionID, ID, 0 FROM #Job WITH(NOLOCK)
- SET @AllRows = @@ROWCOUNT
- IF @TopRows = 0 AND @AllRows > 100
- UPDATE SearchDB..paSearchJobID_3 SET IsTop = 1
- WHERE paSearchConditionID = @paSearchConditionID
- AND ID IN (SELECT TOP 3 ID FROM SearchDB..paSearchJobID_3 WITH(NOLOCK) WHERE paSearchConditionID = @paSearchConditionID)
- END
- DROP TABLE #Job
- COMMIT
- GetRecordSet:
- BEGIN
- ----返回查询数量
- SELECT ValidJobNumber FROM SearchDB..paSearchCondition WITH(NOLOCK) WHERE ID=@paSearchConditionID
- UPDATE SearchDB..paSearchCondition SET ReuseNumber = ReuseNumber + 1 WHERE ID=@paSearchConditionID
- ----返回20行查询结果
- IF (@TableID = 0)
- BEGIN
- SELECT @MinId = MIN(ID) FROM SearchDB..paSearchJobID_0 WITH(NOLOCK) WHERE paSearchConditionID=@paSearchConditionID
- SET @MinId = @MinId+(@PageNumber-1)*@PageSize
- SELECT TOP 8 a.ID, a.cpMainID, a.caMainID, a.Name as JobName, a.dcJobTypeID,
- a.dcJobTypeIDMinor, a.NeedNumber, a.dcSalaryID, a.EmployType,
- a.dcRegionID, a.Responsibility, a.Demand, a.dcEducationID,
- a.MinExperience, a.MinAge, a.MaxAge, a.IssueDate, a.IssueEND,
- a.IsDelete, a.AddDate, a.RefreshDate,
- a.LastModifyDate, b.Name as cpName, b.dcCompanySizeID,
- b.HasLicence, b.UnLimitedDate, b.BalanceDate, b.Balance,
- b.MemberType, STUFF((SELECT ','+LTRIM(x.dcIndustryid)+',c'+LTRIM(isnull(y.Category,0))
- FROM cpIndustry x,dcIndustry y WHERE x.dcIndustryid = y.id
- AND x.cpMainid = b.id FOR XML PATH('')),1,1,'') cpIndustry,
- c.IsTop, b.IsRefreshed, a.SecondId EnJobID, b.SecondId EnCpMainID
- FROM JobPublish a WITH(NOLOCK), cpMainPublish b WITH(NOLOCK), SearchDB..paSearchJobID_0 c WITH(NOLOCK)
- WHERE a.cpMainID = b.ID AND a.id=c.JobID AND c.paSearchConditionID=@paSearchConditionID
- AND c.ID>=@MinId ORDER BY c.ID, a.ID DESC
- END
- ELSE IF (@TableID = 1)
- BEGIN
- SELECT @MinId = MIN(ID) FROM SearchDB..paSearchJobID_1 WITH(NOLOCK) WHERE paSearchConditionID=@paSearchConditionID
- SET @MinId = @MinId+(@PageNumber-1)*@PageSize
- SELECT TOP 8 a.ID, a.cpMainID, a.caMainID, a.Name as JobName, a.dcJobTypeID,
- a.dcJobTypeIDMinor, a.NeedNumber, a.dcSalaryID, a.EmployType,
- a.dcRegionID, a.Responsibility, a.Demand, a.dcEducationID,
- a.MinExperience, a.MinAge, a.MaxAge, a.IssueDate, a.IssueEND,
- a.IsDelete, a.AddDate, a.RefreshDate,
- a.LastModifyDate, b.Name as cpName, b.dcCompanySizeID,
- b.HasLicence, b.UnLimitedDate, b.BalanceDate, b.Balance,
- b.MemberType, STUFF((SELECT ','+LTRIM(x.dcIndustryid)+',c'+LTRIM(isnull(y.Category,0))
- FROM cpIndustry x,dcIndustry y WHERE x.dcIndustryid = y.id
- AND x.cpMainid = b.id FOR XML PATH('')),1,1,'') cpIndustry,
- c.IsTop, b.IsRefreshed, a.SecondId EnJobID, b.SecondId EnCpMainID
- FROM JobPublish a WITH(NOLOCK), cpMainPublish b WITH(NOLOCK), SearchDB..paSearchJobID_1 c WITH(NOLOCK)
- WHERE a.cpMainID = b.ID AND a.id=c.JobID AND c.paSearchConditionID=@paSearchConditionID
- AND c.ID>=@MinId ORDER BY c.ID, a.ID DESC
- END
- ELSE IF (@TableID = 2)
- BEGIN
- SELECT @MinId = MIN(ID) FROM SearchDB..paSearchJobID_2 WITH(NOLOCK) WHERE paSearchConditionID=@paSearchConditionID
- SET @MinId = @MinId+(@PageNumber-1)*@PageSize
- SELECT TOP 8 a.ID, a.cpMainID, a.caMainID, a.Name as JobName, a.dcJobTypeID,
- a.dcJobTypeIDMinor, a.NeedNumber, a.dcSalaryID, a.EmployType,
- a.dcRegionID, a.Responsibility, a.Demand, a.dcEducationID,
- a.MinExperience, a.MinAge, a.MaxAge, a.IssueDate, a.IssueEND,
- a.IsDelete, a.AddDate, a.RefreshDate,
- a.LastModifyDate, b.Name as cpName, b.dcCompanySizeID,
- b.HasLicence, b.UnLimitedDate, b.BalanceDate, b.Balance,
- b.MemberType, STUFF((SELECT ','+LTRIM(x.dcIndustryid)+',c'+LTRIM(isnull(y.Category,0))
- FROM cpIndustry x,dcIndustry y WHERE x.dcIndustryid = y.id
- AND x.cpMainid = b.id FOR XML PATH('')),1,1,'') cpIndustry,
- c.IsTop, b.IsRefreshed, a.SecondId EnJobID, b.SecondId EnCpMainID
- FROM JobPublish a WITH(NOLOCK), cpMainPublish b WITH(NOLOCK), SearchDB..paSearchJobID_2 c WITH(NOLOCK)
- WHERE a.cpMainID = b.ID AND a.id=c.JobID AND c.paSearchConditionID=@paSearchConditionID
- AND c.ID>=@MinId ORDER BY c.ID, a.ID DESC
- END
- ELSE IF (@TableID = 3)
- BEGIN
- SELECT @MinId = MIN(ID) FROM SearchDB..paSearchJobID_3 WITH(NOLOCK) WHERE paSearchConditionID=@paSearchConditionID
- SET @MinId = @MinId+(@PageNumber-1)*@PageSize
- SELECT TOP 8 a.ID, a.cpMainID, a.caMainID, a.Name as JobName, a.dcJobTypeID,
- a.dcJobTypeIDMinor, a.NeedNumber, a.dcSalaryID, a.EmployType,
- a.dcRegionID, a.Responsibility, a.Demand, a.dcEducationID,
- a.MinExperience, a.MinAge, a.MaxAge, a.IssueDate, a.IssueEND,
- a.IsDelete, a.AddDate, a.RefreshDate,
- a.LastModifyDate, b.Name as cpName, b.dcCompanySizeID,
- b.HasLicence, b.UnLimitedDate, b.BalanceDate, b.Balance,
- b.MemberType, STUFF((SELECT ','+LTRIM(x.dcIndustryid)+',c'+LTRIM(isnull(y.Category,0))
- FROM cpIndustry x,dcIndustry y WHERE x.dcIndustryid = y.id
- AND x.cpMainid = b.id FOR XML PATH('')),1,1,'') cpIndustry,
- c.IsTop, b.IsRefreshed, a.SecondId EnJobID, b.SecondId EnCpMainID
- FROM JobPublish a WITH(NOLOCK), cpMainPublish b WITH(NOLOCK), SearchDB..paSearchJobID_3 c WITH(NOLOCK)
- WHERE a.cpMainID = b.ID AND a.id=c.JobID AND c.paSearchConditionID=@paSearchConditionID
- AND c.ID>=@MinId ORDER BY c.ID, a.ID DESC
- END
- RETURN
- END
- END TRY
- BEGIN CATCH
- ---检查是否已经建立临时表,已经建立则删除
- PRINT 'error'
- PRINT error_Message()
- PRINT error_number()
- PRINT error_line()
- END CATCH
- GO
- /****** Object: StoredProcedure [dbo].[paJobByWeixinSelect1] Script Date: 2018/12/13 19:08:02 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- CREATE PROCEDURE [dbo].[paJobByWeixinSelect1]
- (
- @FromUserName VARCHAR(50),
- @Type INT --0:订阅号关键词查询;10:服务号的关键词查询;11:服务号的周边职位
- )
- AS
- --return
- SET NOCOUNT ON
- BEGIN TRY
- DECLARE @dcRegionID INT,@KeyWord NVARCHAR(20),
- @Lng DECIMAL(8,5),@Lat DECIMAL(8,5),@Distance INT,
- @KeyType TINYINT, @ValidJobNumber INT, @PageNumber SMALLINT
- IF @Type =11
- BEGIN
- SELECT @dcRegionID=dcRegionID,@KeyWord=KeyWord,
- @Lng=Lng,@Lat=Lat,@PageNumber=PageNumber
- FROM wxMessage WITH(NOLOCK) WHERE FromUserName=@FromUserName AND CONTENT='推荐职位'
- END
- ELSE
- BEGIN
- SELECT @dcRegionID=dcRegionID,@KeyWord=KeyWord,
- @Lng=Lng,@Lat=Lat,@PageNumber=PageNumber
- FROM wxMessage WITH(NOLOCK) WHERE FromUserName=@FromUserName
- END
- IF @Type =11 OR @Type = 10
- BEGIN
- UPDATE wxMessage SET PageNumber = 2 WHERE FromUserName=@FromUserName
- END
- ELSE
- BEGIN
- UPDATE wxMessage SET PageNumber=PageNumber+1 WHERE FromUserName=@FromUserName
- END
- --UPDATE wxMessage SET PageNumber=PageNumber+1 WHERE FromUserName=@FromUserName
- SELECT @KeyWord = dbo.SafeSQL(ISNULL(@KeyWord, '')),
- @KeyType = 2,
- @Distance = 5000,
- @PageNumber = ISNULL(@PageNumber, 1),
- @dcRegionID = ISNULL(@dcRegionID, 0),
- @Lng = ISNULL(@Lng, 0),
- @Lat = ISNULL(@Lat, 0)
- IF @dcRegionID = 0 AND @Lng = 0 AND @Lat = 0
- RETURN
- DECLARE @paSearchConditionID AS INT,
- @MinId AS INT,
- @PageSize AS TINYINT,
- @TableID AS TINYINT
- IF @Type =11 OR @Type =10
- BEGIN
- SELECT @paSearchConditionID = 0, @PageSize = 5 --每页的行数
- END
- ELSE
- BEGIN
- SELECT @paSearchConditionID = 0, @PageSize = 8 --每页的行数
- END
- --SELECT @paSearchConditionID = 0, @PageSize = 8 --每页的行数
-
- ----搜索60分钟前的数据
- SELECT TOP 1 @paSearchConditionID=ID FROM SearchDB..paSearchCondition WITH(NOLOCK)
- WHERE JobType=''
- AND JobPlace=@dcRegionID AND ISNULL(Industry,'')='' AND ISNULL(Education,'')=''
- AND ISNULL(Experience,'')='' AND ISNULL(Salary,'')='' AND ISNULL(IsNegotiable,'')=''
- AND ISNULL(EmployType,'')='' AND KeyWord=@KeyWord AND KeyType=@KeyType
- AND ISNULL(CompanySizeID,'')='' AND Lng=@Lng AND Lat=@Lat
- ORDER BY ID DESC
- IF ISNULL(@paSearchConditionID, 0) = 0
- BEGIN
- GOTO SelectReset --无数据,重新搜索
- END
- ELSE
- BEGIN
- SELECT @TableID = @paSearchConditionID % 4
- GOTO GetRecordSet --从临时结果中提取数据
- END
- SelectReset:
- --从job中搜索数据
- BEGIN TRAN
- DECLARE @SQL AS VARCHAR(8000)
- DECLARE @WHERE AS VARCHAR(8000)
- DECLARE @FROM AS VARCHAR(1000)
- ----记录查询条件
- INSERT INTO SearchDB..paSearchCondition(SessionID, LogTime, JobType, JobPlace, Industry, Education, Experience,
- Salary, IsNegotiable, EmployType, CompanySizeID, KeyWord, KeyType, ReuseNumber, Lng, Lat, Distance)
- VALUES(1, GETDATE(), '', @dcRegionID, '', '', '', '', '', '', '', @KeyWord, @KeyType, 0, @Lng, @Lat, @Distance)
- SET @paSearchConditionID = @@IDENTITY
- SELECT @TableID = @paSearchConditionID % 4
- ----建立临时表
- CREATE TABLE #Job(
- RowID INT IDENTITY(1, 1),
- ID INT NOT NULL,
- dcJobTypeID SMALLINT NOT NULL,
- dcJobTypeIDMinor SMALLINT NULL,
- dcSalaryID TINYINT NOT NULL,
- dcRegionID VARCHAR(6) NULL,
- dcEducationID TINYINT NOT NULL,
- MinExperience TINYINT NOT NULL,
- RefreshDate SMALLDATETIME NULL
- )
- ------刷新时间,根据刷新时间编号计算
- ----生成插入临时表的Sql语句
- SET @SQL='
- INSERT INTO #Job
- SELECT a.ID, a.dcJobTypeID,
- a.dcJobTypeIDMinor, a.dcSalaryID,
- a.dcRegionID, a.dcEducationID, a.MinExperience,
- a.IssueDate'
- SET @FROM = '
- FROM JobPublish a WITH(NOLOCK)
- INNER JOIN cpMainPublish b WITH(NOLOCK) ON a.cpMainID=b.ID'
- ----职位有效,单位新有效
- SET @WHERE = '
- WHERE a.Valid = 1
- AND b.Valid = 1'
- ----需要增加全文索引的关键字查询
- IF @KeyWord LIKE '% %'
- BEGIN
- SET @KeyWord = REPLACE(@KeyWord, ' ', ' ')
- SET @KeyWord = REPLACE(@KeyWord, ' ', ' ')
- SET @KeyWord = REPLACE(@KeyWord, ' ', ' ')
- SET @KeyWord = '"' + REPLACE(@KeyWord, ' ', '" OR "') + '"'
- END
- IF LEN(@KeyWord) > 0
- BEGIN
- IF @KeyType = 2
- SET @FROM = @FROM + '
- INNER JOIN CONTAINSTABLE(JobPublish, *, ''' + @KeyWord + ''', 1000000) AS KeyJob
- ON a.ID = KeyJob.[Key]'
- END
- ---地区
- IF @dcRegionID > 0
- SET @WHERE = @WHERE + '
- AND a.dcRegionID Like ''' + CONVERT(VARCHAR(6),@dcRegionID) + '%'''
- IF @Lng > 0 AND @Lat > 0
- BEGIN
- DECLARE @Degree AS DECIMAL(8,5),@LBLng AS DECIMAL(8,5),@LBLat AS DECIMAL(8,5),
- @RTLng AS DECIMAL(8,5),@RTLat AS DECIMAL(8,5)
- SET @Degree = @Distance / 100000.0;
- SET @LBLng = @Lng - @Degree
- SET @LBLat = @Lat - @Degree
- SET @RTLng = @Lng + @Degree
- SET @RTLat = @Lat + @Degree
- SET @WHERE = @WHERE + '
- AND a.Lng BETWEEN ' + CONVERT(VARCHAR,@LBLng) + ' AND ' + CONVERT(VARCHAR,@RTLng) + '
- AND a.Lat BETWEEN ' + CONVERT(VARCHAR,@LBLat) + ' AND ' + CONVERT(VARCHAR,@RTLat)
- END
- SET @SQL = @SQL + @FROM + @WHERE
-
- SET @SQL=@SQL + ' ORDER BY a.RefreshDate DESC, a.ID'
- ----把符合条件的职位全部列出
- --PRINT @SQL
- EXEC(@SQL)
-
- SET @ValidJobNumber = @@ROWCOUNT
- ----记录查询结果总数
- UPDATE SearchDB..paSearchCondition SET ValidJobNumber=@ValidJobNumber, SQl=@SQL WHERE ID=@paSearchConditionID
-
- ----插入JobType数据
- DECLARE @TitleValue AS INT, @TopRows AS INT, @AllRows AS INT
- IF (@TableID = 0)
- BEGIN
- INSERT INTO SearchDB..paSearchCount_0(paSearchConditionID, Title, TitleId, TitleValue)
- SELECT @paSearchConditionID, 'JobType', dcJobTypeID, COUNT(*) FROM #Job WITH(NOLOCK)
- GROUP BY dcJobTypeID ORDER BY dcJobTypeID
- ----计算全部某职位类别,2, 4位的数据
- UPDATE a SET a.TitleValue = b.TitleValue
- FROM SearchDB..paSearchCount_0 a WITH(NOLOCK),
- (SELECT LEFT(TitleID, 2) TitleID, SUM(TitleValue) TitleValue
- FROM SearchDB..paSearchCount_0 WITH(NOLOCK)
- WHERE paSearchConditionID = @paSearchConditionID AND Title = 'JobType'
- GROUP BY LEFT(TitleID, 2)) b
- WHERE a.TitleId = b.TitleID
- AND a.paSearchConditionID = @paSearchConditionID AND a.Title = 'JobType'
- ----写入TitleDesc
- UPDATE a SET a.TitleDesc = b.Description
- FROM SearchDB..paSearchCount_0 a WITH(NOLOCK), dcJobType b WITH(NOLOCK)
- WHERE a.TitleID = b.ID AND a.paSearchConditionID = @paSearchConditionID
- AND a.Title = 'JobType'
-
- INSERT INTO SearchDB..paSearchCount_0(paSearchConditionID, Title, TitleId, TitleValue)
- SELECT @paSearchConditionID, 'Salary', dcSalaryID, COUNT(*) FROM #Job WITH(NOLOCK)
- GROUP BY dcSalaryID ORDER BY dcSalaryID
- INSERT INTO SearchDB..paSearchCount_0(paSearchConditionID, Title, TitleId, TitleValue)
- SELECT @paSearchConditionID, 'Region', dcRegionID, COUNT(*) FROM #Job WITH(NOLOCK)
- GROUP BY dcRegionID ORDER BY dcRegionID
- ----计算全部地区,2位的数据
- UPDATE a SET a.TitleValue = b.TitleValue
- FROM SearchDB..paSearchCount_0 a WITH(NOLOCK),
- (SELECT LEFT(TitleID, 2) TitleID, SUM(TitleValue) TitleValue
- FROM SearchDB..paSearchCount_0 WITH(NOLOCK)
- WHERE paSearchConditionID = @paSearchConditionID AND Title = 'Region'
- GROUP BY LEFT(TitleID, 2)) b
- WHERE a.TitleId = b.TitleID
- AND a.paSearchConditionID = @paSearchConditionID AND a.Title = 'Region'
- ----计算全部地区,4位的数据
- UPDATE a SET a.TitleValue = b.TitleValue
- FROM SearchDB..paSearchCount_0 a WITH(NOLOCK), (
- SELECT LEFT(TitleID, 4) TitleID, SUM(TitleValue) TitleValue
- FROM SearchDB..paSearchCount_0 WITH(NOLOCK)
- WHERE paSearchConditionID = @paSearchConditionID AND Title = 'Region'
- AND LEN(TitleID) >3
- GROUP BY LEFT(TitleID, 4)) b
- WHERE a.TitleId = b.TitleID
- AND a.paSearchConditionID = @paSearchConditionID AND a.Title = 'Region'
- ----写入TitleDesc
- UPDATE a SET a.TitleDesc = b.Description
- FROM SearchDB..paSearchCount_0 a WITH(NOLOCK), dcRegion b WITH(NOLOCK)
- WHERE a.TitleID = b.ID AND a.paSearchConditionID = @paSearchConditionID
- AND a.Title = 'Region'
- INSERT INTO SearchDB..paSearchCount_0(paSearchConditionID, Title, TitleId, TitleValue)
- SELECT @paSearchConditionID, 'Education', dcEducationID, COUNT(*) FROM #Job WITH(NOLOCK)
- GROUP BY dcEducationID ORDER BY dcEducationID
- --学历 高中、中专、中级合并
- SELECT @TitleValue = SUM(TitleValue) FROM SearchDB..paSearchCount_0 WITH(NOLOCK)
- WHERE paSearchConditionID = @paSearchConditionID
- AND Title = 'Education' AND TitleID IN(2, 3, 4)
- IF @TitleValue IS NOT NULL
- BEGIN
- IF EXISTS(SELECT 'X' FROM SearchDB..paSearchCount_0 WITH(NOLOCK) WHERE paSearchConditionID = @paSearchConditionID AND Title = 'Education' AND TitleID = 2)
- UPDATE SearchDB..paSearchCount_0 SET TitleValue = @TitleValue
- WHERE paSearchConditionID = @paSearchConditionID
- AND Title = 'Education' AND TitleID = 2
- ELSE
- INSERT INTO SearchDB..paSearchCount_0(paSearchConditionID, Title, TitleId, TitleValue) VALUES
- (@paSearchConditionID, 'Education', 2, @TitleValue)
- DELETE FROM SearchDB..paSearchCount_0
- WHERE paSearchConditionID = @paSearchConditionID
- AND Title = 'Education' AND TitleID IN(3, 4)
- END
- INSERT INTO SearchDB..paSearchCount_0(paSearchConditionID, Title, TitleId, TitleValue)
- SELECT @paSearchConditionID, 'Experience', MinExperience, COUNT(*) FROM #Job WITH(NOLOCK)
- GROUP BY MinExperience ORDER BY MinExperience
-
- INSERT INTO SearchDB..paSearchJobID_0(paSearchConditionID, JobId, IsTop)
- SELECT Top 3 @paSearchConditionID,Balance,1
- FROM caOrder WITH(NOLOCK), (SELECT TOP 2000 ID FROM #Job WITH(NOLOCK)) b
- WHERE caOrder.OrderType = 12 AND BeginDate<GETDATE() AND EndDate>GETDATE() AND b.ID = caOrder.Balance ORDER BY OpenDate DESC
- SET @TopRows = @@ROWCOUNT
- INSERT INTO SearchDB..paSearchJobID_0(paSearchConditionID, JobId, IsTop)
- SELECT TOP 2000 @paSearchConditionID, ID, 0 FROM #Job WITH(NOLOCK)
- SET @AllRows = @@ROWCOUNT
- IF @TopRows = 0 AND @AllRows > 100
- UPDATE SearchDB..paSearchJobID_0 SET IsTop = 1
- WHERE paSearchConditionID = @paSearchConditionID
- AND ID IN (SELECT TOP 3 ID FROM SearchDB..paSearchJobID_0 WITH(NOLOCK) WHERE paSearchConditionID = @paSearchConditionID)
- END
- ELSE IF (@TableId = 1)
- BEGIN
- INSERT INTO SearchDB..paSearchCount_1(paSearchConditionID, Title, TitleId, TitleValue)
- SELECT @paSearchConditionID, 'JobType', dcJobTypeID, COUNT(*) FROM #Job WITH(NOLOCK)
- GROUP BY dcJobTypeID ORDER BY dcJobTypeID
- ----计算全部某职位类别,2, 4位的数据
- UPDATE a SET a.TitleValue = b.TitleValue
- FROM SearchDB..paSearchCount_1 a WITH(NOLOCK),
- (SELECT LEFT(TitleID, 2) TitleID, SUM(TitleValue) TitleValue
- FROM SearchDB..paSearchCount_1 WITH(NOLOCK)
- WHERE paSearchConditionID = @paSearchConditionID AND Title = 'JobType'
- GROUP BY LEFT(TitleID, 2)) b
- WHERE a.TitleId = b.TitleID
- AND a.paSearchConditionID = @paSearchConditionID AND a.Title = 'JobType'
- ----写入TitleDesc
- UPDATE a SET a.TitleDesc = b.Description
- FROM SearchDB..paSearchCount_1 a WITH(NOLOCK), dcJobType b WITH(NOLOCK)
- WHERE a.TitleID = b.ID AND a.paSearchConditionID = @paSearchConditionID
- AND a.Title = 'JobType'
-
- INSERT INTO SearchDB..paSearchCount_1(paSearchConditionID, Title, TitleId, TitleValue)
- SELECT @paSearchConditionID, 'Salary', dcSalaryID, COUNT(*) FROM #Job WITH(NOLOCK)
- GROUP BY dcSalaryID ORDER BY dcSalaryID
- INSERT INTO SearchDB..paSearchCount_1(paSearchConditionID, Title, TitleId, TitleValue)
- SELECT @paSearchConditionID, 'Region', dcRegionID, COUNT(*) FROM #Job WITH(NOLOCK)
- GROUP BY dcRegionID ORDER BY dcRegionID
- ----计算全部地区,2位的数据
- UPDATE a SET a.TitleValue = b.TitleValue
- FROM SearchDB..paSearchCount_1 a WITH(NOLOCK),
- (SELECT LEFT(TitleID, 2) TitleID, SUM(TitleValue) TitleValue
- FROM SearchDB..paSearchCount_1 WITH(NOLOCK)
- WHERE paSearchConditionID = @paSearchConditionID AND Title = 'Region'
- GROUP BY LEFT(TitleID, 2)) b
- WHERE a.TitleId = b.TitleID
- AND a.paSearchConditionID = @paSearchConditionID AND a.Title = 'Region'
- ----计算全部地区,4位的数据
- UPDATE a SET a.TitleValue = b.TitleValue
- FROM SearchDB..paSearchCount_1 a WITH(NOLOCK), (
- SELECT LEFT(TitleID, 4) TitleID, SUM(TitleValue) TitleValue
- FROM SearchDB..paSearchCount_1 WITH(NOLOCK)
- WHERE paSearchConditionID = @paSearchConditionID AND Title = 'Region'
- AND LEN(TitleID) >3
- GROUP BY LEFT(TitleID, 4)) b
- WHERE a.TitleId = b.TitleID
- AND a.paSearchConditionID = @paSearchConditionID AND a.Title = 'Region'
- ----写入TitleDesc
- UPDATE a SET a.TitleDesc = b.Description
- FROM SearchDB..paSearchCount_1 a WITH(NOLOCK), dcRegion b WITH(NOLOCK)
- WHERE a.TitleID = b.ID AND a.paSearchConditionID = @paSearchConditionID
- AND a.Title = 'Region'
- INSERT INTO SearchDB..paSearchCount_1(paSearchConditionID, Title, TitleId, TitleValue)
- SELECT @paSearchConditionID, 'Education', dcEducationID, COUNT(*) FROM #Job WITH(NOLOCK)
- GROUP BY dcEducationID ORDER BY dcEducationID
- --学历 高中、中专、中级合并
- SELECT @TitleValue = SUM(TitleValue) FROM SearchDB..paSearchCount_1 WITH(NOLOCK)
- WHERE paSearchConditionID = @paSearchConditionID
- AND Title = 'Education' AND TitleID IN(2, 3, 4)
- IF @TitleValue IS NOT NULL
- BEGIN
- IF EXISTS(SELECT 'X' FROM SearchDB..paSearchCount_1 WITH(NOLOCK) WHERE paSearchConditionID = @paSearchConditionID AND Title = 'Education' AND TitleID = 2)
- UPDATE SearchDB..paSearchCount_1 SET TitleValue = @TitleValue
- WHERE paSearchConditionID = @paSearchConditionID
- AND Title = 'Education' AND TitleID = 2
- ELSE
- INSERT INTO SearchDB..paSearchCount_1(paSearchConditionID, Title, TitleId, TitleValue) VALUES
- (@paSearchConditionID, 'Education', 2, @TitleValue)
- DELETE FROM SearchDB..paSearchCount_1
- WHERE paSearchConditionID = @paSearchConditionID
- AND Title = 'Education' AND TitleID IN(3, 4)
- END
- INSERT INTO SearchDB..paSearchCount_1(paSearchConditionID, Title, TitleId, TitleValue)
- SELECT @paSearchConditionID, 'Experience', MinExperience, COUNT(*) FROM #Job WITH(NOLOCK)
- GROUP BY MinExperience ORDER BY MinExperience
-
- INSERT INTO SearchDB..paSearchJobID_1(paSearchConditionID, JobId, IsTop)
- SELECT Top 3 @paSearchConditionID,Balance,1
- FROM caOrder WITH(NOLOCK), (SELECT TOP 2000 ID FROM #Job WITH(NOLOCK)) b
- WHERE caOrder.OrderType = 12 AND BeginDate<GETDATE() AND EndDate>GETDATE() AND b.ID = caOrder.Balance ORDER BY OpenDate DESC
- SET @TopRows = @@ROWCOUNT
- INSERT INTO SearchDB..paSearchJobID_1(paSearchConditionID, JobId, IsTop)
- SELECT TOP 2000 @paSearchConditionID, ID, 0 FROM #Job WITH(NOLOCK)
- SET @AllRows = @@ROWCOUNT
- IF @TopRows = 0 AND @AllRows > 100
- UPDATE SearchDB..paSearchJobID_1 SET IsTop = 1
- WHERE paSearchConditionID = @paSearchConditionID
- AND ID IN (SELECT TOP 3 ID FROM SearchDB..paSearchJobID_1 WITH(NOLOCK) WHERE paSearchConditionID = @paSearchConditionID)
- END
- ELSE IF (@TableId = 2)
- BEGIN
- INSERT INTO SearchDB..paSearchCount_2(paSearchConditionID, Title, TitleId, TitleValue)
- SELECT @paSearchConditionID, 'JobType', dcJobTypeID, COUNT(*) FROM #Job WITH(NOLOCK)
- GROUP BY dcJobTypeID ORDER BY dcJobTypeID
- ----计算全部某职位类别,2, 4位的数据
- UPDATE a SET a.TitleValue = b.TitleValue
- FROM SearchDB..paSearchCount_2 a WITH(NOLOCK),
- (SELECT LEFT(TitleID, 2) TitleID, SUM(TitleValue) TitleValue
- FROM SearchDB..paSearchCount_2 WITH(NOLOCK)
- WHERE paSearchConditionID = @paSearchConditionID AND Title = 'JobType'
- GROUP BY LEFT(TitleID, 2)) b
- WHERE a.TitleId = b.TitleID
- AND a.paSearchConditionID = @paSearchConditionID AND a.Title = 'JobType'
- ----写入TitleDesc
- UPDATE a SET a.TitleDesc = b.Description
- FROM SearchDB..paSearchCount_2 a WITH(NOLOCK), dcJobType b WITH(NOLOCK)
- WHERE a.TitleID = b.ID AND a.paSearchConditionID = @paSearchConditionID
- AND a.Title = 'JobType'
-
- INSERT INTO SearchDB..paSearchCount_2(paSearchConditionID, Title, TitleId, TitleValue)
- SELECT @paSearchConditionID, 'Salary', dcSalaryID, COUNT(*) FROM #Job WITH(NOLOCK)
- GROUP BY dcSalaryID ORDER BY dcSalaryID
- INSERT INTO SearchDB..paSearchCount_2(paSearchConditionID, Title, TitleId, TitleValue)
- SELECT @paSearchConditionID, 'Region', dcRegionID, COUNT(*) FROM #Job WITH(NOLOCK)
- GROUP BY dcRegionID ORDER BY dcRegionID
- ----计算全部地区,2位的数据
- UPDATE a SET a.TitleValue = b.TitleValue
- FROM SearchDB..paSearchCount_2 a WITH(NOLOCK),
- (SELECT LEFT(TitleID, 2) TitleID, SUM(TitleValue) TitleValue
- FROM SearchDB..paSearchCount_2 WITH(NOLOCK)
- WHERE paSearchConditionID = @paSearchConditionID AND Title = 'Region'
- GROUP BY LEFT(TitleID, 2)) b
- WHERE a.TitleId = b.TitleID
- AND a.paSearchConditionID = @paSearchConditionID AND a.Title = 'Region'
- ----计算全部地区,4位的数据
- UPDATE a SET a.TitleValue = b.TitleValue
- FROM SearchDB..paSearchCount_2 a WITH(NOLOCK), (
- SELECT LEFT(TitleID, 4) TitleID, SUM(TitleValue) TitleValue
- FROM SearchDB..paSearchCount_2 WITH(NOLOCK)
- WHERE paSearchConditionID = @paSearchConditionID AND Title = 'Region'
- AND LEN(TitleID) >3
- GROUP BY LEFT(TitleID, 4)) b
- WHERE a.TitleId = b.TitleID
- AND a.paSearchConditionID = @paSearchConditionID AND a.Title = 'Region'
- ----写入TitleDesc
- UPDATE a SET a.TitleDesc = b.Description
- FROM SearchDB..paSearchCount_2 a WITH(NOLOCK), dcRegion b WITH(NOLOCK)
- WHERE a.TitleID = b.ID AND a.paSearchConditionID = @paSearchConditionID
- AND a.Title = 'Region'
- INSERT INTO SearchDB..paSearchCount_2(paSearchConditionID, Title, TitleId, TitleValue)
- SELECT @paSearchConditionID, 'Education', dcEducationID, COUNT(*) FROM #Job WITH(NOLOCK)
- GROUP BY dcEducationID ORDER BY dcEducationID
- --学历 高中、中专、中级合并
- SELECT @TitleValue = SUM(TitleValue) FROM SearchDB..paSearchCount_2 WITH(NOLOCK)
- WHERE paSearchConditionID = @paSearchConditionID
- AND Title = 'Education' AND TitleID IN(2, 3, 4)
- IF @TitleValue IS NOT NULL
- BEGIN
- IF EXISTS(SELECT 'X' FROM SearchDB..paSearchCount_2 WITH(NOLOCK) WHERE paSearchConditionID = @paSearchConditionID AND Title = 'Education' AND TitleID = 2)
- UPDATE SearchDB..paSearchCount_2 SET TitleValue = @TitleValue
- WHERE paSearchConditionID = @paSearchConditionID
- AND Title = 'Education' AND TitleID = 2
- ELSE
- INSERT INTO SearchDB..paSearchCount_2(paSearchConditionID, Title, TitleId, TitleValue) VALUES
- (@paSearchConditionID, 'Education', 2, @TitleValue)
- DELETE FROM SearchDB..paSearchCount_2
- WHERE paSearchConditionID = @paSearchConditionID
- AND Title = 'Education' AND TitleID IN(3, 4)
- END
- INSERT INTO SearchDB..paSearchCount_2(paSearchConditionID, Title, TitleId, TitleValue)
- SELECT @paSearchConditionID, 'Experience', MinExperience, COUNT(*) FROM #Job WITH(NOLOCK)
- GROUP BY MinExperience ORDER BY MinExperience
- INSERT INTO SearchDB..paSearchJobID_2(paSearchConditionID, JobId, IsTop)
- SELECT Top 3 @paSearchConditionID,Balance,1
- FROM caOrder WITH(NOLOCK), (SELECT TOP 2000 ID FROM #Job WITH(NOLOCK)) b
- WHERE caOrder.OrderType = 12 AND BeginDate<GETDATE() AND EndDate>GETDATE() AND b.ID = caOrder.Balance ORDER BY OpenDate DESC
- SET @TopRows = @@ROWCOUNT
- INSERT INTO SearchDB..paSearchJobID_2(paSearchConditionID, JobId, IsTop)
- SELECT TOP 2000 @paSearchConditionID, ID, 0 FROM #Job WITH(NOLOCK)
- SET @AllRows = @@ROWCOUNT
- IF @TopRows = 0 AND @AllRows > 100
- UPDATE SearchDB..paSearchJobID_2 SET IsTop = 1
- WHERE paSearchConditionID = @paSearchConditionID
- AND ID IN (SELECT TOP 3 ID FROM SearchDB..paSearchJobID_2 WITH(NOLOCK) WHERE paSearchConditionID = @paSearchConditionID)
- END
- ELSE IF (@TableId = 3)
- BEGIN
- INSERT INTO SearchDB..paSearchCount_3(paSearchConditionID, Title, TitleId, TitleValue)
- SELECT @paSearchConditionID, 'JobType', dcJobTypeID, COUNT(*) FROM #Job WITH(NOLOCK)
- GROUP BY dcJobTypeID ORDER BY dcJobTypeID
- ----计算全部某职位类别,2, 4位的数据
- UPDATE a SET a.TitleValue = b.TitleValue
- FROM SearchDB..paSearchCount_3 a WITH(NOLOCK),
- (SELECT LEFT(TitleID, 2) TitleID, SUM(TitleValue) TitleValue
- FROM SearchDB..paSearchCount_3 WITH(NOLOCK)
- WHERE paSearchConditionID = @paSearchConditionID AND Title = 'JobType'
- GROUP BY LEFT(TitleID, 2)) b
- WHERE a.TitleId = b.TitleID
- AND a.paSearchConditionID = @paSearchConditionID AND a.Title = 'JobType'
- ----写入TitleDesc
- UPDATE a SET a.TitleDesc = b.Description
- FROM SearchDB..paSearchCount_3 a WITH(NOLOCK), dcJobType b WITH(NOLOCK)
- WHERE a.TitleID = b.ID AND a.paSearchConditionID = @paSearchConditionID
- AND a.Title = 'JobType'
-
- INSERT INTO SearchDB..paSearchCount_3(paSearchConditionID, Title, TitleId, TitleValue)
- SELECT @paSearchConditionID, 'Salary', dcSalaryID, COUNT(*) FROM #Job WITH(NOLOCK)
- GROUP BY dcSalaryID ORDER BY dcSalaryID
- INSERT INTO SearchDB..paSearchCount_3(paSearchConditionID, Title, TitleId, TitleValue)
- SELECT @paSearchConditionID, 'Region', dcRegionID, COUNT(*) FROM #Job WITH(NOLOCK)
- GROUP BY dcRegionID ORDER BY dcRegionID
- ----计算全部地区,2位的数据
- UPDATE a SET a.TitleValue = b.TitleValue
- FROM SearchDB..paSearchCount_3 a WITH(NOLOCK),
- (SELECT LEFT(TitleID, 2) TitleID, SUM(TitleValue) TitleValue
- FROM SearchDB..paSearchCount_3 WITH(NOLOCK)
- WHERE paSearchConditionID = @paSearchConditionID AND Title = 'Region'
- GROUP BY LEFT(TitleID, 2)) b
- WHERE a.TitleId = b.TitleID
- AND a.paSearchConditionID = @paSearchConditionID AND a.Title = 'Region'
- ----计算全部地区,4位的数据
- UPDATE a SET a.TitleValue = b.TitleValue
- FROM SearchDB..paSearchCount_3 a WITH(NOLOCK), (
- SELECT LEFT(TitleID, 4) TitleID, SUM(TitleValue) TitleValue
- FROM SearchDB..paSearchCount_3 WITH(NOLOCK)
- WHERE paSearchConditionID = @paSearchConditionID AND Title = 'Region'
- AND LEN(TitleID) >3
- GROUP BY LEFT(TitleID, 4)) b
- WHERE a.TitleId = b.TitleID
- AND a.paSearchConditionID = @paSearchConditionID AND a.Title = 'Region'
- ----写入TitleDesc
- UPDATE a SET a.TitleDesc = b.Description
- FROM SearchDB..paSearchCount_3 a WITH(NOLOCK), dcRegion b WITH(NOLOCK)
- WHERE a.TitleID = b.ID AND a.paSearchConditionID = @paSearchConditionID
- AND a.Title = 'Region'
- INSERT INTO SearchDB..paSearchCount_3(paSearchConditionID, Title, TitleId, TitleValue)
- SELECT @paSearchConditionID, 'Education', dcEducationID, COUNT(*) FROM #Job WITH(NOLOCK)
- GROUP BY dcEducationID ORDER BY dcEducationID
- --学历 高中、中专、中级合并
- SELECT @TitleValue = SUM(TitleValue) FROM SearchDB..paSearchCount_3 WITH(NOLOCK)
- WHERE paSearchConditionID = @paSearchConditionID
- AND Title = 'Education' AND TitleID IN(2, 3, 4)
- IF @TitleValue IS NOT NULL
- BEGIN
- IF EXISTS(SELECT 'X' FROM SearchDB..paSearchCount_3 WITH(NOLOCK) WHERE paSearchConditionID = @paSearchConditionID AND Title = 'Education' AND TitleID = 2)
- UPDATE SearchDB..paSearchCount_3 SET TitleValue = @TitleValue
- WHERE paSearchConditionID = @paSearchConditionID
- AND Title = 'Education' AND TitleID = 2
- ELSE
- INSERT INTO SearchDB..paSearchCount_3(paSearchConditionID, Title, TitleId, TitleValue) VALUES
- (@paSearchConditionID, 'Education', 2, @TitleValue)
- DELETE FROM SearchDB..paSearchCount_3
- WHERE paSearchConditionID = @paSearchConditionID
- AND Title = 'Education' AND TitleID IN(3, 4)
- END
- INSERT INTO SearchDB..paSearchCount_3(paSearchConditionID, Title, TitleId, TitleValue)
- SELECT @paSearchConditionID, 'Experience', MinExperience, COUNT(*) FROM #Job WITH(NOLOCK)
- GROUP BY MinExperience ORDER BY MinExperience
-
- INSERT INTO SearchDB..paSearchJobID_3(paSearchConditionID, JobId, IsTop)
- SELECT Top 3 @paSearchConditionID,Balance,1
- FROM caOrder WITH(NOLOCK), (SELECT TOP 2000 ID FROM #Job WITH(NOLOCK)) b
- WHERE caOrder.OrderType = 12 AND BeginDate<GETDATE() AND EndDate>GETDATE() AND b.ID = caOrder.Balance ORDER BY OpenDate DESC
- SET @TopRows = @@ROWCOUNT
- INSERT INTO SearchDB..paSearchJobID_3(paSearchConditionID, JobId, IsTop)
- SELECT TOP 2000 @paSearchConditionID, ID, 0 FROM #Job WITH(NOLOCK)
- SET @AllRows = @@ROWCOUNT
- IF @TopRows = 0 AND @AllRows > 100
- UPDATE SearchDB..paSearchJobID_3 SET IsTop = 1
- WHERE paSearchConditionID = @paSearchConditionID
- AND ID IN (SELECT TOP 3 ID FROM SearchDB..paSearchJobID_3 WITH(NOLOCK) WHERE paSearchConditionID = @paSearchConditionID)
- END
- DROP TABLE #Job
- COMMIT
- GetRecordSet:
- BEGIN
- ----返回查询数量
- SELECT ValidJobNumber FROM SearchDB..paSearchCondition WITH(NOLOCK) WHERE ID=@paSearchConditionID
- UPDATE SearchDB..paSearchCondition SET ReuseNumber = ReuseNumber + 1 WHERE ID=@paSearchConditionID
- ----返回20行查询结果
- IF (@TableID = 0)
- BEGIN
- SELECT @MinId = MIN(ID) FROM SearchDB..paSearchJobID_0 WITH(NOLOCK) WHERE paSearchConditionID=@paSearchConditionID
- SET @MinId = @MinId+(@PageNumber-1)*@PageSize
- SELECT TOP 8 a.ID, a.cpMainID, a.caMainID, a.Name as JobName, a.dcJobTypeID,
- a.dcJobTypeIDMinor, a.NeedNumber, a.dcSalaryID, a.EmployType,
- a.dcRegionID, a.Responsibility, a.Demand, a.dcEducationID,
- a.MinExperience, a.MinAge, a.MaxAge, a.IssueDate, a.IssueEND,
- a.IsDelete, a.AddDate, a.RefreshDate,
- a.LastModifyDate, b.Name as cpName, b.dcCompanySizeID,
- b.HasLicence, b.UnLimitedDate, b.BalanceDate, b.Balance,
- b.MemberType, STUFF((SELECT ','+LTRIM(x.dcIndustryid)+',c'+LTRIM(isnull(y.Category,0))
- FROM cpIndustry x,dcIndustry y WHERE x.dcIndustryid = y.id
- AND x.cpMainid = b.id FOR XML PATH('')),1,1,'') cpIndustry,
- c.IsTop, b.IsRefreshed, a.SecondId EnJobID, b.SecondId EnCpMainID
- FROM JobPublish a WITH(NOLOCK), cpMainPublish b WITH(NOLOCK), SearchDB..paSearchJobID_0 c WITH(NOLOCK)
- WHERE a.cpMainID = b.ID AND a.id=c.JobID AND c.paSearchConditionID=@paSearchConditionID
- AND c.ID>=@MinId ORDER BY c.ID, a.ID DESC
- END
- ELSE IF (@TableID = 1)
- BEGIN
- SELECT @MinId = MIN(ID) FROM SearchDB..paSearchJobID_1 WITH(NOLOCK) WHERE paSearchConditionID=@paSearchConditionID
- SET @MinId = @MinId+(@PageNumber-1)*@PageSize
- SELECT TOP 8 a.ID, a.cpMainID, a.caMainID, a.Name as JobName, a.dcJobTypeID,
- a.dcJobTypeIDMinor, a.NeedNumber, a.dcSalaryID, a.EmployType,
- a.dcRegionID, a.Responsibility, a.Demand, a.dcEducationID,
- a.MinExperience, a.MinAge, a.MaxAge, a.IssueDate, a.IssueEND,
- a.IsDelete, a.AddDate, a.RefreshDate,
- a.LastModifyDate, b.Name as cpName, b.dcCompanySizeID,
- b.HasLicence, b.UnLimitedDate, b.BalanceDate, b.Balance,
- b.MemberType, STUFF((SELECT ','+LTRIM(x.dcIndustryid)+',c'+LTRIM(isnull(y.Category,0))
- FROM cpIndustry x,dcIndustry y WHERE x.dcIndustryid = y.id
- AND x.cpMainid = b.id FOR XML PATH('')),1,1,'') cpIndustry,
- c.IsTop, b.IsRefreshed, a.SecondId EnJobID, b.SecondId EnCpMainID
- FROM JobPublish a WITH(NOLOCK), cpMainPublish b WITH(NOLOCK), SearchDB..paSearchJobID_1 c WITH(NOLOCK)
- WHERE a.cpMainID = b.ID AND a.id=c.JobID AND c.paSearchConditionID=@paSearchConditionID
- AND c.ID>=@MinId ORDER BY c.ID, a.ID DESC
- END
- ELSE IF (@TableID = 2)
- BEGIN
- SELECT @MinId = MIN(ID) FROM SearchDB..paSearchJobID_2 WITH(NOLOCK) WHERE paSearchConditionID=@paSearchConditionID
- SET @MinId = @MinId+(@PageNumber-1)*@PageSize
- SELECT TOP 8 a.ID, a.cpMainID, a.caMainID, a.Name as JobName, a.dcJobTypeID,
- a.dcJobTypeIDMinor, a.NeedNumber, a.dcSalaryID, a.EmployType,
- a.dcRegionID, a.Responsibility, a.Demand, a.dcEducationID,
- a.MinExperience, a.MinAge, a.MaxAge, a.IssueDate, a.IssueEND,
- a.IsDelete, a.AddDate, a.RefreshDate,
- a.LastModifyDate, b.Name as cpName, b.dcCompanySizeID,
- b.HasLicence, b.UnLimitedDate, b.BalanceDate, b.Balance,
- b.MemberType, STUFF((SELECT ','+LTRIM(x.dcIndustryid)+',c'+LTRIM(isnull(y.Category,0))
- FROM cpIndustry x,dcIndustry y WHERE x.dcIndustryid = y.id
- AND x.cpMainid = b.id FOR XML PATH('')),1,1,'') cpIndustry,
- c.IsTop, b.IsRefreshed, a.SecondId EnJobID, b.SecondId EnCpMainID
- FROM JobPublish a WITH(NOLOCK), cpMainPublish b WITH(NOLOCK), SearchDB..paSearchJobID_2 c WITH(NOLOCK)
- WHERE a.cpMainID = b.ID AND a.id=c.JobID AND c.paSearchConditionID=@paSearchConditionID
- AND c.ID>=@MinId ORDER BY c.ID, a.ID DESC
- END
- ELSE IF (@TableID = 3)
- BEGIN
- SELECT @MinId = MIN(ID) FROM SearchDB..paSearchJobID_3 WITH(NOLOCK) WHERE paSearchConditionID=@paSearchConditionID
- SET @MinId = @MinId+(@PageNumber-1)*@PageSize
- SELECT TOP 8 a.ID, a.cpMainID, a.caMainID, a.Name as JobName, a.dcJobTypeID,
- a.dcJobTypeIDMinor, a.NeedNumber, a.dcSalaryID, a.EmployType,
- a.dcRegionID, a.Responsibility, a.Demand, a.dcEducationID,
- a.MinExperience, a.MinAge, a.MaxAge, a.IssueDate, a.IssueEND,
- a.IsDelete, a.AddDate, a.RefreshDate,
- a.LastModifyDate, b.Name as cpName, b.dcCompanySizeID,
- b.HasLicence, b.UnLimitedDate, b.BalanceDate, b.Balance,
- b.MemberType, STUFF((SELECT ','+LTRIM(x.dcIndustryid)+',c'+LTRIM(isnull(y.Category,0))
- FROM cpIndustry x,dcIndustry y WHERE x.dcIndustryid = y.id
- AND x.cpMainid = b.id FOR XML PATH('')),1,1,'') cpIndustry,
- c.IsTop, b.IsRefreshed, a.SecondId EnJobID, b.SecondId EnCpMainID
- FROM JobPublish a WITH(NOLOCK), cpMainPublish b WITH(NOLOCK), SearchDB..paSearchJobID_3 c WITH(NOLOCK)
- WHERE a.cpMainID = b.ID AND a.id=c.JobID AND c.paSearchConditionID=@paSearchConditionID
- AND c.ID>=@MinId ORDER BY c.ID, a.ID DESC
- END
- RETURN
- END
- END TRY
- BEGIN CATCH
- ---检查是否已经建立临时表,已经建立则删除
- PRINT 'error'
- PRINT error_Message()
- PRINT error_number()
- PRINT error_line()
- END CATCH
- GO
- /****** Object: StoredProcedure [dbo].[paPaRemindLogSelectByIndex] Script Date: 2018/12/13 19:08:04 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- CREATE PROCEDURE [dbo].[paPaRemindLogSelectByIndex]
- (
- @paMainID INT
- )
- AS
- BEGIN
- SET NOCOUNT ON
- SELECT TOP 0 * FROM paRemindLog
- -- DECLARE @LastLoginDate SMALLDATETIME
- -- SELECT @LastLoginDate = ISNULL(AddDate,GETDATE()) FROM(
- -- SELECT TOP 2 AddDate,ROW_NUMBER() OVER(ORDER BY AddDate DESC) row FROM paLoginLog WHERE paMainID = @paMainID
- -- ) a WHERE row = 2
- -- SELECT * FROM paRemindLog WHERE AddDate > ISNULL(@LastLoginDate,GETDATE()) AND PaMainID = @paMainID
- SET NOCOUNT OFF
- END
- GO
- /****** Object: StoredProcedure [dbo].[paTagsMainByJobTypeSelect] Script Date: 2018/12/13 19:08:04 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- --根据职位类别获取该职位类别下关键字信息 Peter 2017-1-13
- CREATE PROCEDURE [dbo].[paTagsMainByJobTypeSelect]
- (
- @JobType VARCHAR(50)
- )
- AS
- BEGIN
- SELECT TOP 100 Tag
- FROM (
- SELECT DISTINCT Tag
- FROM paTagsMain WITH(NOLOCK)
- WHERE dcJobTypeID IN (
- SELECT a FROM dbo.fnSplit(@JobType, ',')
- )) a
- ORDER BY NEWID()
- END
- GO
- /****** Object: StoredProcedure [dbo].[paWeixinSave] Script Date: 2018/12/13 19:08:04 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- CREATE PROCEDURE [dbo].[paWeixinSave]
- (
- @Content NVARCHAR(50),
- @Lat VARCHAR(20),
- @Lng VARCHAR(20),
- @FromUserName VARCHAR(50)
- )
- AS
- BEGIN TRY
- SET @Content = dbo.SafeSql(@Content)
- DELETE FROM wxMessage WHERE FromUserName=@FromUserName
- IF ISNULL(@Content,'')=''
- BEGIN
- INSERT INTO wxMessage(FromUserName,Lat,Lng,Content) VALUES
- (@FromUserName,@Lat,@Lng,@Content)
- END
- ELSE
- BEGIN
- DECLARE @dcRegionID INT, @KeyWord NVARCHAR(20), @c NVARCHAR(50)
- IF @Content LIKE '% %'
- SET @c = LEFT(@Content, CHARINDEX(' ', @Content) - 1)
- ELSE
- SET @c = @Content
- SELECT TOP 1 @dcRegionID = ID FROM dcRegion WITH(NOLOCK)
- WHERE CHARINDEX(Abbr, @c)>0
- ORDER BY ID DESC
- IF ISNULL(@dcRegionID,0)=0
- RETURN 0
- SELECT @KeyWord=REPLACE(REPLACE(@Content,MapbarName,''),REPLACE(MapbarName,'市',''),'') FROM dcRegion WITH(NOLOCK) WHERE ID=@dcRegionID
- SELECT @KeyWord=REPLACE(REPLACE(REPLACE(@KeyWord,Description,''),REPLACE(Description,'市',''),''),REPLACE(Description,'区',''),'') FROM dcRegion WITH(NOLOCK) WHERE ID=@dcRegionID
- SELECT @KeyWord=REPLACE(REPLACE(@KeyWord,LEFT(FullName,CHARINDEX('省',FullName)),''),REPLACE(LEFT(FullName,CHARINDEX('省',FullName)),'省',''),'') FROM dcRegion WITH(NOLOCK) WHERE ID=@dcRegionID
- SELECT @KeyWord=REPLACE(@KeyWord,' ','')
- SELECT @KeyWord=REPLACE(@KeyWord,'+','')
- INSERT INTO wxMessage(FromUserName,dcRegionID,KeyWord,Content) VALUES
- (@FromUserName,@dcRegionID,@KeyWord,@Content)
- END
- RETURN 1
- END TRY
- BEGIN CATCH
- RETURN 0
- END CATCH
- GO
- /****** Object: StoredProcedure [dbo].[pcAdvantageAnalysisByExJobApplySelect] Script Date: 2018/12/13 19:08:05 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- CREATE PROCEDURE [dbo].[pcAdvantageAnalysisByExJobApplySelect]
- (
- @JobID INT
- )
- AS
- --Lucifer 添加
- --2013-11-4 应聘优势分析
- BEGIN
- SELECT b.dcSalaryID,COUNT(1) Cnt FROM exJobApply a WITH(NOLOCK),cvMain b WITH(NOLOCK) WHERE a.cvMainID=b.ID
- AND a.JobID=@JobID AND b.dcSalaryID IS NOT NULL GROUP BY b.dcSalaryID
- SELECT b.RelatedWorkYears,COUNT(1) Cnt FROM exJobApply a WITH(NOLOCK),cvMain b WITH(NOLOCK) WHERE a.cvMainID=b.ID
- AND a.JobID=@JobID AND b.RelatedWorkYears IS NOT NULL GROUP BY b.RelatedWorkYears
- SELECT b.Degree,COUNT(1) Cnt FROM exJobApply a WITH(NOLOCK),cvMain b WITH(NOLOCK) WHERE a.cvMainID=b.ID
- AND a.JobID=@JobID AND b.Degree IS NOT NULL GROUP BY b.Degree
- END
- GO
- /****** Object: StoredProcedure [dbo].[pcbsCvModifySelect] Script Date: 2018/12/13 19:08:05 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- --#####################################################
- --创建时间:2014.10.31
- --创建人:Nick
- --说明:获取简历所有的审核信息
- --#####################################################
- CREATE PROCEDURE [dbo].[pcbsCvModifySelect]
- (
- @PamainID INT,
- @CvMainID INT
- )
- AS
- BEGIN TRY
- SELECT * FROM bsCvModify WITH(NOLOCK)
- WHERE VerifyInfo Is NOT NULL
- AND paMainID=@PamainID
- And cvMainID=@CvMainID
- And VerifyInfo<>(Select Top 1 VerifyInfo From bsCvVerify Where cvMainID=@CvMainID
- Order By VerifyDate Desc
- )
- END TRY
- BEGIN CATCH
- RETURN 0
- END CATCH
- GO
- /****** Object: StoredProcedure [dbo].[pcBsPaStatusInsert] Script Date: 2018/12/13 19:08:05 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- -- =============================================
- -- Author: <Author,,Name>
- -- Create date: <Create Date,,>
- -- Description: <Description,,>
- -- =============================================
- CREATE PROCEDURE [dbo].[pcBsPaStatusInsert]
- (
- @paMainID INT,
- @cvMainID INT,
- @StatusID INT,
- @ApplyInfo VARCHAR(400)
- )
- AS
- BEGIN TRY
- DECLARE @MaxID AS INT
- INSERT INTO bsPaStatus (paMainID,cvMainID,StatusID,ApplyInfo) VALUES(@paMainID,@cvMainID,@StatusID,@ApplyInfo)
- SET @MaxID = @@IDENTITY
- END TRY
- BEGIN CATCH
- GOTO ERR
- END CATCH
- RETURN @MaxID
- ERR:
- BEGIN
- RETURN 0
- END
- GO
- /****** Object: StoredProcedure [dbo].[pcCaCvIntentionBatchDelete] Script Date: 2018/12/13 19:08:05 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- CREATE PROCEDURE [dbo].[pcCaCvIntentionBatchDelete]
- (
- @AllID VARCHAR(1000),
- @paMainID INT
- )
- AS
- SET NOCOUNT ON
- BEGIN TRAN
- BEGIN TRY
- --生成临时表
- DECLARE @t AS TABLE(
- ID INT
- )
- DECLARE @i INT
- SET @i=CHARINDEX(',',@AllID)
- WHILE @i>=1
- BEGIN
- IF LEFT(@AllID,@i-1) > ''
- INSERT @t VALUES(LEFT(@AllID,@i-1))
- SET @AllID=SUBSTRING(@AllID,@i+1,LEN(@AllID)-@i)
- SET @i=CHARINDEX(',',@AllID)
- END
- IF @AllID > ''
- INSERT @t VALUES(@AllID)
- IF EXISTS(SELECT 'X' FROM caCvIntention a WITH(NOLOCK),@t b,cvMain c WITH(NOLOCK)
- WHERE a.id=b.id AND a.cvMainID=c.ID AND c.paMainID<>@paMainID)
- GOTO Err
- DELETE FROM caCvIntention WHERE CompanyDeleted=1 AND ID IN(SELECT ID FROM @t)
- UPDATE CaCvIntention SET PersonDeleted=1 WHERE ID IN(SELECT ID FROM @t)
- UPDATE CaCvIntention SET Reply=2,ReplyDate=GETDATE() WHERE ID IN(SELECT ID FROM @t) AND PersonDeleted=1
- AND Reply IS NULL
-
- END TRY
- BEGIN CATCH
- GOTO ERR
- END CATCH
- COMMIT TRAN
- RETURN 1
- ERR:
- BEGIN
- ROLLBACK TRAN
- RETURN 0
- END
- GO
- /****** Object: StoredProcedure [dbo].[pcCaCvIntentionByBaiduPushSelect] Script Date: 2018/12/13 19:08:05 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- --====================================
- --创建: Andy Yin
- --获得所有PaMainID简历浏览记录个数,用于给app推送数据。
- --====================================
- CREATE PROCEDURE [dbo].[pcCaCvIntentionByBaiduPushSelect]
- (
- @WHERE VARCHAR(1000)
- )
- AS
- BEGIN
- BEGIN TRY
- SET @WHERE = REPLACE(dbo.SafeSQL(@WHERE), '''', '')
- DECLARE @SQL AS VARCHAR(2000)
- SET @SQL = 'SELECT d.paMainID, count(*) as Count
- FROM caCvIntention a WITH(NOLOCK)
- inner join Job b WITH(NOLOCK) On a.JobID = b.ID
- inner join cpMain c WITH(NOLOCK) On b.cpMainID = c.ID
- inner join cvMain d WITH(NOLOCK) On a.cvMainID = d.ID
- WHERE PersonDeleted=0'
-
- IF LEN(@WHERE)>0
- SET @SQL = @SQL + ' ' + @WHERE
- SET @SQL=@SQL + ' GROUP BY d.pamainiD '
- EXEC(@SQL)
-
- END TRY
- BEGIN CATCH
- END CATCH
- END
- GO
- /****** Object: StoredProcedure [dbo].[pcCaCvIntentionSelect] Script Date: 2018/12/13 19:08:05 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- --lucifer 2018-3-22
- CREATE PROCEDURE [dbo].[pcCaCvIntentionSelect]
- (
- @WHERE VARCHAR(1000),
- @Order VARCHAR(100)
- )
- AS
- SET NOCOUNT ON
- BEGIN
- SET @WHERE = dbo.SafeSQL(@WHERE)
- SET @ORDER = dbo.SafeSQL(@ORDER)
- DECLARE @SQL AS VARCHAR(2000)
- SET @SQL = 'SELECT JobID,cvMainID,a.AddDate,b.Name as JobName,b.IssueDate,b.IssueEnd,Reply,ReplyDate,d.Name cvName,
- b.dcRegionID,b.IsDelete,c.Name as cpName,c.ID as cpID,c.HasLicence, c.IsAgent, c.MemberType,a.ID,
- b.dcSalaryId, b.dcSalaryIdMax, b.SecondId EnJobID, c.SecondId EnCpMainID,ISNULL((SELECT IsOnline FROM caOnline WHERE caMainId =b.caMainID), 0) AS IsOnline,b.CaMainID,b.Valid JobValid,
- b.Welfare1,b.Welfare2,b.Welfare3,b.Welfare4,b.Welfare5,b.Welfare6,b.Welfare7,b.Welfare8,
- b.Welfare9,b.Welfare10,b.Welfare11,b.Welfare12,b.Welfare13,b.Welfare14,b.Welfare15,b.Welfare16,
- b.Welfare17,b.Welfare18,b.Welfare19,c.ReplyRate, c.LogoFile LogoUrl, e.DescriptionCp SalaryMin, f.DescriptionCp SalaryMax
- FROM caCvIntention a WITH(NOLOCK)
- inner join Job b WITH(NOLOCK) On a.JobID = b.ID
- inner join cpMain c WITH(NOLOCK) On b.cpMainID = c.ID
- inner join cvMain d WITH(NOLOCK) On a.cvMainID = d.ID
- inner join dcSalary e WITH(NOLOCK) On b.dcSalaryId = e.ID
- inner join dcSalary f WITH(NOLOCK) On b.dcSalaryIdMax = f.ID
- WHERE PersonDeleted=0'
- IF LEN(@WHERE) > 0
- SET @SQL=@SQL + ' ' + @WHERE
- IF LEN(@ORDER) > 0
- SET @SQL=@SQL + ' ORDER BY '+@ORDER
- --PRINT @SQL
- EXEC(@SQL)
- END
- GO
- /****** Object: StoredProcedure [dbo].[pcCaCvIntentionUpdate] Script Date: 2018/12/13 19:08:05 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- CREATE PROCEDURE [dbo].[pcCaCvIntentionUpdate]
- (
- @ID INT,
- @Reply TINYINT,
- @paMainID INT
- )
- AS
- BEGIN TRY
- IF NOT EXISTS(SELECT 'x' FROM caCvIntention a WITH(NOLOCK),cvMain b WITH(NOLOCK) WHERE a.id=@ID AND a.cvMainID=b.ID AND b.paMainID=@paMainID)
- GOTO ERR
- UPDATE caCvIntention
- SET Reply=@Reply,ReplyDate=GETDATE()
- WHERE ID=@ID
- RETURN 1
- END TRY
- BEGIN CATCH
- GOTO ERR
- END CATCH
- ERR:
- BEGIN
- RETURN 0
- END
- GO
- /****** Object: StoredProcedure [dbo].[pcCaCvViewLogByBaiduPushSelect] Script Date: 2018/12/13 19:08:06 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- --====================================
- --创建: Andy Yin
- --获得半小时内所有的简历浏览记录个数,按照个人PamainID查找。用于给app推送数据。
- --====================================
- CREATE PROCEDURE [dbo].[pcCaCvViewLogByBaiduPushSelect]
- AS
- BEGIN
- SELECT e.paMainID, COUNT(a.camainid) AS Count
- FROM caCvviewLog a WITH(NOLOCK)
- inner join camain b WITH(NOLOCK) on a.camainid=b.id
- inner join cpmain c with(nolock) on c.id=b.cpmainid
- inner join cvmain e WITH(NOLOCK) on a.cvmainid=e.id
- inner join job d with(nolock) on a.camainid=d.camainid
- WHERE a.AddDate>DATEADD(hour,-0.5,GetDate()) --当前日期加一周后的日期()
- Group by e.paMainID
- END
- GO
- /****** Object: StoredProcedure [dbo].[pcCaCvViewLogSelect] Script Date: 2018/12/13 19:08:06 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- --====================================
- --创建: lucifer
- --检查: Sean 2010-10-14
- --企业浏览记录
- --====================================
- CREATE PROCEDURE [dbo].[pcCaCvViewLogSelect]
- (
- @AllJobID VARCHAR(1000),
- @AllCvMainID VARCHAR(1000),
- @ORDER VARCHAR(200)
- )
- AS
- SET NOCOUNT ON
- BEGIN
- SET @AllJobID = dbo.FormatIDS(@AllJobID)
- SET @AllCvMainID = dbo.FormatIDS(@AllCvMainID)
- SET @ORDER = REPLACE(dbo.SafeSQL(@ORDER), '''', '')
- SELECT * ,0 AS IsApply INTO #t FROM caCvviewLog WITH(NOLOCK)
- WHERE cvMainId in(SELECT * FROM dbo.fnSplit(@AllCvMainID, ','))
-
- UPDATE #t SET IsApply=1
- FROM #t a,exjobapply b, job c,caMain d
- WHERE b.jobid=c.id and a.caMainid = d.id and c.cpMainID=d.cpMainID
- DECLARE @SQL VARCHAR(2000)
- SET @SQL = 'SELECT DISTINCT a.camainid,a.cvmainid,a.adddate,b.Name as caName,
- b.Email,b.Mobile,b.Telephone,b.Gender,b.IsPhoneHide,b.IsNameHide,
- b.IsMobileHide,c.Name as cpName,c.Address,c.ID as cpID,c.HasLicence,
- c.IsAgent,e.Name cvName, c.Membertype, c.dcRegionId, c.SecondId EnCpMainID, c.LogoFile LogoUrl
- from #t a WITH(NOLOCK)
- inner join camain b WITH(NOLOCK) on a.camainid=b.id
- inner join cpmain c with(nolock) on c.id=b.cpmainid
- inner join cvmain e WITH(NOLOCK) on a.cvmainid=e.id'
- IF LEN(@AllJobID) > 0
- SET @SQL = @SQL + ' inner join job d with(nolock) on a.camainid=d.camainid'
- SET @SQL = @SQL + ' WHERE a.cvMainId in(' + @AllCvMainID +')'
- IF LEN(@AllJobID) > 0
- SET @SQL = @SQL + ' AND d.id in(' + @AllJobID +')'
- IF LEN(@ORDER) > 0
- SET @SQL = @SQL + ' ORDER BY ' + @ORDER
- EXEC(@SQL)
- END
- SET NOCOUNT OFF
- GO
- /****** Object: StoredProcedure [dbo].[pcCaCvViewLogSelect20171218] Script Date: 2018/12/13 19:08:06 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- CREATE PROCEDURE [dbo].[pcCaCvViewLogSelect20171218]
- (
- @AllCvMainID VARCHAR(1000),
- @Page SMALLINT
- )
- AS
- SET NOCOUNT ON
- BEGIN
- IF @AllCvMainID = ''
- RETURN
- SET @AllCvMainID = dbo.FormatIDS(@AllCvMainID)
- SELECT ROW_NUMBER() OVER(ORDER BY AddDate DESC) TitleID, caMainId, cvMainId, AddDate, NULL JobId ,0 IsApply
- INTO #1
- FROM caCvviewLog WITH(NOLOCK INDEX(IX_caCvViewLog_cvMainID))
- WHERE cvMainId IN(SELECT a FROM dbo.fnSplit(@AllCvMainID, ','))
- AND EXISTS(SELECT TOP 1 'X' FROM JobPublish WITH(NOLOCK) WHERE caMainID = caCvviewLog.caMainID)
- SELECT * INTO #T
- FROM #1
- WHERE TitleID > (@Page - 1) * 20 AND TitleID <= @Page * 20
- -- SELECT * INTO #T FROM (
- -- SELECT ROW_NUMBER() OVER(ORDER BY AddDate DESC) TitleID, caMainId, cvMainId, AddDate, NULL JobId ,0 IsApply
- -- FROM caCvviewLog WITH(NOLOCK INDEX(IX_caCvViewLog_cvMainID))
- -- WHERE cvMainId IN(SELECT a FROM dbo.fnSplit(@AllCvMainID, ','))
- -- AND EXISTS(SELECT TOP 1 'X' FROM JobPublish WITH(NOLOCK) WHERE caMainID = caCvviewLog.caMainID)
- -- ) a WHERE TitleID > (@Page - 1) * 20 AND TitleID <= @Page * 20
-
- UPDATE #T SET IsApply = 1
- WHERE EXISTS(
- SELECT TOP 1 'X' FROM exJobApply a WITH(NOLOCK), JobPublish b WITH(NOLOCK)
- WHERE a.JobID = b.ID AND a.cvMainID = #T.cvMainID AND b.caMainID = #T.caMainID
- )
- UPDATE #T SET JobId = (SELECT TOP 1 a.ID FROM JobPublish a WITH(NOLOCK), caMain b WITH(NOLOCK), cpMainPublish c WITH(NOLOCK)
- WHERE a.cpMainId = b.cpMainID AND b.cpMainID = c.ID AND a.dcJobTypeId IN(SELECT dcJobTypeID FROM cvJobType WITH(NOLOCK) WHERE cvMainId = #T.cvMainId)
- AND b.Id = #T.caMainID ORDER BY a.RefreshDate DESC)
-
- UPDATE #T SET JobId = (SELECT TOP 1 a.ID FROM JobPublish a WITH(NOLOCK), caMain b WITH(NOLOCK), cpMainPublish c WITH(NOLOCK)
- WHERE a.cpMainId = b.cpMainID AND b.cpMainID = c.ID AND LEFT(a.dcJobTypeId, 2) IN(SELECT dcJobTypeID FROM cvJobType WITH(NOLOCK) WHERE cvMainId = #T.cvMainId)
- AND b.Id = #T.caMainID ORDER BY a.RefreshDate DESC) WHERE JobId IS NULL
-
- UPDATE #T SET JobId = (SELECT TOP 1 a.ID FROM JobPublish a WITH(NOLOCK), caMain b WITH(NOLOCK), cpMainPublish c WITH(NOLOCK)
- WHERE a.cpMainId = b.cpMainID AND b.cpMainID = c.ID
- AND b.Id = #T.caMainID ORDER BY a.RefreshDate DESC) WHERE JobId IS NULL
-
- SELECT a.caMainId,a.cvMainId,a.AddDate adddate,b.Name as caName,d.Id jobId,d.Name jobName,
- d.SecondId EnJobId,d.NeedNumber,d.dcSalaryID, d.dcSalaryIDMax,
- b.Email,b.Mobile,b.Telephone,b.Gender,b.IsPhoneHide,b.IsNameHide,b.IsMobileHide,
- c.Name as cpName,c.Address,c.ID as cpID,c.HasLicence,c.IsAgent,e.Name cvName,
- c.Membertype, c.dcRegionId, c.SecondId EnCpMainID, c.LogoFile LogoUrl
- FROM #T a WITH(NOLOCK)
- INNER JOIN caMain b WITH(NOLOCK) ON a.caMainID = b.ID
- INNER JOIN cpMain c WITH(NOLOCK) ON c.ID = b.cpMainId
- INNER JOIN cvMain e WITH(NOLOCK) ON a.cvMainId = e.Id
- INNER JOIN JobPublish d WITH(NOLOCK) ON a.JobId = d.Id
-
- SELECT COUNT(1)
- FROM #1
- END
- SET NOCOUNT OFF
- GO
- /****** Object: StoredProcedure [dbo].[pcCaCvViewLogSelectBak] Script Date: 2018/12/13 19:08:07 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- --====================================
- --创建: lucifer
- --检查: Sean 2010-10-14
- --企业浏览记录
- --====================================
- CREATE PROCEDURE [dbo].[pcCaCvViewLogSelectBak]
- (
- @AllJobID VARCHAR(1000),
- @AllCvMainID VARCHAR(1000),
- @ORDER VARCHAR(200)
- )
- AS
- BEGIN
- SET @AllJobID = dbo.FormatIDS(@AllJobID)
- SET @AllCvMainID = dbo.FormatIDS(@AllCvMainID)
- SET @ORDER = REPLACE(dbo.SafeSQL(@ORDER), '''', '')
- DECLARE @SQL VARCHAR(2000)
- SET @SQL='SELECT DISTINCT a.camainid,a.cvmainid,a.adddate,b.Name as caName,
- b.Email,b.Mobile,b.Telephone,b.Gender,b.IsPhoneHide,b.IsNameHide,
- b.IsMobileHide,c.Name as cpName,c.Address,c.ID as cpID,c.HasLicence,
- c.IsAgent,e.Name cvName, c.Membertype
- from cacvviewlog a WITH(NOLOCK)
- inner join camain b WITH(NOLOCK) on a.camainid=b.id
- inner join cpmain c with(nolock) on c.id=b.cpmainid
- inner join cvmain e WITH(NOLOCK) on a.cvmainid=e.id'
- IF LEN(@AllJobID)>0
- SET @SQL=@SQL+' inner join job d with(nolock) on a.camainid=d.camainid'
- SET @SQL=@SQL+' WHERE a.cvMainId in(' + @AllCvMainID +')'
- IF LEN(@AllJobID)>0
- SET @SQL=@SQL+' AND d.id in(' + @AllJobID +')'
- IF LEN(@ORDER)>0
- SET @SQL=@SQL+' ORDER BY '+@ORDER
- EXEC(@SQL)
- END
- GO
- /****** Object: StoredProcedure [dbo].[PcCaMainByIsShowEmailContactSelect] Script Date: 2018/12/13 19:08:07 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- create PROCEDURE [dbo].[PcCaMainByIsShowEmailContactSelect]
- (
- @JobId INT
- )
- AS
- BEGIN
- SELECT 'x' FROM caMain WHERE id IN(SELECT caMainId FROM Job WHERE Id = @JobId) AND IsShowEmailContact = 1
- END
- GO
- /****** Object: StoredProcedure [dbo].[pcCaPlaintByIDSelect_old] Script Date: 2018/12/13 19:08:07 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- --============
- --应该没有用了
- --============
- CREATE PROCEDURE [dbo].[pcCaPlaintByIDSelect_old]
- (
- @ID INT
- )
- AS
- BEGIN
- SELECT *
- FROM CaPlaint WITH(NOLOCK)
- WHERE ID = @ID
- END
- GO
- /****** Object: StoredProcedure [dbo].[pccaplaintIsViewedUpdate] Script Date: 2018/12/13 19:08:07 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- --========================================
- --asp中取所有IsViewed = false的id
- --检查 sean 2010-10-10
- --========================================
- CREATE PROCEDURE [dbo].[pccaplaintIsViewedUpdate]
- (
- @AllID VARCHAR(200)
- )
- AS
- BEGIN TRY
- SET @AllID = dbo.FormatIDS(@AllID)
- DECLARE @T AS TABLE(ID INT)
- INSERT INTO @T SELECT * FROM dbo.fnSplit(@AllID, ',')
- UPDATE caplaint SET IsViewed=1 WHERE ID IN(SELECT ID FROM @T)
- RETURN 1
- END TRY
- BEGIN CATCH
- RETURN 0
- END CATCH
- GO
- /****** Object: StoredProcedure [dbo].[pcCaPlaintNoViewSelect] Script Date: 2018/12/13 19:08:07 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- --========================================
- --asp中取所有IsViewed = false的id
- --检查 sean 2010-10-10
- --个人首页用,未查看的企业投诉
- --========================================
- CREATE PROCEDURE [dbo].[pcCaPlaintNoViewSelect]
- (
- @PaMainID INT
- )
- AS
- BEGIN
- SELECT a.*
- FROM CaPlaint a WITH(NOLOCK INDEX(IX_caPlaint_cvMainID)), cvMain b WITH(NOLOCK INDEX(IX_cvMain_paMainID)), caMain c WITH(NOLOCK)
- WHERE a.cvMainID = b.ID
- AND b.PaMainID = @PaMainID
- AND a.caMainID = c.ID
- AND c.IsDelete = 0
- AND a.IsViewed = 0
- AND a.ReplyType = 1
- ORDER BY a.ID DESC
- END
- GO
- /****** Object: StoredProcedure [dbo].[pcCaPlaintSelect] Script Date: 2018/12/13 19:08:07 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- CREATE PROCEDURE [dbo].[pcCaPlaintSelect]
- (
- @PaMainID INT
- )
- AS
- BEGIN
- SELECT a.*,d.ID cpMainID ,d.name CompanyName
- FROM CaPlaint a WITH(NOLOCK INDEX(IX_caPlaint_cvMainID))
- INNER JOIN cvMain b WITH(NOLOCK INDEX(IX_cvMain_paMainID))
- ON a.cvMainID = b.ID
- LEFT JOIN caMain c WITH(NOLOCK)
- ON a.caMainID = c.ID
- LEFT JOIN cpMain d WITH(NOLOCK)
- ON c.cpMainID = d.ID
- WHERE b.PaMainID = @PaMainID
- AND (c.IsDelete = 0 OR c.IsDelete IS NULL)
- AND a.ReplyType = 1
- ORDER BY a.ID DESC
- END
- GO
- /****** Object: StoredProcedure [dbo].[pcChatOnLineByPaMainIDSelect] Script Date: 2018/12/13 19:08:08 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- CREATE PROCEDURE [dbo].[pcChatOnLineByPaMainIDSelect]
- (
- @PaMainID INT --求职者的ID
- )
- AS
- SET NOCOUNT ON
- --INSERT INTO procLog SELECT 'pcChatOnLineByPaMainIDSelect', @PaMainID, GETDATE()
- BEGIN
- CREATE TABLE #UserList
- (
- ChatOnlineID INT,
- CaMainID INT,
- CvMainID INT,
- EndDate SMALLDATETIME,
- LastChatDate SMALLDATETIME,
- SumUnRead INT,
- IsHidden BIT
- )
- UPDATE ChatOnline
- SET paUnViewed = 0
- WHERE paUnViewed > 0
- AND cvMainId IN(SELECT ID FROM cvMain WHERE paMainId = @PaMainId)
- UPDATE a
- SET a.paUnViewed = b.Cnt
- FROM ChatOnline a, (
- SELECT MAX(a.ID) Id, COUNT(*) Cnt
- FROM ChatOnline a, ChatOnlineLog b
- WHERE a.id = b.ChatOnlineID
- AND b.IsViewed = 0
- AND b.SenderType <> 2 --不是个人发送的
- AND a.cvMainId IN(SELECT ID FROM cvMain WHERE paMainId = @PaMainId)
- GROUP BY a.CaMainId, a.CvMainID
- ) b
- WHERE a.Id = b.Id
- --个人的联系人列表,有留言的
- INSERT INTO #UserList
- SELECT MAX(ID), CaMainID, CvMainID, MAX(EndDate), MAX(StartDate), SUM(paUnViewed), 0
- FROM ChatOnline
- WHERE cvMainId IN(SELECT ID FROM cvMain WHERE paMainId = @PaMainId) --当前个人
- AND (paUnViewed > 0 OR StartDate > GETDATE() - 15)
- GROUP BY CaMainID, cvMainId
- --个人联系列表,15之外曾有联系的,隐藏不显示
- INSERT INTO #UserList
- SELECT MAX(ID), CaMainID, CvMainID, MAX(EndDate), MAX(StartDate), 0, 1
- FROM ChatOnline
- WHERE cvMainId IN (SELECT ID FROM CvMain WHERE PaMainID = @PaMainID) --当前个人用户
- AND CaMainID NOT IN(SELECT CaMainID FROM #UserList)
- GROUP BY caMainId, CvMainID
- SELECT a.*, b.Name CpName, b.SecondID, c.Name UserName,
- c.cpMainID, ISNULL(d.IsOnline, 0) IsOnline
- FROM #UserList a
- INNER JOIN caMain c ON a.caMainID = c.ID
- INNER JOIN cpMain b ON b.ID = c.cpMainID
- LEFT JOIN caOnline d ON c.Id = d.caMainId
- ORDER BY a.LastChatDate DESC
-
- DROP TABLE #UserList
- END
- GO
- /****** Object: StoredProcedure [dbo].[pcChatOnLineListByCaMainIDSelect] Script Date: 2018/12/13 19:08:08 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- -----创建人:Nick
- -----创建时间:2014-9-9
- -----用途:根据企业用户ID获取聊天列表
- CREATE PROCEDURE [dbo].[pcChatOnLineListByCaMainIDSelect]
- (
- @CaMainID INT --企业用户ID
- )
- AS
- --INSERT INTO procLog SELECT 'pcChatOnLineListByCaMainIDSelect', @caMainID, GETDATE()
- BEGIN
- DECLARE @ChatList1 AS TABLE
- (
- CvMainID INT,
- CaMainID INT,
- ManagerUserID SMALLINT,
- Name VARCHAR(100),
- Message NVARCHAR(200),
- SendDate DATETIME,
- NoViewedNum INT,
- OnlineStatus INT,
- Photo VARCHAR(50),
- OpenName INT
- )
- DECLARE @ChatList2 AS TABLE
- (
- CvMainID INT,
- CaMainID INT,
- ManagerUserID SMALLINT,
- Name VARCHAR(100),
- Message NVARCHAR(200),
- SendDate DATETIME,
- NoViewedNum INT,
- OnlineStatus INT,
- Photo VARCHAR(50),
- HasPhoto INT
- )
- --客服或顾问聊天列表
- INSERT INTO @ChatList1(CvMainID,CaMainID,ManagerUserID,Name,OnlineStatus)
- SELECT DISTINCT a.cvMainID,a.caMainID ,a.ManagerUserID,'客服' as Name,0
- FROM ChatOnline a
- WHERE a.caMainID = @CaMainID
- AND (a.AddDate > GETDATE() - 15 OR ID IN (
- SELECT ChatOnlineID FROM ChatOnlineLog WHERE IsViewed = 0 ))
- AND (a.cvMainID IS NULL or a.cvMainID = 0)
-
- UPDATE a SET
- Message = (
- SELECT TOP 1 MESSAGE
- FROM ChatOnlineLog
- WHERE ChatOnlineID IN (SELECT ID FROM CHATONLINE WHERE CaMainID = a.CaMainID AND ManagerUserID = a.ManagerUserID)
- Order BY AddDate DESC
- ),
- SendDate = (
- SELECT TOP 1 AddDate
- FROM ChatOnlineLog
- WHERE ChatOnlineID IN (SELECT ID FROM CHATONLINE WHERE CaMainID = a.CaMainID AND ManagerUserID = a.ManagerUserID)
- Order BY AddDate DESC),
- NoViewedNum = (
- SELECT COUNT(*)
- FROM ChatOnlineLog
- WHERE ChatOnlineID IN (SELECT ID FROM CHATONLINE WHERE CaMainID = a.CaMainID AND ManagerUserID = a.ManagerUserID)
- AND IsViewed = 0
- ),
- Photo = (
- SELECT TOP 1 Photo FROM ManagerUser WHERE ID = a.ManagerUserID
- ),
- OnlineStatus = (
- SELECT TOP 1 SOLStatus FROM ManagerUser WHERE ID = a.ManagerUserID
- ),
- OpenName = (
- SELECT TOP 1 OpenName FROM ManagerUser WHERE ID = a.ManagerUserID
- )
- FROM @ChatList1 a
-
- UPDATE @ChatList1 SET Photo = '' WHERE OpenName <> 1
-
- --跟个人聊天列表
- INSERT INTO @ChatList2(CvMainID,CaMainID,ManagerUserID,Name,OnlineStatus)
- SELECT DISTINCT a.cvMainID,a.caMainID ,a.ManagerUserID,c.Name,dbo.GetPaOnlineStatus(c.ID)
- FROM ChatOnline a , cvMain b,PaMain c
- WHERE a.caMainID = @CaMainID
- AND a.cvMainID = b.ID
- AND b.PaMainID = c.ID
- AND (a.AddDate > GETDATE() - 15 OR a.ID IN (
- SELECT ChatOnlineID FROM ChatOnlineLog WHERE IsViewed = 0 AND SenderType = 2))
- AND (a.ManagerUserID IS NULL or a.ManagerUserID = 0)
-
- UPDATE a SET
- Message = (
- SELECT TOP 1 MESSAGE
- FROM ChatOnlineLog
- WHERE ChatOnlineID IN (SELECT ID FROM CHATONLINE WHERE CvMainID = a.CvMainID AND CaMainID = a.CaMainID)
- Order BY AddDate DESC
- ),
- SendDate = (
- SELECT TOP 1 AddDate
- FROM ChatOnlineLog
- WHERE ChatOnlineID IN (SELECT ID FROM CHATONLINE WHERE CvMainID = a.CvMainID AND CaMainID = a.CaMainID)
- Order BY AddDate DESC),
- NoViewedNum = (
- SELECT COUNT(*)
- FROM ChatOnlineLog
- WHERE ChatOnlineID IN (SELECT ID FROM CHATONLINE WHERE CvMainID = a.CvMainID AND CaMainID = a.CaMainID)
- AND IsViewed = 0
- AND SenderType = 2
- ),
- Photo = (
- SELECT PhotoProcessed FROM paPhoto WHERE paMainID = (
- SELECT PaMainID FROM CvMain WHERE ID = a.CvMainID
- )
- ),
- HasPhoto = (
- SELECT HasPhoto FROM paMain WHERE ID = (
- SELECT PaMainID FROM CvMain WHERE ID = a.CvMainID
- )
- )
- FROM @ChatList2 a
-
- SELECT * FROM @ChatList1
- SELECT * FROM @ChatList2
- END
- GO
- /****** Object: StoredProcedure [dbo].[pcChatOnLineListByPaMainIDSelect] Script Date: 2018/12/13 19:08:08 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- -- = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
- --修改人: Nick
- --修改日期:2014-10-09
- --修改内容:未查看消息数量问题
- -- = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
- CREATE PROCEDURE [dbo].[pcChatOnLineListByPaMainIDSelect]
- (
- @PaMainID INT --求职者的ID
- )
- AS
- --INSERT INTO procLog SELECT 'pcChatOnlineListByPaMainIDSelect', @PaMainID, GETDATE()
- BEGIN
- CREATE TABLE #ChatList1
- (
- CvMainID INT,
- CaMainID INT,
- ManagerUserID SMALLINT,
- Name VARCHAR(100),
- Message NVARCHAR(200),
- SendDate DATETIME,
- NoViewedNum INT,
- OnlineStatus INT,
- LogoUrl VARCHAR(300)
- )
- CREATE TABLE #ChatList2
- (
- CvMainID INT,
- CaMainID INT,
- ManagerUserID SMALLINT,
- Name VARCHAR(100),
- Message NVARCHAR(200),
- SendDate DATETIME,
- NoViewedNum INT,
- OnlineStatus INT,
- LogoUrl VARCHAR(300)
- )
- --客服聊天列表
- INSERT INTO #ChatList1(CvMainID, CaMainID, ManagerUserID, Name, OnlineStatus, LogoUrl)
- SELECT DISTINCT a.cvMainID, a.caMainID, a.ManagerUserID, '客服' as Name, 0, ''
- FROM ChatOnline a, caMain b
- WHERE a.caMainID = b.ID AND a.cvMainID In (SELECT ID FROM CVMAIN WHERE PaMainID = @PaMainID)
- AND (a.AddDate > GETDATE() - 15 OR a.ID IN (
- SELECT ChatOnlineID FROM ChatOnlineLog WHERE IsViewed = 0 ))
- AND (a.caMainID IS NULL or a.caMainID = 0)
-
- UPDATE a SET
- Message = (
- SELECT TOP 1 MESSAGE
- FROM ChatOnlinelog
- WHERE ChatOnlineID IN (SELECT ID FROM ChatOnline WHERE CvMainID = a.CvMainID AND ManagerUserID = a.ManagerUserID)
- Order BY AddDate DESC
- ),
- SendDate = (
- SELECT TOP 1 AddDate
- FROM ChatOnlinelog
- WHERE ChatOnlineID IN (SELECT ID FROM ChatOnline WHERE CvMainID = a.CvMainID AND ManagerUserID = a.ManagerUserID)
- Order BY AddDate DESC),
- NoViewedNum = (
- SELECT COUNT(*)
- FROM ChatOnlinelog
- WHERE ChatOnlineID IN (SELECT ID FROM ChatOnline WHERE CvMainID = a.CvMainID AND ManagerUserID = a.ManagerUserID)
- AND IsViewed = 0
- AND SenderType = 3
- )
- FROM #ChatList1 a
-
- --跟企业聊天列表
- INSERT INTO #ChatList2(CvMainID, CaMainID, ManagerUserID, Name, OnlineStatus, LogoUrl)
- SELECT DISTINCT a.cvMainID, a.caMainID, a.ManagerUserID, c.Name, dbo.GetCaOnlineStatus(a.caMainID), c.LogoFile
- FROM ChatOnline a, caMain b, CpMain c
- WHERE a.cvMainID In (SELECT ID FROM CVMAIN WHERE PaMainID = @PaMainID)
- AND a.caMainID = b.ID
- AND b.CpMainID = c.ID
- AND (a.AddDate > GETDATE() - 15 OR a.ID IN (
- SELECT ChatOnlineID FROM ChatOnlineLog WHERE IsViewed = 0 ))
- AND (a.ManagerUserID IS NULL or a.ManagerUserID = 0)
-
- UPDATE a SET
- Message = (
- SELECT TOP 1 MESSAGE
- FROM ChatOnlinelog
- WHERE ChatOnlineID IN (SELECT ID FROM ChatOnline WHERE CvMainID = a.CvMainID AND CaMainID = a.CaMainID)
- Order BY AddDate DESC
- ),
- SendDate = (
- SELECT TOP 1 AddDate
- FROM ChatOnlinelog
- WHERE ChatOnlineID IN (SELECT ID FROM ChatOnline WHERE CvMainID = a.CvMainID AND CaMainID = a.CaMainID)
- Order BY AddDate DESC),
- NoViewedNum = (
- SELECT COUNT(*)
- FROM ChatOnlinelog
- WHERE ChatOnlineID IN (SELECT ID FROM ChatOnline WHERE CvMainID = a.CvMainID AND CaMainID = a.CaMainID)
- AND IsViewed = 0
- AND SenderType = 1
- )
- FROM #ChatList2 a
- SELECT * FROM #ChatList1 UNION SELECT * FROM #ChatList2
- END
- GO
- /****** Object: StoredProcedure [dbo].[PcChatOnlineLogByPaMainIdForServiceSelect] Script Date: 2018/12/13 19:08:08 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- create PROCEDURE [dbo].[PcChatOnlineLogByPaMainIdForServiceSelect]
- (
- @Id INT
- )
- AS
- BEGIN
- SELECT b.AddDate, a.ManagerUserID, b.Message, c.Name AS ManagerUserName, e.Name AS PaName, b.senderType
- FROM ChatOnline a, ChatOnlineLog b, ManagerUser c, cvMain d, paMain e
- WHERE a.ID = b.ChatOnlineID AND a.cvMainID=d.ID AND d.paMainID=e.ID AND a.ManagerUserID=c.ID
- AND e.ID = @Id
- AND ManagerUserID != 0
- ORDER BY b.AddDate
- END
- GO
- /****** Object: StoredProcedure [dbo].[pcChatOnLineLogByPaMainIDSelect] Script Date: 2018/12/13 19:08:09 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- CREATE PROCEDURE [dbo].[pcChatOnLineLogByPaMainIDSelect]
- (
- @PaMainID INT --求职者的ID
- )
- AS
- SET NOCOUNT ON
- --INSERT INTO procLog SELECT 'pcChatOnLineLogByPaMainIDSelect', @PaMainID, GETDATE()
- BEGIN
- CREATE TABLE #ChatLog
- (
- CaMainID INT,
- CvMainID INT,
- LastMessage VARCHAR(MAX),
- LastReceiverDate SMALLDATETIME,
- Initiative TINYINT
- )
- INSERT INTO #ChatLog
- SELECT
- a.CaMainID,
- a.CvMainID,
- (SELECT TOP 1 Message FROM ChatOnlineLog WHERE ChatOnlineID = MAX(a.ID) ORDER BY AddDate DESC),
- MAX(b.Adddate),
- (SELECT Initiative FROM ChatOnline WHERE ID = MIN(a.ID))
- FROM ChatOnline a, ChatOnlineLog b
- WHERE a.id = b.ChatOnlineID
- AND a.cvMainId IN (SELECT ID FROM CvMain WHERE PaMainID = @PaMainID) --当前个人用户
- GROUP BY a.CaMainID,a.CvMainID
- SELECT
- a.*,
- dbo.GetCaName(b.ID) CaName,
- c.Name CpName,
- d.Name CvName,
- c.SecondID EnCpMainID,
- c.HasLicence,
- c.MemberType,
- c.IsAgent,
- Initiative
- FROM #ChatLog a,caMain b,cpMain c,cvMain d
- WHERE a.caMainID = b.id AND b.cpMainID = c.ID AND a.cvMainID = d.ID
- ORDER BY LastReceiverDate DESC
- END
- GO
- /****** Object: StoredProcedure [dbo].[pcChatOnlineSelect] Script Date: 2018/12/13 19:08:09 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- CREATE PROCEDURE [dbo].[pcChatOnlineSelect]
- (
- @caMainId INT,
- @paMainId INT
- )
- AS
- SET NOCOUNT ON
- BEGIN
- CREATE TABLE #ChatList
- (
- cvMainID INT,
- caMainID INT,
- [Name] VARCHAR(100),
- NoViewedNum INT,
- OnlineStatus INT,
- paMainId INT,
- SecondId VARCHAR(10)
- )
- IF @paMainId > 0
- BEGIN
- DELETE FROM ChatOnlineExchange WHERE UserID = @paMainId AND UserType = 2
- INSERT INTO #ChatList(cvMainID, caMainID, OnlineStatus)
- SELECT TOP 100 cvMainID, caMainID, dbo.GetCaOnlineStatus(caMainID)
- FROM ChatOnline WITH(NOLOCK)
- WHERE caMainID > 0 AND cvMainID IN(
- SELECT ID FROM cvMain WITH(NOLOCK) WHERE paMainID = @paMainId
- )
- ORDER BY AddDate DESC
- UPDATE #ChatList SET NoViewedNum = (
- SELECT COUNT(1)
- FROM ChatOnlineLog WITH(NOLOCK)
- WHERE ChatOnlineID IN (
- SELECT ID FROM ChatOnline WITH(NOLOCK)
- WHERE cvMainID = #ChatList.cvMainID AND caMainID = #ChatList.caMainID
- )
- AND IsViewed = 0 AND SenderType = 1 AND MessageType NOT IN(6, 7)
- )
- UPDATE a SET a.[Name] = c.[Name] + ' ' + b.[Name]
- FROM #ChatList a, cpMain b WITH(NOLOCK), caMain c WITH(NOLOCK)
- WHERE b.ID = c.cpMainID AND c.ID = a.caMainID
- END
- ELSE IF @caMainID > 0
- BEGIN
- DELETE FROM ChatOnlineExchange WHERE UserID = @caMainID AND UserType = 1
- INSERT INTO #ChatList(cvMainID, caMainID)
- SELECT TOP 100 cvMainID, caMainID
- FROM ChatOnline
- WHERE caMainID = @caMainId AND cvMainID > 0
- ORDER BY AddDate DESC
- UPDATE #ChatList SET NoViewedNum = (
- SELECT COUNT(1)
- FROM ChatOnlineLog WITH(NOLOCK)
- WHERE ChatOnlineID IN (
- SELECT ID FROM ChatOnline WITH(NOLOCK)
- WHERE cvMainID = #ChatList.cvMainID AND caMainID = #ChatList.caMainID
- )
- AND IsViewed = 0 AND SenderType = 2 AND MessageType NOT IN(6, 7)
- )
- UPDATE #ChatList SET OnlineStatus = (
- SELECT TOP 1 dbo.GetPaOnlineStatus(paMainID)
- FROM cvMain WITH(NOLOCK)
- WHERE ID = #ChatList.cvMainID
- )
- UPDATE #ChatList SET [Name] = (
- SELECT TOP 1 dbo.GetPaName(#ChatList.cvMainId, cpMainId)
- FROM caMain WITH(NOLOCK)
- WHERE ID = #ChatList.caMainId
- )
- UPDATE a SET a.paMainId = b.paMainId, a.SecondId = b.SecondId FROM #ChatList a, cvMain b WHERE a.cvMainId = b.Id
- END
- SELECT * FROM #ChatList
- END
- GO
- /****** Object: StoredProcedure [dbo].[pcChatOnLineStatusUpdate] Script Date: 2018/12/13 19:08:09 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- -----创建人:Nick
- -----创建时间:2014-9-11
- -----用途:用于修改个人或企业的在线状态
- CREATE PROCEDURE [dbo].[pcChatOnLineStatusUpdate]
- (
- @CaMainID INT, --企业用户ID
- @PaMainID INT --个人用户ID
- )
- AS
- SET NOCOUNT ON
- --INSERT INTO _1 SELECT @caMainID, @paMainId, GETDATE()
- BEGIN
- IF(@CaMainID !=0) --修改企业用户在线状态
- BEGIN
- IF NOT EXISTS(SELECT 'x' FROM caOnline WITH(NOLOCK)
- WHERE caMainID = @CaMainID)
- INSERT INTO caOnline (CaMainID,IsOnline,IsVi,RefreshDate)
- VALUES (@CaMainID,1,0,GETDATE())
- ELSE
- UPDATE caOnline SET RefreshDate=GETDATE(),IsOnline=1 where caMainID=@caMainID
- END
- ELSE --修改个人用户在线状态
- BEGIN
- IF NOT EXISTS(SELECT 'x' FROM paOnline WITH(NOLOCK)
- WHERE paMainID = @PaMainID)
- INSERT INTO paOnline (paMainID,IsOnline,RefreshDate)
- VALUES (@PaMainID,1,GETDATE())
- ELSE
- UPDATE paOnline SET RefreshDate=GETDATE(),IsOnline=1 where PaMainID=@PaMainID
- END
- END
- GO
- /****** Object: StoredProcedure [dbo].[pccpImageSelect] Script Date: 2018/12/13 19:08:09 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- --=============================================
- CREATE PROCEDURE [dbo].[pccpImageSelect]
- @cpMainID INT
- AS
- BEGIN
- SET NOCOUNT ON
- SELECT a.*,b.HasLogo
- FROM cpImage a WITH(NOLOCK ),cpMain b with(NOLOCK)
- WHERE a.cpMainID= b.ID and a.ImgType=1 AND a.cpMainID=@cpMainID
- SET NOCOUNT OFF
- END
- GO
- /****** Object: StoredProcedure [dbo].[pcCpMainBycaMainIdSelect] Script Date: 2018/12/13 19:08:09 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- /**********************8
- sean 2014-10-29
- ***********************/
- CREATE PROCEDURE [dbo].[pcCpMainBycaMainIdSelect]
- (
- @caMainID INT
- )
- AS
- --INSERT INTO procLog SELECT 'pcCpMainBycaMainIdSelect', @caMainID, GETDATE()
- BEGIN
- SELECT a.ID, a.Name ShowName, a.SecondID ShowID, dbo.GetCaName(b.ID) UserName, a.RegDate,
- ISNULL((SELECT IsOnline FROM caOnline WITH(NOLOCK) WHERE caMainId = @caMainID), 0) IsOnline
- FROM cpMain a, caMain b
- WHERE a.ID = b.cpMainID
- AND b.ID = @caMainID
- END
- GO
- /****** Object: StoredProcedure [dbo].[pcCpMainByNameSelect] Script Date: 2018/12/13 19:08:10 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- CREATE PROCEDURE [dbo].[pcCpMainByNameSelect]
- (
- @Name VARCHAR(25)
- )
- AS
- --INSERT INTO procLog SELECT 'pcCpMainByNameSelect', @Name, GETDATE()
- BEGIN
- DECLARE @t AS TABLE(ID INT,
- SecondId VARCHAR(12),
- ProvinceName NVARCHAR(10),
- Name NVARCHAR(50)
- )
- INSERT INTO @t
- SELECT TOP 50 a.ID, a.SecondId,
- (SELECT ProvinceName
- FROM dcProvince WITH(NOLOCK)
- WHERE dcProvince.ID = LEFT(a.dcRegionID, 2)) ProvinceName,
- a.Name
- FROM cpMainPublish a WITH(NOLOCK),
- CONTAINSTABLE(cpMainPublish, Name, @Name, 100) AS b
- WHERE a.Id = b.[Key]
- IF NOT EXISTS(SELECT 'x' FROM @t)
- BEGIN
- INSERT @t
- SELECT TOP 50 ID,SecondId,
- (SELECT ProvinceName
- FROM dcProvince WITH(NOLOCK)
- WHERE dcProvince.ID = LEFT(cpMainPublish.dcRegionID, 2)) ProvinceName,
- Name
- FROM cpMainPublish WITH(NOLOCK INDEX(IX_cpMainPublish_Name))
- WHERE Name LIKE @Name + '%'
- ORDER BY RefreshDate DESC
- END
- SELECT * FROM @t
- /*
- IF (@Name LIKE '%公司%' AND LEN(@Name) > 6) OR LEN(@Name) > 10
- BEGIN
- SELECT TOP 50 ID,SecondId,
- (SELECT ProvinceName
- FROM dcProvince WITH(NOLOCK)
- WHERE dcProvince.ID = cpMain.dcProvinceID)
- ProvinceName,
- Name
- FROM cpMain WITH(NOLOCK INDEX(IX_cpmain_Name))
- WHERE Name LIKE @Name + '%'
- ORDER BY RefreshDate DESC
- END
- ELSE
- BEGIN
- SELECT TOP 50 ID, SecondId,
- (SELECT ProvinceName
- FROM dcProvince WITH(NOLOCK)
- WHERE dcProvince.ID = cpMain.dcProvinceID) ProvinceName,
- Name
- FROM cpMain WITH(NOLOCK)
- WHERE Name LIKE '%' + @Name + '%'
- ORDER BY RefreshDate DESC
- END
- */
- END
- GO
- /****** Object: StoredProcedure [dbo].[pcCvAppendixByIDSelect] Script Date: 2018/12/13 19:08:10 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- --=============================================
- -- 创建: sean
- -- 检查: 2010-9-27
- -- 说明: 取消各字段,改为*
- --=============================================
- CREATE PROCEDURE [dbo].[pcCvAppendixByIDSelect]
- @ID INT
- AS
- BEGIN
- SELECT *
- FROM CvAppendix WITH(NOLOCK INDEX(PK_cvAppendix))
- WHERE ID = @ID
- END
- GO
- /****** Object: StoredProcedure [dbo].[pcCvAppendixDelete] Script Date: 2018/12/13 19:08:10 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- --=============================================
- -- 创建: sean
- -- 检查: 2010-9-27
- -- 说明: 取消pcCvMainByCvLevelUpdate,取消pcCvMainVerifyResultCheck
- -- 修改:Lambo,2010-11-25
- -- 描述:增加了paMainID参数,判断是否是本人的
- --=============================================
- CREATE PROCEDURE [dbo].[pcCvAppendixDelete]
- @ID INT,
- @paMainID INT
- AS
- BEGIN TRAN
- BEGIN TRY
- DECLARE @cvMainID AS INT
- DECLARE @RETURN AS VARCHAR(2)
- SELECT @cvMainID = cvMainID FROM CvAppendix WITH(NOLOCK) WHERE ID = @ID
-
- IF @cvMainID IS NULL
- GOTO ERR
- IF NOT EXISTS(SELECT 'x' FROM cvMain WITH(NOLOCK)
- WHERE ID = @cvMainID AND paMainID = @paMainID)
- GOTO ERR
- DELETE FROM bsCvModify WHERE SubID = @ID AND Location LIKE 'c%'
- DELETE FROM CvAppendix WHERE ID=@ID
- EXEC @RETURN = pcCvMainByCvLevelCheck @cvMainID, 10
- END TRY
- BEGIN CATCH
- GOTO ERR
- END CATCH
- COMMIT TRAN
- RETURN @RETURN
- ERR:
- BEGIN
- ROLLBACK TRAN
- RETURN 3
- END
- GO
- /****** Object: StoredProcedure [dbo].[pcCvAppendixSave] Script Date: 2018/12/13 19:08:10 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- -- = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
- -- 创建: Sean
- -- 检查: 2010-9-27 未完成,原先隐藏了对bsCvModify的操作
- -- 修改:Lambo,2010-11-25
- -- 描述:增加了paMainID参数,判断是否是本人的
- -- 修改:harry 重复证书 增加描述时间判断是否重复 2018-1-4
- -- = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
- CREATE PROCEDURE [dbo].[pcCvAppendixSave]
- (
- @Type INT,
- @ID INT,
- @cvMainID INT,
- @dcAppendixID SMALLINT,
- @Name VARCHAR(250),
- @Description VARCHAR(1000),
- @AccessDate SMALLINT,
- @paMainID INT
- )
- AS
- SET NOCOUNT ON
- IF CHARINDEX('<', @Name) > 0
- SET @Name = REPLACE(@Name, '<', '')
- IF CHARINDEX('<', @Description) > 0
- SET @Description = REPLACE(@Description, '<', '')
- BEGIN TRAN
- ----检查是否是该账号的简历
- IF NOT EXISTS(SELECT 'x' FROM cvMain WITH(NOLOCK) WHERE ID = @cvMainID AND paMainID = @paMainID)
- GOTO ERR1
- ----检查是否是该简历的证书
- IF @ID > 0
- IF NOT EXISTS(SELECT 'x' FROM cvAppendix WITH(NOLOCK) WHERE ID = @ID AND cvMainID = @cvMainID)
- GOTO ERR2
- ----不能有重复的证件
- IF EXISTS(SELECT 'x' FROM cvAppendix WITH(NOLOCK)
- WHERE cvMainID = @cvMainID AND dcAppendixID = @dcAppendixID
- AND ID <> @ID AND dcAppendixID < 999 AND Description = @Description AND AccessDate = @AccessDate)
- GOTO ERR3
- SELECT @Description = dbo.SafeSql(dbo.TextTrim(@Description)),
- @Name = dbo.SafeSql(dbo.TextTrim(@Name))
- IF @dcAppendixID IS NULL
- GOTO ERR4
- IF @dcAppendixID = 999 AND @Name IS NULL
- GOTO ERR5
- IF @dcAppendixID < 999
- SELECT @Name = Description FROM dcAppendix WITH(NOLOCK) WHERE ID = @dcAppendixID
- DECLARE @MaxId AS INT
- DECLARE @NameOld AS VARCHAR(250)
- DECLARE @DescriptionOld AS VARCHAR(1000)
- DECLARE @CNT AS INT
- BEGIN TRY
- IF @Type = 0 --中文
- BEGIN
- DECLARE @N AS NVARCHAR(50)
- DECLARE @D AS NVARCHAR(200)
- SET @N = @Name
- SET @D = @Description
- IF @ID>0 --修改证书
- BEGIN
- SELECT @NameOld = dbo.TextTrim(Name), @DescriptionOld = dbo.TextTrim(Description)
- FROM cvAppendix WITH(NOLOCK)
- WHERE ID = @ID
- UPDATE CvAppendix SET
- Name = @N,
- dcAppendixID = @dcAppendixID,
- Description = @D,
- AccessDate = @AccessDate
- WHERE ID = @ID
- SET @MaxID = @ID
- IF @dcAppendixID = 999
- BEGIN
- IF ISNULL(@NameOld, '') <> ISNULL(@N, '')
- BEGIN
- DELETE FROM bsCvModify WHERE SubID = @ID AND Location = 'cc1'
- INSERT INTO bsCvModify(paMainID,cvMainID,SubID,Location,ColValue) VALUES(@paMainID,@cvMainID,@MaxID,'cc1',@N)
- END
- END
- ELSE
- DELETE FROM bsCvModify WHERE SubID = @ID AND Location = 'cc1'
- IF @D IS NULL
- DELETE FROM bsCvModify WHERE SubID = @ID AND Location = 'cc2'
- ELSE
- IF ISNULL(LTRIM(@DescriptionOld), '') <> @D
- BEGIN
- DELETE FROM bsCvModify WHERE SubID = @ID AND Location = 'cc2'
- INSERT INTO bsCvModify(paMainID,cvMainID,SubID,Location,ColValue) VALUES(@paMainID,@cvMainID,@MaxID,'cc2',@D)
- END
- END
- ELSE --新增证书
- BEGIN
- SELECT @CNT=COUNT(*) FROM CvAppendix WITH(NOLOCK) WHERE cvMainID = @cvMainID
- IF @CNT<10
- BEGIN
- INSERT INTO CvAppendix(cvMainID, Name, AccessDate, dcAppendixID, Description)
- VALUES(@cvMainID, @N, @AccessDate, @dcAppendixID, @D)
- SET @MaxID = @@IDENTITY
- IF @dcAppendixID = 999
- INSERT INTO bsCvModify(paMainID,cvMainID,SubID,Location,ColValue) VALUES(@paMainID,@cvMainID,@MaxID,'cc1',@Name)
- IF LTRIM(@Description) >''
- INSERT INTO bsCvModify(paMainID,cvMainID,SubID,Location,ColValue) VALUES(@paMainID,@cvMainID,@MaxID,'cc2',@Description)
- END
- END
- END
- ELSE --英文
- BEGIN
- IF @ID>0 --修改证书
- BEGIN
- SELECT @NameOld = dbo.TextTrim(NameEng), @DescriptionOld = dbo.TextTrim(DescriptionEng)
- FROM cvAppendix WITH(NOLOCK)
- WHERE ID = @ID
- UPDATE CvAppendix SET
- NameEng = @Name,
- AccessDate = @AccessDate,
- dcAppendixID = @dcAppendixID,
- DescriptionEng = @Description
- WHERE ID = @ID
- SET @MaxID = @ID
- IF @dcAppendixID = 999
- BEGIN
- IF ISNULL(@NameOld, '') <> ISNULL(@Name, '')
- BEGIN
- DELETE FROM bsCvModify WHERE SubID = @ID AND Location = 'ce1'
- INSERT INTO bsCvModify(paMainID,cvMainID,SubID,Location,ColValue) VALUES(@paMainID,@cvMainID,@MaxID,'ce1',@Name)
- END
- END
- ELSE
- DELETE FROM bsCvModify WHERE SubID = @ID AND Location = 'ce1'
- IF @Description IS NULL
- DELETE FROM bsCvModify WHERE SubID = @ID AND Location = 'ce2'
- ELSE
- IF ISNULL(@DescriptionOld, '') <> @Description
- BEGIN
- DELETE FROM bsCvModify WHERE SubID = @ID AND Location = 'ce2'
- INSERT INTO bsCvModify(paMainID,cvMainID,SubID,Location,ColValue) VALUES(@paMainID,@cvMainID,@MaxID,'ce2',@Description)
- END
- END
- ELSE --新增证书
- BEGIN
- SELECT @CNT=COUNT(*) FROM CvAppendix WITH(NOLOCK) WHERE cvMainID = @cvMainID
- IF @CNT<5
- BEGIN
- INSERT INTO CvAppendix(cvMainID, NameEng, dcAppendixID, AccessDate, DescriptionEng)
- VALUES(@cvMainID, @Name, @dcAppendixID, @AccessDate, @Description)
- SET @MaxID = @@IDENTITY
- IF @dcAppendixID = 999
- INSERT INTO bsCvModify(paMainID,cvMainID,SubID,Location,ColValue) VALUES(@paMainID,@cvMainID,@MaxID,'ce1',@Name)
- IF @Description IS NOT NULL
- INSERT INTO bsCvModify(paMainID,cvMainID,SubID,Location,ColValue) VALUES(@paMainID,@cvMainID,@MaxID,'ce2',@Description)
- END
- END
- END
- --修改cvLevel
- DECLARE @SQL AS VARCHAR(100)
- SET @SQL = 'EXEC pcCvMainByCvLevelUpdateNew ' + CONVERT(CHAR(1), @Type) + ',' + CONVERT(VARCHAR(10), @cvMainID) + ',10,1'
- EXEC(@SQL)
- EXEC pcCvMainByCvLevelCheck @cvMainID, 10
- END TRY
- BEGIN CATCH
- GOTO ERR
- END CATCH
- COMMIT TRAN
- RETURN @MaxID
- ERR:
- BEGIN
- ROLLBACK TRAN
- RETURN 0
- END
- ERR1:
- BEGIN
- ROLLBACK TRAN
- RETURN -1
- END
- ERR2:
- BEGIN
- ROLLBACK TRAN
- RETURN -2
- END
- ERR3:
- BEGIN
- ROLLBACK TRAN
- RETURN -3
- END
- ERR4:
- BEGIN
- ROLLBACK TRAN
- RETURN -4
- END
- ERR5:
- BEGIN
- ROLLBACK TRAN
- RETURN -5
- END
-
- GO
- /****** Object: StoredProcedure [dbo].[pcCvAppendixSelect] Script Date: 2018/12/13 19:08:11 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- /*############################################
- 创建: sean
- 检查: 2010-10-5
- 说明: 取消各字段,改为*
- ############################################*/
- CREATE PROCEDURE [dbo].[pcCvAppendixSelect]
- (
- @cvMainID INT,
- @lan INT
- )
- AS
- BEGIN
- SELECT *
- FROM CvAppendix WITH(NOLOCK INDEX(IX_cvAppendix_cvMainID))
- WHERE cvMainID = @cvMainID
- ORDER BY AccessDate DESC, ID
- /*
- IF @lan>0
- SELECT *
- FROM CvAppendix WITH(NOLOCK INDEX(IX_cvAppendix_cvMainID))
- WHERE cvMainID = @cvMainID
- AND (dcAppendixID<999 OR name>'')
- ELSE IF @lan=0
- SELECT *
- FROM CvAppendix WITH(NOLOCK INDEX(IX_cvAppendix_cvMainID))
- WHERE cvMainID = @cvMainID
- AND (dcAppendixID<999 OR nameEng>'')
- ELSE 用于个人后台修改页面
- SELECT *
- FROM CvAppendix WITH(NOLOCK INDEX(IX_cvAppendix_cvMainID))
- WHERE cvMainID = @cvMainID
- */
- END
- GO
- /****** Object: StoredProcedure [dbo].[pcCvAttachmentBySaveInsert] Script Date: 2018/12/13 19:08:12 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- --新版的附件简历上传简历
- CREATE PROCEDURE [dbo].[pcCvAttachmentBySaveInsert]
- (
- @ID INT,
- @Attachment VARCHAR(50),
- @FileName VARCHAR(50),
- @paMainID INT
- )
- AS
- SET NOCOUNT ON
- IF CHARINDEX('<', @Attachment) > 0
- SET @Attachment = REPLACE(@Attachment, '<', '<')
- IF CHARINDEX('<', @FileName) > 0
- SET @FileName = REPLACE(@FileName, '<', '<')
- BEGIN TRY
- DECLARE @paID AS INT
- SELECT @paID = paMainID FROM cvMain WITH(NOLOCK) WHERE ID = @ID
- IF @paMainID = 0
- BEGIN
- --无账号
- IF @paID IS NULL
- RETURN 0
- END
- ELSE
- IF @paID <> @paMainID --cvMainID.paMainID <> paMain.ID,简历和账号不对应
- RETURN 0
-
- IF (SELECT COUNT(1) FROM cvAttachment WITH(NOLOCK) WHERE cvMainID = @ID AND VerifyResult <> 0) >= 3 --一份简历的附件不能超过3份
- RETURN -1
- INSERT INTO cvAttachment(cvMainID,FilePath,[FileName])
- VALUES(@ID,@Attachment,@FileName)
-
- UPDATE CvMain SET Attachment = 'X' WHERE id = @ID
- IF(SELECT RefreshDate FROM cvMain WITH(NOLOCK) WHERE ID = @ID) > DATEADD(HOUR, -1, GETDATE())
- UPDATE cvMain SET RefreshDate = GETDATE() WHERE ID = @ID
-
- RETURN 1
- END TRY
- BEGIN CATCH
- print 0
- RETURN 0
- END CATCH
- GO
- /****** Object: StoredProcedure [dbo].[pccvEducationByCvMainIDSelect] Script Date: 2018/12/13 19:08:12 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- --#####################################################
- --创建时间:2014.10.31
- --创建人:Nick
- --说明:得到毕业院校信息
- --#####################################################
- CREATE PROCEDURE [dbo].[pccvEducationByCvMainIDSelect]
- (
- @CvMainID INT,
- @Degree INT
- )
- AS
- BEGIN TRY
- SELECT TOP 1 GraduateCollage, MajorName, Graduation
- FROM cvEducation WITH(NOLOCK)
- WHERE cvMainID=@CvMainID
- AND Degree=@Degree
- ORDER BY Graduation DESC
- END TRY
- BEGIN CATCH
- RETURN 0
- END CATCH
- GO
- /****** Object: StoredProcedure [dbo].[pcCvEducationByIDSelect] Script Date: 2018/12/13 19:08:12 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- -- =============================================
- -- Author: Sean
- -- Create date: 2010-9-27
- -- Description:
- -- =============================================
- CREATE PROCEDURE [dbo].[pcCvEducationByIDSelect]
- @ID int
- AS
- BEGIN
- SELECT
- *
- FROM cvEducation WITH(NOLOCK INDEX(PK_cvEducation))
- WHERE ID=@ID
- END
- GO
- /****** Object: StoredProcedure [dbo].[pcCvEducationDelete] Script Date: 2018/12/13 19:08:12 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- -----------------------------------------------------------
- --修改:Sean,2010-9-27
- --描述:取消执行pcCvMainByCvLevelUpdate,因为js执行了cvLevelProc.asp,这个应该上线后调整
- --取消pcCvMainVerifyResultCheck
- --修改:Lambo,2010-11-25
- --描述:增加了paMainID参数,判断是否是本人的
- -----------------------------------------------------------
- --[pcCvEducationDelete] 7424951,12222868
- CREATE PROCEDURE [dbo].[pcCvEducationDelete]
- @ID INT,
- @paMainID INT
- AS
- BEGIN TRAN
- BEGIN TRY
- DECLARE @cvMainId AS INT
- DECLARE @RETURN AS VARCHAR(2)
- SELECT @cvMainId = cvMainId FROM cvEducation WITH(NOLOCK) WHERE ID=@ID
-
- IF @cvMainId IS NULL
- GOTO ERR
- IF NOT EXISTS(SELECT 'x' FROM cvMain WITH(NOLOCK)
- WHERE paMainID = @paMainID AND ID = @cvMainID)
- GOTO ERR
-
- DELETE FROM bsCvModify WHERE SubID = @ID AND Location LIKE 'd%'
- DELETE FROM cvEducation WHERE ID=@ID
- ----重新计算最高学位和专业
- DECLARE @dcMajorID AS SMALLINT
- DECLARE @Degree AS TINYINT
- SELECT TOP 1 @dcMajorID = dcMajorID, @Degree = Degree FROM cvEducation WITH(NOLOCK) WHERE cvMainID = @cvMainID ORDER BY Degree DESC
- UPDATE cvMain SET Degree = @Degree, dcMajorID = @dcMajorID WHERE ID = @cvMainID
- EXEC @RETURN = pcCvMainByCvLevelCheck @cvMainID, 3
- END TRY
- BEGIN CATCH
- GOTO ERR
- END CATCH
- COMMIT TRAN
- RETURN @RETURN
- ERR:
- BEGIN
- ROLLBACK TRAN
- RETURN 3
- END
- GO
- /****** Object: StoredProcedure [dbo].[pcCvEducationSave] Script Date: 2018/12/13 19:08:13 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- -----------------------------------------------------------
- --修改:Sean,2010-9-25
- --描述:LastModifyDate=GETDATE(),不再调用存储过程
- --取消执行pcCvMainByCvLevelUpdate,因为js执行了cvLevelProc.asp,这个应该上线后调整
- -- 修改:Lambo,2010-11-25
- -- 描述:增加了paMainID参数,判断是否是本人的
- -----------------------------------------------------------
- CREATE PROCEDURE [dbo].[pcCvEducationSave]
- (
- @Type INT,
- @ID INT,
- @cvMainID INT,
- @GraduateCollage VARCHAR(250),
- @Graduation INT,
- @dcMajorID SMALLINT,
- @MajorName VARCHAR(100),
- @Degree TINYINT,
- @EduType TINYINT,
- @Details VARCHAR(2000),
- @paMainID INT
- )
- AS
- SET NOCOUNT ON
- IF CHARINDEX('<', @GraduateCollage) > 0
- SET @GraduateCollage = REPLACE(@GraduateCollage, '<', '<')
- IF CHARINDEX('<', @MajorName) > 0
- SET @MajorName = REPLACE(@MajorName, '<', '<')
- IF CHARINDEX('<', @Details) > 0
- SET @Details = REPLACE(@Details, '<', '<')
- BEGIN TRAN
- ----检查是否是该账号的简历
- IF NOT EXISTS(SELECT 'x' FROM cvMain WITH(NOLOCK) WHERE ID = @cvMainID AND paMainID = @paMainID)
- GOTO ERR
- ----检查是否是该简历的教育背景
- IF @ID > 0
- IF NOT EXISTS(SELECT 'x' FROM cvEducation WITH(NOLOCK) WHERE ID = @ID AND cvMainID = @cvMainID)
- GOTO ERR
-
- SELECT @GraduateCollage = dbo.SafeSql(dbo.TextTrim(@GraduateCollage)),
- @MajorName = dbo.SafeSql(dbo.TextTrim(@MajorName)),
- @Details = dbo.SafeSql(dbo.TextTrim(@Details))
- DECLARE @MaxId AS INT
- DECLARE @CNT AS INT
- DECLARE @GraduateCollageOld AS VARCHAR(250)
- DECLARE @MajorNameOld AS VARCHAR(100)
- DECLARE @DetailsOld AS VARCHAR(2000)
- DECLARE @cvdcMajorID AS SMALLINT
- DECLARE @Modify AS INT
- SET @Modify=-1
- BEGIN TRY
- IF @Type=0
- BEGIN
- DECLARE @GC AS NVARCHAR(50)
- DECLARE @MN AS NVARCHAR(20)
- DECLARE @D AS NVARCHAR(400)
- SET @GC = @GraduateCollage
- SET @MN = @MajorName
- SET @D = @Details
- IF @ID>0
- BEGIN
- SELECT @GraduateCollageOld = dbo.TextTrim(GraduateCollage),
- @MajorNameOld = dbo.TextTrim(MajorName),
- @DetailsOld = dbo.TextTrim(Details)
- FROM cvEducation WITH(NOLOCK INDEX(PK_cvEducation)) WHERE ID=@ID
- UPDATE cvEducation SET
- GraduateCollage = @GC,
- Graduation = @Graduation,
- dcMajorID = @dcMajorID,
- MajorName =@MN,
- Degree = @Degree,
- EduType = @EduType,
- Details = @D
- WHERE ID=@ID
- SET @MaxID=@ID
- IF ISNULL(@GraduateCollageOld, '') <> ISNULL(@GC, '')
- BEGIN
- DELETE FROM bsCvModify WHERE SubID = @ID AND Location = 'dc1'
- INSERT INTO bsCvModify(paMainID,cvMainID,SubID,Location,ColValue) VALUES(@paMainID,@cvMainID,@MaxID,'dc1',@GC)
- SET @Modify=0
- END
- IF ISNULL(@MajorNameOld, '') <> ISNULL(@MN, '')
- BEGIN
- DELETE FROM bsCvModify WHERE paMainID=@paMainID AND cvMainID=@cvMainID AND SubID = @ID AND Location = 'dc2'
- INSERT INTO bsCvModify(paMainID,cvMainID,SubID,Location,ColValue) VALUES(@paMainID,@cvMainID,@MaxID,'dc2',@MN)
- SET @Modify=0
- END
- IF @D IS NULL
- DELETE FROM bsCvModify WHERE paMainID=@paMainID AND cvMainID=@cvMainID AND SubID = @ID AND Location = 'dc3'
- ELSE
- IF ISNULL(@DetailsOld, '') <> @D
- BEGIN
- DELETE FROM bsCvModify WHERE paMainID=@paMainID AND cvMainID=@cvMainID AND SubID = @ID AND Location = 'dc3'
- INSERT INTO bsCvModify(paMainID,cvMainID,SubID,Location,ColValue) VALUES(@paMainID,@cvMainID,@MaxID,'dc3',@D)
- SET @Modify=0
- END
- END
- ELSE
- BEGIN
- SELECT @CNT=COUNT(*) FROM cvEducation WITH(NOLOCK INDEX(PK_cvEducation)) WHERE cvMainID = @cvMAinID
- IF @CNT<5
- BEGIN
- INSERT INTO cvEducation(cvMainID,GraduateCollage,Graduation,dcMajorID,MajorName,Degree,EduType,Details)
- VALUES(@cvMainID,@GC,@Graduation,@dcMajorID,@MN,@Degree,@EduType,@D)
- SET @MaxID = @@IDENTITY
- INSERT INTO bsCvModify(paMainID,cvMainID,SubID,Location,ColValue) VALUES(@paMainID,@cvMainID,@MaxID,'dc1',@GC)
- INSERT INTO bsCvModify(paMainID,cvMainID,SubID,Location,ColValue) VALUES(@paMainID,@cvMainID,@MaxID,'dc2',@MN)
- SET @Modify=0
- IF @D > ''
- INSERT INTO bsCvModify(paMainID,cvMainID,SubID,Location,ColValue) VALUES(@paMainID,@cvMainID,@MaxID,'dc3',@D)
- END
- ELSE
- GOTO ERR
- END
- END
- ELSE
- BEGIN
- IF @ID>0
- BEGIN
- SELECT @GraduateCollageOld = dbo.TextTrim(GraduateCollageEng),
- @MajorNameOld = dbo.TextTrim(MajorNameEng),
- @DetailsOld = dbo.TextTrim(DetailsEng)
- FROM cvEducation WITH(NOLOCK INDEX(PK_cvEducation)) WHERE ID=@ID
- UPDATE cvEducation SET
- GraduateCollageENG = @GraduateCollage,
- Graduation = @Graduation,
- dcMajorID = @dcMajorID,
- MajorNameEng =@MajorName,
- Degree = @Degree,
- EduType = @EduType,
- DetailsEng = @Details
- WHERE ID=@ID
- SET @MaxID=@ID
- IF ISNULL(@GraduateCollageOld, '') <> ISNULL(@GraduateCollage, '')
- BEGIN
- DELETE FROM bsCvModify WHERE SubID = @ID AND Location = 'de1'
- INSERT INTO bsCvModify(paMainID,cvMainID,SubID,Location,ColValue) VALUES(@paMainID,@cvMainID,@MaxID,'de1',@GraduateCollage)
- SET @Modify=1
- END
- IF ISNULL(@MajorNameOld, '') <> ISNULL(@MajorName, '')
- BEGIN
- DELETE FROM bsCvModify WHERE paMainID=@paMainID AND cvMainID=@cvMainID AND SubID = @ID AND Location = 'de2'
- INSERT INTO bsCvModify(paMainID,cvMainID,SubID,Location,ColValue) VALUES(@paMainID,@cvMainID,@MaxID,'de2',@MajorName)
- SET @Modify=1
- END
- IF @Details IS NULL
- DELETE FROM bsCvModify WHERE paMainID=@paMainID AND cvMainID=@cvMainID AND SubID = @ID AND Location = 'de3'
- ELSE
- IF ISNULL(@DetailsOld, '') <> @Details
- BEGIN
- DELETE FROM bsCvModify WHERE paMainID=@paMainID AND cvMainID=@cvMainID AND SubID = @ID AND Location = 'de3'
- INSERT INTO bsCvModify(paMainID,cvMainID,SubID,Location,ColValue) VALUES(@paMainID,@cvMainID,@MaxID,'de3',@Details)
- SET @Modify=1
- END
- END
- ELSE
- BEGIN
- SELECT @CNT=COUNT(*) FROM cvEducation WITH(NOLOCK INDEX(PK_cvEducation)) WHERE cvMainID = @cvMainID
- IF @CNT<5
- BEGIN
- INSERT INTO cvEducation(cvMainID,GraduateCollageEng,Graduation,dcMajorID,MajorNameEng,Degree,EduType,DetailsEng)
- VALUES(@cvMainID,@GraduateCollage,@Graduation,@dcMajorID,@MajorName,@Degree,@EduType,@Details)
- SET @MaxID = @@IDENTITY
- INSERT INTO bsCvModify(paMainID,cvMainID,SubID,Location,ColValue) VALUES(@paMainID,@cvMainID,@MaxID,'de1',@GraduateCollage)
- INSERT INTO bsCvModify(paMainID,cvMainID,SubID,Location,ColValue) VALUES(@paMainID,@cvMainID,@MaxID,'de2',@MajorName)
- SET @Modify=1
- IF @Details > ''
- INSERT INTO bsCvModify(paMainID,cvMainID,SubID,Location,ColValue) VALUES(@paMainID,@cvMainID,@MaxID,'de3',@Details)
- END
- ELSE
- GOTO ERR
- END
- END
- SELECT @Degree = MAX(DEGREE) FROM cvEducation WITH(NOLOCK) WHERE cvMainID = @cvMainID
- UPDATE cvMain SET Degree=@Degree, dcMajorID=@dcMajorID WHERE ID=@cvMainID
- --修改cvLevel
- DECLARE @SQL AS VARCHAR(100)
- SET @SQL = 'EXEC pcCvMainByCvLevelUpdateNew ' + CONVERT(CHAR(1), @Type) + ',' + CONVERT(VARCHAR(10), @cvMainID) + ',3,1'
- EXEC(@SQL)
- IF EXISTS(SELECT 'x' FROM cvMain WITH(NOLOCK) WHERE Id = @cvMainId AND cvType = 1 AND SUBSTRING(cvLevel, 4, 1) = '0')
- BEGIN
- SET @SQL = 'EXEC pcCvMainByCvLevelUpdateNew ' + CONVERT(CHAR(1), @Type) + ',' + CONVERT(VARCHAR(10), @cvMainID) + ',4,1'
- EXEC(@SQL)
- END
- END TRY
- BEGIN CATCH
- GOTO ERR
- END CATCH
- COMMIT TRAN
- RETURN @MaxID
- ERR:
- BEGIN
- ROLLBACK TRAN
- RETURN 0
- END
- GO
- /****** Object: StoredProcedure [dbo].[pcCvEducationSelect] Script Date: 2018/12/13 19:08:13 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- -- =============================================
- -- Author: Sean
- -- Create date: 2010-9-27
- -- Description:
- -- =============================================
- CREATE PROCEDURE [dbo].[pcCvEducationSelect]
- @cvMainID int
- AS
- BEGIN
- SELECT *,
- (SELECT Description FROM DcMajor WITH(NOLOCK) WHERE ID = cvEducation.dcMajorID ) dcMajorName
- FROM cvEducation WITH(NOLOCK INDEX(IX_cvEducation_CvMainID))
- WHERE cvMainID=@cvMainID
- ORDER BY Degree DESC,Graduation Desc
- END
- GO
- /****** Object: StoredProcedure [dbo].[pcCvEducationSelectByPhone] Script Date: 2018/12/13 19:08:14 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- CREATE PROCEDURE [dbo].[pcCvEducationSelectByPhone]
- @cvMainID int
- AS
- BEGIN
- SELECT a.*,b.Description Major,c.Description EduTypeName,d.Description Education
- FROM cvEducation a WITH(NOLOCK INDEX(IX_cvEducation_CvMainID)),dcMajor b WITH(NOLOCK),dcEduType c WITH(NOLOCK),dcEducation d WITH(NOLOCK)
- WHERE a.dcMajorID=b.ID AND a.EduType=c.ID AND a.Degree=d.ID AND a.cvMainID=@cvMainID
- ORDER BY a.Degree DESC,a.Graduation Desc
- END
- GO
- /****** Object: StoredProcedure [dbo].[pcCvExperienceByIDSelect] Script Date: 2018/12/13 19:08:14 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- ---------------------------------------------------
- --创建 Sean
- -- 2010-9-27
- -- 各字段改为*
- ---------------------------------------------------
- CREATE PROCEDURE [dbo].[pcCvExperienceByIDSelect]
- @ID INT
- AS
- BEGIN
- SELECT *
- FROM cvExperience WITH(NOLOCK INDEX(PK_cvExperience))
- WHERE ID = @ID
- END
- GO
- /****** Object: StoredProcedure [dbo].[pcCvExperienceDelete] Script Date: 2018/12/13 19:08:14 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- -----------------------------------------------
- --创建Sean
- --检查时间 2010-9-27
- --修改了有无工作经验的判断, 取消pcCvMainVerifyResultCheck
- --修改:Lambo,2010-11-25
- --描述:增加了paMainID参数,判断是否是本人的
- -----------------------------------------------
- CREATE PROCEDURE [dbo].[pcCvExperienceDelete]
- (
- @ID INT,
- @paMainID INT
- )
- AS
- SET NOCOUNT ON
- BEGIN TRAN
- BEGIN TRY
- DECLARE @cvMainId AS INT
- DECLARE @RETURN AS VARCHAR(2)
- SELECT @cvMainId = cvMainId FROM cvExperience WITH(NOLOCK) WHERE ID=@ID
- IF @cvMainId IS NULL
- GOTO ERR
- IF NOT EXISTS(SELECT 'x' FROM cvMain WITH(NOLOCK) WHERE paMainID = @paMainID AND ID = @cvMainID)
- GOTO ERR
- DELETE FROM bsCvModify WHERE SubID = @ID AND Location LIKE 'e%'
- DELETE FROM cvExperience WHERE ID=@ID
- END TRY
- BEGIN CATCH
- GOTO ERR
- END CATCH
- COMMIT TRAN
- RETURN @RETURN
- ERR:
- BEGIN
- ROLLBACK TRAN
- RETURN 3
- END
- GO
- /****** Object: StoredProcedure [dbo].[pcCvExperienceSave] Script Date: 2018/12/13 19:08:14 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- -----------------------------------------------------------
- --修改:Sean,2010-9-26
- --描述:LastModifyDate = GETDATE(),不再调用存储过程
- --屏蔽了@Modify,上线后在调整
- --修改:Lambo,2010-11-25
- --描述:增加了paMainID参数,判断是否是本人的
- -----------------------------------------------------------
- CREATE PROCEDURE [dbo].[pcCvExperienceSave]
- (
- @Type INT,
- @ID INT,
- @cvMainID INT,
- @CompanyName VARCHAR(100),
- @dcIndustryID INT,
- @dcCompanySizeID INT,
- @dcJobtypeID INT,
- @JobName VARCHAR(100),
- @BeginDate INT,
- @EndDate INT,
- @SubNodeNum INT,
- @Description VARCHAR(Max),
- @dcCompanyKindID INT = NULL,
- @WorkPlace VARCHAR(6) = NULL,
- @Dept VARCHAR(100) = NULL,
- @UpperPost VARCHAR(100) = NULL,
- @dcLeaveResonID INT = NULL,
- @paMainID INT
- )
- AS
- SET NOCOUNT ON
- IF CHARINDEX('<', @CompanyName) > 0
- SET @CompanyName = REPLACE(@CompanyName, '<', '')
- IF CHARINDEX('<', @JobName) > 0
- SET @JobName = REPLACE(@JobName, '<', '')
- IF CHARINDEX('<', @Description) > 0
- SET @Description = REPLACE(@Description, '<', '')
- IF CHARINDEX('<', @Dept) > 0
- SET @Dept = REPLACE(@Dept, '<', '')
- IF CHARINDEX('<', @UpperPost) > 0
- SET @UpperPost = REPLACE(@UpperPost, '<', '')
- BEGIN TRAN
- ----检查是否是该账号的简历
- IF NOT EXISTS(SELECT 'x' FROM cvMain WITH(NOLOCK) WHERE ID = @cvMainID AND paMainID = @paMainID)
- GOTO ERR
- ----检查是否是该简历的工作经验
- IF @ID > 0
- IF NOT EXISTS(SELECT 'x' FROM cvExperience WITH(NOLOCK) WHERE ID = @ID AND cvMainID = @cvMainID)
- GOTO ERR
- SELECT @CompanyName = dbo.SafeSQL(dbo.TextTrim(@CompanyName)),
- @JobName = dbo.SafeSQL(dbo.TextTrim(@JobName)),
- @Description = dbo.SafeSQL(dbo.TextTrim(@Description)),
- @WorkPlace = dbo.TextTrim(@WorkPlace),
- @Dept = dbo.SafeSQL(dbo.TextTrim(@Dept)),
- @UpperPost = dbo.SafeSQL(dbo.TextTrim(@UpperPost))
- IF CHARINDEX(',', @JobName) > 0
- SELECT @JobName = dbo.SafeSql(REPLACE(@JobName, ',', ','))
- DECLARE @MaxId AS INT
- DECLARE @CNT AS INT
- DECLARE @CompanyNameOld AS VARCHAR(100)
- DECLARE @JobNameOld AS VARCHAR(100)
- DECLARE @DescriptionOld AS VARCHAR(Max)
- DECLARE @DeptOld AS VARCHAR(100)
- DECLARE @UpperPostOld AS VARCHAR(100)
- DECLARE @Modify AS INT
- SET @Modify = -1
- BEGIN TRY
- IF @Type = 0
- BEGIN
- DECLARE @C_CompanyName AS NVARCHAR(30)
- DECLARE @C_JobName AS NVARCHAR(50)
- DECLARE @C_Description AS NVARCHAR(2000)
- DECLARE @C_Dept AS NVARCHAR(20)
- DECLARE @C_UpperPost AS NVARCHAR(20)
- SET @C_CompanyName = dbo.TextTrim(@CompanyName)
- SET @C_JobName = dbo.TextTrim(@JobName)
- SET @C_Description = dbo.TextTrim(@Description)
- SET @C_Dept = dbo.TextTrim(@Dept)
- SET @C_UpperPost = dbo.TextTrim(@UpperPost)
-
- IF @ID>0
- BEGIN
- SELECT @CompanyNameOld = dbo.TextTrim(ISNULL(CompanyName, '')),
- @JobNameOld = dbo.TextTrim(ISNULL(JobName, '')),
- @DescriptionOld = dbo.TextTrim(ISNULL(Description, '')),
- @DeptOld = dbo.TextTrim(ISNULL(Dept, '')),
- @UpperPostOld = dbo.TextTrim(ISNULL(UpperPost, ''))
- FROM cvExperience WITH(NOLOCK INDEX(PK_cvExperience)) WHERE ID = @ID
- UPDATE cvExperience SET
- CompanyName = @C_CompanyName,
- dcIndustryID = @dcIndustryID,
- dcCompanySizeID = @dcCompanySizeID,
- dcJobtypeID = @dcJobtypeID,
- JobName = @C_JobName,
- BeginDate = @BeginDate,
- EndDate = @EndDate,
- SubNodeNum = @SubNodeNum,
- Description = @C_Description,
- dcCompanyKindID = @dcCompanyKindID,
- WorkPlace = @WorkPlace,
- Dept = @C_Dept,
- UpperPost = @C_UpperPost,
- dcLeaveResonID = @dcLeaveResonID
- WHERE ID = @ID
- SET @MaxID = @ID
- IF ISNULL(@CompanyNameOld, '') <> ISNULL(@C_CompanyName, '')
- BEGIN
- DELETE FROM bsCvModify WHERE SubID = @ID AND Location = 'ec1'
- INSERT INTO bsCvModify(paMainID,cvMainID,SubID,Location,ColValue) VALUES(@paMainID,@cvMainID,@MaxID,'ec1',@CompanyName)
- SET @Modify = 0
- END
- IF ISNULL(@JobNameOld, '') <> ISNULL(@C_JobName, '')
- BEGIN
- DELETE FROM bsCvModify WHERE paMainID = @paMainID AND cvMainID = @cvMainID AND SubID = @ID AND Location = 'ec2'
- INSERT INTO bsCvModify(paMainID,cvMainID,SubID,Location,ColValue) VALUES(@paMainID,@cvMainID,@MaxID,'ec2',@C_JobName)
- SET @Modify = 0
- END
- IF ISNULL(@DescriptionOld, '') <> ISNULL(@C_Description, '')
- BEGIN
- DELETE FROM bsCvModify WHERE paMainID = @paMainID AND cvMainID = @cvMainID AND SubID = @ID AND Location = 'ec3'
- INSERT INTO bsCvModify(paMainID,cvMainID,SubID,Location,ColValue) VALUES(@paMainID,@cvMainID,@MaxID,'ec3',@C_Description)
- SET @Modify = 0
- END
- IF @C_Dept IS NULL
- DELETE FROM bsCvModify WHERE paMainID = @paMainID AND cvMainID = @cvMainID AND SubID = @ID AND Location = 'ec4'
- ELSE
- IF ISNULL(@DeptOld, '') <> @C_Dept
- BEGIN
- DELETE FROM bsCvModify WHERE paMainID = @paMainID AND cvMainID = @cvMainID AND SubID = @ID AND Location = 'ec4'
- INSERT INTO bsCvModify(paMainID,cvMainID,SubID,Location,ColValue) VALUES(@paMainID,@cvMainID,@MaxID,'ec4',@C_Dept)
- SET @Modify = 0
- END
- IF @UpperPost IS NULL
- DELETE FROM bsCvModify WHERE paMainID = @paMainID AND cvMainID = @cvMainID AND SubID = @ID AND Location = 'ec5'
- ELSE
- IF ISNULL(@UpperPostOld, '') <> @C_UpperPost
- BEGIN
- DELETE FROM bsCvModify WHERE paMainID = @paMainID AND cvMainID = @cvMainID AND SubID = @ID AND Location = 'ec5'
- INSERT INTO bsCvModify(paMainID,cvMainID,SubID,Location,ColValue) VALUES(@paMainID,@cvMainID,@MaxID,'ec5',@C_UpperPost)
- SET @Modify = 0
- END
- END
- ELSE
- BEGIN
- SELECT @CNT = COUNT(*) FROM cvExperience WITH(NOLOCK INDEX(IX_cvExperience_cvMainID)) WHERE cvMainID = @cvMainID
- IF @CNT<20
- BEGIN
- INSERT INTO cvExperience
- (cvMainID,CompanyName,dcIndustryID,dcCompanySizeID,dcJobtypeID,JobName,
- BeginDate,EndDate,SubNodeNum,Description,dcCompanyKindID,WorkPlace,Dept,
- UpperPost,dcLeaveResonID)
- VALUES
- (@cvMainID,@CompanyName,@dcIndustryID,@dcCompanySizeID,@dcJobtypeID,@JobName,
- @BeginDate,@EndDate,@SubNodeNum,@Description,@dcCompanyKindID,@WorkPlace,@Dept,
- @UpperPost,@dcLeaveResonID)
- SET @MaxID = @@IDENTITY
- INSERT INTO bsCvModify(paMainID,cvMainID,SubID,Location,ColValue) VALUES(@paMainID,@cvMainID,@MaxID,'ec1',@C_CompanyName)
- INSERT INTO bsCvModify(paMainID,cvMainID,SubID,Location,ColValue) VALUES(@paMainID,@cvMainID,@MaxID,'ec2',@C_JobName)
- INSERT INTO bsCvModify(paMainID,cvMainID,SubID,Location,ColValue) VALUES(@paMainID,@cvMainID,@MaxID,'ec3',@C_Description)
- IF @Dept > ''
- INSERT INTO bsCvModify(paMainID,cvMainID,SubID,Location,ColValue) VALUES(@paMainID,@cvMainID,@MaxID,'ec4',@C_Dept)
- IF @UpperPost > ''
- INSERT INTO bsCvModify(paMainID,cvMainID,SubID,Location,ColValue) VALUES(@paMainID,@cvMainID,@MaxID,'ec5',@C_UpperPost)
- SET @Modify = 0
- END
- ELSE
- GOTO ERR
- END
- END
- ELSE
- BEGIN
- IF @ID>0
- BEGIN
- SELECT @CompanyNameOld = dbo.TextTrim(ISNULL(CompanyNameEng, '')),
- @JobNameOld = dbo.TextTrim(iSNULL(JobNameEng, '')),
- @DescriptionOld = dbo.TextTrim(ISNULL(DescriptionEng, '')),
- @DeptOld = dbo.TextTrim(ISNULL(DeptEng, '')),
- @UpperPostOld = dbo.TextTrim(ISNULL(UpperPostEng, ''))
- FROM cvExperience WITH(NOLOCK INDEX(PK_cvExperience))
- WHERE ID = @ID
- UPDATE cvExperience SET
- CompanyNameEng = @CompanyName,
- dcIndustryID = @dcIndustryID,
- dcCompanySizeID = @dcCompanySizeID,
- dcJobtypeID = @dcJobtypeID,
- JobNameEng = @JobName,
- BeginDate = @BeginDate,
- EndDate = @EndDate,
- SubNodeNum = @SubNodeNum,
- DescriptionEng = @Description,
- dcCompanyKindID = @dcCompanyKindID,
- WorkPlace = @WorkPlace,
- DeptEng = @Dept,
- UpperPostEng = @UpperPost,
- dcLeaveResonID = @dcLeaveResonID
- WHERE ID = @ID
- SET @MaxID = @ID
- IF ISNULL(@CompanyNameOld, '') <> ISNULL(@CompanyName, '')
- BEGIN
- DELETE FROM bsCvModify WHERE SubID = @ID AND Location = 'ee1'
- INSERT INTO bsCvModify(paMainID,cvMainID,SubID,Location,ColValue) VALUES(@paMainID,@cvMainID,@MaxID,'ee1',@CompanyName)
- SET @Modify = 1
- END
- IF ISNULL(@JobNameOld, '') <> ISNULL(@JobName, '')
- BEGIN
- DELETE FROM bsCvModify WHERE paMainID = @paMainID AND cvMainID = @cvMainID AND SubID = @ID AND Location = 'ee2'
- INSERT INTO bsCvModify(paMainID,cvMainID,SubID,Location,ColValue) VALUES(@paMainID,@cvMainID,@MaxID,'ee2',@JobName)
- SET @Modify = 1
- END
- IF ISNULL(@DescriptionOld, '') <> ISNULL(@Description, '')
- BEGIN
- DELETE FROM bsCvModify WHERE paMainID = @paMainID AND cvMainID = @cvMainID AND SubID = @ID AND Location = 'ee3'
- INSERT INTO bsCvModify(paMainID,cvMainID,SubID,Location,ColValue) VALUES(@paMainID,@cvMainID,@MaxID,'ee3',@Description)
- SET @Modify = 1
- END
- IF @Dept IS NULL
- DELETE FROM bsCvModify WHERE paMainID = @paMainID AND cvMainID = @cvMainID AND SubID = @ID AND Location = 'ee4'
- ELSE
- IF ISNULL(@DeptOld, '') <> @Dept
- BEGIN
- DELETE FROM bsCvModify WHERE paMainID = @paMainID AND cvMainID = @cvMainID AND SubID = @ID AND Location = 'ee4'
- INSERT INTO bsCvModify(paMainID,cvMainID,SubID,Location,ColValue) VALUES(@paMainID,@cvMainID,@MaxID,'ee4',@Dept)
- SET @Modify = 1
- END
- IF @UpperPost IS NULL
- DELETE FROM bsCvModify WHERE paMainID = @paMainID AND cvMainID = @cvMainID AND SubID = @ID AND Location = 'ee5'
- ELSE
- IF ISNULL(@UpperPostOld, '') <> @UpperPost
- BEGIN
- DELETE FROM bsCvModify WHERE paMainID = @paMainID AND cvMainID = @cvMainID AND SubID = @ID AND Location = 'ee5'
- INSERT INTO bsCvModify(paMainID,cvMainID,SubID,Location,ColValue) VALUES(@paMainID,@cvMainID,@MaxID,'ee5',@UpperPost)
- SET @Modify = 1
- END
- END
- ELSE
- BEGIN
- INSERT INTO cvExperience
- (cvMainID,CompanyNameEng,dcIndustryID,dcCompanySizeID,dcJobtypeID,JobNameEng,
- BeginDate,EndDate,SubNodeNum,DescriptionEng,dcCompanyKindID,WorkPlace,DeptEng,
- UpperPostEng,dcLeaveResonID)
- VALUES
- (@cvMainID,@CompanyName,@dcIndustryID,@dcCompanySizeID,@dcJobtypeID,@JobName,
- @BeginDate,@EndDate,@SubNodeNum,@Description,@dcCompanyKindID,@WorkPlace,@Dept,
- @UpperPost,@dcLeaveResonID)
- SET @MaxID = @@IDENTITY
- INSERT INTO bsCvModify(paMainID,cvMainID,SubID,Location,ColValue) VALUES(@paMainID,@cvMainID,@MaxID,'ee1',@CompanyName)
- INSERT INTO bsCvModify(paMainID,cvMainID,SubID,Location,ColValue) VALUES(@paMainID,@cvMainID,@MaxID,'ee2',@JobName)
- INSERT INTO bsCvModify(paMainID,cvMainID,SubID,Location,ColValue) VALUES(@paMainID,@cvMainID,@MaxID,'ee3',@Description)
- SET @Modify = 1
- IF @Dept > ''
- INSERT INTO bsCvModify(paMainID,cvMainID,SubID,Location,ColValue) VALUES(@paMainID,@cvMainID,@MaxID,'ee4',@Dept)
- IF @UpperPost > ''
- INSERT INTO bsCvModify(paMainID,cvMainID,SubID,Location,ColValue) VALUES(@paMainID,@cvMainID,@MaxID,'ee5',@UpperPost)
- END
- END
- UPDATE cvMain SET cvType = 0 WHERE Id = @CvMainId AND cvType = 1
- --修改cvLevel
- DECLARE @SQL AS VARCHAR(100)
- SET @SQL = 'EXEC pcCvMainByCvLevelUpdateNew ' + CONVERT(CHAR(1), @Type) + ',' + CONVERT(VARCHAR(10), @cvMainID) + ',4,1'
- EXEC(@SQL)
- END TRY
- BEGIN CATCH
- GOTO ERR
- END CATCH
- COMMIT TRAN
- RETURN @MaxID
- ERR:
- BEGIN
- ROLLBACK TRAN
- RETURN 0
- END
- GO
- /****** Object: StoredProcedure [dbo].[pcCvExperienceSelect] Script Date: 2018/12/13 19:08:14 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- ----------------------------------
- --创建: Sean
- --检查: 2010-9-27
- ----------------------------------
- CREATE PROCEDURE [dbo].[pcCvExperienceSelect]
- @cvMainID INT
- AS
- BEGIN
- SELECT *
- FROM cvExperience WITH(NOLOCK INDEX(IX_cvExperience_cvMainID))
- WHERE cvMainID = @cvMainID
- ORDER BY BeginDate DESC
- END
- GO
- /****** Object: StoredProcedure [dbo].[pcCvExperienceSelectByPhone] Script Date: 2018/12/13 19:08:14 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- CREATE PROCEDURE [dbo].[pcCvExperienceSelectByPhone]
- @cvMainID INT
- AS
- BEGIN
- SELECT a.*,b.Description JobType,c.Description CpmpanySize,d.Description Industry,
- g.Description LowerNumber,e.Description CompanyKind,f.Description LeaveReson,h.FullName Region
- FROM cvExperience a WITH(NOLOCK INDEX(IX_cvExperience_cvMainID))
- INNER JOIN dcJobType b WITH(NOLOCK) ON a.dcJobTypeID=b.ID
- INNER JOIN dcCompanySize c WITH(NOLOCK) ON a.dcCompanySizeID=c.ID
- INNER JOIN dcIndustry d WITH(NOLOCK) ON a.dcIndustryID=d.ID
- INNER JOIN dcLowerNumber g WITH(NOLOCK) ON a.SubNodeNum=g.ID
- LEFT JOIN dcCompanyKind e WITH(NOLOCK) ON a.dcCompanyKindID=e.ID
- LEFT JOIN dcLeaveReson f WITH(NOLOCK) ON a.dcLeaveResonID=f.ID
- LEFT JOIN dcRegion h WITH(NOLOCK) ON a.WorkPlace=h.ID
- WHERE cvMainID=@cvMainID
- ORDER BY a.BeginDate DESC
- END
- GO
- /****** Object: StoredProcedure [dbo].[pccvImportPrevByPaMainIDSelect] Script Date: 2018/12/13 19:08:15 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- --#####################################################
- --创建时间:2014.10.31
- --创建人:Nick
- --说明:获取该简历在简历导入的认证信息
- --#####################################################
- CREATE PROCEDURE [dbo].[pccvImportPrevByPaMainIDSelect]
- (
- @paMainID VARCHAR(20)
- )
- AS
- BEGIN TRY
- SELECT TOP 1 EntryDate,ContactResult
- FROM marketdb..cvImportPrev WITH(NOLOCK)
- WHERE pamainid = @paMainID
- AND EntryDate IS NOT NULL
- END TRY
- BEGIN CATCH
- RETURN 0
- END CATCH
- GO
- /****** Object: StoredProcedure [dbo].[pcCvLanguageByIDSelect] Script Date: 2018/12/13 19:08:15 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- ----------------------------
- --创建: Sean
- --检查: 2010-9-27
- ----------------------------
- CREATE PROCEDURE [dbo].[pcCvLanguageByIDSelect]
- @ID INT
- AS
- BEGIN
- SELECT *
- FROM CvLanguage WITH(NOLOCK INDEX(PK_cvLanguage))
- WHERE ID = @ID
- END
- GO
- /****** Object: StoredProcedure [dbo].[pcCvLanguageDelete] Script Date: 2018/12/13 19:08:15 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- -----------------------------------------------------------
- --修改:Sean,2010-9-27
- --描述:取消执行pcCvMainByCvLevelUpdate,因为js执行了cvLevelProc.asp,这个应该上线后调整
- -- 取消pcCvMainVerifyResultCheck的执行,因为与审核状态无关
- --修改:Lambo,2010-11-25
- --描述:增加了paMainID参数,判断是否是本人的
- -----------------------------------------------------------
- CREATE PROCEDURE [dbo].[pcCvLanguageDelete]
- @ID INT,
- @paMainID INT
- AS
- BEGIN TRAN
- BEGIN TRY
- DECLARE @cvMainId AS INT
- DECLARE @RETURN AS VARCHAR(2)
- SELECT @cvMainId = cvMainId FROM cvLanguage WITH(NOLOCK) WHERE ID=@ID
-
- IF @cvMainId IS NULL
- GOTO ERR
- IF NOT EXISTS(SELECT 'x' FROM cvMain WITH(NOLOCK)
- WHERE paMainID = @paMainID AND ID = @cvMainID)
- GOTO ERR
- DELETE FROM bsCvModify WHERE SubID = @ID AND Location LIKE 'h%'
- DELETE FROM cvLanguage WHERE ID=@ID
- EXEC @RETURN = pcCvMainByCvLevelCheck @cvMainID, 7
- END TRY
- BEGIN CATCH
- GOTO ERR
- END CATCH
- COMMIT TRAN
- RETURN @RETURN
- ERR:
- BEGIN
- ROLLBACK TRAN
- RETURN 3
- END
- GO
- /****** Object: StoredProcedure [dbo].[pcCvLanguageSave] Script Date: 2018/12/13 19:08:15 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- -----------------------------------------------------------
- --修改: Sean
- --检查: 2010-9-27
- --描述: 取消执行pcCvMainByCvLevelUpdate,因为js执行了cvLevelProc.asp,这个应该上线后调整
- -- 取消pcCvMainVerifyResultUpdate
- --修改:Lambo,2010-11-25
- --描述:增加了paMainID参数,判断是否是本人的
- -----------------------------------------------------------
- CREATE PROCEDURE [dbo].[pcCvLanguageSave]
- (
- @Type INT,
- @ID INT,
- @cvMainID INT,
- @LanguageType INT,
- @Mastery INT,
- @ReadWrite INT,
- @Spoken INT,
- @Score VARCHAR(100),
- @paMainID INT
- )
- AS
- SET NOCOUNT ON
- IF CHARINDEX('<', @Score) > 0
- SET @Score = REPLACE(@Score, '<', '')
- BEGIN TRAN
- ----检查是否是该账号的简历
- IF NOT EXISTS(SELECT 'x' FROM cvMain WITH(NOLOCK) WHERE ID = @cvMainID AND paMainID = @paMainID)
- GOTO ERR
- ----检查是否是该简历的语言能力
- IF @ID > 0
- IF NOT EXISTS(SELECT 'x' FROM cvLanguage WITH(NOLOCK) WHERE ID = @ID AND cvMainID = @cvMainID)
- GOTO ERR
- SET @Score = dbo.SafeSql(dbo.TextTrim(@Score))
- DECLARE @MaxId AS INT
- DECLARE @ScoreOld AS VARCHAR(100)
- DECLARE @Modify AS INT
- SET @Modify=-1
- BEGIN TRY
- IF @Type=0
- BEGIN
- DECLARE @S AS NVARCHAR(30)
- SET @S = @Score
- SELECT @ScoreOld = dbo.TextTrim(ISNULL(Score, '')) FROM cvLanguage WITH(NOLOCK INDEX(PK_cvLanguage)) WHERE ID = @ID
- IF @ID>0
- BEGIN
- --DELETE FROM CvLanguage WHERE LanguageType = @LanguageType AND cvMainID=@cvMainID
- UPDATE CvLanguage SET
- LanguageType = @LanguageType,
- Mastery = @Mastery,
- ReadWrite = @ReadWrite,
- Spoken = @Spoken,
- Score = @S
- WHERE ID=@ID
- SET @MaxID = @ID
- IF @S IS NULL
- DELETE FROM bsCvModify WHERE SubID = @ID AND Location = 'hc1'
- ELSE
- IF @S <> ISNULL(@ScoreOld, '')
- BEGIN
- DELETE FROM bsCvModify WHERE SubID = @ID AND Location = 'hc1'
- INSERT INTO bsCvModify(paMainID,cvMainID,SubID,Location,ColValue) VALUES(@paMainID,@cvMainID,@MaxID,'hc1',@S)
- SET @Modify=0
- END
- END
- ELSE
- BEGIN
- INSERT INTO CvLanguage(cvMainID,LanguageType,Mastery,ReadWrite,Spoken,Score)
- VALUES(@cvMainID,@LanguageType,@Mastery,@ReadWrite,@Spoken,@Score)
- SET @MaxID = @@IDENTITY
- IF @S > ''
- BEGIN
- INSERT INTO bsCvModify(paMainID,cvMainID,SubID,Location,ColValue) VALUES(@paMainID,@cvMainID,@MaxID,'hc1',@S)
- SET @Modify=0
- END
- END
- END
- ELSE
- BEGIN
- IF @ID>0
- BEGIN
- --DELETE FROM CvLanguage WHERE LanguageType = @LanguageType AND cvMainID=@cvMainID
- SELECT @ScoreOld = dbo.TextTrim(ISNULL(Score, '')) FROM cvLanguage WITH(NOLOCK INDEX(PK_cvLanguage)) WHERE ID = @ID
- UPDATE CvLanguage SET
- LanguageType = @LanguageType,
- Mastery = @Mastery,
- ReadWrite = @ReadWrite,
- Spoken = @Spoken,
- ScoreEng = @Score
- WHERE ID=@ID
- SET @MaxID = @ID
- IF @Score IS NULL
- DELETE FROM bsCvModify WHERE SubID = @ID AND Location = 'he1'
- ELSE
- IF @Score <> ISNULL(@ScoreOld, '')
- BEGIN
- DELETE FROM bsCvModify WHERE SubID = @ID AND Location = 'he1'
- INSERT INTO bsCvModify(paMainID,cvMainID,SubID,Location) VALUES(@paMainID,@cvMainID,@MaxID,'he1')
- SET @Modify=1
- END
- END
- ELSE
- BEGIN
- INSERT INTO CvLanguage(cvMainID,LanguageType,Mastery,ReadWrite,Spoken,ScoreEng)
- VALUES(@cvMainID,@LanguageType,@Mastery,@ReadWrite,@Spoken,@Score)
- SET @MaxID = @@IDENTITY
- IF @Score > ''
- BEGIN
- INSERT INTO bsCvModify(paMainID,cvMainID,SubID,Location) VALUES(@paMainID,@cvMainID,@MaxID,'he1')
- SET @Modify=1
- END
- END
- END
- --修改cvLevel
- DECLARE @SQL AS VARCHAR(100)
- SET @SQL = 'EXEC pcCvMainByCvLevelUpdateNew ' + CONVERT(CHAR(1), @Type) + ',' + CONVERT(VARCHAR(10), @cvMainID) + ',7,1'
- EXEC(@SQL)
- END TRY
- BEGIN CATCH
- GOTO ERR
- END CATCH
- COMMIT TRAN
- RETURN @MaxID
- ERR:
- BEGIN
- ROLLBACK TRAN
- RETURN 0
- END
- GO
- /****** Object: StoredProcedure [dbo].[pcCvLanguageSelect] Script Date: 2018/12/13 19:08:16 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- -----------------------------------------------------------
- --修改: Sean
- --检查: 2010-9-27
- -----------------------------------------------------------
- CREATE PROCEDURE [dbo].[pcCvLanguageSelect]
- @cvMainID INT
- AS
- BEGIN
- SELECT *
- FROM CvLanguage WITH(NOLOCK INDEX(IX_cvLanguage_cvMainID))
- WHERE cvMainID = @cvMainID
- END
- GO
- /****** Object: StoredProcedure [dbo].[pcCvMainByApplySelect] Script Date: 2018/12/13 19:08:16 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- CREATE PROCEDURE [dbo].[pcCvMainByApplySelect]
- @paMainID INT
- AS
- BEGIN
- SELECT
- ID,
- paMainID,
- Name,
- EmployType,
- dcSalaryID,
- Attachment,
- WordFileNAme,
- cvType,
- IsNameHidden,
- IscvHidden,
- isOpen,
- cvLevel,
- cvLevelEng,
- VerifyResult,
- VerifyResultEng,
- Valid,
- ViewNumber,
- RefreshDate,
- Degree
- FROM cvMain WITH(NOLOCK)
- WHERE paMainID=@paMainID
- AND ((cvLevel like '111__1%' AND VerifyResult=1) OR (cvLevelEng like '111__1%' AND VerifyResultEng=1))
- ORDER BY RefreshDate DESC
- END
- GO
- /****** Object: StoredProcedure [dbo].[pcCvMainByAttachmentClear] Script Date: 2018/12/13 19:08:16 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- --=============================================
- --修改: Sean
- --检查: 2010-10-5
- --=============================================
- CREATE PROCEDURE [dbo].[pcCvMainByAttachmentClear]
- @ID INT, --cvMain.ID
- @paMainID INT
- AS
- BEGIN TRY
- ----检查是否是该账号的简历
- IF NOT EXISTS(SELECT 'x' FROM cvMain WITH(NOLOCK) WHERE ID = @ID AND paMainID = @paMainID)
- RETURN 0
- UPDATE CvMain SET Attachment = NULL, WordFilename = NULL WHERE ID = @ID
- IF(SELECT RefreshDate FROM cvMain WITH(NOLOCK) WHERE ID = @ID) > DATEADD(HOUR, -1, GETDATE())
- UPDATE cvMain SET RefreshDate = GETDATE() WHERE ID = @ID
- DELETE FROM bsCvModify WHERE Location = 'ac5' AND cvMainID = @ID
- RETURN 1
- END TRY
- BEGIN CATCH
- RETURN 0
- END CATCH
- GO
- /****** Object: StoredProcedure [dbo].[pcCvMainByAttachmentUpdate] Script Date: 2018/12/13 19:08:16 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- --=============================================
- --检查: Sean,2010-10-5
- --
- --=============================================
- CREATE PROCEDURE [dbo].[pcCvMainByAttachmentUpdate]
- (
- @ID INT,
- @Attachment VARCHAR(50),
- @WordFileName VARCHAR(50),
- @paMainID INT
- )
- AS
- SET NOCOUNT ON
- IF CHARINDEX('<', @Attachment) > 0
- SET @Attachment = REPLACE(@Attachment, '<', '<')
- IF CHARINDEX('<', @WordFileName) > 0
- SET @WordFileName = REPLACE(@WordFileName, '<', '<')
- BEGIN TRY
- DECLARE @paID AS INT
- SELECT @paID = paMainID FROM cvMain WITH(NOLOCK) WHERE ID = @ID
- IF @paMainID = 0
- BEGIN
- --无账号
- IF @paID IS NULL
- RETURN 0
- --账号不是附件上传建立的,附件上传新建的账号密码=123456
- IF NOT EXISTS(SELECT 'x' FROM paMain WITH(NOLOCK) WHERE ID = @paID AND Password = '123456')
- RETURN 0
- END
- ELSE
- IF @paID <> @paMainID --cvMainID.paMainID <> paMain.ID,简历和账号不对应
- RETURN 0
- UPDATE CvMain SET Attachment = dbo.SafeSql(@Attachment), WordFileNAme=dbo.SafeSql(@WordFileName) WHERE ID = @ID
- DELETE FROM bsCvModify WHERE cvMainID = @ID AND Location = 'ac5'
- INSERT INTO bsCvModify(paMainID,cvMainID,Location,colvalue) VALUES(@paID, @ID, 'ac5', @Attachment)
- IF(SELECT RefreshDate FROM cvMain WITH(NOLOCK) WHERE ID = @ID) > DATEADD(HOUR, -1, GETDATE())
- UPDATE cvMain SET RefreshDate = GETDATE() WHERE ID = @ID
-
- RETURN 1
- END TRY
- BEGIN CATCH
- print 0
- RETURN 0
- END CATCH
- GO
- /****** Object: StoredProcedure [dbo].[pcCvMainByCvJobTypeSelect] Script Date: 2018/12/13 19:08:16 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- CREATE PROCEDURE [dbo].[pcCvMainByCvJobTypeSelect]
- (
- @strJobType VARCHAR(10)
- )
- AS
- BEGIN
- SELECT a.MajorName, a.dcMajorId, a.PinYin, a.jianPin, b.*
- FROM dcJobTypeMajorMap a WITH(NOLOCK) LEFT JOIN dcMajor b WITH(NOLOCK) ON b.id = a.dcMajorID
- WHERE a.dcJobTypeid= @strJobType
- AND a.dcMajorId = b.Id
- END
- GO
- /****** Object: StoredProcedure [dbo].[pcCvMainByCvLevelCheck] Script Date: 2018/12/13 19:08:16 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- --[pcCvMainByCvLevelCheck] 12222868,3
- CREATE PROCEDURE [dbo].[pcCvMainByCvLevelCheck]
- (
- @cvMainID INT,
- @Pos INT
- )
- AS
- SET NOCOUNT ON
- BEGIN TRAN
- BEGIN TRY
- DECLARE @Chs AS INT
- DECLARE @Eng AS INT
- DECLARE @paID AS INT
- DECLARE @Return AS VARCHAR(2)
- SELECT @paID = paMainID FROM cvMain WHERE ID = @cvMainID
- --教育背景
- IF @Pos = 3
- BEGIN
- SELECT @Chs = COUNT(1) FROM cvEducation WITH(NOLOCK) WHERE cvMainID = @cvMainID AND GraduateCollage > ''
- SELECT @Eng = COUNT(1) FROM cvEducation WITH(NOLOCK) WHERE cvMainID = @cvMainID AND GraduateCollageEng > ''
- END
- --工作经历
- IF @Pos = 4
- BEGIN
- SELECT @Chs = COUNT(1) FROM cvExperience WITH(NOLOCK) WHERE cvMainID = @cvMainID AND CompanyName > ''
- SELECT @Eng = COUNT(1) FROM cvExperience WITH(NOLOCK) WHERE cvMainID = @cvMainID AND CompanyNameEng > ''
- END
- --求职意向
- IF @Pos = 6
- BEGIN
- SELECT @Chs = COUNT(1) FROM cvMain WITH(NOLOCK) WHERE ID = @cvMainID AND dcSalaryID > 0
- SELECT @Eng = @Chs
- END
- --工作能力
- IF @Pos = 5
- BEGIN
- SELECT @Chs = COUNT(1) FROM cvMain WITH(NOLOCK) WHERE ID = @cvMainID AND Speciality IS NOT NULL
- SELECT @Eng = COUNT(1) FROM cvMain WITH(NOLOCK) WHERE ID = @cvMainID AND SpecialityEng IS NOT NULL
- END
- -- 7 语言能力
- IF @Pos = 7
- BEGIN
- SELECT @Chs = COUNT(1) FROM cvLanguage WITH(NOLOCK) WHERE cvMainID = @cvMainID
- SELECT @Eng = @Chs
- END
- -- 8 培训经历
- IF @Pos = 8
- BEGIN
- SELECT @Chs = COUNT(1) FROM cvTraining WITH(NOLOCK) WHERE cvMainID = @cvMainID AND Institution IS NOT NULL
- SELECT @Eng = COUNT(1) FROM cvTraining WITH(NOLOCK) WHERE cvMainID = @cvMainID AND InstitutionEng IS NOT NULL
- END
- -- 9 项目经历
- IF @Pos = 9
- BEGIN
- SELECT @Chs = COUNT(1) FROM cvProject WITH(NOLOCK) WHERE cvMainID = @cvMainID AND Name IS NOT NULL
- SELECT @Eng = COUNT(1) FROM cvProject WITH(NOLOCK) WHERE cvMainID = @cvMainID AND NameEng IS NOT NULL
- END
- -- 10 证书附件
- IF @Pos = 10
- BEGIN
- SELECT @Chs = COUNT(1) FROM cvAppendix WITH(NOLOCK) WHERE cvMainID = @cvMainID AND (dcAppendixID < 999 OR (dcAppendixID = 999 AND Name > ''))
- SELECT @Eng = COUNT(1) FROM cvAppendix WITH(NOLOCK) WHERE cvMainID = @cvMainID AND (dcAppendixID < 999 OR (dcAppendixID = 999 AND NameEng > ''))
- END
- SET @Chs = ISNULL(@Chs, 0)
- SET @Eng = ISNULL(@Eng, 0)
- IF @Chs > 0
- SET @Chs = 1
- IF @Eng > 0
- SET @Eng = 1
-
- EXEC pcCvMainByCvLevelUpdateNew 0, @cvMainID, @Pos, @Chs
- EXEC pcCvMainByCvLevelUpdateNew 1, @cvMainID, @Pos, @Eng
- END TRY
- BEGIN CATCH
- GOTO ERR
- END CATCH
- SET @Return = LTRIM(STR(@Chs)) + LTRIM(STR(@Eng))
- COMMIT TRAN
- RETURN @Return
- ERR:
- BEGIN
- ROLLBACK TRAN
- RETURN 3
- END
- GO
- /****** Object: StoredProcedure [dbo].[pcCvMainByCvLevelUpdate] Script Date: 2018/12/13 19:08:17 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- -- =============================================
- -- Author: Sean
- -- Create date: 2010-10-5
- -- Description: <Description,,>
- -- 1 存在简历
- -- 2 基本信息
- -- 3 教育背景
- -- 4 工作经历
- -- 5 工作能力
- -- 6 求职意向
- -- 7 语言能力
- -- 8 培训经历
- -- 9 项目经历
- -- 10 证书附件
- -- 修改cvmain的lastmodifydate和refreshdate
- --检查:sean 2010-9-27
- -- =============================================
- CREATE PROCEDURE [dbo].[pcCvMainByCvLevelUpdate]
- (
- @Type INT,
- @cvMainID INT,
- @pos INT,
- @cvLevel CHAR(1),
- @PamainID INT
- )
- AS
- BEGIN TRAN
- BEGIN TRY
- DECLARE @Level AS VARCHAR(10),
- @cvName AS VARCHAR(100),
- @c AS CHAR(1)
- IF @Type = 0
- BEGIN
- SELECT @c = SUBSTRING(cvLevel, @pos, 1) FROM cvMain WITH(NOLOCK) WHERE ID = @cvMainID
- IF(@c <> @cvLevel)
- UPDATE cvmain SET cvLevel = dbo.ComputeCvLevel(cvLevel, @Pos, @cvLevel) WHERE ID = @cvMainID
- END
- ELSE
- BEGIN
- SELECT @c = SUBSTRING(cvLevelEng, @pos, 1) FROM cvMain WITH(NOLOCK) WHERE ID = @cvMainID
- IF(@c <> @cvLevel)
- UPDATE cvmain SET cvLevelEng = dbo.ComputeCvLevel(cvLevelEng, @Pos, @cvLevel) WHERE ID = @cvMainID
- END
- --SELECT @Level = cvLevel, @cvName = Name FROM cvMain WITH(NOLOCK) WHERE ID = @cvMainID
- --IF @cvName Is NULL
- -- UPDATE cvMain SET Name = '未完成简历' WHERE ID = @cvMainID
-
- UPDATE cvmain SET RefreshDate = GETDATE() WHERE ID = @cvMainID AND DATEADD(HOUR, 1, RefreshDate) < GETDATE()
- END TRY
- BEGIN CATCH
- GOTO ERR
- END CATCH
- COMMIT TRAN
- RETURN 1
- ERR:
- BEGIN
- ROLLBACK TRAN
- RETURN 0
- END
- GO
- /****** Object: StoredProcedure [dbo].[pcCvMainByCvLevelUpdateNew] Script Date: 2018/12/13 19:08:17 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- CREATE PROCEDURE [dbo].[pcCvMainByCvLevelUpdateNew]
- (
- @Type INT,
- @cvMainID INT,
- @pos INT,
- @cvLevel CHAR(1)
- )
- AS
- BEGIN TRAN
- BEGIN TRY
- DECLARE @Level AS VARCHAR(10),
- @cvName AS VARCHAR(100),
- @c AS CHAR(1)
- IF @Type = 0
- BEGIN
- SELECT @c = SUBSTRING(cvLevel, @pos, 1) FROM cvMain WITH(NOLOCK) WHERE ID = @cvMainID
- IF(@c <> @cvLevel)
- UPDATE cvmain SET cvLevel = dbo.ComputeCvLevel(cvLevel, @Pos, @cvLevel) WHERE ID = @cvMainID
- END
- ELSE
- BEGIN
- SELECT @c = SUBSTRING(cvLevelEng, @pos, 1) FROM cvMain WITH(NOLOCK) WHERE ID = @cvMainID
- IF(@c <> @cvLevel)
- UPDATE cvmain SET cvLevelEng = dbo.ComputeCvLevel(cvLevelEng, @Pos, @cvLevel) WHERE ID = @cvMainID
- END
-
- UPDATE cvmain SET RefreshDate = GETDATE() WHERE ID = @cvMainID AND DATEADD(HOUR, 1, RefreshDate) < GETDATE()
- END TRY
- BEGIN CATCH
- GOTO ERR
- END CATCH
- COMMIT TRAN
- RETURN 1
- ERR:
- BEGIN
- ROLLBACK TRAN
- RETURN 0
- END
- GO
- /****** Object: StoredProcedure [dbo].[pcCvMainByEngClearUpdate] Script Date: 2018/12/13 19:08:17 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- /**创建时间:2013-12-09 13:22
- *创建人:Peter
- *功能:清空英文简历
- */
- CREATE PROCEDURE [dbo].[pcCvMainByEngClearUpdate]
- (
- @cvMainID INT,
- @paMainID INT
- )
- AS
- BEGIN TRAN
- BEGIN TRY
- --判断cvMainID是否属于该paMain
- DECLARE @CountTemp AS INT
- SELECT @CountTemp = COUNT(*)
- FROM cvMain
- WHERE id = @cvMainID AND paMainID = @paMainID
- IF @CountTemp = 1
- BEGIN
- --清空证书信息
- UPDATE cvAppendix
- SET NameEng = NULL, DescriptionEng = NULL
- WHERE cvMainID = @cvMainID
- --清空教育信息
- UPDATE cvEducation
- SET GraduateCollageEng = NULL, MajorNameEng = NULL, DetailsEng = NULL
- WHERE cvMainID = @cvMainID
-
- --清空工作经历信息
- UPDATE cvExperience
- SET CompanyNameEng = NULL, JobNameEng = NULL, DescriptionEng = NULL, DeptEng = NULL, UpperPostEng = NULL
- WHERE cvMainID = @cvMainID
- --清空语言信息
- UPDATE cvLanguage
- SET ScoreEng = NULL
- WHERE cvMainID = @cvMainID
- --清空项目经历信息
- UPDATE cvProject
- SET NameEng = NULL, DescriptionEng = NULL, ResponsibilitiesEng = NULL
- WHERE cvMainID = @cvMainID
- --清空培训经历信息
- UPDATE cvTraining
- SET InstitutionEng = NULL, CourseEng = NULL, CityEng = NULL, CertificateEng = NULL, DetailsEng = NULL
- WHERE cvMainID = @cvMainID
-
- --清空paMain中的英文名称
- UPDATE paMain
- SET NameEng = NULL
- WHERE ID = @paMainID
- --清空CvMain中的信息
- UPDATE cvMain
- SET SpecialityEng = NULL, VerifyResultEng = 0, cvLevelEng = '1000000000'
- WHERE ID = @cvMainID
- --删除修改日志里该简历的数据
- DELETE FROM bsCvModify
- WHERE cvMainID = @cvMainID
- AND paMainID = @paMainID
- AND Location LIKE '_e_'
- END
- ELSE
- BEGIN
- RETURN -1
- END
- END TRY
- BEGIN CATCH
- GOTO ERR
- END CATCH
- COMMIT TRAN
- RETURN 1
- ERR:
- BEGIN
- ROLLBACK TRAN
- RETURN 0
- END
- GO
- /****** Object: StoredProcedure [dbo].[pcCvMainByIscvHiddenUpdate] Script Date: 2018/12/13 19:08:18 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- --====================================
- --检查: Sean,2010-10-5
- --说明: 隐藏简历
- --在ajax文件中判断caMain.paMainID = pa.ID
- --====================================
- CREATE PROCEDURE [dbo].[pcCvMainByIscvHiddenUpdate]
- @ID INT,
- @IscvHidden INT, ----0:不隐藏;1:隐藏
- @paMainID INT
- AS
- BEGIN
- BEGIN TRY
- UPDATE CvMain SET IscvHidden = @IscvHidden WHERE ID = @ID AND paMainID = @paMainID
- RETURN 1
- END TRY
- BEGIN CATCH
- RETURN 0
- END CATCH
- END
- GO
- /****** Object: StoredProcedure [dbo].[pcCvMainByIsNameHiddenUpdate] Script Date: 2018/12/13 19:08:18 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- -- =============================================
- --检查: Sean,2010-12-9
- --说明: 隐藏姓名
- --在ajax文件中判断caMain.paMainID = pa.ID
- -- =============================================
- CREATE PROCEDURE [dbo].[pcCvMainByIsNameHiddenUpdate]
- @ID INT,
- @IsNameHidden INT, ----0:不隐藏;1:隐藏
- @paMainID INT
- AS
- BEGIN TRY
- IF NOT EXISTS(SELECT 'x' FROM cvMain WITH(NOLOCK) WHERE ID = @ID AND paMainID = @paMainID)
- RETURN 0
- UPDATE CvMain SET IsNameHidden = @IsNameHidden WHERE ID = @ID
- RETURN 1
- END TRY
- BEGIN CATCH
- RETURN 0
- END CATCH
- GO
- /****** Object: StoredProcedure [dbo].[pcCvMainByNameUpdate] Script Date: 2018/12/13 19:08:18 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- --=============================================
- -- 检查: Sean
- -- 时间: 2010-9-28
- -- 描述: 取消了对简历名称的审核,取消了对cvlevel的修改,cvlevel做第一位一直是1。
- --修改:Lambo,2010-11-25
- --描述:增加了paMainID参数,判断是否是本人的
- --=============================================
- CREATE PROCEDURE [dbo].[pcCvMainByNameUpdate]
- (
- @Type INT,
- @ID INT,
- @paMainID INT,
- @Name VARCHAR(100)
- )
- AS
- SET NOCOUNT ON
- IF LEN(ISNULL(@Name, '')) = 0
- RETURN 0
- IF CHARINDEX('<', @Name) > 0
- SET @Name = REPLACE(@Name, '<', '')
- BEGIN TRAN
- BEGIN TRY
- IF NOT EXISTS(SELECT 'x' FROM cvMain WITH(NOLOCK) WHERE ID = @ID AND paMainID = @paMainID)
- GOTO ERR
- SET @Name = dbo.SafeSql(@Name)
- DECLARE @N NVARCHAR(20)
- SET @N = @Name
- IF @Type = 0
- UPDATE CvMain SET Name = @N WHERE ID = @ID
- ELSE
- UPDATE CvMain SET Name = @Name WHERE ID = @ID
- END TRY
- BEGIN CATCH
- GOTO ERR
- END CATCH
- COMMIT TRAN
- RETURN 1
- ERR:
- BEGIN
- ROLLBACK TRAN
- RETURN 0
- END
- GO
- /****** Object: StoredProcedure [dbo].[pcCvMainByNoExpCreate] Script Date: 2018/12/13 19:08:18 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- CREATE PROCEDURE [dbo].[pcCvMainByNoExpCreate]
- (
- @paMainID INT,
- @IP VARCHAR(39)
- )
- AS
- BEGIN TRY
- DECLARE @Count INT
- SELECT @Count=COUNT(*) FROM cvMain WITH(NOLOCK INDEX(IX_cvMain_paMainID)) WHERE paMainID=@paMainID
- --已经有3份简历
- IF @Count>2
- RETURN 0
- ELSE
- BEGIN
- DECLARE @Mobile VARCHAR(13), @Name VARCHAR(20), @cvLevel AS CHAR(10), @cvLevelEng AS CHAR(10)
- SELECT @cvLevel = '1000000000', @cvLevelEng = '1000000000'
- SELECT @Name = ISNULL(Name, ''), @Mobile = ISNULL(Mobile, '') FROM paMain WITH(NOLOCK INDEX(PK_paMain)) WHERE ID = @paMainID
- IF (LEN(@Mobile) > 0 AND LEN(@Name) > 0)
- BEGIN
- SELECT @cvLevel = '1100000000', @cvLevelEng = '1100000000'
- END
- BEGIN TRAN
- DECLARE @cvMainID AS INT
- INSERT INTO cvMain(paMainID, Name, cvLevel, cvLevelEng, cvType)
- VALUES(@paMainID, '未完成简历', @cvLevel, @cvLevelEng,1)
- SET @cvMainID = @@IDENTITY
- INSERT INTO paOperationLog (paMainID,Operation,Details,IP)
- VALUES(@paMainID, 14, '创建简历,编号' + RTRIM(CONVERT(VARCHAR(10),@cvMainID)), @IP)
- COMMIT
- RETURN @cvMainID
- END
- END TRY
- BEGIN CATCH
- PRINT ''
- ROLLBACK TRAN
- RETURN 0
- END CATCH
- GO
- /****** Object: StoredProcedure [dbo].[pcCvMainByPaMainIDBaseSelect] Script Date: 2018/12/13 19:08:18 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- CREATE PROCEDURE [dbo].[pcCvMainByPaMainIDBaseSelect]
- (
- @paMainID INT
- )
- AS
- BEGIN
- SELECT ID,
- paMainID,
- Name,
- IsNameHidden,
- IscvHidden,
- isOpen,
- cvLevel,
- cvLevelEng,
- VerifyResult,
- VerifyResultEng,
- Valid,
- ViewNumber,
- RefreshDate,
- Attachment,
- cvType,
- JobName
- FROM cvMain WITH(NOLOCK)
- WHERE paMainID=@paMainID
- ORDER BY RefreshDate DESC, ID
- END
- GO
- /****** Object: StoredProcedure [dbo].[pcCvMainByPaMainIDMinSelect] Script Date: 2018/12/13 19:08:19 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- --====================================
- --Creatoe: sean,2011-8-4
- --主要用于个人用户自己的查看,而不是搜索,所以不加valid>0条件
- --====================================
- CREATE PROCEDURE [dbo].[pcCvMainByPaMainIDMinSelect]
- (
- @paMainID INT
- )
- AS
- BEGIN
- SELECT ID, Name
- FROM cvMain WITH(NOLOCK)
- WHERE paMainID=@paMainID
- ORDER BY RefreshDate DESC, ID
- END
- GO
- /****** Object: StoredProcedure [dbo].[pcCvMainByPaMainIDSelect] Script Date: 2018/12/13 19:08:19 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- --====================================
- --检查: sean,2010-10-5
- --主要用于个人用户自己的查看,而不是搜索,所以不加valid>0条件
- --====================================
- CREATE PROCEDURE [dbo].[pcCvMainByPaMainIDSelect]
- (
- @paMainID INT
- )
- AS
- BEGIN
- SELECT *
- FROM cvMain WITH(NOLOCK)
- WHERE paMainID=@paMainID
- ORDER BY RefreshDate DESC, ID
- END
- GO
- /****** Object: StoredProcedure [dbo].[pcCvMainByRecommendSelect] Script Date: 2018/12/13 19:08:19 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- CREATE PROCEDURE [dbo].[pcCvMainByRecommendSelect]
- @paMainID INT
- AS
- BEGIN
- SELECT
- ID,
- paMainID,
- Name,
- EmployType,
- dcSalaryID,
- Attachment,
- WordFileNAme,
- cvType,
- IsNameHidden,
- IscvHidden,
- isOpen,
- cvLevel,
- cvLevelEng,
- VerifyResult,
- VerifyResultEng,
- Valid,
- ViewNumber,
- RefreshDate,
- Degree
- FROM cvMain WITH(NOLOCK)
- WHERE paMainID=@paMainID
- AND ((cvLevel like '1111_1%' AND VerifyResult=1) OR (cvLevelEng like '1111_1%' AND VerifyResultEng=1))
- END
- GO
- /****** Object: StoredProcedure [dbo].[pcCvMainBySpecialitySelect] Script Date: 2018/12/13 19:08:19 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- -- =============================================
- -- 创建: Sean
- -- 检查: 2010-9-27
- -- 说明: 提取工作能力
- -- =============================================
- CREATE PROCEDURE [dbo].[pcCvMainBySpecialitySelect]
- @Type INT,
- @ID INT,
- @Speciality NVARCHAR(Max) OutPut
- AS
- BEGIN
- IF @Type=0
- SELECT @Speciality=Speciality FROM cvMain WITH(NOLOCK) WHERE ID = @ID
- ELSE
- SELECT @Speciality=SpecialityEng FROM cvMain WITH(NOLOCK) WHERE ID = @ID
- END
- GO
- /****** Object: StoredProcedure [dbo].[pcCvMainBySpecialityUpdate] Script Date: 2018/12/13 19:08:19 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- CREATE PROCEDURE [dbo].[pcCvMainBySpecialityUpdate]
- (
- @Type INT,
- @ID INT,
- @Speciality VARCHAR(MAX),
- @paMainID INT
- )
- AS
- SET NOCOUNT ON
- IF CHARINDEX('<', @Speciality) > 0
- SET @Speciality = REPLACE(@Speciality, '<', '<')
- BEGIN TRAN
- BEGIN TRY
- IF NOT EXISTS(SELECT 'x' FROM cvMain WITH(NOLOCK) WHERE ID = @ID AND paMainID = @paMainID)
- GOTO err
- SET @Speciality = dbo.SafeSql(dbo.TextTrim(@Speciality))
- DECLARE @SpecialityOld VARCHAR(MAX)
- DECLARE @S NVARCHAR(2000)
-
- IF @Type=0
- BEGIN
- SELECT @SpecialityOld = dbo.TextTrim(Speciality) FROM cvMain WHERE ID = @ID
- SET @S=@Speciality
- IF ISNULL(@SpecialityOld, '') <> ISNULL(@S, '')
- BEGIN
- UPDATE cvMain SET Speciality = @S WHERE ID = @ID
- DELETE FROM bsCvModify WHERE cvMainID=@ID AND Location = 'bc2'
- IF @S IS NOT NULL
- INSERT INTO bsCvModify(paMainID,cvMainID,Location,ColValue) VALUES(@paMainID,@ID,'bc2',@S)
- END
- END
- ELSE
- BEGIN
- SELECT @SpecialityOld = dbo.TextTrim(SpecialityEng) FROM cvMain WHERE ID = @ID
- IF ISNULL(@SpecialityOld, '') <> ISNULL(@Speciality, '')
- BEGIN
- UPDATE cvMain SET SpecialityEng = @Speciality WHERE ID = @ID
- DELETE FROM bsCvModify WHERE cvMainID=@ID AND Location = 'be2'
- IF @Speciality IS NOT NULL
- INSERT INTO bsCvModify(paMainID,cvMainID,Location,ColValue) VALUES(@paMainID,@ID,'be2',@Speciality)
- END
- END
- --修改cvLevel
- DECLARE @SQL AS VARCHAR(100)
- IF @Speciality >''
- SET @SQL = 'EXEC pcCvMainByCvLevelUpdateNew ' + CONVERT(CHAR(1), @Type) + ',' + CONVERT(VARCHAR(10), @ID) + ',5,1'
- ELSE
- SET @SQL = 'EXEC pcCvMainByCvLevelUpdateNew ' + CONVERT(CHAR(1), @Type) + ',' + CONVERT(VARCHAR(10), @ID) + ',5,0'
- EXEC(@SQL)
- END TRY
- BEGIN CATCH
- GOTO ERR
- END CATCH
- COMMIT TRAN
- RETURN 1
- ERR:
- BEGIN
- ROLLBACK TRAN
- RETURN 0
- END
- GO
- /****** Object: StoredProcedure [dbo].[pcCvMainByWordCreate] Script Date: 2018/12/13 19:08:20 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- -- =============================================
- -- Author: Sean
- -- Create date: 2010-10-5
- -- Description: <Description,,>
- -- =============================================
- CREATE PROCEDURE [dbo].[pcCvMainByWordCreate]
- (
- @paMainID INT,
- @IP VARCHAR(39)
- )
- AS
- BEGIN TRY
- DECLARE @Count INT
- SELECT @Count = COUNT(*) FROM cvMain WITH(NOLOCK INDEX(IX_cvMain_paMainID)) WHERE paMainID = @paMainID
- --已经有3份简历
- IF @Count>2
- RETURN 0
- ELSE
- BEGIN
- DECLARE @Mobile VARCHAR(13), @Name VARCHAR(20), @cvLevel AS CHAR(10), @cvLevelEng AS CHAR(10)
- SELECT @cvLevel = '1000000000', @cvLevelEng = '1000000000'
- SELECT @Name = ISNULL(Name, ''), @Mobile = ISNULL(Mobile, '') FROM paMain WITH(NOLOCK INDEX(PK_paMain)) WHERE ID = @paMainID
- IF (LEN(@Mobile) > 0 AND LEN(@Name) > 0)
- BEGIN
- SELECT @cvLevel = '1100000000', @cvLevelEng = '1100000000'
- END
- BEGIN TRAN
- DECLARE @cvMainID AS INT
- INSERT INTO cvMain(paMainID, Name, cvLevel, cvLevelEng, JobName)
- VALUES(@paMainID, '未完成简历', @cvLevel, @cvLevelEng, '附件简历')
- SET @cvMainID = @@IDENTITY
- INSERT INTO paOperationLog (paMainID,Operation,Details,IP)
- VALUES(@paMainID, 14, '创建简历,编号' + RTRIM(CONVERT(VARCHAR(10),@cvMainID)), @IP)
- COMMIT
- RETURN @cvMainID
- END
- END TRY
- BEGIN CATCH
- PRINT ''
- ROLLBACK TRAN
- RETURN 0
- END CATCH
- GO
- /****** Object: StoredProcedure [dbo].[pcCvMainCreate] Script Date: 2018/12/13 19:08:20 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- -- =============================================
- -- Author: Sean
- -- Create date: 2010-10-5
- -- Description: <Description,,>
- -- =============================================
- CREATE PROCEDURE [dbo].[pcCvMainCreate]
- (
- @paMainID INT,
- @IP VARCHAR(39)
- )
- AS
- SET NOCOUNT ON
- BEGIN TRY
- DECLARE @Count INT
- SELECT @Count=COUNT(*) FROM cvMain WITH(NOLOCK INDEX(IX_cvMain_paMainID)) WHERE paMainID = @paMainID
- --已经有3份简历
- IF @Count>2
- BEGIN
- DELETE FROM cvMain WHERE paMainid = @paMainID AND cvLevel = '1100000000' AND Name = '未完成简历'
- SELECT @Count=COUNT(*) FROM cvMain WITH(NOLOCK INDEX(IX_cvMain_paMainID)) WHERE paMainID = @paMainID
- --已经有3份简历
- IF @Count>2
- RETURN 0
- END
- ELSE
- BEGIN
- DECLARE @Mobile VARCHAR(13), @Name VARCHAR(20), @cvLevel AS CHAR(10), @cvLevelEng AS CHAR(10)
- SELECT @cvLevel = '1000000000', @cvLevelEng = '1000000000'
- SELECT @Name = ISNULL(Name, ''), @Mobile = ISNULL(Mobile, '') FROM paMain WITH(NOLOCK INDEX(PK_paMain)) WHERE ID = @paMainID
- IF (LEN(@Mobile) > 0 AND LEN(@Name) > 0)
- BEGIN
- SELECT @cvLevel = '1100000000', @cvLevelEng = '1100000000'
- END
- BEGIN TRAN
- DECLARE @cvMainID AS INT
- INSERT INTO cvMain(paMainID, Name, cvLevel, cvLevelEng)
- VALUES(@paMainID, '未完成简历', @cvLevel, @cvLevelEng)
- SET @cvMainID = @@IDENTITY
- INSERT INTO paOperationLog (paMainID,Operation,Details,IP)
- VALUES(@paMainID, 14, '创建简历,编号' + RTRIM(CONVERT(VARCHAR(10),@cvMainID)), @IP)
- UPDATE dcSystemData SET Value = Value + RAND() * 5.4 WHERE ID = 1
- COMMIT
- --PRINT @cvMainID
- RETURN @cvMainID
- END
- END TRY
- BEGIN CATCH
- PRINT ''
- ROLLBACK TRAN
- RETURN 0
- END CATCH
- GO
- /****** Object: StoredProcedure [dbo].[pcCvMainCvTypeUpdate] Script Date: 2018/12/13 19:08:20 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- --===================================
- --检查: Sean,2010-10-5
- --修改:Lambo,2010-11-25
- --描述:增加了paMainID参数,判断是否是本人的
- --===================================
- CREATE PROCEDURE [dbo].[pcCvMainCvTypeUpdate]
- (
- @ID INT,
- @cvType TINYINT,
- @paMainID INT
- )
- AS
- BEGIN
- BEGIN TRY
- IF NOT EXISTS(SELECT 'x' FROM cvMain WITH(NOLOCK) WHERE ID = @ID AND paMainID = @paMainID)
- RETURN 0
- UPDATE CvMain SET cvType = @cvType WHERE ID = @ID
- DECLARE @SQL AS VARCHAR(100)
- IF @cvType = 1
- BEGIN
- SET @SQL = 'EXEC pcCvMainByCvLevelUpdateNew 0,' + CONVERT(VARCHAR(10),@ID) + ',4,1'
- EXEC(@SQL)
- SET @SQL = 'EXEC pcCvMainByCvLevelUpdateNew 1,' + CONVERT(VARCHAR(10),@ID) + ',4,1'
- EXEC(@SQL)
- END
- ELSE
- BEGIN
- IF NOT EXISTS(SELECT ID FROM cvExperience WITH(NOLOCK INDEX(IX_cvExperience_cvMainID)) WHERE cvMainID = @ID AND CompanyName>'')
- BEGIN
- SET @SQL = 'EXEC pcCvMainByCvLevelUpdateNew 0,' + CONVERT(VARCHAR(10),@ID) + ',4,0'
- EXEC(@SQL)
- END
- IF NOT EXISTS(SELECT ID FROM cvExperience WITH(NOLOCK INDEX(IX_cvExperience_cvMainID)) WHERE cvMainID = @ID AND CompanyNameEng>'')
- BEGIN
- SET @SQL = 'EXEC pcCvMainByCvLevelUpdateNew 1,' + CONVERT(VARCHAR(10),@ID) + ',4,0'
- EXEC(@SQL)
- END
- END
- RETURN 1
- END TRY
- BEGIN CATCH
- RETURN 0
- END CATCH
- END
- GO
- /****** Object: StoredProcedure [dbo].[pcCvMainDelete] Script Date: 2018/12/13 19:08:21 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- --====================================
- --检查: Sean,2010-10-5
- --说明: 假删改为真删
- --====================================
- CREATE PROCEDURE [dbo].[pcCvMainDelete]
- @ID INT,
- @paMainID INT,
- @IP VARCHAR(30)
- AS
- SET NOCOUNT ON
- BEGIN TRAN
- BEGIN TRY
- DECLARE @paID AS INT
- SELECT @paID = paMainID FROM cvMain WITH(NOLOCK INDEX(PK_cvMain)) WHERE ID = @ID
- IF @paMainID <> @paID
- GOTO Err
- INSERT INTO paOperationLog (paMainID,Operation,Details,IP)
- VALUES(@paID, 15, '删除简历,编号'+RTRIM(CONVERT(VARCHAR(10),@ID)), @IP)
- DELETE FROM cvMain WHERE ID=@ID
- END TRY
- BEGIN CATCH
- PRINT '错误编号' + CONVERT(VARCHAR(10),ERROR_NUMBER()) + '错误发生的行号' + CONVERT(VARCHAR(10),ERROR_LINE()) +'错误信息' + ERROR_MESSAGE()
- GOTO ERR
- END CATCH
- COMMIT TRAN
- RETURN 1
- ERR:
- BEGIN
- ROLLBACK TRAN
- RETURN 0
- END
- GO
- /****** Object: StoredProcedure [dbo].[pcCvMainDetailByIDSelect] Script Date: 2018/12/13 19:08:21 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- --#####################################################
- --创建时间:2014.10.31
- --创建人:Nick
- --说明:获取简历对应的年龄、学历、工作年限、性别、工作地点
- --#####################################################
- CREATE PROCEDURE [dbo].[pcCvMainDetailByIDSelect]
- (
- @CvMainID INT
- )
- AS
- BEGIN TRY
- SELECT b.LivePlace,b.gender,dbo.BirthToAge(b.birthday) AS age,a.dcMajorID,
- a.RelatedWorkYears,c.dcRegionID, a.Degree, a.Attachment
- FROM cvmain a,pamain b,cvjobPlace c
- WHERE a.id=@CvMainID
- AND a.pamainID=b.ID
- AND a.id=c.cvMainID
- END TRY
- BEGIN CATCH
- RETURN 0
- END CATCH
- GO
- /****** Object: StoredProcedure [dbo].[pcCvMainIDByJobApplyIDSelect] Script Date: 2018/12/13 19:08:21 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- --#####################################################
- --创建时间:2014.11.4
- --创建人:John
- --说明:根据JobApplyID取得CvMainID
- --#####################################################
- CREATE PROCEDURE [dbo].[pcCvMainIDByJobApplyIDSelect]
- (
- @PaMainID INT
- )
- AS
- BEGIN
- DECLARE @CvMainID INT
- SET @CvMainID = 0
- SELECT @CvMainID = cvMainID FROM
- (
- SELECT TOP 1 cvMainID
- FROM exJobApply WITH(NOLOCK)
- WHERE cvMainID IN ( SELECT ID FROM cvMain WITH(NOLOCK) WHERE paMainID = @PaMainID )
- ORDER BY AddDate DESC
- ) TEMP1
- IF @CvMainID = 0
- BEGIN
- SELECT @CvMainID = ID FROM
- (
- SELECT TOP 1 ID
- FROM cvMain WITH(NOLOCK)
- WHERE paMainID = @PaMainID
- ORDER BY RefreshDate DESC
- ) TEMP2
- END
- RETURN @CvMainID
- END
- GO
- /****** Object: StoredProcedure [dbo].[pcCvMainIDByPaMainIDSelect] Script Date: 2018/12/13 19:08:21 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- --#####################################################
- --创建时间:2014.11.10
- --创建人:Nick
- --说明:
- --#####################################################
- CREATE PROCEDURE [dbo].[pcCvMainIDByPaMainIDSelect]
- (
- @cvMainID INT,
- @paMainID INT
- )
- AS
- BEGIN TRY
- IF @cvMainID = 0
- BEGIN
- SELECT TOP 1 ID
- FROM cvMain WITH(NOLOCK)
- WHERE (
- cvLevel like '111111%'
- OR cvLevelEng LIKE '111111%'
- OR cvLevel like '111101%'
- OR cvLevelEng LIKE '111101%'
- ) AND paMainID = @paMainID ORDER BY ID DESC
- END
- ELSE
- BEGIN
- SELECT TOP 1 ID
- FROM cvMain WITH(NOLOCK)
- WHERE (
- cvLevel like '111111%'
- OR cvLevelEng LIKE '111111%'
- OR cvLevel like '111101%'
- OR cvLevelEng LIKE '111101%'
- ) AND paMainID = @paMainID And ID = @cvMainID
- END
- END TRY
- BEGIN CATCH
- RETURN 0
- END CATCH
- GO
- /****** Object: StoredProcedure [dbo].[pcCvMainNameByIDSelect] Script Date: 2018/12/13 19:08:22 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- --#####################################################
- --创建时间:2014.10.31
- --创建人:Nick
- --说明:获取简历名称
- --#####################################################
- CREATE PROCEDURE [dbo].[pcCvMainNameByIDSelect]
- (
- @ID INT
- )
- AS
- BEGIN TRY
- SELECT Name FROM cvMain WHERE ID = @ID
- END TRY
- BEGIN CATCH
- RETURN 0
- END CATCH
- GO
- /****** Object: StoredProcedure [dbo].[pcCvMainNameByPamainIDSelect] Script Date: 2018/12/13 19:08:22 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- --#####################################################
- --创建时间:2014.10.31
- --创建人:Nick
- --说明:获取简历名称
- --#####################################################
- CREATE PROCEDURE [dbo].[pcCvMainNameByPamainIDSelect]
- (
- @paMainID INT
- )
- AS
- BEGIN TRY
- SELECT ID, Name FROM cvMain WITH(NOLOCK) Where VerifyResult=10 And paMainID=@paMainID ORDER BY ID
- END TRY
- BEGIN CATCH
- RETURN 0
- END CATCH
- GO
- /****** Object: StoredProcedure [dbo].[pcCvMainResultByPaMainIDSelect] Script Date: 2018/12/13 19:08:22 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- --#####################################################
- --创建时间:2014.10.31
- --创建人:Nick
- --说明:获取CVMAIN
- --#####################################################
- CREATE PROCEDURE [dbo].[pcCvMainResultByPaMainIDSelect]
- (
- @PamainID INT
- )
- AS
- BEGIN TRY
- SELECT * FROM cvMain WITH(NOLOCK)
- WHERE paMainID = @PamainID
- AND (AttachMent <> '' OR((cvLevel LIKE '111111%' OR cvLevel LIKE '111101%') AND VerifyResult = 1)
- OR((cvLevelEng LIKE '111111%' OR cvLevelEng LIKE '111101%') AND VerifyResultEng = 1))
- END TRY
- BEGIN CATCH
- RETURN 0
- END CATCH
- GO
- /****** Object: StoredProcedure [dbo].[pcCvMainSelect] Script Date: 2018/12/13 19:08:22 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- CREATE PROCEDURE [dbo].[pcCvMainSelect]
- @ID INT
- AS
- BEGIN
- SELECT *,dbo.GetPaOnlineStatus(paMainID) IsOnline
- FROM cvMain WITH(NOLOCK INDEX(PK_cvMain))
- WHERE ID=@ID
- END
- GO
- /****** Object: StoredProcedure [dbo].[pcCvMainSelectTest] Script Date: 2018/12/13 19:08:22 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- CREATE PROCEDURE [dbo].[pcCvMainSelectTest]
- (
- @ID INT
- )
- AS
- BEGIN
- SELECT *,dbo.GetPaOnlineStatus(paMainID) IsOnline
- FROM cvMain WITH(NOLOCK INDEX(PK_cvMain))
- WHERE ID=@ID
- END
- GO
- /****** Object: StoredProcedure [dbo].[pcCvMainVerifyResultCheck_OLD] Script Date: 2018/12/13 19:08:22 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- --==============================================
- -- 名称: pcCvMainVerifyResultCheck
- -- 删除: Sean
- -- 时间: 2010-9-29
- -- 原因: VerifyResult修改后不变,只有审核时变化,审核时列表不从cvMain提取,所以该存储过程应该无用了
- --==============================================
- CREATE PROCEDURE [dbo].[pcCvMainVerifyResultCheck_OLD]
- @cvMainID INT
- AS
- BEGIN TRAN
- BEGIN TRY
- IF EXISTS(SELECT ID FROM bsCvModify WITH(NOLOCK)WHERE cvMainID=@cvMainID AND SUBSTRING(Location,2,1)='c' AND SUBSTRING(Location,1,1)<>'a')
- UPDATE cvMain SET VerifyResult=11 WHERE ID=@cvMainID
- ELSE
- UPDATE cvMain SET VerifyResult=100 WHERE ID=@cvMainID
- IF EXISTS(SELECT ID FROM bsCvModify WITH(NOLOCK)WHERE cvMainID=@cvMainID AND SUBSTRING(Location,2,1)='e' AND SUBSTRING(Location,1,1)<>'a')
- UPDATE cvMain SET VerifyResultEng=11 WHERE ID=@cvMainID
- ELSE
- UPDATE cvMain SET VerifyResultEng=100 WHERE ID=@cvMainID
- END TRY
- BEGIN CATCH
- GOTO ERR
- END CATCH
- COMMIT TRAN
- RETURN 1
- ERR:
- BEGIN
- ROLLBACK TRAN
- RETURN 0
- END
- GO
- /****** Object: StoredProcedure [dbo].[pcCvProjectByIDSelect] Script Date: 2018/12/13 19:08:23 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- -------===========================
- -- 检查: sean
- -- 时间: 2010-9-29
- -- 描述: 提取项目信息
- -------===========================
- CREATE PROCEDURE [dbo].[pcCvProjectByIDSelect]
- @ID INT
- AS
- BEGIN
- SELECT *
- FROM CvProject WITH(NOLOCK INDEX(PK_cvProject))
- WHERE ID = @ID
- END
- GO
- /****** Object: StoredProcedure [dbo].[pcCvProjectDelete] Script Date: 2018/12/13 19:08:23 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- -------===========================
- -- 检查: sean
- -- 时间: 2010-9-29
- -- 描述: 删除项目信息 取消pcCvMainByCvLevelUpdate,取消pcCvMainVerifyResultCheck
- -- 修改:Lambo,2010-11-25
- -- 描述:增加了paMainID参数,判断是否是本人的
- -------===========================
- CREATE PROCEDURE [dbo].[pcCvProjectDelete]
- @ID INT,
- @paMainID INT
- AS
- BEGIN TRAN
- BEGIN TRY
- DECLARE @cvMainId AS INT
- DECLARE @RETURN AS VARCHAR(2)
- SELECT @cvMainId = cvMainId FROM cvProject WITH(NOLOCK) WHERE ID=@ID
-
- IF @cvMainId IS NULL
- GOTO ERR
- IF NOT EXISTS(SELECT 'x' FROM cvMain WITH(NOLOCK)
- WHERE paMainID = @paMainID AND ID = @cvMainID)
- GOTO ERR
- DELETE FROM bsCvModify WHERE SubID = @ID AND Location LIKE 'f%'
- DELETE FROM cvProject WHERE ID=@ID
- EXEC @RETURN = pcCvMainByCvLevelCheck @cvMainID, 9
- END TRY
- BEGIN CATCH
- GOTO ERR
- END CATCH
- COMMIT TRAN
- RETURN @RETURN
- ERR:
- BEGIN
- ROLLBACK TRAN
- RETURN 3
- END
- GO
- /****** Object: StoredProcedure [dbo].[pcCvProjectSave] Script Date: 2018/12/13 19:08:23 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- --===============================
- -- 检查: sean
- -- 时间: 2010-9-29
- -- 描述: 取消pcCvMainByCvLevelUpdate, pcCvMainVerifyResultUpdate
- -- 修改:Lambo,2010-11-25
- -- 描述:增加了paMainID参数,判断是否是本人的
- --===============================
- CREATE PROCEDURE [dbo].[pcCvProjectSave]
- (
- @Type INT,
- @ID INT,
- @cvMainID INT,
- @Name VARCHAR(250),
- @StartDate INT,
- @ENDDate INT,
- @Description VARCHAR(MAX),
- @Responsibilities VARCHAR(1000),
- @paMainID INT
- )
- AS
- SET NOCOUNT ON
- IF CHARINDEX('<', @Description) > 0
- SET @Description = REPLACE(@Description, '<', '')
- IF CHARINDEX('<', @Responsibilities) > 0
- SET @Responsibilities = REPLACE(@Responsibilities, '<', '')
- IF CHARINDEX('<', @Name) > 0
- SET @Name = REPLACE(@Name, '<', '')
- BEGIN TRAN
- ----检查是否是该账号的简历
- IF NOT EXISTS(SELECT 'x' FROM cvMain WITH(NOLOCK) WHERE ID = @cvMainID AND paMainID = @paMainID)
- GOTO ERR
- ----检查是否是该简历的工作经验
- IF @ID > 0
- IF NOT EXISTS(SELECT 'x' FROM cvProject WITH(NOLOCK) WHERE ID = @ID AND cvMainID = @cvMainID)
- GOTO ERR
- SELECT @Name = dbo.SafeSql(dbo.TextTrim(@Name)),
- @Description = dbo.SafeSql(dbo.TextTrim(@Description)),
- @Responsibilities = dbo.SafeSql(dbo.TextTrim(@Responsibilities))
- DECLARE @MaxId AS INT
- DECLARE @NameOld AS VARCHAR(250)
- DECLARE @DescriptionOld AS VARCHAR(MAX)
- DECLARE @ResponsibilitiesOld AS VARCHAR(1000)
- DECLARE @Modify AS INT
- SET @Modify=-1
- BEGIN TRY
- IF NOT EXISTS(SELECT 'x' FROM cvMain WITH(NOLOCK) WHERE ID =@cvMainID AND paMainID = @paMainID)
- GOTO ERR
- IF @Type=0
- BEGIN
- DECLARE @N AS NVARCHAR(50)
- DECLARE @R AS NVARCHAR(200)
- DECLARE @D AS NVARCHAR(2000)
- SET @N = @Name
- SET @D = @Description
- SET @R = @Responsibilities
- IF @ID>0
- BEGIN
- IF NOT EXISTS(SELECT 'x' FROM CvProject WITH(NOLOCK) WHERE ID =@ID AND cvMainID = @cvMainID)
- GOTO ERR
- SELECT @NameOld = dbo.TextTrim(ISNULL(Name, '')),
- @DescriptionOld = dbo.TextTrim(ISNULL(Description, '')),
- @ResponsibilitiesOld = dbo.TextTrim(ISNULL(Responsibilities, ''))
- FROM CvProject WITH(NOLOCK) WHERE ID = @ID
- UPDATE CvProject SET
- Name = @N,
- StartDate = @StartDate,
- ENDDate = @ENDDate,
- Description = @D,
- Responsibilities = @R
- WHERE ID=@ID
- SET @MaxID = @ID
-
- IF ISNULL(@NameOld, '') <> ISNULL(@N, '')
- BEGIN
- DELETE FROM bsCvModify WHERE SubID = @ID AND Location = 'fc1'
- INSERT INTO bsCvModify(paMainID,cvMainID,SubID,Location,ColValue) VALUES(@paMainID,@cvMainID,@MaxID,'fc1',@N)
- SET @Modify=0
- END
- IF @D IS NULL
- DELETE FROM bsCvModify WHERE paMainID=@paMainID AND cvMainID=@cvMainID AND SubID = @ID AND Location = 'fc2'
- ELSE
- IF ISNULL(@DescriptionOld, '') <> @D
- BEGIN
- DELETE FROM bsCvModify WHERE paMainID=@paMainID AND cvMainID=@cvMainID AND SubID = @ID AND Location = 'fc2'
- INSERT INTO bsCvModify(paMainID,cvMainID,SubID,Location,ColValue) VALUES(@paMainID,@cvMainID,@MaxID,'fc2',@D)
- SET @Modify=0
- END
- IF @R IS NULL
- DELETE FROM bsCvModify WHERE paMainID=@paMainID AND cvMainID=@cvMainID AND SubID = @ID AND Location = 'fc3'
- ELSE
- IF ISNULL(@ResponsibilitiesOld, '') <> @R
- BEGIN
- DELETE FROM bsCvModify WHERE paMainID=@paMainID AND cvMainID=@cvMainID AND SubID = @ID AND Location = 'fc3'
- INSERT INTO bsCvModify(paMainID,cvMainID,SubID,Location,ColValue) VALUES(@paMainID,@cvMainID,@MaxID,'fc3',@R)
- SET @Modify=0
- END
- END
- ELSE
- BEGIN
- INSERT INTO CvProject
- (cvMainID,Name,StartDate,ENDDate,Description,Responsibilities)
- VALUES(@cvMainID,@Name,@StartDate,@ENDDate,@D,@R)
- SET @MaxID = @@IDENTITY
- SET @Modify=0
- INSERT INTO bsCvModify(paMainID,cvMainID,SubID,Location,ColValue) VALUES(@paMainID,@cvMainID,@MaxID,'fc1',@N)
- IF @D > ''
- INSERT INTO bsCvModify(paMainID,cvMainID,SubID,Location,ColValue) VALUES(@paMainID,@cvMainID,@MaxID,'fc2',@D)
- IF @R > ''
- INSERT INTO bsCvModify(paMainID,cvMainID,SubID,Location,ColValue) VALUES(@paMainID,@cvMainID,@MaxID,'fc3',@R)
- END
- END
- ELSE
- BEGIN
- IF NOT EXISTS(SELECT 'x' FROM cvMain WITH(NOLOCK) WHERE ID =@cvMainID AND paMainID = @paMainID)
- GOTO ERR
- IF @ID>0
- BEGIN
- IF NOT EXISTS(SELECT 'x' FROM CvProject WITH(NOLOCK) WHERE ID =@ID AND cvMainID = @cvMainID)
- GOTO ERR
- SELECT @NameOld = dbo.TextTrim(ISNULL(NameEng, '')),
- @DescriptionOld = dbo.TextTrim(ISNULL(DescriptionEng, '')),
- @ResponsibilitiesOld = dbo.TextTrim(ISNULL(ResponsibilitiesEng, ''))
- FROM CvProject WITH(NOLOCK) WHERE ID = @ID
- UPDATE CvProject SET
- NameEng = @Name,
- StartDate = @StartDate,
- ENDDate = @ENDDate,
- DescriptionEng = @Description,
- ResponsibilitiesEng = @Responsibilities
- WHERE ID=@ID
- SET @MaxID = @ID
- IF ISNULL(@NameOld, '') <> ISNULL(@Name, '')
- BEGIN
- DELETE FROM bsCvModify WHERE SubID = @ID AND Location = 'fe1'
- INSERT INTO bsCvModify(paMainID,cvMainID,SubID,Location,ColValue) VALUES(@paMainID,@cvMainID,@MaxID,'fe1',@Name)
- SET @Modify=1
- END
- IF @Description IS NULL
- DELETE FROM bsCvModify WHERE paMainID=@paMainID AND cvMainID=@cvMainID AND SubID = @ID AND Location = 'fe2'
- ELSE
- IF ISNULL(@DescriptionOld, '') <> @Description
- BEGIN
- DELETE FROM bsCvModify WHERE paMainID=@paMainID AND cvMainID=@cvMainID AND SubID = @ID AND Location = 'fe2'
- INSERT INTO bsCvModify(paMainID,cvMainID,SubID,Location,ColValue) VALUES(@paMainID,@cvMainID,@MaxID,'fe2',@Description)
- SET @Modify=1
- END
- IF @Responsibilities IS NULL
- DELETE FROM bsCvModify WHERE paMainID=@paMainID AND cvMainID=@cvMainID AND SubID = @ID AND Location = 'fe3'
- ELSE
- IF ISNULL(@ResponsibilitiesOld, '') <> @Responsibilities
- BEGIN
- DELETE FROM bsCvModify WHERE paMainID=@paMainID AND cvMainID=@cvMainID AND SubID = @ID AND Location = 'fe3'
- INSERT INTO bsCvModify(paMainID,cvMainID,SubID,Location,ColValue) VALUES(@paMainID,@cvMainID,@MaxID,'fe3',@Responsibilities)
- SET @Modify=1
- END
- END
- ELSE
- BEGIN
- INSERT INTO CvProject
- (cvMainID,NameEng,StartDate,ENDDate,DescriptionEng,ResponsibilitiesEng)
- VALUES(@cvMainID,@Name,@StartDate,@ENDDate,@Description,@Responsibilities)
- SET @MaxID = @@IDENTITY
- SET @Modify=1
- INSERT INTO bsCvModify(paMainID,cvMainID,SubID,Location,ColValue) VALUES(@paMainID,@cvMainID,@MaxID,'fe1',@Name)
- IF @Description > ''
- INSERT INTO bsCvModify(paMainID,cvMainID,SubID,Location,ColValue) VALUES(@paMainID,@cvMainID,@MaxID,'fe2',@Description)
- IF @Responsibilities > ''
- INSERT INTO bsCvModify(paMainID,cvMainID,SubID,Location,ColValue) VALUES(@paMainID,@cvMainID,@MaxID,'fe3',@Responsibilities)
- END
- END
- --修改cvLevel
- DECLARE @SQL AS VARCHAR(100)
- SET @SQL = 'EXEC pcCvMainByCvLevelUpdateNew ' + CONVERT(CHAR(1), @Type) + ',' + CONVERT(VARCHAR(10), @cvMainID) + ',9,1'
- EXEC(@SQL)
- END TRY
- BEGIN cATCH
- GOTO ERR
- END CATCH
- COMMIT TRAN
- RETURN @MaxID
- ERR:
- BEGIN
- ROLLBACK TRAN
- RETURN 0
- END
- GO
- /****** Object: StoredProcedure [dbo].[pcCvProjectSelect] Script Date: 2018/12/13 19:08:23 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- -- =============================================
- -- Author: Sean
- -- Create date: 2010-10-5
- -- Description: 选择项目信息
- -- =============================================
- CREATE PROCEDURE [dbo].[pcCvProjectSelect]
- @cvMainID INT
- AS
- BEGIN
- SELECT *
- FROM CvProject WITH(NOLOCK INDEX(IX_cvProject_cvMainID))
- WHERE cvMainID = @cvMainID
- ORDER BY StartDate DESC
- END
- GO
- /****** Object: StoredProcedure [dbo].[pcCvrExchangeInsert] Script Date: 2018/12/13 19:08:23 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- CREATE PROCEDURE [dbo].[pcCvrExchangeInsert]
- (
- @RecommendID INT,
- @dcSubSiteId INT,
- @ExchangeNumber INT,
- @cvrGift INT,
- @Recipient VARCHAR(50),
- @RecipientMobile VARCHAR(15),
- @RecipientAddress VARCHAR(100),
- @Remark VARCHAR(MAX)
- )
- AS
- BEGIN TRY
- DECLARE @Amount INT
- DECLARE @lastIntegral INT
- IF NOT EXISTS(SELECT 'x' FROM marketDB..cvrGift WITH(NOLOCK) WHERE ID = @cvrGift AND isonline=1 AND remainder >= @ExchangeNumber)
- RETURN -1
- SELECT @Amount = Cost * @ExchangeNumber FROM marketDB..cvrGift WHERE ID = @cvrGift
- SELECT @lastIntegral = (SELECT COUNT(*) FROM marketdb..cvrRecommend WITH(NOLOCK)
- WHERE RecommendID=@RecommendID
- AND HasValid=3 AND HasReply=1) -
- ISNULL((SELECT SUM(Amount) FROM marketdb..cvrExchange WITH(NOLOCK)
- WHERE RecommendID=@RecommendID
- AND HasVerify<>2), 0)
- IF @lastIntegral<@Amount
- RETURN -2
- INSERT INTO marketDB..cvrExchange(RecommendID, dcSubSiteId, ExchangeNumber, cvrGift, Amount, ApplyTime, Recipient, RecipientMobile, RecipientAddress, Remark)
- SELECT @RecommendID, @dcSubSiteId, @ExchangeNumber, @cvrGift, @Amount, GETDATE(), dbo.SafeSQL(@Recipient),
- dbo.SafeSQL(@RecipientMobile), dbo.SafeSQL(@RecipientAddress), dbo.SafeSQL(@Remark)
- UPDATE marketDB..cvrGift SET Remainder = Remainder - @ExchangeNumber WHERE ID = @cvrGift
- RETURN 1
- END TRY
- BEGIN CATCH
- RETURN 0
- END CATCH
- GO
- /****** Object: StoredProcedure [dbo].[pcCvTrainingByIDSelect] Script Date: 2018/12/13 19:08:24 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- -- =============================================
- -- 检查: Sean
- -- 日期: 2010-10-5
- -- 描述: 提取培训经历
- -- =============================================
- CREATE PROCEDURE [dbo].[pcCvTrainingByIDSelect]
- @ID INT
- AS
- BEGIN
- SELECT *
- FROM CvTraining WITH(NOLOCK INDEX(PK_cvTraining))
- WHERE ID = @ID
- END
- GO
- /****** Object: StoredProcedure [dbo].[pcCvTrainingDelete] Script Date: 2018/12/13 19:08:24 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- --===============================
- -- 检查: sean
- -- 时间: 2010-9-29
- -- 描述: 删除培训经历 取消pcCvMainByCvLevelUpdate,pcCvMainVerifyResultCheck
- -- 修改:Lambo,2010-11-25
- -- 描述:增加了paMainID参数,判断是否是本人的
- --===============================
- CREATE PROCEDURE [dbo].[pcCvTrainingDelete]
- (
- @ID INT,
- @paMainID INT
- )
- AS
- BEGIN TRAN
- BEGIN TRY
- DECLARE @cvMainId AS INT
- DECLARE @RETURN AS VARCHAR(2)
- SELECT @cvMainId = cvMainId FROM CvTraining WITH(NOLOCK) WHERE ID=@ID
-
- IF @cvMainId IS NULL
- GOTO ERR
- IF NOT EXISTS(SELECT 'x' FROM cvMain WITH(NOLOCK)
- WHERE paMainID = @paMainID AND ID = @cvMainID)
- GOTO ERR
- DELETE FROM CvTraining WHERE ID=@ID
- DELETE FROM bsCvModify WHERE SubID = @ID AND Location LIKE 'g%'
- EXEC @RETURN = pcCvMainByCvLevelCheck @cvMainID, 8
- END TRY
- BEGIN CATCH
- GOTO ERR
- END CATCH
- COMMIT TRAN
- RETURN @RETURN
- ERR:
- BEGIN
- ROLLBACK TRAN
- RETURN 3
- END
- GO
- /****** Object: StoredProcedure [dbo].[pcCvTrainingSave] Script Date: 2018/12/13 19:08:24 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- --==================================================
- -- 检查: sean
- -- 时间: 2010-9-29
- -- 说明: 保存培训信息 取消pcCvMainByCvLevelUpdate pcCvMainVerifyResultUpdate
- ----------------
- CREATE PROCEDURE [dbo].[pcCvTrainingSave]
- (
- @Type INT,
- @ID INT,
- @cvMainID INT,
- @StartDate INT,
- @TimeLength INT,
- @TimeUnit INT,
- @Institution VARCHAR(150),
- @Course VARCHAR(250),
- @City VARCHAR(50),
- @Certificate VARCHAR(250),
- @Details VARCHAR(2500),
- @paMainID INT
- )
- AS
- SET NOCOUNT ON
- IF CHARINDEX('<', @Institution) > 0
- SET @Institution = REPLACE(@Institution, '<', '')
- IF CHARINDEX('<', @Course) > 0
- SET @Course = REPLACE(@Course, '<', '')
- IF CHARINDEX('<', @City) > 0
- SET @City = REPLACE(@City, '<', '')
- IF CHARINDEX('<', @Certificate) > 0
- SET @Certificate = REPLACE(@Certificate, '<', '')
- IF CHARINDEX('<', @Details) > 0
- SET @Details = REPLACE(@Details, '<', '')
- BEGIN TRAN
- ----检查是否是该账号的简历
- IF NOT EXISTS(SELECT 'x' FROM cvMain WITH(NOLOCK) WHERE ID = @cvMainID AND paMainID = @paMainID)
- GOTO ERR
- ----检查是否是该简历的培训信息
- IF @ID > 0
- IF NOT EXISTS(SELECT 'x' FROM CvTraining WITH(NOLOCK) WHERE ID = @ID AND cvMainID = @cvMainID)
- GOTO ERR
- SELECT @Institution = dbo.SafeSql(dbo.TextTrim(@Institution)),
- @Course = dbo.SafeSql(dbo.TextTrim(@Course)),
- @City = dbo.SafeSql(dbo.TextTrim(@City)),
- @Certificate = dbo.SafeSql(dbo.TextTrim(@Certificate)),
- @Details = dbo.SafeSql(dbo.TextTrim(@Details))
- BEGIN TRY
- DECLARE @MaxId AS INT
- DECLARE @InstitutionOld AS VARCHAR(150)
- DECLARE @CourseOld AS VARCHAR(250)
- DECLARE @CityOld AS VARCHAR(50)
- DECLARE @CertificateOld AS VARCHAR(250)
- DECLARE @DetailsOld AS VARCHAR(2500)
- DECLARE @Modify AS INT
- SET @Modify=-1
- IF @Type=0
- BEGIN
- DECLARE @I AS NVARCHAR(30)
- DECLARE @C AS NVARCHAR(50)
- DECLARE @Ci AS NVARCHAR(10)
- DECLARE @Ce AS NVARCHAR(50)
- DECLARE @D AS NVARCHAR(500)
- SET @I = @Institution
- SET @C = @Course
- SET @Ci = @City
- SET @Ce = @Certificate
- SET @D = @Details
-
- IF @ID>0
- BEGIN
- SELECT @InstitutionOld=dbo.TextTrim(ISNULL(Institution, '')),
- @CourseOld=dbo.TextTrim(ISNULL(Course, '')),
- @CityOld=dbo.TextTrim(ISNULL(City, '')),
- @CertificateOld=dbo.TextTrim(ISNULL(Certificate, '')),
- @DetailsOld=dbo.TextTrim(ISNULL(Details, ''))
- FROM CvTraining WITH(NOLOCK INDEX(PK_cvTraining))
- WHERE ID =@ID
- UPDATE CvTraining SET
- StartDate = @StartDate,
- TimeLength = @TimeLength,
- TimeUnit = @TimeUnit,
- Institution = @I,
- Course = @C,
- City = @Ci,
- Certificate = @Ce,
- Details = @D
- WHERE ID=@ID
- SET @MaxID = @ID
-
- IF ISNULL(@InstitutionOld, '') <> ISNULL(@I, '')
- BEGIN
- DELETE FROM bsCvModify WHERE paMainID=@paMainID AND cvMainID=@cvMainID AND SubID = @ID AND Location = 'gc1'
- INSERT INTO bsCvModify(paMainID,cvMainID,SubID,Location,ColValue) VALUES(@paMainID,@cvMainID,@MaxID,'gc1',@I)
- SET @Modify=0
- END
- IF ISNULL(@CourseOld, '') <> ISNULL(@C, '')
- BEGIN
- DELETE FROM bsCvModify WHERE paMainID=@paMainID AND cvMainID=@cvMainID AND SubID = @ID AND Location = 'gc2'
- INSERT INTO bsCvModify(paMainID,cvMainID,SubID,Location,ColValue) VALUES(@paMainID,@cvMainID,@MaxID,'gc2',@C)
- SET @Modify=0
- END
-
- IF @Ci IS NULL
- DELETE FROM bsCvModify WHERE paMainID=@paMainID AND cvMainID=@cvMainID AND SubID = @ID AND Location = 'gc3'
- ELSE
- IF ISNULL(@CityOld, '') <> ISNULL(@Ci, '')
- BEGIN
- DELETE FROM bsCvModify WHERE paMainID=@paMainID AND cvMainID=@cvMainID AND SubID = @ID AND Location = 'gc3'
- INSERT INTO bsCvModify(paMainID,cvMainID,SubID,Location,ColValue) VALUES(@paMainID,@cvMainID,@MaxID,'gc3',@ci)
- SET @Modify=0
- END
- IF @Ce IS NULL
- DELETE FROM bsCvModify WHERE paMainID=@paMainID AND cvMainID=@cvMainID AND SubID = @ID AND Location = 'gc4'
- ELSE
- IF ISNULL(@CertificateOld, '') <> ISNULL(@Ce, '')
- BEGIN
- DELETE FROM bsCvModify WHERE paMainID=@paMainID AND cvMainID=@cvMainID AND SubID = @ID AND Location = 'gc4'
- INSERT INTO bsCvModify(paMainID,cvMainID,SubID,Location,ColValue) VALUES(@paMainID,@cvMainID,@MaxID,'gc4',@ce)
- SET @Modify=0
- END
- IF @D IS NULL
- DELETE FROM bsCvModify WHERE paMainID=@paMainID AND cvMainID=@cvMainID AND SubID = @ID AND Location = 'gc5'
- ELSE
- IF ISNULL(@DetailsOld, '') <> ISNULL(@D, '')
- BEGIN
- DELETE FROM bsCvModify WHERE paMainID=@paMainID AND cvMainID=@cvMainID AND SubID = @ID AND Location = 'gc5'
- INSERT INTO bsCvModify(paMainID,cvMainID,SubID,Location,ColValue) VALUES(@paMainID,@cvMainID,@MaxID,'gc5',@D)
- SET @Modify=0
- END
- END
- ELSE
- BEGIN
- INSERT INTO CvTraining
- (cvMainID,StartDate,TimeLength,TimeUnit,Institution,
- Course,City,Certificate,Details)
- VALUES(@cvMainID,@StartDate,@TimeLength,@TimeUnit,@I,
- @c,@Ci,@Ce,@D)
- SET @MaxID = @@IDENTITY
- SET @Modify=0
- INSERT INTO bsCvModify(paMainID,cvMainID,SubID,Location,ColValue) VALUES(@paMainID,@cvMainID,@MaxID,'gc1',@I)
- INSERT INTO bsCvModify(paMainID,cvMainID,SubID,Location,ColValue) VALUES(@paMainID,@cvMainID,@MaxID,'gc2',@C)
- IF @ci > ''
- INSERT INTO bsCvModify(paMainID,cvMainID,SubID,Location,ColValue) VALUES(@paMainID,@cvMainID,@MaxID,'gc3',@ci)
- IF @Ce > ''
- INSERT INTO bsCvModify(paMainID,cvMainID,SubID,Location,ColValue) VALUES(@paMainID,@cvMainID,@MaxID,'gc4',@ce)
- IF @D > ''
- INSERT INTO bsCvModify(paMainID,cvMainID,SubID,Location,ColValue) VALUES(@paMainID,@cvMainID,@MaxID,'gc5',@D)
- END
- END
- ELSE
- BEGIN
- IF @ID>0
- BEGIN
- SELECT @InstitutionOld=dbo.TextTrim(ISNULL(InstitutionEng, '')),
- @CourseOld=dbo.TextTrim(ISNULL(CourseEng, '')),
- @CityOld=dbo.TextTrim(ISNULL(CityEng, '')),
- @CertificateOld=dbo.TextTrim(ISNULL(CertificateEng, '')),
- @DetailsOld=dbo.TextTrim(ISNULL(DetailsEng, ''))
- FROM CvTraining WITH(NOLOCK INDEX(PK_cvTraining)) WHERE ID =@ID
- UPDATE CvTraining SET
- StartDate = @StartDate,
- TimeLength = @TimeLength,
- TimeUnit = @TimeUnit,
- InstitutionEng = @Institution,
- CourseEng = @Course,
- CityEng = @City,
- CertificateEng = @Certificate,
- DetailsEng = @Details
- WHERE ID=@ID
- SET @MaxID = @ID
- IF ISNULL(@InstitutionOld, '') <> ISNULL(@Institution, '')
- BEGIN
- DELETE FROM bsCvModify WHERE paMainID=@paMainID AND cvMainID=@cvMainID AND SubID = @ID AND Location = 'ge1'
- INSERT INTO bsCvModify(paMainID,cvMainID,SubID,Location,ColValue) VALUES(@paMainID,@cvMainID,@MaxID,'ge1',@Institution)
- SET @Modify=1
- END
- IF ISNULL(@CourseOld, '') <> ISNULL(@Course, '')
- BEGIN
- DELETE FROM bsCvModify WHERE paMainID=@paMainID AND cvMainID=@cvMainID AND SubID = @ID AND Location = 'ge2'
- INSERT INTO bsCvModify(paMainID,cvMainID,SubID,Location,ColValue) VALUES(@paMainID,@cvMainID,@MaxID,'ge2',@Course)
- SET @Modify=1
- END
- IF @City IS NULL
- DELETE FROM bsCvModify WHERE paMainID=@paMainID AND cvMainID=@cvMainID AND SubID = @ID AND Location = 'ge3'
- ELSE
- IF ISNULL(@CityOld, '') <> ISNULL(@City, '')
- BEGIN
- DELETE FROM bsCvModify WHERE paMainID=@paMainID AND cvMainID=@cvMainID AND SubID = @ID AND Location = 'ge3'
- INSERT INTO bsCvModify(paMainID,cvMainID,SubID,Location,ColValue) VALUES(@paMainID,@cvMainID,@MaxID,'ge3',@City)
- SET @Modify=1
- END
- IF @Certificate IS NULL
- DELETE FROM bsCvModify WHERE paMainID=@paMainID AND cvMainID=@cvMainID AND SubID = @ID AND Location = 'ge4'
- ELSE
- IF ISNULL(@CertificateOld, '') <> ISNULL(@Certificate, '')
- BEGIN
- DELETE FROM bsCvModify WHERE paMainID=@paMainID AND cvMainID=@cvMainID AND SubID = @ID AND Location = 'ge4'
- INSERT INTO bsCvModify(paMainID,cvMainID,SubID,Location,ColValue) VALUES(@paMainID,@cvMainID,@MaxID,'ge4',@Certificate)
- SET @Modify=1
- END
- IF @Details IS NULL
- DELETE FROM bsCvModify WHERE paMainID=@paMainID AND cvMainID=@cvMainID AND SubID = @ID AND Location = 'ge5'
- ELSE
- IF ISNULL(@DetailsOld, '') <> ISNULL(@Details, '')
- BEGIN
- DELETE FROM bsCvModify WHERE paMainID=@paMainID AND cvMainID=@cvMainID AND SubID = @ID AND Location = 'ge5'
- INSERT INTO bsCvModify(paMainID,cvMainID,SubID,Location,ColValue) VALUES(@paMainID,@cvMainID,@MaxID,'ge5',@Details)
- SET @Modify=1
- END
- END
- ELSE
- BEGIN
- INSERT INTO CvTraining
- (cvMainID,StartDate,TimeLength,TimeUnit,InstitutionEng,
- CourseEng,CityEng,CertificateEng,DetailsEng)
- VALUES(@cvMainID,@StartDate,@TimeLength,@TimeUnit,@Institution,
- @Course,@City,@Certificate,@Details)
- SET @MaxID = @@IDENTITY
- SET @Modify=1
- INSERT INTO bsCvModify(paMainID,cvMainID,SubID,Location,ColValue) VALUES(@paMainID,@cvMainID,@MaxID,'ge1',@Institution)
- INSERT INTO bsCvModify(paMainID,cvMainID,SubID,Location,ColValue) VALUES(@paMainID,@cvMainID,@MaxID,'ge2',@Course)
- IF @City > ''
- INSERT INTO bsCvModify(paMainID,cvMainID,SubID,Location,ColValue) VALUES(@paMainID,@cvMainID,@MaxID,'ge3',@City)
- IF @Certificate > ''
- INSERT INTO bsCvModify(paMainID,cvMainID,SubID,Location,ColValue) VALUES(@paMainID,@cvMainID,@MaxID,'ge4',@Certificate)
- IF @Details > ''
- INSERT INTO bsCvModify(paMainID,cvMainID,SubID,Location,ColValue) VALUES(@paMainID,@cvMainID,@MaxID,'ge5',@Details)
- END
- END
- --修改cvLevel
- DECLARE @SQL AS VARCHAR(100)
- SET @SQL = 'EXEC pcCvMainByCvLevelUpdateNew ' + CONVERT(CHAR(1), @Type) + ',' + CONVERT(VARCHAR(10), @cvMainID) + ',8,1'
- EXEC(@SQL)
- END TRY
- BEGIN cATCH
- GOTO ERR
- END CATCH
- COMMIT TRAN
- RETURN @MaxID
- ERR:
- BEGIN
- ROLLBACK TRAN
- RETURN 0
- END
- GO
- /****** Object: StoredProcedure [dbo].[pcCvTrainingSelect] Script Date: 2018/12/13 19:08:25 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- -- =============================================
- -- 检查: Sean
- -- 日期: 2010-10-5
- -- 描述: 选择培训信息
- -- =============================================
- CREATE PROCEDURE [dbo].[pcCvTrainingSelect]
- @cvMainID INT
- AS
- BEGIN
- SELECT *
- FROM CvTraining WITH(NOLOCK INDEX(IX_cvTraining_cvMainID))
- WHERE cvMainID = @cvMainID
- ORDER BY StartDate DESC
- END
- GO
- /****** Object: StoredProcedure [dbo].[pcDcAutoEmailByWordSelect] Script Date: 2018/12/13 19:08:25 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- CREATE PROCEDURE [dbo].[pcDcAutoEmailByWordSelect]
- AS
- SET NOCOUNT ON
- BEGIN
- DECLARE @Id INT, @Email VARCHAR(50)
- IF NOT EXISTS(SELECT TOP 1 'X' FROM dcAutoEmail)
- BEGIN
- EXEC ProcDcAutoEmailInsert
- END
- SELECT TOP 1 @Id = id,@Email=Email FROM dcAutoEmail ORDER BY id
- DELETE FROM dcAutoEmail WHERE id= @Id
- SELECT @Email Email
- END
- GO
- /****** Object: StoredProcedure [dbo].[pcDcAutoEmailDelete] Script Date: 2018/12/13 19:08:25 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- --#####################################################
- --创建时间:2014.11.4
- --创建人:John
- --说明:删除记录
- --#####################################################
- CREATE PROCEDURE [dbo].[pcDcAutoEmailDelete]
- (
- @id INT
- )
- AS
- BEGIN
- DELETE FROM dcAutoEmail WHERE id= @id
- END
- GO
- /****** Object: StoredProcedure [dbo].[pcDcAutoEmailSelect] Script Date: 2018/12/13 19:08:25 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- --#####################################################
- --创建时间:2014.11.4
- --创建人:John
- --说明:获取第一条记录
- --#####################################################
- CREATE PROCEDURE [dbo].[pcDcAutoEmailSelect]
- AS
- BEGIN
- SELECT TOP 1 * FROM dcAutoEmail ORDER BY id
- END
- GO
- /****** Object: StoredProcedure [dbo].[pcdcFeeDelete] Script Date: 2018/12/13 19:08:25 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- CREATE PROCEDURE [dbo].[pcdcFeeDelete]
- (
- @ID INT
- )
- AS
- BEGIN TRAN
- BEGIN TRY
- UPDATE dcFee SET EndDate = GETDATE() WHERE ID = @ID
- --INSERT INTO dcFeeLog SELECT * FROM dcFee WITH(NOLOCK) WHERE ID=@ID
- DELETE FROM dcFee WHERE ID = @ID
- END TRY
- BEGIN CATCH
- GOTO ERR
- END CATCH
- COMMIT TRAN
- RETURN 1
- ERR:
- BEGIN
- ROLLBACK TRAN
- RETURN 0
- END
- GO
- /****** Object: StoredProcedure [dbo].[pcdcVipDelete] Script Date: 2018/12/13 19:08:25 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- CREATE PROCEDURE [dbo].[pcdcVipDelete]
- (
- @ID INT
- )
- AS
- BEGIN TRAN
- BEGIN TRY
- UPDATE dcVip SET EndDate = GETDATE() WHERE ID = @ID
- --INSERT INTO dcVipLog SELECT * FROM dcVip WITH(NOLOCK) WHERE ID=@ID
- DELETE FROM dcVip WHERE ID = @ID
- END TRY
- BEGIN CATCH
- GOTO ERR
- END CATCH
- COMMIT TRAN
- RETURN 1
- ERR:
- BEGIN
- ROLLBACK TRAN
- RETURN 0
- END
- GO
- /****** Object: StoredProcedure [dbo].[pcexImageInsert] Script Date: 2018/12/13 19:08:26 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- CREATE PROCEDURE [dbo].[pcexImageInsert]
- (
- @OutID INT,
- @OutType INT,
- @UID VARCHAR(20) OUTPUT
- )
- AS
- BEGIN
- DECLARE @T AS VARCHAR(20)
- SET @T = CONVERT(VARCHAR(20), CONVERT(DECIMAL(18,12),GETDATE()))
- SET @T = RTRIM(CONVERT(VARCHAR(12), @OutID)) + '_' + RIGHT(@T,8)
- Insert Into exImage(OutID,OutType,UniqueID)
- Values(@OutID,@OutType,@T)
- SET @UID = @T
- END
- GO
- /****** Object: StoredProcedure [dbo].[pcExInterViewByBaiduPushSelect] Script Date: 2018/12/13 19:08:26 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- --===================================
- --创建: Andy
- --描述: 获取所有paMainID面试通知个数,
- --===================================
- CREATE PROCEDURE [dbo].[pcExInterViewByBaiduPushSelect]
- (
- @WHERE VARCHAR(1000)
- )
- AS
- BEGIN
- SET @WHERE = dbo.SafeSql(@Where)
- DECLARE @SQL AS VARCHAR(2000)
- SET @SQL='SELECT d.paMainID, count(*) as Count
- FROM exInterView a WITH(NOLOCK)
- Inner Join Job b WITH(NOLOCK) On b.ID=a.JobID
- Inner Join cpMain c WITH(NOLOCK) ON b.cpMainID=c.ID
- Inner Join cvMain d WITH(NOLOCK) ON a.cvMainID=d.ID
- WHERE PersonDeleted=0 '
- IF LEN(@WHERE)>0
- SET @SQL=@SQL + ' AND '+@WHERE
- SET @SQL=@SQL + ' GROUP BY d.pamainiD '
- EXEC(@SQL)
- END
- GO
- /****** Object: StoredProcedure [dbo].[pcexInterViewByMailUpdate] Script Date: 2018/12/13 19:08:26 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- --===================================
- --创建: lucifer
- --检查: Sean
- --描述: 回复面试通知 ,增加paMainID
- --===================================
- CREATE PROCEDURE [dbo].[pcexInterViewByMailUpdate]
- (
- @ID INT,
- @Reply TINYINT,
- @ReplyMessage VARCHAR(500),
- @paMainID INT
- )
- AS
- SET NOCOUNT ON
- IF CHARINDEX('<', @ReplyMessage) > 0
- SET @ReplyMessage = REPLACE(@ReplyMessage, '<', '')
- BEGIN TRY
- IF NOT EXISTS(SELECT 'x' FROM exInterview a WITH(NOLOCK), cvMain b WITH(NOLOCK) WHERE a.id=@ID AND a.cvMainID=b.ID AND b.paMainID=@paMainID)
- GOTO ERR1
- UPDATE exInterView
- SET Reply = @Reply, ReplyMessage = dbo.SafeSql(@ReplyMessage), ReplyDate=GETDATE()
- WHERE ID = @ID
- DECLARE @Str AS VARCHAR(3000),
- @CompanyName AS NVARCHAR(50),
- @JobName AS VARCHAR(50),
- @ConsultantId AS INT,
- @ConsultantName AS VARCHAR(100),
- @JobId AS INT,
- @cvMainId AS INT
- SELECT @JobId = JobId, @cvMainId = cvMainId FROM exInterView WITH(NOLOCK) WHERE ID = @ID
- SELECT @CompanyName = a.Name, @JobName = b.Name, @ConsultantId = a.ConsultantId
- FROM cpMain a WITH(NOLOCK)
- INNER JOIN Job b WITH(NOLOCK) ON a.ID = b.cpMainId
- WHERE b.Id = @JobId
- SET @str = '<html><body><font style="font-family:''宋体'';font-size:14px">'
- SET @Str = @Str + @CompanyName
- SET @Str = @Str + ',您好:<br> 您曾在::WebSite'
- SET @Str = @Str + '(<a href=''http://::EmailSite'' target=''_blank''>http://::EmailSite</a>)上通知求职者<b>::paName'
- SET @Str = @Str + '[简历编号:' + LTRIM(STR(@cvMainId)) + ']</b>参加['
- SET @Str = @Str + @JobName
- SET @Str = @Str + ']的面试,'
- IF @Reply = 1
- SET @Str = @Str + '对方表示能够赴约'
- ELSE
- SET @Str = @Str + '对方表示不能够赴约'
- SET @Str = @Str + '。详细情况请登录::WebSite(<a href=''http://::EmailSite'' target=''_blank''>http://::EmailSite</a>)查看。'
- IF @ConsultantId > 0
- BEGIN
- SELECT @ConsultantName = Name FROM ManagerUser WITH(NOLOCK) WHERE ID = @ConsultantId
- SET @Str = @Str + '您的招聘顾问是'
- SET @Str = @Str + LTRIM(STR(@ConsultantId))
- SET @Str = @Str + '号'
- SET @Str = @Str + @ConsultantName
- SET @Str = @Str + '。'
- END
- SET @Str = @Str + '<br> 此通知信委托网站发送,请不要直接回复该邮件,该求职者无法收到。为保证您的权益,请使用正确的网址http://::EmailSite访问,建议将该网址添加到浏览器收藏夹。</font></body></html>'
- SELECT @Str
- RETURN
- END TRY
- BEGIN CATCH
- GOTO ERR
- END CATCH
- ERR:
- BEGIN
- SELECT 0
- RETURN
- END
- ERR1:
- BEGIN
- SELECT -1
- END
- GO
- /****** Object: StoredProcedure [dbo].[pcexInterViewByMailUpdateNew] Script Date: 2018/12/13 19:08:26 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- --===================================
- --创建: Nick 2012-12-7
- --描述: 回复面试通知
- --修改: Nick 2013-1-24
- --修改:Alen 2018-10-19 添加paPushLog取第一条数据
- --描述: 查询企业Email
- ---20160411 Lucifer 添加企业微信提醒
- --===================================
- CREATE PROCEDURE [dbo].[pcexInterViewByMailUpdateNew]
- (
- @ID INT,
- @Reply TINYINT,
- @ReplyMessage VARCHAR(500),
- @paMainID INT
- )
- AS
- SET NOCOUNT ON
- IF CHARINDEX('<', @ReplyMessage) > 0
- SET @ReplyMessage = REPLACE(@ReplyMessage, '<', '')
- BEGIN TRY
- IF NOT EXISTS(SELECT 'x' FROM exInterview a WITH(NOLOCK), cvMain b WITH(NOLOCK) WHERE a.id=@ID AND a.cvMainID=b.ID AND b.paMainID=@paMainID)
- GOTO ERR1
- UPDATE exInterView
- SET Reply = @Reply, ReplyMessage = dbo.SafeSQL(@ReplyMessage), ReplyDate=GETDATE()
- WHERE ID = @ID
- DECLARE @Str AS VARCHAR(3000),
- @CompanyName AS NVARCHAR(50),
- @JobName AS VARCHAR(50),
- @ConsultantId AS INT,
- @ConsultantName AS VARCHAR(100),
- @JobId AS INT,
- @cvMainId AS INT,
- @ReplyInfo AS NVARCHAR(100),
- @CompanyEmail AS VARCHAR(200),
- @cpMainID AS INT
- SELECT @JobId = JobId, @cvMainId = cvMainId FROM exInterView WITH(NOLOCK) WHERE ID = @ID
- SELECT @CompanyName = a.Name, @JobName = b.Name, @ConsultantId = a.ConsultantId ,@CompanyEmail = c.Email, @cpMainID = a.ID
- FROM cpMain a WITH(NOLOCK), Job b WITH(NOLOCK) , CaMain c WITH(NOLOCK)
- WHERE a.ID = b.cpMainId
- AND b.Id = @JobId
- AND b.CaMainID = c.ID
- ---是否能够赴约
- IF @Reply = 1
- SET @ReplyInfo = '对方表示能够赴约'
- ELSE
- SET @ReplyInfo = '对方表示不能够赴约'
- SELECT @ReplyInfo AS Reply, @CompanyName AS CompanyName, @cvMainId AS cvMainId,
- @CompanyName AS CompanyName, @JobName AS JobName, @ConsultantId AS ConsultantId,
- @CompanyEmail AS CompanyEmail, @cpMainID AS cpMainId
- INSERT wxMessageSend2(Templatetype, WxFansID, PaMainId, CvMainId, CpMainID, CaMainId, JobId, AddDate)
- SELECT 15, b.ID, @paMainID, d.cvMainID, c.cpMainID, c.caMainID, c.ID, GETDATE()
- FROM paLoginContact a WITH(NOLOCK), wxFans b WITH(NOLOCK), Job c WITH(NOLOCK), exInterview d WITH(NOLOCK)
- WHERE a.OpenID = b.OpenID AND c.caMainID = a.paMainID AND d.JobID = c.ID AND a.ContactType = 101 AND d.ID = @ID
-
- INSERT INTO paPushLog(paMainID, PushMessage, PushType)
- SELECT TOP 1 a.caMainID, e.name+'回复'+ REPLACE(@ReplyInfo,'对方表示',''), 13
- FROM caIOSBind a WITH(NOLOCK),Job b WITH(NOLOCK), exInterview c WITH(NOLOCK),cvMain d WITH(NOLOCK),paMain e WITH(NOLOCK)
- WHERE a.caMainID = b.caMainID AND b.ID = c.JobID AND c.cvMainId= d.id AND d.paMainId= e.id AND c.id = @ID
-
- END TRY
- BEGIN CATCH
- GOTO ERR
- END CATCH
- ERR:
- BEGIN
- SELECT 0
- RETURN
- END
- ERR1:
- BEGIN
- SELECT -1
- END
- GO
- /****** Object: StoredProcedure [dbo].[pcExInterViewDelete] Script Date: 2018/12/13 19:08:26 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- --===============================
- --创建: lucifer
- --检查: sean,2010-10-13
- --返回值: 0:未知错误
- -- -1:该留言不存在
- -- -2:您没有权限查看该留言,该留言不是你写的
- -- 如果企业已经删除了该面试通知,个人删除
- CREATE PROCEDURE [dbo].[pcExInterViewDelete]
- (
- @ID INT,
- @paMainID INT
- )
- AS
- BEGIN TRY
- DECLARE @CompanyDeleted AS BIT
- DECLARE @cvMainID AS INT
- DECLARE @paID AS INT
- SELECT @CompanyDeleted=CompanyDeleted,@cvMainID=cvMainID FROM ExInterView WITH(NOLOCK) WHERE ID=@ID
- IF @cvMainID IS NULL
- GOTO Err1
- ELSE
- SELECT @paID=paMainID FROM cvMain WITH(NOLOCK) WHERE ID = @cvMainID
-
- IF @paMainID = @paID
- IF @CompanyDeleted=1
- DELETE FROM ExInterView WHERE CompanyDeleted=1 AND ID = @ID
- ELSE
- UPDATE ExInterView SET PersonDeleted=1, PersonDeleteDate=GETDATE() WHERE ID = @ID
- ELSE
- GOTO Err2
- END TRY
- BEGIN CATCH
- GOTO ERR
- END CATCH
- RETURN 1
- ERR:
- BEGIN
- RETURN 0
- END
- ERR1:
- BEGIN
- RETURN -1
- END
- ERR2:
- BEGIN
- RETURN -2
- END
- GO
- /****** Object: StoredProcedure [dbo].[pcExInterViewSelect] Script Date: 2018/12/13 19:08:27 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- --===================================
- --创建: lucifer
- --检查: Sean
- --描述: 个人用户查看面试通知,面试通知选择
- --修改: Harry 2015-6-24
- --修改内容: dcregionID改为dcregionId
- --===================================
- CREATE PROCEDURE [dbo].[pcExInterViewSelect]
- (
- @WHERE VARCHAR(1000),
- @Order VARCHAR(100)
- )
- AS
- BEGIN
- SELECT @WHERE = dbo.SafeSQL(@WHERE),
- @ORDER = dbo.SafeSQL(@ORDER)
- DECLARE @SQL AS VARCHAR(2000)
- SET @SQL='SELECT a.ID,a.JobID,a.cvMainID,a.InterviewDate,a.InterViewPlace,a.LinkMan,a.Telephone,a.Remark,a.AddDate,a.Reply,a.ReplyMessage,a.Replydate,a.CompanyDeleted,a.CompanyDeleteDate,a.PersonDeleted,a.PersonDeleteDate,a.ViewDate,
- b.Name as JobName,b.dcRegionId,c.Name as cpName,c.ID as cpID,c.HasLicence,c.IsAgent,b.IssueDate,b.IssueEND,b.IsDelete,d.Name cvName, c.Membertype, b.SecondId EnJobID, c.SecondId EnCpMainID,ISNULL((SELECT IsOnline FROM caOnline WHERE caMainId =b.caMainID), 0) AS IsOnline,b.CaMainID, c.LogoFile LogoUrl, b.Valid JobValid'
- SET @SQL=@SQl+' FROM exInterView a WITH(NOLOCK) inner join Job b WITH(NOLOCK) On
- b.ID=a.JobID Inner Join cpMain c WITH(NOLOCK) ON b.cpMainID=c.ID Inner Join cvMain d WITH(NOLOCK) ON a.cvMainID=d.ID'
- SET @SQL=@SQl+' WHERE PersonDeleted=0 '
- IF LEN(@WHERE) > 0
- SET @SQL = @SQL + ' AND ' + @WHERE
- IF LEN(@ORDER) > 0
- SET @SQL = @SQL + ' ORDER BY ' + @ORDER
- EXEC(@SQL)
- END
- GO
- /****** Object: StoredProcedure [dbo].[pcexInterViewUpdate] Script Date: 2018/12/13 19:08:27 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- --===================================
- --创建: lucifer
- --检查: Sean
- --描述: 回复面试通知 ,增加paMainID
- --===================================
- CREATE PROCEDURE [dbo].[pcexInterViewUpdate]
- (
- @ID INT,
- @Reply TINYINT,
- @ReplyMessage VARCHAR(500),
- @paMainID INT
- )
- AS
- SET NOCOUNT ON
- IF CHARINDEX('<', @ReplyMessage) > 0
- SET @ReplyMessage = REPLACE(@ReplyMessage, '<', '')
- BEGIN TRY
- IF NOT EXISTS(SELECT 'x' FROM exInterview a WITH(NOLOCK),cvMain b WITH(NOLOCK) WHERE a.id=@ID AND a.cvMainID=b.ID AND b.paMainID=@paMainID)
- GOTO ERR1
- UPDATE exInterView
- SET Reply=@Reply, ReplyMessage = dbo.SafeSql(@ReplyMessage), ReplyDate=GETDATE()
- WHERE ID=@ID
- RETURN 1
- END TRY
- BEGIN CATCH
- GOTO ERR
- END CATCH
- ERR:
- BEGIN
- RETURN 0
- END
- ERR1:
- BEGIN
- RETURN -1
- END
- GO
- /****** Object: StoredProcedure [dbo].[pcexInterViewViewDateUpdate] Script Date: 2018/12/13 19:08:27 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- --===================================
- --创建: lucifer
- --检查: Sean
- --描述: 面试通知查看时间修改 ,增加了pamainid
- --===================================
- CREATE PROCEDURE [dbo].[pcexInterViewViewDateUpdate]
- (
- @ID INT,
- @paMainID INT
- )
- AS
- BEGIN TRY
- UPDATE a SET a.ViewDate=GETDATE()
- FROM exInterView a, cvMain b
- WHERE a.ID=@ID
- AND a.cvMainID = b.ID
- AND b.paMainID = @paMainID
- END TRY
- BEGIN CATCH
- GOTO ERR
- END CATCH
- RETURN 1
- ERR:
- BEGIN
- RETURN 0
- END
- GO
- /****** Object: StoredProcedure [dbo].[pcExJobApplyApplyMessageByCvMainIDSelect] Script Date: 2018/12/13 19:08:27 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- CREATE PROCEDURE [dbo].[pcExJobApplyApplyMessageByCvMainIDSelect]
- (
- @CvMainID INT
- )
- AS
- BEGIN
- SELECT TOP 1 ApplyMessage FROM exJobApply WITH(NOLOCK) WHERE cvMainID = @CvMainID ORDER BY ID DESC
- END
- GO
- /****** Object: StoredProcedure [dbo].[pcExJobApplyBatchDelete] Script Date: 2018/12/13 19:08:28 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- --====================================
- --返回值:-1:不是你的求职申请
- --创建: luicifer
- --检查: sean 2010-10-13
- --====================================
- CREATE PROCEDURE [dbo].[pcExJobApplyBatchDelete]
- (
- @AllID VARCHAR(1000),
- @paMainID INT
- )
- AS
- SET NOCOUNT ON
- BEGIN TRAN
- BEGIN TRY
- IF LEN(ISNULL(@AllID, '')) < 2
- GOTO Err2
- --生成临时表
- DECLARE @t AS TABLE(
- ID INT
- )
- DECLARE @i INT
- SET @i=CHARINDEX(',',@AllID)
- WHILE @i>=1
- BEGIN
- IF LEFT(@AllID,@i-1) > ''
- INSERT @t VALUES(LEFT(@AllID,@i-1))
- SET @AllID=SUBSTRING(@AllID,@i+1,LEN(@AllID)-@i)
- SET @i=CHARINDEX(',',@AllID)
- END
- IF @AllID > ''
- INSERT @t VALUES(@AllID)
- ----判断是否这些id是同一个paMainID
- IF EXISTS(SELECT 'X' FROM ExJobApply a WITH(NOLOCK),@t b,cvMain c WITH(NOLOCK)
- WHERE a.id=b.id AND a.cvMainID=c.ID AND c.paMainID<>@paMainID)
- GOTO Err1
- DELETE FROM ExJobApply WHERE CompanyDeleted=1 AND ID IN(SELECT ID FROM @t)
- UPDATE ExJobApply SET PersonDeleted=1 WHERE ID IN(SELECT ID FROM @t)
- END TRY
- BEGIN CATCH
- GOTO ERR
- END CATCH
- COMMIT TRAN
- --PRINT -1
- RETURN 1
- ERR:
- BEGIN
- --PRINT 0
- ROLLBACK TRAN
- RETURN 0
- END
- ERR1:
- BEGIN
- --PRINT -1
- ROLLBACK TRAN
- RETURN -1
- END
- ERR2:
- BEGIN
- --PRINT 2
- ROLLBACK TRAN
- RETURN -2
- END
- GO
- /****** Object: StoredProcedure [dbo].[pcExjobApplyByAddDateSelect] Script Date: 2018/12/13 19:08:28 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- --harry 2018-6-21
- --14天内是否申请过职位
- CREATE PROCEDURE [dbo].[pcExjobApplyByAddDateSelect]
- (
- @paMainId INT
- )
- AS
- BEGIN
- SET NOCOUNT ON
- SELECT * FROM exjobapply
- WHERE cvMainId IN(select id FROM cvmain WHERE valid=1 AND paMainId = @paMainId)
- AND AddDate>GETDATE()-14
- SET NOCOUNT OFF
- END
- GO
- /****** Object: StoredProcedure [dbo].[pcExJobApplyByApplyMessageUpdate] Script Date: 2018/12/13 19:08:28 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- CREATE PROCEDURE [dbo].[pcExJobApplyByApplyMessageUpdate]
- (
- @ApplyIds VARCHAR(2000),
- @ApplyMessage VARCHAR(3000),
- @cvMainID INT
- )
- AS
- SET NOCOUNT ON
- IF CHARINDEX('<', @ApplyMessage) > 0
- SET @ApplyMessage = REPLACE(@ApplyMessage, '<', '')
- BEGIN
- UPDATE exJobApply SET ApplyMessage = @ApplyMessage WHERE ID IN(SELECT a FROM dbo.FnSplit(@ApplyIds, ',')) AND cvMainID = @cvMainID
- RETURN 1
- END
- SET NOCOUNT ON
- GO
- /****** Object: StoredProcedure [dbo].[pcExJobApplyByBaiduPushSelect] Script Date: 2018/12/13 19:08:28 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- --====================================
- --创建: Andy Yin
- --获取所有PaMainID对应的职位邀请数据个数。用于给app推送数据。
- --====================================
- CREATE PROCEDURE [dbo].[pcExJobApplyByBaiduPushSelect]
- (
- @WHERE VARCHAR(1000)
- )
- AS
- BEGIN
- BEGIN TRY
- SET @WHERE = REPLACE(dbo.SafeSQL(@WHERE), '''', '')
- DECLARE @SQL AS VARCHAR(2000)
- SET @SQL='SELECT d.paMainID, COUNT(*) as Count
- FROM exJobApply a WITH(NOLOCK)
- INNER JOIN Job b WITH(NOLOCK) On b.ID=a.JobID
- INNER JOIN cpMain c WITH(NOLOCK) ON b.cpMainID=c.ID
- INNER JOIN cvMain d WITH(NOLOCK) ON a.cvMainID = d.ID WHERE PersonDeleted=0'
- IF LEN(@WHERE)>0
- SET @SQL=@SQL + ' AND '+@WHERE
- SET @SQL=@SQL + ' GROUP BY d.pamainid '
- EXEC(@SQL)
- END TRY
- BEGIN CATCH
- END CATCH
- END
- GO
- /****** Object: StoredProcedure [dbo].[pcExJobApplyByCpMainIDSelect] Script Date: 2018/12/13 19:08:28 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- --#####################################################
- --创建时间:2014.10.31
- --创建人:Nick
- --说明:向企业申请的职位
- --#####################################################
- CREATE PROCEDURE [dbo].[pcExJobApplyByCpMainIDSelect]
- (
- @cpmainID INT,
- @cvMainID INT
- )
- AS
- BEGIN TRY
- SELECT b.id, b.Name
- FROM ExJobApply a WITH(NOLOCK),Job b
- WHERE a.JobID = b.ID
- AND a.cvMainID = @cvMainID
- AND b.cpMainID = @cpMainID
- AND CompanyDeleted = 0
- AND PersonDeleted = 0
- ORDER BY a.IsFilter,
- a.ID DESC
- END TRY
- BEGIN CATCH
- RETURN 0
- END CATCH
- GO
- /****** Object: StoredProcedure [dbo].[pcExJobApplyByIDsDelete] Script Date: 2018/12/13 19:08:29 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- --#####################################################
- --创建时间:2014.11.4
- --创建人:John
- --说明:删除职位信息
- --#####################################################
- CREATE PROCEDURE [dbo].[pcExJobApplyByIDsDelete]
- (
- @ApplyIDs VARCHAR(MAX)
- )
- AS
- BEGIN
- SET @ApplyIDs = dbo.FormatIDS(@ApplyIDs)
- DECLARE @SQL AS VARCHAR(MAX)
- SET @SQL = 'DELETE FROM exJobApply WHERE ID IN(' + @ApplyIDs + ')'
- EXEC(@SQL)
- END
- GO
- /****** Object: StoredProcedure [dbo].[pcExJobApplyByIDUpdate] Script Date: 2018/12/13 19:08:29 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- --创建:Nick
- --创建日期:2015-11-09
- --个人中心,还原职位
- --------------------------------------------------
- CREATE PROCEDURE [dbo].[pcExJobApplyByIDUpdate]
- (
- @ID INT,
- @PaMainID INT
- )
- AS
- BEGIN
- SET NOCOUNT ON
- UPDATE ExJobApply SET PersonDeleted=0
- WHERE CvMainID IN(SELECT ID FROM CVMAIN WITH(NOLOCK) WHERE PaMainID = @PaMainID)
- AND ID = @ID
- AND PersonDeleted = 1
- SET NOCOUNT OFF
- END
- GO
- /****** Object: StoredProcedure [dbo].[pcExJobApplyByIsDeletedSelect] Script Date: 2018/12/13 19:08:30 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- --创建:Nick
- --创建日期:2015-11-09
- --个人中心,职位回收站
- --------------------------------------------------
- CREATE PROCEDURE [dbo].[pcExJobApplyByIsDeletedSelect]
- (
- @WHERE VARCHAR(1000),
- @Order VARCHAR(100)
- )
- AS
- SET NOCOUNT ON
- BEGIN
- SET @WHERE = REPLACE(dbo.SafeSQL(@WHERE), '''', '')
- SET @ORDER = REPLACE(dbo.SafeSQL(@ORDER), '''', '')
- SET @Where = REPLACE(@Where, 'LIKE %', 'LIKE ''%')
- SET @Where = REPLACE(@Where, '% OR ', '%'' OR ')
- SET @Where = REPLACE(@Where, '%)', '%'')')
- DECLARE @SQL AS VARCHAR(2000)
- SET @SQL='SELECT a.ID, a.JobID, b.SecondId EnJobID, c.SecondId EnCpMainID, a.cvMainID, a.ApplyMessage, a.AddDate, a.CompanyDeleted, a.CompanyDeleteDate,
- a.PersonDeleted, a.Reply, a.ReplyDate, a.ViewDate, b.Name as JobName, b.caMainID, b.dcRegionID, c.Name as cpName, c.ID as cpID,
- c.HasLicence, c.IsAgent, c.MemberType, b.IssueDate, b.IssueEND, b.IsDelete, d.Name cvName, dbo.GetCvMatch(a.cvMainID,a.JobID) cvMatch, dbo.GetCaOnlineStatus(b.caMainID) AS IsOnline,a.RemindDate
- FROM exJobApply a WITH(NOLOCK)
- inner join Job b WITH(NOLOCK) On b.ID=a.JobID
- Inner Join cpMain c WITH(NOLOCK) ON b.cpMainID=c.ID
- INNER JOIN cvMain d WITH(NOLOCK) ON a.cvMainID = d.ID
- WHERE PersonDeleted=1 AND IsDeleted = 0'
- IF LEN(@WHERE)>0
- SET @SQL=@SQL + ' AND '+@WHERE
- IF LEN(@ORDER)>0
- SET @SQL=@SQL + ' ORDER BY '+@ORDER
- EXEC(@SQL)
- END
- GO
- /****** Object: StoredProcedure [dbo].[pcExJobApplyByJobIDSelect] Script Date: 2018/12/13 19:08:30 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- --#####################################################
- --创建时间:2014.10.31
- --创建人:Nick
- --说明:根据职位ID获取一条申请记录
- --修改:harry2017-5-4提升企业答复率,按照申请时间显示最早的申请记录,未答复的
- --#####################################################
- CREATE PROCEDURE [dbo].[pcExJobApplyByJobIDSelect]
- (
- @CvMainID INT,
- @JobID INT
- )
- AS
- BEGIN TRY
- SELECT TOP 1 a.ID,a.reply,a.AddDate,b.ID jobID,b.name,a.*,b.CaMainID
- FROM exjobapply a,job b
- WHERE a.jobid = b.id
- AND a.cvMainID = @CvMainID
- AND b.id =@JobID
- ORDER BY a.reply asc ,a.adddate asc
- END TRY
- BEGIN CATCH
- RETURN 0
- END CATCH
- GO
- /****** Object: StoredProcedure [dbo].[pcExJobApplyByPaMainIDDelete] Script Date: 2018/12/13 19:08:30 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- --====================================
- --返回值:-1:个人彻底删除职申请位
- --创建: Nick 20151110
- --====================================
- CREATE PROCEDURE [dbo].[pcExJobApplyByPaMainIDDelete]
- (
- @AllID VARCHAR(1000),
- @paMainID INT
- )
- AS
- SET NOCOUNT ON
- BEGIN TRAN
- IF LEN(ISNULL(@AllID, '')) < 2
- GOTO Err2
- --生成临时表
- DECLARE @t AS TABLE(
- ID INT
- )
- DECLARE @i INT
- SET @i=CHARINDEX(',',@AllID)
- WHILE @i>=1
- BEGIN
- IF LEFT(@AllID,@i-1) > ''
- INSERT @t VALUES(LEFT(@AllID,@i-1))
- SET @AllID=SUBSTRING(@AllID,@i+1,LEN(@AllID)-@i)
- SET @i=CHARINDEX(',',@AllID)
- END
- IF @AllID > ''
- INSERT @t VALUES(@AllID)
- ----判断是否这些id是同一个paMainID
- IF EXISTS(SELECT 'X' FROM ExJobApply a WITH(NOLOCK),@t b,cvMain c WITH(NOLOCK)
- WHERE a.id=b.id AND a.cvMainID=c.ID AND c.paMainID<>@paMainID)
- GOTO Err1
- DELETE FROM ExJobApply WHERE CompanyDeleted=1 AND ID IN(SELECT ID FROM @t)
- UPDATE ExJobApply SET IsDeleted = 1 WHERE ID IN(SELECT ID FROM @t) AND PersonDeleted=1
- COMMIT TRAN
- --PRINT -1
- RETURN 1
- ERR:
- BEGIN
- --PRINT 0
- ROLLBACK TRAN
- RETURN 0
- END
- ERR1:
- BEGIN
- --PRINT -1
- ROLLBACK TRAN
- RETURN -1
- END
- ERR2:
- BEGIN
- --PRINT 2
- ROLLBACK TRAN
- RETURN -2
- END
- GO
- /****** Object: StoredProcedure [dbo].[pcExJobApplyByPaMainIDUpdate] Script Date: 2018/12/13 19:08:30 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- --创建:Nick
- --创建日期:2015-11-09
- --个人中心,提醒企业
- --harry 2018-06-13 增加推送
- --修改:Alen 2018-10-19 添加paPushLog取第一条数据
- --------------------------------------------------
- CREATE PROCEDURE [dbo].[pcExJobApplyByPaMainIDUpdate]
- (
- @ID VARCHAR(200),
- @PaMainID INT
- )
- AS
- BEGIN
- SET NOCOUNT ON
- UPDATE ExJobApply
- SET RemindDate = GETDATE()
- WHERE CvMainID IN (SELECT ID FROM CVMAIN WITH(NOLOCK) WHERE PaMainID = @PaMainID)
- AND ID IN (SELECT * FROM dbo.fnSplit(@ID,','))
-
- SELECT DISTINCT b.caMainid INTO #t
- FROM exjobapply a WITH(NOLOCK), job b WITH(NOLOCK)
- WHERE a.ID IN (SELECT * FROM dbo.fnSplit(@ID,','))
- AND a.jobId=b.id
-
- DECLARE @name VARCHAR(20)
- SELECT @name=name FROM paMain WHERE id= @PaMainID
- INSERT INTO paPushLog(paMainID, PushMessage, PushType)
- SELECT TOP 1 a.caMainid, @name+'求答复❤',10
- FROM caIOSBind a WITH(NOLOCK), #t b WITH(NOLOCK)
- WHERE a.caMainId= b.caMainId
-
- DROP TABLE #t
- SET NOCOUNT OFF
- END
- GO
- /****** Object: StoredProcedure [dbo].[pcExJobApplyByTempDelete] Script Date: 2018/12/13 19:08:30 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- CREATE PROCEDURE [dbo].[pcExJobApplyByTempDelete]
- (
- @JobIDs VARCHAR(1000),
- @paMainID INT
- )
- AS
- BEGIN
- SET @JobIDs = dbo.FormatIDS(@JobIDs)
- DECLARE @Sql AS VARCHAR(1000)
- SET @Sql = 'DELETE FROM exJobApply WHERE JobId IN(' + @JobIDS + ')
- AND cvMainID IN(SELECT ID FROM cvMain WITH(NOLOCK) WHERE paMainId = ' + LTRIM(STR(@PaMainID)) + ')
- AND ISTempInsert = 1'
- EXEC(@SQL)
- END
- GO
- /****** Object: StoredProcedure [dbo].[pcExJobApplyByTempInsert] Script Date: 2018/12/13 19:08:30 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- --修改harry 增加企业app提醒2018-6-11
- CREATE PROCEDURE [dbo].[pcExJobApplyByTempInsert]
- (
- @JobID INT,
- @cvMainID INT,
- @ApplyMessage VARCHAR(4000),
- @paMainID INT,
- @IsFilter bit
- )
- AS
- SET NOCOUNT ON
- IF CHARINDEX('<', @ApplyMessage) > 0
- SET @ApplyMessage = REPLACE(@ApplyMessage, '<', '')
- BEGIN
- SET @ApplyMessage = dbo.SafeSql(@ApplyMessage)
- DECLARE @MaxID AS INT
- SET @IsFilter = dbo.IsJobApplyFilter(@JobID, @cvMainID)
- BEGIN TRY
- IF EXISTS(SELECT ID FROM cvMain WITH(NOLOCK) WHERE paMainID = @paMainID AND ID = @cvMainID)
- IF EXISTS(SELECT ID FROM ExJobApply WITH(NOLOCK) WHERE JobID = @JobID AND cvMainID = @cvMainID AND AddDate > GETDATE()-30)
- SET @MaxID = 0
- ELSE
- BEGIN
- IF EXISTS(SELECT ID FROM JOB WITH(NOLOCK) WHERE ID=@JobID AND Valid = 0)
- SET @MaxID = 0
- ELSE
- BEGIN
- INSERT INTO ExJobApply(JobID,cvMainID,ApplyMessage,IsTempInsert,IsFilter) VALUES(@JobID,@cvMainID,@ApplyMessage, 1,@IsFilter)
- SET @MaxID=@@IDENTITY
-
- INSERT INTO paPushLog(paMainID, PushMessage, PushType)
- SELECT a.caMainId, b.Name+'应聘:'+a.Name+','+CASE b.Gender WHEN 0 THEN '男' WHEN 1 THEN '女' END+'|'
- + CONVERT(VARCHAR(5), dbo.BirthToAge(b.BirthDay)) + '岁|'
- +LTRIM(STR(ISNULL(RelatedWorkYears, 0))) + '年工作经验|'+f.Description, 9
- FROM exJobApply c LEFT JOIN job a ON a.id= c.jobId
- LEFT JOIN cvMain d ON c.cvMainID= d.id
- LEFT JOIN paMain b ON d.paMainId= b.id
- LEFT JOIN dceducation e ON e.id= d.degree
- LEFT JOIN dcRegion f ON f.id=b.AccountPlace
- WHERE c.Id= @MaxID
- AND EXISTS(SELECT 'X' FROM caIOSBind WHERE caMainID IN(SELECT caMainId FROM Job WITH(NOLOCK) WHERE ID = @JobId))
- IF NOT EXISTS(SELECT 'x' FROM paJobViewLog WITH(NOLOCK) WHERE paMainId = @PaMainId AND JobId = @JobId)
- BEGIN
- INSERT INTO paJobViewLog(JobId, paMainId, AddDate) VALUES(@JobId, @paMainId, GETDATE())
- UPDATE Job SET ViewNumber = ViewNumber + 1 WHERE ID = @JobId
- END
- IF EXISTS(SELECT 'x' FROM caCvIntention WITH(NOLOCK) WHERE cvMainID = @cvMainId AND JobId = @JobId)
- UPDATE caCvIntention SET Reply = 1, ReplyDate = GETDATE() WHERE cvMainID = @cvMainId AND JobId = @JobId
- END
- INSERT wxMessageSend2(Templatetype, WxFansID, PaMainId, CvMainId, CpMainID, CaMainId, JobId, AddDate)
- SELECT 14, b.ID, @paMainID, @cvMainID, c.cpMainID, c.caMainID, c.ID, GETDATE()
- FROM paLoginContact a WITH(NOLOCK), wxFans b WITH(NOLOCK), Job c WITH(NOLOCK)
- WHERE a.OpenID = b.OpenID AND c.caMainID = a.paMainID AND a.ContactType = 101 AND c.ID = @JobID
- END
- END TRY
- BEGIN cATCH
- GOTO ERR
- END CATCH
- RETURN @MaxID
- END
- ERR:
- BEGIN
- RETURN 0
- END
- GO
- /****** Object: StoredProcedure [dbo].[pcExJobApplyByTempInsertNew] Script Date: 2018/12/13 19:08:31 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- CREATE PROCEDURE [dbo].[pcExJobApplyByTempInsertNew]
- (
- @JobID INT,
- @cvMainID INT,
- @ApplyMessage VARCHAR(4000),
- @paMainID INT,
- @IsFilter bit
- )
- AS
- BEGIN
- SET @ApplyMessage = dbo.SafeSql(@ApplyMessage)
- DECLARE @MaxID AS INT
- SET @IsFilter = dbo.IsJobApplyFilter(@JobID, @cvMainID)
- BEGIN TRY
- IF EXISTS(SELECT ID FROM cvMain WITH(NOLOCK) WHERE paMainID = @paMainID AND ID = @cvMainID)
- IF EXISTS(SELECT ID FROM ExJobApply WITH(NOLOCK) WHERE JobID=@JobID AND cvMainID=@cvMainID AND AddDate>GETDATE()-30)
- SET @MaxID = 0
- ELSE
- IF EXISTS(SELECT ID FROM JOB WITH(NOLOCK) WHERE ID=@JobID AND Valid = 0)
- SET @MaxID = 0
- ELSE
- BEGIN
- INSERT INTO ExJobApply(JobID,cvMainID,ApplyMessage,IsTempInsert,IsFilter) VALUES(@JobID,@cvMainID,@ApplyMessage, 1,@IsFilter)
- SET @MaxID=@@IDENTITY
- IF NOT EXISTS(SELECT 'x' FROM paJobViewLog WITH(NOLOCK) WHERE paMainId = @PaMainId AND JobId = @JobId)
- BEGIN
- INSERT INTO paJobViewLog(JobId, paMainId, AddDate) VALUES(@JobId, @paMainId, GETDATE())
- UPDATE Job SET ViewNumber = ViewNumber + 1 WHERE ID = @JobId
- END
- END
- END TRY
- BEGIN cATCH
- GOTO ERR
- END CATCH
- RETURN @MaxID
- END
- ERR:
- BEGIN
- RETURN 0
- END
- GO
- /****** Object: StoredProcedure [dbo].[pcExJobApplyInsert] Script Date: 2018/12/13 19:08:31 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- --修改harry 增加企业app提醒2018-6-11
- CREATE PROCEDURE [dbo].[pcExJobApplyInsert]
- (
- @JobID INT,
- @cvMainID INT,
- @ApplyMessage VARCHAR(4000),
- @paMainID INT,
- @IsFilter BIT
- )
- AS
- SET NOCOUNT ON
- --IF CHARINDEX('<', @ApplyMessage) > 0
- -- SET @ApplyMessage = REPLACE(@ApplyMessage, '<', '')
- SET @ApplyMessage = ''
- BEGIN
- SET @ApplyMessage = dbo.SafeSql(@ApplyMessage)
- SET @IsFilter = dbo.IsJobApplyFilter(@JobID, @cvMainID)
- DECLARE @MaxID AS INT
- BEGIN TRY
- IF EXISTS(SELECT ID FROM cvMain WITH(NOLOCK) WHERE paMainID = @paMainID AND ID = @cvMainID) --是否是有效简历
- IF EXISTS(SELECT ID FROM ExJobApply WITH(NOLOCK) WHERE JobID=@JobID AND cvMainID = @cvMainID AND AddDate > GETDATE()-30) --是否在30天申请过
- SET @MaxID = 0
- ELSE
- BEGIN
- IF EXISTS(SELECT ID FROM JOB WITH(NOLOCK) WHERE ID = @JobID AND Valid = 0) --是否是有效职位
- SET @MaxID = 0
- ELSE
- BEGIN
- INSERT INTO ExJobApply(JobID,cvMainID,ApplyMessage,IsFilter) VALUES(@JobID,@cvMainID,@ApplyMessage,@IsFilter)
- SET @MaxID = @@IDENTITY
- UPDATE Job SET ApplyNumber = ApplyNumber + 1 WHERE ID = @JobID
-
- INSERT INTO paPushLog(paMainID, PushMessage, PushType)
- SELECT a.caMainId, b.Name+'应聘:'+a.Name+','+CASE b.Gender WHEN 0 THEN '男' WHEN 1 THEN '女' END+'|'
- + CONVERT(VARCHAR(5), dbo.BirthToAge(b.BirthDay)) + '岁|'
- +LTRIM(STR(ISNULL(RelatedWorkYears, 0))) + '年工作经验|'+f.Description, 9
- FROM exJobApply c LEFT JOIN job a ON c.jobId =a.id
- LEFT JOIN cvMain d ON c.cvMainID= d.id
- LEFT JOIN paMain b ON d.paMainId= b.id
- LEFT JOIN dceducation e ON e.id= d.degree
- LEFT JOIN dcRegion f ON f.id=b.AccountPlace
- WHERE c.Id= @MaxID
- AND EXISTS(SELECT 'X' FROM caIOSBind WHERE caMainID IN(SELECT caMainId FROM Job WITH(NOLOCK) WHERE ID = @JobId))
- IF EXISTS(SELECT 'x' FROM caCvIntention WITH(NOLOCK) WHERE cvMainID = @cvMainId AND JobId = @JobId)
- UPDATE caCvIntention SET Reply = 1, ReplyDate = GETDATE() WHERE cvMainID = @cvMainId AND JobId = @JobId
-
- INSERT INTO wxMessageSend2(Templatetype, WxFansID, PaMainId, CvMainId, CpMainID, CaMainId, JobId, AddDate)
- SELECT 14, b.ID, @paMainID, @cvMainID, c.cpMainID, c.caMainID, c.ID, GETDATE()
- FROM paLoginContact a WITH(NOLOCK), wxFans b WITH(NOLOCK), Job c WITH(NOLOCK)
- WHERE a.OpenID = b.OpenID AND c.caMainID = a.paMainID AND a.ContactType = 101 AND c.ID = @JobID
- END
- END
- END TRY
- BEGIN CATCH
- GOTO ERR
- END CATCH
- RETURN @MaxID
- END
- ERR:
- BEGIN
- RETURN 0
- END
- GO
- /****** Object: StoredProcedure [dbo].[pcExJobApplyInsertNew] Script Date: 2018/12/13 19:08:31 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- CREATE PROCEDURE [dbo].[pcExJobApplyInsertNew]
- (
- @JobID INT,
- @cvMainID INT,
- @ApplyMessage VARCHAR(4000),
- @paMainID INT,
- @IsFilter BIT
- )
- AS
- SET NOCOUNT ON
- IF CHARINDEX('<', @ApplyMessage) > 0
- SET @ApplyMessage = REPLACE(@ApplyMessage, '<', '')
- BEGIN
- SET @ApplyMessage = dbo.SafeSql(@ApplyMessage)
- SET @IsFilter = dbo.IsJobApplyFilter(@JobID, @cvMainID)
- DECLARE @MaxID AS INT
- BEGIN TRY
- IF EXISTS(SELECT ID FROM cvMain WITH(NOLOCK) WHERE paMainID = @paMainID AND ID = @cvMainID) --是否是有效简历
- IF EXISTS(SELECT ID FROM ExJobApply WITH(NOLOCK) WHERE JobID=@JobID AND cvMainID = @cvMainID AND AddDate > GETDATE()-30) --是否在30天申请过
- SET @MaxID = 0
- ELSE
- IF EXISTS(SELECT ID FROM JOB WITH(NOLOCK) WHERE ID = @JobID AND Valid = 0) --是否是有效职位
- SET @MaxID = 0
- ELSE
- BEGIN
- INSERT INTO ExJobApply(JobID,cvMainID,ApplyMessage,IsFilter) VALUES(@JobID,@cvMainID,@ApplyMessage,@IsFilter)
- SET @MaxID = @@IDENTITY
- UPDATE Job SET ApplyNumber = ApplyNumber + 1 WHERE ID = @JobID
- END
- END TRY
- BEGIN cATCH
- GOTO ERR
- END CATCH
- RETURN @MaxID
- END
- ERR:
- BEGIN
- RETURN 0
- END
- GO
- /****** Object: StoredProcedure [dbo].[pcExJobApplyInsertOld] Script Date: 2018/12/13 19:08:31 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- CREATE PROCEDURE [dbo].[pcExJobApplyInsertOld]
- (
- @JobID INT,
- @cvMainID INT,
- @ApplyMessage VARCHAR(4000),
- @paMainID INT
- )
- AS
- BEGIN
- DECLARE @MaxID AS INT, @IsFilter AS BIT
- SET @IsFilter = dbo.IsJobApplyFilter(@JobID, @cvMainID)
- BEGIN TRY
- IF EXISTS(SELECT ID FROM cvMain WITH(NOLOCK) WHERE paMainID = @paMainID AND ID = @cvMainID) --是否是有效简历
- IF EXISTS(SELECT ID FROM ExJobApply WITH(NOLOCK) WHERE JobID=@JobID AND cvMainID = @cvMainID AND AddDate > GETDATE()-30) --是否在30天申请过
- SET @MaxID = 0
- ELSE
- IF EXISTS(SELECT ID FROM JOB WITH(NOLOCK) WHERE ID = @JobID AND Valid = 0) --是否是有效职位
- SET @MaxID = 0
- ELSE
- BEGIN
- INSERT INTO ExJobApply(JobID,cvMainID,ApplyMessage,IsFilter) VALUES(@JobID,@cvMainID,@ApplyMessage, @IsFilter)
- SET @MaxID = @@IDENTITY
- UPDATE Job SET ApplyNumber = ApplyNumber + 1 WHERE ID = @JobID
- END
- END TRY
- BEGIN cATCH
- GOTO ERR
- END CATCH
- RETURN @MaxID
- END
- ERR:
- BEGIN
- RETURN 0
- END
- GO
- /****** Object: StoredProcedure [dbo].[pcExJobApplySelect] Script Date: 2018/12/13 19:08:31 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- CREATE PROCEDURE [dbo].[pcExJobApplySelect]
- (
- @WHERE VARCHAR(1000),
- @Order VARCHAR(100)
- )
- AS
- SET NOCOUNT ON
- BEGIN
- SET @WHERE = REPLACE(dbo.SafeSQL(@WHERE), '''', '')
- SET @ORDER = REPLACE(dbo.SafeSQL(@ORDER), '''', '')
- SET @Where = REPLACE(@Where, 'LIKE %', 'LIKE ''%')
- SET @Where = REPLACE(@Where, '% OR ', '%'' OR ')
- SET @Where = REPLACE(@Where, '%)', '%'')')
- DECLARE @SQL AS VARCHAR(2000)
- SET @SQL='SELECT a.ID, a.JobID, b.SecondId EnJobID, c.SecondId EnCpMainID, a.cvMainID, a.ApplyMessage, a.AddDate, a.CompanyDeleted, a.CompanyDeleteDate,
- a.PersonDeleted, a.Reply, a.ReplyDate, a.ViewDate, b.Name as JobName, b.caMainID, b.dcRegionID, c.Name as cpName, c.ID as cpID,
- b.Welfare1,b.Welfare2,b.Welfare3,b.Welfare4,b.Welfare5,b.Welfare6,b.Welfare7,b.Welfare8,
- b.Welfare9,b.Welfare10,b.Welfare11,b.Welfare12,b.Welfare13,b.Welfare14,b.Welfare15,b.Welfare16,
- b.Welfare17,b.Welfare18,b.Welfare19,b.Valid JobValid, c.LogoFile LogoUrl,
- c.HasLicence, c.IsAgent, c.MemberType, b.IssueDate, b.IssueEND, b.IsDelete, d.Name cvName, dbo.GetCvMatch(a.cvMainID,a.JobID) cvMatch, dbo.GetCaOnlineStatus(b.caMainID) AS IsOnline,a.RemindDate,a.ReplyReason, c.ReplyRate
- FROM exJobApply a WITH(NOLOCK)
- inner join Job b WITH(NOLOCK) On b.ID=a.JobID
- Inner Join cpMain c WITH(NOLOCK) ON b.cpMainID=c.ID
- INNER JOIN cvMain d WITH(NOLOCK) ON a.cvMainID = d.ID
- WHERE PersonDeleted=0 AND IsDeleted = 0'
- IF LEN(@WHERE) > 0
- SET @SQL = @SQL + ' AND ' + @WHERE
- IF LEN(@ORDER) > 0
- SET @SQL = @SQL + ' ORDER BY ' + @ORDER
- EXEC(@SQL)
- END
- GO
- /****** Object: StoredProcedure [dbo].[pcExMessageByCaMainIdDelete] Script Date: 2018/12/13 19:08:31 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- --===============================
- --返回值: 0:未知错误
- --返回值: 1:正常删除
- --用于个人删除留言,2013-08个人会员中心改版,删除留言就删除整个会话
- --如果企业已经删除了该留言,个人删除时就真删除,否则只增加个人删除标签
- --创建: Peter
- --===============================
- CREATE PROCEDURE [dbo].[pcExMessageByCaMainIdDelete]
- (
- @caMainID INT,
- @paMainID INT
- )
- AS
- BEGIN TRY
- DELETE FROM ExMessageC2P
- WHERE CompanyDeleted = 1
- AND caMainID = @caMainID
- AND cvMainID IN (SELECT ID FROM CvMain WITH(NOLOCK) WHERE paMainID = @paMainID)
-
- UPDATE ExMessageC2P
- SET PersonDeleted=1
- WHERE CompanyDeleted = 0
- AND caMainID = @caMainID
- AND cvMainID IN (SELECT ID FROM CvMain WITH(NOLOCK) WHERE paMainID = @paMainID)
- DELETE FROM ExMessageP2C
- WHERE CompanyDeleted = 1
- AND caMainID = @caMainID
- AND cvMainID IN (SELECT ID FROM CvMain WITH(NOLOCK) WHERE paMainID = @paMainID)
-
- UPDATE ExMessageP2C
- SET PersonDeleted=1
- WHERE CompanyDeleted = 0
- AND caMainID = @caMainID
- AND cvMainID IN (SELECT ID FROM CvMain WITH(NOLOCK) WHERE paMainID = @paMainID)
- END TRY
- BEGIN CATCH
- GOTO ERR
- END CATCH
- RETURN 1
- ERR:
- BEGIN
- RETURN 0
- END
- GO
- /****** Object: StoredProcedure [dbo].[pcExMessageC2PDelete] Script Date: 2018/12/13 19:08:31 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- --===============================
- --返回值: 0:未知错误
- -- -1:该留言不存在
- -- -2:您没有权限查看该留言
- --如果企业已经删除了该留言,个人删除时就真删除,否则只增加删除标签
- --收到的留言删除
- --创建: lucifer
- --检查: sean,2010-10-13
- --===============================
- CREATE PROCEDURE [dbo].[pcExMessageC2PDelete]
- (
- @ID INT,
- @paMainID INT
- )
- AS
- BEGIN TRY
- DECLARE @CompanyDeleted AS BIT
- DECLARE @cvMainID AS INT
- DECLARE @paID AS INT
- SELECT @CompanyDeleted=CompanyDeleted,@cvMainID=cvMainID FROM ExMessageC2P WITH(NOLOCK) WHERE ID=@ID
- IF @cvMainID IS NULL
- GOTO Err1
- ELSE
- SELECT @paID=paMainID FROM cvMain WITH(NOLOCK) WHERE ID = @cvMainID
-
- IF @paMainID = @paID
- IF @CompanyDeleted=1
- DELETE FROM ExMessageC2P WHERE CompanyDeleted=1 AND ID = @ID
- ELSE
- UPDATE ExMessageC2P SET PersonDeleted=1 WHERE ID = @ID
- ELSE
- GOTO Err2
- END TRY
- BEGIN CATCH
- GOTO ERR
- END CATCH
- RETURN 1
- ERR:
- BEGIN
- RETURN 0
- END
- ERR1:
- BEGIN
- RETURN -1
- END
- ERR2:
- BEGIN
- RETURN -2
- END
- GO
- /****** Object: StoredProcedure [dbo].[pcexMessageC2PIsViewedUpdate] Script Date: 2018/12/13 19:08:32 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- --==========================
- --创建:lucifer
- --检查:sean,2010-10-14
- --记录个人查看单位留言时间
- --==========================
- CREATE PROCEDURE [dbo].[pcexMessageC2PIsViewedUpdate]
- (
- @ID INT,
- @paMainID INT
- )
- AS
- BEGIN TRY
- IF NOT EXISTS(SELECT 'x' FROM exMessageC2P a WITH(NOLOCK), cvMain b WITH(NOLOCK) WHERE a.ID=@ID AND b.paMainID=@paMainID AND a.cvMainID = b.ID)
- GOTO ERR
-
- UPDATE exMessageC2P SET IsViewed=1 WHERE ID=@ID
- END TRY
- BEGIN CATCH
- GOTO ERR
- END CATCH
- RETURN 1
- ERR:
- BEGIN
- RETURN 0
- END
- GO
- /****** Object: StoredProcedure [dbo].[pcExMessageC2PSelect] Script Date: 2018/12/13 19:08:32 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- --=======================================
- --创建: lucifer
- --检查: Sean,2010-10-13
- --=======================================
- CREATE PROCEDURE [dbo].[pcExMessageC2PSelect]
- (
- @WHERE VARCHAR(1000),
- @Order VARCHAR(100)
- )
- AS
- BEGIN
- BEGIN TRY
- SET @WHERE = REPLACE(dbo.SafeSQL(@WHERE), '''', '')
- SET @ORDER = REPLACE(dbo.SafeSQL(@ORDER), '''', '')
- DECLARE @SQL AS VARCHAR(2000)
- SET @SQL='SELECT a.ID,a.caMainID,a.cvMainID,a.Message,a.AddDate,a.IsViewed,a.IsReply,a.CompanyDeleted,a.PersonDeleted,
- b.Name as caName,b.Title,b.Email,b.Mobile,b.Telephone,b.Dept,b.GENDer,b.IsPhoneHide,b.IsNameHide,b.IsMobileHide,c.Name as cpName,c.ID as cpID,c.HasLicence,c.IsAgent,d.Name cvName, c.Membertype'
- SET @SQL=@SQl+' FROM exMessageC2P a WITH(NOLOCK) inner join caMain b WITH(NOLOCK) On
- b.ID=a.caMainID Inner Join cpMain c WITH(NOLOCK) ON b.cpMainID=c.ID Inner Join cvMain d WITH(NOLOCK) ON a.cvMainID=d.ID'
- SET @SQL=@SQl+' WHERE PersonDeleted=0'
- IF LEN(@WHERE)>0
- SET @SQL=@SQL + ' AND ' + @WHERE
- IF LEN(@ORDER)>0
- SET @SQL=@SQL + ' ORDER BY ' + @ORDER
- EXEC(@SQL)
- END TRY
- BEGIN CATCH
- END CATCH
- END
- GO
- /****** Object: StoredProcedure [dbo].[pcexMessageP2CByC2PInsert] Script Date: 2018/12/13 19:08:32 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- CREATE PROCEDURE [dbo].[pcexMessageP2CByC2PInsert]
- (
- @ID INT,
- @caMainID INT,
- @cvMainID INT,
- @Message VARCHAR(200),
- @paMainID INT
- )
- AS
- BEGIN
- IF EXISTS(SELECT ID FROM cvMain WITH(NOLOCK) WHERE paMainID = @paMainID AND ID=@cvMainID)
- BEGIN
- SET @Message = dbo.SafeSQL(LTRIM(RTRIM(@Message)))
- INSERT exMessageP2C(caMainID,cvMainID,Message) VALUES(@caMainID,@cvMainID,@Message)
- IF @ID > 0
- Update exMessageC2P Set IsReply=1 WHERE ID=@ID
- END
- END
- GO
- /****** Object: StoredProcedure [dbo].[pcExMessageP2CDelete] Script Date: 2018/12/13 19:08:32 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- --===============================
- --返回值: 0:未知错误
- -- -1:该留言不存在
- -- -2:您没有权限查看该留言,该留言不是你写的
- -- 如果企业已经删除了该留言,个人删除时就真删除,否则只增加删除标签
- --创建: Lucifer
- --检查: Sean,2010-10-13
- --===============================
- CREATE PROCEDURE [dbo].[pcExMessageP2CDelete]
- (
- @ID INT,
- @paMainID INT
- )
- AS
- BEGIN TRY
- DECLARE @CompanyDeleted AS BIT
- DECLARE @cvMainID AS INT
- DECLARE @paID AS INT
- SELECT @CompanyDeleted=CompanyDeleted,@cvMainID=cvMainID FROM ExMessageP2C WITH(NOLOCK) WHERE ID=@ID
- IF @cvMainID IS NULL
- GOTO Err1
-
- SELECT @paID=paMainID FROM cvMain WITH(NOLOCK) WHERE ID = @cvMainID
-
- IF @paMainID = @paID
- IF @CompanyDeleted=1
- DELETE FROM ExMessageP2C WHERE CompanyDeleted=1 AND ID = @ID
- ELSE
- UPDATE ExMessageP2C SET PersonDeleted=1 WHERE ID = @ID
- ELSE
- GOTO Err2
- END TRY
- BEGIN CATCH
- GOTO ERR
- END CATCH
- RETURN 1
- ERR:
- BEGIN
- RETURN 0
- END
- ERR1:
- BEGIN
- RETURN -1
- END
- ERR2:
- BEGIN
- RETURN -2
- END
- GO
- /****** Object: StoredProcedure [dbo].[pcexMessageP2CInsert] Script Date: 2018/12/13 19:08:33 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- CREATE PROCEDURE [dbo].[pcexMessageP2CInsert]
- (
- @caMainID INT,
- @cvMainID INT,
- @Message VARCHAR(200),
- @paMainID INT
- )
- AS
- BEGIN
- IF EXISTS(SELECT ID FROM cvMain WITH(NOLOCK) WHERE paMainID = @paMainID AND ID=@cvMainID)
- BEGIN
- SET @Message = dbo.SafeSql(LTRIM(RTRIM(@Message)))
- INSERT exMessageP2C(caMainID,cvMainID,Message) VALUES(@caMainID,@cvMainID,@Message)
- END
- END
- GO
- /****** Object: StoredProcedure [dbo].[pcExMessageP2CSelect] Script Date: 2018/12/13 19:08:33 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- --=================================
- --创建: lucifer
- --检查: sean,2010-10-13
- --描述: 发出的留言列表
- --=================================
- CREATE PROCEDURE [dbo].[pcExMessageP2CSelect]
- (
- @WHERE VARCHAR(1000),
- @Order VARCHAR(100)
- )
- AS
- BEGIN
- SET @WHERE = REPLACE(dbo.SafeSQL(@WHERE), '''', '')
- SET @ORDER = REPLACE(dbo.SafeSQL(@ORDER), '''', '')
- BEGIN TRY
- DECLARE @SQL AS VARCHAR(2000)
- SET @SQL='SELECT a.ID,a.caMainID,a.cvMainID,a.Message,a.AddDate,a.IsViewed,a.IsReply,a.CompanyDeleted,a.PersonDeleted,
- b.Name as caName,b.Title,b.Dept,b.GENDer,b.IsNameHide,c.Name as cpName,c.ID as cpID,c.HasLicence,c.IsAgent,d.Name as cvName, c.MemberType'
- SET @SQL=@SQl+' FROM exMessageP2C a WITH(NOLOCK) inner join caMain b WITH(NOLOCK) On
- b.ID=a.caMainID Inner Join cpMain c WITH(NOLOCK) ON b.cpMainID=c.ID Inner Join cvMain d WITH(NOLOCK) ON a.cvMainID=d.ID'
- SET @SQL=@SQl+' WHERE PersonDeleted=0'
- IF LEN(@WHERE)>0
- SET @SQL=@SQL + ' AND '+@WHERE
- IF LEN(@ORDER)>0
- SET @SQL=@SQL + ' ORDER BY '+@ORDER
- EXEC(@SQL)
- END TRY
- BEGIN CATCH
- END CATCH
- END
- GO
- /****** Object: StoredProcedure [dbo].[pcFaqSelect] Script Date: 2018/12/13 19:08:34 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- CREATE PROCEDURE [dbo].[pcFaqSelect]
- AS
- BEGIN
- SELECT ID, Question
- FROM Faq WITH(NOLOCK)
- WHERE Type=2
- ORDER BY Power
- END
- GO
- /****** Object: StoredProcedure [dbo].[pcGetCvMainByCvIDsSelect] Script Date: 2018/12/13 19:08:34 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- --#####################################################
- --创建时间:2014.10.31
- --创建人:Nick
- --说明:根据 Id1,Id2获取简历信息
- --#####################################################
- CREATE PROCEDURE [dbo].[pcGetCvMainByCvIDsSelect]
- (
- @CvIds VARCHAR(200)
- )
- AS
- BEGIN
- SELECT a.Id, a.Name AS cvName, b.Name AS paName, a.paMainId, a.SecondId
- FROM cvMain a, paMain b
- WHERE a.paMainId = b.Id
- AND a.Id IN(SELECT * FROM dbo.fnSplit(@CvIds, ','))
- END
- GO
- /****** Object: StoredProcedure [dbo].[pcGovNewsListByPhone] Script Date: 2018/12/13 19:08:34 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- CREATE PROCEDURE [dbo].[pcGovNewsListByPhone]
- (
- @dcProvinceID AS SMALLINT,
- @PageNum AS INT,
- @PageSize AS INT
- )
- AS
- BEGIN
- DECLARE @COUNT INT
- SELECT @COUNT=COUNT(1)
- FROM QlrcNews WITH(NOLOCK) WHERE (
- EXISTS(SELECT 'x' FROM fnSplit(DetailType,',') b,dcNewsType c WITH(NOLOCK) WHERE b.a=c.ID AND c.Category=1) OR DetailType IS NULL)
- AND (VersionID=@dcProvinceID OR VersionID=0) AND NewsType = 2 AND DetailType like '%,2,%'
- IF @COUNT > 200
- SET @COUNT = 200
- SELECT *,@COUNT FROM(
- SELECT TOP 200 ROW_NUMBER() OVER(ORDER BY RefreshDate DESC) AS Rows,ID,Title,RefreshDate,Author
- FROM QlrcNews WITH(NOLOCK) WHERE (
- EXISTS(SELECT 'x' FROM fnSplit(DetailType,',') b,dcNewsType c WITH(NOLOCK) WHERE b.a=c.ID AND c.Category=1) OR DetailType IS NULL)
- AND (VersionID=@dcProvinceID OR VersionID=0) AND NewsType = 2 AND DetailType like '%,2,%'
- ) AS a
- WHERE a.Rows BETWEEN (@PageNum-1)*@PageSize+1 AND @PageNum*@PageSize ORDER BY Rows
- END
- GO
- /****** Object: StoredProcedure [dbo].[pcHasCvByCvMainIDPaMainIDSelect] Script Date: 2018/12/13 19:08:34 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- --#####################################################
- --创建时间:2014.10.30
- --创建人:John
- --说明:检查简历是否属于当前用户
- --#####################################################
- CREATE PROCEDURE [dbo].[pcHasCvByCvMainIDPaMainIDSelect]
- (
- @cvMainID INT,
- @paMainID INT
- )
- AS
- BEGIN
- SELECT TOP 1 * FROM cvMain WITH(NOLOCK) WHERE id=@cvMainID AND paMainID=@paMainID
- END
- GO
- /****** Object: StoredProcedure [dbo].[pcHasExJobApplyByCvMainIDSelect] Script Date: 2018/12/13 19:08:34 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- --#####################################################
- --创建时间:2014.10.31
- --创建人:John
- --说明:判断简历是否申请过职位
- --#####################################################
- CREATE PROCEDURE [dbo].[pcHasExJobApplyByCvMainIDSelect]
- (
- @cvMainID INT,
- @jobID INT
- )
- AS
- BEGIN
- IF EXISTS (
- SELECT TOP 1 'x'
- FROM exjobapply WITH(NOLOCK)
- WHERE cvMainID = @cvMainID AND AddDate > GETDATE()-30 AND jobID = @jobID
- )
- BEGIN
- RETURN 1
- END
- ELSE
- BEGIN
- RETURN 0
- END
- END
- GO
- /****** Object: StoredProcedure [dbo].[pcIndexPageSelect] Script Date: 2018/12/13 19:08:34 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- --修改Harry 调查增加exLink 2017-8-3
- CREATE PROCEDURE [dbo].[pcIndexPageSelect]
- (
- @paMainID INT,
- @ProvinceID INT
- )
- AS
- SET NOCOUNT ON
- BEGIN
- DECLARE @t AS TABLE(
- ID INT,
- type INT,
- iCount INT NULL,
- Title NVARCHAR(100) NULL,
- Link NVARCHAR(200) NULL,
- ContentText NVARCHAR(MAX) NULL,
- AddDate SMALLDATETIME NULL
- )
- --取未答复的面试通知
- INSERT INTO @T(ID,type,iCount)
- SELECT @paMainID,1,Count(a.ID) FROM exInterView a WITH(NOLOCK)
- INNER JOIN cvMain d WITH(NOLOCK) ON a.cvMainID=d.ID
- WHERE PersonDeleted=0 AND paMainID=@paMainID AND Reply=0
- --取未查看的留言
- INSERT INTO @T(ID,type,iCount)
- SELECT @paMainID,2,Count(a.ID) FROM exMessageC2P a WITH(NOLOCK)
- INNER JOIN cvMain d WITH(NOLOCK) ON a.cvMainID=d.ID
- WHERE PersonDeleted=0 AND paMainID=@paMainID AND IsViewed=0
- --取未答复的应聘邀请
- INSERT INTO @T(ID,type,iCount)
- SELECT @paMainID,8,Count(a.ID) FROM caCvIntention a WITH(NOLOCK)
- INNER JOIN cvMain d WITH(NOLOCK) ON a.cvMainID=d.ID
- WHERE PersonDeleted=0 AND paMainID=@paMainID AND Reply IS NULL
- --取未查看的反馈
- INSERT INTO @T(ID,type, ContentText,AddDate)
- SELECT Top 1 ID,3, LEFT(ReplyMessage, 300), ReplyDate
- FROM paFeedBack WITH(NOLOCK INDEX(IX_paFeedBack_paMainID))
- WHERE paMainID = @paMainID AND IsReply = 1 AND ViewDate IS NULL
- ORDER BY ID DESC
- --取未查看的网站消息
- INSERT INTO @T(ID,type,ContentText,AddDate)
- SELECT TOP 2 ID,4,LEFT(Message, 300), AddDate
- FROM PaNotify WITH(NOLOCK)
- WHERE paMainID = @paMainID
- AND (
- (NotifyType = 1 AND IsViewed = 0) --一次性消息,看过就不再通知了
- OR (NotifyType=2 AND ENDDate > GETDATE()) --即时消息,到期前(ENDdate)一直通知
- )
- ORDER BY ID DESC
- --取未查看的网站分类通知
- INSERT INTO @T(ID,type,Title,ContentText,link,iCount)
- SELECT TOP 2 ID,5, Title,LEFT(Content, 300), link,Type
- FROM ResumeInform WITH(NOLOCK)
- WHERE Status=1
- AND Province like '%' + LTRIM(str(@ProvinceID)) + '%'
- AND EndDate > GETDATE()
- ORDER BY ID DESC
- --取未查看的投诉
- INSERT INTO @T(ID,type,ContentText,AddDate)
- SELECT TOP 1 a.ID,6,LEFT(a.Plaint, 300),a.AddDate
- FROM CaPlaint a WITH(NOLOCK INDEX(IX_caPlaint_cvMainID)), cvMain b WITH(NOLOCK INDEX(IX_cvMain_paMainID))
- WHERE a.cvMainID = b.ID AND b.PaMainID = @PaMainID AND a.IsViewed = 0 AND a.ReplyType = 1
- ORDER BY a.ID DESC
- --取当前调查
- DECLARE @Reg AS INT
- SET @Reg = 0
- IF @ProvinceID=32
- BEGIN
- IF EXISTS(SELECT 'x' FROM paMain WITH(NOLOCK) WHERE ID=@paMainId AND AddDate > '2012-1-26')
- SET @Reg = 1
- END
- IF @Reg = 1
- INSERT INTO @T(ID,type,ContentText,Link)
- SELECT TOP 1 ID, 7, Title,exLink FROM Ivgt_Investigation WITH(NOLOCK)
- WHERE ENDDate > GETDATE() AND Province LIKE '%' + LTRIM(str(@ProvinceID))+'%' AND Type=2
- ORDER BY ID DESC
- ELSE
- INSERT INTO @T(ID,type,ContentText,Link)
- SELECT TOP 1 ID, 7, Title,exLink FROM Ivgt_Investigation WITH(NOLOCK)
- WHERE ENDDate > GETDATE() AND Province LIKE '%' + LTRIM(str(@ProvinceID))+'%' AND Type=2
- AND ID <> 276
- ORDER BY ID DESC
-
- SELECT * FROM @T
- END
- GO
- /****** Object: StoredProcedure [dbo].[pcInterviewRecordByPaMainIDSelect] Script Date: 2018/12/13 19:08:35 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- --#####################################################
- --创建时间:2014.10.30
- --创建人:John
- --说明:个人获取面试记录
- --#####################################################
- CREATE PROCEDURE [dbo].[pcInterviewRecordByPaMainIDSelect]
- (
- @paMainID INT
- )
- AS
- BEGIN
- SELECT a.*,c.Name caName,d.Name cpName,ISNULL(d.SecondId ,d.ID) cpMainID
- FROM viInterviewRecord a
- LEFT JOIN viRoom b ON b.ID=a.viRoomID
- LEFT JOIN caMain c ON c.ID=b.caMainID
- LEFT JOIN cpMain d ON d.ID=c.cpMainID
- WHERE a.Begindate IS NOT NULL
- AND a.cvMainID IN
- (
- SELECT ID
- FROM cvMain
- WHERE paMainID=@paMainID
- )
- ORDER BY a.ID DESC
- END
- GO
- /****** Object: StoredProcedure [dbo].[pcJobByCountySearchSelect] Script Date: 2018/12/13 19:08:35 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- CREATE PROCEDURE [dbo].[pcJobByCountySearchSelect]
- (
- @dcJobTypeID VARCHAR(100), --职位类别
- @dcRegionID VARCHAR(6), --求职地区
- @PageNumber INT --翻页页码
- )
- AS
- SELECT 0 JobNumber
- SELECT TOP 0 * FROM SearchDb..CountyJob WITH(NOLOCK)
- RETURN
- BEGIN
- DECLARE @crDate DATETIME
- SELECT TOP 1 @crDate = crDate FROM SearchDb..CountyJob WITH(NOLOCK) WHERE JobPlaceId = @dcRegionID
- IF DATEADD(HOUR, -2, GETDATE()) > ISNULL(@crDate, GETDATE() - 1)
- BEGIN
- EXEC procCountyJobInsert @dcRegionID
- END
-
- IF ISNULL(@PageNumber, 0) = 0
- SET @PageNumber = 1
- IF @PageNumber > 67
- SET @PageNumber = 67
- SELECT JobNumber FROM SearchDb..CountyJobNumber WHERE ProvinceId = LEFT(@dcRegionID, 2)
- SELECT * FROM SearchDb..CountyJob WITH(NOLOCK)
- WHERE JobPlaceId = @dcRegionID
- AND PageID = @PageNumber
- ORDER BY RowID
- END
- GO
- /****** Object: StoredProcedure [dbo].[pcJobByHighSalarySelect] Script Date: 2018/12/13 19:08:35 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- --lambo 2014-9-17
- --前台校园招聘 取靠普高薪职位 山东北京上海取5000以上的 ,其它地区取4000以上的
- --Mice 2014-9-26 添加 with(nolock)
- CREATE PROCEDURE [dbo].[pcJobByHighSalarySelect]
- (
- @dcProvinceID INT
- )
- AS
- BEGIN
- SELECT * FROM HighJob WITH(NOLOCK) WHERE ProvinceId = @dcProvinceId
- END
- GO
- /****** Object: StoredProcedure [dbo].[pcJobByIntentionSelect] Script Date: 2018/12/13 19:08:35 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- -- = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
- -- 检查: Sean
- -- 日期: 2010-10-5
- -- 描述: 提取求职意向
- --peter 2018-3-27
- -- = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
- CREATE PROCEDURE [dbo].[pcJobByIntentionSelect]
- (
- @cvMainID INT
- )
- AS
- SET NOCOUNT ON
- BEGIN
- DECLARE @JobType AS VARCHAR(30),
- @JobTypeName AS VARCHAR(1000),
- @JobPlace AS VARCHAR(40),
- @JobPlaceName AS VARCHAR(100),
- @Industry AS VARCHAR(30),
- @IndustryName AS VARCHAR(100)
- SELECT @JobType = '',@JobTypeName= '' , @JobPlace = '',@JobPlaceName = '', @Industry = '',@IndustryName = ''
- SELECT @JobType = @JobType + LTRIM(STR(dcJobTypeID)) + ' ',
- @JobTypeName =@JobTypeName + (SELECT TOP 1 Description+' ' FROM dcJobType WITH(NOLOCK) WHERE ID = dcJobTypeID)
- FROM cvJobType WITH(NOLOCK)
- WHERE cvMainID = @cvMainID ORDER BY dcJobTypeID
- SELECT @JobPlace = @JobPlace + LTRIM(STR(dcRegionID)) + ' ',
- @JobPlaceName = @JobPlaceName + (SELECT TOP 1 Description+' ' FROM dcRegion WITH(NOLOCK) WHERE ID = dcRegionID)
- FROM cvJobPlace WITH(NOLOCK)
- WHERE cvMainID = @cvMainID ORDER BY dcRegionID
- SELECT @Industry = @Industry + LTRIM(STR(dcIndustryID)) + ' ',
- @IndustryName = @IndustryName + (SELECT TOP 1 Description+' ' FROM dcIndustry WITH(NOLOCK) WHERE ID = dcIndustryID)
- FROM cvIndustry WITH(NOLOCK)
- WHERE cvMainID = @cvMainID ORDER BY dcIndustryID
- SELECT RelatedWorkYears,
- EmployType,
- dcSalaryID,
- IsNegotiable,
- RTRIM(@JobType) AS JobType,
- RTRIM(@JobTypeName) AS JobTypeName,
- RTRIM(@JobPlace) AS JobPlace,
- RTRIM(@JobPlaceName) AS JobPlaceName,
- RTRIM(@Industry) AS Industry,
- RTRIM(@IndustryName) AS IndustryName
- FROM cvMain WITH(NOLOCK)
- WHERE id = @cvMainID
- END
- GO
- /****** Object: StoredProcedure [dbo].[pcJobByIntentionSelectByPhone] Script Date: 2018/12/13 19:08:35 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- CREATE PROCEDURE [dbo].[pcJobByIntentionSelectByPhone]
- @cvMainID INT
- AS
- BEGIN
- DECLARE @JobType AS VARCHAR(100)
- DECLARE @JobTypeName AS VARCHAR(1000)
- DECLARE @JobPlace AS VARCHAR(100)
- DECLARE @JobPlaceName AS VARCHAR(100)
- DECLARE @Industry AS VARCHAR(100)
- DECLARE @IndustryName AS VARCHAR(100)
- DECLARE @INTTemp AS INT
- DECLARE @STRTemp AS VARCHAR(20)
- DECLARE #JobType CURSOR FOR SELECT a.dcJobTypeID,b.Description JobType FROM cvJobType a WITH(NOLOCK),dcJobType b WITH(NOLOCK) WHERE a.dcJobTypeID=b.ID AND a.cvMainID=@cvMainID ORDER BY a.dcJobTypeID
- DECLARE #JobPlace CURSOR FOR SELECT a.dcRegionID,b.FullName Region FROM cvJobPlace a WITH(NOLOCK),dcRegion b WITH(NOLOCK) WHERE a.dcRegionID=b.ID AND a.cvMainID=@cvMainID ORDER BY a.dcRegionID
- DECLARE #Industry CURSOR FOR SELECT a.dcIndustryID,b.Description Industry FROM cvIndustry a WITH(NOLOCK),dcIndustry b WITH(NOLOCK) WHERE a.dcIndustryID=b.ID AND a.cvMainID=@cvMainID ORDER BY dcIndustryID
-
- --取得JobType
- OPEN #JobType
- FETCH NEXT FROM #JobType INTO @INTTemp,@STRTemp
- WHILE @@FETCH_STATUS = 0
- BEGIN
- IF Len(@JobType) > 0
- BEGIN
- SET @JobType = @JobType + ' ' + Rtrim(CONVERT(CHAR(10),@INTTemp))
- SET @JobTypeName = @JobTypeName + ' ' + @STRTemp
- END
- ELSE
- BEGIN
- SET @JobType = Rtrim(CONVERT(CHAR(10),@INTTemp))
- SET @JobTypeName = @STRTemp
- END
- FETCH NEXT FROM #JobType INTO @INTTemp,@STRTemp
- END
- CLOSE #JobType
- DEALLOCATE #JobType
- --取得JobPlace
- OPEN #JobPlace
- FETCH NEXT FROM #JobPlace INTO @INTTemp,@STRTemp
- WHILE @@FETCH_STATUS = 0
- BEGIN
- IF Len(@JobPlace) > 0
- BEGIN
- SET @JobPlace = @JobPlace + ' ' + Rtrim(CONVERT(CHAR(10),@INTTemp))
- SET @JobPlaceName = @JobPlaceName + ' ' + @STRTemp
- END
- ELSE
- BEGIN
- SET @JobPlace = Rtrim(CONVERT(CHAR(10),@INTTemp))
- SET @JobPlaceName = @STRTemp
- END
- FETCH NEXT FROM #JobPlace INTO @INTTemp,@STRTemp
- END
- CLOSE #JobPlace
- DEALLOCATE #JobPlace
- --取得Industry
- OPEN #Industry
- FETCH NEXT FROM #Industry INTO @INTTemp,@STRTemp
- WHILE @@FETCH_STATUS = 0
- BEGIN
- IF Len(@Industry) > 0
- BEGIN
- SET @Industry = @Industry + ' ' + Rtrim(CONVERT(CHAR(10),@INTTemp))
- SET @IndustryName = @IndustryName + ' ' + @STRTemp
- END
- ELSE
- BEGIN
- SET @Industry = Rtrim(CONVERT(CHAR(10),@INTTemp))
- SET @IndustryName = @STRTemp
- END
- FETCH NEXT FROM #Industry INTO @INTTemp,@STRTemp
- END
- CLOSE #Industry
- DEALLOCATE #Industry
- SELECT
- RelatedWorkYears,
- EmployType,
- dcSalaryID,
- IsNegotiable,
- b.Description Salary,
- @JobType AS JobType,
- @JobPlace AS JobPlace,
- @Industry AS Industry,
- @JobTypeName AS JobTypeName,
- @JobPlaceName AS JobPlaceName,
- @IndustryName AS IndustryName
- From cvMain a WITH(NOLOCK)
- LEFT JOIN dcSalary b WITH(NOLOCK) ON a.dcSalaryID=b.ID
- WHERE a.id=@cvMainID
- END
- GO
- /****** Object: StoredProcedure [dbo].[pcJobByJobApplyCount] Script Date: 2018/12/13 19:08:35 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- CREATE PROCEDURE [dbo].[pcJobByJobApplyCount]
- (
- @JobID INT
- )
- AS
- BEGIN
- DECLARE @ApplyCount AS INT
- SELECT @ApplyCount = COUNT(ID) FROM exJobApply WITH(NOLOCK) WHERE JobID = @JobID
- RETURN @ApplyCount
- END
- GO
- /****** Object: StoredProcedure [dbo].[pcJobByJobIDsSelect] Script Date: 2018/12/13 19:08:36 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- CREATE PROCEDURE [dbo].[pcJobByJobIDsSelect]
- (
- @JobIDs VARCHAR(300)
- )
- AS
- BEGIN
- SELECT * FROM Job WITH(NOLOCK) WHERE ID IN (SELECT A FROM dbo.fnsplit(@JobIDs ,','))
- END
- GO
- /****** Object: StoredProcedure [dbo].[pcJobByListSelect] Script Date: 2018/12/13 19:08:36 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- CREATE PROCEDURE [dbo].[pcJobByListSelect]
- (
- @AllJobID VARCHAR(1000)
- )
- AS
- BEGIN
- SET @AllJobID = dbo.FormatIDS(@AllJobID)
- DECLARE @T AS TABLE(ID INT)
- INSERT INTO @T SELECT * FROM dbo.fnSplit(@AllJobID, ',')
- SELECT c.ID,c.cpMainID,c.caMainID,c.Name AS JobName,c.dcJobTypeID,c.dcJobTypeIDMinor,
- c.NeedNumber,c.dcSalaryID,c.EmployType,c.dcRegionID,c.dcEducationID,c.MinExperience,
- c.IssueDate,c.IssueEND,c.IsDelete,b.AccountType,b.Name AS caName,b.GENDer,
- b.Title,b.Dept,b.TelePhone,b.Mobile,b.Fax,
- b.IsPhoneHide,b.IsNameHide,b.IsMobileHide,a.Name AS cpName,
- a.ShortName,a.dcCompanyKindID,a.dcCompanySizeID,
- a.dcRegionID AS cpDcRegionID,a.Address,a.Zip,c.SecondID EnJobID,a.SecondID EnCpMainID
- FROM cpMain a WITH(NOLOCK)
- INNER JOIN caMain b WITH(NOLOCK) ON a.ID = b.cpMainID
- INNER JOIN Job c WITH(NOLOCK) ON b.ID = c.caMainID
- WHERE c.ID IN (SELECT ID FROM @t)
- END
- GO
- /****** Object: StoredProcedure [dbo].[pcJobByMapSearchSelect] Script Date: 2018/12/13 19:08:36 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- CREATE PROCEDURE [dbo].[pcJobByMapSearchSelect]
- (
- @dcJobTypeID VARCHAR(100), --职位类别
- @dcIndustryID VARCHAR(100), --求职行业
- @KeyWord NVARCHAR(50), --关键词
- @KeyType TINYINT, --关键词类别,0无;1-全文;2-职位;3-公司
- @Type INT, --1:主动搜索 点击搜索按钮 10分钟,翻页60分钟有效;0:翻页搜索,不刷新
- @PageNumber INT, --翻页页码
- @Distance INT, --距离范围
- @Lng DECIMAL(8,5), --经度
- @Lat DECIMAL(8,5), --纬度
- @dcSalaryID TINYINT, --月薪
- @MinExperience TINYINT, --工作经验,100为未选择
- @dcEducationID TINYINT, --最低学历
- @EmployType VARCHAR(10), --是否在线 -----工作性质,1全职;3兼职;4实习,
- @CompanySizeID VARCHAR(2) --dcprovinceid --fei 是否环境照片 --企业规模
- )
- AS
- --return
- SET NOCOUNT ON
- IF @Lng IS NULL OR @Lat IS NULL
- RETURN
- BEGIN TRY
- BEGIN
- ----给null值变量赋默认值
- SELECT @dcJobTypeID = RTRIM(dbo.FormatIDS(@dcJobTypeID)),
- @dcIndustryID = RTRIM(dbo.FormatIDS(@dcIndustryID)),
- @Type = ISNULL(@Type, 0),
- @dcSalaryID = 0,
- @MinExperience = 0,
- @dcEducationID = 0,
- @PageNumber = ISNULL(@PageNumber, 0),
- @CompanySizeID = ISNULL(@CompanySizeID, '0'),
- @EmployType = ISNULL(@EmployType, '')
-
- IF RIGHT(@dcJobTypeID, 1) = ','
- SET @dcJobTypeID = LEFT(@dcJobTypeID, LEN(@dcJobTypeID) - 1)
- IF RIGHT(@dcIndustryID, 1) = ','
- SET @dcIndustryID = LEFT(@dcIndustryID, LEN(@dcIndustryID) - 1)
- DECLARE @paSearchConditionID AS INT,
- @MinId AS INT,
- @PageSize AS TINYINT,
- @TableID AS TINYINT
- SELECT @paSearchConditionID = 0, @PageSize = 30 --每页的行数
-
- ----搜索60分钟前的数据
- SELECT TOP 1 @paSearchConditionID=ID FROM SearchDB..paSearchCondition WITH(NOLOCK)
- WHERE IsDelete = 0 AND JobType = @dcJobTypeID
- AND Industry = @dcIndustryID AND Lng = @Lng
- AND Distance = @Distance AND Lat = @Lat
- AND Education = @dcEducationID AND EmployType = @EmployType
- AND Experience = @MinExperience AND Salary = @dcSalaryID
- AND CompanySizeID = 0 AND dcProvinceId = @CompanySizeID
- ORDER BY ID DESC
- IF ISNULL(@paSearchConditionID, 0) = 0
- BEGIN
- SET @Type =1
- GOTO SelectReset --无数据,重新搜索
- END
- ELSE
- BEGIN
- SELECT @TableID = @paSearchConditionID % 4
- GOTO GetRecordSet --从临时结果中提取数据
- END
- END
- SelectReset: --从job中搜索数据
- BEGIN TRAN
- DECLARE @SQL AS VARCHAR(8000)
- DECLARE @WHERE AS VARCHAR(8000)
- DECLARE @FROM AS VARCHAR(1000)
- ----记录查询条件
- INSERT INTO SearchDB..paSearchCondition(SessionID, LogTime, JobType, Industry,
- Lng, Lat, Distance, ReuseNumber, Education, Experience,
- Salary, EmployType, CompanySizeID, dcProvinceId, Keyword)
- VALUES(51, GETDATE(), @dcJobTypeID, @dcIndustryID, @Lng, @Lat,
- @Distance, 0, @dcEducationID, @MinExperience,
- @dcSalaryID, @EmployType, 0, @CompanySizeID, '')
- SET @paSearchConditionID = @@IDENTITY
- SELECT @TableID = @paSearchConditionID % 4
- ------生成职位类别的表变量,因为职位类别有包含(父子)关系
- DECLARE @T_JobType AS TABLE(ID INT)
- DECLARE @JobType AS VARCHAR(3000)
- DECLARE @ValidJobNumber AS INT
- SET @JobType=''
- ----生成求聘职位的表变量
- IF LEN(@dcJobTypeID) > 0
- BEGIN
- DECLARE @T_Temp AS TABLE(ID INT) --临时表,用于构建组合查询语句
- INSERT INTO @T_Temp
- SELECT * FROM dbo.fnSplit(@dcJobTypeID, ',')
- INSERT INTO @T_JobType
- SELECT DISTINCT ID FROM dcJobType WITH(NOLOCK)
- WHERE ParentId IN(SELECT ID FROM @T_TEMP)
- OR ParentId2 in(SELECT ID FROM @T_TEMP)
- OR ID IN(SELECT ID FROM @T_TEMP)
- ----生成in字符串
- SELECT @JobType = (@JobType + LTRIM(STR(ID) + ',')) FROM @T_JobType
- IF RIGHT(@JobType, 1) = ','
- SET @JobType = LEFT(@JobType, LEN(@JobType) - 1)
- END
-
- ----建立临时表
- CREATE TABLE #Job(
- RowID INT IDENTITY(1, 1),
- ID INT NOT NULL,
- dcJobTypeID SMALLINT NOT NULL,
- dcJobTypeIDMinor SMALLINT NULL,
- dcSalaryID TINYINT NOT NULL,
- dcRegionID VARCHAR(6) NULL,
- dcEducationID TINYINT NOT NULL,
- MinExperience TINYINT NOT NULL,
- RefreshDate SMALLDATETIME NULL,
- EmployType TINYINT NULL,
- dcCompanySizeID SMALLINT NULL
- )
- ------刷新时间,根据刷新时间编号计算
- ----生成插入临时表的Sql语句
- SET @SQL='
- INSERT INTO #Job
- SELECT a.ID, a.dcJobTypeID,
- a.dcJobTypeIDMinor, a.dcSalaryID,
- a.dcRegionID, a.dcEducationID, a.MinExperience,
- a.IssueDate,a.EmployType,b.dcCompanySizeID'
- SET @FROM = '
- FROM JobPublish a WITH(NOLOCK)
- INNER JOIN cpMainPublish b WITH(NOLOCK) ON a.cpMainID=b.ID'
- ----职位有效,单位新有效
- IF LEN(@dcIndustryID) > 0
- SET @WHERE = '
- WHERE b.ID IN (SELECT cpMainID FROM cpIndustry WHERE dcIndustryId in(' + @dcIndustryID + '))
- AND a.Valid = 1
- AND b.Valid = 1'
- ELSE
- SET @WHERE = '
- WHERE a.Valid = 1
- AND b.Valid = 1'
- IF LEN(@CompanySizeId) = 2
- SET @WHERE = @WHERE + '
- AND b.dcProvinceID = ' + @CompanySizeId
- ----职位类别
- IF LEN(@dcJobTypeID) > 0
- SET @WHERE = @WHERE + '
- AND (a.dcJobTypeID IN(' + @JobType +')
- OR a.dcJobTypeIDMinor IN(' +@JobType + '))'
- ----1、全职;3、兼职;4实习。 2、全职/兼职 职位中无此项
- IF LEN(@EmployType) = '1'
- SET @WHERE = @WHERE + '
- AND a.caMainId IN(SELECT caMainId FROM caOnline WITH(NOLOCK) WHERE IsOnline = 1)'
-
- DECLARE @Degree AS DECIMAL(8,5),@LBLng AS DECIMAL(8,5),@LBLat AS DECIMAL(8,5),
- @RTLng AS DECIMAL(8,5),@RTLat AS DECIMAL(8,5)
- SET @Degree = @Distance / 100000.0;
- SET @LBLng = @Lng - @Degree
- SET @LBLat = @Lat - @Degree
- SET @RTLng = @Lng + @Degree
- SET @RTLat = @Lat + @Degree
- SET @WHERE = @WHERE + '
- AND a.Lng BETWEEN ' + CONVERT(VARCHAR,@LBLng) + ' AND ' + CONVERT(VARCHAR,@RTLng) + '
- AND a.Lat BETWEEN ' + CONVERT(VARCHAR,@LBLat) + ' AND ' + CONVERT(VARCHAR,@RTLat) + '
- AND (a.Lng-' + CONVERT(VARCHAR,@Lng) + ')*(a.Lng-' + CONVERT(VARCHAR,@Lng) + ')+
- (a.Lat-' + CONVERT(VARCHAR,@Lat) + ')*(a.Lat-' + CONVERT(VARCHAR,@Lat) + ')<' + CONVERT(VARCHAR,@Degree*@Degree)
- SET @SQL = @SQL + @FROM + @WHERE
-
- --IF LEN(@ORDER)>0
- SET @SQL=@SQL + ' ORDER BY a.RefreshDate DESC, a.ID'
- --原来是ORDER BY a.IssueDate DESC, a.ID,Richard 2011年11月23日17:06分修改
- ----把符合条件的职位全部列出
- --PRINT @SQL
- EXEC(@SQL)
-
- SET @ValidJobNumber = @@ROWCOUNT
- ----记录查询结果总数
- UPDATE SearchDB..paSearchCondition SET ValidJobNumber=@ValidJobNumber, SQl=@SQL WHERE ID=@paSearchConditionID
- ----插入JobType数据
- DECLARE @TitleValue AS INT, @TopRows AS INT, @AllRows AS INT
- IF (@TableID = 0)
- BEGIN
- INSERT INTO SearchDB..paSearchCount_0(paSearchConditionID, Title, TitleId, TitleValue)
- SELECT @paSearchConditionID, 'JobType', dcJobTypeID, COUNT(*) FROM #Job WITH(NOLOCK)
- GROUP BY dcJobTypeID ORDER BY dcJobTypeID
- ----计算全部某职位类别,2, 4位的数据
- UPDATE a SET a.TitleValue = b.TitleValue
- FROM SearchDB..paSearchCount_0 a WITH(NOLOCK),
- (SELECT LEFT(TitleID, 2) TitleID, SUM(TitleValue) TitleValue
- FROM SearchDB..paSearchCount_0 WITH(NOLOCK)
- WHERE paSearchConditionID = @paSearchConditionID AND Title = 'JobType'
- GROUP BY LEFT(TitleID, 2)) b
- WHERE a.TitleId = b.TitleID
- AND a.paSearchConditionID = @paSearchConditionID AND a.Title = 'JobType'
- ----写入TitleDesc
- UPDATE a SET a.TitleDesc = b.Description
- FROM SearchDB..paSearchCount_0 a WITH(NOLOCK), dcJobType b WITH(NOLOCK)
- WHERE a.TitleID = b.ID AND a.paSearchConditionID = @paSearchConditionID
- AND a.Title = 'JobType'
-
- INSERT INTO SearchDB..paSearchCount_0(paSearchConditionID, Title, TitleId, TitleValue)
- SELECT @paSearchConditionID, 'Salary', dcSalaryID, COUNT(*) FROM #Job WITH(NOLOCK)
- GROUP BY dcSalaryID ORDER BY dcSalaryID
- INSERT INTO SearchDB..paSearchCount_0(paSearchConditionID, Title, TitleId, TitleValue)
- SELECT @paSearchConditionID, 'Region', dcRegionID, COUNT(*) FROM #Job WITH(NOLOCK)
- GROUP BY dcRegionID ORDER BY dcRegionID
- ----计算全部地区,2位的数据
- UPDATE a SET a.TitleValue = b.TitleValue
- FROM SearchDB..paSearchCount_0 a WITH(NOLOCK),
- (SELECT LEFT(TitleID, 2) TitleID, SUM(TitleValue) TitleValue
- FROM SearchDB..paSearchCount_0 WITH(NOLOCK)
- WHERE paSearchConditionID = @paSearchConditionID AND Title = 'Region'
- GROUP BY LEFT(TitleID, 2)) b
- WHERE a.TitleId = b.TitleID
- AND a.paSearchConditionID = @paSearchConditionID AND a.Title = 'Region'
- ----计算全部地区,4位的数据
- UPDATE a SET a.TitleValue = b.TitleValue
- FROM SearchDB..paSearchCount_0 a WITH(NOLOCK), (
- SELECT LEFT(TitleID, 4) TitleID, SUM(TitleValue) TitleValue
- FROM SearchDB..paSearchCount_0 WITH(NOLOCK)
- WHERE paSearchConditionID = @paSearchConditionID AND Title = 'Region'
- AND LEN(TitleID) >3
- GROUP BY LEFT(TitleID, 4)) b
- WHERE a.TitleId = b.TitleID
- AND a.paSearchConditionID = @paSearchConditionID AND a.Title = 'Region'
- ----写入TitleDesc
- UPDATE a SET a.TitleDesc = b.Description
- FROM SearchDB..paSearchCount_0 a WITH(NOLOCK), dcRegion b WITH(NOLOCK)
- WHERE a.TitleID = b.ID AND a.paSearchConditionID = @paSearchConditionID
- AND a.Title = 'Region'
- INSERT INTO SearchDB..paSearchCount_0(paSearchConditionID, Title, TitleId, TitleValue)
- SELECT @paSearchConditionID, 'Education', CASE WHEN dcEducationId IN(2, 3, 4) THEN 2 ELSE dcEducationId END, COUNT(*) FROM #Job WITH(NOLOCK)
- GROUP BY CASE WHEN dcEducationId IN(2, 3, 4) THEN 2 ELSE dcEducationId END
- ORDER BY CASE WHEN dcEducationId IN(2, 3, 4) THEN 2 ELSE dcEducationId END
-
- INSERT INTO SearchDB..paSearchCount_0(paSearchConditionID, Title, TitleId, TitleValue)
- SELECT @paSearchConditionID, 'Experience', MinExperience, COUNT(*) FROM #Job WITH(NOLOCK)
- GROUP BY MinExperience ORDER BY MinExperience
-
- INSERT INTO SearchDB..paSearchCount_0(paSearchConditionID, Title, TitleId, TitleValue)
- SELECT @paSearchConditionID, 'EmployType', EmployType, COUNT(*) FROM #Job WITH(NOLOCK)
- GROUP BY EmployType ORDER BY EmployType
- INSERT INTO SearchDB..paSearchCount_0(paSearchConditionID, Title, TitleId, TitleValue)
- SELECT @paSearchConditionID, 'CompanySize', dcCompanySizeID, COUNT(*) FROM #Job WITH(NOLOCK)
- GROUP BY dcCompanySizeID ORDER BY dcCompanySizeID
- INSERT INTO SearchDB..paSearchJobID_0(paSearchConditionID, JobId, IsTop)
- SELECT Top 3 @paSearchConditionID, a.JobId, 1
- FROM SearchJobTop a WITH(NOLOCK), (SELECT TOP 2000 ID FROM #Job WITH(NOLOCK)) b
- WHERE b.ID = a.JobId ORDER BY a.OpenDate DESC
- SET @TopRows = @@ROWCOUNT
- INSERT INTO SearchDB..paSearchJobID_0(paSearchConditionID, JobId, IsTop)
- SELECT TOP 2000 @paSearchConditionID, ID, 0 FROM #Job WITH(NOLOCK)
- SET @AllRows = @@ROWCOUNT
- IF @TopRows = 0 AND @AllRows > 100
- UPDATE SearchDB..paSearchJobID_0 SET IsTop = 1
- WHERE paSearchConditionID = @paSearchConditionID
- AND ID IN (SELECT TOP 3 ID FROM SearchDB..paSearchJobID_0 WITH(NOLOCK) WHERE paSearchConditionID = @paSearchConditionID)
- END
- ELSE IF (@TableId = 1)
- BEGIN
- INSERT INTO SearchDB..paSearchCount_1(paSearchConditionID, Title, TitleId, TitleValue)
- SELECT @paSearchConditionID, 'JobType', dcJobTypeID, COUNT(*) FROM #Job WITH(NOLOCK)
- GROUP BY dcJobTypeID ORDER BY dcJobTypeID
- ----计算全部某职位类别,2, 4位的数据
- UPDATE a SET a.TitleValue = b.TitleValue
- FROM SearchDB..paSearchCount_1 a WITH(NOLOCK),
- (SELECT LEFT(TitleID, 2) TitleID, SUM(TitleValue) TitleValue
- FROM SearchDB..paSearchCount_1 WITH(NOLOCK)
- WHERE paSearchConditionID = @paSearchConditionID AND Title = 'JobType'
- GROUP BY LEFT(TitleID, 2)) b
- WHERE a.TitleId = b.TitleID
- AND a.paSearchConditionID = @paSearchConditionID AND a.Title = 'JobType'
- ----写入TitleDesc
- UPDATE a SET a.TitleDesc = b.Description
- FROM SearchDB..paSearchCount_1 a WITH(NOLOCK), dcJobType b WITH(NOLOCK)
- WHERE a.TitleID = b.ID AND a.paSearchConditionID = @paSearchConditionID
- AND a.Title = 'JobType'
-
- INSERT INTO SearchDB..paSearchCount_1(paSearchConditionID, Title, TitleId, TitleValue)
- SELECT @paSearchConditionID, 'Salary', dcSalaryID, COUNT(*) FROM #Job WITH(NOLOCK)
- GROUP BY dcSalaryID ORDER BY dcSalaryID
- INSERT INTO SearchDB..paSearchCount_1(paSearchConditionID, Title, TitleId, TitleValue)
- SELECT @paSearchConditionID, 'Region', dcRegionID, COUNT(*) FROM #Job WITH(NOLOCK)
- GROUP BY dcRegionID ORDER BY dcRegionID
- ----计算全部地区,2位的数据
- UPDATE a SET a.TitleValue = b.TitleValue
- FROM SearchDB..paSearchCount_1 a WITH(NOLOCK),
- (SELECT LEFT(TitleID, 2) TitleID, SUM(TitleValue) TitleValue
- FROM SearchDB..paSearchCount_1 WITH(NOLOCK)
- WHERE paSearchConditionID = @paSearchConditionID AND Title = 'Region'
- GROUP BY LEFT(TitleID, 2)) b
- WHERE a.TitleId = b.TitleID
- AND a.paSearchConditionID = @paSearchConditionID AND a.Title = 'Region'
- ----计算全部地区,4位的数据
- UPDATE a SET a.TitleValue = b.TitleValue
- FROM SearchDB..paSearchCount_1 a WITH(NOLOCK), (
- SELECT LEFT(TitleID, 4) TitleID, SUM(TitleValue) TitleValue
- FROM SearchDB..paSearchCount_1 WITH(NOLOCK)
- WHERE paSearchConditionID = @paSearchConditionID AND Title = 'Region'
- AND LEN(TitleID) >3
- GROUP BY LEFT(TitleID, 4)) b
- WHERE a.TitleId = b.TitleID
- AND a.paSearchConditionID = @paSearchConditionID AND a.Title = 'Region'
- ----写入TitleDesc
- UPDATE a SET a.TitleDesc = b.Description
- FROM SearchDB..paSearchCount_1 a WITH(NOLOCK), dcRegion b WITH(NOLOCK)
- WHERE a.TitleID = b.ID AND a.paSearchConditionID = @paSearchConditionID
- AND a.Title = 'Region'
- INSERT INTO SearchDB..paSearchCount_1(paSearchConditionID, Title, TitleId, TitleValue)
- SELECT @paSearchConditionID, 'Education', CASE WHEN dcEducationId IN(2, 3, 4) THEN 2 ELSE dcEducationId END, COUNT(*) FROM #Job WITH(NOLOCK)
- GROUP BY CASE WHEN dcEducationId IN(2, 3, 4) THEN 2 ELSE dcEducationId END
- ORDER BY CASE WHEN dcEducationId IN(2, 3, 4) THEN 2 ELSE dcEducationId END
-
- INSERT INTO SearchDB..paSearchCount_1(paSearchConditionID, Title, TitleId, TitleValue)
- SELECT @paSearchConditionID, 'Experience', MinExperience, COUNT(*) FROM #Job WITH(NOLOCK)
- GROUP BY MinExperience ORDER BY MinExperience
-
- INSERT INTO SearchDB..paSearchCount_1(paSearchConditionID, Title, TitleId, TitleValue)
- SELECT @paSearchConditionID, 'EmployType', EmployType, COUNT(*) FROM #Job WITH(NOLOCK)
- GROUP BY EmployType ORDER BY EmployType
- INSERT INTO SearchDB..paSearchCount_1(paSearchConditionID, Title, TitleId, TitleValue)
- SELECT @paSearchConditionID, 'CompanySize', dcCompanySizeID, COUNT(*) FROM #Job WITH(NOLOCK)
- GROUP BY dcCompanySizeID ORDER BY dcCompanySizeID
- INSERT INTO SearchDB..paSearchJobID_1(paSearchConditionID, JobId, IsTop)
- SELECT Top 3 @paSearchConditionID, a.JobId, 1
- FROM SearchJobTop a WITH(NOLOCK), (SELECT TOP 2000 ID FROM #Job WITH(NOLOCK)) b
- WHERE b.ID = a.JobId ORDER BY a.OpenDate DESC
- SET @TopRows = @@ROWCOUNT
- INSERT INTO SearchDB..paSearchJobID_1(paSearchConditionID, JobId, IsTop)
- SELECT TOP 2000 @paSearchConditionID, ID, 0 FROM #Job WITH(NOLOCK)
- SET @AllRows = @@ROWCOUNT
- IF @TopRows = 0 AND @AllRows > 100
- UPDATE SearchDB..paSearchJobID_1 SET IsTop = 1
- WHERE paSearchConditionID = @paSearchConditionID
- AND ID IN (SELECT TOP 3 ID FROM SearchDB..paSearchJobID_1 WITH(NOLOCK) WHERE paSearchConditionID = @paSearchConditionID)
- END
- ELSE IF (@TableId = 2)
- BEGIN
- INSERT INTO SearchDB..paSearchCount_2(paSearchConditionID, Title, TitleId, TitleValue)
- SELECT @paSearchConditionID, 'JobType', dcJobTypeID, COUNT(*) FROM #Job WITH(NOLOCK)
- GROUP BY dcJobTypeID ORDER BY dcJobTypeID
- ----计算全部某职位类别,2, 4位的数据
- UPDATE a SET a.TitleValue = b.TitleValue
- FROM SearchDB..paSearchCount_2 a WITH(NOLOCK),
- (SELECT LEFT(TitleID, 2) TitleID, SUM(TitleValue) TitleValue
- FROM SearchDB..paSearchCount_2 WITH(NOLOCK)
- WHERE paSearchConditionID = @paSearchConditionID AND Title = 'JobType'
- GROUP BY LEFT(TitleID, 2)) b
- WHERE a.TitleId = b.TitleID
- AND a.paSearchConditionID = @paSearchConditionID AND a.Title = 'JobType'
- ----写入TitleDesc
- UPDATE a SET a.TitleDesc = b.Description
- FROM SearchDB..paSearchCount_2 a WITH(NOLOCK), dcJobType b WITH(NOLOCK)
- WHERE a.TitleID = b.ID AND a.paSearchConditionID = @paSearchConditionID
- AND a.Title = 'JobType'
-
- INSERT INTO SearchDB..paSearchCount_2(paSearchConditionID, Title, TitleId, TitleValue)
- SELECT @paSearchConditionID, 'Salary', dcSalaryID, COUNT(*) FROM #Job WITH(NOLOCK)
- GROUP BY dcSalaryID ORDER BY dcSalaryID
- INSERT INTO SearchDB..paSearchCount_2(paSearchConditionID, Title, TitleId, TitleValue)
- SELECT @paSearchConditionID, 'Region', dcRegionID, COUNT(*) FROM #Job WITH(NOLOCK)
- GROUP BY dcRegionID ORDER BY dcRegionID
- ----计算全部地区,2位的数据
- UPDATE a SET a.TitleValue = b.TitleValue
- FROM SearchDB..paSearchCount_2 a WITH(NOLOCK),
- (SELECT LEFT(TitleID, 2) TitleID, SUM(TitleValue) TitleValue
- FROM SearchDB..paSearchCount_2 WITH(NOLOCK)
- WHERE paSearchConditionID = @paSearchConditionID AND Title = 'Region'
- GROUP BY LEFT(TitleID, 2)) b
- WHERE a.TitleId = b.TitleID
- AND a.paSearchConditionID = @paSearchConditionID AND a.Title = 'Region'
- ----计算全部地区,4位的数据
- UPDATE a SET a.TitleValue = b.TitleValue
- FROM SearchDB..paSearchCount_2 a WITH(NOLOCK), (
- SELECT LEFT(TitleID, 4) TitleID, SUM(TitleValue) TitleValue
- FROM SearchDB..paSearchCount_2 WITH(NOLOCK)
- WHERE paSearchConditionID = @paSearchConditionID AND Title = 'Region'
- AND LEN(TitleID) >3
- GROUP BY LEFT(TitleID, 4)) b
- WHERE a.TitleId = b.TitleID
- AND a.paSearchConditionID = @paSearchConditionID AND a.Title = 'Region'
- ----写入TitleDesc
- UPDATE a SET a.TitleDesc = b.Description
- FROM SearchDB..paSearchCount_2 a WITH(NOLOCK), dcRegion b WITH(NOLOCK)
- WHERE a.TitleID = b.ID AND a.paSearchConditionID = @paSearchConditionID
- AND a.Title = 'Region'
- INSERT INTO SearchDB..paSearchCount_2(paSearchConditionID, Title, TitleId, TitleValue)
- SELECT @paSearchConditionID, 'Education', CASE WHEN dcEducationId IN(2, 3, 4) THEN 2 ELSE dcEducationId END, COUNT(*) FROM #Job WITH(NOLOCK)
- GROUP BY CASE WHEN dcEducationId IN(2, 3, 4) THEN 2 ELSE dcEducationId END
- ORDER BY CASE WHEN dcEducationId IN(2, 3, 4) THEN 2 ELSE dcEducationId END
-
- INSERT INTO SearchDB..paSearchCount_2(paSearchConditionID, Title, TitleId, TitleValue)
- SELECT @paSearchConditionID, 'Experience', MinExperience, COUNT(*) FROM #Job WITH(NOLOCK)
- GROUP BY MinExperience ORDER BY MinExperience
-
- INSERT INTO SearchDB..paSearchCount_2(paSearchConditionID, Title, TitleId, TitleValue)
- SELECT @paSearchConditionID, 'EmployType', EmployType, COUNT(*) FROM #Job WITH(NOLOCK)
- GROUP BY EmployType ORDER BY EmployType
- INSERT INTO SearchDB..paSearchCount_2(paSearchConditionID, Title, TitleId, TitleValue)
- SELECT @paSearchConditionID, 'CompanySize', dcCompanySizeID, COUNT(*) FROM #Job WITH(NOLOCK)
- GROUP BY dcCompanySizeID ORDER BY dcCompanySizeID
- INSERT INTO SearchDB..paSearchJobID_2(paSearchConditionID, JobId, IsTop)
- SELECT Top 3 @paSearchConditionID, a.JobId, 1
- FROM SearchJobTop a WITH(NOLOCK), (SELECT TOP 2000 ID FROM #Job WITH(NOLOCK)) b
- WHERE b.ID = a.JobId ORDER BY a.OpenDate DESC
- SET @TopRows = @@ROWCOUNT
- INSERT INTO SearchDB..paSearchJobID_2(paSearchConditionID, JobId, IsTop)
- SELECT TOP 2000 @paSearchConditionID, ID, 0 FROM #Job WITH(NOLOCK)
- SET @AllRows = @@ROWCOUNT
- IF @TopRows = 0 AND @AllRows > 100
- UPDATE SearchDB..paSearchJobID_2 SET IsTop = 1
- WHERE paSearchConditionID = @paSearchConditionID
- AND ID IN (SELECT TOP 3 ID FROM SearchDB..paSearchJobID_2 WITH(NOLOCK) WHERE paSearchConditionID = @paSearchConditionID)
- END
- ELSE IF (@TableId = 3)
- BEGIN
- INSERT INTO SearchDB..paSearchCount_3(paSearchConditionID, Title, TitleId, TitleValue)
- SELECT @paSearchConditionID, 'JobType', dcJobTypeID, COUNT(*) FROM #Job WITH(NOLOCK)
- GROUP BY dcJobTypeID ORDER BY dcJobTypeID
- ----计算全部某职位类别,2, 4位的数据
- UPDATE a SET a.TitleValue = b.TitleValue
- FROM SearchDB..paSearchCount_3 a WITH(NOLOCK),
- (SELECT LEFT(TitleID, 2) TitleID, SUM(TitleValue) TitleValue
- FROM SearchDB..paSearchCount_3 WITH(NOLOCK)
- WHERE paSearchConditionID = @paSearchConditionID AND Title = 'JobType'
- GROUP BY LEFT(TitleID, 2)) b
- WHERE a.TitleId = b.TitleID
- AND a.paSearchConditionID = @paSearchConditionID AND a.Title = 'JobType'
- ----写入TitleDesc
- UPDATE a SET a.TitleDesc = b.Description
- FROM SearchDB..paSearchCount_3 a WITH(NOLOCK), dcJobType b WITH(NOLOCK)
- WHERE a.TitleID = b.ID AND a.paSearchConditionID = @paSearchConditionID
- AND a.Title = 'JobType'
-
- INSERT INTO SearchDB..paSearchCount_3(paSearchConditionID, Title, TitleId, TitleValue)
- SELECT @paSearchConditionID, 'Salary', dcSalaryID, COUNT(*) FROM #Job WITH(NOLOCK)
- GROUP BY dcSalaryID ORDER BY dcSalaryID
- INSERT INTO SearchDB..paSearchCount_3(paSearchConditionID, Title, TitleId, TitleValue)
- SELECT @paSearchConditionID, 'Region', dcRegionID, COUNT(*) FROM #Job WITH(NOLOCK)
- GROUP BY dcRegionID ORDER BY dcRegionID
- ----计算全部地区,2位的数据
- UPDATE a SET a.TitleValue = b.TitleValue
- FROM SearchDB..paSearchCount_3 a WITH(NOLOCK),
- (SELECT LEFT(TitleID, 2) TitleID, SUM(TitleValue) TitleValue
- FROM SearchDB..paSearchCount_3 WITH(NOLOCK)
- WHERE paSearchConditionID = @paSearchConditionID AND Title = 'Region'
- GROUP BY LEFT(TitleID, 2)) b
- WHERE a.TitleId = b.TitleID
- AND a.paSearchConditionID = @paSearchConditionID AND a.Title = 'Region'
- ----计算全部地区,4位的数据
- UPDATE a SET a.TitleValue = b.TitleValue
- FROM SearchDB..paSearchCount_3 a WITH(NOLOCK), (
- SELECT LEFT(TitleID, 4) TitleID, SUM(TitleValue) TitleValue
- FROM SearchDB..paSearchCount_3 WITH(NOLOCK)
- WHERE paSearchConditionID = @paSearchConditionID AND Title = 'Region'
- AND LEN(TitleID) >3
- GROUP BY LEFT(TitleID, 4)) b
- WHERE a.TitleId = b.TitleID
- AND a.paSearchConditionID = @paSearchConditionID AND a.Title = 'Region'
- ----写入TitleDesc
- UPDATE a SET a.TitleDesc = b.Description
- FROM SearchDB..paSearchCount_3 a WITH(NOLOCK), dcRegion b WITH(NOLOCK)
- WHERE a.TitleID = b.ID AND a.paSearchConditionID = @paSearchConditionID
- AND a.Title = 'Region'
- INSERT INTO SearchDB..paSearchCount_3(paSearchConditionID, Title, TitleId, TitleValue)
- SELECT @paSearchConditionID, 'Education', CASE WHEN dcEducationId IN(2, 3, 4) THEN 2 ELSE dcEducationId END, COUNT(*) FROM #Job WITH(NOLOCK)
- GROUP BY CASE WHEN dcEducationId IN(2, 3, 4) THEN 2 ELSE dcEducationId END
- ORDER BY CASE WHEN dcEducationId IN(2, 3, 4) THEN 2 ELSE dcEducationId END
-
- INSERT INTO SearchDB..paSearchCount_3(paSearchConditionID, Title, TitleId, TitleValue)
- SELECT @paSearchConditionID, 'Experience', MinExperience, COUNT(*) FROM #Job WITH(NOLOCK)
- GROUP BY MinExperience ORDER BY MinExperience
-
- INSERT INTO SearchDB..paSearchCount_3(paSearchConditionID, Title, TitleId, TitleValue)
- SELECT @paSearchConditionID, 'EmployType', EmployType, COUNT(*) FROM #Job WITH(NOLOCK)
- GROUP BY EmployType ORDER BY EmployType
- INSERT INTO SearchDB..paSearchCount_3(paSearchConditionID, Title, TitleId, TitleValue)
- SELECT @paSearchConditionID, 'CompanySize', dcCompanySizeID, COUNT(*) FROM #Job WITH(NOLOCK)
- GROUP BY dcCompanySizeID ORDER BY dcCompanySizeID
- INSERT INTO SearchDB..paSearchJobID_3(paSearchConditionID, JobId, IsTop)
- SELECT Top 3 @paSearchConditionID, a.JobId, 1
- FROM SearchJobTop a WITH(NOLOCK), (SELECT TOP 2000 ID FROM #Job WITH(NOLOCK)) b
- WHERE b.ID = a.JobId ORDER BY a.OpenDate DESC
- SET @TopRows = @@ROWCOUNT
- INSERT INTO SearchDB..paSearchJobID_3(paSearchConditionID, JobId, IsTop)
- SELECT TOP 2000 @paSearchConditionID, ID, 0 FROM #Job WITH(NOLOCK)
- SET @AllRows = @@ROWCOUNT
- IF @TopRows = 0 AND @AllRows > 100
- UPDATE SearchDB..paSearchJobID_3 SET IsTop = 1
- WHERE paSearchConditionID = @paSearchConditionID
- AND ID IN (SELECT TOP 3 ID FROM SearchDB..paSearchJobID_3 WITH(NOLOCK) WHERE paSearchConditionID = @paSearchConditionID)
- END
- DROP TABLE #Job
- --PRINT 'DROP #JOB ' + CONVERT(VARCHAR(30), GETDATE(), 121)
- COMMIT
- --GOTO GetRecordSet
- GetRecordSet:
- BEGIN
- ----返回查询数量
- SELECT ValidJobNumber FROM SearchDB..paSearchCondition WITH(NOLOCK) WHERE ID=@paSearchConditionID
- UPDATE SearchDB..paSearchCondition SET ReuseNumber = ReuseNumber + 1 WHERE ID=@paSearchConditionID
- ----返回20行查询结果
- IF (@TableID = 0)
- BEGIN
- SELECT @MinId = MIN(ID) FROM SearchDB..paSearchJobID_0 WITH(NOLOCK) WHERE paSearchConditionID=@paSearchConditionID
- SET @MinId = @MinId+(@PageNumber-1)*@PageSize
- SELECT TOP 30 a.ID, a.cpMainID, a.caMainID, a.Name as JobName, a.dcJobTypeID,
- a.dcJobTypeIDMinor, a.NeedNumber, a.dcSalaryID, a.dcSalaryIDMax, a.EmployType,
- a.dcRegionID, a.Responsibility, a.Demand, a.dcEducationID,
- a.MinExperience, a.MinAge, a.MaxAge, a.IssueDate, a.IssueEND,
- a.IsDelete, a.AddDate, a.RefreshDate, a.Lng, a.Lat,
- a.LastModifyDate, b.Name as cpName, b.dcCompanySizeID,
- b.HasLicence, b.UnLimitedDate, b.BalanceDate, b.Balance,
- b.MemberType, STUFF((SELECT ','+LTRIM(x.dcIndustryid)+',c'+LTRIM(isnull(y.Category,0))
- FROM cpIndustry x,dcIndustry y WHERE x.dcIndustryid = y.id
- AND x.cpMainid = b.id FOR XML PATH('')),1,1,'') cpIndustry,
- c.IsTop, b.IsRefreshed, a.SecondId EnJobID, b.SecondId EnCpMainID, a.Welfare1,a.Welfare2,
- a.Welfare3, a.Welfare4,a.Welfare5,a.Welfare6,a.Welfare7,a.Welfare8, a.Welfare9,a.Welfare10,
- a.Welfare11,a.Welfare12,a.Welfare13, a.Welfare14,a.Welfare15,a.Welfare16,a.Welfare17,a.Welfare18,a.Welfare19, dbo.GetCaOnlineStatus(a.caMainID) AS IsOnline,
- CASE WHEN b.ReplyRate >= 0.6 THEN b.ReplyRate ELSE NULL END Replyrate, b.RealName
- FROM JobPublish a WITH(NOLOCK), cpMainPublish b WITH(NOLOCK), SearchDB..paSearchJobID_0 c WITH(NOLOCK)
- WHERE a.cpMainID = b.ID AND a.id=c.JobID AND c.paSearchConditionID=@paSearchConditionID
- AND c.ID>=@MinId ORDER BY c.ID, a.ID DESC
- END
- ELSE IF (@TableID = 1)
- BEGIN
- SELECT @MinId = MIN(ID) FROM SearchDB..paSearchJobID_1 WITH(NOLOCK) WHERE paSearchConditionID=@paSearchConditionID
- SET @MinId = @MinId+(@PageNumber-1)*@PageSize
- SELECT TOP 30 a.ID, a.cpMainID, a.caMainID, a.Name as JobName, a.dcJobTypeID,
- a.dcJobTypeIDMinor, a.NeedNumber, a.dcSalaryID, a.dcSalaryIDMax, a.EmployType,
- a.dcRegionID, a.Responsibility, a.Demand, a.dcEducationID,
- a.MinExperience, a.MinAge, a.MaxAge, a.IssueDate, a.IssueEND,
- a.IsDelete, a.AddDate, a.RefreshDate, a.Lng, a.Lat,
- a.LastModifyDate, b.Name as cpName, b.dcCompanySizeID,
- b.HasLicence, b.UnLimitedDate, b.BalanceDate, b.Balance,
- b.MemberType, STUFF((SELECT ','+LTRIM(x.dcIndustryid)+',c'+LTRIM(isnull(y.Category,0))
- FROM cpIndustry x,dcIndustry y WHERE x.dcIndustryid = y.id
- AND x.cpMainid = b.id FOR XML PATH('')),1,1,'') cpIndustry,
- c.IsTop, b.IsRefreshed, a.SecondId EnJobID, b.SecondId EnCpMainID, a.Welfare1,a.Welfare2,
- a.Welfare3, a.Welfare4,a.Welfare5,a.Welfare6,a.Welfare7,a.Welfare8, a.Welfare9,a.Welfare10,
- a.Welfare11,a.Welfare12,a.Welfare13, a.Welfare14,a.Welfare15,a.Welfare16,a.Welfare17,a.Welfare18,a.Welfare19, dbo.GetCaOnlineStatus(a.caMainID) AS IsOnline,
- CASE WHEN b.ReplyRate >= 0.6 THEN b.ReplyRate ELSE NULL END Replyrate, b.RealName
- FROM JobPublish a WITH(NOLOCK), cpMainPublish b WITH(NOLOCK), SearchDB..paSearchJobID_1 c WITH(NOLOCK)
- WHERE a.cpMainID = b.ID AND a.id=c.JobID AND c.paSearchConditionID=@paSearchConditionID
- AND c.ID>=@MinId ORDER BY c.ID, a.ID DESC
- END
- ELSE IF (@TableID = 2)
- BEGIN
- SELECT @MinId = MIN(ID) FROM SearchDB..paSearchJobID_2 WITH(NOLOCK) WHERE paSearchConditionID=@paSearchConditionID
- SET @MinId = @MinId+(@PageNumber-1)*@PageSize
- SELECT TOP 30 a.ID, a.cpMainID, a.caMainID, a.Name as JobName, a.dcJobTypeID,
- a.dcJobTypeIDMinor, a.NeedNumber, a.dcSalaryID, a.dcSalaryIDMax, a.EmployType,
- a.dcRegionID, a.Responsibility, a.Demand, a.dcEducationID,
- a.MinExperience, a.MinAge, a.MaxAge, a.IssueDate, a.IssueEND,
- a.IsDelete, a.AddDate, a.RefreshDate, a.Lng, a.Lat,
- a.LastModifyDate, b.Name as cpName, b.dcCompanySizeID,
- b.HasLicence, b.UnLimitedDate, b.BalanceDate, b.Balance,
- b.MemberType, STUFF((SELECT ','+LTRIM(x.dcIndustryid)+',c'+LTRIM(isnull(y.Category,0))
- FROM cpIndustry x,dcIndustry y WHERE x.dcIndustryid = y.id
- AND x.cpMainid = b.id FOR XML PATH('')),1,1,'') cpIndustry,
- c.IsTop, b.IsRefreshed, a.SecondId EnJobID, b.SecondId EnCpMainID, a.Welfare1,a.Welfare2,
- a.Welfare3, a.Welfare4,a.Welfare5,a.Welfare6,a.Welfare7,a.Welfare8, a.Welfare9,a.Welfare10,
- a.Welfare11,a.Welfare12,a.Welfare13, a.Welfare14,a.Welfare15,a.Welfare16,a.Welfare17,a.Welfare18,a.Welfare19, dbo.GetCaOnlineStatus(a.caMainID) AS IsOnline,
- CASE WHEN b.ReplyRate >= 0.6 THEN b.ReplyRate ELSE NULL END Replyrate, b.RealName
- FROM JobPublish a WITH(NOLOCK), cpMainPublish b WITH(NOLOCK), SearchDB..paSearchJobID_2 c WITH(NOLOCK)
- WHERE a.cpMainID = b.ID AND a.id=c.JobID AND c.paSearchConditionID=@paSearchConditionID
- AND c.ID>=@MinId ORDER BY c.ID, a.ID DESC
- END
- ELSE IF (@TableID = 3)
- BEGIN
- SELECT @MinId = MIN(ID) FROM SearchDB..paSearchJobID_3 WITH(NOLOCK) WHERE paSearchConditionID=@paSearchConditionID
- SET @MinId = @MinId+(@PageNumber-1)*@PageSize
- SELECT TOP 30 a.ID, a.cpMainID, a.caMainID, a.Name as JobName, a.dcJobTypeID,
- a.dcJobTypeIDMinor, a.NeedNumber, a.dcSalaryID, a.dcSalaryIDMax, a.EmployType,
- a.dcRegionID, a.Responsibility, a.Demand, a.dcEducationID,
- a.MinExperience, a.MinAge, a.MaxAge, a.IssueDate, a.IssueEND,
- a.IsDelete, a.AddDate, a.RefreshDate, a.Lng, a.Lat,
- a.LastModifyDate, b.Name as cpName, b.dcCompanySizeID,
- b.HasLicence, b.UnLimitedDate, b.BalanceDate, b.Balance,
- b.MemberType, STUFF((SELECT ','+LTRIM(x.dcIndustryid)+',c'+LTRIM(isnull(y.Category,0))
- FROM cpIndustry x,dcIndustry y WHERE x.dcIndustryid = y.id
- AND x.cpMainid = b.id FOR XML PATH('')),1,1,'') cpIndustry,
- c.IsTop, b.IsRefreshed, a.SecondId EnJobID, b.SecondId EnCpMainID, a.Welfare1,a.Welfare2,
- a.Welfare3, a.Welfare4,a.Welfare5,a.Welfare6,a.Welfare7,a.Welfare8, a.Welfare9,a.Welfare10,
- a.Welfare11,a.Welfare12,a.Welfare13, a.Welfare14,a.Welfare15,a.Welfare16,a.Welfare17,a.Welfare18,a.Welfare19, dbo.GetCaOnlineStatus(a.caMainID) AS IsOnline,
- CASE WHEN b.ReplyRate >= 0.6 THEN b.ReplyRate ELSE NULL END Replyrate, b.RealName
- FROM JobPublish a WITH(NOLOCK), cpMainPublish b WITH(NOLOCK), SearchDB..paSearchJobID_3 c WITH(NOLOCK)
- WHERE a.cpMainID = b.ID AND a.id=c.JobID AND c.paSearchConditionID=@paSearchConditionID
- AND c.ID>=@MinId ORDER BY c.ID, a.ID DESC
- END
- --RICHARD 2011-7-23 16:51分修改
- ----返回统计数量
- IF @Type=1
- BEGIN
- IF (@TableID = 0)
- BEGIN
- SELECT * FROM SearchDB..paSearchCount_0 WITH(NOLOCK) WHERE Title = 'JobType' AND paSearchConditionID=@paSearchConditionID ORDER BY Title, CONVERT(VARCHAR(10), TitleID)
- SELECT * FROM SearchDB..paSearchCount_0 WITH(NOLOCK) WHERE Title = 'Region' AND paSearchConditionID=@paSearchConditionID ORDER BY Title, CONVERT(VARCHAR(10), TitleID)
- SELECT * FROM SearchDB..paSearchCount_0 WITH(NOLOCK) WHERE Title = 'Education' AND paSearchConditionID=@paSearchConditionID ORDER BY Title, CONVERT(INT, TitleID)
- SELECT * FROM SearchDB..paSearchCount_0 WITH(NOLOCK) WHERE Title = 'Experience' AND paSearchConditionID=@paSearchConditionID ORDER BY Title, CONVERT(INT, TitleID)
- SELECT * FROM SearchDB..paSearchCount_0 WITH(NOLOCK) WHERE Title = 'Salary' AND paSearchConditionID=@paSearchConditionID ORDER BY Title, CONVERT(INT, TitleID)
- SELECT * FROM SearchDB..paSearchCount_0 WITH(NOLOCK) WHERE Title = 'EmployType' AND paSearchConditionID=@paSearchConditionID ORDER BY Title, CONVERT(INT, TitleID)
- SELECT * FROM SearchDB..paSearchCount_0 WITH(NOLOCK) WHERE Title = 'CompanySize' AND paSearchConditionID=@paSearchConditionID ORDER BY Title, CONVERT(INT, TitleID)
- END
- IF (@TableID = 1)
- BEGIN
- SELECT * FROM SearchDB..paSearchCount_1 WITH(NOLOCK) WHERE Title = 'JobType' AND paSearchConditionID=@paSearchConditionID ORDER BY Title, CONVERT(VARCHAR(10), TitleID)
- SELECT * FROM SearchDB..paSearchCount_1 WITH(NOLOCK) WHERE Title = 'Region' AND paSearchConditionID=@paSearchConditionID ORDER BY Title, CONVERT(VARCHAR(10), TitleID)
- SELECT * FROM SearchDB..paSearchCount_1 WITH(NOLOCK) WHERE Title = 'Education' AND paSearchConditionID=@paSearchConditionID ORDER BY Title, CONVERT(INT, TitleID)
- SELECT * FROM SearchDB..paSearchCount_1 WITH(NOLOCK) WHERE Title = 'Experience' AND paSearchConditionID=@paSearchConditionID ORDER BY Title, CONVERT(INT, TitleID)
- SELECT * FROM SearchDB..paSearchCount_1 WITH(NOLOCK) WHERE Title = 'Salary' AND paSearchConditionID=@paSearchConditionID ORDER BY Title, CONVERT(INT, TitleID)
- SELECT * FROM SearchDB..paSearchCount_1 WITH(NOLOCK) WHERE Title = 'EmployType' AND paSearchConditionID=@paSearchConditionID ORDER BY Title, CONVERT(INT, TitleID)
- SELECT * FROM SearchDB..paSearchCount_1 WITH(NOLOCK) WHERE Title = 'CompanySize' AND paSearchConditionID=@paSearchConditionID ORDER BY Title, CONVERT(INT, TitleID)
- END
- IF (@TableID = 2)
- BEGIN
- SELECT * FROM SearchDB..paSearchCount_2 WITH(NOLOCK) WHERE Title = 'JobType' AND paSearchConditionID=@paSearchConditionID ORDER BY Title, CONVERT(VARCHAR(10), TitleID)
- SELECT * FROM SearchDB..paSearchCount_2 WITH(NOLOCK) WHERE Title = 'Region' AND paSearchConditionID=@paSearchConditionID ORDER BY Title, CONVERT(VARCHAR(10), TitleID)
- SELECT * FROM SearchDB..paSearchCount_2 WITH(NOLOCK) WHERE Title = 'Education' AND paSearchConditionID=@paSearchConditionID ORDER BY Title, CONVERT(INT, TitleID)
- SELECT * FROM SearchDB..paSearchCount_2 WITH(NOLOCK) WHERE Title = 'Experience' AND paSearchConditionID=@paSearchConditionID ORDER BY Title, CONVERT(INT, TitleID)
- SELECT * FROM SearchDB..paSearchCount_2 WITH(NOLOCK) WHERE Title = 'Salary' AND paSearchConditionID=@paSearchConditionID ORDER BY Title, CONVERT(INT, TitleID)
- SELECT * FROM SearchDB..paSearchCount_2 WITH(NOLOCK) WHERE Title = 'EmployType' AND paSearchConditionID=@paSearchConditionID ORDER BY Title, CONVERT(INT, TitleID)
- SELECT * FROM SearchDB..paSearchCount_2 WITH(NOLOCK) WHERE Title = 'CompanySize' AND paSearchConditionID=@paSearchConditionID ORDER BY Title, CONVERT(INT, TitleID)
- END
- IF (@TableID = 3)
- BEGIN
- SELECT * FROM SearchDB..paSearchCount_3 WITH(NOLOCK) WHERE Title = 'JobType' AND paSearchConditionID=@paSearchConditionID ORDER BY Title, CONVERT(VARCHAR(10), TitleID)
- SELECT * FROM SearchDB..paSearchCount_3 WITH(NOLOCK) WHERE Title = 'Region' AND paSearchConditionID=@paSearchConditionID ORDER BY Title, CONVERT(VARCHAR(10), TitleID)
- SELECT * FROM SearchDB..paSearchCount_3 WITH(NOLOCK) WHERE Title = 'Education' AND paSearchConditionID=@paSearchConditionID ORDER BY Title, CONVERT(INT, TitleID)
- SELECT * FROM SearchDB..paSearchCount_3 WITH(NOLOCK) WHERE Title = 'Experience' AND paSearchConditionID=@paSearchConditionID ORDER BY Title, CONVERT(INT, TitleID)
- SELECT * FROM SearchDB..paSearchCount_3 WITH(NOLOCK) WHERE Title = 'Salary' AND paSearchConditionID=@paSearchConditionID ORDER BY Title, CONVERT(INT, TitleID)
- SELECT * FROM SearchDB..paSearchCount_3 WITH(NOLOCK) WHERE Title = 'EmployType' AND paSearchConditionID=@paSearchConditionID ORDER BY Title, CONVERT(INT, TitleID)
- SELECT * FROM SearchDB..paSearchCount_3 WITH(NOLOCK) WHERE Title = 'CompanySize' AND paSearchConditionID=@paSearchConditionID ORDER BY Title, CONVERT(INT, TitleID)
- END
- END
- RETURN
- END
- END TRY
- BEGIN CATCH
- ---检查是否已经建立临时表,已经建立则删除
- DECLARE @para VARCHAR(MAX)
- SET @para = '@dcJobTypeID=' + ISNULL(@dcJobTypeID, '') + '|' +
- '@dcIndustryID=' + ISNULL(@dcIndustryID, '') + '|' +
- '@EmployType=' + ISNULL(@EmployType, '') + '|' +
- '@KeyWord=' + ISNULL(@KeyWord, '')
- INSERT INTO ErrorLog
- SELECT 'p3 ' +ISNULL(error_Message(), ' no msg')+ ' para=' + ISNULL(@Para, 'no para ') + ISNULL(@SQL, ' no sql'), error_number(), error_line(), GETDATE()
- END CATCH
- GO
- /****** Object: StoredProcedure [dbo].[pcJobByNewstSelect] Script Date: 2018/12/13 19:08:38 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- CREATE PROCEDURE [dbo].[pcJobByNewstSelect]
- (
- @dcProvinceID INT
- )
- AS
- SET NOCOUNT ON
- --insert proclog select 'pcJobByNewstSelect', @dcProvinceID, getdate()
- BEGIN
- IF NOT EXISTS(SELECT 'x' FROM SearchDb..JobNewst WHERE AddDate > DATEADD(MINUTE, -3, GETDATE()) AND ProvinceId = @dcProvinceID)
- BEGIN
- DELETE FROM SearchDb..JobNewst WHERE ProvinceId = @dcProvinceID
- INSERT INTO SearchDb..JobNewst(cpMainName, JobName, JobId, CpMainID, cpId, JId, ProvinceID, AddDate)
- SELECT TOP 10 a.Name, b.Name, b.ID, a.Id, a.SecondId, b.SecondId, @dcProvinceID, GETDATE()
- FROM cpMainPublish a WITH(NOLOCK)
- INNER JOIN JobPublish b WITH(NOLOCK) ON a.ID = b.cpMainId
- WHERE b.dcRegionID LIKE LTRIM(STR(@dcProvinceID)) + '%'
- AND a.Valid = 1
- AND b.Valid = 1
- AND a.MemberType > 1
- AND a.dcProvinceId = LEFT(@dcProvinceId, 2)
- ORDER BY b.ID DESC
- END
- SELECT cpMainName, JobName, JobId, CpMainID, cpId, JId FROM SearchDb..JobNewst WITH(NOLOCK) WHERE ProvinceId = @dcProvinceID
- END
- GO
- /****** Object: StoredProcedure [dbo].[pcJobByRecommendSelect] Script Date: 2018/12/13 19:08:38 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- CREATE PROCEDURE [dbo].[pcJobByRecommendSelect]
- (
- @dcJobTypeID VARCHAR(100), --职位类别
- @dcRegionID VARCHAR(100), --求职地区
- @dcIndustryID VARCHAR(100), --求职行业
- @dcSalaryID TINYINT, --月薪
- @MinExperience TINYINT, --工作经验,100为未选择
- @dcEducationID TINYINT, --最低学历
- @EmployType VARCHAR(10), --工作性质,1全职;3兼职;4实习
- @RowCount SMALLINT --需要显示的行数
- )
- AS
- SET NOCOUNT ON
- BEGIN
- SELECT @dcJobTypeID = RTRIM(dbo.FormatIDS(@dcJobTypeID)),
- @dcRegionID = RTRIM(dbo.FormatIDS(@dcRegionID)),
- @dcIndustryID = RTRIM(dbo.FormatIDS(@dcIndustryID)),
- @dcSalaryID = ISNULL(@dcSalaryID, 0),
- @MinExperience = ISNULL(@MinExperience, 100),
- @dcEducationID = ISNULL(@dcEducationID, 0),
- @EmployType = CASE @EmployType WHEN '2' THEN '1,3' ELSE ISNULL(@EmployType, '') END
- IF @dcJobTypeID LIKE '%,%,%,%,%,%'
- SET @dcJobTypeID = LEFT(@dcJobTypeID, 2)
- IF @dcRegionID LIKE '%,%,%,%,%,%'
- SET @dcRegionID = LEFT(@dcRegionID, 2)
- IF RIGHT(@dcJobTypeID, 1) = ','
- SET @dcJobTypeID = LEFT(@dcJobTypeID, LEN(@dcJobTypeID) - 1)
- IF RIGHT(@dcRegionID, 1) = ','
- SET @dcRegionID = LEFT(@dcRegionID, LEN(@dcRegionID) - 1)
- IF RIGHT(@dcIndustryID, 1) = ','
- SET @dcIndustryID = LEFT(@dcIndustryID, LEN(@dcIndustryID) - 1)
- ------生成职位类别的表变量,因为职位类别有包含(父子)关系
- DECLARE @T_JobPlace AS TABLE(ID INT)
- DECLARE @T_JobType AS TABLE(ID INT)
- DECLARE @JobType AS VARCHAR(3000)
- DECLARE @JobPlace AS VARCHAR(2000)
- DECLARE @SQL AS NVARCHAR(MAX)
- DECLARE @WHERE AS VARCHAR(8000)
- DECLARE @FROM AS VARCHAR(1000)
- SET @JobPlace = ''
- SET @JobType=''
- ----生成工作地点的表变量
- IF LEN(@dcRegionID) > 0
- BEGIN
- INSERT INTO @T_JobPlace
- SELECT * FROM dbo.fnSplit(@dcRegionID, ',')
- SELECT @JobPlace = (@JobPlace + ' OR a.dcRegionID Like ''' + LTRIM(STR(ID) + '%''')) FROM @T_JobPlace
- IF LEN(@JobPlace) > 0
- SET @JobPlace = RIGHT(@JobPlace, LEN(@JobPlace) -4)
- END
- ----生成求聘职位的表变量
- IF LEN(@dcJobTypeID) > 0
- BEGIN
- DECLARE @T_Temp AS TABLE(ID INT) --临时表,用于构建组合查询语句
- INSERT INTO @T_Temp
- SELECT * FROM dbo.fnSplit(@dcJobTypeID, ',')
- INSERT INTO @T_JobType
- SELECT DISTINCT ID FROM dcJobType WITH(NOLOCK)
- WHERE ParentId IN(SELECT ID FROM @T_TEMP)
- OR ParentId2 in(SELECT ID FROM @T_TEMP)
- OR ID IN(SELECT ID FROM @T_TEMP)
- ----生成in字符串
- SELECT @JobType = (@JobType + LTRIM(STR(ID) + ',')) FROM @T_JobType
- IF RIGHT(@JobType, 1) = ','
- SET @JobType = LEFT(@JobType, LEN(@JobType) - 1)
- END
- ----建立临时表
- CREATE TABLE #Job(
- RowID INT IDENTITY(1, 1),
- ID INT NOT NULL,
- dcJobTypeID SMALLINT NOT NULL,
- dcJobTypeIDMinor SMALLINT NULL,
- dcSalaryID TINYINT NOT NULL,
- dcRegionID VARCHAR(6) NULL,
- dcEducationID TINYINT NOT NULL,
- MinExperience TINYINT NOT NULL,
- RefreshDate SMALLDATETIME NULL
- )
- ----生成插入临时表的Sql语句
- SET @SQL = '
- INSERT INTO #Job
- SELECT TOP ' + CONVERT(VARCHAR(3),@RowCount) + ' a.ID, a.dcJobTypeID,
- a.dcJobTypeIDMinor, a.dcSalaryID,
- a.dcRegionID, a.dcEducationID, a.MinExperience,
- a.IssueDate'
- SET @FROM = '
- FROM JobPublish a WITH(NOLOCK)
- INNER JOIN cpMainPublish b WITH(NOLOCK) ON a.cpMainID=b.ID'
- ----职位有效,单位新有效
- IF LEN(@dcIndustryID) > 0
- SET @WHERE = '
- WHERE b.ID IN (SELECT cpMainID FROM cpIndustry WHERE dcIndustryId in(' + @dcIndustryID + '))
- AND a.Valid = 1
- AND b.Valid = 1'
- ELSE
- SET @WHERE = '
- WHERE a.Valid = 1
- AND b.Valid = 1'
- ----职位类别
- IF LEN(@dcJobTypeID) > 0
- SET @WHERE = @WHERE + '
- AND (a.dcJobTypeID IN(' + @JobType +')
- OR a.dcJobTypeIDMinor IN(' +@JobType + '))'
- IF LEN(@JobPlace) > 0
- SET @WHERE = @WHERE + '
- AND (' + @JobPlace + ')'
- IF @dcSalaryID > 0
- BEGIN
- IF @dcSalaryID < 100 ----从form中搜索,月薪跨2个级别, 是本级和上级别的薪金
- BEGIN
- SET @WHERE = @WHERE + '
- AND a.dcSalaryID IN(' + LTRIM(STR(@dcSalaryID)) + ',' + LTRIM(STR(@dcSalaryID + 1))
- SET @WHERE = @WHERE + ')'
- END
- IF @dcSalaryID = 100 ----从筛选结果中点击面议,值是100
- BEGIN
- SET @WHERE = @WHERE + '
- AND a.dcSalaryID = 100'
- END
- IF @dcSalaryID > 100 ----从筛选结果中点击搜索,月薪只有1个级别,传值时增加100
- SET @WHERE = @WHERE + '
- AND a.dcSalaryID=' + LTRIM(STR(@dcSalaryID-100))
- END
- ----工作经验要求
- IF @MinExperience < 100
- SET @WHERE = @WHERE + '
- AND a.MinExperience = ' + LTRIM(STR(@MinExperience))
- ----学历要求
- ----'1初中', '2\3\4高中、中技、中专', '5大专', '6本科', '7硕士', '8博士
- IF @dcEducationID > 0
- IF @dcEducationID = 2
- SET @WHERE = @WHERE + '
- AND a.dcEducationID IN(2, 3, 4)'
- ELSE
- SET @WHERE = @WHERE + '
- AND a.dcEducationID = ' + LTRIM(STR(@dcEducationID))
- ----1、全职;3、兼职;4实习。 2、全职/兼职 职位中无此项
- IF LEN(@EmployType) > 0
- SET @WHERE = @WHERE + '
- AND a.EmployType IN (' + @EmployType + ')'
- SET @SQL = @SQL + @FROM + @WHERE
- SET @SQL = @SQL + ' ORDER BY a.RefreshDate DESC, a.ID'
- EXEC(@SQL)
- DECLARE @CurrentCount AS SMALLINT
- DECLARE @NeedCount AS SMALLINT
- SELECT @CurrentCount = COUNT(*) FROM #Job
- IF @CurrentCount < @RowCount
- BEGIN
- SET @NeedCount = @RowCount - @CurrentCount
- ----生成插入临时表的Sql语句
- SET @SQL = '
- INSERT INTO #Job
- SELECT TOP ' + CONVERT(VARCHAR(3),@NeedCount) + ' a.ID, a.dcJobTypeID,
- a.dcJobTypeIDMinor, a.dcSalaryID,
- a.dcRegionID, a.dcEducationID, a.MinExperience,
- a.IssueDate'
- SET @FROM = '
- FROM JobPublish a WITH(NOLOCK)
- INNER JOIN cpMainPublish b WITH(NOLOCK) ON a.cpMainID=b.ID'
- ----职位有效,单位新有效
- SET @WHERE = '
- WHERE a.Valid = 1
- AND b.Valid = 1 AND a.ID NOT IN(SELECT ID FROM #Job)'
- ----职位类别
- IF LEN(@dcJobTypeID) > 0
- SET @WHERE = @WHERE + '
- AND (a.dcJobTypeID IN(' + @JobType +')
- OR a.dcJobTypeIDMinor IN(' +@JobType + '))'
- IF LEN(@JobPlace) > 0
- SET @WHERE = @WHERE + '
- AND (' + @JobPlace + ')'
- SET @SQL = @SQL + @FROM + @WHERE
- SET @SQL = @SQL + ' ORDER BY a.RefreshDate DESC, a.ID'
- EXEC(@SQL)
- SELECT @CurrentCount = COUNT(*) FROM #Job
- IF @CurrentCount < @RowCount
- BEGIN
- SET @NeedCount = @RowCount - @CurrentCount
- --将工作地点扩大一级
- DECLARE @T_JobPlaceDistinct AS TABLE(ID INT)
- UPDATE @T_JobPlace SET ID = LEFT(ID,LEN(ID)-2) WHERE LEN(ID) > 2
- INSERT INTO @T_JobPlaceDistinct SELECT DISTINCT ID FROM @T_JobPlace
- SELECT @JobPlace = ''
- SELECT @JobPlace = (@JobPlace + ' OR a.dcRegionID Like ''' + LTRIM(STR(ID) + '%''')) FROM @T_JobPlaceDistinct
- IF LEN(@JobPlace) > 0
- SET @JobPlace = RIGHT(@JobPlace, LEN(@JobPlace) -4)
- --将职位类别扩大一级
- UPDATE @T_TEMP SET ID = LEFT(ID,LEN(ID)-2) WHERE LEN(ID) > 2
- DELETE FROM @T_JobType
- INSERT INTO @T_JobType
- SELECT DISTINCT ID FROM dcJobType WITH(NOLOCK)
- WHERE ParentId IN(SELECT ID FROM @T_TEMP)
- OR ParentId2 in(SELECT ID FROM @T_TEMP)
- OR ID IN(SELECT ID FROM @T_TEMP)
- SELECT @JobType = ''
- SELECT @JobType = (@JobType + LTRIM(STR(ID) + ',')) FROM @T_JobType
- IF RIGHT(@JobType, 1) = ','
- SET @JobType = LEFT(@JobType, LEN(@JobType) - 1)
- ----生成插入临时表的Sql语句
- SET @SQL = '
- INSERT INTO #Job
- SELECT TOP ' + CONVERT(VARCHAR(3),@NeedCount) + ' a.ID, a.dcJobTypeID,
- a.dcJobTypeIDMinor, a.dcSalaryID,
- a.dcRegionID, a.dcEducationID, a.MinExperience,
- a.IssueDate'
- SET @FROM = '
- FROM JobPublish a WITH(NOLOCK)
- INNER JOIN cpMainPublish b WITH(NOLOCK) ON a.cpMainID=b.ID'
- ----职位有效,单位新有效
- SET @WHERE = '
- WHERE a.Valid = 1
- AND b.Valid = 1 AND a.ID NOT IN(SELECT ID FROM #Job)'
- ----职位类别
- IF LEN(@dcJobTypeID) > 0
- SET @WHERE = @WHERE + '
- AND (a.dcJobTypeID IN(' + @JobType +')
- OR a.dcJobTypeIDMinor IN(' +@JobType + '))'
- IF LEN(@JobPlace) > 0
- SET @WHERE = @WHERE + '
- AND (' + @JobPlace + ')'
- SET @SQL = @SQL + @FROM + @WHERE
- SET @SQL = @SQL + ' ORDER BY a.RefreshDate DESC, a.ID'
- EXEC(@SQL)
- END
- END
- SELECT TOP 20 a.ID, a.cpMainID, a.caMainID, a.Name as JobName, a.dcJobTypeID,
- a.dcJobTypeIDMinor, a.NeedNumber, a.dcSalaryID, a.dcSalaryIDMax, a.EmployType,
- a.dcRegionID, a.Responsibility, a.Demand, a.dcEducationID,
- a.MinExperience, a.MinAge, a.MaxAge, a.IssueDate, a.IssueEND,
- a.IsDelete, a.AddDate, a.RefreshDate, a.SecondId EnJobID, b.SecondId EnCpMainID,
- a.LastModifyDate, b.Name as cpName, b.dcCompanySizeID,
- b.HasLicence, b.UnLimitedDate, b.BalanceDate, b.Balance,
- ISNULL((SELECT IsOnline FROM caOnline WHERE caMainId =a.caMainID), 0) AS IsOnline,
- b.MemberType, STUFF((SELECT ','+LTRIM(x.dcIndustryid)+',c'+LTRIM(isnull(y.Category,0))
- FROM cpIndustry x,dcIndustry y WHERE x.dcIndustryid = y.id
- AND x.cpMainid = b.id FOR XML PATH('')),1,1,'') cpIndustry, b.IsRefreshed,
- dbo.GetCaOnlineStatus(a.caMainID) AS IsOnline, CASE WHEN b.ReplyRate >= 0.6 THEN b.ReplyRate ELSE NULL END Replyrate
- FROM JobPublish a WITH(NOLOCK), cpMainPublish b WITH(NOLOCK), #Job c WITH(NOLOCK)
- WHERE a.cpMainID = b.ID AND a.ID = c.ID ORDER BY c.RowID
- END
- GO
- /****** Object: StoredProcedure [dbo].[pcJobByRecommendSelectNew] Script Date: 2018/12/13 19:08:38 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- CREATE PROCEDURE [dbo].[pcJobByRecommendSelectNew]
- (
- @dcJobTypeID VARCHAR(100), --职位类别
- @dcRegionID VARCHAR(100), --求职地区
- @dcIndustryID VARCHAR(100), --求职行业
- @dcSalaryID TINYINT, --月薪
- @MinExperience TINYINT, --工作经验,100为未选择
- @dcEducationID TINYINT, --最低学历
- @EmployType VARCHAR(10), --工作性质,1全职;3兼职;4实习
- @RowCount SMALLINT --需要显示的行数
- )
- AS
- --INSERT INTO procLog SELECT 'pcJobByRecommendSelectNew', '', GETDATE()
- BEGIN
- SELECT @dcJobTypeID = RTRIM(dbo.FormatIDS(@dcJobTypeID)),
- @dcRegionID = RTRIM(dbo.FormatIDS(@dcRegionID)),
- @dcIndustryID = RTRIM(dbo.FormatIDS(@dcIndustryID)),
- @dcSalaryID = ISNULL(@dcSalaryID, 0),
- @MinExperience = ISNULL(@MinExperience, 100),
- @dcEducationID = ISNULL(@dcEducationID, 0),
- @EmployType = CASE @EmployType WHEN '2' THEN '1,3' ELSE ISNULL(@EmployType, '') END
- IF @dcJobTypeID LIKE '%,%,%,%,%,%'
- SET @dcJobTypeID = LEFT(@dcJobTypeID, 2)
- IF @dcRegionID LIKE '%,%,%,%,%,%'
- SET @dcRegionID = LEFT(@dcRegionID, 2)
- IF RIGHT(@dcJobTypeID, 1) = ','
- SET @dcJobTypeID = LEFT(@dcJobTypeID, LEN(@dcJobTypeID) - 1)
- IF RIGHT(@dcRegionID, 1) = ','
- SET @dcRegionID = LEFT(@dcRegionID, LEN(@dcRegionID) - 1)
- IF RIGHT(@dcIndustryID, 1) = ','
- SET @dcIndustryID = LEFT(@dcIndustryID, LEN(@dcIndustryID) - 1)
- ------生成职位类别的表变量,因为职位类别有包含(父子)关系
- DECLARE @T_JobPlace AS TABLE(ID INT)
- DECLARE @T_JobType AS TABLE(ID INT)
- DECLARE @JobType AS VARCHAR(3000)
- DECLARE @JobPlace AS VARCHAR(2000)
- DECLARE @SQL AS NVARCHAR(MAX)
- DECLARE @WHERE AS VARCHAR(8000)
- DECLARE @FROM AS VARCHAR(1000)
- SET @JobPlace = ''
- SET @JobType=''
- ----生成工作地点的表变量
- IF LEN(@dcRegionID) > 0
- BEGIN
- INSERT INTO @T_JobPlace
- SELECT * FROM dbo.fnSplit(@dcRegionID, ',')
- SELECT @JobPlace = (@JobPlace + ' OR a.dcRegionID Like ''' + LTRIM(STR(ID) + '%''')) FROM @T_JobPlace
- IF LEN(@JobPlace) > 0
- SET @JobPlace = RIGHT(@JobPlace, LEN(@JobPlace) -4)
- END
- ----生成求聘职位的表变量
- IF LEN(@dcJobTypeID) > 0
- BEGIN
- DECLARE @T_Temp AS TABLE(ID INT) --临时表,用于构建组合查询语句
- INSERT INTO @T_Temp
- SELECT * FROM dbo.fnSplit(@dcJobTypeID, ',')
- INSERT INTO @T_JobType
- SELECT DISTINCT ID FROM dcJobType WITH(NOLOCK)
- WHERE ParentId IN(SELECT ID FROM @T_TEMP)
- OR ParentId2 in(SELECT ID FROM @T_TEMP)
- OR ID IN(SELECT ID FROM @T_TEMP)
- ----生成in字符串
- SELECT @JobType = (@JobType + LTRIM(STR(ID) + ',')) FROM @T_JobType
- IF RIGHT(@JobType, 1) = ','
- SET @JobType = LEFT(@JobType, LEN(@JobType) - 1)
- END
- ----建立临时表
- CREATE TABLE #Job(
- RowID INT IDENTITY(1, 1),
- ID INT NOT NULL,
- dcJobTypeID SMALLINT NOT NULL,
- dcJobTypeIDMinor SMALLINT NULL,
- dcSalaryID TINYINT NOT NULL,
- dcRegionID VARCHAR(6) NULL,
- dcEducationID TINYINT NOT NULL,
- MinExperience TINYINT NOT NULL,
- RefreshDate SMALLDATETIME NULL
- )
- ----生成插入临时表的Sql语句
- SET @SQL = '
- INSERT INTO #Job
- SELECT TOP ' + CONVERT(VARCHAR(3),@RowCount) + ' a.ID, a.dcJobTypeID,
- a.dcJobTypeIDMinor, a.dcSalaryID,
- a.dcRegionID, a.dcEducationID, a.MinExperience,
- a.IssueDate'
- SET @FROM = '
- FROM JobPublish a WITH(NOLOCK)
- INNER JOIN cpMainPublish b WITH(NOLOCK) ON a.cpMainID=b.ID'
- ----职位有效,单位新有效
- IF LEN(@dcIndustryID) > 0
- SET @WHERE = '
- WHERE b.ID IN (SELECT cpMainID FROM cpIndustry WHERE dcIndustryId in(' + @dcIndustryID + '))
- AND a.Valid = 1
- AND b.Valid = 1'
- ELSE
- SET @WHERE = '
- WHERE a.Valid = 1
- AND b.Valid = 1'
- ----职位类别
- IF LEN(@dcJobTypeID) > 0
- SET @WHERE = @WHERE + '
- AND (a.dcJobTypeID IN(' + @JobType +')
- OR a.dcJobTypeIDMinor IN(' +@JobType + '))'
- IF LEN(@JobPlace) > 0
- SET @WHERE = @WHERE + '
- AND (' + @JobPlace + ')'
- IF @dcSalaryID > 0
- BEGIN
- IF @dcSalaryID < 100 ----从form中搜索,月薪跨2个级别, 是本级和上级别的薪金
- BEGIN
- SET @WHERE = @WHERE + '
- AND a.dcSalaryID IN(' + LTRIM(STR(@dcSalaryID)) + ',' + LTRIM(STR(@dcSalaryID + 1))
- SET @WHERE = @WHERE + ')'
- END
- IF @dcSalaryID = 100 ----从筛选结果中点击面议,值是100
- BEGIN
- SET @WHERE = @WHERE + '
- AND a.dcSalaryID = 100'
- END
- IF @dcSalaryID > 100 ----从筛选结果中点击搜索,月薪只有1个级别,传值时增加100
- SET @WHERE = @WHERE + '
- AND a.dcSalaryID=' + LTRIM(STR(@dcSalaryID-100))
- END
- ----工作经验要求
- IF @MinExperience < 100
- SET @WHERE = @WHERE + '
- AND a.MinExperience = ' + LTRIM(STR(@MinExperience))
- ----学历要求
- ----'1初中', '2\3\4高中、中技、中专', '5大专', '6本科', '7硕士', '8博士
- IF @dcEducationID > 0
- IF @dcEducationID = 2
- SET @WHERE = @WHERE + '
- AND a.dcEducationID IN(2, 3, 4)'
- ELSE
- SET @WHERE = @WHERE + '
- AND a.dcEducationID = ' + LTRIM(STR(@dcEducationID))
- ----1、全职;3、兼职;4实习。 2、全职/兼职 职位中无此项
- IF LEN(@EmployType) > 0
- SET @WHERE = @WHERE + '
- AND a.EmployType IN (' + @EmployType + ')'
- SET @SQL = @SQL + @FROM + @WHERE
- SET @SQL = @SQL + ' ORDER BY a.RefreshDate DESC, a.ID'
- EXEC(@SQL)
- DECLARE @CurrentCount AS SMALLINT
- DECLARE @NeedCount AS SMALLINT
- SELECT @CurrentCount = COUNT(*) FROM #Job
- IF @CurrentCount < @RowCount
- BEGIN
- SET @NeedCount = @RowCount - @CurrentCount
- ----生成插入临时表的Sql语句
- SET @SQL = '
- INSERT INTO #Job
- SELECT TOP ' + CONVERT(VARCHAR(3),@NeedCount) + ' a.ID, a.dcJobTypeID,
- a.dcJobTypeIDMinor, a.dcSalaryID,
- a.dcRegionID, a.dcEducationID, a.MinExperience,
- a.IssueDate'
- SET @FROM = '
- FROM JobPublish a WITH(NOLOCK)
- INNER JOIN cpMainPublish b WITH(NOLOCK) ON a.cpMainID=b.ID'
- ----职位有效,单位新有效
- SET @WHERE = '
- WHERE a.Valid = 1
- AND b.Valid = 1 AND a.ID NOT IN(SELECT ID FROM #Job)'
- ----职位类别
- IF LEN(@dcJobTypeID) > 0
- SET @WHERE = @WHERE + '
- AND (a.dcJobTypeID IN(' + @JobType +')
- OR a.dcJobTypeIDMinor IN(' +@JobType + '))'
- IF LEN(@JobPlace) > 0
- SET @WHERE = @WHERE + '
- AND (' + @JobPlace + ')'
- SET @SQL = @SQL + @FROM + @WHERE
- SET @SQL = @SQL + ' ORDER BY a.RefreshDate DESC, a.ID'
- EXEC(@SQL)
- SELECT @CurrentCount = COUNT(*) FROM #Job
- IF @CurrentCount < @RowCount
- BEGIN
- SET @NeedCount = @RowCount - @CurrentCount
- --将工作地点扩大一级
- DECLARE @T_JobPlaceDistinct AS TABLE(ID INT)
- UPDATE @T_JobPlace SET ID = LEFT(ID,LEN(ID)-2) WHERE LEN(ID) > 2
- INSERT INTO @T_JobPlaceDistinct SELECT DISTINCT ID FROM @T_JobPlace
- SELECT @JobPlace = ''
- SELECT @JobPlace = (@JobPlace + ' OR a.dcRegionID Like ''' + LTRIM(STR(ID) + '%''')) FROM @T_JobPlaceDistinct
- IF LEN(@JobPlace) > 0
- SET @JobPlace = RIGHT(@JobPlace, LEN(@JobPlace) -4)
- --将职位类别扩大一级
- UPDATE @T_TEMP SET ID = LEFT(ID,LEN(ID)-2) WHERE LEN(ID) > 2
- DELETE FROM @T_JobType
- INSERT INTO @T_JobType
- SELECT DISTINCT ID FROM dcJobType WITH(NOLOCK)
- WHERE ParentId IN(SELECT ID FROM @T_TEMP)
- OR ParentId2 in(SELECT ID FROM @T_TEMP)
- OR ID IN(SELECT ID FROM @T_TEMP)
- SELECT @JobType = ''
- SELECT @JobType = (@JobType + LTRIM(STR(ID) + ',')) FROM @T_JobType
- IF RIGHT(@JobType, 1) = ','
- SET @JobType = LEFT(@JobType, LEN(@JobType) - 1)
- ----生成插入临时表的Sql语句
- SET @SQL = '
- INSERT INTO #Job
- SELECT TOP ' + CONVERT(VARCHAR(3),@NeedCount) + ' a.ID, a.dcJobTypeID,
- a.dcJobTypeIDMinor, a.dcSalaryID,
- a.dcRegionID, a.dcEducationID, a.MinExperience,
- a.IssueDate'
- SET @FROM = '
- FROM JobPublish a WITH(NOLOCK)
- INNER JOIN cpMainPublish b WITH(NOLOCK) ON a.cpMainID=b.ID'
- ----职位有效,单位新有效
- SET @WHERE = '
- WHERE a.Valid = 1
- AND b.Valid = 1 AND a.ID NOT IN(SELECT ID FROM #Job)'
- ----职位类别
- IF LEN(@dcJobTypeID) > 0
- SET @WHERE = @WHERE + '
- AND (a.dcJobTypeID IN(' + @JobType +')
- OR a.dcJobTypeIDMinor IN(' +@JobType + '))'
- IF LEN(@JobPlace) > 0
- SET @WHERE = @WHERE + '
- AND (' + @JobPlace + ')'
- SET @SQL = @SQL + @FROM + @WHERE
- SET @SQL = @SQL + ' ORDER BY a.RefreshDate DESC, a.ID'
- EXEC(@SQL)
- END
- END
- SELECT TOP 20 a.ID, a.cpMainID, a.caMainID, a.Name as JobName, a.dcJobTypeID,
- a.dcJobTypeIDMinor, a.NeedNumber, a.dcSalaryID, a.EmployType,
- a.dcRegionID, a.Responsibility, a.Demand, a.dcEducationID,
- a.MinExperience, a.MinAge, a.MaxAge, a.IssueDate, a.IssueEND,
- a.IsDelete, a.AddDate, a.RefreshDate, a.SecondId EnJobID, b.SecondId EnCpMainID,
- a.LastModifyDate, b.Name as cpName, b.dcCompanySizeID,
- b.HasLicence, b.UnLimitedDate, b.BalanceDate, b.Balance,
- ISNULL((SELECT IsOnline FROM caOnline WHERE caMainId =a.caMainID), 0) AS IsOnline,
- b.MemberType, STUFF((SELECT ','+LTRIM(x.dcIndustryid)+',c'+LTRIM(isnull(y.Category,0))
- FROM cpIndustry x,dcIndustry y WHERE x.dcIndustryid = y.id
- AND x.cpMainid = b.id FOR XML PATH('')),1,1,'') cpIndustry, b.IsRefreshed,
- dbo.GetCaOnlineStatus(a.caMainID) AS IsOnline
- FROM JobPublish a WITH(NOLOCK), cpMainPublish b WITH(NOLOCK), #Job c WITH(NOLOCK)
- WHERE a.cpMainID = b.ID AND a.ID = c.ID ORDER BY c.RowID
- END
- GO
- /****** Object: StoredProcedure [dbo].[pcJobBySearchSelect] Script Date: 2018/12/13 19:08:38 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- CREATE proCEDURE [dbo].[pcJobBySearchSelect]
- (
- @dcJobTypeID VARCHAR(100), --职位类别
- @dcRegionID VARCHAR(100), --求职地区
- @dcIndustryID VARCHAR(100), --求职行业
- @dcSalaryID TINYINT, --月薪
- @IsNegotiable BIT, --1允许面议,不面议
- @MinExperience TINYINT, --工作经验,100为未选择
- @dcEducationID TINYINT, --最低学历
- @EmployType VARCHAR(10), --工作性质,1全职;3兼职;4实习,
- @KeyWord NVARCHAR(50), --关键词
- @KeyType TINYINT, --搜索类别,0无;1-全文;2-职位;3-公司
- @ORDER VARCHAR(100), --显示顺序,没有用
- @RefreshNo INT, --1, 1天内;2, 3天内;3,一周内;4,15天内;5,一个月内;6超过一个月
- @Type INT, --1:主动搜索 点击搜索按钮 10分钟,翻页60分钟有效;0:翻页搜索,不刷新
- @PageNumber INT, --翻页页码
- @SessionID varchar(50),
- @CompanySizeID VARCHAR(1), --企业规模
- @JobId INT,
- @Welfare VARCHAR(50),
- @IsOnline BIT --是否在线
- )
- AS
- SET NOCOUNT ON
- INSERT INTO SearchIp(Ip, Source) SELECT @SessionId, 'r'
- DECLARE @CanReturn BIT
- SET @CanReturn = 0
- IF EXISTS(SELECT 'x' FROM RefuseIp WITH(NOLOCK) WHERE CHARINDEX(Ip,@SessionId) > 0)
- SET @CanReturn = 1
- IF CHARINDEX(',0', @dcRegionID) > 0 OR CHARINDEX(',0', @dcJobTypeID) > 0
- OR CHARINDEX(',,', @dcRegionID) > 0 OR CHARINDEX(',,', @dcJobTypeID) > 0
- OR LEN(@dcRegionID) > 35 OR LEN(@dcJobTypeID) > 25
- SET @CanReturn = 1
- IF @CanReturn = 1
- BEGIN
- SELECT 0 ValidJobNumber
- SELECT TOP 0 * FROM JobTemp
- SELECT TOP 0 * FROM SearchDB..paSearchCount_0
- SELECT TOP 0 * FROM SearchDB..paSearchCount_0
- SELECT TOP 0 * FROM SearchDB..paSearchCount_0
- SELECT TOP 0 * FROM SearchDB..paSearchCount_0
- SELECT TOP 0 * FROM SearchDB..paSearchCount_0
- SELECT TOP 0 * FROM SearchDB..paSearchCount_0
- SELECT TOP 0 * FROM SearchDB..paSearchCount_0
- --insert into _0 select @SessionId, getdate()
- RETURN
- END
- IF Rand() * 10 > 5 AND (@SessionId LIKE '123.125.71%' OR @SessionId LIKE '220.181.108%')
- BEGIN
- SELECT 0 ValidJobNumber
- SELECT TOP 0 * FROM JobTemp
- SELECT TOP 0 * FROM SearchDB..paSearchCount_0
- SELECT TOP 0 * FROM SearchDB..paSearchCount_0
- SELECT TOP 0 * FROM SearchDB..paSearchCount_0
- SELECT TOP 0 * FROM SearchDB..paSearchCount_0
- SELECT TOP 0 * FROM SearchDB..paSearchCount_0
- SELECT TOP 0 * FROM SearchDB..paSearchCount_0
- SELECT TOP 0 * FROM SearchDB..paSearchCount_0
- RETURN
- END
- INSERT INTO SearchDB..paSearchLog(ProcType, SessionID, LogTime, JobType, JobPlace, Industry, Education, Experience,
- Salary, IsNegotiable, EmployType, CompanySizeID, KeyWord, KeyType, ReuseNumber, Welfare, IsOnline, RefreshNo)
- VALUES('pcJobBySearchSelect', @SessionId, GETDATE(), @dcJobTypeID, @dcRegionID, @dcIndustryID, @dcEducationID, @MinExperience,
- @dcSalaryID, 0, @EmployType, @CompanySizeID, @KeyWord, @KeyType, 0, @Welfare, @IsOnline, @RefreshNo)
- SET @SessionId = 20
- ----------------------20160126 nick 得到 省份、排序
- DECLARE @paMainId INT, @SQL AS VARCHAR(8000)
- SET @paMainId = 0
- BEGIN TRY
- IF @Order LIKE 'r=%'
- SET @KeyType = CONVERT(DECIMAL(4, 2), RIGHT(LEFT(@Order, 5), 3)) * 100
- ELSE
- SET @KeyType = 0
- IF @Order LIKE '%p=%'
- SET @paMainId = RIGHT(@Order, LEN(@Order) - CHARINDEX('p=', @Order) - 1)
- END TRY
- BEGIN CATCH
- SET @KeyType = 0
- END CATCH
- BEGIN TRY
- BEGIN
- IF CHARINDEX('请填写', @Keyword) > 0
- SET @Keyword = ''
- DECLARE @ReuseNumber AS INT, @dcProvinceId INT
- ----给null值变量赋默认值
- IF NOT LEFT(@dcRegionID, 1) = 'p'
- SELECT @dcRegionID = RTRIM(dbo.FormatIDS(@dcRegionID))
- IF @EmployType NOT IN('1', '2', '3', '4')
- SET @EmployType = ''
- SELECT @dcJobTypeID = RTRIM(dbo.FormatIDS(@dcJobTypeID)),
- @dcIndustryID = RTRIM(dbo.FormatIDS(@dcIndustryID)),
- @dcSalaryID = ISNULL(@dcSalaryID, 0),
- @MinExperience = ISNULL(@MinExperience, 100),
- @dcEducationID = ISNULL(@dcEducationID, 0),
- @EmployType = CASE @EmployType WHEN '2' THEN '1,3' ELSE ISNULL(@EmployType, '') END,
- @CompanySizeID = ISNULL(@CompanySizeID, '0'),
- @KeyWord = LTRIM(RTRIM(dbo.SafeSQL(ISNULL(@KeyWord, '')))),
- @ORDER = ' ORDER BY a.RefreshDate DESC, a.SecondID DESC',
- @Type = ISNULL(@Type, 0),
- @PageNumber = ISNULL(@PageNumber, 0),
- @Welfare = RTRIM(dbo.FormatIDS(@Welfare)),
- @IsOnline = ISNULL(@IsOnline, 0),
- @ReuseNumber = 0
- IF LEN(@Welfare) > 1
- BEGIN
- DECLARE @wf VARCHAR(50)
- SET @wf = ''
- SELECT @wf = @wf + a + ',' FROM dbo.fnSplit(@Welfare, ',') WHERE a <= 19 AND LEN(a) < 3
- IF LEN(@wf) > 1
- SET @wf = LEFT(@wf, LEN(@wf) - 1)
- SET @Welfare = @wf
- END
- --@RefreshNo = 0选择全部数据,不限制时间
- IF ISNULL(@RefreshNo, 0) > 100
- SELECT @dcProvinceId = @RefreshNo - 100
- ELSE IF ISNULL(@RefreshNo, 0) > 9
- SELECT @dcProvinceId = @RefreshNo
- ELSE
- SELECT @dcProvinceId = 0
- IF RIGHT(@KeyWord, 2) = '公司'
- SET @KeyWord = LEFT(@KeyWord, LEN(@KeyWord) - 2)
-
- IF RIGHT(@dcJobTypeID, 1) = ','
- SET @dcJobTypeID = LEFT(@dcJobTypeID, LEN(@dcJobTypeID) - 1)
- IF RIGHT(@dcRegionID, 1) = ','
- SET @dcRegionID = LEFT(@dcRegionID, LEN(@dcRegionID) - 1)
- IF RIGHT(@dcIndustryID, 1) = ','
- SET @dcIndustryID = LEFT(@dcIndustryID, LEN(@dcIndustryID) - 1)
- DECLARE @paSearchConditionID AS INT, @MinId AS INT, @PageSize AS TINYINT, @TableID AS TINYINT
- SELECT @paSearchConditionID = 0, @PageSize = 30
- ----搜索1分钟前的数据
- SELECT TOP 1 @paSearchConditionID = ID, @ReuseNumber = ReuseNumber
- FROM SearchDB..paSearchCondition WITH(NOLOCK)
- WHERE JobType = @dcJobTypeID AND IsOnline = @IsOnline AND JobPlace = @dcRegionID
- AND Industry = @dcIndustryID AND Education = @dcEducationID AND Experience = @MinExperience
- AND Salary = @dcSalaryID AND EmployType = @EmployType AND ISNULL(KeyWord, '') = @KeyWord
- AND CompanySizeID = @CompanySizeID AND Welfare = @Welfare AND IsOnline = @IsOnline
- AND LogTime > DATEADD(MINUTE, -1, GETDATE()) AND ReuseNumber > 0
- AND RefreshNo = @RefreshNo AND KeyType = @KeyType AND dcProvinceId = @dcProvinceId
- IF ISNULL(@paSearchConditionID, 0) = 0
- BEGIN
- SET @Type = 1
- GOTO SelectReset --无数据,重新搜索
- END
- ELSE
- BEGIN
- SELECT @TableID = @paSearchConditionID % 4
- GOTO GetRecordSet --从临时结果中提取数据
- END
- END
- SelectReset:
- --从job中搜索数据
- --BEGIN TRAN
- DECLARE @WHERE AS VARCHAR(8000)
- DECLARE @FROM AS VARCHAR(1000)
- ----记录查询条件
- INSERT INTO SearchDB..paSearchCondition(SessionID, LogTime, JobType, JobPlace, Industry, Education, Experience,
- Salary, IsNegotiable, EmployType, CompanySizeID, KeyWord, KeyType, ReuseNumber, Welfare, IsOnline, RefreshNo, dcProvinceId)
- VALUES(@SessionId, GETDATE(), @dcJobTypeID, @dcRegionID, @dcIndustryID, @dcEducationID, @MinExperience,
- @dcSalaryID, 0, @EmployType, @CompanySizeID, @KeyWord, @KeyType, 0, @Welfare, @IsOnline, @RefreshNo, @dcProvinceId)
-
- SET @paSearchConditionID = @@IDENTITY
- SELECT @TableID = @paSearchConditionID % 4
- ------生成职位类别的表变量,因为职位类别有包含(父子)关系
- DECLARE @T_JobPlace AS TABLE(ID INT)
- DECLARE @T_JobType AS TABLE(ID INT)
- DECLARE @JobPlaceLen AS INT, @JobTypeLen AS INT
- IF CHARINDEX(',', @dcJobTypeID) > 0
- SET @JobTypeLen = -1
- ELSE
- SET @JobTypeLen = LEN(@dcJobTypeID)
- DECLARE @JobType AS VARCHAR(3000), @JobPlace AS VARCHAR(2000), @ValidJobNumber AS INT
- SELECT @JobPlace = '', @JobType=''
- ----生成工作地点的表变量
- IF LEN(@dcRegionID) > 0
- BEGIN
- IF LEFT(@dcRegionID, 1) = 'p'
- BEGIN
- DECLARE @Degree AS DECIMAL(8,5),@LBLng AS DECIMAL(8,5),@LBLat AS DECIMAL(8,5),
- @RTLng AS DECIMAL(8,5),@RTLat AS DECIMAL(8,5),@Lat AS DECIMAL(8,5),@Lng AS DECIMAL(8,5)
-
- SELECT @Lat = Lat,@Lng = Lng FROM dcMapPlace WITH(NOLOCK) WHERE ID = RIGHT(@dcRegionID,LEN(@dcRegionID)-1)
- IF @dcRegionID LIKE '3201%'
- SET @Degree = 1000 / 100000.0
- ELSE
- SET @Degree = 2000 / 100000.0
- SET @LBLng = @Lng - @Degree
- SET @LBLat = @Lat - @Degree
- SET @RTLng = @Lng + @Degree
- SET @RTLat = @Lat + @Degree
- SET @JobPlace = 'a.Lng BETWEEN ' + CONVERT(VARCHAR,@LBLng) + ' AND ' + CONVERT(VARCHAR,@RTLng) + '
- AND a.Lat BETWEEN ' + CONVERT(VARCHAR,@LBLat) + ' AND ' + CONVERT(VARCHAR,@RTLat) + '
- AND (a.Lng-' + CONVERT(VARCHAR,@Lng) + ')*(a.Lng-' + CONVERT(VARCHAR,@Lng) + ')+
- (a.Lat-' + CONVERT(VARCHAR,@Lat) + ')*(a.Lat-' + CONVERT(VARCHAR,@Lat) + ')<' + CONVERT(VARCHAR,@Degree*@Degree)
- SELECT @JobPlaceLen = 8
- END
- ELSE IF LEN(@dcRegionID) > 1
- BEGIN
- INSERT INTO @T_JobPlace
- SELECT * FROM dbo.fnSplit(@dcRegionID, ',')
- WHERE LEN(a) IN(2, 4, 6)
- SELECT @JobPlace = (@JobPlace + ' OR a.dcRegionID Like ''' + LTRIM(STR(ID) + '%''')) FROM @T_JobPlace
- IF LEN(@JobPlace) > 0
- SET @JobPlace = RIGHT(@JobPlace, LEN(@JobPlace) -4)
- IF (SELECT COUNT(*) FROM @T_JobPlace) > 1
- SET @JobPlaceLen = -1
- ELSE
- SET @JobPlaceLen = LEN(@dcRegionID)
- END
- END
- ELSE
- SELECT @JobPlaceLen = 0
- ----生成求聘职位的表变量
- IF LEN(@dcJobTypeID) > 0
- BEGIN
- DECLARE @T_Temp AS TABLE(ID INT) --临时表,用于构建组合查询语句
- INSERT INTO @T_Temp
- SELECT * FROM dbo.fnSplit(@dcJobTypeID, ',')
- WHERE LEN(a) IN(2, 4)
- INSERT INTO @T_JobType
- SELECT DISTINCT ID FROM dcJobType WITH(NOLOCK)
- WHERE ParentId IN(SELECT ID FROM @T_TEMP)
- OR ParentId2 in(SELECT ID FROM @T_TEMP)
- OR ID IN(SELECT ID FROM @T_TEMP)
- ----生成in字符串
- SELECT @JobType = (@JobType + LTRIM(STR(ID) + ',')) FROM @T_JobType
- IF RIGHT(@JobType, 1) = ','
- SET @JobType = LEFT(@JobType, LEN(@JobType) - 1)
- END
- ----建立临时表
- CREATE TABLE #Job(
- RowID INT IDENTITY(1, 1),
- ID INT NOT NULL,
- cpMainId INT,
- dcJobTypeID SMALLINT NOT NULL,
- dcJobTypeIDMinor SMALLINT NULL,
- dcSalaryID TINYINT NOT NULL,
- dcRegionID VARCHAR(6) NULL,
- dcEducationID TINYINT NOT NULL,
- MinExperience TINYINT NOT NULL,
- RefreshDate SMALLDATETIME NULL,
- EmployType TINYINT NULL,
- dcCompanySizeID SMALLINT NULL
- )
- CREATE TABLE #FullText(
- Id INT IDENTITY(1, 1),
- Priority INT,
- JobId INT NOT NULL
- )
- ------刷新时间,根据刷新时间编号计算
- ----生成插入临时表的Sql语句
- SET @SQL='
- INSERT INTO #Job
- SELECT a.ID, a.cpMainId, a.dcJobTypeID, a.dcJobTypeIDMinor, a.dcSalaryID,
- a.dcRegionID, a.dcEducationID, a.MinExperience, a.IssueDate,a.EmployType,b.dcCompanySizeID'
- SET @FROM = '
- FROM JobPublish a WITH(NOLOCK)
- INNER JOIN cpMainPublish b WITH(NOLOCK) ON a.cpMainID=b.ID'
- ----职位有效,单位新有效
- IF LEN(@dcIndustryID) > 0
- SET @WHERE = '
- WHERE b.ID IN (SELECT cpMainID FROM cpIndustry WHERE dcIndustryId in(' + @dcIndustryID + '))
- AND a.Valid = 1
- AND b.Valid = 1'
- ELSE
- SET @WHERE = '
- WHERE a.Valid = 1
- AND b.Valid = 1'
- IF @dcProvinceId > 0
- SET @WHERE = @WHERE + ' AND b.dcProvinceId = ' + LTRIM(STR(@dcProvinceId))
- IF @KeyType IN(60, 70, 80, 90, 100)
- SET @WHERE = @WHERE + '
- AND b.ReplyRate >= ' + LEFT(@KeyType / 100.0, 3)
- IF @RefreshNo > 100
- SET @WHERE = @WHERE + '
- AND b.HasEnvironment = 1'
- ----需要增加全文索引的关键字查询
- --SET @KeyWord = dbo.CutWord(@KeyWord)
-
- ----职位类别
- IF LEN(@dcJobTypeID) > 0 AND @JobType > ''
- BEGIN
- SET @WHERE = @WHERE + '
- AND (a.dcJobTypeID IN(' + @JobType +')
- OR a.dcJobTypeIDMinor IN(' +@JobType + ')'
- IF LEN(@dcJobTypeID) IN(2, 4)
- BEGIN
- DECLARE @JobtypeName NVARCHAR(50)
- SELECT @JobtypeName = Description FROM dcJobType WITH(NOLOCK) WHERE Id = @dcJobTypeID
- IF CHARINDEX('/', @JobtypeName) = 0
- SET @WHERE = @WHERE + '
- OR a.Name LIKE ''%' + @JobtypeName + '%'''
- ELSE
- SET @WHERE = @WHERE + '
- OR a.Name LIKE ''%' + LEFT(@JobtypeName, CHARINDEX('/', @JobtypeName) - 1) + '%'''
- END
- SET @WHERE = @WHERE + ')'
- END
- IF LEN(@JobPlace) > 0
- SET @WHERE = @WHERE + '
- AND (' + @JobPlace + ')'
- IF @dcSalaryID > 0
- BEGIN
- IF @dcSalaryID < 100 ----从form中搜索,月薪跨2个级别, 是本级和上级别的薪金
- SET @WHERE = @WHERE + '
- AND a.dcSalaryID IN(' + LTRIM(STR(@dcSalaryID)) + ',' + LTRIM(STR(@dcSalaryID + 1)) + ')'
- ELSE IF @dcSalaryID = 100 ----从筛选结果中点击面议,值是100
- SET @WHERE = @WHERE + '
- AND a.dcSalaryID = 100'
- ELSE IF @dcSalaryID BETWEEN 101 AND 106 ----从筛选结果中点击搜索,月薪只有1个级别,传值时增加100
- SET @WHERE = @WHERE + '
- AND a.dcSalaryID <= ' + LTRIM(STR(@dcSalaryID-99)) + ' AND a.dcSalaryIDMax > ' + LTRIM(STR(@dcSalaryID-100))
- ELSE IF @dcSalaryID BETWEEN 107 AND 113 ----从筛选结果中点击搜索,月薪只有1个级别,传值时增加100
- SET @WHERE = @WHERE + '
- AND a.dcSalaryID <= ' + LTRIM(STR(@dcSalaryID - 100)) + ' AND a.dcSalaryIDMax > ' + LTRIM(STR(@dcSalaryID-100))
- ELSE IF @dcSalaryID BETWEEN 114 AND 120
- SET @WHERE = @WHERE + '
- AND a.dcSalaryID < 100 AND a.dcSalaryIDMax > ' + LTRIM(STR(@dcSalaryID - 100))
- END
- ----工作经验要求
- IF @MinExperience < 100
- SET @WHERE = @WHERE + '
- AND a.MinExperience = ' + LTRIM(STR(@MinExperience))
- ----学历要求
- ----'1初中', '2\3\4高中、中技、中专', '5大专', '6本科', '7硕士', '8博士
- IF @dcEducationID > 0
- IF @dcEducationID = 2
- SET @WHERE = @WHERE + '
- AND a.dcEducationID IN(2, 3, 4)'
- ELSE
- SET @WHERE = @WHERE + '
- AND a.dcEducationID = ' + LTRIM(STR(@dcEducationID))
- ----1、全职;3、兼职;4实习。 2、全职/兼职 职位中无此项
- IF LEN(@EmployType) > 0
- SET @WHERE = @WHERE + '
- AND a.EmployType IN (' + @EmployType + ')'
- IF @CompanySizeID BETWEEN 1 AND 6
- SET @WHERE = @WHERE + '
- AND b.dcCompanySizeID = ' + LTRIM(STR(@CompanySizeID))
- IF LEN(@Welfare) > 0
- SET @WHERE = @WHERE + '
- AND a.Welfare' + REPLACE(@Welfare, ',', ' = 1 AND a.Welfare') + ' = 1'
-
- IF @IsOnline = 1
- SET @WHERE = @WHERE + '
- AND a.caMainId IN(SELECT caMainId FROM caOnline WITH(NOLOCK) WHERE IsOnline = 1)'
- IF LEN(@KeyWord) > 1 ----使用全文搜索job和cpmain2个表,经过测试发现union最快
- BEGIN
- IF EXISTS(SELECT TOP 1 'x' FROM cpMainPublish WITH(NOLOCK) WHERE Name = @KeyWord)
- BEGIN
- SET @WHERE = @WHERE + '
- AND b.Name = ''' + @KeyWord + ''''
- SET @SQL = @SQL + @FROM + @WHERE
- END
- ELSE
- BEGIN
- DECLARE @KeyWordTemp NVARCHAR(50)
- SET @KeyWordTemp = REPLACE(@KeyWord, ' ', '%')
- SET @KeyWordTemp = REPLACE(REPLACE(@KeyWordTemp, '(', ''), ')', '')
- IF LEN(@KeyWordTemp) > 1
- BEGIN
- IF @dcProvinceId > 0
- BEGIN
- IF @dcRegionId > '' AND @dcRegionId NOT LIKE '%,%'
- INSERT #FullText
- SELECT TOP 2000 1, b.ID
- FROM cpMainPublish a WITH(NOLOCK),
- JobPublish b WITH(NOLOCK)
- WHERE a.Id = b.cpMainId
- AND CHARINDEX(@KeyWord, b.Name) > 0
- AND a.dcProvinceId = @dcprovinceId
- AND b.dcRegionID LIKE @dcRegionId + '%'
- ORDER BY b.RefreshDate DESC
- ELSE
- INSERT #FullText
- SELECT TOP 2000 1, b.ID
- FROM cpMainPublish a WITH(NOLOCK),
- JobPublish b WITH(NOLOCK)
- WHERE a.Id = b.cpMainId
- AND CHARINDEX(@KeyWord, b.Name) > 0
- AND a.dcProvinceId = @dcprovinceId
- ORDER BY b.RefreshDate DESC
- INSERT #FullText
- SELECT TOP 2000 2, b.ID
- FROM cpMainPublish a WITH(NOLOCK),
- JobPublish b WITH(NOLOCK)
- WHERE a.Id = b.cpMainId
- AND CHARINDEX(@KeyWord, a.Name) > 0
- AND a.dcProvinceId = @dcprovinceId
- ORDER BY b.RefreshDate DESC
- END
- ELSE
- BEGIN
- INSERT #FullText
- SELECT TOP 2000 2, b.ID
- FROM cpMainPublish a WITH(NOLOCK),
- JobPublish b WITH(NOLOCK)
- WHERE a.Id = b.cpMainId
- AND CHARINDEX(@KeyWord, a.Name) > 0
- ORDER BY b.RefreshDate DESC
- INSERT #FullText
- SELECT TOP 2000 1, b.ID
- FROM cpMainPublish a WITH(NOLOCK),
- JobPublish b WITH(NOLOCK)
- WHERE a.Id = b.cpMainId
- AND CHARINDEX(@KeyWord, b.Name) > 0
- ORDER BY b.RefreshDate DESC
- END
- END
- IF (SELECT COUNT(*) FROM #FullText) < 2000
- BEGIN
- INSERT #FullText
- SELECT TOP 5000 3 + RANK, [Key]
- FROM FREETEXTTABLE(cpMainJob, JobName, @KeyWordTemp, 100000) AS KeyJob ORDER BY RANK DESC
- END
- IF (SELECT COUNT(*) FROM #FullText) < 2000
- BEGIN
- INSERT #FullText
- SELECT TOP 5000 3000 + RANK, [Key]
- FROM FREETEXTTABLE(cpMainJob, *, @KeyWordTemp, 100000) AS KeyJob ORDER BY RANK DESC
- END
- DELETE a FROM #FullText a, #FullText b WHERE a.JobId = b.JobId AND a.Priority > b.Priority
- DELETE a FROM #FullText a, #FullText b WHERE a.JobId = b.JobId AND a.Id > b.Id
- --------------------
- SELECT @FROM = @FROM + '
- INNER JOIN #FullText ON a.ID = #FullText.JobId',
- @ORDER = ' ORDER BY #FullText.Priority, a.RefreshDate DESC, a.SecondId DESC'
- SET @SQL = @SQL + @FROM + @WHERE
- END
- END
- ELSE
- SET @SQL = @SQL + @FROM + @WHERE
-
- SET @SQL = @SQL + @ORDER --' ORDER BY a.RefreshDate DESC, a.ID'
- --原来是ORDER BY a.IssueDate DESC, a.ID,Richard 2011年11月23日17:06分修改
- ----把符合条件的职位全部列出
- --PRINT @SQL
- EXEC(@SQL)
- SET @ValidJobNumber = @@ROWCOUNT
- ----记录查询结果总数
- UPDATE SearchDB..paSearchCondition SET ValidJobNumber=@ValidJobNumber, SQl = @SQL
- WHERE ID=@paSearchConditionID
- IF LEN(@dcJobTypeID) > 0 --IN(2, 4)
- UPDATE #Job SET dcJobTypeId = dcJobTypeIDMinor
- WHERE dcJobTypeID NOT IN(SELECT a FROM dbo.fnSplit(@JobType, ','))
- AND dcJobTypeIDMinor> 0
- ----插入JobType数据
- DECLARE @TitleValue AS INT, @TopRows AS INT, @AllRows AS INT
- DECLARE @sc AS TABLE (
- paSearchConditionID int,
- Title varchar(20),
- TitleID varchar(10),
- TitleValue int
- )
- DECLARE @sc2 AS TABLE (
- paSearchConditionID int,
- Title varchar(20),
- TitleID varchar(10),
- TitleValue int
- )
- IF (@TableID = 0)
- BEGIN
- ----------------------------jobtype
- INSERT INTO @sc2(paSearchConditionID, Title, TitleId, TitleValue)
- SELECT @paSearchConditionID, 'JobType', dcJobTypeID, COUNT(*)
- FROM #Job WITH(NOLOCK)
- GROUP BY dcJobTypeID ORDER BY dcJobTypeID
- ----计算全部某职位类别,2, 4位的数据
- IF @JobTypeLen NOT IN(2, 4)
- BEGIN
- INSERT INTO @Sc(paSearchConditionID, Title, TitleId, TitleValue)
- SELECT @paSearchConditionID, 'JobType', LEFT(TitleID, 2) TitleID, SUM(TitleValue) TitleValue
- FROM @sc2 GROUP BY LEFT(TitleID, 2)
- END
- IF @JobTypeLen NOT IN(0, 4)
- BEGIN
- INSERT INTO @Sc(paSearchConditionID, Title, TitleId, TitleValue)
- SELECT @paSearchConditionID, 'JobType', TitleId, TitleValue
- FROM @sc2 WHERE LEN(TitleId) = 4
- END
- IF @JobTypeLen = -1
- DELETE @sc WHERE TitleID NOT IN(SELECT a FROM dbo.fnSplit(@dcJobTypeID, ','))
- INSERT INTO SearchDB..paSearchCount_0(paSearchConditionID, Title, TitleId, TitleValue)
- SELECT @paSearchConditionID, 'JobType', TitleId, TitleValue FROM @sc
- DELETE @sc
- DELETE @sc2
- --------------------------region
- INSERT INTO @sc2(paSearchConditionID, Title, TitleId, TitleValue)
- SELECT @paSearchConditionID, 'Region', dcRegionID, COUNT(*) FROM #Job WITH(NOLOCK)
- GROUP BY dcRegionID ORDER BY dcRegionID
- ----计算全部地区,2位的数据
- IF @JobPlaceLen IN(-1, 0)
- INSERT INTO @sc(paSearchConditionID, Title, TitleId, TitleValue)
- SELECT @paSearchConditionID, 'Region', LEFT(TitleID, 2) TitleID, SUM(TitleValue) TitleValue
- FROM @sc2 GROUP BY LEFT(TitleID, 2)
- IF @JobPlaceLen IN(-1, 2)
- INSERT INTO @sc(paSearchConditionID, Title, TitleId, TitleValue)
- SELECT @paSearchConditionID, 'Region', LEFT(TitleID, 4) TitleID, SUM(TitleValue) TitleValue
- FROM @sc2 WHERE LEN(TitleID) >= 4 GROUP BY LEFT(TitleID, 4)
- IF @JobPlaceLen IN(-1, 4)
- INSERT INTO @sc(paSearchConditionID, Title, TitleId, TitleValue)
- SELECT @paSearchConditionID, 'Region', TitleID, TitleValue
- FROM @sc2 WHERE LEN(TitleID) = 6
- IF @JobPlaceLen = -1
- DELETE @sc WHERE TitleID NOT IN(SELECT ID FROM @T_JobPlace)
- ELSE
- DELETE @sc WHERE LEN(TitleID) <> @JobPlaceLen + 2
- INSERT INTO SearchDB..paSearchCount_0(paSearchConditionID, Title, TitleId, TitleValue)
- SELECT paSearchConditionID, Title, TitleId, TitleValue FROM @sc
- ----------------------------
- INSERT INTO SearchDB..paSearchCount_0(paSearchConditionID, Title, TitleId, TitleValue)
- SELECT @paSearchConditionID, 'EmployType', EmployType, COUNT(*) FROM #Job WITH(NOLOCK)
- GROUP BY EmployType ORDER BY EmployType
- INSERT INTO SearchDB..paSearchCount_0(paSearchConditionID, Title, TitleId, TitleValue)
- SELECT @paSearchConditionID, 'Education', CASE WHEN dcEducationId IN(2, 3, 4) THEN 2 ELSE dcEducationId END, COUNT(*) FROM #Job WITH(NOLOCK)
- GROUP BY CASE WHEN dcEducationId IN(2, 3, 4) THEN 2 ELSE dcEducationId END
- ORDER BY CASE WHEN dcEducationId IN(2, 3, 4) THEN 2 ELSE dcEducationId END
- INSERT INTO SearchDB..paSearchCount_0(paSearchConditionID, Title, TitleId, TitleValue)
- SELECT @paSearchConditionID, 'Experience', MinExperience, COUNT(*) FROM #Job WITH(NOLOCK)
- GROUP BY MinExperience ORDER BY MinExperience
- INSERT INTO SearchDB..paSearchCount_0(paSearchConditionID, Title, TitleId, TitleValue)
- SELECT @paSearchConditionID, 'CompanySize', dcCompanySizeID, COUNT(*) FROM #Job WITH(NOLOCK)
- GROUP BY dcCompanySizeID ORDER BY dcCompanySizeID
- INSERT INTO SearchDB..paSearchCount_0(paSearchConditionID, Title, TitleId, TitleValue)
- SELECT @paSearchConditionID, 'Salary', dcSalaryID, COUNT(*) FROM #Job WITH(NOLOCK)
- GROUP BY dcSalaryID ORDER BY dcSalaryID
- INSERT INTO SearchDB..paSearchCount_0(paSearchConditionID, Title, TitleId, TitleValue)
- SELECT @paSearchConditionID, 'Industry', dcIndustryID, COUNT(*)
- FROM #Job a WITH(NOLOCK), cpIndustry b WITH(NOLOCK)
- WHERE a.cpMainId = b.cpMainId
- GROUP BY b.dcIndustryId ORDER BY b.dcIndustryId
- IF EXISTS(SELECT TOP 1 'x' FROM #FullText)
- INSERT INTO SearchDB..paSearchJobID_0(paSearchConditionID, JobId, IsTop)
- SELECT TOP 10 @paSearchConditionID, a.JobId, 1
- FROM SearchJobTop a WITH(NOLOCK), (SELECT ID FROM #Job WITH(NOLOCK) WHERE RowId < 2001) b
- WHERE b.ID = a.JobId
- AND CHARINDEX(@KeyWord, a.JobName) > 0
- ORDER BY a.OrderType, a.OpenDate DESC
- ELSE
- INSERT INTO SearchDB..paSearchJobID_0(paSearchConditionID, JobId, IsTop)
- SELECT TOP 10 @paSearchConditionID, a.JobId, 1
- FROM SearchJobTop a WITH(NOLOCK), (SELECT ID FROM #Job WITH(NOLOCK) WHERE RowId < 2001) b
- WHERE b.ID = a.JobId
- ORDER BY a.OrderType, a.OpenDate DESC
- SET @TopRows = @@ROWCOUNT
- INSERT INTO SearchDB..paSearchJobID_0(paSearchConditionID, JobId, IsTop)
- SELECT TOP 2000 @paSearchConditionID, ID, 0 FROM #Job WITH(NOLOCK) ORDER BY RowId
- SET @AllRows = @@ROWCOUNT
- IF @TopRows = 0 AND @AllRows > 100
- UPDATE SearchDB..paSearchJobID_0 SET IsTop = 1
- WHERE paSearchConditionID = @paSearchConditionID
- AND ID IN (SELECT TOP 3 ID FROM SearchDB..paSearchJobID_0 WITH(NOLOCK) WHERE paSearchConditionID = @paSearchConditionID ORDER BY ID)
- END
- ELSE IF (@TableId = 1)
- BEGIN
- ----------------------------jobtype
- INSERT INTO @sc2(paSearchConditionID, Title, TitleId, TitleValue)
- SELECT @paSearchConditionID, 'JobType', dcJobTypeID, COUNT(*)
- FROM #Job WITH(NOLOCK)
- GROUP BY dcJobTypeID ORDER BY dcJobTypeID
- ----计算全部某职位类别,2, 4位的数据
- IF @JobTypeLen NOT IN(2, 4)
- BEGIN
- INSERT INTO @Sc(paSearchConditionID, Title, TitleId, TitleValue)
- SELECT @paSearchConditionID, 'JobType', LEFT(TitleID, 2) TitleID, SUM(TitleValue) TitleValue
- FROM @sc2 GROUP BY LEFT(TitleID, 2)
- END
- IF @JobTypeLen NOT IN(0, 4)
- BEGIN
- INSERT INTO @Sc(paSearchConditionID, Title, TitleId, TitleValue)
- SELECT @paSearchConditionID, 'JobType', TitleId, TitleValue
- FROM @sc2 WHERE LEN(TitleId) = 4
- END
- IF @JobTypeLen = -1
- DELETE @sc WHERE TitleID NOT IN(SELECT a FROM dbo.fnSplit(@dcJobTypeID, ','))
- INSERT INTO SearchDB..paSearchCount_1(paSearchConditionID, Title, TitleId, TitleValue)
- SELECT @paSearchConditionID, 'JobType', TitleId, TitleValue FROM @sc
- DELETE @sc
- DELETE @sc2
- --------------------------region
- INSERT INTO @sc2(paSearchConditionID, Title, TitleId, TitleValue)
- SELECT @paSearchConditionID, 'Region', dcRegionID, COUNT(*) FROM #Job WITH(NOLOCK)
- GROUP BY dcRegionID ORDER BY dcRegionID
- ----计算全部地区,2位的数据
- IF @JobPlaceLen IN(-1, 0)
- INSERT INTO @sc(paSearchConditionID, Title, TitleId, TitleValue)
- SELECT @paSearchConditionID, 'Region', LEFT(TitleID, 2) TitleID, SUM(TitleValue) TitleValue
- FROM @sc2 GROUP BY LEFT(TitleID, 2)
- IF @JobPlaceLen IN(-1, 2)
- INSERT INTO @sc(paSearchConditionID, Title, TitleId, TitleValue)
- SELECT @paSearchConditionID, 'Region', LEFT(TitleID, 4) TitleID, SUM(TitleValue) TitleValue
- FROM @sc2 WHERE LEN(TitleID) >= 4 GROUP BY LEFT(TitleID, 4)
- IF @JobPlaceLen IN(-1, 4)
- INSERT INTO @sc(paSearchConditionID, Title, TitleId, TitleValue)
- SELECT @paSearchConditionID, 'Region', TitleID, TitleValue
- FROM @sc2 WHERE LEN(TitleID) = 6
- IF @JobPlaceLen = -1
- DELETE @sc WHERE TitleID NOT IN(SELECT ID FROM @T_JobPlace)
- ELSE
- DELETE @sc WHERE LEN(TitleID) <> @JobPlaceLen + 2
- INSERT INTO SearchDB..paSearchCount_1(paSearchConditionID, Title, TitleId, TitleValue)
- SELECT paSearchConditionID, Title, TitleId, TitleValue FROM @sc
- ----------------------------
- INSERT INTO SearchDB..paSearchCount_1(paSearchConditionID, Title, TitleId, TitleValue)
- SELECT @paSearchConditionID, 'Salary', dcSalaryID, COUNT(*) FROM #Job WITH(NOLOCK)
- GROUP BY dcSalaryID ORDER BY dcSalaryID
- INSERT INTO SearchDB..paSearchCount_1(paSearchConditionID, Title, TitleId, TitleValue)
- SELECT @paSearchConditionID, 'Education', CASE WHEN dcEducationId IN(2, 3, 4) THEN 2 ELSE dcEducationId END, COUNT(*) FROM #Job WITH(NOLOCK)
- GROUP BY CASE WHEN dcEducationId IN(2, 3, 4) THEN 2 ELSE dcEducationId END
- ORDER BY CASE WHEN dcEducationId IN(2, 3, 4) THEN 2 ELSE dcEducationId END
- INSERT INTO SearchDB..paSearchCount_1(paSearchConditionID, Title, TitleId, TitleValue)
- SELECT @paSearchConditionID, 'Experience', MinExperience, COUNT(*) FROM #Job WITH(NOLOCK)
- GROUP BY MinExperience ORDER BY MinExperience
- INSERT INTO SearchDB..paSearchCount_1(paSearchConditionID, Title, TitleId, TitleValue)
- SELECT @paSearchConditionID, 'EmployType', EmployType, COUNT(*) FROM #Job WITH(NOLOCK)
- GROUP BY EmployType ORDER BY EmployType
- INSERT INTO SearchDB..paSearchCount_1(paSearchConditionID, Title, TitleId, TitleValue)
- SELECT @paSearchConditionID, 'CompanySize', dcCompanySizeID, COUNT(*) FROM #Job WITH(NOLOCK)
- GROUP BY dcCompanySizeID ORDER BY dcCompanySizeID
- INSERT INTO SearchDB..paSearchCount_1(paSearchConditionID, Title, TitleId, TitleValue)
- SELECT @paSearchConditionID, 'Industry', dcIndustryID, COUNT(*)
- FROM #Job a WITH(NOLOCK), cpIndustry b WITH(NOLOCK)
- WHERE a.cpMainId = b.cpMainId
- GROUP BY dcIndustryID ORDER BY dcIndustryID
- IF EXISTS(SELECT TOP 1 'x' FROM #FullText)
- INSERT INTO SearchDB..paSearchJobID_1(paSearchConditionID, JobId, IsTop)
- SELECT TOP 10 @paSearchConditionID, a.JobId, 1
- FROM SearchJobTop a WITH(NOLOCK), (SELECT ID FROM #Job WITH(NOLOCK) WHERE RowId < 2001) b
- WHERE b.ID = a.JobId
- AND CHARINDEX(@KeyWord, a.JobName) > 0
- ORDER BY a.OrderType, a.OpenDate DESC
- ELSE
- INSERT INTO SearchDB..paSearchJobID_1(paSearchConditionID, JobId, IsTop)
- SELECT TOP 10 @paSearchConditionID, a.JobId, 1
- FROM SearchJobTop a WITH(NOLOCK), (SELECT ID FROM #Job WITH(NOLOCK) WHERE RowId < 2001) b
- WHERE b.ID = a.JobId
- ORDER BY a.OrderType, a.OpenDate DESC
- SET @TopRows = @@ROWCOUNT
-
- INSERT INTO SearchDB..paSearchJobID_1(paSearchConditionID, JobId, IsTop)
- SELECT TOP 2000 @paSearchConditionID, ID, 0 FROM #Job WITH(NOLOCK) ORDER BY RowId
- SET @AllRows = @@ROWCOUNT
- IF @TopRows = 0 AND @AllRows > 100
- UPDATE SearchDB..paSearchJobID_1 SET IsTop = 1
- WHERE paSearchConditionID = @paSearchConditionID
- AND ID IN (SELECT TOP 3 ID FROM SearchDB..paSearchJobID_1 WITH(NOLOCK) WHERE paSearchConditionID = @paSearchConditionID ORDER BY ID)
- END
- ELSE IF (@TableId = 2)
- BEGIN
- ----------------------------jobtype
- INSERT INTO @sc2(paSearchConditionID, Title, TitleId, TitleValue)
- SELECT @paSearchConditionID, 'JobType', dcJobTypeID, COUNT(*)
- FROM #Job WITH(NOLOCK)
- GROUP BY dcJobTypeID ORDER BY dcJobTypeID
- ----计算全部某职位类别,2, 4位的数据
- IF @JobTypeLen NOT IN(2, 4)
- BEGIN
- INSERT INTO @Sc(paSearchConditionID, Title, TitleId, TitleValue)
- SELECT @paSearchConditionID, 'JobType', LEFT(TitleID, 2) TitleID, SUM(TitleValue) TitleValue
- FROM @sc2 GROUP BY LEFT(TitleID, 2)
- END
- IF @JobTypeLen NOT IN(0, 4)
- BEGIN
- INSERT INTO @Sc(paSearchConditionID, Title, TitleId, TitleValue)
- SELECT @paSearchConditionID, 'JobType', TitleId, TitleValue
- FROM @sc2 WHERE LEN(TitleId) = 4
- END
- IF @JobTypeLen = -1
- DELETE @sc WHERE TitleID NOT IN(SELECT a FROM dbo.fnSplit(@dcJobTypeID, ','))
- INSERT INTO SearchDB..paSearchCount_2(paSearchConditionID, Title, TitleId, TitleValue)
- SELECT @paSearchConditionID, 'JobType', TitleId, TitleValue FROM @sc
- DELETE @sc
- DELETE @sc2
- --------------------------region
- INSERT INTO @sc2(paSearchConditionID, Title, TitleId, TitleValue)
- SELECT @paSearchConditionID, 'Region', dcRegionID, COUNT(*) FROM #Job WITH(NOLOCK)
- GROUP BY dcRegionID ORDER BY dcRegionID
- ----计算全部地区,2位的数据
- IF @JobPlaceLen IN(-1, 0)
- INSERT INTO @sc(paSearchConditionID, Title, TitleId, TitleValue)
- SELECT @paSearchConditionID, 'Region', LEFT(TitleID, 2) TitleID, SUM(TitleValue) TitleValue
- FROM @sc2 GROUP BY LEFT(TitleID, 2)
- IF @JobPlaceLen IN(-1, 2)
- INSERT INTO @sc(paSearchConditionID, Title, TitleId, TitleValue)
- SELECT @paSearchConditionID, 'Region', LEFT(TitleID, 4) TitleID, SUM(TitleValue) TitleValue
- FROM @sc2 WHERE LEN(TitleID) >= 4 GROUP BY LEFT(TitleID, 4)
- IF @JobPlaceLen IN(-1, 4)
- INSERT INTO @sc(paSearchConditionID, Title, TitleId, TitleValue)
- SELECT @paSearchConditionID, 'Region', TitleID, TitleValue
- FROM @sc2 WHERE LEN(TitleID) = 6
- IF @JobPlaceLen = -1
- DELETE @sc WHERE TitleID NOT IN(SELECT ID FROM @T_JobPlace)
- ELSE
- DELETE @sc WHERE LEN(TitleID) <> @JobPlaceLen + 2
- INSERT INTO SearchDB..paSearchCount_2(paSearchConditionID, Title, TitleId, TitleValue)
- SELECT paSearchConditionID, Title, TitleId, TitleValue FROM @sc
- ----------------------------
- INSERT INTO SearchDB..paSearchCount_2(paSearchConditionID, Title, TitleId, TitleValue)
- SELECT @paSearchConditionID, 'Salary', dcSalaryID, COUNT(*) FROM #Job WITH(NOLOCK)
- GROUP BY dcSalaryID ORDER BY dcSalaryID
- INSERT INTO SearchDB..paSearchCount_2(paSearchConditionID, Title, TitleId, TitleValue)
- SELECT @paSearchConditionID, 'Education', CASE WHEN dcEducationId IN(2, 3, 4) THEN 2 ELSE dcEducationId END, COUNT(*) FROM #Job WITH(NOLOCK)
- GROUP BY CASE WHEN dcEducationId IN(2, 3, 4) THEN 2 ELSE dcEducationId END
- ORDER BY CASE WHEN dcEducationId IN(2, 3, 4) THEN 2 ELSE dcEducationId END
- INSERT INTO SearchDB..paSearchCount_2(paSearchConditionID, Title, TitleId, TitleValue)
- SELECT @paSearchConditionID, 'Experience', MinExperience, COUNT(*) FROM #Job WITH(NOLOCK)
- GROUP BY MinExperience ORDER BY MinExperience
- INSERT INTO SearchDB..paSearchCount_2(paSearchConditionID, Title, TitleId, TitleValue)
- SELECT @paSearchConditionID, 'EmployType', EmployType, COUNT(*) FROM #Job WITH(NOLOCK)
- GROUP BY EmployType ORDER BY EmployType
- INSERT INTO SearchDB..paSearchCount_2(paSearchConditionID, Title, TitleId, TitleValue)
- SELECT @paSearchConditionID, 'CompanySize', dcCompanySizeID, COUNT(*) FROM #Job WITH(NOLOCK)
- GROUP BY dcCompanySizeID ORDER BY dcCompanySizeID
- INSERT INTO SearchDB..paSearchCount_2(paSearchConditionID, Title, TitleId, TitleValue)
- SELECT @paSearchConditionID, 'Industry', dcIndustryID, COUNT(*)
- FROM #Job a WITH(NOLOCK), cpIndustry b WITH(NOLOCK)
- WHERE a.cpMainId = b.cpMainId
- GROUP BY dcIndustryID ORDER BY dcIndustryID
- IF EXISTS(SELECT TOP 1 'x' FROM #FullText)
- INSERT INTO SearchDB..paSearchJobID_2(paSearchConditionID, JobId, IsTop)
- SELECT TOP 10 @paSearchConditionID, a.JobId, 1
- FROM SearchJobTop a WITH(NOLOCK), (SELECT ID FROM #Job WITH(NOLOCK) WHERE RowId < 2001) b
- WHERE b.ID = a.JobId
- AND CHARINDEX(@KeyWord, a.JobName) > 0
- ORDER BY a.OrderType, a.OpenDate DESC
- ELSE
- INSERT INTO SearchDB..paSearchJobID_2(paSearchConditionID, JobId, IsTop)
- SELECT TOP 10 @paSearchConditionID, a.JobId, 1
- FROM SearchJobTop a WITH(NOLOCK), (SELECT ID FROM #Job WITH(NOLOCK) WHERE RowId < 2001) b
- WHERE b.ID = a.JobId
- ORDER BY a.OrderType, a.OpenDate DESC
- SET @TopRows = @@ROWCOUNT
- INSERT INTO SearchDB..paSearchJobID_2(paSearchConditionID, JobId, IsTop)
- SELECT TOP 2000 @paSearchConditionID, ID, 0 FROM #Job WITH(NOLOCK) ORDER BY RowId
- SET @AllRows = @@ROWCOUNT
- IF @TopRows = 0 AND @AllRows > 100
- UPDATE SearchDB..paSearchJobID_2 SET IsTop = 1
- WHERE paSearchConditionID = @paSearchConditionID
- AND ID IN (SELECT TOP 3 ID FROM SearchDB..paSearchJobID_2 WITH(NOLOCK) WHERE paSearchConditionID = @paSearchConditionID ORDER BY ID)
- END
- ELSE IF (@TableId = 3)
- BEGIN
- ----------------------------jobtype
- INSERT INTO @sc2(paSearchConditionID, Title, TitleId, TitleValue)
- SELECT @paSearchConditionID, 'JobType', dcJobTypeID, COUNT(*)
- FROM #Job WITH(NOLOCK)
- GROUP BY dcJobTypeID ORDER BY dcJobTypeID
- ----计算全部某职位类别,2, 4位的数据
- IF @JobTypeLen NOT IN(2, 4)
- BEGIN
- INSERT INTO @Sc(paSearchConditionID, Title, TitleId, TitleValue)
- SELECT @paSearchConditionID, 'JobType', LEFT(TitleID, 2) TitleID, SUM(TitleValue) TitleValue
- FROM @sc2 GROUP BY LEFT(TitleID, 2)
- END
- IF @JobTypeLen NOT IN(0, 4)
- BEGIN
- INSERT INTO @Sc(paSearchConditionID, Title, TitleId, TitleValue)
- SELECT @paSearchConditionID, 'JobType', TitleId, TitleValue
- FROM @sc2 WHERE LEN(TitleId) = 4
- END
- IF @JobTypeLen = -1
- DELETE @sc WHERE TitleID NOT IN(SELECT a FROM dbo.fnSplit(@dcJobTypeID, ','))
- INSERT INTO SearchDB..paSearchCount_3(paSearchConditionID, Title, TitleId, TitleValue)
- SELECT @paSearchConditionID, 'JobType', TitleId, TitleValue FROM @sc
- DELETE @sc
- DELETE @sc2
- --------------------------region
- INSERT INTO @sc2(paSearchConditionID, Title, TitleId, TitleValue)
- SELECT @paSearchConditionID, 'Region', dcRegionID, COUNT(*) FROM #Job WITH(NOLOCK)
- GROUP BY dcRegionID ORDER BY dcRegionID
- ----计算全部地区,2位的数据
- IF @JobPlaceLen IN(-1, 0)
- INSERT INTO @sc(paSearchConditionID, Title, TitleId, TitleValue)
- SELECT @paSearchConditionID, 'Region', LEFT(TitleID, 2) TitleID, SUM(TitleValue) TitleValue
- FROM @sc2 GROUP BY LEFT(TitleID, 2)
- IF @JobPlaceLen IN(-1, 2)
- INSERT INTO @sc(paSearchConditionID, Title, TitleId, TitleValue)
- SELECT @paSearchConditionID, 'Region', LEFT(TitleID, 4) TitleID, SUM(TitleValue) TitleValue
- FROM @sc2 WHERE LEN(TitleID) >= 4 GROUP BY LEFT(TitleID, 4)
- IF @JobPlaceLen IN(-1, 4)
- INSERT INTO @sc(paSearchConditionID, Title, TitleId, TitleValue)
- SELECT @paSearchConditionID, 'Region', TitleID, TitleValue
- FROM @sc2 WHERE LEN(TitleID) = 6
- IF @JobPlaceLen = -1
- DELETE @sc WHERE TitleID NOT IN(SELECT ID FROM @T_JobPlace)
- ELSE
- DELETE @sc WHERE LEN(TitleID) <> @JobPlaceLen + 2
- INSERT INTO SearchDB..paSearchCount_3(paSearchConditionID, Title, TitleId, TitleValue)
- SELECT paSearchConditionID, Title, TitleId, TitleValue FROM @sc
- ----------------------------
- INSERT INTO SearchDB..paSearchCount_3(paSearchConditionID, Title, TitleId, TitleValue)
- SELECT @paSearchConditionID, 'Salary', dcSalaryID, COUNT(*) FROM #Job WITH(NOLOCK)
- GROUP BY dcSalaryID ORDER BY dcSalaryID
- INSERT INTO SearchDB..paSearchCount_3(paSearchConditionID, Title, TitleId, TitleValue)
- SELECT @paSearchConditionID, 'Education', CASE WHEN dcEducationId IN(2, 3, 4) THEN 2 ELSE dcEducationId END, COUNT(*) FROM #Job WITH(NOLOCK)
- GROUP BY CASE WHEN dcEducationId IN(2, 3, 4) THEN 2 ELSE dcEducationId END
- ORDER BY CASE WHEN dcEducationId IN(2, 3, 4) THEN 2 ELSE dcEducationId END
-
- INSERT INTO SearchDB..paSearchCount_3(paSearchConditionID, Title, TitleId, TitleValue)
- SELECT @paSearchConditionID, 'Experience', MinExperience, COUNT(*) FROM #Job WITH(NOLOCK)
- GROUP BY MinExperience ORDER BY MinExperience
- INSERT INTO SearchDB..paSearchCount_3(paSearchConditionID, Title, TitleId, TitleValue)
- SELECT @paSearchConditionID, 'EmployType', EmployType, COUNT(*) FROM #Job WITH(NOLOCK)
- GROUP BY EmployType ORDER BY EmployType
- INSERT INTO SearchDB..paSearchCount_3(paSearchConditionID, Title, TitleId, TitleValue)
- SELECT @paSearchConditionID, 'CompanySize', dcCompanySizeID, COUNT(*) FROM #Job WITH(NOLOCK)
- GROUP BY dcCompanySizeID ORDER BY dcCompanySizeID
- INSERT INTO SearchDB..paSearchCount_3(paSearchConditionID, Title, TitleId, TitleValue)
- SELECT @paSearchConditionID, 'Industry', dcIndustryID, COUNT(*)
- FROM #Job a WITH(NOLOCK), cpIndustry b WITH(NOLOCK)
- WHERE a.cpMainId = b.cpMainId
- GROUP BY dcIndustryID ORDER BY dcIndustryID
- IF EXISTS(SELECT TOP 1 'x' FROM #FullText)
- INSERT INTO SearchDB..paSearchJobID_3(paSearchConditionID, JobId, IsTop)
- SELECT TOP 10 @paSearchConditionID, a.JobId, 1
- FROM SearchJobTop a WITH(NOLOCK), (SELECT ID FROM #Job WITH(NOLOCK) WHERE RowId < 2001) b
- WHERE b.ID = a.JobId
- AND CHARINDEX(@KeyWord, a.JobName) > 0
- ORDER BY a.OrderType, a.OpenDate DESC
- ELSE
- INSERT INTO SearchDB..paSearchJobID_3(paSearchConditionID, JobId, IsTop)
- SELECT TOP 10 @paSearchConditionID, a.JobId, 1
- FROM SearchJobTop a WITH(NOLOCK), (SELECT ID FROM #Job WITH(NOLOCK) WHERE RowId < 2001) b
- WHERE b.ID = a.JobId
- ORDER BY a.OrderType, a.OpenDate DESC
- SET @TopRows = @@ROWCOUNT
- INSERT INTO SearchDB..paSearchJobID_3(paSearchConditionID, JobId, IsTop)
- SELECT TOP 2000 @paSearchConditionID, ID, 0 FROM #Job WITH(NOLOCK) ORDER BY RowId
- SET @AllRows = @@ROWCOUNT
- IF @TopRows = 0 AND @AllRows > 100
- UPDATE SearchDB..paSearchJobID_3 SET IsTop = 1
- WHERE paSearchConditionID = @paSearchConditionID
- AND ID IN (SELECT TOP 3 ID FROM SearchDB..paSearchJobID_3 WITH(NOLOCK) WHERE paSearchConditionID = @paSearchConditionID ORDER BY ID)
- END
- DROP TABLE #Job
- DROP TABLE #FullText
- --PRINT 'DROP #JOB ' + CONVERT(VARCHAR(30), GETDATE(), 121)
- --COMMIT
- --GOTO GetRecordSet
- GetRecordSet:
- BEGIN
- ----返回查询数量
- SELECT ValidJobNumber FROM SearchDB..paSearchCondition WITH(NOLOCK) WHERE ID=@paSearchConditionID
- UPDATE SearchDB..paSearchCondition SET ReuseNumber = ReuseNumber + 1 WHERE ID=@paSearchConditionID
- ----返回20行查询结果
- IF (@TableID = 0)
- BEGIN
- SELECT @MinId = MIN(ID) FROM SearchDB..paSearchJobID_0 WITH(NOLOCK) WHERE paSearchConditionID=@paSearchConditionID
- SET @MinId = @MinId+(@PageNumber-1)*@PageSize
- SELECT TOP 30 a.ID, a.cpMainID, a.caMainID, a.Name as JobName, a.dcJobTypeID,
- a.dcJobTypeIDMinor, a.NeedNumber, a.dcSalaryID, a.dcSalaryIDMax, a.EmployType,
- a.dcRegionID, a.Responsibility, a.Demand, a.dcEducationID,
- a.MinExperience, a.MinAge, a.MaxAge, a.IssueDate, a.IssueEND,
- a.IsDelete, a.AddDate, a.RefreshDate, a.Welfare1, a.Welfare2, a.Welfare3,
- a.Welfare4, a.Welfare5, a.Welfare6, a.Welfare7, a.Welfare8,
- a.Welfare9, a.Welfare10, a.Welfare11, a.Welfare12, a.Welfare13,
- a.Welfare14, a.Welfare15, a.Welfare16, a.Welfare17, a.Welfare18,
- a.Welfare19, a.SecondId EnJobID, b.SecondId EnCpMainID,
- a.LastModifyDate, b.Name as cpName, b.dcCompanySizeID,
- b.HasLicence, b.RealName, b.UnLimitedDate, b.BalanceDate, b.Balance,
- b.MemberType, '' cpIndustry, --STUFF((SELECT ','+LTRIM(x.dcIndustryid)+',c'+LTRIM(isnull(y.Category,0)) FROM cpIndustry x,dcIndustry y WHERE x.dcIndustryid = y.id AND x.cpMainid = b.id FOR XML PATH('')),1,1,'') cpIndustry,
- c.IsTop, b.IsRefreshed, ISNULL(d.IsOnline, 0) IsOnline, d.IsVi, d.ViPlanId, d.InterviewDate, CASE WHEN b.ReplyRate >= 0.6 THEN b.ReplyRate ELSE NULL END Replyrate,
- (SELECT TOP 1 ID from paAttention WITH(NOLOCK) WHERE AttentionType=2 AND AttentionID=a.ID AND paMainId = @paMainId) AttentionId
- FROM JobPublish a WITH(NOLOCK)
- INNER JOIN cpMainPublish b WITH(NOLOCK) ON a.cpMainID = b.ID
- INNER JOIN SearchDB..paSearchJobID_0 c WITH(NOLOCK) ON a.id = c.JobID
- LEFT JOIN caOnline d WITH(NOLOCK) ON a.caMainId = d.caMainId
- WHERE paSearchConditionID=@paSearchConditionID
- AND c.ID >= @MinId
- ORDER BY c.ID, a.ID DESC
- END
- ELSE IF (@TableID = 1)
- BEGIN
- SELECT @MinId = MIN(ID) FROM SearchDB..paSearchJobID_1 WITH(NOLOCK) WHERE paSearchConditionID=@paSearchConditionID
- SET @MinId = @MinId+(@PageNumber-1)*@PageSize
- SELECT TOP 30 a.ID, a.cpMainID, a.caMainID, a.Name as JobName, a.dcJobTypeID,
- a.dcJobTypeIDMinor, a.NeedNumber, a.dcSalaryID, a.dcSalaryIDMax, a.EmployType,
- a.dcRegionID, a.Responsibility, a.Demand, a.dcEducationID,
- a.MinExperience, a.MinAge, a.MaxAge, a.IssueDate, a.IssueEND,
- a.IsDelete, a.AddDate, a.RefreshDate, a.Welfare1, a.Welfare2, a.Welfare3,
- a.Welfare4, a.Welfare5, a.Welfare6, a.Welfare7, a.Welfare8,
- a.Welfare9, a.Welfare10, a.Welfare11, a.Welfare12, a.Welfare13,
- a.Welfare14, a.Welfare15, a.Welfare16, a.Welfare17, a.Welfare18, a.Welfare19,
- a.SecondId EnJobID, b.SecondId EnCpMainID,
- a.LastModifyDate, b.Name cpName, b.dcCompanySizeID,
- b.HasLicence, b.RealName, b.UnLimitedDate, b.BalanceDate, b.Balance,
- b.MemberType, '' cpIndustry, --STUFF((SELECT ','+LTRIM(x.dcIndustryid)+',c'+LTRIM(isnull(y.Category,0)) FROM cpIndustry x,dcIndustry y WHERE x.dcIndustryid = y.id AND x.cpMainid = b.id FOR XML PATH('')),1,1,'') cpIndustry,
- c.IsTop, b.IsRefreshed, ISNULL(d.IsOnline, 0) IsOnline, d.IsVi, d.ViPlanId, d.InterviewDate, CASE WHEN b.ReplyRate >= 0.6 THEN b.ReplyRate ELSE NULL END Replyrate,
- (SELECT TOP 1 ID from paAttention WITH(NOLOCK) WHERE AttentionType=2 AND AttentionID=a.ID AND paMainId = @paMainId) AttentionId
- FROM JobPublish a WITH(NOLOCK)
- INNER JOIN cpMainPublish b WITH(NOLOCK) ON a.cpMainID = b.ID
- INNER JOIN SearchDB..paSearchJobID_1 c WITH(NOLOCK) ON a.id = c.JobID
- LEFT JOIN caOnline d WITH(NOLOCK) ON a.caMainId = d.caMainId
- WHERE paSearchConditionID=@paSearchConditionID
- AND c.ID >= @MinId
- ORDER BY c.ID, a.ID DESC
- END
- ELSE IF (@TableID = 2)
- BEGIN
- SELECT @MinId = MIN(ID) FROM SearchDB..paSearchJobID_2 WITH(NOLOCK) WHERE paSearchConditionID=@paSearchConditionID
- SET @MinId = @MinId+(@PageNumber-1)*@PageSize
- SELECT TOP 30 a.ID, a.cpMainID, a.caMainID, a.Name as JobName, a.dcJobTypeID,
- a.dcJobTypeIDMinor, a.NeedNumber, a.dcSalaryID, a.dcSalaryIDMax, a.EmployType,
- a.dcRegionID, a.Responsibility, a.Demand, a.dcEducationID,
- a.MinExperience, a.MinAge, a.MaxAge, a.IssueDate, a.IssueEND,
- a.IsDelete, a.AddDate, a.RefreshDate, a.Welfare1, a.Welfare2, a.Welfare3,
- a.Welfare4, a.Welfare5, a.Welfare6, a.Welfare7, a.Welfare8,
- a.Welfare9, a.Welfare10, a.Welfare11, a.Welfare12, a.Welfare13,
- a.Welfare14, a.Welfare15, a.Welfare16, a.Welfare17, a.Welfare18, a.Welfare19,
- a.SecondId EnJobID, b.SecondId EnCpMainID,
- a.LastModifyDate, b.Name cpName, b.dcCompanySizeID,
- b.HasLicence, b.RealName, b.UnLimitedDate, b.BalanceDate, b.Balance,
- b.MemberType, '' cpIndustry, --STUFF((SELECT ','+LTRIM(x.dcIndustryid)+',c'+LTRIM(isnull(y.Category,0)) FROM cpIndustry x,dcIndustry y WHERE x.dcIndustryid = y.id AND x.cpMainid = b.id FOR XML PATH('')),1,1,'') cpIndustry,
- c.IsTop, b.IsRefreshed, ISNULL(d.IsOnline, 0) IsOnline, d.IsVi, d.ViPlanId, d.InterviewDate, CASE WHEN b.ReplyRate >= 0.6 THEN b.ReplyRate ELSE NULL END Replyrate,
- (SELECT TOP 1 ID from paAttention WITH(NOLOCK) WHERE AttentionType=2 AND AttentionID=a.ID AND paMainId = @paMainId) AttentionId
- FROM JobPublish a WITH(NOLOCK)
- INNER JOIN cpMainPublish b WITH(NOLOCK) ON a.cpMainID = b.ID
- INNER JOIN SearchDB..paSearchJobID_2 c WITH(NOLOCK) ON a.id = c.JobID
- LEFT JOIN caOnline d WITH(NOLOCK) ON a.caMainId = d.caMainId
- WHERE paSearchConditionID=@paSearchConditionID
- AND c.ID >= @MinId
- ORDER BY c.ID, a.ID DESC
- END
- ELSE IF (@TableID = 3)
- BEGIN
- SELECT @MinId = MIN(ID) FROM SearchDB..paSearchJobID_3 WITH(NOLOCK) WHERE paSearchConditionID=@paSearchConditionID
- SET @MinId = @MinId+(@PageNumber-1)*@PageSize
- SELECT TOP 30 a.ID, a.cpMainID, a.caMainID, a.Name as JobName, a.dcJobTypeID,
- a.dcJobTypeIDMinor, a.NeedNumber, a.dcSalaryID, a.dcSalaryIDMax, a.EmployType,
- a.dcRegionID, a.Responsibility, a.Demand, a.dcEducationID,
- a.MinExperience, a.MinAge, a.MaxAge, a.IssueDate, a.IssueEND,
- a.IsDelete, a.AddDate, a.RefreshDate, a.Welfare1, a.Welfare2, a.Welfare3,
- a.Welfare4, a.Welfare5, a.Welfare6, a.Welfare7, a.Welfare8,
- a.Welfare9, a.Welfare10, a.Welfare11, a.Welfare12, a.Welfare13,
- a.Welfare14, a.Welfare15, a.Welfare16, a.Welfare17, a.Welfare18, a.Welfare19,
- a.SecondId EnJobID, b.SecondId EnCpMainID,
- a.LastModifyDate, b.Name cpName, b.dcCompanySizeID,
- b.HasLicence, b.RealName, b.UnLimitedDate, b.BalanceDate, b.Balance,
- b.MemberType, '' cpIndustry, --STUFF((SELECT ',' + LTRIM(x.dcIndustryid) + ',c' + LTRIM(isnull(y.Category,0)) FROM cpIndustry x,dcIndustry y WHERE x.dcIndustryid = y.id AND x.cpMainid = b.id FOR XML PATH('')),1,1,'') cpIndustry,
- c.IsTop, b.IsRefreshed, ISNULL(d.IsOnline, 0) IsOnline, d.IsVi, d.ViPlanId, d.InterviewDate, CASE WHEN b.ReplyRate >= 0.6 THEN b.ReplyRate ELSE NULL END Replyrate,
- (SELECT TOP 1 ID from paAttention WITH(NOLOCK) WHERE AttentionType=2 AND AttentionID=a.ID AND paMainId = @paMainId) AttentionId
- FROM JobPublish a WITH(NOLOCK)
- INNER JOIN cpMainPublish b WITH(NOLOCK) ON a.cpMainID = b.ID
- INNER JOIN SearchDB..paSearchJobID_3 c WITH(NOLOCK) ON a.id = c.JobID
- LEFT JOIN caOnline d WITH(NOLOCK) ON a.caMainId = d.caMainId
- WHERE paSearchConditionID=@paSearchConditionID
- AND c.ID >= @MinId
- ORDER BY c.ID, a.ID DESC
- END
- --RICHARD 2011-7-23 16:51分修改
- ----返回统计数量
- IF @Type=1
- BEGIN
- DECLARE @RegionCount AS INT
- SELECT @RegionCount = -1
- IF CHARINDEX(',', @dcRegionID) = 0 AND LEN(@dcRegionID) > 0
- BEGIN
- IF NOT LEFT(@dcRegionID, 1) = 'p'
- SELECT @RegionCount = COUNT(*) FROM dcRegion WHERE ParentID = @dcRegionID
- END
- IF (@TableID = 0)
- BEGIN
- SELECT * FROM SearchDB..paSearchCount_0 WITH(NOLOCK) WHERE Title = 'JobType' AND paSearchConditionID=@paSearchConditionID ORDER BY Title, CONVERT(VARCHAR(10), TitleID)
- IF @RegionCount = 0
- SELECT * FROM dcMapPlace WITH(NOLOCK) WHERE dcRegionID = @dcRegionID
- ELSE
- SELECT * FROM SearchDB..paSearchCount_0 WITH(NOLOCK) WHERE Title = 'Region' AND paSearchConditionID=@paSearchConditionID ORDER BY Title, CONVERT(VARCHAR(10), TitleID)
- SELECT * FROM SearchDB..paSearchCount_0 WITH(NOLOCK) WHERE Title = 'Education' AND paSearchConditionID=@paSearchConditionID ORDER BY Title, CONVERT(INT, TitleID)
- SELECT * FROM SearchDB..paSearchCount_0 WITH(NOLOCK) WHERE Title = 'Experience' AND paSearchConditionID=@paSearchConditionID ORDER BY Title, CONVERT(INT, TitleID)
- SELECT * FROM SearchDB..paSearchCount_0 WITH(NOLOCK) WHERE Title = 'Salary' AND paSearchConditionID=@paSearchConditionID ORDER BY Title, CONVERT(INT, TitleID)
- SELECT * FROM SearchDB..paSearchCount_0 WITH(NOLOCK) WHERE Title = 'EmployType' AND paSearchConditionID=@paSearchConditionID ORDER BY Title, CONVERT(INT, TitleID)
- SELECT * FROM SearchDB..paSearchCount_0 WITH(NOLOCK) WHERE Title = 'CompanySize' AND paSearchConditionID=@paSearchConditionID ORDER BY Title, CONVERT(INT, TitleID)
- SELECT * FROM SearchDB..paSearchCount_0 WITH(NOLOCK) WHERE Title = 'Industry' AND paSearchConditionID=@paSearchConditionID ORDER BY Title, CONVERT(INT, TitleID)
- END
- IF (@TableID = 1)
- BEGIN
- SELECT * FROM SearchDB..paSearchCount_1 WITH(NOLOCK) WHERE Title = 'JobType' AND paSearchConditionID=@paSearchConditionID ORDER BY Title, CONVERT(VARCHAR(10), TitleID)
- IF @RegionCount = 0
- SELECT * FROM dcMapPlace WITH(NOLOCK) WHERE dcRegionID = @dcRegionID
- ELSE
- SELECT * FROM SearchDB..paSearchCount_1 WITH(NOLOCK) WHERE Title = 'Region' AND paSearchConditionID=@paSearchConditionID ORDER BY Title, CONVERT(VARCHAR(10), TitleID)
- SELECT * FROM SearchDB..paSearchCount_1 WITH(NOLOCK) WHERE Title = 'Education' AND paSearchConditionID=@paSearchConditionID ORDER BY Title, CONVERT(INT, TitleID)
- SELECT * FROM SearchDB..paSearchCount_1 WITH(NOLOCK) WHERE Title = 'Experience' AND paSearchConditionID=@paSearchConditionID ORDER BY Title, CONVERT(INT, TitleID)
- SELECT * FROM SearchDB..paSearchCount_1 WITH(NOLOCK) WHERE Title = 'Salary' AND paSearchConditionID=@paSearchConditionID ORDER BY Title, CONVERT(INT, TitleID)
- SELECT * FROM SearchDB..paSearchCount_1 WITH(NOLOCK) WHERE Title = 'EmployType' AND paSearchConditionID=@paSearchConditionID ORDER BY Title, CONVERT(INT, TitleID)
- SELECT * FROM SearchDB..paSearchCount_1 WITH(NOLOCK) WHERE Title = 'CompanySize' AND paSearchConditionID=@paSearchConditionID ORDER BY Title, CONVERT(INT, TitleID)
- SELECT * FROM SearchDB..paSearchCount_1 WITH(NOLOCK) WHERE Title = 'Industry' AND paSearchConditionID=@paSearchConditionID ORDER BY Title, CONVERT(INT, TitleID)
- END
- IF (@TableID = 2)
- BEGIN
- SELECT * FROM SearchDB..paSearchCount_2 WITH(NOLOCK) WHERE Title = 'JobType' AND paSearchConditionID=@paSearchConditionID ORDER BY Title, CONVERT(VARCHAR(10), TitleID)
- IF @RegionCount = 0
- SELECT * FROM dcMapPlace WITH(NOLOCK) WHERE dcRegionID = @dcRegionID
- ELSE
- SELECT * FROM SearchDB..paSearchCount_2 WITH(NOLOCK) WHERE Title = 'Region' AND paSearchConditionID=@paSearchConditionID ORDER BY Title, CONVERT(VARCHAR(10), TitleID)
- SELECT * FROM SearchDB..paSearchCount_2 WITH(NOLOCK) WHERE Title = 'Education' AND paSearchConditionID=@paSearchConditionID ORDER BY Title, CONVERT(INT, TitleID)
- SELECT * FROM SearchDB..paSearchCount_2 WITH(NOLOCK) WHERE Title = 'Experience' AND paSearchConditionID=@paSearchConditionID ORDER BY Title, CONVERT(INT, TitleID)
- SELECT * FROM SearchDB..paSearchCount_2 WITH(NOLOCK) WHERE Title = 'Salary' AND paSearchConditionID=@paSearchConditionID ORDER BY Title, CONVERT(INT, TitleID)
- SELECT * FROM SearchDB..paSearchCount_2 WITH(NOLOCK) WHERE Title = 'EmployType' AND paSearchConditionID=@paSearchConditionID ORDER BY Title, CONVERT(INT, TitleID)
- SELECT * FROM SearchDB..paSearchCount_2 WITH(NOLOCK) WHERE Title = 'CompanySize' AND paSearchConditionID=@paSearchConditionID ORDER BY Title, CONVERT(INT, TitleID)
- SELECT * FROM SearchDB..paSearchCount_2 WITH(NOLOCK) WHERE Title = 'Industry' AND paSearchConditionID=@paSearchConditionID ORDER BY Title, CONVERT(INT, TitleID)
- END
- IF (@TableID = 3)
- BEGIN
- SELECT * FROM SearchDB..paSearchCount_3 WITH(NOLOCK) WHERE Title = 'JobType' AND paSearchConditionID=@paSearchConditionID ORDER BY Title, CONVERT(VARCHAR(10), TitleID)
- IF @RegionCount = 0
- SELECT * FROM dcMapPlace WITH(NOLOCK) WHERE dcRegionID = @dcRegionID
- ELSE
- SELECT * FROM SearchDB..paSearchCount_3 WITH(NOLOCK) WHERE Title = 'Region' AND paSearchConditionID=@paSearchConditionID ORDER BY Title, CONVERT(VARCHAR(10), TitleID)
- SELECT * FROM SearchDB..paSearchCount_3 WITH(NOLOCK) WHERE Title = 'Education' AND paSearchConditionID=@paSearchConditionID ORDER BY Title, CONVERT(INT, TitleID)
- SELECT * FROM SearchDB..paSearchCount_3 WITH(NOLOCK) WHERE Title = 'Experience' AND paSearchConditionID=@paSearchConditionID ORDER BY Title, CONVERT(INT, TitleID)
- SELECT * FROM SearchDB..paSearchCount_3 WITH(NOLOCK) WHERE Title = 'Salary' AND paSearchConditionID=@paSearchConditionID ORDER BY Title, CONVERT(INT, TitleID)
- SELECT * FROM SearchDB..paSearchCount_3 WITH(NOLOCK) WHERE Title = 'EmployType' AND paSearchConditionID=@paSearchConditionID ORDER BY Title, CONVERT(INT, TitleID)
- SELECT * FROM SearchDB..paSearchCount_3 WITH(NOLOCK) WHERE Title = 'CompanySize' AND paSearchConditionID=@paSearchConditionID ORDER BY Title, CONVERT(INT, TitleID)
- SELECT * FROM SearchDB..paSearchCount_3 WITH(NOLOCK) WHERE Title = 'Industry' AND paSearchConditionID=@paSearchConditionID ORDER BY Title, CONVERT(INT, TitleID)
- END
- END
- --UPDATE SearchDB..paSearchCondition SET SQl=@JobPlaceLen WHERE ID=@paSearchConditionID
- RETURN
- END
- END TRY
- BEGIN CATCH
- ---检查是否已经建立临时表,已经建立则删除
- DECLARE @para VARCHAR(MAX)
- SET @para = '@dcJobTypeID=' + ISNULL(@dcJobTypeID, '') + '|' +
- '@dcRegionID=' + ISNULL(@dcRegionID, '') + '|' +
- '@dcIndustryID=' + ISNULL(@dcIndustryID, '') + '|' +
- '@EmployType=' + ISNULL(@EmployType, '') + '|' +
- '@KeyWord=' + ISNULL(@KeyWord, '') + '|' +
- '@ORDER=' + ISNULL(@ORDER, '') + '|' +
- '@SessionID=' + ISNULL(@SessionID, '') + '|' +
- '@Welfare=' + ISNULL(@Welfare, '')
- INSERT INTO ErrorLog
- SELECT 'p1 ' +ISNULL(error_Message(), ' no msg')+ ' para=' + ISNULL(@Para, 'no para ') + ISNULL(@SQL, ' no sql'), error_number(), error_line(), GETDATE()
- END CATCH
- GO
- /****** Object: StoredProcedure [dbo].[pcJobBySearchSelectHotPlace] Script Date: 2018/12/13 19:08:40 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- CREATE PROCEDURE [dbo].[pcJobBySearchSelectHotPlace]
- (
- @dcJobTypeID VARCHAR(100), --职位类别
- @dcRegionID VARCHAR(100), --求职地区
- @dcIndustryID VARCHAR(100), --求职行业
- @dcSalaryID TINYINT, --月薪
- @IsNegotiable BIT, --1允许面议,不面议
- @MinExperience TINYINT, --工作经验,100为未选择
- @dcEducationID TINYINT, --最低学历
- @EmployType VARCHAR(10), --工作性质,1全职;3兼职;4实习,
- @KeyWord NVARCHAR(50), --关键词
- @KeyType TINYINT, --搜索类别,0无;1-全文;2-职位;3-公司
- @ORDER VARCHAR(100), --显示顺序,没有用
- @RefreshNo INT, --1, 1天内;2, 3天内;3,一周内;4,15天内;5,一个月内;6超过一个月
- @Type INT, --1:主动搜索 点击搜索按钮 10分钟,翻页60分钟有效;0:翻页搜索,不刷新
- @PageNumber INT, --翻页页码
- @SessionID INT,
- @CompanySizeID VARCHAR(1), --企业规模
- @JobId INT,
- @Welfare VARCHAR(50) --
- --sessionid,没有采用全部人员共享方式,因为10分钟内,搜索相同条件的可能性很大,
- --而10分钟搜索的用户翻到第二页时内容可能会和第一页一样。这样让用户很难理解。
- --使用SessionID, 可以保证60分钟内查询结果一致。出现不一致的几率很小
- )
- AS
- INSERT proclog SELECT 'pcJobBySearchSelectHotPlace', @dcRegionID, GETDATE()
- --return @SessionId = 15
- SET NOCOUNT ON
- BEGIN TRY
- IF @JobID > 0
- BEGIN
- IF EXISTS(SELECT 'x' FROM JobPublish WITH(NOLOCK) WHERE ID = @JobId AND Valid = 1)
- BEGIN
- SELECT 1
- SELECT a.ID, a.cpMainID, a.caMainID, a.Name as JobName, a.dcJobTypeID,
- a.dcJobTypeIDMinor, a.NeedNumber, a.dcSalaryID, a.EmployType,
- a.dcRegionID, a.Responsibility, a.Demand, a.dcEducationID,
- a.MinExperience, a.MinAge, a.MaxAge, a.IssueDate, a.IssueEND,
- a.IsDelete, a.AddDate, a.RefreshDate,
- a.LastModifyDate,a.Welfare1,a.Welfare2,a.Welfare3,
- a.Welfare4,a.Welfare5,a.Welfare6,a.Welfare7,a.Welfare8,
- a.Welfare9,a.Welfare10,a.Welfare11,a.Welfare12,a.Welfare13,
- a.Welfare14,a.Welfare15,a.Welfare16,a.Welfare17,a.Welfare18,a.SecondId EnJobID,b.SecondId EnCpMainID,
- b.Name as cpName, b.dcCompanySizeID,
- b.HasLicence, b.UnLimitedDate, b.BalanceDate, b.Balance, b.MemberType,
- '' cpIndustry, --STUFF((SELECT ','+LTRIM(x.dcIndustryid)+',c'+LTRIM(isnull(y.Category,0)) FROM cpIndustry x,dcIndustry y WHERE x.dcIndustryid = y.id AND x.cpMainid = b.id FOR XML PATH('')),1,1,'') cpIndustry,
- 0 IsTop, 0 IsRefreshed, c.IsOnline, c.IsVi, c.ViPlanId, c.InterviewDate
- FROM JobPublish a WITH(NOLOCK)
- INNER JOIN cpMainPublish b WITH(NOLOCK) ON a.cpMainID = b.ID
- LEFT Join caOnline c WITH(NOLOCK) ON a.caMainId = c.caMainId
- WHERE a.id = @JobID AND a.Valid = 1 AND b.Valid = 1
- END
- ELSE
- BEGIN
- SELECT 0
- SELECT TOP 0 NULL
- END
- SELECT TOP 0 * FROM SearchDB..paSearchCount WITH(NOLOCK)
- SELECT TOP 0 * FROM SearchDB..paSearchCount WITH(NOLOCK)
- SELECT TOP 0 * FROM SearchDB..paSearchCount WITH(NOLOCK)
- SELECT TOP 0 * FROM SearchDB..paSearchCount WITH(NOLOCK)
- SELECT TOP 0 * FROM SearchDB..paSearchCount WITH(NOLOCK)
- RETURN
- END
- ELSE
- BEGIN
- DECLARE @KeyWordTemp AS NVARCHAR(50), @KeyTypeTemp AS INT, @ReuseNumber AS INT
- ----给null值变量赋默认值
- IF NOT LEFT(@dcRegionID,1) = 'p'
- SELECT @dcRegionID = RTRIM(dbo.FormatIDS(@dcRegionID))
- SELECT @dcJobTypeID = RTRIM(dbo.FormatIDS(@dcJobTypeID)),
- @dcIndustryID = RTRIM(dbo.FormatIDS(@dcIndustryID)),
- @dcSalaryID = ISNULL(@dcSalaryID, 0),
- @IsNegotiable = ISNULL(@IsNegotiable, 0),
- @MinExperience = ISNULL(@MinExperience, 100),
- @dcEducationID = ISNULL(@dcEducationID, 0),
- @EmployType = CASE @EmployType WHEN '2' THEN '1,3' ELSE ISNULL(@EmployType, '') END,
- @CompanySizeID = ISNULL(@CompanySizeID, '0'),
- @KeyWord = dbo.SafeSQL(ISNULL(@KeyWord, '')),
- @ORDER = ' ORDER BY a.RefreshDate DESC, a.ID', --@ORDER = dbo.SafeSQL(ISNULL(@ORDER, '')),
- @Type = ISNULL(@Type, 0),
- @PageNumber = ISNULL(@PageNumber, 0),
- @KeyType = CASE @KeyWord WHEN NULL THEN 0 ELSE 1 END,
- @Welfare = RTRIM(dbo.FormatIDS(@Welfare))
- IF @dcSalaryID = 0
- SET @IsNegotiable = 0
-
- --@RefreshNo = 0选择全部数据,不限制时间
- SET @RefreshNo = 0
- IF(@KeyType = 0 AND ISNULL(@dcJobTypeID, '') = '' AND ISNULL(@dcRegionID, '') = '' AND ISNULL(@dcIndustryID, '') = '')
- RETURN
- --如果关键词不为空 查询关键词对应的搜索类型 max 2012-12-25
-
- IF (@KeyWord IS NOT NULL)
- BEGIN
- SELECT @KeyTypeTemp = @KeyType
- SELECT @KeyType = KeyType
- FROM Searchdb..SearchKeyword WITH(NOLOCK)
- WHERE Keyword = @KeyWord
- -- 如果搜索类型不是职位类别 按照原搜索类型搜索 max 2012-12-25
- IF @KeyType <> 4
- SET @KeyType = @KeyTypeTemp
- IF @KeyWord = ''
- SET @KeyType = 0
- END
- -- 搜索类型4为职业类别
- IF(@KeyType = 4)
- BEGIN
- IF ISNULL(@dcJobTypeID, '') = ''
- BEGIN
- SELECT @dcJobTypeID = ID
- FROM dcJobType WITH(NOLOCK)
- WHERE Description = @KeyWord
- OR DescriptionEng = @KeyWord
- SELECT @KeyWord = '', @KeyType = 0
- END
- ELSE
- SET @KeyType = @KeyTypeTemp
- END
- IF (@KeyWord IS NOT NULL)
- BEGIN
- SET @KeyWordTemp = @KeyWord
- END
- IF LEN(@KeyWordTemp) > 2
- BEGIN
- SET @KeyWordTemp = REPLACE(@KeyWordTemp, '公司', '')
- END
- IF ISNULL(@KeyType, 0) NOT IN (1, 2, 3, 4, 5)
- BEGIN
- SET @KeyType = 0
- SET @KeyWord = ''
- END
-
- IF RIGHT(@dcJobTypeID, 1) = ','
- SET @dcJobTypeID = LEFT(@dcJobTypeID, LEN(@dcJobTypeID) - 1)
- IF RIGHT(@dcRegionID, 1) = ','
- SET @dcRegionID = LEFT(@dcRegionID, LEN(@dcRegionID) - 1)
- IF RIGHT(@dcIndustryID, 1) = ','
- SET @dcIndustryID = LEFT(@dcIndustryID, LEN(@dcIndustryID) - 1)
- DECLARE @paSearchConditionID AS INT,
- @MinId AS INT,
- @PageSize AS TINYINT,
- @TableID AS TINYINT
- SELECT @paSearchConditionID = 0, @PageSize = 30
- /*, @SessionId = ISNULL(@SessionId, 9908) --每页的行数
- IF @SessionId = 0
- SET @SessionId = 9920
- IF @SessionId = 1
- SET @SessionId = 9921
- IF @SessionId = 11
- SET @SessionId = 9922
- IF @SessionId = 111
- SET @SessionId = 9923
- */
- SET @SessionId = 15
- ----搜索1分钟前的数据
- SELECT TOP 1 @paSearchConditionID = ID,
- @ReuseNumber = ReuseNumber
- FROM SearchDB..paSearchCondition WITH(NOLOCK)
- WHERE JobType=@dcJobTypeID
- AND JobPlace=@dcRegionID AND Industry=@dcIndustryID AND Education=@dcEducationID
- AND Experience=@MinExperience AND Salary=@dcSalaryID AND IsNegotiable=@IsNegotiable
- AND EmployType=@EmployType AND KeyWord=@KeyWord AND KeyType=@KeyType
- AND CompanySizeID = @CompanySizeID AND Welfare = @Welfare
- AND LogTime > DATEADD(MINUTE, -1, GETDATE()) AND ReuseNumber > 0
- AND RefreshNo = 0
- ORDER BY ID DESC
- IF @ReuseNumber = 0
- BEGIN
- SELECT TOP 1 @paSearchConditionID = ID
- FROM SearchDB..paSearchCondition WITH(NOLOCK)
- WHERE JobType=@dcJobTypeID
- AND JobPlace=@dcRegionID AND Industry=@dcIndustryID AND Education=@dcEducationID
- AND Experience=@MinExperience AND Salary=@dcSalaryID AND IsNegotiable=@IsNegotiable
- AND EmployType=@EmployType AND KeyWord=@KeyWord AND KeyType=@KeyType
- AND CompanySizeID = @CompanySizeID AND Welfare = @Welfare
- AND ReuseNumber > 0 AND LogTime > DATEADD(MINUTE, -2, GETDATE())
- AND RefreshNo = 0
- ORDER BY ID DESC
- END
- IF ISNULL(@paSearchConditionID, 0) = 0
- BEGIN
- SET @Type =1
- GOTO SelectReset --无数据,重新搜索
- END
- ELSE
- BEGIN
- SELECT @TableID = @paSearchConditionID % 4
- GOTO GetRecordSet --从临时结果中提取数据
- END
- END
- SelectReset:
- --从job中搜索数据
- BEGIN TRAN
- DECLARE @SQL AS VARCHAR(8000)
- DECLARE @WHERE AS VARCHAR(8000)
- DECLARE @FROM AS VARCHAR(1000)
- ----记录查询条件
- INSERT INTO SearchDB..paSearchCondition(SessionID, LogTime, JobType, JobPlace, Industry, Education, Experience,
- Salary, IsNegotiable, EmployType, CompanySizeID, KeyWord, KeyType, ReuseNumber, Welfare)
- VALUES(
- @SessionId, GETDATE(), @dcJobTypeID, @dcRegionID, @dcIndustryID, @dcEducationID, @MinExperience,
- @dcSalaryID, @IsNegotiable, @EmployType, @CompanySizeID, @KeyWord, @KeyType, 0, @Welfare)
- SET @paSearchConditionID = @@IDENTITY
- SELECT @TableID = @paSearchConditionID % 4
- ------生成职位类别的表变量,因为职位类别有包含(父子)关系
- DECLARE @T_JobPlace AS TABLE(ID INT)
- DECLARE @T_JobType AS TABLE(ID INT)
- DECLARE @JobType AS VARCHAR(3000), @JobPlace AS VARCHAR(2000), @ValidJobNumber AS INT
- SELECT @JobPlace = '', @JobType=''
- ----生成工作地点的表变量
- IF LEN(@dcRegionID) > 0
- BEGIN
- IF LEFT(@dcRegionID,1) = 'p'
- BEGIN
- DECLARE @Degree AS DECIMAL(8,5),@LBLng AS DECIMAL(8,5),@LBLat AS DECIMAL(8,5),
- @RTLng AS DECIMAL(8,5),@RTLat AS DECIMAL(8,5),@Lat AS DECIMAL(8,5),@Lng AS DECIMAL(8,5)
-
- SELECT @Lat = Lat,@Lng = Lng FROM dcMapPlace WITH(NOLOCK) WHERE ID = RIGHT(@dcRegionID,LEN(@dcRegionID)-1)
- IF @dcRegionID LIKE '3201%'
- SET @Degree = 1000 / 100000.0
- ELSE
- SET @Degree = 2000 / 100000.0
- SET @LBLng = @Lng - @Degree
- SET @LBLat = @Lat - @Degree
- SET @RTLng = @Lng + @Degree
- SET @RTLat = @Lat + @Degree
- SET @JobPlace = 'a.Lng BETWEEN ' + CONVERT(VARCHAR,@LBLng) + ' AND ' + CONVERT(VARCHAR,@RTLng) + '
- AND a.Lat BETWEEN ' + CONVERT(VARCHAR,@LBLat) + ' AND ' + CONVERT(VARCHAR,@RTLat) + '
- AND (a.Lng-' + CONVERT(VARCHAR,@Lng) + ')*(a.Lng-' + CONVERT(VARCHAR,@Lng) + ')+
- (a.Lat-' + CONVERT(VARCHAR,@Lat) + ')*(a.Lat-' + CONVERT(VARCHAR,@Lat) + ')<' + CONVERT(VARCHAR,@Degree*@Degree)
- END
- ELSE
- BEGIN
- INSERT INTO @T_JobPlace
- SELECT * FROM dbo.fnSplit(@dcRegionID, ',')
- SELECT @JobPlace = (@JobPlace + ' OR a.dcRegionID Like ''' + LTRIM(STR(ID) + '%''')) FROM @T_JobPlace
- IF LEN(@JobPlace) > 0
- SET @JobPlace = RIGHT(@JobPlace, LEN(@JobPlace) -4)
- END
- END
- ----生成求聘职位的表变量
- IF LEN(@dcJobTypeID) > 0
- BEGIN
- DECLARE @T_Temp AS TABLE(ID INT) --临时表,用于构建组合查询语句
- INSERT INTO @T_Temp
- SELECT * FROM dbo.fnSplit(@dcJobTypeID, ',')
- INSERT INTO @T_JobType
- SELECT DISTINCT ID FROM dcJobType WITH(NOLOCK)
- WHERE ParentId IN(SELECT ID FROM @T_TEMP)
- OR ParentId2 in(SELECT ID FROM @T_TEMP)
- OR ID IN(SELECT ID FROM @T_TEMP)
- ----生成in字符串
- SELECT @JobType = (@JobType + LTRIM(STR(ID) + ',')) FROM @T_JobType
- IF RIGHT(@JobType, 1) = ','
- SET @JobType = LEFT(@JobType, LEN(@JobType) - 1)
- END
- ----建立临时表
- CREATE TABLE #Job(
- RowID INT IDENTITY(1, 1),
- ID INT NOT NULL,
- dcJobTypeID SMALLINT NOT NULL,
- dcJobTypeIDMinor SMALLINT NULL,
- dcSalaryID TINYINT NOT NULL,
- dcRegionID VARCHAR(6) NULL,
- dcEducationID TINYINT NOT NULL,
- MinExperience TINYINT NOT NULL,
- RefreshDate SMALLDATETIME NULL,
- EmployType TINYINT NULL,
- dcCompanySizeID SMALLINT NULL
- )
- CREATE TABLE #FullText(
- Priority INT,
- JobId INT NOT NULL
- )
- ------刷新时间,根据刷新时间编号计算
- ----生成插入临时表的Sql语句
- SET @SQL='
- INSERT INTO #Job
- SELECT a.ID, a.dcJobTypeID,
- a.dcJobTypeIDMinor, a.dcSalaryID,
- a.dcRegionID, a.dcEducationID, a.MinExperience,
- a.IssueDate,a.EmployType,b.dcCompanySizeID'
- SET @FROM = '
- FROM JobPublish a WITH(NOLOCK)
- INNER JOIN cpMainPublish b WITH(NOLOCK) ON a.cpMainID=b.ID'
- ----职位有效,单位新有效
- IF LEN(@dcIndustryID) > 0
- SET @WHERE = '
- WHERE b.ID IN (SELECT cpMainID FROM cpIndustry WHERE dcIndustryId in(' + @dcIndustryID + '))
- AND a.Valid = 1
- AND b.Valid = 1'
- ELSE
- SET @WHERE = '
- WHERE a.Valid = 1
- AND b.Valid = 1'
- ----需要增加全文索引的关键字查询
- IF @KeyWord LIKE '% %'
- BEGIN
- SET @KeyWord = REPLACE(@KeyWord, ' ', ' ')
- SET @KeyWord = REPLACE(@KeyWord, ' ', ' ')
- SET @KeyWord = REPLACE(@KeyWord, ' ', ' ')
- SET @KeyWord = '"' + REPLACE(@KeyWord, ' ', '" OR "') + '"'
- END
- IF @KeyWordTemp LIKE '% %'
- BEGIN
- SET @KeyWordTemp = REPLACE(@KeyWordTemp, ' ', ' ')
- SET @KeyWordTemp = REPLACE(@KeyWordTemp, ' ', ' ')
- SET @KeyWordTemp = REPLACE(@KeyWordTemp, ' ', ' ')
- SET @KeyWordTemp = '"' + REPLACE(@KeyWordTemp, ' ', '" OR "') + '"'
- END
- ----职位类别
- IF LEN(@dcJobTypeID) > 0
- SET @WHERE = @WHERE + '
- AND (a.dcJobTypeID IN(' + @JobType +')
- OR a.dcJobTypeIDMinor IN(' +@JobType + '))'
- IF LEN(@JobPlace) > 0
- SET @WHERE = @WHERE + '
- AND (' + @JobPlace + ')'
- IF @dcSalaryID > 0
- BEGIN
- IF @dcSalaryID < 100 ----从form中搜索,月薪跨2个级别, 是本级和上级别的薪金
- BEGIN
- SET @WHERE = @WHERE + '
- AND a.dcSalaryID IN(' + LTRIM(STR(@dcSalaryID)) + ',' + LTRIM(STR(@dcSalaryID + 1))
- IF @IsNegotiable = 1 --包括面议
- SET @WHERE = @WHERE + ', 100'
- SET @WHERE = @WHERE + ')'
- END
- IF @dcSalaryID = 100 ----从筛选结果中点击面议,值是100
- BEGIN
- SET @WHERE = @WHERE + '
- AND a.dcSalaryID = 100'
- END
- IF @dcSalaryID > 100 ----从筛选结果中点击搜索,月薪只有1个级别,传值时增加100
- SET @WHERE = @WHERE + '
- AND a.dcSalaryID=' + LTRIM(STR(@dcSalaryID-100))
- END
- ----工作经验要求
- IF @MinExperience < 100
- SET @WHERE = @WHERE + '
- AND a.MinExperience = ' + LTRIM(STR(@MinExperience))
- ----学历要求
- ----'1初中', '2\3\4高中、中技、中专', '5大专', '6本科', '7硕士', '8博士
- IF @dcEducationID > 0
- IF @dcEducationID = 2
- SET @WHERE = @WHERE + '
- AND a.dcEducationID IN(2, 3, 4)'
- ELSE
- SET @WHERE = @WHERE + '
- AND a.dcEducationID = ' + LTRIM(STR(@dcEducationID))
- ----1、全职;3、兼职;4实习。 2、全职/兼职 职位中无此项
- IF LEN(@EmployType) > 0
- SET @WHERE = @WHERE + '
- AND a.EmployType IN (' + @EmployType + ')'
- IF @CompanySizeID BETWEEN 1 AND 6
- SET @WHERE = @WHERE + '
- AND b.dcCompanySizeID = ' + LTRIM(STR(@CompanySizeID))
- IF LEN(@Welfare) > 0
- SET @WHERE = @WHERE + '
- AND a.Welfare' + REPLACE(@Welfare, ',', ' = 1 AND a.Welfare') + ' = 1'
- IF LEN(@KeyWord) > 0 AND @KeyType > 0 ----使用全文搜索job和cpmain2个表,经过测试发现union最快
- BEGIN
- IF EXISTS(SELECT TOP 1 'x' FROM cpMainPublish WITH(NOLOCK) WHERE Name = @KeyWord)
- BEGIN
- SET @WHERE = @WHERE + '
- AND b.Name = ''' + @KeyWord + ''''
- SET @SQL = @SQL + @FROM + @WHERE
- END
- ELSE
- BEGIN
- INSERT #FullText
- SELECT 1, [Key]
- FROM CONTAINSTABLE(JobPublish, Name, @KeyWord, 100000) AS KeyJob
- INSERT #FullText
- SELECT 2, a.ID
- FROM JobPublish a WITH(NOLOCK),
- CONTAINSTABLE(cpMainPublish, Name, @KeyWord, 100000) AS b
- WHERE a.cpMainId = b.[Key]
- DELETE #FullText WHERE Priority = 2 AND JobId IN(SELECT JobId FROM #FullText WHERE Priority = 1)
- IF (SELECT COUNT(*) FROM #FullText) < 5000
- BEGIN
- INSERT #FullText
- SELECT 3, [Key]
- FROM CONTAINSTABLE(JobPublish, *, @KeyWord, 100000) AS KeyJob
- DELETE #FullText WHERE Priority = 3 AND JobId IN(SELECT JobId FROM #FullText WHERE Priority < 3)
- IF (SELECT COUNT(*) FROM #FullText) < 5000
- BEGIN
- INSERT #FullText
- SELECT 4, a.ID
- FROM JobPublish a WITH(NOLOCK),
- CONTAINSTABLE(cpMainPublish, *, @KeyWord, 100000) AS b
- WHERE a.cpMainId = b.[Key]
-
- DELETE #FullText WHERE Priority = 4 AND JobId IN(SELECT JobId FROM #FullText WHERE Priority < 4)
- END
- END
- --------------------
- SELECT @FROM = @FROM + '
- INNER JOIN #FullText ON a.ID = #FullText.JobId',
- @ORDER = ' ORDER BY #FullText.Priority, a.RefreshDate DESC, a.ID'
- SET @SQL = @SQL + @FROM + @WHERE
- END
- END
- ELSE
- SET @SQL = @SQL + @FROM + @WHERE
-
- SET @SQL = @SQL + @ORDER --' ORDER BY a.RefreshDate DESC, a.ID'
- --原来是ORDER BY a.IssueDate DESC, a.ID,Richard 2011年11月23日17:06分修改
- ----把符合条件的职位全部列出
- --PRINT @SQL
- EXEC(@SQL)
- SET @ValidJobNumber = @@ROWCOUNT
- ----记录查询结果总数
- UPDATE SearchDB..paSearchCondition SET ValidJobNumber=@ValidJobNumber, SQl=@SQL WHERE ID=@paSearchConditionID
-
- IF LEN(@dcJobTypeID) > 0 --IN(2, 4)
- UPDATE #Job SET dcJobTypeId = dcJobTypeIDMinor
- WHERE dcJobTypeID NOT IN(SELECT a FROM dbo.fnSplit(@JobType, ','))
- ----插入JobType数据
- DECLARE @TitleValue AS INT, @TopRows AS INT, @AllRows AS INT
- IF (@TableID = 0)
- BEGIN
- --IF LEN(@dcJobTypeID) IN(2, 4)
- INSERT INTO SearchDB..paSearchCount_0(paSearchConditionID, Title, TitleId, TitleValue)
- SELECT @paSearchConditionID, 'JobType', dcJobTypeID, COUNT(*) FROM #Job WITH(NOLOCK)
- -- WHERE dcJobTypeID LIKE @dcJobTypeID + '%'
- -- OR dcJobTypeIDMinor LIKE @dcJobTypeID + '%'
- GROUP BY dcJobTypeID ORDER BY dcJobTypeID
- --ELSE
- -- INSERT INTO SearchDB..paSearchCount_0(paSearchConditionID, Title, TitleId, TitleValue)
- -- SELECT @paSearchConditionID, 'JobType', dcJobTypeID, COUNT(*) FROM #Job WITH(NOLOCK)
- -- GROUP BY dcJobTypeID ORDER BY dcJobTypeID
- ----计算全部某职位类别,2, 4位的数据
- UPDATE a SET a.TitleValue = b.TitleValue
- FROM SearchDB..paSearchCount_0 a WITH(NOLOCK),
- (SELECT LEFT(TitleID, 2) TitleID, SUM(TitleValue) TitleValue
- FROM SearchDB..paSearchCount_0 WITH(NOLOCK)
- WHERE paSearchConditionID = @paSearchConditionID AND Title = 'JobType'
- GROUP BY LEFT(TitleID, 2)) b
- WHERE a.TitleId = b.TitleID
- AND a.paSearchConditionID = @paSearchConditionID AND a.Title = 'JobType'
-
- INSERT INTO SearchDB..paSearchCount_0(paSearchConditionID, Title, TitleId, TitleValue)
- SELECT @paSearchConditionID, 'EmployType', EmployType, COUNT(*) FROM #Job WITH(NOLOCK)
- GROUP BY EmployType ORDER BY EmployType
- INSERT INTO SearchDB..paSearchCount_0(paSearchConditionID, Title, TitleId, TitleValue)
- SELECT @paSearchConditionID, 'CompanySize', dcCompanySizeID, COUNT(*) FROM #Job WITH(NOLOCK)
- GROUP BY dcCompanySizeID ORDER BY dcCompanySizeID
- INSERT INTO SearchDB..paSearchCount_0(paSearchConditionID, Title, TitleId, TitleValue)
- SELECT @paSearchConditionID, 'Salary', dcSalaryID, COUNT(*) FROM #Job WITH(NOLOCK)
- GROUP BY dcSalaryID ORDER BY dcSalaryID
- INSERT INTO SearchDB..paSearchCount_0(paSearchConditionID, Title, TitleId, TitleValue)
- SELECT @paSearchConditionID, 'Region', dcRegionID, COUNT(*) FROM #Job WITH(NOLOCK)
- GROUP BY dcRegionID ORDER BY dcRegionID
- ----计算全部地区,2位的数据
- UPDATE a SET a.TitleValue = b.TitleValue
- FROM SearchDB..paSearchCount_0 a WITH(NOLOCK),
- (SELECT LEFT(TitleID, 2) TitleID, SUM(TitleValue) TitleValue
- FROM SearchDB..paSearchCount_0 WITH(NOLOCK)
- WHERE paSearchConditionID = @paSearchConditionID AND Title = 'Region'
- GROUP BY LEFT(TitleID, 2)) b
- WHERE a.TitleId = b.TitleID
- AND a.paSearchConditionID = @paSearchConditionID AND a.Title = 'Region'
- ----计算全部地区,4位的数据
- UPDATE a SET a.TitleValue = b.TitleValue
- FROM SearchDB..paSearchCount_0 a WITH(NOLOCK), (
- SELECT LEFT(TitleID, 4) TitleID, SUM(TitleValue) TitleValue
- FROM SearchDB..paSearchCount_0 WITH(NOLOCK)
- WHERE paSearchConditionID = @paSearchConditionID AND Title = 'Region'
- AND LEN(TitleID) >3
- GROUP BY LEFT(TitleID, 4)) b
- WHERE a.TitleId = b.TitleID
- AND a.paSearchConditionID = @paSearchConditionID AND a.Title = 'Region'
- INSERT INTO SearchDB..paSearchCount_0(paSearchConditionID, Title, TitleId, TitleValue)
- SELECT @paSearchConditionID, 'Education', dcEducationID, COUNT(*) FROM #Job WITH(NOLOCK)
- GROUP BY dcEducationID ORDER BY dcEducationID
- --学历 高中、中专、中级合并
- SELECT @TitleValue = SUM(TitleValue) FROM SearchDB..paSearchCount_0 WITH(NOLOCK)
- WHERE paSearchConditionID = @paSearchConditionID
- AND Title = 'Education' AND TitleID IN(2, 3, 4)
- IF @TitleValue IS NOT NULL
- BEGIN
- IF EXISTS(SELECT 'X' FROM SearchDB..paSearchCount_0 WITH(NOLOCK) WHERE paSearchConditionID = @paSearchConditionID AND Title = 'Education' AND TitleID = 2)
- UPDATE SearchDB..paSearchCount_0 SET TitleValue = @TitleValue
- WHERE paSearchConditionID = @paSearchConditionID
- AND Title = 'Education' AND TitleID = 2
- ELSE
- INSERT INTO SearchDB..paSearchCount_0(paSearchConditionID, Title, TitleId, TitleValue) VALUES
- (@paSearchConditionID, 'Education', 2, @TitleValue)
- DELETE FROM SearchDB..paSearchCount_0
- WHERE paSearchConditionID = @paSearchConditionID
- AND Title = 'Education' AND TitleID IN(3, 4)
- END
- INSERT INTO SearchDB..paSearchCount_0(paSearchConditionID, Title, TitleId, TitleValue)
- SELECT @paSearchConditionID, 'Experience', MinExperience, COUNT(*) FROM #Job WITH(NOLOCK)
- GROUP BY MinExperience ORDER BY MinExperience
-
- /* ----写入TitleDesc
- UPDATE a SET a.TitleDesc = b.Description
- FROM SearchDB..paSearchCount_0 a WITH(NOLOCK), dcEducation b WITH(NOLOCK)
- WHERE a.TitleID = b.ID AND a.paSearchConditionID = @paSearchConditionID
- AND a.Title = 'Education'
-
- UPDATE a SET a.TitleDesc = b.Description
- FROM SearchDB..paSearchCount_0 a WITH(NOLOCK), dcRegion b WITH(NOLOCK)
- WHERE a.TitleID = b.ID AND a.paSearchConditionID = @paSearchConditionID
- AND a.Title = 'Region'
- UPDATE a SET a.TitleDesc = b.Description
- FROM SearchDB..paSearchCount_0 a WITH(NOLOCK), dcJobType b WITH(NOLOCK)
- WHERE a.TitleID = b.ID AND a.paSearchConditionID = @paSearchConditionID
- AND a.Title = 'JobType'
- UPDATE a SET a.TitleDesc = b.Description
- FROM SearchDB..paSearchCount_0 a WITH(NOLOCK), dcSalary b WITH(NOLOCK)
- WHERE a.TitleID = b.ID AND a.paSearchConditionID = @paSearchConditionID
- AND a.Title = 'Salary'
- UPDATE a SET a.TitleDesc = b.Description
- FROM SearchDB..paSearchCount_0 a WITH(NOLOCK), dcCompanySize b WITH(NOLOCK)
- WHERE a.TitleID = b.ID AND a.paSearchConditionID = @paSearchConditionID
- AND a.Title = 'CompanySize'
- UPDATE a SET a.TitleDesc = b.Description
- FROM SearchDB..paSearchCount_0 a WITH(NOLOCK), dcCompanySize b WITH(NOLOCK)
- WHERE a.TitleID = b.ID AND a.paSearchConditionID = @paSearchConditionID
- AND a.Title = 'CompanySize'
-
- UPDATE SearchDB..paSearchCount_0 SET TitleDesc =
- CASE TitleID
- WHEN 0 THEN '不限'
- WHEN 1 THEN '1~2年'
- WHEN 2 THEN '3~5年'
- WHEN 3 THEN '6~10年'
- WHEN 4 THEN '10年以上'
- WHEN 5 THEN '应届毕业生'
- END
- WHERE paSearchConditionID = @paSearchConditionID
- AND Title = 'Experience'
- UPDATE SearchDB..paSearchCount_0 SET TitleDesc =
- CASE TitleID
- WHEN 1 THEN '全职'
- WHEN 3 THEN '兼职'
- WHEN 4 THEN '实习'
- END
- WHERE paSearchConditionID = @paSearchConditionID
- AND Title = 'EmployType'
- */
- INSERT INTO SearchDB..paSearchJobID_0(paSearchConditionID, JobId, IsTop)
- SELECT Top 3 @paSearchConditionID, a.JobId, 1
- FROM SearchJobTop a WITH(NOLOCK), (SELECT TOP 2000 ID FROM #Job WITH(NOLOCK)) b
- WHERE b.ID = a.JobId ORDER BY a.OpenDate DESC
- SET @TopRows = @@ROWCOUNT
- INSERT INTO SearchDB..paSearchJobID_0(paSearchConditionID, JobId, IsTop)
- SELECT TOP 2000 @paSearchConditionID, ID, 0 FROM #Job WITH(NOLOCK)
- SET @AllRows = @@ROWCOUNT
- IF @TopRows = 0 AND @AllRows > 100
- UPDATE SearchDB..paSearchJobID_0 SET IsTop = 1
- WHERE paSearchConditionID = @paSearchConditionID
- AND ID IN (SELECT TOP 3 ID FROM SearchDB..paSearchJobID_0 WITH(NOLOCK) WHERE paSearchConditionID = @paSearchConditionID)
- END
- ELSE IF (@TableId = 1)
- BEGIN
- --IF LEN(@dcJobTypeID) IN(2, 4)
- INSERT INTO SearchDB..paSearchCount_1(paSearchConditionID, Title, TitleId, TitleValue)
- SELECT @paSearchConditionID, 'JobType', dcJobTypeID, COUNT(*) FROM #Job WITH(NOLOCK)
- -- WHERE dcJobTypeID LIKE @dcJobTypeID + '%'
- -- OR dcJobTypeIDMinor LIKE @dcJobTypeID + '%'
- GROUP BY dcJobTypeID ORDER BY dcJobTypeID
- --ELSE
- -- INSERT INTO SearchDB..paSearchCount_1(paSearchConditionID, Title, TitleId, TitleValue)
- -- SELECT @paSearchConditionID, 'JobType', dcJobTypeID, COUNT(*) FROM #Job WITH(NOLOCK)
- -- GROUP BY dcJobTypeID ORDER BY dcJobTypeID
- ----计算全部某职位类别,2, 4位的数据
- UPDATE a SET a.TitleValue = b.TitleValue
- FROM SearchDB..paSearchCount_1 a WITH(NOLOCK),
- (SELECT LEFT(TitleID, 2) TitleID, SUM(TitleValue) TitleValue
- FROM SearchDB..paSearchCount_1 WITH(NOLOCK)
- WHERE paSearchConditionID = @paSearchConditionID AND Title = 'JobType'
- GROUP BY LEFT(TitleID, 2)) b
- WHERE a.TitleId = b.TitleID
- AND a.paSearchConditionID = @paSearchConditionID AND a.Title = 'JobType'
-
- INSERT INTO SearchDB..paSearchCount_1(paSearchConditionID, Title, TitleId, TitleValue)
- SELECT @paSearchConditionID, 'Salary', dcSalaryID, COUNT(*) FROM #Job WITH(NOLOCK)
- GROUP BY dcSalaryID ORDER BY dcSalaryID
- INSERT INTO SearchDB..paSearchCount_1(paSearchConditionID, Title, TitleId, TitleValue)
- SELECT @paSearchConditionID, 'Region', dcRegionID, COUNT(*) FROM #Job WITH(NOLOCK)
- GROUP BY dcRegionID ORDER BY dcRegionID
- INSERT INTO SearchDB..paSearchCount_1(paSearchConditionID, Title, TitleId, TitleValue)
- SELECT @paSearchConditionID, 'EmployType', EmployType, COUNT(*) FROM #Job WITH(NOLOCK)
- GROUP BY EmployType ORDER BY EmployType
- INSERT INTO SearchDB..paSearchCount_1(paSearchConditionID, Title, TitleId, TitleValue)
- SELECT @paSearchConditionID, 'CompanySize', dcCompanySizeID, COUNT(*) FROM #Job WITH(NOLOCK)
- GROUP BY dcCompanySizeID ORDER BY dcCompanySizeID
- ----计算全部地区,2位的数据
- UPDATE a SET a.TitleValue = b.TitleValue
- FROM SearchDB..paSearchCount_1 a WITH(NOLOCK),
- (SELECT LEFT(TitleID, 2) TitleID, SUM(TitleValue) TitleValue
- FROM SearchDB..paSearchCount_1 WITH(NOLOCK)
- WHERE paSearchConditionID = @paSearchConditionID AND Title = 'Region'
- GROUP BY LEFT(TitleID, 2)) b
- WHERE a.TitleId = b.TitleID
- AND a.paSearchConditionID = @paSearchConditionID AND a.Title = 'Region'
- ----计算全部地区,4位的数据
- UPDATE a SET a.TitleValue = b.TitleValue
- FROM SearchDB..paSearchCount_1 a WITH(NOLOCK), (
- SELECT LEFT(TitleID, 4) TitleID, SUM(TitleValue) TitleValue
- FROM SearchDB..paSearchCount_1 WITH(NOLOCK)
- WHERE paSearchConditionID = @paSearchConditionID AND Title = 'Region'
- AND LEN(TitleID) >3
- GROUP BY LEFT(TitleID, 4)) b
- WHERE a.TitleId = b.TitleID
- AND a.paSearchConditionID = @paSearchConditionID AND a.Title = 'Region'
- INSERT INTO SearchDB..paSearchCount_1(paSearchConditionID, Title, TitleId, TitleValue)
- SELECT @paSearchConditionID, 'Education', dcEducationID, COUNT(*) FROM #Job WITH(NOLOCK)
- GROUP BY dcEducationID ORDER BY dcEducationID
- --学历 高中、中专、中级合并
- SELECT @TitleValue = SUM(TitleValue) FROM SearchDB..paSearchCount_1 WITH(NOLOCK)
- WHERE paSearchConditionID = @paSearchConditionID
- AND Title = 'Education' AND TitleID IN(2, 3, 4)
- IF @TitleValue IS NOT NULL
- BEGIN
- IF EXISTS(SELECT 'X' FROM SearchDB..paSearchCount_1 WITH(NOLOCK) WHERE paSearchConditionID = @paSearchConditionID AND Title = 'Education' AND TitleID = 2)
- UPDATE SearchDB..paSearchCount_1 SET TitleValue = @TitleValue
- WHERE paSearchConditionID = @paSearchConditionID
- AND Title = 'Education' AND TitleID = 2
- ELSE
- INSERT INTO SearchDB..paSearchCount_1(paSearchConditionID, Title, TitleId, TitleValue) VALUES
- (@paSearchConditionID, 'Education', 2, @TitleValue)
- DELETE FROM SearchDB..paSearchCount_1
- WHERE paSearchConditionID = @paSearchConditionID
- AND Title = 'Education' AND TitleID IN(3, 4)
- END
- INSERT INTO SearchDB..paSearchCount_1(paSearchConditionID, Title, TitleId, TitleValue)
- SELECT @paSearchConditionID, 'Experience', MinExperience, COUNT(*) FROM #Job WITH(NOLOCK)
- GROUP BY MinExperience ORDER BY MinExperience
-
- /* ----写入TitleDesc
- UPDATE a SET a.TitleDesc = b.Description
- FROM SearchDB..paSearchCount_1 a WITH(NOLOCK), dcEducation b WITH(NOLOCK)
- WHERE a.TitleID = b.ID AND a.paSearchConditionID = @paSearchConditionID
- AND a.Title = 'Education'
-
- UPDATE a SET a.TitleDesc = b.Description
- FROM SearchDB..paSearchCount_1 a WITH(NOLOCK), dcRegion b WITH(NOLOCK)
- WHERE a.TitleID = b.ID AND a.paSearchConditionID = @paSearchConditionID
- AND a.Title = 'Region'
- UPDATE a SET a.TitleDesc = b.Description
- FROM SearchDB..paSearchCount_1 a WITH(NOLOCK), dcJobType b WITH(NOLOCK)
- WHERE a.TitleID = b.ID AND a.paSearchConditionID = @paSearchConditionID
- AND a.Title = 'JobType'
- UPDATE a SET a.TitleDesc = b.Description
- FROM SearchDB..paSearchCount_1 a WITH(NOLOCK), dcSalary b WITH(NOLOCK)
- WHERE a.TitleID = b.ID AND a.paSearchConditionID = @paSearchConditionID
- AND a.Title = 'Salary'
- UPDATE a SET a.TitleDesc = b.Description
- FROM SearchDB..paSearchCount_1 a WITH(NOLOCK), dcCompanySize b WITH(NOLOCK)
- WHERE a.TitleID = b.ID AND a.paSearchConditionID = @paSearchConditionID
- AND a.Title = 'CompanySize'
- UPDATE a SET a.TitleDesc = b.Description
- FROM SearchDB..paSearchCount_1 a WITH(NOLOCK), dcCompanySize b WITH(NOLOCK)
- WHERE a.TitleID = b.ID AND a.paSearchConditionID = @paSearchConditionID
- AND a.Title = 'CompanySize'
-
- UPDATE SearchDB..paSearchCount_1 SET TitleDesc =
- CASE TitleID
- WHEN 0 THEN '不限'
- WHEN 1 THEN '1~2年'
- WHEN 2 THEN '3~5年'
- WHEN 3 THEN '6~10年'
- WHEN 4 THEN '10年以上'
- WHEN 5 THEN '应届毕业生'
- END
- WHERE paSearchConditionID = @paSearchConditionID
- AND Title = 'Experience'
- UPDATE SearchDB..paSearchCount_1 SET TitleDesc =
- CASE TitleID
- WHEN 1 THEN '全职'
- WHEN 3 THEN '兼职'
- WHEN 4 THEN '实习'
- END
- WHERE paSearchConditionID = @paSearchConditionID
- AND Title = 'EmployType'
- */
- INSERT INTO SearchDB..paSearchJobID_1(paSearchConditionID, JobId, IsTop)
- SELECT Top 3 @paSearchConditionID, a.JobId, 1
- FROM SearchJobTop a WITH(NOLOCK), (SELECT TOP 2000 ID FROM #Job WITH(NOLOCK)) b
- WHERE b.ID = a.JobId ORDER BY a.OpenDate DESC
- SET @TopRows = @@ROWCOUNT
- INSERT INTO SearchDB..paSearchJobID_1(paSearchConditionID, JobId, IsTop)
- SELECT TOP 2000 @paSearchConditionID, ID, 0 FROM #Job WITH(NOLOCK)
- SET @AllRows = @@ROWCOUNT
- IF @TopRows = 0 AND @AllRows > 100
- UPDATE SearchDB..paSearchJobID_1 SET IsTop = 1
- WHERE paSearchConditionID = @paSearchConditionID
- AND ID IN (SELECT TOP 3 ID FROM SearchDB..paSearchJobID_1 WITH(NOLOCK) WHERE paSearchConditionID = @paSearchConditionID)
- END
- ELSE IF (@TableId = 2)
- BEGIN
- --IF LEN(@dcJobTypeID) IN(2, 4)
- INSERT INTO SearchDB..paSearchCount_2(paSearchConditionID, Title, TitleId, TitleValue)
- SELECT @paSearchConditionID, 'JobType', dcJobTypeID, COUNT(*) FROM #Job WITH(NOLOCK)
- -- WHERE dcJobTypeID LIKE @dcJobTypeID + '%'
- -- OR dcJobTypeIDMinor LIKE @dcJobTypeID + '%'
- GROUP BY dcJobTypeID ORDER BY dcJobTypeID
- --ELSE
- -- INSERT INTO SearchDB..paSearchCount_2(paSearchConditionID, Title, TitleId, TitleValue)
- -- SELECT @paSearchConditionID, 'JobType', dcJobTypeID, COUNT(*) FROM #Job WITH(NOLOCK)
- -- GROUP BY dcJobTypeID ORDER BY dcJobTypeID
- ----计算全部某职位类别,2, 4位的数据
- UPDATE a SET a.TitleValue = b.TitleValue
- FROM SearchDB..paSearchCount_2 a WITH(NOLOCK),
- (SELECT LEFT(TitleID, 2) TitleID, SUM(TitleValue) TitleValue
- FROM SearchDB..paSearchCount_2 WITH(NOLOCK)
- WHERE paSearchConditionID = @paSearchConditionID AND Title = 'JobType'
- GROUP BY LEFT(TitleID, 2)) b
- WHERE a.TitleId = b.TitleID
- AND a.paSearchConditionID = @paSearchConditionID AND a.Title = 'JobType'
-
- INSERT INTO SearchDB..paSearchCount_2(paSearchConditionID, Title, TitleId, TitleValue)
- SELECT @paSearchConditionID, 'Salary', dcSalaryID, COUNT(*) FROM #Job WITH(NOLOCK)
- GROUP BY dcSalaryID ORDER BY dcSalaryID
- INSERT INTO SearchDB..paSearchCount_2(paSearchConditionID, Title, TitleId, TitleValue)
- SELECT @paSearchConditionID, 'EmployType', EmployType, COUNT(*) FROM #Job WITH(NOLOCK)
- GROUP BY EmployType ORDER BY EmployType
- INSERT INTO SearchDB..paSearchCount_2(paSearchConditionID, Title, TitleId, TitleValue)
- SELECT @paSearchConditionID, 'CompanySize', dcCompanySizeID, COUNT(*) FROM #Job WITH(NOLOCK)
- GROUP BY dcCompanySizeID ORDER BY dcCompanySizeID
- INSERT INTO SearchDB..paSearchCount_2(paSearchConditionID, Title, TitleId, TitleValue)
- SELECT @paSearchConditionID, 'Region', dcRegionID, COUNT(*) FROM #Job WITH(NOLOCK)
- GROUP BY dcRegionID ORDER BY dcRegionID
- ----计算全部地区,2位的数据
- UPDATE a SET a.TitleValue = b.TitleValue
- FROM SearchDB..paSearchCount_2 a WITH(NOLOCK),
- (SELECT LEFT(TitleID, 2) TitleID, SUM(TitleValue) TitleValue
- FROM SearchDB..paSearchCount_2 WITH(NOLOCK)
- WHERE paSearchConditionID = @paSearchConditionID AND Title = 'Region'
- GROUP BY LEFT(TitleID, 2)) b
- WHERE a.TitleId = b.TitleID
- AND a.paSearchConditionID = @paSearchConditionID AND a.Title = 'Region'
- ----计算全部地区,4位的数据
- UPDATE a SET a.TitleValue = b.TitleValue
- FROM SearchDB..paSearchCount_2 a WITH(NOLOCK), (
- SELECT LEFT(TitleID, 4) TitleID, SUM(TitleValue) TitleValue
- FROM SearchDB..paSearchCount_2 WITH(NOLOCK)
- WHERE paSearchConditionID = @paSearchConditionID AND Title = 'Region'
- AND LEN(TitleID) >3
- GROUP BY LEFT(TitleID, 4)) b
- WHERE a.TitleId = b.TitleID
- AND a.paSearchConditionID = @paSearchConditionID AND a.Title = 'Region'
- INSERT INTO SearchDB..paSearchCount_2(paSearchConditionID, Title, TitleId, TitleValue)
- SELECT @paSearchConditionID, 'Education', dcEducationID, COUNT(*) FROM #Job WITH(NOLOCK)
- GROUP BY dcEducationID ORDER BY dcEducationID
- --学历 高中、中专、中级合并
- SELECT @TitleValue = SUM(TitleValue) FROM SearchDB..paSearchCount_2 WITH(NOLOCK)
- WHERE paSearchConditionID = @paSearchConditionID
- AND Title = 'Education' AND TitleID IN(2, 3, 4)
- IF @TitleValue IS NOT NULL
- BEGIN
- IF EXISTS(SELECT 'X' FROM SearchDB..paSearchCount_2 WITH(NOLOCK) WHERE paSearchConditionID = @paSearchConditionID AND Title = 'Education' AND TitleID = 2)
- UPDATE SearchDB..paSearchCount_2 SET TitleValue = @TitleValue
- WHERE paSearchConditionID = @paSearchConditionID
- AND Title = 'Education' AND TitleID = 2
- ELSE
- INSERT INTO SearchDB..paSearchCount_2(paSearchConditionID, Title, TitleId, TitleValue) VALUES
- (@paSearchConditionID, 'Education', 2, @TitleValue)
- DELETE FROM SearchDB..paSearchCount_2
- WHERE paSearchConditionID = @paSearchConditionID
- AND Title = 'Education' AND TitleID IN(3, 4)
- END
- INSERT INTO SearchDB..paSearchCount_2(paSearchConditionID, Title, TitleId, TitleValue)
- SELECT @paSearchConditionID, 'Experience', MinExperience, COUNT(*) FROM #Job WITH(NOLOCK)
- GROUP BY MinExperience ORDER BY MinExperience
-
- /* ----写入TitleDesc
- UPDATE a SET a.TitleDesc = b.Description
- FROM SearchDB..paSearchCount_2 a WITH(NOLOCK), dcEducation b WITH(NOLOCK)
- WHERE a.TitleID = b.ID AND a.paSearchConditionID = @paSearchConditionID
- AND a.Title = 'Education'
-
- UPDATE a SET a.TitleDesc = b.Description
- FROM SearchDB..paSearchCount_2 a WITH(NOLOCK), dcRegion b WITH(NOLOCK)
- WHERE a.TitleID = b.ID AND a.paSearchConditionID = @paSearchConditionID
- AND a.Title = 'Region'
- UPDATE a SET a.TitleDesc = b.Description
- FROM SearchDB..paSearchCount_2 a WITH(NOLOCK), dcJobType b WITH(NOLOCK)
- WHERE a.TitleID = b.ID AND a.paSearchConditionID = @paSearchConditionID
- AND a.Title = 'JobType'
- UPDATE a SET a.TitleDesc = b.Description
- FROM SearchDB..paSearchCount_2 a WITH(NOLOCK), dcSalary b WITH(NOLOCK)
- WHERE a.TitleID = b.ID AND a.paSearchConditionID = @paSearchConditionID
- AND a.Title = 'Salary'
- UPDATE a SET a.TitleDesc = b.Description
- FROM SearchDB..paSearchCount_2 a WITH(NOLOCK), dcCompanySize b WITH(NOLOCK)
- WHERE a.TitleID = b.ID AND a.paSearchConditionID = @paSearchConditionID
- AND a.Title = 'CompanySize'
- UPDATE a SET a.TitleDesc = b.Description
- FROM SearchDB..paSearchCount_2 a WITH(NOLOCK), dcCompanySize b WITH(NOLOCK)
- WHERE a.TitleID = b.ID AND a.paSearchConditionID = @paSearchConditionID
- AND a.Title = 'CompanySize'
-
- UPDATE SearchDB..paSearchCount_2 SET TitleDesc =
- CASE TitleID
- WHEN 0 THEN '不限'
- WHEN 1 THEN '1~2年'
- WHEN 2 THEN '3~5年'
- WHEN 3 THEN '6~10年'
- WHEN 4 THEN '10年以上'
- WHEN 5 THEN '应届毕业生'
- END
- WHERE paSearchConditionID = @paSearchConditionID
- AND Title = 'Experience'
- UPDATE SearchDB..paSearchCount_2 SET TitleDesc =
- CASE TitleID
- WHEN 1 THEN '全职'
- WHEN 3 THEN '兼职'
- WHEN 4 THEN '实习'
- END
- WHERE paSearchConditionID = @paSearchConditionID
- AND Title = 'EmployType'
- */
- INSERT INTO SearchDB..paSearchJobID_2(paSearchConditionID, JobId, IsTop)
- SELECT Top 3 @paSearchConditionID, a.JobId, 1
- FROM SearchJobTop a WITH(NOLOCK), (SELECT TOP 2000 ID FROM #Job WITH(NOLOCK)) b
- WHERE b.ID = a.JobId ORDER BY a.OpenDate DESC
- SET @TopRows = @@ROWCOUNT
- INSERT INTO SearchDB..paSearchJobID_2(paSearchConditionID, JobId, IsTop)
- SELECT TOP 2000 @paSearchConditionID, ID, 0 FROM #Job WITH(NOLOCK)
- SET @AllRows = @@ROWCOUNT
- IF @TopRows = 0 AND @AllRows > 100
- UPDATE SearchDB..paSearchJobID_2 SET IsTop = 1
- WHERE paSearchConditionID = @paSearchConditionID
- AND ID IN (SELECT TOP 3 ID FROM SearchDB..paSearchJobID_2 WITH(NOLOCK) WHERE paSearchConditionID = @paSearchConditionID)
- END
- ELSE IF (@TableId = 3)
- BEGIN
- --IF LEN(@dcJobTypeID) IN(2, 4)
- INSERT INTO SearchDB..paSearchCount_3(paSearchConditionID, Title, TitleId, TitleValue)
- SELECT @paSearchConditionID, 'JobType', dcJobTypeID, COUNT(*) FROM #Job WITH(NOLOCK)
- -- WHERE dcJobTypeID LIKE @dcJobTypeID + '%'
- -- OR dcJobTypeIDMinor LIKE @dcJobTypeID + '%'
- GROUP BY dcJobTypeID ORDER BY dcJobTypeID
- --ELSE
- -- INSERT INTO SearchDB..paSearchCount_3(paSearchConditionID, Title, TitleId, TitleValue)
- -- SELECT @paSearchConditionID, 'JobType', dcJobTypeID, COUNT(*) FROM #Job WITH(NOLOCK)
- -- GROUP BY dcJobTypeID ORDER BY dcJobTypeID
- ----计算全部某职位类别,2, 4位的数据
- UPDATE a SET a.TitleValue = b.TitleValue
- FROM SearchDB..paSearchCount_3 a WITH(NOLOCK),
- (SELECT LEFT(TitleID, 2) TitleID, SUM(TitleValue) TitleValue
- FROM SearchDB..paSearchCount_3 WITH(NOLOCK)
- WHERE paSearchConditionID = @paSearchConditionID AND Title = 'JobType'
- GROUP BY LEFT(TitleID, 2)) b
- WHERE a.TitleId = b.TitleID
- AND a.paSearchConditionID = @paSearchConditionID AND a.Title = 'JobType'
-
- INSERT INTO SearchDB..paSearchCount_3(paSearchConditionID, Title, TitleId, TitleValue)
- SELECT @paSearchConditionID, 'Salary', dcSalaryID, COUNT(*) FROM #Job WITH(NOLOCK)
- GROUP BY dcSalaryID ORDER BY dcSalaryID
- INSERT INTO SearchDB..paSearchCount_3(paSearchConditionID, Title, TitleId, TitleValue)
- SELECT @paSearchConditionID, 'EmployType', EmployType, COUNT(*) FROM #Job WITH(NOLOCK)
- GROUP BY EmployType ORDER BY EmployType
- INSERT INTO SearchDB..paSearchCount_3(paSearchConditionID, Title, TitleId, TitleValue)
- SELECT @paSearchConditionID, 'CompanySize', dcCompanySizeID, COUNT(*) FROM #Job WITH(NOLOCK)
- GROUP BY dcCompanySizeID ORDER BY dcCompanySizeID
- INSERT INTO SearchDB..paSearchCount_3(paSearchConditionID, Title, TitleId, TitleValue)
- SELECT @paSearchConditionID, 'Region', dcRegionID, COUNT(*) FROM #Job WITH(NOLOCK)
- GROUP BY dcRegionID ORDER BY dcRegionID
- ----计算全部地区,2位的数据
- UPDATE a SET a.TitleValue = b.TitleValue
- FROM SearchDB..paSearchCount_3 a WITH(NOLOCK),
- (SELECT LEFT(TitleID, 2) TitleID, SUM(TitleValue) TitleValue
- FROM SearchDB..paSearchCount_3 WITH(NOLOCK)
- WHERE paSearchConditionID = @paSearchConditionID AND Title = 'Region'
- GROUP BY LEFT(TitleID, 2)) b
- WHERE a.TitleId = b.TitleID
- AND a.paSearchConditionID = @paSearchConditionID AND a.Title = 'Region'
- ----计算全部地区,4位的数据
- UPDATE a SET a.TitleValue = b.TitleValue
- FROM SearchDB..paSearchCount_3 a WITH(NOLOCK), (
- SELECT LEFT(TitleID, 4) TitleID, SUM(TitleValue) TitleValue
- FROM SearchDB..paSearchCount_3 WITH(NOLOCK)
- WHERE paSearchConditionID = @paSearchConditionID AND Title = 'Region'
- AND LEN(TitleID) >3
- GROUP BY LEFT(TitleID, 4)) b
- WHERE a.TitleId = b.TitleID
- AND a.paSearchConditionID = @paSearchConditionID AND a.Title = 'Region'
- INSERT INTO SearchDB..paSearchCount_3(paSearchConditionID, Title, TitleId, TitleValue)
- SELECT @paSearchConditionID, 'Education', dcEducationID, COUNT(*) FROM #Job WITH(NOLOCK)
- GROUP BY dcEducationID ORDER BY dcEducationID
- --学历 高中、中专、中级合并
- SELECT @TitleValue = SUM(TitleValue) FROM SearchDB..paSearchCount_3 WITH(NOLOCK)
- WHERE paSearchConditionID = @paSearchConditionID
- AND Title = 'Education' AND TitleID IN(2, 3, 4)
- IF @TitleValue IS NOT NULL
- BEGIN
- IF EXISTS(SELECT 'X' FROM SearchDB..paSearchCount_3 WITH(NOLOCK) WHERE paSearchConditionID = @paSearchConditionID AND Title = 'Education' AND TitleID = 2)
- UPDATE SearchDB..paSearchCount_3 SET TitleValue = @TitleValue
- WHERE paSearchConditionID = @paSearchConditionID
- AND Title = 'Education' AND TitleID = 2
- ELSE
- INSERT INTO SearchDB..paSearchCount_3(paSearchConditionID, Title, TitleId, TitleValue) VALUES
- (@paSearchConditionID, 'Education', 2, @TitleValue)
- DELETE FROM SearchDB..paSearchCount_3
- WHERE paSearchConditionID = @paSearchConditionID
- AND Title = 'Education' AND TitleID IN(3, 4)
- END
- INSERT INTO SearchDB..paSearchCount_3(paSearchConditionID, Title, TitleId, TitleValue)
- SELECT @paSearchConditionID, 'Experience', MinExperience, COUNT(*) FROM #Job WITH(NOLOCK)
- GROUP BY MinExperience ORDER BY MinExperience
- /* ----写入TitleDesc
- UPDATE a SET a.TitleDesc = b.Description
- FROM SearchDB..paSearchCount_3 a WITH(NOLOCK), dcEducation b WITH(NOLOCK)
- WHERE a.TitleID = b.ID AND a.paSearchConditionID = @paSearchConditionID
- AND a.Title = 'Education'
-
- UPDATE a SET a.TitleDesc = b.Description
- FROM SearchDB..paSearchCount_3 a WITH(NOLOCK), dcRegion b WITH(NOLOCK)
- WHERE a.TitleID = b.ID AND a.paSearchConditionID = @paSearchConditionID
- AND a.Title = 'Region'
- UPDATE a SET a.TitleDesc = b.Description
- FROM SearchDB..paSearchCount_3 a WITH(NOLOCK), dcJobType b WITH(NOLOCK)
- WHERE a.TitleID = b.ID AND a.paSearchConditionID = @paSearchConditionID
- AND a.Title = 'JobType'
- UPDATE a SET a.TitleDesc = b.Description
- FROM SearchDB..paSearchCount_3 a WITH(NOLOCK), dcSalary b WITH(NOLOCK)
- WHERE a.TitleID = b.ID AND a.paSearchConditionID = @paSearchConditionID
- AND a.Title = 'Salary'
- UPDATE a SET a.TitleDesc = b.Description
- FROM SearchDB..paSearchCount_3 a WITH(NOLOCK), dcCompanySize b WITH(NOLOCK)
- WHERE a.TitleID = b.ID AND a.paSearchConditionID = @paSearchConditionID
- AND a.Title = 'CompanySize'
- UPDATE a SET a.TitleDesc = b.Description
- FROM SearchDB..paSearchCount_3 a WITH(NOLOCK), dcCompanySize b WITH(NOLOCK)
- WHERE a.TitleID = b.ID AND a.paSearchConditionID = @paSearchConditionID
- AND a.Title = 'CompanySize'
-
- UPDATE SearchDB..paSearchCount_3 SET TitleDesc =
- CASE TitleID
- WHEN 0 THEN '不限'
- WHEN 1 THEN '1~2年'
- WHEN 2 THEN '3~5年'
- WHEN 3 THEN '6~10年'
- WHEN 4 THEN '10年以上'
- WHEN 5 THEN '应届毕业生'
- END
- WHERE paSearchConditionID = @paSearchConditionID
- AND Title = 'Experience'
- UPDATE SearchDB..paSearchCount_3 SET TitleDesc =
- CASE TitleID
- WHEN 1 THEN '全职'
- WHEN 3 THEN '兼职'
- WHEN 4 THEN '实习'
- END
- WHERE paSearchConditionID = @paSearchConditionID
- AND Title = 'EmployType'
- */
- INSERT INTO SearchDB..paSearchJobID_3(paSearchConditionID, JobId, IsTop)
- SELECT Top 3 @paSearchConditionID, a.JobId, 1
- FROM SearchJobTop a WITH(NOLOCK), (SELECT TOP 2000 ID FROM #Job WITH(NOLOCK)) b
- WHERE b.ID = a.JobId ORDER BY a.OpenDate DESC
- SET @TopRows = @@ROWCOUNT
- INSERT INTO SearchDB..paSearchJobID_3(paSearchConditionID, JobId, IsTop)
- SELECT TOP 2000 @paSearchConditionID, ID, 0 FROM #Job WITH(NOLOCK)
- SET @AllRows = @@ROWCOUNT
- IF @TopRows = 0 AND @AllRows > 100
- UPDATE SearchDB..paSearchJobID_3 SET IsTop = 1
- WHERE paSearchConditionID = @paSearchConditionID
- AND ID IN (SELECT TOP 3 ID FROM SearchDB..paSearchJobID_3 WITH(NOLOCK) WHERE paSearchConditionID = @paSearchConditionID)
- END
- DROP TABLE #Job
- --PRINT 'DROP #JOB ' + CONVERT(VARCHAR(30), GETDATE(), 121)
- COMMIT
- --GOTO GetRecordSet
- GetRecordSet:
- BEGIN
- ----返回查询数量
- SELECT ValidJobNumber FROM SearchDB..paSearchCondition WITH(NOLOCK) WHERE ID=@paSearchConditionID
- UPDATE SearchDB..paSearchCondition SET ReuseNumber = ReuseNumber + 1 WHERE ID=@paSearchConditionID
- ----返回20行查询结果
- IF (@TableID = 0)
- BEGIN
- SELECT @MinId = MIN(ID) FROM SearchDB..paSearchJobID_0 WITH(NOLOCK) WHERE paSearchConditionID=@paSearchConditionID
- SET @MinId = @MinId+(@PageNumber-1)*@PageSize
- SELECT TOP 30 a.ID, a.cpMainID, a.caMainID, a.Name as JobName, a.dcJobTypeID,
- a.dcJobTypeIDMinor, a.NeedNumber, a.dcSalaryID, a.EmployType,
- a.dcRegionID, a.Responsibility, a.Demand, a.dcEducationID,
- a.MinExperience, a.MinAge, a.MaxAge, a.IssueDate, a.IssueEND,
- a.IsDelete, a.AddDate, a.RefreshDate, a.Welfare1,a.Welfare2,a.Welfare3,
- a.Welfare4,a.Welfare5,a.Welfare6,a.Welfare7,a.Welfare8,
- a.Welfare9,a.Welfare10,a.Welfare11,a.Welfare12,a.Welfare13,
- a.Welfare14,a.Welfare15,a.Welfare16,a.Welfare17,a.Welfare18,a.SecondId EnJobID,b.SecondId EnCpMainID,
- a.LastModifyDate, b.Name as cpName, b.dcCompanySizeID,
- b.HasLicence, b.UnLimitedDate, b.BalanceDate, b.Balance,
- b.MemberType, '' cpIndustry, --STUFF((SELECT ','+LTRIM(x.dcIndustryid)+',c'+LTRIM(isnull(y.Category,0)) FROM cpIndustry x,dcIndustry y WHERE x.dcIndustryid = y.id AND x.cpMainid = b.id FOR XML PATH('')),1,1,'') cpIndustry,
- c.IsTop, b.IsRefreshed, d.IsOnline, d.IsVi, d.ViPlanId, d.InterviewDate
- FROM JobPublish a WITH(NOLOCK)
- INNER JOIN cpMainPublish b WITH(NOLOCK) ON a.cpMainID = b.ID
- INNER JOIN SearchDB..paSearchJobID_0 c WITH(NOLOCK) ON a.id = c.JobID
- LEFT JOIN caOnline d WITH(NOLOCK) ON a.caMainId = d.caMainId
- WHERE paSearchConditionID=@paSearchConditionID
- AND c.ID >= @MinId
- ORDER BY c.ID, a.ID DESC
- END
- ELSE IF (@TableID = 1)
- BEGIN
- SELECT @MinId = MIN(ID) FROM SearchDB..paSearchJobID_1 WITH(NOLOCK) WHERE paSearchConditionID=@paSearchConditionID
- SET @MinId = @MinId+(@PageNumber-1)*@PageSize
- SELECT TOP 30 a.ID, a.cpMainID, a.caMainID, a.Name as JobName, a.dcJobTypeID,
- a.dcJobTypeIDMinor, a.NeedNumber, a.dcSalaryID, a.EmployType,
- a.dcRegionID, a.Responsibility, a.Demand, a.dcEducationID,
- a.MinExperience, a.MinAge, a.MaxAge, a.IssueDate, a.IssueEND,
- a.IsDelete, a.AddDate, a.RefreshDate, a.Welfare1, a.Welfare2, a.Welfare3,
- a.Welfare4, a.Welfare5, a.Welfare6, a.Welfare7, a.Welfare8,
- a.Welfare9, a.Welfare10, a.Welfare11, a.Welfare12, a.Welfare13,
- a.Welfare14, a.Welfare15, a.Welfare16, a.Welfare17, a.Welfare18,
- a.SecondId EnJobID, b.SecondId EnCpMainID,
- a.LastModifyDate, b.Name cpName, b.dcCompanySizeID,
- b.HasLicence, b.UnLimitedDate, b.BalanceDate, b.Balance,
- b.MemberType, '' cpIndustry, --STUFF((SELECT ','+LTRIM(x.dcIndustryid)+',c'+LTRIM(isnull(y.Category,0)) FROM cpIndustry x,dcIndustry y WHERE x.dcIndustryid = y.id AND x.cpMainid = b.id FOR XML PATH('')),1,1,'') cpIndustry,
- c.IsTop, b.IsRefreshed, d.IsOnline, d.IsVi, d.ViPlanId, d.InterviewDate
- FROM JobPublish a WITH(NOLOCK)
- INNER JOIN cpMainPublish b WITH(NOLOCK) ON a.cpMainID = b.ID
- INNER JOIN SearchDB..paSearchJobID_1 c WITH(NOLOCK) ON a.id = c.JobID
- LEFT JOIN caOnline d WITH(NOLOCK) ON a.caMainId = d.caMainId
- WHERE paSearchConditionID=@paSearchConditionID
- AND c.ID >= @MinId
- ORDER BY c.ID, a.ID DESC
- END
- ELSE IF (@TableID = 2)
- BEGIN
- SELECT @MinId = MIN(ID) FROM SearchDB..paSearchJobID_2 WITH(NOLOCK) WHERE paSearchConditionID=@paSearchConditionID
- SET @MinId = @MinId+(@PageNumber-1)*@PageSize
- SELECT TOP 30 a.ID, a.cpMainID, a.caMainID, a.Name as JobName, a.dcJobTypeID,
- a.dcJobTypeIDMinor, a.NeedNumber, a.dcSalaryID, a.EmployType,
- a.dcRegionID, a.Responsibility, a.Demand, a.dcEducationID,
- a.MinExperience, a.MinAge, a.MaxAge, a.IssueDate, a.IssueEND,
- a.IsDelete, a.AddDate, a.RefreshDate, a.Welfare1, a.Welfare2, a.Welfare3,
- a.Welfare4, a.Welfare5, a.Welfare6, a.Welfare7, a.Welfare8,
- a.Welfare9, a.Welfare10, a.Welfare11, a.Welfare12, a.Welfare13,
- a.Welfare14, a.Welfare15, a.Welfare16, a.Welfare17, a.Welfare18,
- a.SecondId EnJobID, b.SecondId EnCpMainID,
- a.LastModifyDate, b.Name cpName, b.dcCompanySizeID,
- b.HasLicence, b.UnLimitedDate, b.BalanceDate, b.Balance,
- b.MemberType, '' cpIndustry, --STUFF((SELECT ','+LTRIM(x.dcIndustryid)+',c'+LTRIM(isnull(y.Category,0)) FROM cpIndustry x,dcIndustry y WHERE x.dcIndustryid = y.id AND x.cpMainid = b.id FOR XML PATH('')),1,1,'') cpIndustry,
- c.IsTop, b.IsRefreshed, d.IsOnline, d.IsVi, d.ViPlanId, d.InterviewDate
- FROM JobPublish a WITH(NOLOCK)
- INNER JOIN cpMainPublish b WITH(NOLOCK) ON a.cpMainID = b.ID
- INNER JOIN SearchDB..paSearchJobID_2 c WITH(NOLOCK) ON a.id = c.JobID
- LEFT JOIN caOnline d WITH(NOLOCK) ON a.caMainId = d.caMainId
- WHERE paSearchConditionID=@paSearchConditionID
- AND c.ID >= @MinId
- ORDER BY c.ID, a.ID DESC
- END
- ELSE IF (@TableID = 3)
- BEGIN
- SELECT @MinId = MIN(ID) FROM SearchDB..paSearchJobID_3 WITH(NOLOCK) WHERE paSearchConditionID=@paSearchConditionID
- SET @MinId = @MinId+(@PageNumber-1)*@PageSize
- SELECT TOP 30 a.ID, a.cpMainID, a.caMainID, a.Name as JobName, a.dcJobTypeID,
- a.dcJobTypeIDMinor, a.NeedNumber, a.dcSalaryID, a.EmployType,
- a.dcRegionID, a.Responsibility, a.Demand, a.dcEducationID,
- a.MinExperience, a.MinAge, a.MaxAge, a.IssueDate, a.IssueEND,
- a.IsDelete, a.AddDate, a.RefreshDate, a.Welfare1, a.Welfare2, a.Welfare3,
- a.Welfare4, a.Welfare5, a.Welfare6, a.Welfare7, a.Welfare8,
- a.Welfare9, a.Welfare10, a.Welfare11, a.Welfare12, a.Welfare13,
- a.Welfare14, a.Welfare15, a.Welfare16, a.Welfare17, a.Welfare18,
- a.SecondId EnJobID, b.SecondId EnCpMainID,
- a.LastModifyDate, b.Name cpName, b.dcCompanySizeID,
- b.HasLicence, b.UnLimitedDate, b.BalanceDate, b.Balance,
- b.MemberType, '' cpIndustry, --STUFF((SELECT ',' + LTRIM(x.dcIndustryid) + ',c' + LTRIM(isnull(y.Category,0)) FROM cpIndustry x,dcIndustry y WHERE x.dcIndustryid = y.id AND x.cpMainid = b.id FOR XML PATH('')),1,1,'') cpIndustry,
- c.IsTop, b.IsRefreshed, d.IsOnline, d.IsVi, d.ViPlanId, d.InterviewDate
- FROM JobPublish a WITH(NOLOCK)
- INNER JOIN cpMainPublish b WITH(NOLOCK) ON a.cpMainID = b.ID
- INNER JOIN SearchDB..paSearchJobID_3 c WITH(NOLOCK) ON a.id = c.JobID
- LEFT JOIN caOnline d WITH(NOLOCK) ON a.caMainId = d.caMainId
- WHERE paSearchConditionID=@paSearchConditionID
- AND c.ID >= @MinId
- ORDER BY c.ID, a.ID DESC
- END
- --RICHARD 2011-7-23 16:51分修改
- ----返回统计数量
- IF @Type=1
- BEGIN
- DECLARE @RegionCount AS INT
- SELECT @RegionCount = -1
- IF CHARINDEX(',', @dcRegionID) = 0 AND LEN(@dcRegionID) > 0
- BEGIN
- IF NOT LEFT(@dcRegionID,1) = 'p'
- SELECT @RegionCount = COUNT(*) FROM dcRegion WHERE ParentID = @dcRegionID
- END
- IF (@TableID = 0)
- BEGIN
- SELECT * FROM SearchDB..paSearchCount_0 WITH(NOLOCK) WHERE Title = 'JobType' AND paSearchConditionID=@paSearchConditionID ORDER BY Title, CONVERT(VARCHAR(10), TitleID)
- IF @RegionCount = 0
- SELECT * FROM dcMapPlace WITH(NOLOCK) WHERE dcRegionID = @dcRegionID
- ELSE
- SELECT * FROM SearchDB..paSearchCount_0 WITH(NOLOCK) WHERE Title = 'Region' AND paSearchConditionID=@paSearchConditionID ORDER BY Title, CONVERT(VARCHAR(10), TitleID)
- SELECT * FROM SearchDB..paSearchCount_0 WITH(NOLOCK) WHERE Title = 'Education' AND paSearchConditionID=@paSearchConditionID ORDER BY Title, CONVERT(INT, TitleID)
- SELECT * FROM SearchDB..paSearchCount_0 WITH(NOLOCK) WHERE Title = 'Experience' AND paSearchConditionID=@paSearchConditionID ORDER BY Title, CONVERT(INT, TitleID)
- SELECT * FROM SearchDB..paSearchCount_0 WITH(NOLOCK) WHERE Title = 'Salary' AND paSearchConditionID=@paSearchConditionID ORDER BY Title, CONVERT(INT, TitleID)
- SELECT * FROM SearchDB..paSearchCount_0 WITH(NOLOCK) WHERE Title = 'EmployType' AND paSearchConditionID=@paSearchConditionID ORDER BY Title, CONVERT(INT, TitleID)
- SELECT * FROM SearchDB..paSearchCount_0 WITH(NOLOCK) WHERE Title = 'CompanySize' AND paSearchConditionID=@paSearchConditionID ORDER BY Title, CONVERT(INT, TitleID)
- END
- IF (@TableID = 1)
- BEGIN
- SELECT * FROM SearchDB..paSearchCount_1 WITH(NOLOCK) WHERE Title = 'JobType' AND paSearchConditionID=@paSearchConditionID ORDER BY Title, CONVERT(VARCHAR(10), TitleID)
- IF @RegionCount = 0
- SELECT * FROM dcMapPlace WITH(NOLOCK) WHERE dcRegionID = @dcRegionID
- ELSE
- SELECT * FROM SearchDB..paSearchCount_1 WITH(NOLOCK) WHERE Title = 'Region' AND paSearchConditionID=@paSearchConditionID ORDER BY Title, CONVERT(VARCHAR(10), TitleID)
- SELECT * FROM SearchDB..paSearchCount_1 WITH(NOLOCK) WHERE Title = 'Education' AND paSearchConditionID=@paSearchConditionID ORDER BY Title, CONVERT(INT, TitleID)
- SELECT * FROM SearchDB..paSearchCount_1 WITH(NOLOCK) WHERE Title = 'Experience' AND paSearchConditionID=@paSearchConditionID ORDER BY Title, CONVERT(INT, TitleID)
- SELECT * FROM SearchDB..paSearchCount_1 WITH(NOLOCK) WHERE Title = 'Salary' AND paSearchConditionID=@paSearchConditionID ORDER BY Title, CONVERT(INT, TitleID)
- SELECT * FROM SearchDB..paSearchCount_1 WITH(NOLOCK) WHERE Title = 'EmployType' AND paSearchConditionID=@paSearchConditionID ORDER BY Title, CONVERT(INT, TitleID)
- SELECT * FROM SearchDB..paSearchCount_1 WITH(NOLOCK) WHERE Title = 'CompanySize' AND paSearchConditionID=@paSearchConditionID ORDER BY Title, CONVERT(INT, TitleID)
- END
- IF (@TableID = 2)
- BEGIN
- SELECT * FROM SearchDB..paSearchCount_2 WITH(NOLOCK) WHERE Title = 'JobType' AND paSearchConditionID=@paSearchConditionID ORDER BY Title, CONVERT(VARCHAR(10), TitleID)
- IF @RegionCount = 0
- SELECT * FROM dcMapPlace WITH(NOLOCK) WHERE dcRegionID = @dcRegionID
- ELSE
- SELECT * FROM SearchDB..paSearchCount_2 WITH(NOLOCK) WHERE Title = 'Region' AND paSearchConditionID=@paSearchConditionID ORDER BY Title, CONVERT(VARCHAR(10), TitleID)
- SELECT * FROM SearchDB..paSearchCount_2 WITH(NOLOCK) WHERE Title = 'Education' AND paSearchConditionID=@paSearchConditionID ORDER BY Title, CONVERT(INT, TitleID)
- SELECT * FROM SearchDB..paSearchCount_2 WITH(NOLOCK) WHERE Title = 'Experience' AND paSearchConditionID=@paSearchConditionID ORDER BY Title, CONVERT(INT, TitleID)
- SELECT * FROM SearchDB..paSearchCount_2 WITH(NOLOCK) WHERE Title = 'Salary' AND paSearchConditionID=@paSearchConditionID ORDER BY Title, CONVERT(INT, TitleID)
- SELECT * FROM SearchDB..paSearchCount_2 WITH(NOLOCK) WHERE Title = 'EmployType' AND paSearchConditionID=@paSearchConditionID ORDER BY Title, CONVERT(INT, TitleID)
- SELECT * FROM SearchDB..paSearchCount_2 WITH(NOLOCK) WHERE Title = 'CompanySize' AND paSearchConditionID=@paSearchConditionID ORDER BY Title, CONVERT(INT, TitleID)
- END
- IF (@TableID = 3)
- BEGIN
- SELECT * FROM SearchDB..paSearchCount_3 WITH(NOLOCK) WHERE Title = 'JobType' AND paSearchConditionID=@paSearchConditionID ORDER BY Title, CONVERT(VARCHAR(10), TitleID)
- IF @RegionCount = 0
- SELECT * FROM dcMapPlace WITH(NOLOCK) WHERE dcRegionID = @dcRegionID
- ELSE
- SELECT * FROM SearchDB..paSearchCount_3 WITH(NOLOCK) WHERE Title = 'Region' AND paSearchConditionID=@paSearchConditionID ORDER BY Title, CONVERT(VARCHAR(10), TitleID)
- SELECT * FROM SearchDB..paSearchCount_3 WITH(NOLOCK) WHERE Title = 'Education' AND paSearchConditionID=@paSearchConditionID ORDER BY Title, CONVERT(INT, TitleID)
- SELECT * FROM SearchDB..paSearchCount_3 WITH(NOLOCK) WHERE Title = 'Experience' AND paSearchConditionID=@paSearchConditionID ORDER BY Title, CONVERT(INT, TitleID)
- SELECT * FROM SearchDB..paSearchCount_3 WITH(NOLOCK) WHERE Title = 'Salary' AND paSearchConditionID=@paSearchConditionID ORDER BY Title, CONVERT(INT, TitleID)
- SELECT * FROM SearchDB..paSearchCount_3 WITH(NOLOCK) WHERE Title = 'EmployType' AND paSearchConditionID=@paSearchConditionID ORDER BY Title, CONVERT(INT, TitleID)
- SELECT * FROM SearchDB..paSearchCount_3 WITH(NOLOCK) WHERE Title = 'CompanySize' AND paSearchConditionID=@paSearchConditionID ORDER BY Title, CONVERT(INT, TitleID)
- END
- END
- RETURN
- END
- END TRY
- BEGIN CATCH
- ---检查是否已经建立临时表,已经建立则删除
- PRINT 'error'
- PRINT error_Message()
- PRINT error_number()
- PRINT error_line()
- END CATCH
- GO
- /****** Object: StoredProcedure [dbo].[pcJobBySimilarSelect] Script Date: 2018/12/13 19:08:41 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- CREATE PROCEDURE [dbo].[pcJobBySimilarSelect]
- (
- @dcJobTypeID VARCHAR(6),
- @dcRegionID VARCHAR(6),
- @JobId INT
- )
- AS
- SET NOCOUNT ON
- BEGIN
- DECLARE @SecondId VARCHAR(12)
- SELECT @SecondId = SecondId
- FROM JobPublish WITH(NOLOCK)
- WHERE ID = @JobID
- IF @SecondId IS NULL
- SELECT @SecondId = ''
- IF @dcRegionID LIKE '32%'
- SET @dcRegionID = '30'
-
- SELECT TOP 10 *
- FROM (
- SELECT TOP 50 NeedNumber, JobName, a.ID, cpMainID, cpName, SubSiteUrl,
- b.FullName, dcSalaryID, dcSalaryIDMax, LastLoginDate
- FROM JobSimilar a WITH(NOLOCK INDEX(IX_JobSimilar_Complex)),
- dcRegion b WITH(NOLOCK)
- WHERE a.dcRegionID = b.ID
- AND dcJobTypeID LIKE @dcJobTypeID + '%'
- AND dcRegionID LIKE @dcRegionID + '%'
- ) a
- WHERE ID <> @SecondId
- ORDER BY NEWID()
- END
- GO
- /****** Object: StoredProcedure [dbo].[pcJobByZhaopinSelect] Script Date: 2018/12/13 19:08:42 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- CREATE PROCEDURE [dbo].[pcJobByZhaopinSelect]
- (
- @dcJobTypeID VARCHAR(100), --职位类别
- @dcRegionID VARCHAR(100), --求职地区
- @dcIndustryID VARCHAR(100), --求职行业
- @dcSalaryID TINYINT, --月薪
- @IsNegotiable BIT, --1允许面议,不面议
- @MinExperience TINYINT, --工作经验,100为未选择
- @dcEducationID TINYINT, --最低学历
- @EmployType VARCHAR(10), --工作性质,1全职;3兼职;4实习,
- @KeyWord NVARCHAR(10), --关键词
- @KeyType TINYINT, --关键词类别,0无;1-全文;2-职位;3-公司
- @ORDER VARCHAR(100), --显示顺序,没有用
- @RefreshNo INT, --1,1天内;2,3天内;3,一周内;4,15天内;5,一个月内;6超过一个月
- @Type INT, --1:主动搜索 点击搜索按钮 10分钟,翻页60分钟有效;0:翻页搜索,不刷新
- @PageNumber INT, --翻页页码
- @SessionID VARCHAR(50)
- )
- AS
- --return @SessionId = 16
- SET NOCOUNT ON
- INSERT INTO SearchIp(Ip, Source) SELECT @SessionId, 'z'
- IF EXISTS(SELECT 'x' FROM RefuseIp WITH(NOLOCK) WHERE CHARINDEX(Ip,@SessionId) > 0)
- BEGIN
- SELECT 0 ValidJobNumber
- SELECT TOP 0 * FROM JobTemp
- SELECT TOP 0 * FROM SearchDB..paSearchCount_0
- SELECT TOP 0 * FROM SearchDB..paSearchCount_0
- SELECT TOP 0 * FROM SearchDB..paSearchCount_0
- SELECT TOP 0 * FROM SearchDB..paSearchCount_0
- SELECT TOP 0 * FROM SearchDB..paSearchCount_0
- SELECT TOP 0 * FROM SearchDB..paSearchCount_0
- SELECT TOP 0 * FROM SearchDB..paSearchCount_0
- RETURN
- END
- SET @SessionId = 30
- BEGIN TRY
- BEGIN
- ----给null值变量赋默认值
- SELECT @dcJobTypeID = dbo.FormatIDS(@dcJobTypeID),
- @dcRegionID = dbo.FormatIDS(@dcRegionID),
- @dcIndustryID = dbo.FormatIDS(@dcIndustryID)
- IF @dcSalaryID IS NULL
- SET @dcSalaryID = 0
- IF @MinExperience IS NULL
- SET @MinExperience = 100
- IF @dcEducationID IS NULL
- SET @dcEducationID = 0
- IF @EmployType IS NULL
- SET @EmployType = ''
- IF @EmployType = '2'
- SET @EmployType = '1,3'
- IF @ORDER IS NULL
- SET @ORDER = ''
- SET @ORDER = dbo.SafeSQL(@ORDER)
- --@RefreshNo = 0选择全部数据,不限制时间
- DECLARE @dcProvinceId INT
- IF ISNULL(@RefreshNo, 0) > 9
- SELECT @dcProvinceId = @RefreshNo
- ELSE
- SELECT @dcProvinceId = 0
- IF @Type IS NULL
- SET @Type = 0
- IF @PageNumber IS NULL
- SET @PageNumber = 0
-
- IF(ISNULL(@dcJobTypeID, '') = '' AND ISNULL(@dcRegionID, '') = '' AND ISNULL(@dcIndustryID, '') = '')
- RETURN
- DECLARE @paSearchConditionID AS INT, @MinId AS INT, @PageSize AS TINYINT, @TableID AS TINYINT
- SELECT @paSearchConditionID = 0, @PageSize = 50
- ----搜索2分钟的数据
- SELECT TOP 1 @paSearchConditionID = ID
- FROM SearchDB..paSearchCondition WITH(NOLOCK)
- WHERE JobType=@dcJobTypeID AND JobPlace=@dcRegionID AND Industry=@dcIndustryID
- AND Education=@dcEducationID AND Experience=@MinExperience AND Salary=@dcSalaryID
- AND EmployType=@EmployType AND KeyWord='' AND CompanySizeID = 0
- AND Welfare = '' AND IsOnline=0 AND dcProvinceId = @dcProvinceId
- AND LogTime > DATEADD(MINUTE, -1, GETDATE()) AND ReuseNumber > 0
- ORDER BY ID DESC
-
- IF ISNULL(@paSearchConditionID, 0) = 0
- BEGIN
- SET @Type =1
- GOTO SelectReset --无数据,重新搜索
- END
- ELSE
- BEGIN
- SELECT @TableID = @paSearchConditionID % 4
- GOTO GetRecordSet --从临时结果中提取数据
- END
- END
- SelectReset: --从job中搜索数据
- BEGIN TRAN
- DECLARE @SQL AS VARCHAR(8000)
- DECLARE @WHERE AS VARCHAR(8000)
- DECLARE @FROM AS VARCHAR(1000)
- ----记录查询条件
- INSERT INTO SearchDB..paSearchCondition(SessionID, LogTime, JobType, JobPlace, Industry, Education, Experience,
- Salary, IsNegotiable, EmployType, KeyWord, KeyType, ReuseNumber, CompanySizeID, dcProvinceId)
- SELECT @SessionId, GETDATE(), @dcJobTypeID, @dcRegionID, @dcIndustryID, @dcEducationID, @MinExperience,
- @dcSalaryID, @IsNegotiable, @EmployType, '', 0, 0, 0, @dcProvinceId
- SET @paSearchConditionID = @@IDENTITY
- SELECT @TableID = @paSearchConditionID % 4
- ------生成职位类别的表变量,因为职位类别有包含(父子)关系
- DECLARE @T_JobPlace AS TABLE(ID INT)
- DECLARE @T_JobType AS TABLE(ID INT)
- DECLARE @JobType AS VARCHAR(3000)
- DECLARE @JobPlace AS VARCHAR(2000)
- DECLARE @ValidJobNumber AS INT
- DECLARE @JobPlaceLen AS INT, @JobTypeLen AS INT
- IF CHARINDEX(',', @dcJobTypeID) > 0
- SET @JobTypeLen = -1
- ELSE
- SET @JobTypeLen = LEN(@dcJobTypeID)
- SELECT @JobPlace = '', @JobType=''
- ----生成工作地点的表变量
- IF LEN(@dcRegionID) > 0
- BEGIN
- INSERT INTO @T_JobPlace
- SELECT * FROM dbo.fnSplit(@dcRegionID, ',')
- SELECT @JobPlace = (@JobPlace + ' OR a.dcRegionID Like ''' + LTRIM(STR(ID) + '%''')) FROM @T_JobPlace
- IF LEN(@JobPlace) > 0
- SET @JobPlace = RIGHT(@JobPlace, LEN(@JobPlace) -4)
- IF (SELECT COUNT(*) FROM @T_JobPlace) > 1
- SET @JobPlaceLen = -1
- ELSE
- SET @JobPlaceLen = LEN(@dcRegionID)
- END
- ----生成求聘职位的表变量
- IF LEN(@dcJobTypeID) > 0
- BEGIN
- DECLARE @T_Temp AS TABLE(ID INT) --临时表,用于构建组合查询语句
- INSERT INTO @T_Temp
- SELECT * FROM dbo.fnSplit(@dcJobTypeID, ',')
- INSERT INTO @T_JobType
- SELECT DISTINCT ID FROM dcJobType WITH(NOLOCK)
- WHERE ParentId IN(SELECT ID FROM @T_TEMP)
- OR ParentId2 in(SELECT ID FROM @T_TEMP)
- OR ID IN(SELECT ID FROM @T_TEMP)
- ----生成in字符串
- SELECT @JobType = (@JobType + LTRIM(STR(ID) + ',')) FROM @T_JobType
- IF RIGHT(@JobType, 1) = ','
- SET @JobType = LEFT(@JobType, LEN(@JobType) - 1)
- END
- ----建立临时表
- CREATE TABLE #Job(
- RowID INT IDENTITY(1, 1),
- ID INT NOT NULL,
- cpMainId INT,
- dcJobTypeID SMALLINT NOT NULL,
- dcJobTypeIDMinor SMALLINT NULL,
- dcSalaryID TINYINT NOT NULL,
- dcRegionID VARCHAR(6) NULL,
- dcEducationID TINYINT NOT NULL,
- MinExperience TINYINT NOT NULL,
- RefreshDate SMALLDATETIME NULL,
- EmployType TINYINT NULL,
- dcCompanySizeID SMALLINT NULL
- )
- ------刷新时间,根据刷新时间编号计算
- ----生成插入临时表的Sql语句
- SET @SQL='
- INSERT INTO #Job
- SELECT a.ID, a.cpMainId, a.dcJobTypeID, a.dcJobTypeIDMinor, a.dcSalaryID,
- a.dcRegionID, a.dcEducationID, a.MinExperience, a.IssueDate, a.EmployType, b.dcCompanySizeID'
- SET @FROM = '
- FROM JobPublish a WITH(NOLOCK)
- INNER JOIN cpMainPublish b WITH(NOLOCK) ON a.cpMainID=b.ID'
- ----职位有效,单位新有效
- IF LEN(@dcIndustryID) > 0
- SET @WHERE = '
- WHERE b.ID IN (SELECT cpMainID FROM cpIndustry WHERE dcIndustryId in(' + @dcIndustryID + '))
- AND a.Valid = 1
- AND b.Valid = 1'
- ELSE
- SET @WHERE = '
- WHERE a.Valid = 1
- AND b.Valid = 1'
- IF @dcProvinceId > 0
- SET @WHERE = @WHERE + ' AND b.dcProvinceId = ' + LTRIM(STR(@dcProvinceId))
- ----职位类别
- IF LEN(@dcJobTypeID) > 0
- SET @WHERE = @WHERE + '
- AND (a.dcJobTypeID IN(' + @JobType +')
- OR a.dcJobTypeIDMinor IN(' +@JobType + '))'
- IF LEN(@JobPlace) > 0
- SET @WHERE = @WHERE + '
- AND (' + @JobPlace + ')'
- IF @dcSalaryID > 0
- BEGIN
- IF @dcSalaryID < 100 ----从form中搜索,月薪跨2个级别,是本级和上级别的薪金
- BEGIN
- SET @WHERE = @WHERE + '
- AND a.dcSalaryID IN(' + LTRIM(STR(@dcSalaryID)) + ', ' + LTRIM(STR(@dcSalaryID + 1))
- IF @IsNegotiable = 1 --包括面议
- SET @WHERE = @WHERE + ', 100'
- SET @WHERE = @WHERE + ')'
- END
- IF @dcSalaryID = 100 ----从筛选结果中点击面议,值是100
- BEGIN
- SET @WHERE = @WHERE + '
- AND a.dcSalaryID = 100'
- END
- IF @dcSalaryID > 100 ----从筛选结果中点击搜索,月薪只有1个级别,传值时增加100
- SET @WHERE = @WHERE + '
- AND a.dcSalaryID=' + LTRIM(STR(@dcSalaryID-100))
- END
- ----工作经验要求
- IF @MinExperience < 100
- SET @WHERE = @WHERE + '
- AND a.MinExperience = ' + LTRIM(STR(@MinExperience))
- ----学历要求
- ----'1初中','2\3\4高中、中技、中专','5大专','6本科','7硕士','8博士
- IF @dcEducationID > 0
- IF @dcEducationID = 2
- SET @WHERE = @WHERE + '
- AND a.dcEducationID IN(2,3,4)'
- ELSE
- SET @WHERE = @WHERE + '
- AND a.dcEducationID = ' + LTRIM(STR(@dcEducationID))
- ----1、全职;3、兼职;4实习。 2、全职/兼职 职位中无此项
- IF LEN(@EmployType) > 0
- SET @WHERE = @WHERE + '
- AND a.EmployType IN (' + @EmployType + ')'
- SET @SQL = @SQL + @FROM + @WHERE
-
- --IF LEN(@ORDER)>0
- SET @SQL=@SQL + ' ORDER BY a.RefreshDate DESC, a.SecondID'
- --原来是ORDER BY a.IssueDate DESC, a.ID,Richard 2011年11月23日17:06分修改
- ----把符合条件的职位全部列出
- --PRINT @SQL
- EXEC(@SQL)
-
- SET @ValidJobNumber = @@ROWCOUNT
- ----记录查询结果总数
- UPDATE SearchDB..paSearchCondition SET ValidJobNumber=@ValidJobNumber, SQl=@SQL WHERE ID=@paSearchConditionID
-
- DECLARE @TitleValue AS INT, @TopRows AS INT, @AllRows AS INT
- DECLARE @sc AS TABLE (
- paSearchConditionID int,
- Title varchar(20),
- TitleID varchar(10),
- TitleValue int
- )
- DECLARE @sc2 AS TABLE (
- paSearchConditionID int,
- Title varchar(20),
- TitleID varchar(10),
- TitleValue int
- )
- ----插入JobType数据
- IF (@TableID = 0)
- BEGIN
- ----------------------------jobtype
- INSERT INTO @sc2(paSearchConditionID, Title, TitleId, TitleValue)
- SELECT @paSearchConditionID, 'JobType', dcJobTypeID, COUNT(*)
- FROM #Job WITH(NOLOCK)
- GROUP BY dcJobTypeID ORDER BY dcJobTypeID
- ----计算全部某职位类别,2, 4位的数据
- IF @JobTypeLen NOT IN(2, 4)
- BEGIN
- INSERT INTO @Sc(paSearchConditionID, Title, TitleId, TitleValue)
- SELECT @paSearchConditionID, 'JobType', LEFT(TitleID, 2) TitleID, SUM(TitleValue) TitleValue
- FROM @sc2 GROUP BY LEFT(TitleID, 2)
- END
- IF @JobTypeLen NOT IN(0, 4)
- BEGIN
- INSERT INTO @Sc(paSearchConditionID, Title, TitleId, TitleValue)
- SELECT @paSearchConditionID, 'JobType', TitleId, TitleValue
- FROM @sc2 WHERE LEN(TitleId) = 4
- END
- IF @JobTypeLen = -1
- DELETE @sc WHERE TitleID NOT IN(SELECT a FROM dbo.fnSplit(@dcJobTypeID, ','))
- INSERT INTO SearchDB..paSearchCount_0(paSearchConditionID, Title, TitleId, TitleValue)
- SELECT @paSearchConditionID, 'JobType', TitleId, TitleValue FROM @sc
- DELETE @sc
- DELETE @sc2
- --------------------------region
- INSERT INTO @sc2(paSearchConditionID, Title, TitleId, TitleValue)
- SELECT @paSearchConditionID, 'Region', dcRegionID, COUNT(*) FROM #Job WITH(NOLOCK)
- GROUP BY dcRegionID ORDER BY dcRegionID
- ----计算全部地区,2位的数据
- IF @JobPlaceLen IN(-1, 0)
- INSERT INTO @sc(paSearchConditionID, Title, TitleId, TitleValue)
- SELECT @paSearchConditionID, 'Region', LEFT(TitleID, 2) TitleID, SUM(TitleValue) TitleValue
- FROM @sc2 GROUP BY LEFT(TitleID, 2)
- IF @JobPlaceLen IN(-1, 2)
- INSERT INTO @sc(paSearchConditionID, Title, TitleId, TitleValue)
- SELECT @paSearchConditionID, 'Region', LEFT(TitleID, 4) TitleID, SUM(TitleValue) TitleValue
- FROM @sc2 WHERE LEN(TitleID) >= 4 GROUP BY LEFT(TitleID, 4)
- IF @JobPlaceLen IN(-1, 4)
- INSERT INTO @sc(paSearchConditionID, Title, TitleId, TitleValue)
- SELECT @paSearchConditionID, 'Region', TitleID, TitleValue
- FROM @sc2 WHERE LEN(TitleID) = 6
- IF @JobPlaceLen = -1
- DELETE @sc WHERE TitleID NOT IN(SELECT ID FROM @T_JobPlace)
- ELSE
- DELETE @sc WHERE LEN(TitleID) <> @JobPlaceLen + 2
- INSERT INTO SearchDB..paSearchCount_0(paSearchConditionID, Title, TitleId, TitleValue)
- SELECT paSearchConditionID, Title, TitleId, TitleValue FROM @sc
- ----------------------------
- INSERT INTO SearchDB..paSearchCount_0(paSearchConditionID, Title, TitleId, TitleValue)
- SELECT @paSearchConditionID, 'EmployType', EmployType, COUNT(*) FROM #Job WITH(NOLOCK)
- GROUP BY EmployType ORDER BY EmployType
- INSERT INTO SearchDB..paSearchCount_0(paSearchConditionID, Title, TitleId, TitleValue)
- SELECT @paSearchConditionID, 'Education', CASE WHEN dcEducationId IN(2, 3, 4) THEN 2 ELSE dcEducationId END, COUNT(*) FROM #Job WITH(NOLOCK)
- GROUP BY CASE WHEN dcEducationId IN(2, 3, 4) THEN 2 ELSE dcEducationId END
- ORDER BY CASE WHEN dcEducationId IN(2, 3, 4) THEN 2 ELSE dcEducationId END
- INSERT INTO SearchDB..paSearchCount_0(paSearchConditionID, Title, TitleId, TitleValue)
- SELECT @paSearchConditionID, 'Experience', MinExperience, COUNT(*) FROM #Job WITH(NOLOCK)
- GROUP BY MinExperience ORDER BY MinExperience
- INSERT INTO SearchDB..paSearchCount_0(paSearchConditionID, Title, TitleId, TitleValue)
- SELECT @paSearchConditionID, 'CompanySize', dcCompanySizeID, COUNT(*) FROM #Job WITH(NOLOCK)
- GROUP BY dcCompanySizeID ORDER BY dcCompanySizeID
- INSERT INTO SearchDB..paSearchCount_0(paSearchConditionID, Title, TitleId, TitleValue)
- SELECT @paSearchConditionID, 'Salary', dcSalaryID, COUNT(*) FROM #Job WITH(NOLOCK)
- GROUP BY dcSalaryID ORDER BY dcSalaryID
- INSERT INTO SearchDB..paSearchCount_0(paSearchConditionID, Title, TitleId, TitleValue)
- SELECT @paSearchConditionID, 'Industry', dcIndustryID, COUNT(*)
- FROM #Job a WITH(NOLOCK), cpIndustry b WITH(NOLOCK)
- WHERE a.cpMainId = b.cpMainId
- GROUP BY b.dcIndustryId ORDER BY b.dcIndustryId
- INSERT INTO SearchDB..paSearchJobID_0(paSearchConditionId, JobId)
- SELECT TOP 2000 @paSearchConditionID, ID FROM #Job WITH(NOLOCK) ORDER BY RowId
- END
- ELSE IF (@TableId = 1)
- BEGIN
- ----------------------------jobtype
- INSERT INTO @sc2(paSearchConditionID, Title, TitleId, TitleValue)
- SELECT @paSearchConditionID, 'JobType', dcJobTypeID, COUNT(*)
- FROM #Job WITH(NOLOCK)
- GROUP BY dcJobTypeID ORDER BY dcJobTypeID
- ----计算全部某职位类别,2, 4位的数据
- IF @JobTypeLen NOT IN(2, 4)
- BEGIN
- INSERT INTO @Sc(paSearchConditionID, Title, TitleId, TitleValue)
- SELECT @paSearchConditionID, 'JobType', LEFT(TitleID, 2) TitleID, SUM(TitleValue) TitleValue
- FROM @sc2 GROUP BY LEFT(TitleID, 2)
- END
- IF @JobTypeLen NOT IN(0, 4)
- BEGIN
- INSERT INTO @Sc(paSearchConditionID, Title, TitleId, TitleValue)
- SELECT @paSearchConditionID, 'JobType', TitleId, TitleValue
- FROM @sc2 WHERE LEN(TitleId) = 4
- END
- IF @JobTypeLen = -1
- DELETE @sc WHERE TitleID NOT IN(SELECT a FROM dbo.fnSplit(@dcJobTypeID, ','))
- INSERT INTO SearchDB..paSearchCount_1(paSearchConditionID, Title, TitleId, TitleValue)
- SELECT @paSearchConditionID, 'JobType', TitleId, TitleValue FROM @sc
- DELETE @sc
- DELETE @sc2
- --------------------------region
- INSERT INTO @sc2(paSearchConditionID, Title, TitleId, TitleValue)
- SELECT @paSearchConditionID, 'Region', dcRegionID, COUNT(*) FROM #Job WITH(NOLOCK)
- GROUP BY dcRegionID ORDER BY dcRegionID
- ----计算全部地区,2位的数据
- IF @JobPlaceLen IN(-1, 0)
- INSERT INTO @sc(paSearchConditionID, Title, TitleId, TitleValue)
- SELECT @paSearchConditionID, 'Region', LEFT(TitleID, 2) TitleID, SUM(TitleValue) TitleValue
- FROM @sc2 GROUP BY LEFT(TitleID, 2)
- IF @JobPlaceLen IN(-1, 2)
- INSERT INTO @sc(paSearchConditionID, Title, TitleId, TitleValue)
- SELECT @paSearchConditionID, 'Region', LEFT(TitleID, 4) TitleID, SUM(TitleValue) TitleValue
- FROM @sc2 WHERE LEN(TitleID) >= 4 GROUP BY LEFT(TitleID, 4)
- IF @JobPlaceLen IN(-1, 4)
- INSERT INTO @sc(paSearchConditionID, Title, TitleId, TitleValue)
- SELECT @paSearchConditionID, 'Region', TitleID, TitleValue
- FROM @sc2 WHERE LEN(TitleID) = 6
- IF @JobPlaceLen = -1
- DELETE @sc WHERE TitleID NOT IN(SELECT ID FROM @T_JobPlace)
- ELSE
- DELETE @sc WHERE LEN(TitleID) <> @JobPlaceLen + 2
- INSERT INTO SearchDB..paSearchCount_1(paSearchConditionID, Title, TitleId, TitleValue)
- SELECT paSearchConditionID, Title, TitleId, TitleValue FROM @sc
- ----------------------------
- INSERT INTO SearchDB..paSearchCount_1(paSearchConditionID, Title, TitleId, TitleValue)
- SELECT @paSearchConditionID, 'Salary', dcSalaryID, COUNT(*) FROM #Job WITH(NOLOCK)
- GROUP BY dcSalaryID ORDER BY dcSalaryID
- INSERT INTO SearchDB..paSearchCount_1(paSearchConditionID, Title, TitleId, TitleValue)
- SELECT @paSearchConditionID, 'Education', CASE WHEN dcEducationId IN(2, 3, 4) THEN 2 ELSE dcEducationId END, COUNT(*) FROM #Job WITH(NOLOCK)
- GROUP BY CASE WHEN dcEducationId IN(2, 3, 4) THEN 2 ELSE dcEducationId END
- ORDER BY CASE WHEN dcEducationId IN(2, 3, 4) THEN 2 ELSE dcEducationId END
-
- INSERT INTO SearchDB..paSearchCount_1(paSearchConditionID, Title, TitleId, TitleValue)
- SELECT @paSearchConditionID, 'Experience', MinExperience, COUNT(*) FROM #Job WITH(NOLOCK)
- GROUP BY MinExperience ORDER BY MinExperience
- INSERT INTO SearchDB..paSearchCount_1(paSearchConditionID, Title, TitleId, TitleValue)
- SELECT @paSearchConditionID, 'EmployType', EmployType, COUNT(*) FROM #Job WITH(NOLOCK)
- GROUP BY EmployType ORDER BY EmployType
- INSERT INTO SearchDB..paSearchCount_1(paSearchConditionID, Title, TitleId, TitleValue)
- SELECT @paSearchConditionID, 'CompanySize', dcCompanySizeID, COUNT(*) FROM #Job WITH(NOLOCK)
- GROUP BY dcCompanySizeID ORDER BY dcCompanySizeID
- INSERT INTO SearchDB..paSearchCount_1(paSearchConditionID, Title, TitleId, TitleValue)
- SELECT @paSearchConditionID, 'Industry', dcIndustryID, COUNT(*)
- FROM #Job a WITH(NOLOCK), cpIndustry b WITH(NOLOCK)
- WHERE a.cpMainId = b.cpMainId
- GROUP BY dcIndustryID ORDER BY dcIndustryID
- INSERT INTO SearchDB..paSearchJobID_1(paSearchConditionId, JobId)
- SELECT TOP 2000 @paSearchConditionID, ID FROM #Job WITH(NOLOCK) ORDER BY RowId
- END
- ELSE IF (@TableId = 2)
- BEGIN
- ----------------------------jobtype
- INSERT INTO @sc2(paSearchConditionID, Title, TitleId, TitleValue)
- SELECT @paSearchConditionID, 'JobType', dcJobTypeID, COUNT(*)
- FROM #Job WITH(NOLOCK)
- GROUP BY dcJobTypeID ORDER BY dcJobTypeID
- ----计算全部某职位类别,2, 4位的数据
- IF @JobTypeLen NOT IN(2, 4)
- BEGIN
- INSERT INTO @Sc(paSearchConditionID, Title, TitleId, TitleValue)
- SELECT @paSearchConditionID, 'JobType', LEFT(TitleID, 2) TitleID, SUM(TitleValue) TitleValue
- FROM @sc2 GROUP BY LEFT(TitleID, 2)
- END
- IF @JobTypeLen NOT IN(0, 4)
- BEGIN
- INSERT INTO @Sc(paSearchConditionID, Title, TitleId, TitleValue)
- SELECT @paSearchConditionID, 'JobType', TitleId, TitleValue
- FROM @sc2 WHERE LEN(TitleId) = 4
- END
- IF @JobTypeLen = -1
- DELETE @sc WHERE TitleID NOT IN(SELECT a FROM dbo.fnSplit(@dcJobTypeID, ','))
- INSERT INTO SearchDB..paSearchCount_2(paSearchConditionID, Title, TitleId, TitleValue)
- SELECT @paSearchConditionID, 'JobType', TitleId, TitleValue FROM @sc
- DELETE @sc
- DELETE @sc2
- --------------------------region
- INSERT INTO @sc2(paSearchConditionID, Title, TitleId, TitleValue)
- SELECT @paSearchConditionID, 'Region', dcRegionID, COUNT(*) FROM #Job WITH(NOLOCK)
- GROUP BY dcRegionID ORDER BY dcRegionID
- ----计算全部地区,2位的数据
- IF @JobPlaceLen IN(-1, 0)
- INSERT INTO @sc(paSearchConditionID, Title, TitleId, TitleValue)
- SELECT @paSearchConditionID, 'Region', LEFT(TitleID, 2) TitleID, SUM(TitleValue) TitleValue
- FROM @sc2 GROUP BY LEFT(TitleID, 2)
- IF @JobPlaceLen IN(-1, 2)
- INSERT INTO @sc(paSearchConditionID, Title, TitleId, TitleValue)
- SELECT @paSearchConditionID, 'Region', LEFT(TitleID, 4) TitleID, SUM(TitleValue) TitleValue
- FROM @sc2 WHERE LEN(TitleID) >= 4 GROUP BY LEFT(TitleID, 4)
- IF @JobPlaceLen IN(-1, 4)
- INSERT INTO @sc(paSearchConditionID, Title, TitleId, TitleValue)
- SELECT @paSearchConditionID, 'Region', TitleID, TitleValue
- FROM @sc2 WHERE LEN(TitleID) = 6
- IF @JobPlaceLen = -1
- DELETE @sc WHERE TitleID NOT IN(SELECT ID FROM @T_JobPlace)
- ELSE
- DELETE @sc WHERE LEN(TitleID) <> @JobPlaceLen + 2
- INSERT INTO SearchDB..paSearchCount_2(paSearchConditionID, Title, TitleId, TitleValue)
- SELECT paSearchConditionID, Title, TitleId, TitleValue FROM @sc
- ----------------------------
- INSERT INTO SearchDB..paSearchCount_2(paSearchConditionID, Title, TitleId, TitleValue)
- SELECT @paSearchConditionID, 'Salary', dcSalaryID, COUNT(*) FROM #Job WITH(NOLOCK)
- GROUP BY dcSalaryID ORDER BY dcSalaryID
- INSERT INTO SearchDB..paSearchCount_2(paSearchConditionID, Title, TitleId, TitleValue)
- SELECT @paSearchConditionID, 'Education', CASE WHEN dcEducationId IN(2, 3, 4) THEN 2 ELSE dcEducationId END, COUNT(*) FROM #Job WITH(NOLOCK)
- GROUP BY CASE WHEN dcEducationId IN(2, 3, 4) THEN 2 ELSE dcEducationId END
- ORDER BY CASE WHEN dcEducationId IN(2, 3, 4) THEN 2 ELSE dcEducationId END
-
- INSERT INTO SearchDB..paSearchCount_2(paSearchConditionID, Title, TitleId, TitleValue)
- SELECT @paSearchConditionID, 'Experience', MinExperience, COUNT(*) FROM #Job WITH(NOLOCK)
- GROUP BY MinExperience ORDER BY MinExperience
- INSERT INTO SearchDB..paSearchCount_2(paSearchConditionID, Title, TitleId, TitleValue)
- SELECT @paSearchConditionID, 'EmployType', EmployType, COUNT(*) FROM #Job WITH(NOLOCK)
- GROUP BY EmployType ORDER BY EmployType
- INSERT INTO SearchDB..paSearchCount_2(paSearchConditionID, Title, TitleId, TitleValue)
- SELECT @paSearchConditionID, 'CompanySize', dcCompanySizeID, COUNT(*) FROM #Job WITH(NOLOCK)
- GROUP BY dcCompanySizeID ORDER BY dcCompanySizeID
- INSERT INTO SearchDB..paSearchCount_2(paSearchConditionID, Title, TitleId, TitleValue)
- SELECT @paSearchConditionID, 'Industry', dcIndustryID, COUNT(*)
- FROM #Job a WITH(NOLOCK), cpIndustry b WITH(NOLOCK)
- WHERE a.cpMainId = b.cpMainId
- GROUP BY dcIndustryID ORDER BY dcIndustryID
- INSERT INTO SearchDB..paSearchJobID_2(paSearchConditionId, JobId)
- SELECT TOP 2000 @paSearchConditionID, ID FROM #Job WITH(NOLOCK) ORDER BY RowId
- END
- ELSE IF (@TableId = 3)
- BEGIN
- ----------------------------jobtype
- INSERT INTO @sc2(paSearchConditionID, Title, TitleId, TitleValue)
- SELECT @paSearchConditionID, 'JobType', dcJobTypeID, COUNT(*)
- FROM #Job WITH(NOLOCK)
- GROUP BY dcJobTypeID ORDER BY dcJobTypeID
- ----计算全部某职位类别,2, 4位的数据
- IF @JobTypeLen NOT IN(2, 4)
- BEGIN
- INSERT INTO @Sc(paSearchConditionID, Title, TitleId, TitleValue)
- SELECT @paSearchConditionID, 'JobType', LEFT(TitleID, 2) TitleID, SUM(TitleValue) TitleValue
- FROM @sc2 GROUP BY LEFT(TitleID, 2)
- END
- IF @JobTypeLen NOT IN(0, 4)
- BEGIN
- INSERT INTO @Sc(paSearchConditionID, Title, TitleId, TitleValue)
- SELECT @paSearchConditionID, 'JobType', TitleId, TitleValue
- FROM @sc2 WHERE LEN(TitleId) = 4
- END
- IF @JobTypeLen = -1
- DELETE @sc WHERE TitleID NOT IN(SELECT a FROM dbo.fnSplit(@dcJobTypeID, ','))
- INSERT INTO SearchDB..paSearchCount_3(paSearchConditionID, Title, TitleId, TitleValue)
- SELECT @paSearchConditionID, 'JobType', TitleId, TitleValue FROM @sc
- DELETE @sc
- DELETE @sc2
- --------------------------region
- INSERT INTO @sc2(paSearchConditionID, Title, TitleId, TitleValue)
- SELECT @paSearchConditionID, 'Region', dcRegionID, COUNT(*) FROM #Job WITH(NOLOCK)
- GROUP BY dcRegionID ORDER BY dcRegionID
- ----计算全部地区,2位的数据
- IF @JobPlaceLen IN(-1, 0)
- INSERT INTO @sc(paSearchConditionID, Title, TitleId, TitleValue)
- SELECT @paSearchConditionID, 'Region', LEFT(TitleID, 2) TitleID, SUM(TitleValue) TitleValue
- FROM @sc2 GROUP BY LEFT(TitleID, 2)
- IF @JobPlaceLen IN(-1, 2)
- INSERT INTO @sc(paSearchConditionID, Title, TitleId, TitleValue)
- SELECT @paSearchConditionID, 'Region', LEFT(TitleID, 4) TitleID, SUM(TitleValue) TitleValue
- FROM @sc2 WHERE LEN(TitleID) >= 4 GROUP BY LEFT(TitleID, 4)
- IF @JobPlaceLen IN(-1, 4)
- INSERT INTO @sc(paSearchConditionID, Title, TitleId, TitleValue)
- SELECT @paSearchConditionID, 'Region', TitleID, TitleValue
- FROM @sc2 WHERE LEN(TitleID) = 6
- IF @JobPlaceLen = -1
- DELETE @sc WHERE TitleID NOT IN(SELECT ID FROM @T_JobPlace)
- ELSE
- DELETE @sc WHERE LEN(TitleID) <> @JobPlaceLen + 2
- INSERT INTO SearchDB..paSearchCount_3(paSearchConditionID, Title, TitleId, TitleValue)
- SELECT paSearchConditionID, Title, TitleId, TitleValue FROM @sc
- ----------------------------
- INSERT INTO SearchDB..paSearchCount_3(paSearchConditionID, Title, TitleId, TitleValue)
- SELECT @paSearchConditionID, 'Salary', dcSalaryID, COUNT(*) FROM #Job WITH(NOLOCK)
- GROUP BY dcSalaryID ORDER BY dcSalaryID
- INSERT INTO SearchDB..paSearchCount_3(paSearchConditionID, Title, TitleId, TitleValue)
- SELECT @paSearchConditionID, 'Education', CASE WHEN dcEducationId IN(2, 3, 4) THEN 2 ELSE dcEducationId END, COUNT(*) FROM #Job WITH(NOLOCK)
- GROUP BY CASE WHEN dcEducationId IN(2, 3, 4) THEN 2 ELSE dcEducationId END
- ORDER BY CASE WHEN dcEducationId IN(2, 3, 4) THEN 2 ELSE dcEducationId END
-
- INSERT INTO SearchDB..paSearchCount_3(paSearchConditionID, Title, TitleId, TitleValue)
- SELECT @paSearchConditionID, 'Experience', MinExperience, COUNT(*) FROM #Job WITH(NOLOCK)
- GROUP BY MinExperience ORDER BY MinExperience
- INSERT INTO SearchDB..paSearchCount_3(paSearchConditionID, Title, TitleId, TitleValue)
- SELECT @paSearchConditionID, 'EmployType', EmployType, COUNT(*) FROM #Job WITH(NOLOCK)
- GROUP BY EmployType ORDER BY EmployType
- INSERT INTO SearchDB..paSearchCount_3(paSearchConditionID, Title, TitleId, TitleValue)
- SELECT @paSearchConditionID, 'CompanySize', dcCompanySizeID, COUNT(*) FROM #Job WITH(NOLOCK)
- GROUP BY dcCompanySizeID ORDER BY dcCompanySizeID
- INSERT INTO SearchDB..paSearchCount_3(paSearchConditionID, Title, TitleId, TitleValue)
- SELECT @paSearchConditionID, 'Industry', dcIndustryID, COUNT(*)
- FROM #Job a WITH(NOLOCK), cpIndustry b WITH(NOLOCK)
- WHERE a.cpMainId = b.cpMainId
- GROUP BY dcIndustryID ORDER BY dcIndustryID
- INSERT INTO SearchDB..paSearchJobID_3(paSearchConditionId, JobId)
- SELECT TOP 2000 @paSearchConditionID, ID FROM #Job WITH(NOLOCK) ORDER BY RowId
- END
- DROP TABLE #Job
- --PRINT 'DROP #Job ' + CONVERT(VARCHAR(30), GETDATE(), 121)
- COMMIT
- --GOTO GetRecordSet
- GetRecordSet:
- BEGIN
- ----返回查询数量
- SELECT ValidJobNumber FROM SearchDB..paSearchCondition WITH(NOLOCK) WHERE ID=@paSearchConditionID
- UPDATE SearchDB..paSearchCondition SET ReuseNumber = ReuseNumber + 1 WHERE ID=@paSearchConditionID
- ----返回20行查询结果
- IF (@TableID = 0)
- BEGIN
- SELECT @MinId = MIN(ID)FROM SearchDB..paSearchJobID_0 WITH(NOLOCK) WHERE paSearchConditionID=@paSearchConditionID
- SET @MinId = @MinId+(@PageNumber-1)*@PageSize
- SELECT top 50 a.ID,a.cpMainID,a.caMainID,a.Name as JobName,a.dcJobTypeID,
- a.dcJobTypeIDMinor,a.NeedNumber,a.dcSalaryID, a.dcSalaryIDMax, a.EmployType,
- a.dcRegionID,a.Responsibility,a.Demand,a.dcEducationID,
- a.MinExperience,a.MinAge,a.MaxAge,a.IssueDate,a.IssueEND,
- a.IsDelete,a.AddDate,a.RefreshDate,
- a.LastModifyDate,b.Name as cpName, b.dcCompanySizeID,
- b.HasLicence,b.UnLimitedDate,b.BalanceDate,b.Balance,
- b.MemberType, a.SecondId EnJobID, b.SecondId EnCpMainID,a.Welfare1,a.Welfare2,a.Welfare3,
- a.Welfare4,a.Welfare5,a.Welfare6,a.Welfare7,a.Welfare8,
- a.Welfare9,a.Welfare10,a.Welfare11,a.Welfare12,a.Welfare13,
- a.Welfare14,a.Welfare15,a.Welfare16,a.Welfare17,a.Welfare18,a.Welfare19,
- dbo.GetCaOnlineStatus(a.caMainID) IsOnline, CASE WHEN b.ReplyRate >= 0.6 THEN b.ReplyRate ELSE NULL END Replyrate, b.RealName
- FROM JobPublish a WITH(NOLOCK),cpMainPublish b WITH(NOLOCK),SearchDB..paSearchJobID_0 c WITH(NOLOCK)
- WHERE a.cpMainID = b.ID and a.id=c.JobID and c.paSearchConditionID=@paSearchConditionID
- AND c.ID>=@MinId ORDER BY c.ID,a.ID DESC
- END
- ELSE IF (@TableID = 1)
- BEGIN
- SELECT @MinId = MIN(ID)FROM SearchDB..paSearchJobID_1 WITH(NOLOCK) WHERE paSearchConditionID=@paSearchConditionID
- SET @MinId = @MinId+(@PageNumber-1)*@PageSize
- SELECT top 50 a.ID,a.cpMainID,a.caMainID,a.Name as JobName,a.dcJobTypeID,
- a.dcJobTypeIDMinor,a.NeedNumber,a.dcSalaryID, a.dcSalaryIDMax, a.EmployType,
- a.dcRegionID,a.Responsibility,a.Demand,a.dcEducationID,
- a.MinExperience,a.MinAge,a.MaxAge,a.IssueDate,a.IssueEND,
- a.IsDelete, a.AddDate,a.RefreshDate,
- a.LastModifyDate,b.Name as cpName,b.dcCompanySizeID,
- b.HasLicence,b.UnLimitedDate,b.BalanceDate,b.Balance,
- b.MemberType, a.SecondId EnJobID, b.SecondId EnCpMainID,a.Welfare1,a.Welfare2,a.Welfare3,
- a.Welfare4,a.Welfare5,a.Welfare6,a.Welfare7,a.Welfare8,
- a.Welfare9,a.Welfare10,a.Welfare11,a.Welfare12,a.Welfare13,
- a.Welfare14,a.Welfare15,a.Welfare16,a.Welfare17,a.Welfare18,a.Welfare19,
- dbo.GetCaOnlineStatus(a.caMainID) IsOnline, CASE WHEN b.ReplyRate >= 0.6 THEN b.ReplyRate ELSE NULL END Replyrate, b.RealName
- FROM JobPublish a WITH(NOLOCK),cpMainPublish b WITH(NOLOCK),SearchDB..paSearchJobID_1 c WITH(NOLOCK)
- WHERE a.cpMainID = b.ID and a.id=c.JobID and c.paSearchConditionID=@paSearchConditionID
- AND c.ID>=@MinId ORDER BY c.ID,a.ID DESC
- END
- ELSE IF (@TableID = 2)
- BEGIN
- SELECT @MinId = MIN(ID)FROM SearchDB..paSearchJobID_2 WITH(NOLOCK) WHERE paSearchConditionID=@paSearchConditionID
- SET @MinId = @MinId+(@PageNumber-1)*@PageSize
- SELECT top 50 a.ID,a.cpMainID,a.caMainID,a.Name as JobName,a.dcJobTypeID,
- a.dcJobTypeIDMinor,a.NeedNumber,a.dcSalaryID, a.dcSalaryIDMax, a.EmployType,
- a.dcRegionID,a.Responsibility,a.Demand,a.dcEducationID,
- a.MinExperience,a.MinAge,a.MaxAge,a.IssueDate,a.IssueEND,
- a.IsDelete, a.AddDate,a.RefreshDate,
- a.LastModifyDate,b.Name as cpName,b.dcCompanySizeID,
- b.HasLicence,b.UnLimitedDate,b.BalanceDate,b.Balance,
- b.MemberType, a.SecondId EnJobID, b.SecondId EnCpMainID,a.Welfare1,a.Welfare2,a.Welfare3,
- a.Welfare4,a.Welfare5,a.Welfare6,a.Welfare7,a.Welfare8,
- a.Welfare9,a.Welfare10,a.Welfare11,a.Welfare12,a.Welfare13,
- a.Welfare14,a.Welfare15,a.Welfare16,a.Welfare17,a.Welfare18,a.Welfare19,
- dbo.GetCaOnlineStatus(a.caMainID) IsOnline, CASE WHEN b.ReplyRate >= 0.6 THEN b.ReplyRate ELSE NULL END Replyrate, b.RealName
- FROM JobPublish a WITH(NOLOCK),cpMainPublish b WITH(NOLOCK),SearchDB..paSearchJobID_2 c WITH(NOLOCK)
- WHERE a.cpMainID = b.ID and a.id=c.JobID and c.paSearchConditionID=@paSearchConditionID
- AND c.ID>=@MinId ORDER BY c.ID,a.ID DESC
- END
- ELSE IF (@TableID = 3)
- BEGIN
- SELECT @MinId = MIN(ID)FROM SearchDB..paSearchJobID_3 WITH(NOLOCK) WHERE paSearchConditionID=@paSearchConditionID
- SET @MinId = @MinId+(@PageNumber-1)*@PageSize
- SELECT top 50 a.ID,a.cpMainID,a.caMainID,a.Name as JobName,a.dcJobTypeID,
- a.dcJobTypeIDMinor,a.NeedNumber,a.dcSalaryID, a.dcSalaryIDMax, a.EmployType,
- a.dcRegionID,a.Responsibility,a.Demand,a.dcEducationID,
- a.MinExperience,a.MinAge,a.MaxAge,a.IssueDate,a.IssueEND,
- a.IsDelete, a.AddDate,a.RefreshDate,
- a.LastModifyDate,b.Name as cpName,b.dcCompanySizeID,
- b.HasLicence,b.UnLimitedDate,b.BalanceDate,b.Balance,
- b.MemberType, a.SecondId EnJobID, b.SecondId EnCpMainID,a.Welfare1,a.Welfare2,a.Welfare3,
- a.Welfare4,a.Welfare5,a.Welfare6,a.Welfare7,a.Welfare8,
- a.Welfare9,a.Welfare10,a.Welfare11,a.Welfare12,a.Welfare13,
- a.Welfare14,a.Welfare15,a.Welfare16,a.Welfare17,a.Welfare18,a.Welfare19,
- dbo.GetCaOnlineStatus(a.caMainID) IsOnline, CASE WHEN b.ReplyRate >= 0.6 THEN b.ReplyRate ELSE NULL END Replyrate, b.RealName
- FROM JobPublish a WITH(NOLOCK),cpMainPublish b WITH(NOLOCK),SearchDB..paSearchJobID_3 c WITH(NOLOCK)
- WHERE a.cpMainID = b.ID and a.id=c.JobID and c.paSearchConditionID=@paSearchConditionID
- AND c.ID>=@MinId ORDER BY c.ID,a.ID DESC
- END
- --RICHARD 2011-7-23 16:51分修改
- ----返回统计数量
- IF @Type=1
- IF (@TableID = 0)
- BEGIN
- SELECT * FROM SearchDB..paSearchCount_0 WITH(NOLOCK) WHERE Title = 'JobType' AND paSearchConditionID=@paSearchConditionID ORDER BY Title, CONVERT(VARCHAR(10), TitleID)
- SELECT * FROM SearchDB..paSearchCount_0 WITH(NOLOCK) WHERE Title = 'Region' AND paSearchConditionID=@paSearchConditionID ORDER BY Title, CONVERT(VARCHAR(10), TitleID)
- SELECT * FROM SearchDB..paSearchCount_0 WITH(NOLOCK) WHERE Title = 'Education' AND paSearchConditionID=@paSearchConditionID ORDER BY Title, CONVERT(INT, TitleID)
- SELECT * FROM SearchDB..paSearchCount_0 WITH(NOLOCK) WHERE Title = 'Experience' AND paSearchConditionID=@paSearchConditionID ORDER BY Title, CONVERT(INT, TitleID)
- SELECT * FROM SearchDB..paSearchCount_0 WITH(NOLOCK) WHERE Title = 'Salary' AND paSearchConditionID=@paSearchConditionID ORDER BY Title, CONVERT(INT, TitleID)
- SELECT * FROM SearchDB..paSearchCount_0 WITH(NOLOCK) WHERE Title = 'EmployType' AND paSearchConditionID=@paSearchConditionID ORDER BY Title, CONVERT(INT, TitleID)
- SELECT * FROM SearchDB..paSearchCount_0 WITH(NOLOCK) WHERE Title = 'CompanySize' AND paSearchConditionID=@paSearchConditionID ORDER BY Title, CONVERT(INT, TitleID)
- END
- IF (@TableID = 1)
- BEGIN
- SELECT * FROM SearchDB..paSearchCount_1 WITH(NOLOCK) WHERE Title = 'JobType' AND paSearchConditionID=@paSearchConditionID ORDER BY Title, CONVERT(VARCHAR(10), TitleID)
- SELECT * FROM SearchDB..paSearchCount_1 WITH(NOLOCK) WHERE Title = 'Region' AND paSearchConditionID=@paSearchConditionID ORDER BY Title, CONVERT(VARCHAR(10), TitleID)
- SELECT * FROM SearchDB..paSearchCount_1 WITH(NOLOCK) WHERE Title = 'Education' AND paSearchConditionID=@paSearchConditionID ORDER BY Title, CONVERT(INT, TitleID)
- SELECT * FROM SearchDB..paSearchCount_1 WITH(NOLOCK) WHERE Title = 'Experience' AND paSearchConditionID=@paSearchConditionID ORDER BY Title, CONVERT(INT, TitleID)
- SELECT * FROM SearchDB..paSearchCount_1 WITH(NOLOCK) WHERE Title = 'Salary' AND paSearchConditionID=@paSearchConditionID ORDER BY Title, CONVERT(INT, TitleID)
- SELECT * FROM SearchDB..paSearchCount_1 WITH(NOLOCK) WHERE Title = 'EmployType' AND paSearchConditionID=@paSearchConditionID ORDER BY Title, CONVERT(INT, TitleID)
- SELECT * FROM SearchDB..paSearchCount_1 WITH(NOLOCK) WHERE Title = 'CompanySize' AND paSearchConditionID=@paSearchConditionID ORDER BY Title, CONVERT(INT, TitleID)
- END
- IF (@TableID = 2)
- BEGIN
- SELECT * FROM SearchDB..paSearchCount_2 WITH(NOLOCK) WHERE Title = 'JobType' AND paSearchConditionID=@paSearchConditionID ORDER BY Title, CONVERT(VARCHAR(10), TitleID)
- SELECT * FROM SearchDB..paSearchCount_2 WITH(NOLOCK) WHERE Title = 'Region' AND paSearchConditionID=@paSearchConditionID ORDER BY Title, CONVERT(VARCHAR(10), TitleID)
- SELECT * FROM SearchDB..paSearchCount_2 WITH(NOLOCK) WHERE Title = 'Education' AND paSearchConditionID=@paSearchConditionID ORDER BY Title, CONVERT(INT, TitleID)
- SELECT * FROM SearchDB..paSearchCount_2 WITH(NOLOCK) WHERE Title = 'Experience' AND paSearchConditionID=@paSearchConditionID ORDER BY Title, CONVERT(INT, TitleID)
- SELECT * FROM SearchDB..paSearchCount_2 WITH(NOLOCK) WHERE Title = 'Salary' AND paSearchConditionID=@paSearchConditionID ORDER BY Title, CONVERT(INT, TitleID)
- SELECT * FROM SearchDB..paSearchCount_2 WITH(NOLOCK) WHERE Title = 'EmployType' AND paSearchConditionID=@paSearchConditionID ORDER BY Title, CONVERT(INT, TitleID)
- SELECT * FROM SearchDB..paSearchCount_2 WITH(NOLOCK) WHERE Title = 'CompanySize' AND paSearchConditionID=@paSearchConditionID ORDER BY Title, CONVERT(INT, TitleID)
- END
- IF (@TableID = 3)
- BEGIN
- SELECT * FROM SearchDB..paSearchCount_3 WITH(NOLOCK) WHERE Title = 'JobType' AND paSearchConditionID=@paSearchConditionID ORDER BY Title, CONVERT(VARCHAR(10), TitleID)
- SELECT * FROM SearchDB..paSearchCount_3 WITH(NOLOCK) WHERE Title = 'Region' AND paSearchConditionID=@paSearchConditionID ORDER BY Title, CONVERT(VARCHAR(10), TitleID)
- SELECT * FROM SearchDB..paSearchCount_3 WITH(NOLOCK) WHERE Title = 'Education' AND paSearchConditionID=@paSearchConditionID ORDER BY Title, CONVERT(INT, TitleID)
- SELECT * FROM SearchDB..paSearchCount_3 WITH(NOLOCK) WHERE Title = 'Experience' AND paSearchConditionID=@paSearchConditionID ORDER BY Title, CONVERT(INT, TitleID)
- SELECT * FROM SearchDB..paSearchCount_3 WITH(NOLOCK) WHERE Title = 'Salary' AND paSearchConditionID=@paSearchConditionID ORDER BY Title, CONVERT(INT, TitleID)
- SELECT * FROM SearchDB..paSearchCount_3 WITH(NOLOCK) WHERE Title = 'EmployType' AND paSearchConditionID=@paSearchConditionID ORDER BY Title, CONVERT(INT, TitleID)
- SELECT * FROM SearchDB..paSearchCount_3 WITH(NOLOCK) WHERE Title = 'CompanySize' AND paSearchConditionID=@paSearchConditionID ORDER BY Title, CONVERT(INT, TitleID)
- END
- RETURN
- END
- END TRY
- BEGIN CATCH
- ---检查是否已经建立临时表,已经建立则删除
- DECLARE @para VARCHAR(MAX)
- SET @para = '@dcJobTypeID=' + ISNULL(@dcJobTypeID, '') + '|' +
- '@dcRegionID=' + ISNULL(@dcRegionID, '') + '|' +
- '@dcIndustryID=' + ISNULL(@dcIndustryID, '') + '|' +
- '@EmployType=' + ISNULL(@EmployType, '') + '|' +
- '@KeyWord=' + ISNULL(@KeyWord, '') + '|' +
- '@ORDER=' + ISNULL(@ORDER, '') + '|' +
- '@SessionID=' + ISNULL(@SessionID, '')
- INSERT INTO ErrorLog
- SELECT 'p2 ' +ISNULL(error_Message(), ' no msg')+ ' para=' + ISNULL(@Para, 'no para ') + ISNULL(@SQL, ' no sql'), error_number(), error_line(), GETDATE()
- END CATCH
- GO
- /****** Object: StoredProcedure [dbo].[pcJobIntentionSave] Script Date: 2018/12/13 19:08:42 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- -- = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
- -- 检查: Sean
- -- 日期: 2010-9-29
- -- 描述: 保存求职意向 执行pcCvMainByCvLevelUpdate,取消中英文判断
- -- 修改:Lambo,2010-11-25
- -- 描述:增加了paMainID参数,判断是否是本人的
- -- = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
- CREATE PROCEDURE [dbo].[pcJobIntentionSave]
- (
- @cvMainID INT,
- @RelatedWorkYears TINYINT,
- @EmployType TINYINT,
- @dcSalaryID TINYINT,
- @IsNegotiable TINYINT,
- @JobType VARCHAR(100),
- @JobPlace VARCHAR(100),
- @Industry VARCHAR(100),
- @paMainID INT
- )
- AS
- SET NOCOUNT ON
- BEGIN
- IF @cvMainID IS NULL
- RETURN 0
- IF @paMainID IS NULL
- RETURN 0
- IF @RelatedWorkYears IS NULL
- RETURN 0
- IF @EmployType IS NULL
- RETURN 0
- IF @dcSalaryID IS NULL
- RETURN 0
- IF @JobType IS NULL
- RETURN 0
- IF @JobPlace IS NULL
- RETURN 0
- IF NOT EXISTS(SELECT 'x' FROM cvMain WITH(NOLOCK) WHERE ID = @cvMainID AND paMainID = @paMainID)
- RETURN 0
- DECLARE @i INT, @Name AS VARCHAR(100), @JobType1 AS VARCHAR(10), @JobPlace1 AS VARCHAR(10)
-
- DELETE FROM cvJobType WHERE cvMainID = @cvMainID
- SET @i = CHARINDEX(' ', @JobType)
- WHILE @i >= 1
- BEGIN
- IF LEFT(@JobType, @i-1) > ''
- BEGIN
- INSERT cvJobType(cvMainID, dcJobTypeID) VALUES(@cvMainID, LEFT(@JobType, @i-1))
- IF @JobType1 IS NULL
- SET @JobType1 = LEFT(@JobType, @i-1)
- END
- SET @JobType = SUBSTRING(@JobType, @i+1, LEN(@JobType)-@i)
- SET @i = CHARINDEX(' ', @JobType)
- END
- IF @JobType > ''
- BEGIN
- INSERT cvJobType(cvMainID, dcJobTypeID) VALUES(@cvMainID, @JobType)
- IF @JobType1 IS NULL
- SET @JobType1 = @JobType
- END
- DELETE FROM cvJobPlace WHERE cvMainID = @cvMainID
- SET @i = CHARINDEX(' ', @JobPlace)
- WHILE @i >= 1
- BEGIN
- IF LEFT(@JobPlace, @i-1) > ''
- BEGIN
- INSERT cvJobPlace(cvMainID, dcRegionID) VALUES(@cvMainID, LEFT(@JobPlace, @i-1))
- IF @JobPlace1 IS NULL
- SET @JobPlace1 = LEFT(@JobPlace, @i-1)
- END
- SET @JobPlace = SUBSTRING(@JobPlace, @i+1, LEN(@JobPlace)-@i)
- SET @i = CHARINDEX(' ', @JobPlace)
- END
- IF @JobPlace > ''
- BEGIN
- INSERT cvJobPlace(cvMainID, dcRegionID) VALUES(@cvMainID, @JobPlace)
- IF @JobPlace1 IS NULL
- SET @JobPlace1 = @JobPlace
- END
- DELETE FROM cvIndustry WHERE cvMainID = @cvMainID
- SET @i = CHARINDEX(' ', @Industry)
- WHILE @i >= 1
- BEGIN
- IF LEFT(@Industry, @i-1) > ''
- INSERT cvIndustry(cvMainID, dcIndustryID) VALUES(@cvMainID, LEFT(@Industry, @i-1))
- SET @Industry = SUBSTRING(@Industry, @i+1, LEN(@Industry)-@i)
- SET @i = CHARINDEX(' ', @Industry)
- END
- IF @Industry > ''
- INSERT cvIndustry(cvMainID, dcIndustryID) VALUES(@cvMainID, @Industry)
- SELECT @Name = Name FROM cvMain WITH(NOLOCK) WHERE ID = @cvMainID
- IF(ISNULL(@Name, '未完成简历') = '未完成简历')
- BEGIN
- SELECT @Name = Description FROM dcRegion WITH(NOLOCK) WHERE ID = @JobPlace1
- SELECT @Name = @Name + '+' + Description FROM dcJobType WITH(NOLOCK) WHERE ID = @JobType1
-
- IF (@RelatedWorkYears = 0 AND NOT EXISTS(SELECT 'x' FROM cvExperience WITH(NOLOCK) WHERE cvMainId = @cvMainId))
- BEGIN
- UPDATE cvMain SET Name = @Name,
- RelatedWorkYears = @RelatedWorkYears,
- EmployType = @EmployType,
- dcSalaryID = @dcSalaryID,
- IsNegotiable = @IsNegotiable,
- cvType = 1
- WHERE ID = @cvMainID
- DECLARE @EXECSQL AS VARCHAR(100)
- SET @EXECSQL = 'EXEC pcCvMainByCvLevelUpdateNew 0, ' + LTRIM(STR(@cvMainID)) + ', 4, 1'
- EXEC(@EXECSQL)
- SET @EXECSQL = 'EXEC pcCvMainByCvLevelUpdateNew 1, ' + LTRIM(STR(@cvMainID)) + ', 4, 1'
- EXEC(@EXECSQL)
- END
- ELSE
- UPDATE cvMain SET Name = @Name,
- RelatedWorkYears = @RelatedWorkYears,
- EmployType = @EmployType,
- dcSalaryID = @dcSalaryID,
- IsNegotiable = @IsNegotiable
- WHERE ID = @cvMainID
- END
- ELSE
- BEGIN
- UPDATE cvMain SET RelatedWorkYears = @RelatedWorkYears,
- EmployType = @EmployType,
- dcSalaryID = @dcSalaryID, IsNegotiable = @IsNegotiable
- WHERE ID = @cvMainID
- END
- DECLARE @SQL AS VARCHAR(100)
- SET @SQL = 'EXEC pcCvMainByCvLevelUpdateNew 0, ' + LTRIM(STR(@cvMainID)) + ', 6, 1'
- EXEC(@SQL)
- SET @SQL = 'EXEC pcCvMainByCvLevelUpdateNew 1, ' + LTRIM(STR(@cvMainID)) + ', 6, 1'
- EXEC(@SQL)
- RETURN 1
- END
-
-
- GO
- /****** Object: StoredProcedure [dbo].[pcJobSelect] Script Date: 2018/12/13 19:08:43 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- CREATE PROCEDURE [dbo].[pcJobSelect]
- @ID INT
- AS
- BEGIN
- SELECT *
- FROM Job WITH(NOLOCK)
- WHERE ID = @ID And Valid = 1
- END
- GO
- /****** Object: StoredProcedure [dbo].[pcMapPlaceSelectByRegionID] Script Date: 2018/12/13 19:08:43 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- CREATE PROCEDURE [dbo].[pcMapPlaceSelectByRegionID]
- (
- @dcRegionID VARCHAR(6)
- )
- AS
- BEGIN
- IF LEN(@dcRegionID) = 6
- BEGIN
- IF EXISTS(SELECT TOP 1 'X' FROM dcMapPlace WHERE dcRegionID = @dcRegionID)
- SELECT * FROM dcMapPlace WHERE dcRegionID = @dcRegionID ORDER BY OrderNo
- ELSE
- SELECT * FROM dcMapPlace WHERE dcRegionID = LEFT(@dcRegionID,4) ORDER BY OrderNo
- END
- ELSE IF LEN(@dcRegionID) = 4
- BEGIN
- IF EXISTS(SELECT TOP 1 'X' FROM dcMapPlace WHERE dcRegionID = @dcRegionID)
- SELECT * FROM dcMapPlace WHERE dcRegionID = @dcRegionID ORDER BY OrderNo
- ELSE IF EXISTS(SELECT TOP 1 'X' FROM dcMapPlace WHERE dcRegionID LIKE @dcRegionID + '%' AND IsHot = 1)
- SELECT * FROM dcMapPlace WHERE dcRegionID LIKE @dcRegionID + '%' AND IsHot = 1
- ELSE
- SELECT * FROM dcMapPlace WHERE dcRegionID = LEFT(@dcRegionID,2) ORDER BY OrderNo
- END
- ELSE
- BEGIN
- IF EXISTS(SELECT TOP 1 'X' FROM dcMapPlace WHERE dcRegionID = @dcRegionID)
- SELECT * FROM dcMapPlace WHERE dcRegionID = @dcRegionID ORDER BY OrderNo
- ELSE
- SELECT * FROM dcMapPlace WHERE dcRegionID LIKE @dcRegionID + '%' AND LEN(dcRegionID) = 4 AND IsHot = 1
- END
- END
- GO
- /****** Object: StoredProcedure [dbo].[pcNewsListByPhone] Script Date: 2018/12/13 19:08:43 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- CREATE PROCEDURE [dbo].[pcNewsListByPhone]
- (
- @dcProvinceID AS SMALLINT,
- @PageNum AS INT,
- @PageSize AS INT
- )
- AS
- BEGIN
- DECLARE @COUNT INT
- SELECT @COUNT=COUNT(1)
- FROM QlrcNews WITH(NOLOCK) WHERE (
- EXISTS(SELECT 'x' FROM fnSplit(DetailType,',') b,dcNewsType c WITH(NOLOCK) WHERE b.a=c.ID AND c.Category=1) OR DetailType IS NULL)
- AND (VersionID=@dcProvinceID OR VersionID=0) AND NewsType = 2 AND DetailType NOT LIKE '%,2,%'
- IF @COUNT > 200
- SET @COUNT = 200
- SELECT *,@COUNT AS cnt FROM(
- SELECT TOP 200 ROW_NUMBER() OVER(ORDER BY RefreshDate DESC) AS Rows,ID,Title,RefreshDate,Author
- FROM QlrcNews WITH(NOLOCK) WHERE (
- EXISTS(SELECT 'x' FROM fnSplit(DetailType,',') b,dcNewsType c WITH(NOLOCK) WHERE b.a=c.ID AND c.Category=1) OR DetailType IS NULL)
- AND (VersionID=@dcProvinceID OR VersionID=0) AND NewsType = 2 AND DetailType NOT LIKE '%,2,%'
- ) AS a
- WHERE a.Rows BETWEEN (@PageNum-1)*@PageSize+1 AND @PageNum*@PageSize ORDER BY Rows
- END
- GO
- /****** Object: StoredProcedure [dbo].[pcNoViewViPlanInviteByPaMainIDSelect] Script Date: 2018/12/13 19:08:43 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- --#####################################################
- --创建时间:2014.10.30
- --创建人:John
- --说明:个人获取没有查看过的面试邀请
- --#####################################################
- CREATE PROCEDURE [dbo].[pcNoViewViPlanInviteByPaMainIDSelect]
- (
- @paMainID INT
- )
- AS
- BEGIN
- SELECT a.*,b.interviewdate,c.Name JobName ,ISNULL(c.SecondId,c.id) jobSecondId,d.Name CompanyName,ISNULL(d.SecondId ,d.id) cpMainID,e.Name caName
- FROM viplaninvitelog a,viplan b,job c ,cpMain d ,caMain e
- WHERE c.caMainID=e.id
- AND a.viplanid=b.id
- AND a.jobid=c.id
- AND c.cpMainid=d.id
- AND addtype=1
- AND viewdate IS NULL
- AND cvMainID IN ( SELECT id FROM cvMain WHERE pamainid = @paMainID )
- END
- GO
- /****** Object: StoredProcedure [dbo].[pcNoViewViRoomInviteByPaMainIDSelect] Script Date: 2018/12/13 19:08:44 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- --#####################################################
- --创建时间:2014.10.30
- --创建人:John
- --说明:个人获取没有查看过的面试室邀请
- --#####################################################
- CREATE PROCEDURE [dbo].[pcNoViewViRoomInviteByPaMainIDSelect]
- (
- @paMainID INT
- )
- AS
- BEGIN
- SELECT TOP 1 a.*,b.BeginDate interviewdate,c.Name JobName ,ISNULL(c.SecondId,c.id) jobSecondId,d.Name CompanyName,ISNULL(d.SecondId ,d.id) cpMainID,e.Name caName
- FROM viinterviewrecord a,viroom b,job c ,cpMain d,caMain e
- WHERE c.camainid = e.id
- AND a.viroomid = b.id
- AND a.jobid = c.id
- AND c.cpMainid = d.id
- AND Applytype = 1
- AND b.enddate IS NULL
- AND a.viewdate IS NULL
- AND cvMainID IN ( SELECT id FROM cvMain WHERE pamainid = @paMainID )
- END
- GO
- /****** Object: StoredProcedure [dbo].[pcNoViewViRoomInviteReplyByPaMainIDSelect] Script Date: 2018/12/13 19:08:44 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- --#####################################################
- --创建时间:2014.10.30
- --创建人:John
- --说明:个人获取没有查看过的面试室邀请回复
- --#####################################################
- CREATE PROCEDURE [dbo].[pcNoViewViRoomInviteReplyByPaMainIDSelect]
- (
- @paMainID INT
- )
- AS
- BEGIN
- SELECT TOP 1 a.*,b.BeginDate interviewdate,c.Name JobName ,ISNULL(c.SecondId,c.id) jobSecondId,d.Name CompanyName,ISNULL(d.SecondId ,d.id) cpMainID,e.Name caName
- FROM viinterviewrecord a,viroom b,job c ,cpMain d,caMain e
- WHERE c.camainid = e.id
- AND a.viroomid = b.id
- AND a.jobid = c.id
- AND c.cpMainid = d.id
- AND Applytype = 0
- AND b.enddate IS NULL
- AND a.ReplyDate IS NOT NULL
- AND a.ReplyViewDate IS NULL
- AND cvMainID IN ( SELECT id FROM cvMain WHERE pamainid = @paMainID )
- END
- GO
- /****** Object: StoredProcedure [dbo].[pcNVCaMainByexMessageC2PPaMainIdSelect] Script Date: 2018/12/13 19:08:44 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- CREATE PROCEDURE [dbo].[pcNVCaMainByexMessageC2PPaMainIdSelect]
- (
- @paMainID INT,
- @Where VARCHAR(100)
- )
- AS
- BEGIN
- DECLARE @SQL AS VARCHAR(MAX)
- SET @SQL = '
- SELECT a.caMainID,b.Name,b.Gender,b.Dept,b.Telephone,b.Mobile,b.IsPhoneHide,
- b.IsNameHide,b.IsMobileHide,c.Name CompanyName,c.ID cpMainID, c.SecondId EnCpMainID FROM
- (
- SELECT caMainID,AddDate,ROW_NUMBER() OVER(PARTITION BY caMainID ORDER BY AddDate DESC) RowNumber FROM
- (
- SELECT caMainID,ID,addDate,Message,1 IsCompany,IsViewed FROM exMessageC2p WITH(NOLOCK)
- WHERE cvMainID IN(SELECT ID FROM cvMain WITH(NOLOCK) WHERE paMainID='+CONVERT(VARCHAR,@paMainID)+'
- ) AND PersonDeleted=0
- UNION
- SELECT caMainID,ID,addDate,Message,0 IsCompany,1 FROM exMessageP2C WITH(NOLOCK) WHERE cvMainID IN
- (
- SELECT ID FROM cvMain WITH(NOLOCK) WHERE paMainID='+CONVERT(VARCHAR,@paMainID)+') AND PersonDeleted=0
- ) t
- ) a,caMain b WITH(NOLOCK),cpMain c WITH(NOLOCK)
- WHERE a.RowNumber=1 AND a.caMainID=b.ID AND b.cpMainID=c.ID'
- IF LEN(@Where) > 0
- BEGIN
- SET @Where = dbo.SafeSql(@Where)
- SET @SQL = @SQL + @Where
- END
- SET @SQL = @SQL + ' ORDER BY AddDate DESC'
- EXEC(@SQL)
- END
- GO
- /****** Object: StoredProcedure [dbo].[pcNVexMessageLogSelect] Script Date: 2018/12/13 19:08:44 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- --==================================
- --添加人:Lucifer(个人会员中心改版)
- --添加时间:2013-7-19
- --==================================
- CREATE PROCEDURE [dbo].[pcNVexMessageLogSelect]
- (
- @paMainID INT,
- @caMainID INT
- )
- AS
- BEGIN
- SELECT * FROM (
- SELECT cvMainID,ID,addDate,Message,1 IsCompany,IsViewed FROM exMessageC2p WITH(NOLOCK)
- WHERE cvMainID IN(SELECT ID FROM cvMain WITH(NOLOCK) WHERE paMainID=@paMainID) AND caMainID=@caMainID
- AND PersonDeleted=0
- UNION
- SELECT cvMainID,ID,addDate,Message,0 IsCompany,1 FROM exMessageP2C WITH(NOLOCK)
- WHERE cvMainID IN(SELECT ID FROM cvMain WITH(NOLOCK) WHERE paMainID=@paMainID) AND caMainID=@caMainID
- AND PersonDeleted=0
- ) a ORDER BY a.AddDate
- END
- GO
- /****** Object: StoredProcedure [dbo].[pcNVexMessageP2CByReplyInsert] Script Date: 2018/12/13 19:08:44 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- --================================
- --添加人:Lucifer(个人会员中心改版)
- --添加时间:2013-7-19
- --================================
- CREATE PROCEDURE [dbo].[pcNVexMessageP2CByReplyInsert]
- (
- @caMainID INT,
- @cvMainID INT,
- @Message VARCHAR(200),
- @paMainID INT
- )
- AS
- BEGIN
- IF EXISTS(SELECT ID FROM cvMain WITH(NOLOCK) WHERE paMainID=@paMainID AND ID=@cvMainID)
- BEGIN
- DECLARE @MaxID INT
- SET @Message = dbo.SafeSQL(LTRIM(RTRIM(@Message)))
- INSERT exMessageP2C(caMainID,cvMainID,Message) VALUES(@caMainID,@cvMainID,@Message)
- SET @MaxID = @@IDENTITY
- Update exMessageC2P Set IsReply=1 WHERE cvMainID=@cvMainID AND caMainID=@caMainID AND AddDate<GETDATE()
- RETURN @MaxID
- END
- ELSE
- RETURN 0
- END
- GO
- /****** Object: StoredProcedure [dbo].[pcNVPaMainByPaVerifySelect] Script Date: 2018/12/13 19:08:45 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- CREATE PROCEDURE [dbo].[pcNVPaMainByPaVerifySelect]
- (
- @paMainID INT,
- @Mobile VARCHAR(11),
- @Email VARCHAR(50)
- )
- AS
- SET NOCOUNT ON
- BEGIN
- DECLARE @VerifyCount SMALLINT
- IF EXISTS(SELECT 'x' FROM paVerifyLog WITH(NOLOCK) WHERE AddDate > DATEADD(Second, -150, GETDATE()) AND (paMainId = @paMainId OR Mobile = @Mobile))
- RETURN -2
- SELECT @VerifyCount=COUNT(1) FROM paVerifyLog WHERE paMainID = @paMainID AND Mobile=@Mobile AND Email=@Email AND AddDate>CONVERT(VARCHAR(10),GETDATE(),120)
- IF @VerifyCount > 4
- RETURN 0
-
- DECLARE @MobileVerifyDate SMALLDATETIME,@EmailVerifyDate SMALLDATETIME,@MobileOld VARCHAR(11)
- SELECT @MobileVerifyDate = MobileVerifyDate,@EmailVerifyDate = EmailVerifyDate,@MobileOld = ISNULL(Mobile,'')
- FROM paMain WHERE ID=@paMainID
- IF LEN(@Mobile)=0 AND ISNULL(@EmailVerifyDate,'')<>''
- RETURN -1
- IF LEN(@Email)=0 AND ISNULL(@MobileVerifyDate,'')<>'' AND @MobileOld = @Mobile
- RETURN -1
- DECLARE @VerifyCode AS VARCHAR(6)
- SELECT @VerifyCode = RAND() * 899999 + 100000
- INSERT INTO paVerifyLog(paMainID, Email, Mobile, VerifyCode, VerifyDate, AddDate)
- VALUES(@paMainID,@Email,@Mobile,@VerifyCode,NULL,GETDATE())
- RETURN @VerifyCode
- END
- GO
- /****** Object: StoredProcedure [dbo].[pcNVPaMainByVerifyUpdate] Script Date: 2018/12/13 19:08:45 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- CREATE PROCEDURE [dbo].[pcNVPaMainByVerifyUpdate]
- (
- @paMainID INT,
- @Mobile VARCHAR(11),
- @Email VARCHAR(50),
- @VerifyCode VARCHAR(6)
- )
- AS
- BEGIN
- DECLARE @MobileVerifyDate SMALLDATETIME, @EmailVerifyDate SMALLDATETIME, @MobileOld VARCHAR(11)
- SELECT @MobileVerifyDate = MobileVerifyDate, @EmailVerifyDate = EmailVerifyDate, @MobileOld = ISNULL(Mobile, '') FROM paMain WHERE ID = @paMainID
- IF LEN(@Mobile) = 0 AND ISNULL(@EmailVerifyDate, '') <> ''
- RETURN -1
- IF LEN(@Email) = 0 AND ISNULL(@MobileVerifyDate, '') <> '' AND @MobileOld = @Mobile
- RETURN -1
- DECLARE @paVerifyLogID AS INT
- SET @paVerifyLogID = 0
- SELECT @paVerifyLogID = ID FROM paVerifyLog WHERE paMainID = @paMainID AND Mobile = @Mobile AND Email = @Email
- AND VerifyCode = @VerifyCode AND AddDate>DATEADD(HOUR, -1, GETDATE())
-
- IF @paVerifyLogID = 0
- RETURN 0
-
- UPDATE paVerifyLog SET VerifyDate = GETDATE() WHERE paMainID = @paMainID AND Mobile = @Mobile AND Email = @Email
- AND VerifyCode = @VerifyCode AND AddDate>DATEADD(HOUR, -1, GETDATE())
-
- IF LEN(@Mobile) = 0
- UPDATE paMain SET EmailVerifyDate = GETDATE() WHERE ID = @paMainID
-
- IF LEN(@Email) = 0
- BEGIN
- UPDATE paMain SET Mobile = @Mobile WHERE ID = @paMainID
- --修改本手机号对应的其他帐号的认证状态
- UPDATE paMain SET MobileVerifyDate = NULL WHERE Mobile = @Mobile
- UPDATE paMain SET MobileVerifyDate = GETDATE() WHERE ID = @paMainID AND Mobile = @Mobile
- END
- RETURN 1
- END
- GO
- /****** Object: StoredProcedure [dbo].[pcPaActstatusInsert] Script Date: 2018/12/13 19:08:45 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- create PROCEDURE [dbo].[pcPaActstatusInsert]
- (
- @paMainId INT,
- @ActStatus INt
- )
- AS
- SET NOCOUNT ON
- BEGIN
- INSERT INTO ShortDb..paActStatus(paMainId, ActStatus, AddDate)
- SELECT @paMainId, @ActStatus, GETDATE()
- END
- GO
- /****** Object: StoredProcedure [dbo].[pcPaAttentionByCpMainIDSelect] Script Date: 2018/12/13 19:08:45 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- --创建时间:2015.11.09
- --创建人:nick
- --说明:企业关注详情
- --harry 增加logourl
- --#####################################################
- CREATE PROCEDURE [dbo].[pcPaAttentionByCpMainIDSelect]
- (
- @CpMainID INT,
- @AttentionDate DATETIME,
- @PaMainID INT
- )
- AS
- BEGIN
- SET NOCOUNT ON
- --行业信息
- SELECT a.CpMainiD,b.Description
- FROM CpIndustry a WITH(NOLOCK),dcIndustry b WITH(NOLOCK)
- WHERE a.CpMainiD = @CpMainID
- AND a.DcIndustryID = b.ID
-
- --职位数量
- SELECT TOP 5 a.ID,a.SecondID ,a.Name,a.AddDate,a.IssueEnd,a.IsDelete,b.FullName,c.Description AS SalaryName,a.NeedNumber,a.RefreshDate,0 AS ISApply,
- a.dcSalaryID, c.DescriptionCp Salary, d.DescriptionCp SalaryMax, e.Description Education, f.Description Experience, g.Description NeedNuberDesc, b.MapBarName Region, h.LogoFile LogoUrl
- INTO #TJob
- FROM Job a WITH(NOLOCK),DcRegion b WITH(NOLOCK),dcSalary c WITH(NOLOCK),dcSalary d WITH(NOLOCK),dcEducation e WITH(NOLOCK),dcOthers f WITH(NOLOCK),dcOthers g WITH(NOLOCK), cpMainPublish h WITH(NOLOCK)
- WHERE CpMainID = @CpMainID
- AND a.cpMainId= h.id
- AND a.DcRegionID = b.ID
- AND a.DcSalaryID = c.ID
- AND a.dcSalaryIDMax = d.ID
- AND a.dcEducationID = e.ID
- AND a.MinExperience = f.DetailID AND f.Category = '职位要求工作经验'
- AND a.NeedNumber = g.DetailID AND g.Category = '招聘人数'
- AND a.AddDate > @AttentionDate
- AND a.Valid = 1
- ORDER BY a.AddDate DESC
- UPDATE #TJob
- SET ISApply = 1
- WHERE ID IN(
- SELECT ID
- FROM exJobApply WITH(NOLOCK)
- WHERE CvMainiD in (
- SELECT ID FROM CvMain WITH(NOLOCK)
- WHERE PaMainID = @paMainID
- ) AND PersonDeleted = 0
- )
- SELECT * FROM #TJob
- --面经数量
- SELECT COUNT(*) FROM Comments WITH(NOLOCK)
- WHERE CommentType IN(1,2)
- AND CpMainID = @CpMainID
- AND AddDate > @AttentionDate
- --点评数量
- SELECT COUNT(*) FROM InterView WITH(NOLOCK)
- WHERE InterViewType IN(1,2)
- AND CpMainID = @CpMainID
- AND AddDate > @AttentionDate
- --环境照片数量
- SELECT COUNT(*) FROM cpImage WHERE cpMainID = @CpMainID AND ImgType = 3 AND AddDate > @AttentionDate AND HasPassed = 1
-
- SET NOCOUNT OFF
- END
- GO
- /****** Object: StoredProcedure [dbo].[pcPaAttentionByIDDelete] Script Date: 2018/12/13 19:08:46 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- --创建:Nick
- --创建日期:2015-11-09
- --个人中心,取消关注
- --------------------------------------------------
- CREATE PROCEDURE [dbo].[pcPaAttentionByIDDelete]
- (
- @ID VARCHAR(200),
- @PaMainID INT
- )
- AS
- BEGIN
- SET NOCOUNT ON
- DELETE FROM PaAttention WHERE ID IN (SELECT * FROM dbo.fnSplit(@ID,','))
- AND PaMainID = @PaMainID
- SET NOCOUNT OFF
- END
- GO
- /****** Object: StoredProcedure [dbo].[pcPaAttentionByPaMainIDAPPSelect] Script Date: 2018/12/13 19:08:46 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- --创建时间:2016.1.1
- --创建人:Lucifer
- --说明:个人关注详情
- --#####################################################
- CREATE PROCEDURE [dbo].[pcPaAttentionByPaMainIDAPPSelect]
- (
- @paMainID INT,
- @AttentionType INT --1.企业 2.职位
- )
- AS
- BEGIN
- SET NOCOUNT ON
- IF @AttentionType=1 --企业
- BEGIN
- SELECT a.PaMainID,a.ID,a.AddDate,b.ID AS CpMainID,b.SecondID CpSecondID,b.Name,b.DcCompanyKindID,
- c.Description AS DcCompanyKindName,d.Description AS CompanySizeName,a.AddDate AS SortDate,
- (SELECT COUNT(1) FROM Comments e WHERE e.cpMainID = b.ID AND e.CommentType IN(1,2) AND e.AddDate > a.AddDate) commentCount,
- (SELECT COUNT(1) FROM Interview f WHERE f.cpMainID = b.ID AND f.InterviewType IN(1,2) AND f.AddDate > a.AddDate) interviewCount,
- (SELECT COUNT(1) FROM cpImage g WHERE g.cpMainID = b.ID AND g.ImgType = 3 AND g.HasPassed = 1 AND g.AddDate > a.AddDate) environmentCount
- INTO #tcp
- FROM PaAttention a WITH(NOLOCK), CpMain b WITH(NOLOCK),DcCompanyKind c WITH(NOLOCK),dcCompanySize d WITH(NOLOCK)
- WHERE a.AttentionType=1
- AND a.AttentionID = b.ID
- AND a.PaMainID = @paMainID
- AND b.DcCompanyKindID = C.ID
- AND b.DcCompanySizeID = d.ID
- AND b.IsDelete = 0
- ORDER BY a.AddDate DESC
- --企业职位最近更新时间
- UPDATE d SET d.SortDate = c.JobAddDate
- FROM #tcp d,
- (SELECT a.CpMainID, MAX(a.LastModifyDate) AS JobAddDate
- FROM Job a WITH(NOLOCK)
- WHERE a.CpMainID IN (SELECT CpMainID FROM #tcp)
- GROUP BY a.CpMainID) c
- WHERE d.CpMainID = c.CpMainID AND d.SortDate < c.JobAddDate
- --企业点评、面经最近更新时间
- UPDATE d SET d.SortDate = c.PreachAddDate
- FROM #tcp d,
- (SELECT a.CpMainID, MAX(a.AddDate) AS PreachAddDate
- FROM Comments a WITH(NOLOCK)
- WHERE a.CpMainID IN (SELECT CpMainID FROM #tcp)
- AND a.CommentType IN(1,2)
- GROUP BY a.CpMainID) c
- WHERE d.CpMainID = c.CpMainID AND d.SortDate < c.PreachAddDate
- --企业点评、面经最近更新时间
- UPDATE d SET d.SortDate = c.PreachAddDate
- FROM #tcp d,
- (SELECT a.CpMainID, MAX(a.AddDate) AS PreachAddDate
- FROM InterView a WITH(NOLOCK)
- WHERE a.CpMainID IN (SELECT CpMainID FROM #tcp)
- AND a.InterViewType IN(1,2)
- GROUP BY a.CpMainID) c
- WHERE d.CpMainID = c.CpMainID AND d.SortDate < c.PreachAddDate
- SELECT * FROM #tcp ORDER BY SortDate DESC
-
- --行业信息
- SELECT a.CpMainiD,b.Description
- FROM CpIndustry a WITH(NOLOCK),dcIndustry b WITH(NOLOCK)
- WHERE a.CpMainiD IN(SELECT cpMainID FROM #tcp)
- AND a.DcIndustryID = b.ID
-
- --职位数量
- SELECT a.ID,a.cpMainID,a.SecondID ,a.Name,a.AddDate,a.IssueEnd,a.IsDelete,b.FullName,c.Description AS SalaryName,e.Description NeedNumber,a.RefreshDate,0 AS ISApply INTO #TJob
- FROM Job a WITH(NOLOCK),DcRegion b WITH(NOLOCK),dcsalary c WITH(NOLOCK),#tcp d WITH(NOLOCK),dcOthers e WITH(NOLOCK)
- WHERE a.DcRegionID = b.ID
- AND a.DcSalaryID = c.ID
- AND a.cpMainID = d.cpMainID
- AND a.AddDate > d.AddDate
- AND a.Valid = 1
- AND a.NeedNumber = e.DetailID
- AND e.Category = '招聘人数'
- ORDER BY a.AddDate DESC
- --SELECT a.ID,a.SecondID ,a.Name,a.AddDate,a.IssueEnd,a.IsDelete,b.FullName,c.Description AS SalaryName,a.NeedNumber,a.RefreshDate,0 AS ISApply INTO #TJob
- --FROM Job a WITH(NOLOCK),DcRegion b WITH(NOLOCK),dcsalary c WITH(NOLOCK),#tcp d WITH(NOLOCK)
- --WHERE a.DcRegionID = b.ID
- --AND a.DcSalaryID = c.ID
- --AND a.cpMainID = d.cpMainID
- --AND a.AddDate > d.AddDate
- --AND a.Valid = 1
- --ORDER BY a.AddDate DESC
-
- UPDATE #TJob
- SET ISApply = 1
- WHERE ID IN(
- SELECT ID
- FROM exJobApply WITH(NOLOCK)
- WHERE CvMainiD in (
- SELECT ID FROM CvMain WITH(NOLOCK)
- WHERE PaMainID = @paMainID
- )
- AND PersonDeleted = 0
- )
-
- SELECT * FROM #TJob
- END
- ELSE IF @AttentionType=2 --职位
- BEGIN
- SELECT a.PaMainID,a.ID,a.AddDate,b.ID AS JobID ,b.SecondID JobSecondID,b.Name AS JobName,c.FullName,f. Description NeedNumber,
- d.ID as CpMainiD,d.SecondID CpSecondID,d.Name AS CpName,b.IsDelete,0 AS ISApply,IssueEnd,e.Description AS SalaryName,b.RefreshDate
- INTO #TJob2
- FROM PaAttention a WITH(NOLOCK),Job b WITH(NOLOCK),DcRegion c WITH(NOLOCK),CpMain d WITH(NOLOCK),dcSalary e WITH(NOLOCK),dcOthers f WITH(NOLOCK)
- WHERE a.AttentionType=2
- AND a.AttentionID = b.ID
- AND a.PaMainID = @paMainID
- AND b.CpMainID = d.ID
- AND b.DcRegionID = c.ID
- AND b.DcSalaryID = e.ID
- AND b.NeedNumber = f.DetailID
- AND f.Category = '招聘人数'
- ORDER BY a.AddDate DESC
-
- UPDATE #TJob2 SET ISApply = 1
- WHERE JobID IN(
- SELECT JobID
- FROM exJobApply WITH(NOLOCK)
- WHERE CvMainiD in (
- SELECT ID FROM CvMain WITH(NOLOCK)
- WHERE PaMainID = @paMainID
- ) AND PersonDeleted = 0
- )
- --职位
- SELECT * FROM #TJob2
- END
- SET NOCOUNT OFF
- END
- GO
- /****** Object: StoredProcedure [dbo].[pcPaAttentionByPaMainIDSelect] Script Date: 2018/12/13 19:08:46 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- --====================================
- --返回值:获取个人关注列表
- --创建:Nick 20151109
- --====================================
- CREATE PROCEDURE [dbo].[pcPaAttentionByPaMainIDSelect]
- (
- @paMainID INT,
- @AttentionType INT --1.企业 2.职位
- )
- AS
- BEGIN
- SET NOCOUNT ON
- IF @AttentionType=1 --企业
- BEGIN
- SELECT a.PaMainID,a.ID,a.AddDate,b.ID AS CpMainID,b.SecondID CpSecondID,b.Name,b.DcCompanyKindID,
- c.Description AS DcCompanyKindName,d.Description AS CompanySizeName,a.AddDate AS SortDate, dbo.GetCpIndustry(b.ID) Industry, b.LogoFile LogoUrl INTO #tcp
- FROM PaAttention a WITH(NOLOCK), CpMain b WITH(NOLOCK),DcCompanyKind c WITH(NOLOCK),dcCompanySize d WITH(NOLOCK)
- WHERE a.AttentionType=1
- AND a.AttentionID = b.ID
- AND a.PaMainID = @paMainID
- AND b.DcCompanyKindID = C.ID
- AND b.DcCompanySizeID = d.ID
- AND b.IsDelete = 0
- ORDER BY a.AddDate DESC
- --企业职位最近更新时间
- UPDATE d SET d.SortDate = c.JobAddDate
- FROM #tcp d,
- (SELECT a.CpMainID, MAX(a.LastModifyDate) AS JobAddDate
- FROM Job a WITH(NOLOCK)
- WHERE a.CpMainID IN (SELECT CpMainID FROM #tcp)
- GROUP BY a.CpMainID) c
- WHERE d.CpMainID = c.CpMainID AND d.SortDate < c.JobAddDate
- --企业点评、面经最近更新时间
- UPDATE d SET d.SortDate = c.PreachAddDate
- FROM #tcp d,
- (SELECT a.CpMainID, MAX(a.AddDate) AS PreachAddDate
- FROM Comments a WITH(NOLOCK)
- WHERE a.CpMainID IN (SELECT CpMainID FROM #tcp)
- AND a.CommentType IN(1,2)
- GROUP BY a.CpMainID) c
- WHERE d.CpMainID = c.CpMainID AND d.SortDate < c.PreachAddDate
- --企业点评、面经最近更新时间
- UPDATE d SET d.SortDate = c.PreachAddDate
- FROM #tcp d,
- (SELECT a.CpMainID, MAX(a.AddDate) AS PreachAddDate
- FROM InterView a WITH(NOLOCK)
- WHERE a.CpMainID IN (SELECT CpMainID FROM #tcp)
- AND a.InterViewType IN(1,2)
- GROUP BY a.CpMainID) c
- WHERE d.CpMainID = c.CpMainID AND d.SortDate < c.PreachAddDate
- SELECT * FROM #tcp ORDER BY SortDate DESC
- END
- ELSE IF @AttentionType=2 --职位
- BEGIN
- SELECT a.PaMainID,a.ID,a.AddDate,b.ID AS JobID ,b.SecondID JobSecondID,b.Name AS JobName,c.FullName,b.NeedNumber,
- d.ID as CpMainiD,d.SecondID CpSecondID,d.Name AS CpName,b.IsDelete,0 AS IsApply,IssueEnd,e.Description AS SalaryName,b.RefreshDate, e.DescriptionCp SalaryMin,f.DescriptionCp SalaryMax, g.Description Experience, c.MapBarName Region, b.dcSalaryID, b.dcSalaryIDMax, b.Valid, dbo.GetCaOnlineStatus(b.caMainID) IsOnline
- INTO #TJob
- FROM PaAttention a WITH(NOLOCK),Job b WITH(NOLOCK),DcRegion c WITH(NOLOCK),CpMain d WITH(NOLOCK),dcSalary e WITH(NOLOCK),dcSalary f WITH(NOLOCK),dcOthers g WITH(NOLOCK)
- WHERE a.AttentionType=2
- AND a.AttentionID = b.ID
- AND a.PaMainID = @paMainID
- AND b.CpMainID = d.ID
- AND b.dcRegionID = c.ID
- AND b.dcSalaryID = e.ID
- AND b.dcSalaryIdMax = f.ID
- AND b.MinExperience = g.DetailID AND g.Category = '职位要求工作经验'
- ORDER BY a.AddDate DESC
- UPDATE #TJob
- SET IsApply = 1
- WHERE JobID IN(
- SELECT JobID
- FROM exJobApply WITH(NOLOCK)
- WHERE CvMainiD in (
- SELECT ID FROM CvMain WITH(NOLOCK)
- WHERE PaMainID = @paMainID
- ) AND PersonDeleted = 0
- )
- --职位
- SELECT * FROM #TJob
- END
- SET NOCOUNT OFF
- END
- GO
- /****** Object: StoredProcedure [dbo].[pcPaAttentionInsert] Script Date: 2018/12/13 19:08:47 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- --个人关注
- --20151123 nick
- CREATE PROCEDURE [dbo].[pcPaAttentionInsert]
- (
- @paMainID INT,
- @AttentionType INT,
- @AttentionID INT
- )
- AS
- BEGIN
- SET NOCOUNT ON
- IF NOT EXISTS( --判断是否已关注
- SELECT TOP 1 'x' FROM PaAttention
- WHERE PaMainID = @paMainID
- AND AttentionType = @AttentionType
- AND AttentionID = @AttentionID
- )
- BEGIN
- INSERT INTO PaAttention (paMainID,AttentionType,AttentionID,AddDate)
- VALUES(@paMainID,@AttentionType,@AttentionID,GETDATE())
-
- RETURN 1
- END
- ELSE
- BEGIN
- RETURN 0
- END
- SET NOCOUNT OFF
- END
- GO
- /****** Object: StoredProcedure [dbo].[pcPaCoverLetterByIsDefaultUpdate] Script Date: 2018/12/13 19:08:47 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- --=============================================
- -- 创建: sean
- -- 检查: 2010-10-6
- -- 说明: 求职信默认值修改 ,改名
- --=============================================
- CREATE PROCEDURE [dbo].[pcPaCoverLetterByIsDefaultUpdate]
- @paMainID INT,
- @ID INT
- AS
- BEGIN TRY
- IF NOT EXISTS(SELECT 'X' FROM paCoverLetter WITH(NOLOCK INDEX(IX_paCoverLetter_paMainID)) WHERE paMainID = @paMainID AND ID = @ID)
- RETURN 0
-
- UPDATE paCoverLetter SET IsDefault = 0 WHERE paMainID = @paMainID AND ID <> @ID
- UPDATE paCoverLetter SET IsDefault = IsDefault - 1 WHERE ID=@ID
- END TRY
- BEGIN CATCH
- GOTO ERR
- END CATCH
- RETURN 1
- ERR:
- BEGIN
- RETURN 0
- END
- GO
- /****** Object: StoredProcedure [dbo].[pcPaCoverLetterByPaMainIDSelect] Script Date: 2018/12/13 19:08:47 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- --=============================================
- -- 创建: sean
- -- 检查: 2010-10-6
- -- 说明: 求职信列表
- --=============================================
- CREATE PROCEDURE [dbo].[pcPaCoverLetterByPaMainIDSelect]
- @paMainID INT
- AS
- BEGIN TRY
- SELECT *
- FROM paCoverLetter WITH(NOLOCK INDEX(IX_paCoverLetter_paMainID))
- WHERE paMainID = @paMainID
- ORDER BY IsDefault DESC,ID DESC
- END TRY
- BEGIN CATCH
- END CATCH
- GO
- /****** Object: StoredProcedure [dbo].[pcPaCoverLetterDelete] Script Date: 2018/12/13 19:08:47 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- --=============================================
- -- 创建: sean
- -- 检查: 2010-10-6
- -- 说明: 求职信删除
- --=============================================
- CREATE PROCEDURE [dbo].[pcPaCoverLetterDelete]
- @paMainID INT,
- @ID INT
- AS
- BEGIN TRY
- IF NOT EXISTS(SELECT 'X' FROM paCoverLetter WITH(NOLOCK) WHERE paMainID = @paMainID AND ID = @ID)
- RETURN 0
-
- DELETE FROM paCoverLetter WHERE ID = @ID
- RETURN 1
-
- END TRY
- BEGIN CATCH
- RETURN 0
- END CATCH
- GO
- /****** Object: StoredProcedure [dbo].[pcPaCoverLetterMainTextByIDSelect] Script Date: 2018/12/13 19:08:47 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- --#####################################################
- --创建时间:2014.11.4
- --创建人:John
- --说明:根据ID 从 PaCoverLetter中得到MainText
- --#####################################################
- CREATE PROCEDURE [dbo].[pcPaCoverLetterMainTextByIDSelect]
- (
- @ID INT
- )
- AS
- BEGIN
- SELECT MainText FROM PaCoverLetter WHERE id = @ID
- END
- GO
- /****** Object: StoredProcedure [dbo].[pcPaCoverLetterMainTextByPaMainIDSelect] Script Date: 2018/12/13 19:08:47 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- --#####################################################
- --创建时间:2014.11.4
- --创建人:John
- --说明:从 PaCoverLetter中得到MainText
- --#####################################################
- CREATE PROCEDURE [dbo].[pcPaCoverLetterMainTextByPaMainIDSelect]
- (
- @PaMainID INT
- )
- AS
- BEGIN
- SELECT MainText FROM PaCoverLetter WHERE paMainID = @PaMainID AND IsDefault = 1
- END
- GO
- /****** Object: StoredProcedure [dbo].[pcPaCoverLetterSave] Script Date: 2018/12/13 19:08:48 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- --=============================================
- -- 创建: sean
- -- 检查: 2010-10-6
- -- 说明: 求职信保存 ,改名
- --=============================================
- CREATE PROCEDURE [dbo].[pcPaCoverLetterSave]
- (
- @ID INT,
- @paMainID INT,
- @IsDefault BIT,
- @Title NVARCHAR(20),
- @MainText NVARCHAR(2000)
- )
- AS
- SELECT @MainText = dbo.SafeSQL(dbo.TextTrim(@MainText)), @Title = dbo.SafeSQL(@Title)
- DECLARE @MaxID AS INT
- BEGIN TRY
- IF @ID>0
- BEGIN
- IF NOT EXISTS(SELECT 'x' FROM paCoverLetter WITH(NOLOCK INDEX(PK_paCoverLetter)) WHERE paMainID=@paMainID AND ID = @ID)
- GOTO Err
- UPDATE paCoverLetter
- SET Title = @Title,MainText = @MainText,AddDate=GETDATE()
- WHERE ID=@ID
- AND paMainID = @paMainID
- SET @MaxID = @ID
- END
- ELSE
- BEGIN
- IF EXISTS(SELECT 'x' FROM paCoverLetter WITH(NOLOCK INDEX(IX_paCoverLetter_paMainID)) WHERE paMainID=@paMainID)
- INSERT INTO paCoverLetter(paMainID, IsDefault, Title, MainText)
- VALUES(@paMainID, 0, @Title, @MainText)
- ELSE
- INSERT INTO paCoverLetter(paMainID, IsDefault, Title, MainText)
- VALUES(@paMainID, 1, @Title, @MainText)
-
- SET @MaxID = @@IDENTITY
- END
- END TRY
- BEGIN CATCH
- GOTO ERR
- END CATCH
- RETURN @MaxID
- ERR:
- BEGIN
- RETURN 0
- END
- GO
- /****** Object: StoredProcedure [dbo].[pcPaCoverLetterSelect] Script Date: 2018/12/13 19:08:48 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- --=============================================
- -- 创建: sean
- -- 检查: 2010-10-6
- -- 说明: 求职信新提取
- --=============================================
- CREATE PROCEDURE [dbo].[pcPaCoverLetterSelect]
- (
- @ID INT,
- @paMainID INT OUTPUT,
- @IsDefault Bit OUTPUT,
- @Title VARCHAR(40) OUTPUT,
- @MainText VARCHAR(MAX) OUTPUT,
- @AddDate DateTime OUTPUT
- )
- AS
- SELECT @paMainID=paMainID,@IsDefault=IsDefault,@Title=Title,@MainText=MainText,@AddDate=AddDate
- FROM PaCoverLetter WITH(NOLOCK)
- WHERE ID=@ID AND paMainID = @paMainID
- GO
- /****** Object: StoredProcedure [dbo].[pcpaCvImportLogByCvMainIDUpdate] Script Date: 2018/12/13 19:08:48 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- --#####################################################
- --创建时间:2014.10.31
- --创建人:Nick
- --说明:修改 paCvImportLog
- --#####################################################
- CREATE PROCEDURE [dbo].[pcpaCvImportLogByCvMainIDUpdate]
- (
- @cvMainID INT
- )
- AS
- BEGIN TRY
- UPDATE paCvImportLog SET isSuccess = 1 WHERE cvMainID=@cvMainID
- END TRY
- BEGIN CATCH
- RETURN 0
- END CATCH
- GO
- /****** Object: StoredProcedure [dbo].[pcpaCvImportLogInsert] Script Date: 2018/12/13 19:08:48 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- --#####################################################
- --创建时间:2014.10.31
- --创建人:Nick
- --说明:插入 paCvImportLog
- --#####################################################
- CREATE PROCEDURE [dbo].[pcpaCvImportLogInsert]
- (
- @cvMainID INT,
- @cvFrom VARCHAR(200)
- )
- AS
- BEGIN TRY
- INSERT INTO paCvImportLog VALUES(@cvMainID,@cvFrom,0,GETDATE())
- END TRY
- BEGIN CATCH
- RETURN 0
- END CATCH
- GO
- /****** Object: StoredProcedure [dbo].[pcPaCvMainByIDSelect] Script Date: 2018/12/13 19:08:48 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- --#####################################################
- --创建时间:2014.11.4
- --创建人:John
- --说明:根据PaMain的id获取PaMain,CvMain
- --#####################################################
- CREATE PROCEDURE [dbo].[pcPaCvMainByIDSelect]
- (
- @ID INT
- )
- AS
- BEGIN
- SELECT a.ID,a.NAME,a.UserName,a.Email,b.ID cvMainID,b.Name cvName,Adddate
- FROM paMain a WITH(NOLOCK)
- LEFT JOIN cvMain b WITH(NOLOCK) ON a.ID = b.paMainID
- WHERE a.ID = @ID
- END
- GO
- /****** Object: StoredProcedure [dbo].[pcPaCvviewCountSelect] Script Date: 2018/12/13 19:08:48 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- CREATE PROCEDURE [dbo].[pcPaCvviewCountSelect]
- (
- @paMainId INT
- )
- AS
- SET NOCOUNT ON
- BEGIN
- IF ISNULL(@paMainId, 0) = 0
- BEGIN
- SELECT 0 ViewNumber
- RETURN
- END
- DECLARE @ViewNumber INT, @Cnt INT, @AddDate DateTime
- SELECT @ViewNumber = ViewNumber, @AddDate = AddDate
- FROM paCvViewCount
- WHERE paMainId = @paMainId
- IF ISNULL(@AddDate, GETDATE() - 1) < DATEADD(MINUTE, -120, GETDATE())
- BEGIN
- SELECT @Cnt = COUNT(1)
- FROM caCvviewLog WITH(NOLOCK)
- WHERE cvMainId IN(SELECT ID FROM cvMain WITH(NOLOCK) WHERE paMainId = @paMainId)
- AND EXISTS(SELECT TOP 1 'X' FROM JobPublish WITH(NOLOCK) WHERE caMainID = caCvviewLog.caMainID)
- IF @ViewNumber IS NOT NULL
- DELETE FROM paCvViewCount WHERE paMainId = @paMainId
- INSERT INTO paCvViewCount(paMainId, ViewNumber, AddDate) SELECT @paMainId, @Cnt, GETDATE()
- SET @ViewNumber = @Cnt
- END
- SELECT @ViewNumber ViewNumber
- END
- SET NOCOUNT OFF
- GO
- /****** Object: StoredProcedure [dbo].[pcPaFavorateBatchDelete] Script Date: 2018/12/13 19:08:48 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- --====================================
- --返回值:-1:不是你的收藏职位
- --创建: lucifer
- --检查: Sean 2010-10-14
- --删除收藏的职位
- --====================================
- CREATE PROCEDURE [dbo].[pcPaFavorateBatchDelete]
- (
- @AllID VARCHAR(1000),
- @paMainID INT
- )
- AS
- BEGIN TRY
- --生成临时表
- DECLARE @t AS TABLE(ID INT)
- /*
- DECLARE @i INT
- SET @i=CHARINDEX(',',@AllID)
- WHILE @i>=1
- BEGIN
- IF LEFT(@AllID,@i-1) > ''
- INSERT @t VALUES(LEFT(@AllID,@i-1))
- SET @AllID=SUBSTRING(@AllID,@i+1,LEN(@AllID)-@i)
- SET @i=CHARINDEX(',',@AllID)
- END
- IF @AllID > ''
- INSERT @t VALUES(@AllID)
- */
- INSERT INTO @t
- SELECT * FROM dbo.fnSplit(@AllID, ',')
- ----判断是否这些id是同一个paMainID
- IF EXISTS(SELECT 'X' FROM paFavorate a WITH(NOLOCK), @t b
- WHERE a.id=b.id AND a.paMainID<>@paMainID)
- GOTO Err1
- DELETE FROM paFavorate WHERE ID IN(SELECT ID FROM @t)
- END TRY
- BEGIN CATCH
- GOTO ERR
- END CATCH
- RETURN 1
- ERR:
- BEGIN
- RETURN 0
- END
- ERR1:
- BEGIN
- RETURN -1
- END
- GO
- /****** Object: StoredProcedure [dbo].[pcPaFavorateInsert] Script Date: 2018/12/13 19:08:49 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- --====================================
- --返回值:-1:不是你的收藏职位
- --创建: lucifer
- --检查: Sean 2010-10-14
- --保存收藏的职位 ,先删除、再添加
- --====================================
- CREATE PROCEDURE [dbo].[pcPaFavorateInsert]
- (
- @paMainID INT,
- @JobId INT,
- @Remark VARCHAR(200)
- )
- AS
- BEGIN
- SET @Remark = dbo.SafeSQL(dbo.TRIM(@Remark))
- DECLARE @cnt AS INT
- SELECT @cnt = COUNT(1) FROM paFavorate WITH(NOLOCK) WHERE paMainID = @paMainID
- IF @cnt > 199
- RETURN 0
- IF LEN(@Remark) = 0
- SET @Remark = NULL
- INSERT INTO paFavorate(paMainID,JobId,Remark) VALUES(@paMainID,@JobId,@Remark)
- RETURN 1
- END
- GO
- /****** Object: StoredProcedure [dbo].[pcPaFavorateSelect] Script Date: 2018/12/13 19:08:49 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- CREATE PROCEDURE [dbo].[pcPaFavorateSelect]
- (
- @WHERE VARCHAR(1000),
- @Order VARCHAR(100)
- )
- AS
- BEGIN
- BEGIN TRY
- SET @Where = dbo.SafeSql(@Where)
- SET @Order = dbo.SafeSql(@Order)
- DECLARE @SQL AS VARCHAR(2000)
- SET @SQL='SELECT a.ID,a.paMainID,a.JobID,a.AddDate,a.Remark,b.Name as JobName,b.IssueDate,
- b.IssueEND,b.dcRegionID,b.IsDelete,c.Name as cpName,c.ID as cpID,c.HasLicence,
- c.IsAgent, c.Membertype, b.dcSalaryID, b.SecondId EnJobID, c.SecondId EnCpMainID,
- b.caMainID, dbo.GetCaOnlineStatus(b.caMainID) AS IsOnline
- FROM paFavorate a WITH(NOLOCK)
- Inner Join Job b WITH(NOLOCK) ON a.JobID=b.ID
- Inner Join cpMain c WITH(NOLOCK) ON b.cpMainID=c.ID'
- IF LEN(@WHERE)>0
- SET @SQL=@SQL + ' WHERE '+ @WHERE
- IF LEN(@ORDER)>0
- SET @SQL=@SQL + ' ORDER BY '+@ORDER
- EXEC(@SQL)
- END TRY
- BEGIN CATCH
- END CATCH
- END
- GO
- /****** Object: StoredProcedure [dbo].[pcpaFavorateUpdate] Script Date: 2018/12/13 19:08:50 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- --====================================
- --创建: lucifer
- --检查: Sean 2010-10-14
- --修改备注
- --====================================
- CREATE PROCEDURE [dbo].[pcpaFavorateUpdate]
- (
- @ID INT,
- @Remark VARCHAR(200),
- @paMainId INT
- )
- AS
- BEGIN TRAN
- BEGIN TRY
- UPDATE paFavorate SET Remark=dbo.SafeSQL(@Remark) WHERE ID=@ID AND paMainID = @paMainID
- END TRY
- BEGIN CATCH
- GOTO ERR
- END CATCH
- COMMIT TRAN
- RETURN 1
- ERR:
- BEGIN
- ROLLBACK TRAN
- RETURN 0
- END
- GO
- /****** Object: StoredProcedure [dbo].[pcpaFeedBackInsert] Script Date: 2018/12/13 19:08:50 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- --==================================================
- --检查 sean 2010-10-8
- --描述 新增个人用户反馈
- --==================================================
- CREATE PROCEDURE [dbo].[pcpaFeedBackInsert]
- (
- @paMainID INT,
- @dcProvinceID INT,
- @IP VARCHAR(31),
- @Name VARCHAR(100),
- @Telephone VARCHAR(50),
- @Email VARCHAR(100),
- @Message VARCHAR(4000)
- )
- AS
- BEGIN TRY
- INSERT INTO PaFeedBack(paMainID,dcProvinceID,IP,Name,Telephone,Email,Message,AddDate)
- VALUES(@paMainID,@dcProvinceID,@IP,dbo.SafeSQL(@Name),dbo.SafeSQL(@Telephone),dbo.SafeSQL(@Email),dbo.SafeSQL(@Message),GETDATE())
- RETURN 1
- END TRY
- BEGIN CATCH
- RETURN 0
- END CATCH
- GO
- /****** Object: StoredProcedure [dbo].[pcpaFeedBackNoViewSelect] Script Date: 2018/12/13 19:08:50 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- --==================================================
- --检查 sean 2010-10-8
- --描述 选择未查看的个人用户反馈
- --==================================================
- CREATE PROCEDURE [dbo].[pcpaFeedBackNoViewSelect]
- (
- @paMainID INT
- )
- AS
- BEGIN
- SELECT *
- FROM paFeedBack WITH(NOLOCK INDEX(IX_paFeedBack_paMainID))
- WHERE paMainID = @paMainID
- AND IsReply = 1
- AND ViewDate IS NULL
- ORDER BY ID DESC
- END
- GO
- /****** Object: StoredProcedure [dbo].[pcpaFeedBackSelect] Script Date: 2018/12/13 19:08:50 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- --==================================================
- --检查 sean 2010-10-8
- --描述 选择个人用户反馈
- --==================================================
- CREATE PROCEDURE [dbo].[pcpaFeedBackSelect]
- @paMainID INT
- AS
- BEGIN
- SELECT *
- FROM paFeedBack WITH(NOLOCK INDEX(IX_paFeedBack_paMainID))
- WHERE paMainID = @paMainID
- ORDER BY ID DESC
- END
- GO
- /****** Object: StoredProcedure [dbo].[pcPaFeedbackViewDateUpdate] Script Date: 2018/12/13 19:08:51 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- --==================================================
- --检查 sean 2010-10-8
- --描述asp中取所有viewDate is null的id
- --==================================================
- CREATE PROCEDURE [dbo].[pcPaFeedbackViewDateUpdate]
- @AllID VARCHAR(200),
- @paMainID INT
- AS
- BEGIN TRY
- SET @AllID = dbo.FormatIDS(@AllID)
- DECLARE @T AS TABLE(ID INT)
- INSERT INTO @T SELECT * FROM dbo.fnSplit(@AllID, ',')
- UPDATE paFeedback SET ViewDate=GETDATE() WHERE ID IN(SELECT ID FROM @T) AND paMainID = @paMainID
- RETURN 1
- END TRY
- BEGIN CATCH
- RETURN 0
- END CATCH
- GO
- /****** Object: StoredProcedure [dbo].[pcPaGetPasswordLogByMailSelect] Script Date: 2018/12/13 19:08:51 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- --======================================
- --一天之内一个账号不能查询超过5次
- --一天之内一个ip不能超过20次
- --======================================
- CREATE PROCEDURE [dbo].[pcPaGetPasswordLogByMailSelect]
- @paMainID INT,
- @IP VARCHAR(31)
- AS
- BEGIN
- DECLARE @d AS DATETIME
- DECLARE @C AS INT
- SET @d = CONVERT(DATETIME,(FLOOR(CONVERT(FLOAT,GETDATE()))))
- SELECT @C = COUNT(1) FROM paGetPasswordLog WITH(NOLOCK) WHERE paMainID = @paMainID AND AddDate>=@d
- IF @c >4
- GOTO Err1
-
- SELECT @C = COUNT(1) FROM paGetPasswordLog WITH(NOLOCK) WHERE IP = @IP AND AddDate>=@d
- IF @c > 20
- GOTO Err2
- RETURN 1
- END
- Err1:
- BEGIN
- RETURN -1
- END
- Err2:
- BEGIN
- RETURN -2
- END
-
-
- GO
- /****** Object: StoredProcedure [dbo].[pcPaJobClickLogByIpSelect] Script Date: 2018/12/13 19:08:51 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- --#####################################################
- --创建时间:2014.10.30
- --创建人:Nick
- --说明:得到点击次数
- --#####################################################
- CREATE PROCEDURE [dbo].[pcPaJobClickLogByIpSelect]
- (
- @Ip VARCHAR(50),
- @PaMainID INT
- )
- AS
- SET NOCOUNT ON
- --insert proclog select 'pcPaJobClickLogByIpSelect', @ip, getdate()
- BEGIN
- DECLARE @canview TINYINT
- IF EXISTS(SELECT 'x' FROM paJobClickCount WITH(NOLOCK) WHERE Ip = @Ip)
- SET @canview = '0'
- ELSE
- SET @canview = '1'
- SELECT @canview canview
- /*
- DECLARE @Cnt1 INT, @Cnt2 INT
- IF ISNULL(@PaMainID, 0) > 0
- SELECT @Cnt2 = COUNT(1)
- FROM paJobClickLog WITH(NOLOCK)
- WHERE paMainID = @PaMainID
- ELSE
- SET @Cnt2 = 0
- IF @Cnt2 > 9
- BEGIN
- SELECT '0' canview
- RETURN
- END
- SELECT @Cnt1 = COUNT(1)
- FROM paJobClickLog WITH(NOLOCK)
- WHERE Ip = @ip
- DECLARE @canview VARCHAR(1)
- SET @canview = ''
- IF @Cnt1 > 9
- BEGIN
- IF EXISTS(SELECT 'x' FROM Ip_White WHERE CHARINDEX(ip, @ip) > 0)
- BEGIN
- IF @Cnt1 > 99
- SET @canview = '0'
- END
- ELSE
- SET @canview = '0'
- END
- IF @canview = ''
- SET @canview = '1'
- SELECT @canview canview
- */
- END
- GO
- /****** Object: StoredProcedure [dbo].[pcPaJobClickLogCountSelect] Script Date: 2018/12/13 19:08:51 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- --#####################################################
- --创建时间:2014.10.30
- --创建人:Nick
- --说明:得到点击次数
- --#####################################################
- CREATE PROCEDURE [dbo].[pcPaJobClickLogCountSelect]
- (
- @PaMainID INT
- )
- AS
- BEGIN
- SELECT COUNT(1) cnt
- FROM paJobClickLog WITH(NOLOCK)
- WHERE paMainID = @PaMainID
- --AND AddDate > CONVERT(VARCHAR(10), GETDATE(), 112)
- END
- GO
- /****** Object: StoredProcedure [dbo].[pcPaJobClickLogSelect] Script Date: 2018/12/13 19:08:52 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- --#####################################################
- --创建时间:2014.10.30
- --创建人:Nick
- --说明:根据职位ID,个人ID 判断是否点击过
- --#####################################################
- CREATE PROCEDURE [dbo].[pcPaJobClickLogSelect]
- (
- @JobID INT,
- @PaMainID INT
- )
- AS
- BEGIN
- SELECT 'x'
- FROM paJobClickLog WITH(NOLOCK)
- WHERE AddDate > CONVERT(VARCHAR(10), GETDATE(), 112)
- AND JobID = @JobID
- AND paMainID = @PaMainID
- END
- GO
- /****** Object: StoredProcedure [dbo].[pcPaJobCompareByHomePageSelect] Script Date: 2018/12/13 19:08:52 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- --修改harry 过期的职位不显示2017-10-23
- CREATE PROCEDURE [dbo].[pcPaJobCompareByHomePageSelect]
- (
- @PaMainID INT
- )
- AS
- SET NOCOUNT ON
- BEGIN
- SELECT TOP 9 b.ID JobID, b.SecondID EnJobID, b.Name JobName,b.dcSalaryIdMax,b.Negotiable, c.Name CpName,c.HasLicence, c.SecondID EnCpMainID,
- (SELECT CASE WHEN LEN(e.Id) = 6
- THEN RIGHT(e.FullName, LEN(e.FullName) - CHARINDEX(LEFT(e.MapBarName, 2), e.FullName) + 1)
- ELSE e.Abbr
- END
- FROM dcRegion e WITH(NOLOCK) WHERE e.Id = b.dcRegionId) WorkPlace,
- ISNULL((SELECT Description FROM dcEducation WHERE id = b.dcEducationId), '不限') Education,
- b.dcSalaryID,
- (SELECT Description FROM dcOthers WHERE Category = '招聘人数' AND DetailId = b.NeedNumber) NeedNumber,
- 'http://down.51rc.com/imagefolder/Logo/L' + CASE WHEN c.Id < 90000 THEN '0' ELSE '' END + LTRIM(STR(c.Id / 10000 + 1)) + '0000/' + d.ImgFile ImgFile
- FROM PaJobCompare a WITH(NOLOCK)
- INNER JOIN Job b WITH(NOLOCK) ON b.ID = a.CompareJobID
- INNER JOIN CpMain c WITH(NOLOCK) ON c.ID = b.CpMainID
- INNER Join cpImage d WITH(NOLOCK) ON d.cpMainId = c.Id
- WHERE PaMainID = @PaMainID
- AND b.valid = 1
- AND c.HasLogo = 1
- AND d.Imgtype = 1
- ORDER BY a.AddDate DESC
- END
- GO
- /****** Object: StoredProcedure [dbo].[pcPaJobCompareByPaMainIDSelect] Script Date: 2018/12/13 19:08:52 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- --Harry过期职位不显示2017-10-23
- CREATE PROCEDURE [dbo].[pcPaJobCompareByPaMainIDSelect]
- (
- @PaMainID INT,
- @IsLastBatch BIT,
- @BatchNo SMALLINT
- )
- AS
- SET NOCOUNT ON
- BEGIN
- IF @BatchNo > 0
- BEGIN
- SELECT a.*,b.*,c.Name CpName,c.HasLicence,c.SecondID EnCpMainID,b.ID JobID,b.SecondID EnJobID,
- b.Name JobName,a.AddDate RecommenedDate,c.RealName,
- ISNULL((SELECT IsOnline FROM caOnline WHERE caMainId =b.caMainID), 0) AS IsOnline, c.LogoFile LogoUrl
- FROM PaJobCompare a WITH(NOLOCK)
- LEFT JOIN Job b WITH(NOLOCK) ON b.ID = a.CompareJobID
- LEFT JOIN CpMain c WITH(NOLOCK) ON c.ID = b.CpMainID
- WHERE PaMainID = @PaMainID
- AND BatchNo = @BatchNo
- ORDER BY a.AddDate DESC
- END
- ELSE IF @IsLastBatch = 1
- BEGIN
- SELECT a.*,b.*,c.Name CpName,c.HasLicence,c.SecondID EnCpMainID,b.ID JobID,b.SecondID EnJobID,
- b.Name JobName,a.AddDate RecommenedDate, ISNULL((SELECT IsOnline FROM caOnline WHERE caMainId =b.caMainID), 0) AS IsOnline,
- c.LogoFile LogoUrl, c.RealName
- FROM PaJobCompare a WITH(NOLOCK)
- LEFT JOIN Job b WITH(NOLOCK) ON b.ID = a.CompareJobID
- LEFT JOIN CpMain c WITH(NOLOCK) ON c.ID = b.CpMainID
- WHERE PaMainID = @PaMainID
- AND b.valid = 1
- AND BatchNo = (
- SELECT MAX(BatchNo)
- FROM PaJobCompare WITH(NOLOCK)
- WHERE PaMainID = @PaMainID
- )
- ORDER BY a.AddDate DESC
- END
- ELSE
- BEGIN
- SELECT a.*,b.*,c.Name CpName,c.HasLicence,c.SecondID EnCpMainID,b.ID JobID,b.SecondID EnJobID,
- b.Name JobName,a.AddDate RecommenedDate,ISNULL((SELECT IsOnline FROM caOnline WHERE caMainId =b.caMainID), 0) AS IsOnline,
- c.LogoFile LogoUrl,c.RealName, d.DescriptionCp Salary, e.DescriptionCp SalaryMax, f.MapBarName Region, g.Description Education, h.Description Experience
- FROM PaJobCompare a WITH(NOLOCK)
- LEFT JOIN Job b WITH(NOLOCK) ON b.ID = a.CompareJobID
- LEFT JOIN CpMain c WITH(NOLOCK) ON c.ID = b.CpMainID
- LEFT JOIN dcSalary d WITH(NOLOCK) ON b.dcSalaryId = d.ID
- LEFT JOIN dcSalary e WITH(NOLOCK) ON b.dcSalaryIdMax = e.ID
- LEFT JOIN dcRegion f WITH(NOLOCK) ON b.dcRegionId = f.ID
- LEFT JOIN dcEducation g WITH(NOLOCK) ON b.dcEducationId = g.ID
- LEFT JOIN dcOthers h WITH(NOLOCK) ON b.MinExperience = h.DetailID AND Category = '职位要求工作经验'
- WHERE PaMainID = @PaMainID
- AND b.valid = 1
- ORDER BY a.AddDate DESC
- END
- END
- GO
- /****** Object: StoredProcedure [dbo].[pcpaJobFinderByEmailUpdate] Script Date: 2018/12/13 19:08:53 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- --增加人:LAMBO 20110104
- --作用:修改搜索器的订阅信息,用于我的搜索器页面
- CREATE PROCEDURE [dbo].[pcpaJobFinderByEmailUpdate]
- @ID INT,
- @paMainID INT,
- @EmailSent SMALLINT,
- @EmailEndDate VARCHAR(20),
- @Email VARCHAR(50),
- @EmailNumber INT
- AS
- BEGIN TRY
- UPDATE paJobFinder SET
- EmailSent=@EmailSent,
- EmailEndDate=dbo.SafeSQL(@EmailEndDate),
- EmailNumber=@EmailNumber,
- Email=dbo.SafeSQL(@Email)
- WHERE ID=@ID
- AND paMainID = @paMainID
- RETURN 1
- END TRY
- BEGIN CATCH
- RETURN 0
- END CATCH
- GO
- /****** Object: StoredProcedure [dbo].[pcPaJobFinderByIDUpdate] Script Date: 2018/12/13 19:08:53 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- --修改订阅接收频次
- --nick 20151118
- create PROCEDURE [dbo].[pcPaJobFinderByIDUpdate]
- (
- @ID INT,
- @PaMainID INT,
- @EmailSent INT
- )
- AS
- BEGIN
- SET NOCOUNT ON
- UPDATE PaJobFinder
- SET EmailSent = @EmailSent
- WHERE ID = @ID
- AND PaMainID = @PaMainID
- SET NOCOUNT OFF
- END
- GO
- /****** Object: StoredProcedure [dbo].[pcpaJobFinderBypaMainIDSelect] Script Date: 2018/12/13 19:08:53 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- CREATE PROCEDURE [dbo].[pcpaJobFinderBypaMainIDSelect]
- @paMainID INT
- AS
- BEGIN
- SELECT * FROM paJobFinder WITH(NOLOCK) WHERE paMainID=@paMainID
- END
- GO
- /****** Object: StoredProcedure [dbo].[pcpaJobFinderDelete] Script Date: 2018/12/13 19:08:53 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- ----###############################
- --删除职位搜索器
- ----###############################
- CREATE PROCEDURE [dbo].[pcpaJobFinderDelete]
- (
- @ID INT,
- @paMainID INT
- )
- AS
- BEGIN
- DELETE FROM paJobFinder WHERE ID = @ID AND paMainID = @paMainID
- IF @@ROWCOUNT = 0
- RETURN 0
- ELSE
- RETURN 1
- END
- GO
- /****** Object: StoredProcedure [dbo].[pcpaJobFinderSave] Script Date: 2018/12/13 19:08:53 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- --LAMBO 20101125 修改
- --增加对搜索器个数的判断
- CREATE PROCEDURE [dbo].[pcpaJobFinderSave]
- (
- @ID INT,
- @paMainID INT,
- @Name VARCHAR(50),
- @dcJobTypeID VARCHAR(50),
- @dcIndustryID VARCHAR(50),
- @dcRegionID VARCHAR(50),
- @KeyType TINYINT,
- @KeyWord VARCHAR(50),
- @Education TINYINT,
- @EmployType VARCHAR(50),
- @MinExperience VARCHAR(50),
- @Salary VARCHAR(50),
- @EmailSent SMALLINT,
- @EmailEndDate VARCHAR(20),
- @Email VARCHAR(50),
- @EmailNumber INT
- )
- AS
- DECLARE @MaxId AS INT
- BEGIN TRY
- IF @dcJobTypeID = ''
- SET @dcJobTypeID = NULL
- IF @dcIndustryID = ''
- SET @dcIndustryID = NULL
- IF @dcRegionID = ''
- SET @dcRegionID = NULL
- IF @Education = ''
- SET @Education = NULL
- IF @EmployType = ''
- SET @EmployType = NULL
- IF @MinExperience = ''
- SET @MinExperience = NULL
- IF @Salary = ''
- SET @Salary = NULL
- IF @EmailSent = 0
- BEGIN
- SET @EmailEndDate = NUll
- SET @Email = NUll
- SET @EmailNumber = NULL
- END
- ELSE
- SET @EmailEndDate = CONVERT(VARCHAR(10), CONVERT(DATETIME, @EmailEndDate), 120) + ' 23:59:00'
- --PRINT @EmailEndDate
- IF @ID>0
- BEGIN
- UPDATE paJobFinder SET
- dcJobTypeID=@dcJobTypeID,
- dcIndustryID=@dcIndustryID,
- dcRegionID=@dcRegionID,
- KeyType=@KeyType,
- KeyWord=@KeyWord,
- Education=@Education,
- EmployType=@EmployType,
- MinExperience=@MinExperience,
- Salary=@Salary,
- EmailSent=@EmailSent,
- EmailEndDate=@EmailEndDate,
- EmailNumber=@EmailNumber,
- Email=@Email
- WHERE ID=@ID
- AND paMainID = @paMainID
- SET @MaxID=@ID
- END
- ELSE
- BEGIN
- DECLARE @FinderCount INT
- SELECT @FinderCount = COUNT(1) FROM paJobFinder WHERE paMainID = @paMainID
- IF @FinderCount >= 6
- RETURN -1
- INSERT INTO paJobFinder
- (paMainID,Name,dcJobTypeID,dcIndustryID,
- dcRegionID,KeyType,KeyWord,Education,
- EmployType,MinExperience,Salary,
- EmailSent,EmailEndDate,EmailNumber,Email)
- VALUES
- (@paMainID,@Name,@dcJobTypeID,@dcIndustryID,
- @dcRegionID,@KeyType,@KeyWord,@Education,
- @EmployType,@MinExperience,@Salary,
- @EmailSent,@EmailEndDate,@EmailNumber,@Email)
- SET @MaxID = @@IDENTITY
- END
- END TRY
- BEGIN CATCH
- GOTO ERR
- END CATCH
- RETURN @MaxID
- ERR:
- BEGIN
- RETURN 0
- END
- GO
- /****** Object: StoredProcedure [dbo].[pcpaJobFinderSave2] Script Date: 2018/12/13 19:08:53 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- CREATE PROCEDURE [dbo].[pcpaJobFinderSave2]
- (
- @ID INT,
- @paMainID INT,
- @Name VARCHAR(50),
- @dcJobTypeID VARCHAR(50),
- @dcIndustryID VARCHAR(50),
- @dcRegionID VARCHAR(50),
- @KeyType TINYINT,
- @KeyWord VARCHAR(50),
- @Education TINYINT,
- @EmployType VARCHAR(50),
- @MinExperience VARCHAR(50),
- @Salary VARCHAR(50),
- @EmailSent SMALLINT,
- @EmailEndDate VARCHAR(20),
- @Email VARCHAR(50),
- @EmailNumber INT,
- @IsNegotiable BIT,
- @dcCompanySizeID TINYINT
- )
- AS
- DECLARE @MaxId AS INT
- BEGIN TRY
- IF @dcJobTypeID = ''
- SET @dcJobTypeID = NULL
- IF @dcIndustryID = ''
- SET @dcIndustryID = NULL
- IF @dcRegionID = ''
- SET @dcRegionID = NULL
- IF @Education = ''
- SET @Education = NULL
- IF @EmployType = ''
- SET @EmployType = NULL
- IF @MinExperience = ''
- SET @MinExperience = NULL
- IF @Salary = ''
- SET @Salary = NULL
- IF @IsNegotiable IS NULL
- SET @IsNegotiable = 0
- IF @EmailSent = 0
- BEGIN
- SET @EmailEndDate = NUll
- SET @Email = NUll
- SET @EmailNumber = NULL
- END
- ELSE
- SET @EmailEndDate = CONVERT(VARCHAR(10), CONVERT(DATETIME, @EmailEndDate), 120) + ' 23:59:00'
- ----PRINT @EmailEndDate
- IF @ID>0
- BEGIN
- UPDATE paJobFinder
- SET Name = @Name,
- dcJobTypeID=@dcJobTypeID,
- dcIndustryID=@dcIndustryID,
- dcRegionID=@dcRegionID,
- KeyType=@KeyType,
- KeyWord=@KeyWord,
- Education=@Education,
- EmployType=@EmployType,
- MinExperience=@MinExperience,
- Salary=@Salary,
- EmailSent=@EmailSent,
- EmailEndDate=@EmailEndDate,
- EmailNumber=@EmailNumber,
- Email=@Email,
- IsNegotiable = @IsNegotiable,
- dcCompanySizeID = @dcCompanySizeID
- WHERE ID=@ID
- AND paMainID = @paMainID
- SET @MaxID=@ID
- END
- ELSE
- BEGIN
- DECLARE @FinderCount INT
- SELECT @FinderCount = COUNT(1) FROM paJobFinder WHERE paMainID = @paMainID
- IF @FinderCount >= 6
- BEGIN
- --大于6个将第一个删除 再进行添加
- DELETE FROM paJobFinder WHERE paMainID = @paMainID
- AND ID IN (
- SELECT TOP 1 ID FROM paJobFinder WHERE paMainID = @paMainID
- ORDER BY ID
- )
- --RETURN -1
- END
- INSERT INTO paJobFinder
- (paMainID,Name,dcJobTypeID,dcIndustryID,
- dcRegionID,KeyType,KeyWord,Education,
- EmployType,MinExperience,Salary,
- EmailSent,EmailEndDate,EmailNumber,Email, IsNegotiable, dcCompanySizeID)
- VALUES
- (@paMainID,@Name,@dcJobTypeID,@dcIndustryID,
- @dcRegionID,@KeyType,@KeyWord,@Education,
- @EmployType,@MinExperience,@Salary,
- @EmailSent,@EmailEndDate,@EmailNumber,@Email, @IsNegotiable, @dcCompanySizeID)
- SET @MaxID = @@IDENTITY
- END
- END TRY
- BEGIN CATCH
- GOTO ERR
- END CATCH
- RETURN @MaxID
- ERR:
- BEGIN
- RETURN 0
- END
- GO
- /****** Object: StoredProcedure [dbo].[pcpaJobFinderSelect] Script Date: 2018/12/13 19:08:54 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- CREATE PROCEDURE [dbo].[pcpaJobFinderSelect]
- @ID INT
- AS
- SELECT * FROM paJobFinder WITH(NOLOCK) WHERE ID=@ID
- GO
- /****** Object: StoredProcedure [dbo].[pcPaJobViewLogBatchSave] Script Date: 2018/12/13 19:08:54 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- CREATE PROCEDURE [dbo].[pcPaJobViewLogBatchSave]
- (
- @JobIDs VARCHAR(500),
- @paMainID INT
- )
- AS
- BEGIN
- SET @JobIDs = dbo.FormatIDS(@JobIDs)
- IF @paMainID <> 0
- BEGIN
- UPDATE PaJobViewLog SET AddDate=GETDATE()
- WHERE paMainID = @paMainID AND JobID IN (SELECT * FROM dbo.fnSplit(@JobIDs, ','))
- INSERT PaJobViewLog(paMainID,JobID)
- SELECT @paMainID,a FROM dbo.fnSplit(@JobIDs, ',')
- WHERE a NOT IN (SELECT JobID FROM paJobViewLog WITH(NOLOCK) WHERE paMainID = @paMainID)
- END
-
- UPDATE Job SET ViewNumber = ViewNumber + 1 WHERE ID IN (SELECT * FROM dbo.fnSplit(@JobIDs, ','))
- END
- GO
- /****** Object: StoredProcedure [dbo].[pcPaJobViewLogSave] Script Date: 2018/12/13 19:08:54 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- --====================================
- --创建: lucifer
- --检查: Sean 2010-10-14
- --职位查看记录
- --====================================
- CREATE PROCEDURE [dbo].[pcPaJobViewLogSave]
- (
- @paMainID INT,
- @JobID INT
- )
- AS
- SET NOCOUNT ON
- BEGIN TRY
- IF @paMainID > 0
- IF EXISTS(SELECT 'x' FROM PaJobViewLog WITH(NOLOCK) WHERE paMainID=@paMainID AND JobID=@JobID)
- UPDATE PaJobViewLog SET AddDate = GETDATE() WHERE paMainID = @paMainID AND JobID = @JobID
- ELSE
- INSERT PaJobViewLog(paMainID, JobID) VALUES(@paMainID, @JobID)
-
- UPDATE Job SET ViewNumber = ViewNumber + 1 WHERE ID = @JobID
- END TRY
- BEGIN CATCH
- END CATCH
- GO
- /****** Object: StoredProcedure [dbo].[pcPaJobViewLogSelect] Script Date: 2018/12/13 19:08:54 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- CREATE PROCEDURE [dbo].[pcPaJobViewLogSelect]
- (
- @WHERE VARCHAR(1000),
- @Order VARCHAR(100)
- )
- AS
- BEGIN
- BEGIN TRY
- SET @Where = dbo.SafeSql(@Where)
- SET @Order = dbo.SafeSql(@Order)
- DECLARE @SQL AS VARCHAR(2000)
- SET @SQL = 'SELECT JobID,paMainID,a.AddDate,b.Name as JobName,b.IssueDate,b.IssueEND, b.SecondId EnJobID, c.SecondId EnCpMainID,
- b.dcRegionID,b.IsDelete,c.Name as cpName,c.ID as cpID,c.HasLicence, c.IsAgent, c.MemberType, b.dcSalaryId,b.caMainID,
- dbo.GetCaOnlineStatus(b.caMainID) AS IsOnline
- FROM paJobViewLog a WITH(NOLOCK)
- inner join Job b WITH(NOLOCK) On a.JobID = b.ID
- inner join cpMain c WITH(NOLOCK) On b.cpMainID = c.ID'
- IF LEN(@WHERE)>0
- SET @SQL=@SQL + ' WHERE '+@WHERE
- IF LEN(@ORDER)>0
- SET @SQL=@SQL + ' ORDER BY '+@ORDER
- EXEC(@SQL)
- END TRY
- BEGIN CATCH
- END CATCH
- END
- GO
- /****** Object: StoredProcedure [dbo].[pcPaLoginLogSelect] Script Date: 2018/12/13 19:08:54 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- CREATE PROCEDURE [dbo].[pcPaLoginLogSelect]
- (
- @paMainID INT
- )
- AS
- BEGIN
- SELECT Top 100 a.*,b.Name
- FROM PaLoginLog a WITH(NOLOCK),paMain b WITH(NOLOCK)
- WHERE a.paMainID = @paMainID
- AND a.paMainID = b.ID
- ORDER BY a.Adddate DESC
- END
- GO
- /****** Object: StoredProcedure [dbo].[pcPaLoginRegCountByDcSubSiteIdUpdate] Script Date: 2018/12/13 19:08:55 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- /*++++++++++++++++++++++++++++++++++++
- sean 2014-2-17
- ++++++++++++++++++++++++++++++++++++*/
- CREATE PROCEDURE [dbo].[pcPaLoginRegCountByDcSubSiteIdUpdate]
- (
- @dcSubSiteId INT,
- @Col VARCHAR(20)
- )
- AS
- BEGIN
- IF @Col = 'oneminuteload'
- UPDATE PaLoginRegCount SET OneMinuteLoad = OneMinuteLoad + 1 WHERE CountDate = CONVERT(VARCHAR(8), GETDATE(), 112) AND dcSubSiteId = @dcSubSiteId
- ELSE IF @Col = 'OneMinuteCreate'
- UPDATE PaLoginRegCount SET OneMinuteCreate = OneMinuteCreate + 1 WHERE CountDate = CONVERT(VARCHAR(8), GETDATE(), 112) AND dcSubSiteId = @dcSubSiteId
- ELSE IF @Col = 'OneMinuteLogin'
- UPDATE PaLoginRegCount SET OneMinuteLogin = OneMinuteLogin + 1 WHERE CountDate = CONVERT(VARCHAR(8), GETDATE(), 112) AND dcSubSiteId = @dcSubSiteId
- ELSE IF @Col = 'LoginPageLogin'
- UPDATE PaLoginRegCount SET LoginPageLogin = LoginPageLogin + 1 WHERE CountDate = CONVERT(VARCHAR(8), GETDATE(), 112) AND dcSubSiteId = @dcSubSiteId
- ELSE IF @Col = 'LoginPageReg'
- UPDATE PaLoginRegCount SET LoginPageReg = LoginPageReg + 1 WHERE CountDate = CONVERT(VARCHAR(8), GETDATE(), 112) AND dcSubSiteId = @dcSubSiteId
- END
- GO
- /****** Object: StoredProcedure [dbo].[pcPaLoginRegCountUpdate] Script Date: 2018/12/13 19:08:55 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- /*++++++++++++++++++++++++++++++++++++
- sean 2014-2-13
- ++++++++++++++++++++++++++++++++++++*/
- CREATE PROCEDURE [dbo].[pcPaLoginRegCountUpdate]
- (
- @Col VARCHAR(20)
- )
- AS
- BEGIN
- IF @Col = 'oneminuteload'
- UPDATE PaLoginRegCount SET OneMinuteLoad = OneMinuteLoad + 1 WHERE CountDate = CONVERT(VARCHAR(8), GETDATE(), 112) AND dcSubSiteId = 0
- ELSE IF @Col = 'OneMinuteCreate'
- UPDATE PaLoginRegCount SET OneMinuteCreate = OneMinuteCreate + 1 WHERE CountDate = CONVERT(VARCHAR(8), GETDATE(), 112) AND dcSubSiteId = 0
- ELSE IF @Col = 'OneMinuteLogin'
- UPDATE PaLoginRegCount SET OneMinuteLogin = OneMinuteLogin + 1 WHERE CountDate = CONVERT(VARCHAR(8), GETDATE(), 112) AND dcSubSiteId = 0
- ELSE IF @Col = 'LoginPageLogin'
- UPDATE PaLoginRegCount SET LoginPageLogin = LoginPageLogin + 1 WHERE CountDate = CONVERT(VARCHAR(8), GETDATE(), 112) AND dcSubSiteId = 0
- ELSE IF @Col = 'LoginPageReg'
- UPDATE PaLoginRegCount SET LoginPageReg = LoginPageReg + 1 WHERE CountDate = CONVERT(VARCHAR(8), GETDATE(), 112) AND dcSubSiteId = 0
- END
- GO
- /****** Object: StoredProcedure [dbo].[pcPaMailLogRegisterInsert] Script Date: 2018/12/13 19:08:55 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- CREATE PROCEDURE [dbo].[pcPaMailLogRegisterInsert]
- @paMainID INT,
- @Email VARCHAR(50),
- @Subject VARCHAR(50),
- @Remark VARCHAR(500)
- AS
- BEGIN
- BEGIN TRY
- INSERT INTO paMailLog(paMainID,Email,Subject,Remark) VALUES(@paMainID,dbo.SafeSQL(@Email),dbo.SafeSQL(@Subject),dbo.SafeSQL(@Remark))
- RETURN @@IDENTITY
- END TRY
- BEGIN CATCH
- RETURN 0
- END CATCH
- END
- GO
- /****** Object: StoredProcedure [dbo].[pcPaMainByAllSelect] Script Date: 2018/12/13 19:08:55 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- CREATE PROCEDURE [dbo].[pcPaMainByAllSelect]
- @ID INT
- AS
- BEGIN
- SELECT *,
- (SELECT TOP 1 LoginIP FROM paLoginLog WITH(NOLOCK) WHERE paLoginLog.paMainID = paMain.ID ORDER BY ID DESC) AS LastLoginIP,
- (SELECT COUNT(1) FROM paLoginLog WITH(NOLOCK) WHERE paLoginLog.paMainID = paMain.ID AND AddDate > CONVERT(VARCHAR(10), GETDATE(), 120)) AS TodayLoginNum
- FROM paMain WITH(NOLOCK INDEX(PK_paMain))
- WHERE ID=@ID
- END
- GO
- /****** Object: StoredProcedure [dbo].[pcPaMainByBackLogin] Script Date: 2018/12/13 19:08:56 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- --***********************************************************
- --返回值:
- -- 0:未定义错误
- -- -1:用户名、密码不正确
- -- -2:验证码不正确
- -- 正整数:正确的ID
- --后台登陆用
- --***********************************************************
- CREATE PROCEDURE [dbo].[pcPaMainByBackLogin]
- (
- @UID VARCHAR(20),
- @PaMainID INT
- )
- AS
- BEGIN TRY
- DECLARE @ID AS INT
- SELECT TOP 1 @ID = ID
- FROM BsPaBackLogin WITH(NOLOCK)
- WHERE UnqueID=@UID
- AND HasLogin = 0
- AND PaMainID=@PaMainID
- IF @ID IS NOT NULL
- BEGIN
- UPDATE BsPaBackLogin SET HasLogin = 1 WHERE ID = @ID
- --DELETE FROM BsPaBackLogin WHERE AddDate < GETDATE()-0.2
- IF EXISTS(SELECT 'X' FROM paMain WITH(NOLOCK)
- WHERE ID=@PaMainID
- )
- RETURN 1
- ELSE
- RETURN 0
- END
- END TRY
- BEGIN CATCH
- RETURN -1
- END CATCH
- GO
- /****** Object: StoredProcedure [dbo].[pcPaMainByCareerStatusUpdate] Script Date: 2018/12/13 19:08:56 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- --####################################
- --更新求职状态
- --返回值:
- -- -2 求职状态为空
- --####################################
- CREATE PROCEDURE [dbo].[pcPaMainByCareerStatusUpdate]
- (
- @PaMainID INT,
- @dcCareerStatus TINYINT,
- @IP VARCHAR(39)
- )
- AS
- SET NOCOUNT ON
- BEGIN
- SET NOCOUNT ON
- IF @dcCareerStatus IS NULL
- RETURN -2 --求职状态为空
- UPDATE paMain
- SET dcCareerStatus = @dcCareerStatus,
- LastModifyDate = GETDATE()
- WHERE ID = @PaMainID
- UPDATE CvMain SET RefreshDate = GETDATE() WHERE paMainID = @paMainID
- SET NOCOUNT OFF
- END
- GO
- /****** Object: StoredProcedure [dbo].[pcPaMainByCvMainIDSelect] Script Date: 2018/12/13 19:08:56 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- --#####################################################
- --创建时间:2014.10.31
- --创建人:Nick
- --说明:
- --#####################################################
- CREATE PROCEDURE [dbo].[pcPaMainByCvMainIDSelect]
- (
- @CvMainID INT,
- @CpMainID INT
- )
- AS
- BEGIN TRY
- SELECT a.ID paMainID,a.Name,UserName,Email,dbo.GetPaName(b.ID,@CpMainID) AS paName,b.ID
- FROM paMain a WITH(NOLOCK),cvMain b WITH(NOLOCK)
- WHERE a.ID=b.paMainID AND b.ID=@CvMainID
- END TRY
- BEGIN CATCH
- RETURN 0
- END CATCH
- GO
- /****** Object: StoredProcedure [dbo].[pcPaMainByGetPasswordSelect] Script Date: 2018/12/13 19:08:56 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- -- =============================================
- -- Author: Sean
- -- Create date: 2012-3-6
- -- Description: 取回密码 先检查用户名是否在pamain,Resume_Xixni。如果没有结果则检查是否有邮箱
- --2012.3.6 和取回前、取回后的验证、插入一起
- -- =============================================
- CREATE PROCEDURE [dbo].[pcPaMainByGetPasswordSelect]
- (
- @Username VARCHAR(50),
- @Email VARCHAR(50),
- @Mobile VARCHAR(11),
- @IP VARCHAR(15),
- @VerifyCode VARCHAR(10),
- @SubSiteName VARCHAR(40)
- )
- AS
- BEGIN
- DECLARE @Cnt AS INT, @Type AS VARCHAR(10), @ToDay AS DATETIME, @QueryMobile AS INT
- ----如果用户名、邮箱、手机号都为空则返回
- IF LEN(ISNULL(@Username, '')) = 0 AND LEN(ISNULL(@Email, '')) = 0 AND LEN(ISNULL(@Mobile, '')) = 0
- GOTO Err3
- --SET @Mobile = ''
- ----@t是返回结果临时表
- DECLARE @t AS TABLE(
- ID INT,
- Name NVARCHAR(50) NOT NULL,
- UserName VARCHAR(50) NOT NULL,
- Email VARCHAR(50) NOT NULL,
- Gender NVARCHAR(10),
- Mobile VARCHAR(13),
- ReturnType VARCHAR(10),
- UniqueId VARCHAR(40),
- ActivateCode VARCHAR(6),
- AskNo VARCHAR(40)
- )
- SELECT @Type = 'Email', @QueryMobile = 0
- IF dbo.IsMobile(@Mobile) = 1 ----手机号是否合法
- BEGIN
- SET @QueryMobile = 1 ----手机号合法,则优先使用手机查询
- ----一天内手机取回密码次数
- SELECT @Cnt = COUNT(DISTINCT AskNo) FROM paGetPasswordLog WITH(NOLOCK) WHERE Mobile = @Mobile AND AddDate > GETDATE() - 1
- IF @Cnt >= 3 ----总数=0,按手机号取回
- GOTO Err4
- SET @Type = 'Mobile'
- END
- IF @Type = 'Email' ----按油箱、用户名取回次数
- BEGIN
- SET @ToDay = CONVERT(DATETIME, CONVERT(VARCHAR(8), GETDATE(), 112))
- IF LEN(ISNULL(@Username, '')) > 0 ----用户名
- BEGIN
- SELECT @Cnt = COUNT(1) FROM paGetPasswordLog WITH(NOLOCK) WHERE Username = @Username AND AddDate > @Today
- SET @Type='Username'
- END
- ELSE ----其次Email
- SELECT @Cnt = COUNT(1) FROM paGetPasswordLog WITH(NOLOCK) WHERE Email = @Email AND AddDate > @Today
- IF @Cnt > 4 ----一天之内一个账号最多取回5次
- GOTO Err1
- SELECT @Cnt = COUNT(1) FROM paGetPasswordLog WITH(NOLOCK) WHERE IP = @IP AND AddDate >= @Today
- IF @Cnt > 20 ----一天之内一个ip不能超过20次,很多手机是一个ip,所以不管手机了
- GOTO Err2
- END
- SELECT @Cnt = 0
- IF @QueryMobile = 1 ----按照手机号查询
- BEGIN
- INSERT INTO @t(ID, Name, UserName, Email, Gender, Mobile)
- SELECT TOP 10 ID,
- ISNULL(ISNULL(CONVERT(VARCHAR(50), Name), CONVERT(VARCHAR(50), NameEng)), UserName) Name,
- Username,
- Email,
- CASE Gender WHEN 0 THEN '先生' WHEN 1 THEN '女士' ELSE NULL END Gender,
- Mobile
- FROM paMain WITH(NOLOCK INDEX(IX_PaMain_Mobile))
- WHERE Mobile = @Mobile
- AND MobileVerifyDate IS NOT NULL
- ORDER BY Lastlogindate DESC
- IF NOT EXISTS(SELECT 'x' FROM @t)
- GOTO Err3
- END
- ELSE IF LEN(ISNULL(@Username, '')) > 0 --如果有用户名则以用户名为主
- BEGIN
- SET @Type='Username'
- --先查询paMain.UserName = @UserName 区分大小写
- INSERT INTO @t(ID, Name, UserName, Email, Gender, Mobile)
- SELECT TOP 1 ID,
- ISNULL(ISNULL(CONVERT(VARCHAR(50), Name), CONVERT(VARCHAR(50), NameEng)), UserName) COLLATE Chinese_PRC_CI_AS Name,
- Username COLLATE Chinese_PRC_CI_AS,
- Email,
- CASE Gender WHEN 0 THEN '先生' WHEN 1 THEN '女士' ELSE NULL END Gender,
- Mobile
- FROM paMain WITH(NOLOCK INDEX(IX_PaMain_UserName))
- WHERE UserName = @Username
- IF (SELECT COUNT(*) FROM @t) > 0 --有值则返回
- GOTO Retu
- INSERT INTO @t(ID, Name, UserName, Email, Gender, Mobile)
- SELECT top 1 0 ID,
- Username COLLATE Chinese_PRC_CI_AS Name,
- Username COLLATE Chinese_PRC_CI_AS,
- Email,
- NULL Gender,
- NULL Mobile
- FROM Resume_Xinxi WITH(NOLOCK INDEX(IX_Resume_Xinxi_UserName))
- WHERE UserName = @Username
- IF (SELECT COUNT(*) FROM @t) > 0 --有值则返回
- GOTO Retu
- --先查询paMain.UserName = @UserName 不区分大小写
- INSERT INTO @t(ID, Name, UserName, Email, Gender, Mobile)
- SELECT TOP 1 ID,
- ISNULL(ISNULL(CONVERT(VARCHAR(50), Name), CONVERT(VARCHAR(50), NameEng)), UserName) COLLATE Chinese_PRC_CI_AS Name,
- Username COLLATE Chinese_PRC_CI_AS,
- Email,
- CASE Gender WHEN 0 THEN '先生' WHEN 1 THEN '女士' ELSE NULL END Gender,
- Mobile
- FROM paMain WITH(NOLOCK INDEX(IX_PaMain_UserNameLower))
- WHERE UserNameLower = @Username
- ORDER BY Lastlogindate DESC
- IF (SELECT COUNT(*) FROM @t) > 0 --有值则返回
- GOTO Retu
- INSERT INTO @t(ID, Name, UserName, Email, Gender, Mobile)
- SELECT top 1 0 ID,
- Username COLLATE Chinese_PRC_CI_AS Name,
- Username COLLATE Chinese_PRC_CI_AS,
- Email,
- NULL Gender,
- NULL Mobile
- FROM Resume_Xinxi WITH(NOLOCK INDEX(IX_Resume_Xinxi_UserNameLower))
- WHERE UserNameLower = @Username
- IF NOT EXISTS(SELECT 'x' FROM @t)
- GOTO Err3
- END
- ELSE IF LEN(ISNULL(@Email, '')) > 0 ----查询paMain.Email
- BEGIN
- INSERT INTO @t(ID, Name, UserName, Email, Gender, Mobile)
- SELECT top 10 ID,
- ISNULL(ISNULL(Name, NameEng), UserName) Name,
- Username,
- Email,
- CASE Gender WHEN 0 THEN '先生' WHEN 1 THEN '女士' ELSE NULL END Gender,
- Mobile
- FROM paMain WITH(NOLOCK INDEX(IX_paMain_Email))
- WHERE Email = @Email
- --IF (SELECT COUNT(*) FROM @t) > 0 --有值则返回
- -- GOTO Retu
- INSERT INTO @t(ID, Name, UserName, Email, Gender, Mobile)
- SELECT 0 ID,
- Username Name,
- Username,
- Email,
- NULL Gender,
- NULL Mobile
- FROM Resume_Xinxi WITH(NOLOCK INDEX(IX_Resume_Xinxi_Email))
- WHERE Email = @Email
- IF NOT EXISTS(SELECT 'x' FROM @t)
- GOTO Err3
- END
- END
- Retu: ----正确返回,有数据
- BEGIN
- DECLARE @AskNo AS VARCHAR(40),@ActivateCode AS VARCHAR(6)
- SELECT @AskNo = REPLACE(NEWID(), '-', ''), @ActivateCode = RAND() * 899999 + 100000
-
- UPDATE @t SET ReturnType = @Type, UniqueId = REPLACE(NEWID(), '-', ''), ActivateCode = @ActivateCode, AskNo=@AskNo ----修改返回类型,用于前台显示结果
- ----记录取回纪录
- INSERT INTO PaGetPasswordLog(paMainID, UserNameIn, EmailIn, VerifyCode, IP, UserName, Email, Mobile,UniqueId,ActivateCode,AskNo)
- SELECT ID, @UserName, @Email, @VerifyCode, @IP, UserName, Email, Mobile,UniqueId, ActivateCode,@AskNo FROM @t
- IF @Type = 'Mobile'
- BEGIN
- DECLARE @curUserName AS VARCHAR(50),@curActivateCode AS VARCHAR(10),@Msg AS VARCHAR(200),@Index AS INT
- INSERT SmsMessageLog(SendMan, ManagerUSerId, paMainId, caMainId, Mobile, MsgType, IsCat, Msg)
- SELECT TOP 1 0, NULL, a.ID, NULL, a.Mobile, 104, 0,
- '您好,您在' + REPLACE(@SubSiteName, 'http://', '') + '的激活码是:' + d.ActivateCode
- FROM paMain a WITH(NOLOCK), (SELECT TOP 1 ID, ActivateCode FROM @t ORDER BY ID DESC) d
- WHERE a.ID = d.Id
- AND a.Mobile > ''
- ORDER BY ID DESC
- END
- UPDATE @t SET ReturnType = @Type ----修改返回类型,用于前台显示结果
- SELECT * FROM @t ORDER BY ID DESC
- RETURN
- END
- Err1: ----一个账号一天取回超过5次
- BEGIN
- SELECT null ID, NULL Name, NULL Username, NULL Email, NULL Gender, NULL Mobile, 1 ReturnType
- RETURN
- END
- Err2: ----一个ip一天取回超过20次
- BEGIN
- SELECT null ID, NULL Name, NULL Username, NULL Email, NULL Gender, NULL Mobile, 2 ReturnType
- RETURN
- END
- Err3: ----没有取回数据
- BEGIN
- SELECT null ID, NULL Name, NULL Username, NULL Email, NULL Gender, NULL Mobile, 3 ReturnType
- RETURN
- END
- Err4: ----手机号一天取回超过3次
- BEGIN
- SELECT null ID, NULL Name, NULL Username, NULL Email, NULL Gender, NULL Mobile, 4 ReturnType
- RETURN
- END
- GO
- /****** Object: StoredProcedure [dbo].[pcPaMainByGetPasswordSelectNew] Script Date: 2018/12/13 19:08:56 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- CREATE PROCEDURE [dbo].[pcPaMainByGetPasswordSelectNew]
- (
- @Username VARCHAR(50),
- @Email VARCHAR(50),
- @Mobile VARCHAR(11),
- @IP VARCHAR(15),
- @VerifyCode VARCHAR(10),
- @SubSiteName VARCHAR(40),
- @txtRealName NVARCHAR(10)
- )
- AS
- BEGIN
- DECLARE @Cnt AS INT, @Type AS VARCHAR(10), @ToDay AS DATETIME, @QueryMobile AS INT
- ----如果用户名、邮箱、手机号都为空则返回
- IF LEN(ISNULL(@Username, '')) = 0 AND LEN(ISNULL(@Email, '')) = 0 AND LEN(ISNULL(@Mobile, '')) = 0
- GOTO Err3
- --SET @Mobile = ''
- ----@t是返回结果临时表
- DECLARE @t AS TABLE(
- ID INT,
- Name NVARCHAR(50) NOT NULL,
- UserName VARCHAR(50) NOT NULL,
- Email VARCHAR(50) NOT NULL,
- Gender NVARCHAR(10),
- Mobile VARCHAR(13),
- ReturnType VARCHAR(10),
- UniqueId VARCHAR(40),
- ActivateCode VARCHAR(6),
- AskNo VARCHAR(40)
- )
- SELECT @Type = 'Email', @QueryMobile = 0
- IF dbo.IsMobile(@Mobile) = 1 ----手机号是否合法
- BEGIN
- SET @QueryMobile = 1 ----手机号合法,则优先使用手机查询
- ----一天内手机取回密码次数
- SELECT @Cnt = COUNT(DISTINCT AskNo) FROM paGetPasswordLog WITH(NOLOCK) WHERE Mobile = @Mobile AND AddDate > GETDATE() - 1
- IF @Cnt >= 3 ----总数=0,按手机号取回
- GOTO Err4
-
- SET @Type = 'Mobile'
- END
- IF @Type = 'Email' ----按油箱、用户名取回次数
- BEGIN
- SET @ToDay = CONVERT(DATETIME, CONVERT(VARCHAR(8), GETDATE(), 112))
- IF LEN(ISNULL(@Username, '')) > 0 ----用户名
- BEGIN
- SELECT @Cnt = COUNT(1) FROM paGetPasswordLog WITH(NOLOCK) WHERE Username = @Username AND AddDate > @Today
- SET @Type='Username'
- END
- ELSE ----其次Email
- SELECT @Cnt = COUNT(1) FROM paGetPasswordLog WITH(NOLOCK) WHERE Email = @Email AND AddDate > @Today
- IF @Cnt > 4 ----一天之内一个账号最多取回5次
- GOTO Err1
- SELECT @Cnt = COUNT(1) FROM paGetPasswordLog WITH(NOLOCK) WHERE IP = @IP AND AddDate >= @Today
- IF @Cnt > 20 ----一天之内一个ip不能超过20次,很多手机是一个ip,所以不管手机了
- GOTO Err2
- END
- SELECT @Cnt = 0
- IF @QueryMobile = 1 ----按照手机号查询
- BEGIN
- INSERT INTO @t(ID, Name, UserName, Email, Gender, Mobile)
- SELECT TOP 10 ID,
- ISNULL(ISNULL(CONVERT(VARCHAR(50), Name), CONVERT(VARCHAR(50), NameEng)), UserName) Name,
- Username,
- Email,
- CASE Gender WHEN 0 THEN '先生' WHEN 1 THEN '女士' ELSE NULL END Gender,
- Mobile
- FROM paMain WITH(NOLOCK INDEX(IX_PaMain_Mobile))
- WHERE Mobile = @Mobile
- AND MobileVerifyDate IS NOT NULL
- ORDER BY Lastlogindate DESC
- IF NOT EXISTS(SELECT 'x' FROM @t)
- GOTO Err3
- IF LEN(ISNULL(@txtRealName, '')) > 0
- BEGIN
- IF NOT EXISTS(SELECT 'x' FROM @t WHERE Name = @txtRealName) --姓名不一致
- BEGIN
- GOTO Err5
- END
- ELSE
- BEGIN
- DELETE FROM @t WHERE Name <> @txtRealName --手机号取回的 需要姓名一致
- END
- END
- END
- ELSE IF LEN(ISNULL(@Username, '')) > 0 --如果有用户名则以用户名为主
- BEGIN
- SET @Type='Username'
- --先查询paMain.UserName = @UserName 区分大小写
- INSERT INTO @t(ID, Name, UserName, Email, Gender, Mobile)
- SELECT TOP 1 ID,
- ISNULL(ISNULL(CONVERT(VARCHAR(50), Name), CONVERT(VARCHAR(50), NameEng)), UserName) COLLATE Chinese_PRC_CI_AS Name,
- Username COLLATE Chinese_PRC_CI_AS,
- Email,
- CASE Gender WHEN 0 THEN '先生' WHEN 1 THEN '女士' ELSE NULL END Gender,
- Mobile
- FROM paMain WITH(NOLOCK INDEX(IX_PaMain_UserName))
- WHERE UserName = @Username
- IF (SELECT COUNT(*) FROM @t) > 0 --有值则返回
- GOTO Retu
- INSERT INTO @t(ID, Name, UserName, Email, Gender, Mobile)
- SELECT top 1 0 ID,
- Username COLLATE Chinese_PRC_CI_AS Name,
- Username COLLATE Chinese_PRC_CI_AS,
- Email,
- NULL Gender,
- NULL Mobile
- FROM Resume_Xinxi WITH(NOLOCK INDEX(IX_Resume_Xinxi_UserName))
- WHERE UserName = @Username
- IF (SELECT COUNT(*) FROM @t) > 0 --有值则返回
- GOTO Retu
- --先查询paMain.UserName = @UserName 不区分大小写
- INSERT INTO @t(ID, Name, UserName, Email, Gender, Mobile)
- SELECT TOP 1 ID,
- ISNULL(ISNULL(CONVERT(VARCHAR(50), Name), CONVERT(VARCHAR(50), NameEng)), UserName) COLLATE Chinese_PRC_CI_AS Name,
- Username COLLATE Chinese_PRC_CI_AS,
- Email,
- CASE Gender WHEN 0 THEN '先生' WHEN 1 THEN '女士' ELSE NULL END Gender,
- Mobile
- FROM paMain WITH(NOLOCK INDEX(IX_PaMain_UserNameLower))
- WHERE UserNameLower = @Username
- ORDER BY Lastlogindate DESC
- IF (SELECT COUNT(*) FROM @t) > 0 --有值则返回
- GOTO Retu
- INSERT INTO @t(ID, Name, UserName, Email, Gender, Mobile)
- SELECT top 1 0 ID,
- Username COLLATE Chinese_PRC_CI_AS Name,
- Username COLLATE Chinese_PRC_CI_AS,
- Email,
- NULL Gender,
- NULL Mobile
- FROM Resume_Xinxi WITH(NOLOCK INDEX(IX_Resume_Xinxi_UserNameLower))
- WHERE UserNameLower = @Username
- IF NOT EXISTS(SELECT 'x' FROM @t)
- GOTO Err3
- END
- ELSE IF LEN(ISNULL(@Email, '')) > 0 ----查询paMain.Email
- BEGIN
- INSERT INTO @t(ID, Name, UserName, Email, Gender, Mobile)
- SELECT top 10 ID,
- ISNULL(ISNULL(Name, NameEng), UserName) Name,
- Username,
- Email,
- CASE Gender WHEN 0 THEN '先生' WHEN 1 THEN '女士' ELSE NULL END Gender,
- Mobile
- FROM paMain WITH(NOLOCK INDEX(IX_paMain_Email))
- WHERE Email = @Email
- --IF (SELECT COUNT(*) FROM @t) > 0 --有值则返回
- -- GOTO Retu
- INSERT INTO @t(ID, Name, UserName, Email, Gender, Mobile)
- SELECT 0 ID,
- Username Name,
- Username,
- Email,
- NULL Gender,
- NULL Mobile
- FROM Resume_Xinxi WITH(NOLOCK INDEX(IX_Resume_Xinxi_Email))
- WHERE Email = @Email
- IF NOT EXISTS(SELECT 'x' FROM @t)
- GOTO Err3
- END
- END
- Retu: ----正确返回,有数据
- BEGIN
- DECLARE @AskNo AS VARCHAR(40),@ActivateCode AS VARCHAR(6)
- SELECT @AskNo = REPLACE(NEWID(), '-', ''), @ActivateCode = RAND() * 899999 + 100000
-
- UPDATE @t SET ReturnType = @Type, UniqueId = REPLACE(NEWID(), '-', ''), ActivateCode = @ActivateCode, AskNo=@AskNo ----修改返回类型,用于前台显示结果
- ----记录取回纪录
- INSERT INTO PaGetPasswordLog(paMainID, UserNameIn, EmailIn, VerifyCode, IP, UserName, Email, Mobile,UniqueId,ActivateCode,AskNo)
- SELECT ID, @UserName, @Email, @VerifyCode, @IP, UserName, Email, Mobile,UniqueId, ActivateCode,@AskNo FROM @t
- IF @Type = 'Mobile'
- BEGIN
- DECLARE @curUserName AS VARCHAR(50),@curActivateCode AS VARCHAR(10),@Msg AS VARCHAR(200),@Index AS INT
- INSERT SmsMessageLog(SendMan, ManagerUSerId, paMainId, caMainId, Mobile, MsgType, IsCat, Msg)
- SELECT TOP 1 0, NULL, a.ID, NULL, a.Mobile, 104, 0,
- '您好,您在' + REPLACE(@SubSiteName, 'http://', '') + '的激活码是:' + d.ActivateCode
- FROM paMain a WITH(NOLOCK), (SELECT TOP 1 ID, ActivateCode FROM @t ORDER BY ID DESC) d
- WHERE a.ID = d.Id
- AND a.Mobile > ''
- ORDER BY ID DESC
- END
- UPDATE @t SET ReturnType = @Type ----修改返回类型,用于前台显示结果
- SELECT * FROM @t ORDER BY ID DESC
- RETURN
- END
- Err1: ----一个账号一天取回超过5次
- BEGIN
- SELECT null ID, NULL Name, NULL Username, NULL Email, NULL Gender, NULL Mobile, 1 ReturnType
- RETURN
- END
- Err2: ----一个ip一天取回超过20次
- BEGIN
- SELECT null ID, NULL Name, NULL Username, NULL Email, NULL Gender, NULL Mobile, 2 ReturnType
- RETURN
- END
- Err3: ----没有取回数据
- BEGIN
- SELECT null ID, NULL Name, NULL Username, NULL Email, NULL Gender, NULL Mobile, 3 ReturnType
- RETURN
- END
- Err4: ----手机号一天取回超过3次
- BEGIN
- SELECT null ID, NULL Name, NULL Username, NULL Email, NULL Gender, NULL Mobile, 4 ReturnType
- RETURN
- END
- Err5: ----认证手机号 姓名对应出现问题
- BEGIN
- SELECT null ID, NULL Name, NULL Username, NULL Email, NULL Gender, NULL Mobile, 5 ReturnType
- RETURN
- END
- GO
- /****** Object: StoredProcedure [dbo].[pcPaMainByGetPasswordSelectNew1] Script Date: 2018/12/13 19:08:57 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- --个人取回密码
- --harry
- --2018-4-27
- --修改短信激活码为实时发送
- CREATE PROCEDURE [dbo].[pcPaMainByGetPasswordSelectNew1]
- (
- @Username VARCHAR(50),
- @Email VARCHAR(50),
- @Mobile VARCHAR(11),
- @IP VARCHAR(15),
- @VerifyCode VARCHAR(10),
- @SubSiteName VARCHAR(40),
- @txtRealName NVARCHAR(10)
- )
- AS
- BEGIN
- DECLARE @Cnt AS INT, @Type AS VARCHAR(10), @ToDay AS DATETIME, @QueryMobile AS INT
- ----如果用户名、邮箱、手机号都为空则返回
- IF LEN(ISNULL(@Username, '')) = 0 AND LEN(ISNULL(@Email, '')) = 0 AND LEN(ISNULL(@Mobile, '')) = 0
- GOTO Err3
- --SET @Mobile = ''
- ----@t是返回结果临时表
- DECLARE @t AS TABLE(
- ID INT,
- Name NVARCHAR(50) NOT NULL,
- UserName VARCHAR(50) NOT NULL,
- Email VARCHAR(50) NOT NULL,
- Gender NVARCHAR(10),
- Mobile VARCHAR(13),
- ReturnType VARCHAR(10),
- UniqueId VARCHAR(40),
- ActivateCode VARCHAR(6),
- AskNo VARCHAR(40)
- )
- SELECT @Type = 'Email', @QueryMobile = 0
- IF dbo.IsMobile(@Mobile) = 1 ----手机号是否合法
- BEGIN
- SET @QueryMobile = 1 ----手机号合法,则优先使用手机查询
- ----一天内手机取回密码次数
- SELECT @Cnt = COUNT(DISTINCT AskNo) FROM paGetPasswordLog WITH(NOLOCK) WHERE Mobile = @Mobile AND AddDate > GETDATE() - 1
- IF @Cnt >= 3 ----总数=0,按手机号取回
- GOTO Err4
-
- SET @Type = 'Mobile'
- END
- IF @Type = 'Email' ----按油箱、用户名取回次数
- BEGIN
- SET @ToDay = CONVERT(DATETIME, CONVERT(VARCHAR(8), GETDATE(), 112))
- IF LEN(ISNULL(@Username, '')) > 0 ----用户名
- BEGIN
- SELECT @Cnt = COUNT(1) FROM paGetPasswordLog WITH(NOLOCK) WHERE Username = @Username AND AddDate > @Today
- SET @Type='Username'
- END
- ELSE ----其次Email
- SELECT @Cnt = COUNT(1) FROM paGetPasswordLog WITH(NOLOCK) WHERE Email = @Email AND AddDate > @Today
- IF @Cnt > 4 ----一天之内一个账号最多取回5次
- GOTO Err1
- SELECT @Cnt = COUNT(1) FROM paGetPasswordLog WITH(NOLOCK) WHERE IP = @IP AND AddDate >= @Today
- IF @Cnt > 20 ----一天之内一个ip不能超过20次,很多手机是一个ip,所以不管手机了
- GOTO Err2
- END
- SELECT @Cnt = 0
- IF @QueryMobile = 1 ----按照手机号查询
- BEGIN
- INSERT INTO @t(ID, Name, UserName, Email, Gender, Mobile)
- SELECT TOP 10 ID,
- ISNULL(ISNULL(CONVERT(VARCHAR(50), Name), CONVERT(VARCHAR(50), NameEng)), UserName) Name,
- Username,
- Email,
- CASE Gender WHEN 0 THEN '先生' WHEN 1 THEN '女士' ELSE NULL END Gender,
- Mobile
- FROM paMain WITH(NOLOCK INDEX(IX_PaMain_Mobile))
- WHERE Mobile = @Mobile
- AND MobileVerifyDate IS NOT NULL
- ORDER BY Lastlogindate DESC
- IF NOT EXISTS(SELECT 'x' FROM @t)
- GOTO Err3
- IF LEN(ISNULL(@txtRealName, '')) > 0
- BEGIN
- IF NOT EXISTS(SELECT 'x' FROM @t WHERE Name = @txtRealName) --姓名不一致
- BEGIN
- GOTO Err5
- END
- ELSE
- BEGIN
- DELETE FROM @t WHERE Name <> @txtRealName --手机号取回的 需要姓名一致
- END
- END
- END
- ELSE IF LEN(ISNULL(@Username, '')) > 0 --如果有用户名则以用户名为主
- BEGIN
- SET @Type='Username'
- --先查询paMain.UserName = @UserName 区分大小写
- INSERT INTO @t(ID, Name, UserName, Email, Gender, Mobile)
- SELECT TOP 1 ID,
- ISNULL(ISNULL(CONVERT(VARCHAR(50), Name), CONVERT(VARCHAR(50), NameEng)), UserName) COLLATE Chinese_PRC_CI_AS Name,
- Username COLLATE Chinese_PRC_CI_AS,
- Email,
- CASE Gender WHEN 0 THEN '先生' WHEN 1 THEN '女士' ELSE NULL END Gender,
- Mobile
- FROM paMain WITH(NOLOCK INDEX(IX_PaMain_UserName))
- WHERE UserName = @Username
- IF (SELECT COUNT(*) FROM @t) > 0 --有值则返回
- GOTO Retu
- INSERT INTO @t(ID, Name, UserName, Email, Gender, Mobile)
- SELECT top 1 0 ID,
- Username COLLATE Chinese_PRC_CI_AS Name,
- Username COLLATE Chinese_PRC_CI_AS,
- Email,
- NULL Gender,
- NULL Mobile
- FROM Resume_Xinxi WITH(NOLOCK INDEX(IX_Resume_Xinxi_UserName))
- WHERE UserName = @Username
- IF (SELECT COUNT(*) FROM @t) > 0 --有值则返回
- GOTO Retu
- --先查询paMain.UserName = @UserName 不区分大小写
- INSERT INTO @t(ID, Name, UserName, Email, Gender, Mobile)
- SELECT TOP 1 ID,
- ISNULL(ISNULL(CONVERT(VARCHAR(50), Name), CONVERT(VARCHAR(50), NameEng)), UserName) COLLATE Chinese_PRC_CI_AS Name,
- Username COLLATE Chinese_PRC_CI_AS,
- Email,
- CASE Gender WHEN 0 THEN '先生' WHEN 1 THEN '女士' ELSE NULL END Gender,
- Mobile
- FROM paMain WITH(NOLOCK INDEX(IX_PaMain_UserNameLower))
- WHERE UserNameLower = @Username
- ORDER BY Lastlogindate DESC
- IF (SELECT COUNT(*) FROM @t) > 0 --有值则返回
- GOTO Retu
- INSERT INTO @t(ID, Name, UserName, Email, Gender, Mobile)
- SELECT top 1 0 ID,
- Username COLLATE Chinese_PRC_CI_AS Name,
- Username COLLATE Chinese_PRC_CI_AS,
- Email,
- NULL Gender,
- NULL Mobile
- FROM Resume_Xinxi WITH(NOLOCK INDEX(IX_Resume_Xinxi_UserNameLower))
- WHERE UserNameLower = @Username
- IF NOT EXISTS(SELECT 'x' FROM @t)
- GOTO Err3
- END
- ELSE IF LEN(ISNULL(@Email, '')) > 0 ----查询paMain.Email
- BEGIN
- INSERT INTO @t(ID, Name, UserName, Email, Gender, Mobile)
- SELECT top 10 ID,
- ISNULL(ISNULL(Name, NameEng), UserName) Name,
- Username,
- Email,
- CASE Gender WHEN 0 THEN '先生' WHEN 1 THEN '女士' ELSE NULL END Gender,
- Mobile
- FROM paMain WITH(NOLOCK INDEX(IX_paMain_Email))
- WHERE Email = @Email
- --IF (SELECT COUNT(*) FROM @t) > 0 --有值则返回
- -- GOTO Retu
- INSERT INTO @t(ID, Name, UserName, Email, Gender, Mobile)
- SELECT 0 ID,
- Username Name,
- Username,
- Email,
- NULL Gender,
- NULL Mobile
- FROM Resume_Xinxi WITH(NOLOCK INDEX(IX_Resume_Xinxi_Email))
- WHERE Email = @Email
- IF NOT EXISTS(SELECT 'x' FROM @t)
- GOTO Err3
- END
- END
- Retu: ----正确返回,有数据
- BEGIN
- DECLARE @AskNo AS VARCHAR(40),@ActivateCode AS VARCHAR(6)
- SELECT @AskNo = REPLACE(NEWID(), '-', ''), @ActivateCode = RAND() * 899999 + 100000
-
- UPDATE @t SET ReturnType = @Type, UniqueId = REPLACE(NEWID(), '-', ''), ActivateCode = @ActivateCode, AskNo=@AskNo ----修改返回类型,用于前台显示结果
- ----记录取回纪录
- INSERT INTO PaGetPasswordLog(paMainID, UserNameIn, EmailIn, VerifyCode, IP, UserName, Email, Mobile,UniqueId,ActivateCode,AskNo)
- SELECT ID, @UserName, @Email, @VerifyCode, @IP, UserName, Email, Mobile,UniqueId, ActivateCode,@AskNo FROM @t
-
- UPDATE @t SET ReturnType = @Type ----修改返回类型,用于前台显示结果
- SELECT * FROM @t ORDER BY ID DESC
- IF @Type = 'Mobile'
- BEGIN
- SELECT TOP 1 a.ID AS paMainId, a.Mobile, 104 AS MsgType,
- '您好,您在' + REPLACE(@SubSiteName, 'http://', '') + '的激活码是:' + d.ActivateCode AS Msg
- FROM paMain a WITH(NOLOCK), (SELECT TOP 1 ID, ActivateCode FROM @t ORDER BY ID DESC) d
- WHERE a.ID = d.Id
- AND a.Mobile > ''
- ORDER BY a.ID DESC
- END
- RETURN
- END
- Err1: ----一个账号一天取回超过5次
- BEGIN
- SELECT null ID, NULL Name, NULL Username, NULL Email, NULL Gender, NULL Mobile, 1 ReturnType
- RETURN
- END
- Err2: ----一个ip一天取回超过20次
- BEGIN
- SELECT null ID, NULL Name, NULL Username, NULL Email, NULL Gender, NULL Mobile, 2 ReturnType
- RETURN
- END
- Err3: ----没有取回数据
- BEGIN
- SELECT null ID, NULL Name, NULL Username, NULL Email, NULL Gender, NULL Mobile, 3 ReturnType
- RETURN
- END
- Err4: ----手机号一天取回超过3次
- BEGIN
- SELECT null ID, NULL Name, NULL Username, NULL Email, NULL Gender, NULL Mobile, 4 ReturnType
- RETURN
- END
- Err5: ----认证手机号 姓名对应出现问题
- BEGIN
- SELECT null ID, NULL Name, NULL Username, NULL Email, NULL Gender, NULL Mobile, 5 ReturnType
- RETURN
- END
- GO
- /****** Object: StoredProcedure [dbo].[pcPaMainByHideConditionsDelete] Script Date: 2018/12/13 19:08:57 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- --=============================================
- -- 创建: sean
- -- 检查: 2010-10-6
- -- 说明: 隐藏条件删除
- --=============================================
- CREATE PROCEDURE [dbo].[pcPaMainByHideConditionsDelete]
- @ID INT,
- @Shield NVARCHAR(60),
- @IP VARCHAR(30)
- AS
- BEGIN TRY
- DECLARE @HideConditions AS NVARCHAR(500)
- SELECT @HideConditions = ISNULL(HideConditions, '') FROM PaMain WITH(NOLOCK) WHERE ID = @ID
- SET @Shield = '<' + @Shield + '>'
- IF CHARINDEX(@Shield, @HideConditions) = 0
- RETURN 2
- ELSE
- BEGIN
- SET @HideConditions = Replace(@HideConditions, @Shield, '')
- IF @HideConditions = ''
- SET @HideConditions = NULL
- UPDATE PaMain SET HideConditions = @HideConditions WHERE ID=@ID
- INSERT INTO paOperationLog (paMainID,Operation,Details,IP)
- VALUES(@ID,50,'更新屏蔽设置成功。',@IP)
- RETURN 1
- END
- END TRY
- BEGIN CATCH
- RETURN 0
- END CATCH
- GO
- /****** Object: StoredProcedure [dbo].[pcPaMainByHideConditionsSelect] Script Date: 2018/12/13 19:08:57 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- --=============================================
- -- 创建: sean
- -- 检查: 2010-10-6
- -- 说明: 隐藏条件提取
- --=============================================
- CREATE PROCEDURE [dbo].[pcPaMainByHideConditionsSelect]
- @ID INT,
- @HideConditions NVARCHAR(500) OUTPUT
- AS
- SELECT @HideConditions = ISNULL(HideConditions, '') FROM PaMain WITH(NOLOCK INDEX(PK_paMain)) WHERE ID = @ID
- GO
- /****** Object: StoredProcedure [dbo].[pcPaMainByHideConditionsUpdate] Script Date: 2018/12/13 19:08:58 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- ----------------------------------------
- --返回值:
- -- 4 超过100条数据
- -- 3超长
- -- 2已经存在
- -- 0保存出错
- -- 1保存正确
- ----------------------------------------
- CREATE PROCEDURE [dbo].[pcPaMainByHideConditionsUpdate]
- @ID INT,
- @Shield NVARCHAR(60),
- @IP VARCHAR(30)
- AS
- BEGIN TRY
- DECLARE @HideConditions AS NVARCHAR(500)
- SELECT @HideConditions = ISNULL(HideConditions, '') FROM PaMain WITH(NOLOCK) WHERE ID = @ID
- SET @Shield = '<' + @Shield + '>'
- IF CHARINDEX(@Shield, @HideConditions) > 0
- RETURN 2
- ELSE
- IF LEN(@HideConditions+@Shield)>500
- RETURN 3
- --判断已经插入了多少数据
- DECLARE @temp AS NVARCHAR(500)
- SET @temp=@HideConditions
- IF len(@temp)-len(replace(@temp,'<',''))>100
- BEGIN
- RETURN 4
- END
- BEGIN
-
-
- SET @HideConditions = @Shield + @HideConditions
- UPDATE PaMain SET HideConditions = @HideConditions WHERE ID=@ID
- INSERT INTO paOperationLog (paMainID,Operation,Details,IP)
- VALUES(@ID,50,'更新屏蔽设置成功。',@IP)
- RETURN 1
- END
- END TRY
- BEGIN CATCH
- RETURN 0
- END CATCH
- GO
- /****** Object: StoredProcedure [dbo].[pcPaMainByIDSelect] Script Date: 2018/12/13 19:08:58 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- --#####################################################
- --创建时间:2014.11.4
- --创建人:John
- --说明:根据id获取PaMain
- --#####################################################
- CREATE PROCEDURE [dbo].[pcPaMainByIDSelect]
- (
- @ID INT
- )
- AS
- BEGIN
- SELECT TOP 1 * FROM paMain WITH(NOLOCK) WHERE id=@ID
- END
- GO
- /****** Object: StoredProcedure [dbo].[pcpaMainByIDUpdate] Script Date: 2018/12/13 19:08:58 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- --------------------------------------------------
- --修改:Nick
- --修改日期:2106-3-17
- --根据百度修改pamain
- --------------------------------------------------
- create PROCEDURE [dbo].[pcpaMainByIDUpdate]
- (
- @ID INT,
- @Name VARCHAR(50),
- @Mobile VARCHAR(11),
- @BirthDay INT,
- @LivePlace VARCHAR(6),
- @AccountPlace VARCHAR(6),
- @GrowPlace VARCHAR(6),
- @Gender BIT
- )
- AS
- BEGIN
- UPDATE PaMain
- SET Name = @Name,
- BirthDay = @BirthDay,
- Mobile = @Mobile,
- LivePlace = @LivePlace,
- AccountPlace = @AccountPlace,
- GrowPlace = @GrowPlace,
- Gender = @Gender
- WHERE ID = @ID
- END
- GO
- /****** Object: StoredProcedure [dbo].[pcPaMainByImportUpdate] Script Date: 2018/12/13 19:08:58 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- -- =============================================
- -- Author: Sean
- -- Check date: 2013-6-21
- -- Description: 修改账号信息,cvMainID为0时不修改cvmain信息 Mobile Can be null.
- -- Data imported from zhaopin.com,51job.com
- --修改harry 2018-7-5 处理liveplace等
- -- =============================================
- CREATE PROCEDURE [dbo].[pcPaMainByImportUpdate]
- (
- @Type INT,
- @paMainID INT,
- @cvMainID INT,
- @Name VARCHAR(30),
- @Gender BIT,
- @BirthDay INT,
- @LivePlace VARCHAR(6),
- @AccountPlace VARCHAR(6),
- @GrowPlace VARCHAR(6),
- @Mobile VARCHAR(13),
- @OnlineContact TINYINT,
- @OnlineContactNo VARCHAR(50),
- @Homepage VARCHAR(200),
- @Marriage TINYINT,
- @Nation TINYINT,
- @Height TINYINT,
- @dcCareerStatus TINYINT,
- @IP VARCHAR(39)
- )
- AS
- IF ISNULL(@paMainID, 0) = 0
- RETURN -1
- IF dbo.TrimNULL(@Name) IS NULL
- RETURN -1
- --IF dbo.TrimNULL(@Mobile) IS NULL
- -- RETURN -1
- IF @Marriage = 0
- SET @Marriage = NULL
- IF @Height = 0
- SET @Height = NULL
- IF EXISTS(SELECT 'x' FROM Person_BLACK WITH(NOLOCK) WHERE Mobile = @Mobile AND Mobile > '')
- BEGIN
- ----有黑名单,则增加拒绝次数
- UPDATE Person_Black SET RefuseCount = RefuseCount + 1 WHERE Mobile = @Mobile
- RETURN -1
- END
- BEGIN TRAN
- BEGIN TRY
- IF CHARINDEX(' ', @LivePlace) >2
- BEGIN
- SET @LivePlace=substring(@LivePlace,1,charindex(' ',@LivePlace)-1)
- END
- IF CHARINDEX(' ', @AccountPlace) >2
- BEGIN
- SET @AccountPlace=substring(@AccountPlace,1,charindex(' ',@AccountPlace)-1)
- END
- IF CHARINDEX(' ', @GrowPlace) >2
- BEGIN
- SET @GrowPlace=substring(@GrowPlace,1,charindex(' ',@GrowPlace)-1)
- END
-
-
- DECLARE @NameEngOld AS VARCHAR(30)
- DECLARE @NameOld AS VARCHAR(12)
- DECLARE @OnlineContactNoOld AS VARCHAR(50)
- DECLARE @HomepageOld AS VARCHAR(200)
- DECLARE @MobileOld AS VARCHAR(13)
- DECLARE @Modify AS INT
- -- @Modify=-1未修改需审核项, @Modify=0修改中文项目; @Modify=1修改了英文项目
- SET @Modify=-1
- --检查在线联系方式和号码
- IF @OnlineContact IS NULL
- SET @OnlineContactNo = ''
- ELSE
- SET @OnlineContactNo = dbo.SafeSQL(@OnlineContactNo)
- --取消不正确的主页格式
- SET @Homepage=REPLACE(@Homepage,'http%3A//','http://')
- SET @Homepage=REPLACE(@Homepage,'http://','')
- IF LTRIM(RTRIM(@Homepage)) = 'http://'
- SET @Homepage = null
- IF ISNULL(@Homepage, '') = ''
- SET @Homepage = null
- IF ISNULL(@OnlineContactNo, '') = ''
- SET @OnlineContactNo = null
- --获得原始数据
- SELECT @NameOld=Name,@NameEngOld=NameEng,@OnlineContactNoOld=OnlineContactNo,@HomepageOld=Homepage,@MobileOld=Mobile
- FROM paMain WITH(NOLOCK INDEX(PK_paMain))
- WHERE ID = @paMainID
- --0中文,1英文,只有姓名不同
- IF @TYPE=0
- BEGIN
- DECLARE @CNAME AS VARCHAR(12)
- SET @CNAME = @Name
- UPDATE paMain
- SET Name=@CNAME,
- Gender=@Gender,
- BirthDay=@BirthDay,
- LivePlace=@LivePlace,
- AccountPlace=@AccountPlace,
- GrowPlace=@GrowPlace,
- Mobile=@Mobile,
- OnlineContact=@OnlineContact,
- OnlineContactNo=@OnlineContactNo,
- Homepage=@Homepage,
- Marriage=@Marriage,
- Nation=@Nation,
- Height=@Height,
- --dcCareerStatus#@dcCareerStatus,
- LastModifyDate=GETDATE()
- WHERE ID=@paMainID
- END
- ELSE
- UPDATE paMain
- SET NameENG=@Name,
- Gender=@Gender,
- BirthDay=@BirthDay,
- LivePlace=@LivePlace,
- AccountPlace=@AccountPlace,
- GrowPlace=@GrowPlace,
- Mobile=@Mobile,
- OnlineContact=@OnlineContact,
- OnlineContactNo=@OnlineContactNo,
- Homepage=@Homepage,
- Marriage=@Marriage,
- Nation=@Nation,
- Height=@Height,
- --dcCareerStatus#@dcCareerStatus,
- LastModifyDate=GETDATE()
- WHERE ID=@paMainID
- --保存到bsCvModify,姓名
- IF @TYPE=0
- BEGIN
- IF ISNULL(@NameOld, '') <> @CNAME
- BEGIN
- DELETE FROM bsCvModify WHERE paMainID = @paMainID AND Location = 'ac1'
- INSERT INTO bsCvModify(paMainID,Location,ColValue) VALUES(@paMainID,'ac1',@CNAME)
- SET @Modify=0
- INSERT INTO paOperationLog (paMainID, Operation, Details, IP)
- VALUES(@paMainID, 30,'更新姓名,原姓名:<' + ISNULL(@NameOld, '') + '>;新姓名:<' + @CName + '>', @IP)
- END
- END
- ELSE
- IF ISNULL(@NameOld, '') <> @Name
- BEGIN
- DELETE FROM bsCvModify WHERE paMainID = @paMainID AND Location = 'ae1'
- INSERT INTO bsCvModify(paMainID,Location,ColValue) VALUES(@paMainID,'ae1',@CNAME)
- SET @Modify=1
- INSERT INTO paOperationLog (paMainID, Operation, Details, IP)
- VALUES(@paMainID, 31,'更新英文名,原英文名:<' + ISNULL(@NameOld, '') + '>;新英文名:<' + @Name + '>', @IP)
- END
- --在线联系号码
- IF @OnlineContactNo IS NULL
- DELETE FROM bsCvModify WHERE paMainID = @paMainID AND Location = 'ac2'
- ELSE
- IF @OnlineContactNo <> ISNULL(@OnlineContactNoOld, '')
- BEGIN
- DELETE FROM bsCvModify WHERE paMainID = @paMainID AND Location = 'ac2'
- INSERT INTO bsCvModify(paMainID,Location,ColValue) VALUES(@paMainID,'ac2',@OnlineContactNo)
- SET @Modify=0
- END
- --主页
- IF @Homepage IS NULL
- DELETE FROM bsCvModify WHERE paMainID = @paMainID AND Location = 'ac3'
- ELSE
- IF @Homepage <> ISNULL(@HomepageOld, '')
- BEGIN
- DELETE FROM bsCvModify WHERE paMainID = @paMainID AND Location = 'ac3'
- INSERT INTO bsCvModify(paMainID,Location,ColValue) VALUES(@paMainID,'ac3',@Homepage)
- SET @Modify=0
- END
- --手机号码
- IF ISNULL(@MobileOld, '') <> @Mobile
- BEGIN
- DELETE FROM bsCvModify WHERE paMainID = @paMainID AND Location = 'ac4'
- --INSERT INTO bsCvModify(paMainID,Location,ColValue) VALUES(@paMainID,'ac4',@Mobile)
- --SET @Modify=0
- INSERT INTO paOperationLog (paMainID, Operation, Details, IP)
- VALUES(@paMainID, 35,'更新手机号,原手机号:<' + ISNULL(@MobileOld, '') + '>;新手机号:<' + @Mobile + '>', @IP)
- END
-
- ----修改cvMain.cvLevel
- IF @TYPE=0
- BEGIN
- IF dbo.IsMobile(@Mobile) = 1
- UPDATE cvMain SET cvLevel='11' + RIGHT(cvLevel,8) WHERE paMainID = @paMainID
- ELSE
- UPDATE cvMain SET cvLevelEng='10' + RIGHT(cvLevelEng,8) WHERE paMainID = @paMainID
- END
- ELSE
- BEGIN
- IF dbo.IsMobile(@Mobile) = 1
- UPDATE cvMain SET cvLevel='11' + RIGHT(cvLevel,8) WHERE paMainID = @paMainID
- ELSE
- UPDATE cvMain SET cvLevelEng='10' + RIGHT(cvLevelEng,8) WHERE paMainID = @paMainID
- END
- --1小时内不重复刷新,防止刷新排名
- UPDATE cvmain SET RefreshDate = GETDATE() WHERE ID=@cvMainID AND DATEADD(HOUR, 1, RefreshDate) < GETDATE() AND paMainID = @paMainID
- ----12小时内只保留一次修改记录
- DELETE FROM paOperationLog WHERE paMainID=@paMainID AND Operation=11 AND AddDate>GETDATE()-0.5
- INSERT INTO paOperationLog (paMainID,Operation,Details,IP) VALUES(@paMainID,11,'更新基本信息成功。',@IP)
- END TRY
- BEGIN CATCH
- GOTO ERR
- END CATCH
- COMMIT TRAN
- RETURN 1
- ERR:
- BEGIN
- ROLLBACK TRAN
- RETURN 0
- END
- GO
- /****** Object: StoredProcedure [dbo].[pcPaMainByIsReceiveSmsUpdate] Script Date: 2018/12/13 19:08:59 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- -- =============================================
- -- Author: Sean
- -- Check date: 2010-9-17
- -- Description: 修改账号信息 ,cvMainID为0时不修改cvmain信息
- -- =============================================
- CREATE PROCEDURE [dbo].[pcPaMainByIsReceiveSmsUpdate]
- (
- @paMainID INT,
- @IsReceiveSms BIT,
- @IP VARCHAR(15)
- )
- AS
- IF ISNULL(@paMainID, 0) = 0
- RETURN -1
- BEGIN TRAN
- BEGIN TRY
- INSERT INTO paOperationLog (paMainID, Operation, Details, IP)
- VALUES(@paMainID, 60,'更改接收短信设置为' + CASE @IsReceiveSms WHEN 1 THEN '<接收短信>' ELSE '<不接收短信>' END, @IP)
- UPDATE paMain SET IsReceiveSMS = @IsReceiveSMS WHERE ID = @paMainId
- END TRY
- BEGIN CATCH
- GOTO ERR
- END CATCH
- COMMIT TRAN
- RETURN 1
- ERR:
- BEGIN
- ROLLBACK TRAN
- RETURN 0
- END
- GO
- /****** Object: StoredProcedure [dbo].[pcPaMainByIsUseYourFoodSelect] Script Date: 2018/12/13 19:08:59 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- CREATE PROCEDURE [dbo].[pcPaMainByIsUseYourFoodSelect]
- (
- @Id INT
- )
- AS
- SET NOCOUNT ON
- BEGIN
- IF EXISTS(SELECT 'x' FROM ShortDb..paActStatus WITH(NOLOCK) WHERE paMainId = @id AND ActStatus = 1 AND AddDate > DATEADD(MINUTe, -5, GETDATE()))
- IF EXISTS(SELECT 'x' FROM WxFans WITH(NOLOCK) WHERE paMainId = @id AND Status = 2)
- BEGIN
- DELETE ShortDb..paActStatus WHERE paMainId = @id AND ActStatus = 1 AND AddDate > DATEADD(MINUTe, -5, GETDATE())
- UPDATE paMain SET IsUseYourFood = 1 WHERE Id = @Id
- END
- SELECT 'x' FROM paMain WHERE Id = @Id AND IsUseYourFood = 1
- END
- GO
- /****** Object: StoredProcedure [dbo].[pcPaMainByIsUseYourFoodUpdate] Script Date: 2018/12/13 19:08:59 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- create PROCEDURE [dbo].[pcPaMainByIsUseYourFoodUpdate]
- (
- @Id INT,
- @State INT
- )
- AS
- BEGIN
- UPDATE paMain SET IsUseYourFood = @State WHERE Id = @Id
- END
- GO
- /****** Object: StoredProcedure [dbo].[PcpaMainByLastLoginDateCheckUpdate] Script Date: 2018/12/13 19:08:59 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- CREATE PROCEDURE [dbo].[PcpaMainByLastLoginDateCheckUpdate]
- (
- @PaMainId INT
- )
- AS
- SET NOCOUNT ON
- BEGIN
- IF NOT EXISTS(SELECT 'x' FROM paMain WITH(NOLOCK) WHERE id = @paMainId AND LastLoginDate > CONVERT(VARCHAR(10), GETDATE(), 120))
- UPDATE paMain SET LastLoginDate = GETDATE() WHERE Id = @paMAinId
- END
- GO
- /****** Object: StoredProcedure [dbo].[pcPaMainByLastLoginDateUpdate] Script Date: 2018/12/13 19:09:00 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- CREATE PROCEDURE [dbo].[pcPaMainByLastLoginDateUpdate]
- (
- @PaMainId INT,
- @dcSubSiteID INT,
- @Ip VARCHAR(31),
- @browser VARCHAR(500)
- )
- AS
- SET NOCOUNT ON
- BEGIN
- DECLARE @LoginFrom AS TINYINT
- IF LEFT(@Browser, 3) = 'fm='
- SELECT @LoginFrom = 42 --, @Browser = REPLACE(@Browser, 'ismobile:', '')
- ELSE IF LEFT(@Browser, 3) = 'fp=' AND @LoginFrom IS NULL
- SET @LoginFrom = 19
- ELSE
- SET @LoginFrom = 43 --1
- UPDATE PaMain Set LastLoginDate=GETDATE() WHERE ID = @PaMainId
- IF NOT EXISTS(SELECT 'x' FROM paLoginLog WITH(NOLOCK) WHERE paMainID = @PaMainId AND AddDate >= CONVERT(VARCHAR(10), GETDATE(), 120))
- BEGIN
- UPDATE DateReport
- SET PersonLoginNum_Net = PersonLoginNum_Net + 1
- WHERE CountDate = CONVERT(VARCHAR(8), GETDATE(), 112)
- AND Province_Id = @dcSubSiteID
- --INSERT INTO PaMainDateReport SELECT @PaMainId, 11, GETDATE() --sean 20130708
- INSERT INTO paLoginLog(paMainID, LoginIP, Browser, LoginFrom) VALUES(@PaMainId, @IP, ISNULL(@browser, 'Null'), @LoginFrom)
- END
- END
- GO
- /****** Object: StoredProcedure [dbo].[pcpaMainByLoginSELECT] Script Date: 2018/12/13 19:09:00 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- --lambo 20140904
- --个人登陆查询账号列表
- CREATE PROCEDURE [dbo].[pcpaMainByLoginSELECT]
- (
- @UserName VARCHAR(50)
- )
- AS
- SET NOCOUNT ON
- --INSERT INTO a1 SELECT @UserName, GETDATE()
- BEGIN
- DECLARE @T TABLE(
- ID INT,
- Password VARCHAR(60),
- UserName VARCHAR(50),
- UserNameLower VARCHAR(50),
- Mobile VARCHAR(13),
- LoginType TINYINT
- )
- IF dbo.ISMobile(@UserName)=1
- BEGIN
- INSERT INTO @T(ID, Password, UserName, UserNameLower, Mobile, LoginType)
- SELECT ID, Password, UserName, UserNameLower,Mobile,1
- FROM PaMain WITH(INDEX(IX_paMain_Mobile))
- WHERE Mobile = @UserName
- AND MobileVerifyDate IS NOT NULL
- END
- INSERT INTO @T(ID, Password, UserName, UserNameLower, Mobile, LoginType)
- SELECT ID, Password, UserName, UserNameLower,Mobile,2
- FROM PaMain WITH(NOLOCK)
- WHERE UserNameLower = @UserName
- SELECT * FROM @T
- END
- GO
- /****** Object: StoredProcedure [dbo].[pcpaMainByLoginUpdate] Script Date: 2018/12/13 19:09:00 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- --------------------------------------------------
- --修改:sean
- --修改日期:2010-9-15
- --说明:个人用户登陆 增加从Resume_Xinxi导数据的步骤
- --2010-12-27 sean 修改个人第一次登录时 注册时间改为信息员推广时间
- --密码加密后登录,2012-09-05修改 NIck
- --------------------------------------------------
- CREATE PROCEDURE [dbo].[pcpaMainByLoginUpdate]
- (
- @UserName VARCHAR(50),
- @PlainPassword VARCHAR(50),
- @Password VARCHAR(60),
- @IP VARCHAR(31),
- @dcSubSiteId SMALLINT,
- @AutoLogin TINYINT,
- @browser VARCHAR(500),
- @ID INT,
- @IDType INT
- )
- AS
- SET NOCOUNT ON
- BEGIN TRY
- BEGIN TRAN
- DECLARE
- @Resume_XinxiID AS INT,
- @AddMan AS INT,
- @AddDate AS DATETIME,
- @Email AS VARCHAR(50),
- @CountDate AS INT,
- @dcProvinceID AS TINYINT,
- @TotalLoginNum AS INT,
- @LastLoginDate AS SMALLDATETIME,
- @LoginFrom AS TINYINT,
- @PaType INT
- IF LEFT(@Browser, 9) = 'ismobile:'
- SELECT @LoginFrom = 5, @Browser = REPLACE(@Browser, 'ismobile:', '')
- ELSE
- SELECT @LoginFrom = 1, @Browser = '53:' + @Browser
- SET @UserName = REPLACE(@UserName, ' ', '')
- SELECT @CountDate = CONVERT(VARCHAR(8), GETDATE(), 112), @dcProvinceID = LEFT(@dcSubSiteId, 2)
- SET @PaType = @IDType
- BEGIN TRY
- IF @PaType = 3
- BEGIN
- SELECT @Resume_XinxiID = ID, @AddMan =AddMan, @AddDate = RegDate, @Email = Email
- FROM Resume_Xinxi WITH(NOLOCK INDEX(IX_Resume_Xinxi_UserName))
- WHERE UserName = @UserName AND Password = @PlainPassword
- IF @Resume_XinxiID IS NOT NULL
- SET @PaType = 2
- END
- ELSE IF @PaType=0
- BEGIN
- SELECT TOP 1 @Resume_XinxiID = ID, @AddMan =AddMan, @AddDate = RegDate, @Email = Email
- FROM Resume_Xinxi WITH(NOLOCK INDEX(IX_Resume_Xinxi_UserNameLower))
- WHERE UserNameLower = @UserName AND Password = @PlainPassword
- ORDER BY ID DESC
- IF @Resume_XinxiID IS NOT NULL
- SET @PaType = 4
- END
- IF @PaType = 0
- GOTO Err1
- IF @Resume_XinxiID > 0 ----账号在Resume_xinxi
- BEGIN
- --lucifer添加,添加新的注册模式
- DECLARE @RegisterFrom AS TINYINT
- SELECT @RegisterFrom = 1
- IF CHARINDEX('ios',LOWER(@browser)) > 0
- SELECT @RegisterFrom = 3
- ELSE IF CHARINDEX('android',LOWER(@browser)) > 0
- SELECT @RegisterFrom = 2
- --把数据从Resume_Xini转换到paMain
- INSERT INTO paMain(RegisterMode, AddMan, UserName, Password, Email, dcProvinceID, dcSubSiteId, RegisterIP, IsDefaultPassword, AddDate, RegisterFrom, RegisterType, SpreadDate)
- VALUES(1, @AddMan, @UserName, @Password, @Email, @dcProvinceID, @dcSubSiteId, @IP, 1, GETDATE(), @RegisterFrom, 101, @AddDate)
- SET @ID = @@IDENTITY
- INSERT INTO paOperationLog (paMainID, Operation, Details, IP) VALUES(@ID, 10, '导入个人账号成功。', @IP)
- --记录日报
- UPDATE DateReport SET ValidResume = ValidResume + 1
- WHERE province_id = @dcSubSiteID AND CountDate = @CountDate
- INSERT INTO pamainDatereport SELECT @ID, 9, GETDATE() -- SEAN 20130911
- --统计信息员注册数据
- SELECT TOP 1 CountDate
- FROM Info_Datereport WITH(NOLOCK)
- WHERE CountDate = @CountDate
- AND province_id = @dcProvinceID
- AND InfoManager_ID = @AddMan
- IF (@@ROWCOUNT=0)
- INSERT INTO Info_DateReport(province_id,infomanager_id,countdate)
- VALUES(@dcProvinceID, @AddMan, @CountDate)
-
- UPDATE Info_Datereport
- SET ValidResume=ValidResume + 1
- WHERE CountDate=@CountDate
- AND province_id=@dcProvinceID
- AND InfoManager_ID = @AddMan
- END
- --超过登陆次数,每天限制登录次数位20次
- IF (SELECT COUNT(1) FROM paLoginLog WITH(NOLOCK) WHERE paMainID = @ID AND AddDate > CONVERT(VARCHAR(10), GETDATE(), 120)) > 19
- GOTO ERR2
- --登陆日志
- SELECT @LastLoginDate = LastLoginDate, @TotalLoginNum = TotalLoginNum FROM paMain WITH(NOLOCK) WHERE ID = @Id
- IF CONVERT(VARCHAR(8), @LastLoginDate, 112) = CONVERT(VARCHAR(8), GETDATE(), 112) --今天已经登陆过
- BEGIN
- IF @AutoLogin = 0 --首页的自动登录不计算在每日登陆次数
- BEGIN
- IF NOT EXISTS(SELECT 'x' FROM paLoginLog WITH(NOLOCK) WHERE paMainID = @ID AND AddDate > CONVERT(VARCHAR(10), GETDATE(), 120))
- BEGIN
- UPDATE DateReport
- SET PersonLoginNum_Net = PersonLoginNum_Net + 1
- WHERE CountDate = CONVERT(VARCHAR(8), GETDATE(), 112)
- AND Province_Id = @dcSubSiteID
-
- SELECT @TotalLoginNum = @TotalLoginNum + 1
- END
- INSERT INTO paLoginLog(paMainID, LoginIP, Browser, LoginFrom) VALUES(@ID, @IP, '1:' + ISNULL(@browser, 'Null'), @LoginFrom)
- END
- ELSE
- SELECT @TotalLoginNum = @TotalLoginNum + 1
- IF @LastLoginDate < DATEADD(HOUR, -1, GETDATE()) --登录间隔>1小时更新登录时间
- UPDATE paMain SET LastLoginDate = GETDATE(), TotalLoginNum = @TotalLoginNum WHERE ID = @ID
- ELSE
- UPDATE paMain SET TotalLoginNum = @TotalLoginNum WHERE ID = @ID
- END
- ELSE
- BEGIN
- ----今天第一次登录
- INSERT INTO paLoginLog(paMainID, LoginIP, Browser, LoginFrom) VALUES(@ID, @IP, '2:' + ISNULL(@browser, 'Null'), @LoginFrom)
- SELECT @TotalLoginNum = @TotalLoginNum + 1
- UPDATE paMain SET TotalLoginNum = @TotalLoginNum, LastLoginDate = GETDATE() WHERE ID = @ID
- UPDATE DateReport
- SET PersonLoginNum_Net = PersonLoginNum_Net + 1
- WHERE CountDate = CONVERT(VARCHAR(8), GETDATE(), 112)
- AND Province_Id = @dcSubSiteID
- --INSERT INTO PaMainDateReport SELECT @Id, 11, GETDATE() --sean 20130708
- END
- END TRY
- BEGIN CATCH
- GOTO Err3
- END CATCH
- COMMIT
- RETURN @ID
- ERR1:
- BEGIN
- ROLLBACK TRAN
- INSERT INTO LogDb..RegisterErrorLog SELECT @ID, '0|' + LTRIM(STR(@IDType)) + '|' + @IP, @UserName + ' ' + @PlainPassword, GETDATE()
- RETURN 0
- END
- ERR2:
- BEGIN
- ROLLBACK TRAN
- INSERT INTO LogDb..RegisterErrorLog SELECT @ID, '-1|' + LTRIM(STR(@IDType)) + '|' + @IP, @UserName + ' ' + @PlainPassword, GETDATE()
- RETURN -1
- END
- ERR3:
- BEGIN
- ROLLBACK TRAN
- INSERT INTO LogDb..RegisterErrorLog SELECT @ID, '-2|' + LTRIM(STR(@IDType)) + '|' + @IP, @UserName + ' ' + @PlainPassword, GETDATE()
- RETURN -2
- END
- END TRY
- BEGIN CATCH
- ROLLBACK TRAN
- INSERT INTO LogDb..RegisterErrorLog
- SELECT @ID, '9|' + LTRIM(STR(@IDType)) + '|' + @IP, @UserName + ' ' + @PlainPassword, GETDATE()
- END CATCH
- GO
- /****** Object: StoredProcedure [dbo].[pcpaMainByLoginUpdateNew] Script Date: 2018/12/13 19:09:01 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- --------------------------------------------------
- --修改:sean
- --修改日期:2010-9-15
- --说明:个人用户登陆 增加从Resume_Xinxi导数据的步骤
- --2010-12-27 sean 修改个人第一次登录时 注册时间改为信息员推广时间
- --密码加密后登录,2012-09-05修改 NIck
- --修改:Peter 提取LoginFrom 以便统计登录来源,删掉Broser前缀
- --修改:Carl 来源于毕业生信息网的账号 第一次登录时 简历状态改为公开
- --lucifer 2018-2-24
- --------------------------------------------------
- CREATE PROCEDURE [dbo].[pcpaMainByLoginUpdateNew]
- (
- @UserName VARCHAR(50),
- @PlainPassword VARCHAR(50),
- @Password VARCHAR(60),
- @IP VARCHAR(31),
- @dcSubSiteId SMALLINT,
- @AutoLogin TINYINT,
- @browser VARCHAR(500),
- @ID INT,
- @IDType INT,
- @LoginFrom TINYINT
- )
- AS
- SET NOCOUNT ON
- BEGIN TRY
- BEGIN TRAN
- DECLARE
- @Resume_XinxiID AS INT,
- @AddMan AS INT,
- @AddDate AS DATETIME,
- @Email AS VARCHAR(50),
- @CountDate AS INT,
- @dcProvinceID AS TINYINT,
- @TotalLoginNum AS INT,
- @LastLoginDate AS SMALLDATETIME,
- @PaType INT
- --SELECT @LoginFrom = 1, @Browser = '54:' + @Browser
- SET @UserName = REPLACE(@UserName, ' ', '')
- SELECT @CountDate = CONVERT(VARCHAR(8), GETDATE(), 112), @dcProvinceID = LEFT(@dcSubSiteId, 2)
- SET @PaType = @IDType
- BEGIN TRY
- --第一次登录Carl
- IF EXISTS (SELECT 'X' FROM paMain WITH(NOLOCK) WHERE RegisterType=200 AND Id=@ID AND TotalLoginNum=1)
- UPDATE cvMain SET IscvHidden=0 WHERE paMainId=@ID
- IF @PaType = 3
- BEGIN
- SELECT @Resume_XinxiID = ID, @AddMan =AddMan, @AddDate = RegDate, @Email = Email
- FROM Resume_Xinxi WITH(NOLOCK INDEX(IX_Resume_Xinxi_UserName))
- WHERE UserName = @UserName AND Password = @PlainPassword
- IF @Resume_XinxiID IS NOT NULL
- SET @PaType = 2
- END
- ELSE IF @PaType=0
- BEGIN
- SELECT TOP 1 @Resume_XinxiID = ID, @AddMan =AddMan, @AddDate = RegDate, @Email = Email
- FROM Resume_Xinxi WITH(NOLOCK INDEX(IX_Resume_Xinxi_UserNameLower))
- WHERE UserNameLower = @UserName AND Password = @PlainPassword
- ORDER BY ID DESC
- IF @Resume_XinxiID IS NOT NULL
- SET @PaType = 4
- END
- IF @PaType = 0
- GOTO Err1
- IF @Resume_XinxiID > 0 ----账号在Resume_xinxi
- BEGIN
- --lucifer添加,添加新的注册模式
- DECLARE @RegisterFrom AS TINYINT
- SELECT @RegisterFrom = 1
- IF CHARINDEX('ios',LOWER(@browser)) > 0
- SELECT @RegisterFrom = 3
- ELSE IF CHARINDEX('android',LOWER(@browser)) > 0
- SELECT @RegisterFrom = 2
- --把数据从Resume_Xini转换到paMain
- INSERT INTO paMain(RegisterMode, AddMan, UserName, Password, Email, dcProvinceID, dcSubSiteId, RegisterIP, IsDefaultPassword, AddDate, RegisterFrom, RegisterType, SpreadDate)
- VALUES(1, @AddMan, @UserName, @Password, @Email, @dcProvinceID, @dcSubSiteId, @IP, 1, GETDATE(), @RegisterFrom, 101, @AddDate)
- SET @ID = @@IDENTITY
- INSERT INTO paOperationLog (paMainID, Operation, Details, IP) VALUES(@ID, 10, '导入个人账号成功。', @IP)
- --记录日报
- UPDATE DateReport SET ValidResume = ValidResume + 1
- WHERE province_id = @dcSubSiteID AND CountDate = @CountDate
- INSERT INTO pamainDatereport SELECT @ID, 9, GETDATE() -- SEAN 20130911
- --统计信息员注册数据
- SELECT TOP 1 CountDate
- FROM Info_Datereport WITH(NOLOCK)
- WHERE CountDate = @CountDate
- AND province_id = @dcProvinceID
- AND InfoManager_ID = @AddMan
- IF (@@ROWCOUNT=0)
- INSERT INTO Info_DateReport(province_id,infomanager_id,countdate)
- VALUES(@dcProvinceID, @AddMan, @CountDate)
-
- UPDATE Info_Datereport
- SET ValidResume=ValidResume + 1
- WHERE CountDate=@CountDate
- AND province_id=@dcProvinceID
- AND InfoManager_ID = @AddMan
- END
- --超过登陆次数,每天限制登录次数位20次
- IF (SELECT COUNT(1) FROM paLoginLog WITH(NOLOCK) WHERE paMainID = @ID AND AddDate > CONVERT(VARCHAR(10), GETDATE(), 120)) > 19
- GOTO ERR2
- --登陆日志
- SELECT @LastLoginDate = LastLoginDate, @TotalLoginNum = TotalLoginNum FROM paMain WITH(NOLOCK) WHERE ID = @Id
- IF CONVERT(VARCHAR(8), @LastLoginDate, 112) = CONVERT(VARCHAR(8), GETDATE(), 112) --今天已经登陆过
- BEGIN
- IF @AutoLogin = 0 --首页的自动登录不计算在每日登陆次数
- BEGIN
- IF NOT EXISTS(SELECT 'x' FROM paLoginLog WITH(NOLOCK) WHERE paMainID = @ID AND AddDate > CONVERT(VARCHAR(10), GETDATE(), 120))
- BEGIN
- UPDATE DateReport
- SET PersonLoginNum_Net = PersonLoginNum_Net + 1
- WHERE CountDate = CONVERT(VARCHAR(8), GETDATE(), 112)
- AND Province_Id = @dcSubSiteID
-
- SELECT @TotalLoginNum = @TotalLoginNum + 1
- END
- INSERT INTO paLoginLog(paMainID, LoginIP, Browser, LoginFrom) VALUES(@ID, @IP, ISNULL(@browser, 'Null'), @LoginFrom)
- END
- ELSE
- SELECT @TotalLoginNum = @TotalLoginNum + 1
- IF @LastLoginDate < DATEADD(HOUR, -1, GETDATE()) --登录间隔>1小时更新登录时间
- UPDATE paMain SET LastLoginDate = GETDATE(), TotalLoginNum = @TotalLoginNum WHERE ID = @ID
- ELSE
- UPDATE paMain SET TotalLoginNum = @TotalLoginNum WHERE ID = @ID
- END
- ELSE
- BEGIN
- ----今天第一次登录
- INSERT INTO paLoginLog(paMainID, LoginIP, Browser, LoginFrom) VALUES(@ID, @IP, ISNULL(@browser, 'Null'), @LoginFrom)
- SELECT @TotalLoginNum = @TotalLoginNum + 1
- UPDATE paMain SET TotalLoginNum = @TotalLoginNum, LastLoginDate = GETDATE() WHERE ID = @ID
- UPDATE DateReport
- SET PersonLoginNum_Net = PersonLoginNum_Net + 1
- WHERE CountDate = CONVERT(VARCHAR(8), GETDATE(), 112)
- AND Province_Id = @dcSubSiteID
- --INSERT INTO PaMainDateReport SELECT @Id, 11, GETDATE() --sean 20130708
- END
- END TRY
- BEGIN CATCH
- GOTO Err3
- END CATCH
- COMMIT
- RETURN @ID
- ERR1:
- BEGIN
- ROLLBACK TRAN
- INSERT INTO LogDb..RegisterErrorLog SELECT @ID, 'a|' + LTRIM(STR(@IDType)) + '|' + @IP, @UserName + ' ' + @PlainPassword, GETDATE()
- RETURN 0
- END
- ERR2:
- BEGIN
- ROLLBACK TRAN
- INSERT INTO LogDb..RegisterErrorLog SELECT @ID, 'b|' + LTRIM(STR(@IDType)) + '|' + @IP, @UserName + ' ' + @PlainPassword, GETDATE()
- RETURN -1
- END
- ERR3:
- BEGIN
- ROLLBACK TRAN
- INSERT INTO LogDb..RegisterErrorLog SELECT @ID, 'c|' + LTRIM(STR(@IDType)) + '|' + @IP, @UserName + ' ' + @PlainPassword, GETDATE()
- RETURN -2
- END
- END TRY
- BEGIN CATCH
- ROLLBACK TRAN
- INSERT INTO LogDb..RegisterErrorLog
- SELECT @ID, 'd|' + LTRIM(STR(@IDType)) + '|' + @IP, @UserName + ' ' + @PlainPassword, GETDATE()
- END CATCH
- GO
- /****** Object: StoredProcedure [dbo].[pcPaMainByMobileExist] Script Date: 2018/12/13 19:09:01 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- -- =============================================
- -- Author: Sean
- -- Create date: 2012-2-6
- -- Description: 根据手机号取回密码,取回最新的5条
- -- =============================================
- CREATE PROCEDURE [dbo].[pcPaMainByMobileExist]
- (
- @Mobile VARCHAR(11)
- )
- AS
- BEGIN
- IF(dbo.IsMobile(@Mobile) = 0)
- RETURN -1
- IF EXISTS(SELECT 'x' FROM paMain WITH(NOLOCK) WHERE Mobile = @Mobile)
- RETURN 1
- ELSE
- RETURN 0
- END
- GO
- /****** Object: StoredProcedure [dbo].[pcPaMainByMobileSelect] Script Date: 2018/12/13 19:09:01 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- -- =============================================
- -- Lambo 20140909
- -- 根据手机号取回个人用户,用于验证是否认证过手机号
- -- =============================================
- CREATE PROCEDURE [dbo].[pcPaMainByMobileSelect]
- (
- @Mobile VARCHAR(11)
- )
- AS
- BEGIN
- IF(dbo.IsMobile(@Mobile) = 0)
- RETURN -1
- SELECT Id, MobileVerifyDate FROM paMain WITH(INDEX(IX_paMain_Mobile))
- WHERE Mobile = @Mobile
- AND MobileVerifyDate IS NOT NULL
- END
- GO
- /****** Object: StoredProcedure [dbo].[pcPaMainByMobileUpdate] Script Date: 2018/12/13 19:09:01 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- -- =============================================
- -- 检查: Sean
- -- 日期: 2010-10-5
- -- 描述: 修改手机号,首先检查是否在手机黑名单
- -- =============================================
- CREATE PROCEDURE [dbo].[pcPaMainByMobileUpdate]
- (
- @ID INT,
- @Mobile VARCHAR(13),
- @IP VARCHAR(31)
- )
- AS
- IF EXISTS(SELECT 'x' FROM Person_BLACK WITH(NOLOCK) WHERE Mobile = @Mobile)
- BEGIN
- ----有黑名单,则增加拒绝次数
- UPDATE Person_Black SET RefuseCount = RefuseCount + 1 WHERE Mobile = @Mobile
- RETURN -1
- END
- BEGIN TRAN
- DECLARE @MobileOld VARCHAR(13)
-
- SELECT @MobileOld = ISNULL(Mobile ,'') FROM paMain WITH(NOLOCK INDEX(PK_paMain)) WHERE ID=@ID
- IF @MobileOld <> @Mobile
- BEGIN
- UPDATE paMain SET Mobile = @Mobile, LastModifyDate=GETDATE() WHERE ID =@ID
- INSERT INTO paOperationLog (paMainID,Operation,Details,IP)
- VALUES(@ID,35,'更新手机号码,原号码:<'+@MobileOld +'>;新手机号码:<'+@Mobile+'>', @IP)
- END
- COMMIT
- RETURN 1
- ERR1:
- BEGIN
- ROLLBACK TRAN
- RETURN 0
- END
- GO
- /****** Object: StoredProcedure [dbo].[pcPaMainByMobileUpdateNew] Script Date: 2018/12/13 19:09:01 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- CREATE PROCEDURE [dbo].[pcPaMainByMobileUpdateNew]
- (
- @ID INT,
- @Mobile VARCHAR(13),
- @IP VARCHAR(31),
- @VerifyCode VARCHAR(6)
- )
- AS
- BEGIN
- IF EXISTS(SELECT 'x' FROM Person_BLACK WITH(NOLOCK) WHERE Mobile = @Mobile)
- BEGIN
- ----有黑名单,则增加拒绝次数
- UPDATE Person_Black SET RefuseCount = RefuseCount + 1 WHERE Mobile = @Mobile
- RETURN -1
- END
- BEGIN
- ----验证验证码是否正确
- DECLARE @paVerifyLogID AS INT
- SET @paVerifyLogID = 0
- SELECT @paVerifyLogID = ID FROM paVerifyLog WHERE Mobile = @Mobile AND VerifyCode = @VerifyCode AND AddDate>DATEADD(HOUR, -1, GETDATE())
-
- IF @paVerifyLogID = 0
- RETURN 0
- END
- BEGIN TRY
- DECLARE @MobileOld VARCHAR(13)
- SELECT @MobileOld = ISNULL(Mobile ,'') FROM paMain WITH(NOLOCK INDEX(PK_paMain)) WHERE ID=@ID AND MobileVerifyDate IS NOT NULL
- IF NOT EXISTS(SELECT 'x' FROM PaMain WITH(NOLOCK) WHERE ID = @ID AND MobileVerifyDate IS NOT NULL AND Mobile = @Mobile)
- BEGIN
- UPDATE paMain SET Mobile = @Mobile, LastModifyDate=GETDATE() WHERE ID = @ID
-
-
- ---- 把该手机号的其他账号状态修改为未认证
- UPDATE paMain SET MobileVerifyDate = NULL WHERE mobile = @Mobile
- UPDATE paMain SET MobileVerifyDate=GETDATE() WHERE ID =@ID
- INSERT INTO paOperationLog (paMainID,Operation,Details,[IP])
- VALUES(28404611,35,'更新手机号码,原号码:<'+ISNULL(@MobileOld,'')+'>;新手机号码:<'+@Mobile+'>', @IP)
-
- END
- RETURN 1
- END TRY
- BEGIN CATCH
- RETURN 0
- END CATCH
- END
- GO
- /****** Object: StoredProcedure [dbo].[pcPaMainByMobileVerifyDateUpdate] Script Date: 2018/12/13 19:09:02 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- CREATE PROCEDURE [dbo].[pcPaMainByMobileVerifyDateUpdate]
- (
- @ID INT,
- @PaMainID INT,
- @Mobile VARCHAR(13),
- @dcCareerStatus TINYINT,
- @IP VARCHAR(39),
- @VerifyCode VARCHAR(6)
- )
- AS
- SET NOCOUNT ON
- SET @Mobile = dbo.TextTrim(@Mobile)
- IF @Mobile IS NULL OR @dcCareerStatus IS NULL
- RETURN -2 --手机号或求职状态为空
- IF EXISTS(SELECT 'x' FROM Person_BLACK WITH(NOLOCK) WHERE Mobile = @Mobile)
- BEGIN
- ----有黑名单,则增加拒绝次数
- UPDATE Person_Black SET RefuseCount = RefuseCount + 1 WHERE Mobile = @Mobile
- RETURN -1
- END
- IF @ID > 0
- IF NOT EXISTS(SELECT 'x' FROM cvMain WITH(NOLOCK) WHERE ID = @ID AND paMainID = @paMainID)
- RETURN -3
- ----验证验证码是否正确
- DECLARE @paVerifyLogID AS INT
- SET @paVerifyLogID = 0
- SELECT @paVerifyLogID = ID FROM paVerifyLog WHERE Mobile = @Mobile AND VerifyCode = @VerifyCode AND AddDate>DATEADD(HOUR, -1, GETDATE())
-
- IF @paVerifyLogID = 0
- RETURN 0
- BEGIN TRAN
- BEGIN TRY
- --如果新旧日志不相同,记录更新手机号的操作
- DECLARE @MobileOld AS VARCHAR(13)
- SELECT @MobileOld = Mobile FROM paMain WITH(NOLOCK) WHERE ID = @paMAinID
- IF ISNULL(@MobileOld, '') <> @Mobile
- INSERT INTO paOperationLog (paMainID, Operation, Details, IP)
- VALUES(@paMainID, 35,'更新手机号,原手机号:<' + ISNULL(@MobileOld, '') + '>;新手机号:<' + @Mobile + '>', @IP)
- UPDATE paMain SET Mobile = @mobile, dcCareerStatus = @dcCareerStatus,
- LastModifyDate = GETDATE() WHERE ID = @PaMainID
- UPDATE paMain SET MobileVerifyDate = GETDATE() WHERE ID = @PaMainID
- UPDATE paMain SET MobileVerifyDate = null WHERE Mobile = @mobile AND ID <> @PaMainID
- IF @ID > 0
- UPDATE CvMain SET RefreshDate = GETDATE() WHERE paMainID = @paMainID AND ID = @ID
- ELSe
- UPDATE CvMain SET RefreshDate = GETDATE() WHERE paMainID = @paMainID
- END TRY
- BEGIN CATCH
- GOTO Err
- END CATCH
- COMMIT TRAN
- RETURN 1
- Err:
- BEGIN
- ROLLBACK TRAN
- RETURN 0
- END
- GO
- /****** Object: StoredProcedure [dbo].[pcPaMainByNoticeUpdate] Script Date: 2018/12/13 19:09:02 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- --创建时间:2015.11.09
- --创建人:nick
- --说明:修改是否提醒
- --#####################################################
- CREATE PROCEDURE [dbo].[pcPaMainByNoticeUpdate]
- (
- @PaMainID INT,
- @Type INT ,--1是否app 2是否邮件 3是否微信
- @IsNotice INT
- )
- AS
- BEGIN
- IF @Type = 1
- BEGIN
- UPDATE Pamain SET IsAppNotice = @IsNotice WHERE ID = @PaMainID
- END
- ELSE IF @Type = 2
- BEGIN
- UPDATE Pamain SET IsEmailNotice = @IsNotice WHERE ID = @PaMainID
- END
- ELSE IF @Type = 3
- BEGIN
- UPDATE Pamain SET IsWeixinNotice = @IsNotice WHERE ID = @PaMainID
- END
- ELSE IF @Type = 4
- BEGIN
- UPDATE Pamain SET IsAppJobFinder = @IsNotice WHERE ID = @PaMainID
- END
- ELSE IF @Type = 5
- BEGIN
- UPDATE Pamain SET IsEmailJobFinder = @IsNotice WHERE ID = @PaMainID
- END
- ELSE IF @Type = 6
- BEGIN
- UPDATE Pamain SET IsWeixinJobFinder = @IsNotice WHERE ID = @PaMainID
- END
- END
- GO
- /****** Object: StoredProcedure [dbo].[pcPaMainByPasswordUpdate] Script Date: 2018/12/13 19:09:02 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- -- =============================================
- -- 检查: Sean
- -- 日期: 2010-10-5
- -- 描述: 修改密码
- -- =============================================
- CREATE PROCEDURE [dbo].[pcPaMainByPasswordUpdate]
- @ID INT,
- @Password VARCHAR(50),
- @PasswordOld VARCHAR(50),
- @IP VARCHAR(50)
- AS
- BEGIN TRY
- UPDATE paMain SET Password = @Password, IsDefaultPassword = 0 WHERE ID=@ID AND Password = @PasswordOld
- IF @@RowCount =0
- RETURN 0
- ELSE
- INSERT INTO paOperationLog (paMainID,Operation,Details,IP) VALUES(@ID,21,'更新密码,原密码:<'+@PasswordOld +'>;新密码:<'+@Password+'>', @IP)
- RETURN 1
- END TRY
- BEGIN CATCH
- RETURN 0
- END CATCH
- GO
- /****** Object: StoredProcedure [dbo].[pcPaMainByPtCvInvitationInsert] Script Date: 2018/12/13 19:09:02 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- CREATE PROCEDURE [dbo].[pcPaMainByPtCvInvitationInsert]
- (
- @Email VARCHAR(50),
- @Mobile VARCHAR(11),
- @Password VARCHAR(60),
- @dcSubSiteID SMALLINT,
- @RegisterIP VARCHAR(50)
- )
- AS
- SET NOCOUNT ON
- BEGIN
- DECLARE @RegisterFrom AS VARCHAR(5), @RegisterType AS VARCHAR(5)
- SELECT @RegisterFrom = 1, @RegisterType = 151
- ----在黑名单中则终止
- IF LEN(@Email) > 6 AND EXISTS(SELECT 'X' FROM Person_Black WITH(NOLOCK) WHERE Email = @Email)
- BEGIN
- UPDATE Person_black SET refusecount = refusecount + 1 where email = @Email
- RETURN -1
- END
- ----在paMain中邮件重复则终止,新注册的都要是新邮箱
- IF EXISTS(SELECT 'X' FROM paMain WITH(NOLOCK) WHERE EMail = @Email)
- RETURN -2
- DECLARE @MaxId AS INT, @AddMan SMALLINT, @RegisterMode TINYINT, @dcProvinceID TINYINT, @RegDate DATETIME
- SELECT @RegisterMode = 0, @dcProvinceID = LEFT(@dcSubSiteID, 2)
- --160天内,是否推广邮件,IsHistory有计划任务保证
- SELECT TOP 1 @AddMan = AddMan, @RegDate = RegDate FROM Resume_Xinxi WITH( INDEX(IX_Resume_Xinxi_Email) NOLOCK)
- WHERE Email = @Email AND IsHistory = 0
- AND Province_ID = @dcProvinceID
- ORDER BY RegDate DESC
- ----是160天内推广的
- IF @AddMan > 0
- SELECT @RegisterMode = 1, @RegisterType = 111
- DECLARE @CountDate AS INT
- SET @CountDate = YEAR(GETDATE()) * 10000 + MONTH(GETDATE()) * 100 + DAY(GETDATE())
- IF @RegisterMode = 0 --非推广,自己注册的
- BEGIN
- INSERT INTO paMain(Username, Password, dcProvinceID, dcSubSiteID, Email, Mobile, RegisterIP, LastLoginDate, TotalLoginNum, RegisterFrom, RegisterType)
- VALUES(@Email, @Password, @dcProvinceID, @dcSubSiteID, @Email, @Mobile, @RegisterIP, GETDATE(), 1, @RegisterFrom, @RegisterType)
- SET @MaxId = @@IDENTITY
- UPDATE DateReport SET PersonRegNum = PersonRegNum + 1, PersonLoginNum_Net = PersonLoginNum_Net + 1
- WHERE province_id = @dcSubSiteID AND CountDate = @CountDate
- --INSERT INTO PaMainDateReport SELECT @MaxId, 11, GETDATE() --sean 20130708
- INSERT INTO PaMainDateReport SELECT @MaxId, 2, GETDATE() --sean 20130708
- END
- ELSE --推广的
- BEGIN
- INSERT INTO paMain(Username, Password, dcProvinceID, dcSubSiteID, Email, RegisterIP, AddMan, RegisterMode, LastLoginDate, TotalLoginNum, AddDate, SpreadDate, RegisterFrom, RegisterType)
- VALUES(@Email, @Password, @dcProvinceID, @dcSubSiteID, @Email, @RegisterIP, @AddMan, @RegisterMode, GETDATE(), 1, GETDATE(), @RegDate, @RegisterFrom, @RegisterType)
- SET @MaxId = @@IDENTITY
- UPDATE DateReport SET ValidResume = ValidResume + 1, PersonLoginNum_Net = PersonLoginNum_Net + 1
- WHERE province_id = @dcSubSiteID AND CountDate = @CountDate
- INSERT INTO PaMainDateReport SELECT @MaxId, 9, GETDATE() --sean 20130708
- --INSERT INTO PaMainDateReport SELECT @MaxId, 11, GETDATE() --sean 20130708
- IF NOT EXISTS(SELECT 'x' FROM Info_DateReport WITH(NOLOCK)
- WHERE CountDate = @CountDate
- AND Province_ID = @dcProvinceID
- AND InfoManager_ID = @AddMan
- )
- INSERT INTO Info_DateReport(Province_ID, Infomanager_ID, CountDate)
- VALUES(@dcProvinceID, @AddMan, @CountDate)
- UPDATE Info_DateReport
- SET ValidResume = ValidResume + 1
- WHERE CountDate = @CountDate
- AND Province_ID = @dcProvinceID
- AND InfoManager_ID = @AddMan
- --Lucifer添加,新的register模式
- UPDATE paMain SET SpreadDate = @RegDate, RegisterType=101 WHERE ID=@MaxId
- END
- INSERT INTO paOperationLog (paMainID,Operation,Details,IP) VALUES(@MaxID,10,'注册个人账号成功。',@RegisterIP)
- INSERT INTO paLoginLog (paMainID, LoginIP, AddDate, LoginFrom, Browser) VALUES(@MaxID, @RegisterIP, GETDATE(), 1, '52:From PtCvInvitation')
- RETURN @MaxID
- END
- ERR:
- BEGIN
- INSERT INTO LogDb..RegisterErrorLog SELECT @MaxId, '12|' + @RegisterIP, @Email + ' ' + @Password, GETDATE()
- RETURN -3
- END
- GO
- /****** Object: StoredProcedure [dbo].[pcpaMainByQQLoginUpdate] Script Date: 2018/12/13 19:09:03 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- --------------------------------------------------
- --lambo 2012-11-12
- --前台QQ登陆和人人网登陆相关的存储过程,用于登陆后增加登陆日志
- --------------------------------------------------
- CREATE PROCEDURE [dbo].[pcpaMainByQQLoginUpdate]
- (
- @ID INT,
- @browser VARCHAR(500),
- @ip VARCHAR(31),
- @dcProvinceID INT
- )
- AS
- SET NOCOUNT ON
- BEGIN TRAN
- BEGIN TRY
- DECLARE @TotalLoginNum AS INT, @LastLoginDate AS SMALLDATETIME
- --超过登陆次数,每天限制登录次数位20次
- IF (SELECT COUNT(1) FROM paLoginLog WITH(NOLOCK) WHERE paMainID = @ID AND AddDate > CONVERT(VARCHAR(10), GETDATE(), 120)) > 19
- GOTO ERR2
- --登陆日志
- SELECT @LastLoginDate = LastLoginDate, @TotalLoginNum = TotalLoginNum FROM paMain WITH(NOLOCK) WHERE ID = @Id
- IF CONVERT(VARCHAR(8), @LastLoginDate, 112) = CONVERT(VARCHAR(8), GETDATE(), 112) --今天已经登陆过
- BEGIN
- INSERT INTO paLoginLog(paMainID, LoginIP, browser) VALUES(@ID, @IP, '3:' + ISNULL(@browser, 'Null'))
- SELECT @TotalLoginNum = @TotalLoginNum + 1
- IF @LastLoginDate < DATEADD(HOUR, -1, GETDATE()) --登录间隔>1小时更新登录时间
- UPDATE paMain SET LastLoginDate = GETDATE(), TotalLoginNum = @TotalLoginNum WHERE ID = @ID
- ELSE
- UPDATE paMain SET TotalLoginNum = @TotalLoginNum WHERE ID = @ID
- END
- ELSE
- BEGIN
- ----今天第一次登录
- INSERT INTO paLoginLog(paMainID, LoginIP, browser, LoginFrom) VALUES(@ID, @IP, '4:' + ISNULL(@browser, 'Null'), 55)
- SELECT @TotalLoginNum = @TotalLoginNum + 1
- UPDATE paMain SET TotalLoginNum = @TotalLoginNum, LastLoginDate = GETDATE() WHERE ID = @ID
- UPDATE DateReport
- SET PersonLoginNum_Net = PersonLoginNum_Net + 1
- WHERE CountDate = CONVERT(VARCHAR(8), GETDATE(), 112)
- AND Province_Id = @dcProvinceID
- --INSERT INTO PaMainDateReport SELECT @Id, 11, GETDATE() --sean 20130708
- END
- END TRY
- BEGIN CATCH
- GOTO Err3
- END CATCH
- COMMIT
- RETURN @ID
- ERR1:
- BEGIN
- ROLLBACK TRAN
- RETURN 0
- END
- ERR2:
- BEGIN
- ROLLBACK TRAN
- RETURN -1
- END
- ERR3:
- BEGIN
- ROLLBACK TRAN
- RETURN -2
- END
- GO
- /****** Object: StoredProcedure [dbo].[pcpaMainByQQLoginUpdateNew] Script Date: 2018/12/13 19:09:03 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- --------------------------------------------------
- --lambo 2012-11-12
- --前台QQ登陆和人人网登陆相关的存储过程,用于登陆后增加登陆日志
- --修改Peter 提取LoginFrom 用来统计登录来源 2016-07-15
- --------------------------------------------------
- CREATE PROCEDURE [dbo].[pcpaMainByQQLoginUpdateNew]
- (
- @ID INT,
- @browser VARCHAR(500),
- @ip VARCHAR(31),
- @dcProvinceID INT,
- @LoginFrom TINYINT
- )
- AS
- SET NOCOUNT ON
- SET @LoginFrom = 56
- BEGIN TRAN
- BEGIN TRY
- DECLARE @TotalLoginNum AS INT, @LastLoginDate AS SMALLDATETIME
- --超过登陆次数,每天限制登录次数位20次
- IF (SELECT COUNT(1) FROM paLoginLog WITH(NOLOCK) WHERE paMainID = @ID AND AddDate > CONVERT(VARCHAR(10), GETDATE(), 120)) > 19
- GOTO ERR2
- --登陆日志
- SELECT @LastLoginDate = LastLoginDate, @TotalLoginNum = TotalLoginNum FROM paMain WITH(NOLOCK) WHERE ID = @Id
- IF CONVERT(VARCHAR(8), @LastLoginDate, 112) = CONVERT(VARCHAR(8), GETDATE(), 112) --今天已经登陆过
- BEGIN
- INSERT INTO paLoginLog(paMainID, LoginIP, browser,LoginFrom) VALUES(@ID, @IP, ISNULL(@browser, 'Null') , @LoginFrom)
- SELECT @TotalLoginNum = @TotalLoginNum + 1
- IF @LastLoginDate < DATEADD(HOUR, -1, GETDATE()) --登录间隔>1小时更新登录时间
- UPDATE paMain SET LastLoginDate = GETDATE(), TotalLoginNum = @TotalLoginNum WHERE ID = @ID
- ELSE
- UPDATE paMain SET TotalLoginNum = @TotalLoginNum WHERE ID = @ID
- END
- ELSE
- BEGIN
- ----今天第一次登录
- INSERT INTO paLoginLog(paMainID, LoginIP, browser, LoginFrom) VALUES(@ID, @IP, ISNULL(@browser, 'Null'), @LoginFrom)
- SELECT @TotalLoginNum = @TotalLoginNum + 1
- UPDATE paMain SET TotalLoginNum = @TotalLoginNum, LastLoginDate = GETDATE() WHERE ID = @ID
- UPDATE DateReport
- SET PersonLoginNum_Net = PersonLoginNum_Net + 1
- WHERE CountDate = CONVERT(VARCHAR(8), GETDATE(), 112)
- AND Province_Id = @dcProvinceID
- --INSERT INTO PaMainDateReport SELECT @Id, 11, GETDATE() --sean 20130708
- END
- END TRY
- BEGIN CATCH
- GOTO Err3
- END CATCH
- COMMIT
- RETURN @ID
- ERR1:
- BEGIN
- ROLLBACK TRAN
- RETURN 0
- END
- ERR2:
- BEGIN
- ROLLBACK TRAN
- RETURN -1
- END
- ERR3:
- BEGIN
- ROLLBACK TRAN
- RETURN -2
- END
- GO
- /****** Object: StoredProcedure [dbo].[pcPaMainByRefreshDateUpdate] Script Date: 2018/12/13 19:09:03 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- --####################################33
- --更新求职状态,简历列表中使用
- --@ID=cvmainID
- --@ID=0 则更新全部简历
- --返回值:
- -- 0 数据库错误
- -- -1 手机号已经列入黑名单
- -- -2 手机号或求职状态为空
- -- -3 该简历不属于该账号
- --####################################33
- CREATE PROCEDURE [dbo].[pcPaMainByRefreshDateUpdate]
- (
- @ID INT,
- @PaMainID INT,
- @Mobile VARCHAR(13),
- @dcCareerStatus TINYINT,
- @IP VARCHAR(39)
- )
- AS
- SET NOCOUNT ON
- SET @Mobile = dbo.TextTrim(@Mobile)
- IF @Mobile IS NULL OR @dcCareerStatus IS NULL
- RETURN -2 --手机号或求职状态为空
- IF EXISTS(SELECT 'x' FROM Person_BLACK WITH(NOLOCK) WHERE Mobile = @Mobile)
- BEGIN
- ----有黑名单,则增加拒绝次数
- UPDATE Person_Black SET RefuseCount = RefuseCount + 1 WHERE Mobile = @Mobile
- RETURN -1
- END
- IF @ID > 0
- IF NOT EXISTS(SELECT 'x' FROM cvMain WITH(NOLOCK) WHERE ID = @ID AND paMainID = @paMainID)
- RETURN -3
- BEGIN TRAN
- BEGIN TRY
- --如果新旧日志不相同,记录更新手机号的操作
- DECLARE @MobileOld AS VARCHAR(13)
- SELECT @MobileOld = Mobile FROM paMain WITH(NOLOCK) WHERE ID = @paMAinID
- IF ISNULL(@MobileOld, '') <> @Mobile
- INSERT INTO paOperationLog (paMainID, Operation, Details, IP)
- VALUES(@paMainID, 35,'更新手机号,原手机号:<' + ISNULL(@MobileOld, '') + '>;新手机号:<' + @Mobile + '>', @IP)
- UPDATE paMain SET Mobile = @mobile, dcCareerStatus = @dcCareerStatus,
- LastModifyDate = GETDATE() WHERE ID = @PaMainID
- IF @ID > 0
- UPDATE CvMain SET RefreshDate = GETDATE() WHERE paMainID = @paMainID AND ID = @ID
- ELSe
- UPDATE CvMain SET RefreshDate = GETDATE() WHERE paMainID = @paMainID
- END TRY
- BEGIN CATCH
- GOTO Err
- END CATCH
- COMMIT TRAN
- RETURN 1
- Err:
- BEGIN
- ROLLBACK TRAN
- RETURN 0
- END
- GO
- /****** Object: StoredProcedure [dbo].[pcPaMainByResetPasswordUpdate] Script Date: 2018/12/13 19:09:03 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- ---*******************
- --lambo 2012-11-9
- --peter 2018-4-20
- ---*******************
- CREATE PROCEDURE [dbo].[pcPaMainByResetPasswordUpdate]
- (
- @ID INT,
- @Password VARCHAR(80),
- @PlainPassword VARCHAR(40),
- @IP VARCHAR(50)
- )
- AS
- BEGIN
- IF NOT (dbo.ISAccount(@PlainPassword) = 1)
- BEGIN
- RETURN -2
- END
- ELSE
- BEGIN
- UPDATE paMain SET Password = @Password, IsDefaultPassword = 0 WHERE ID = @ID
- IF @@RowCount =0
- RETURN -3
- ELSE
- INSERT INTO paOperationLog (paMainID, Operation, Details, IP) VALUES(@ID, 21, '重置密码,新密码:<' + LEFT(@PlainPassword, 3) + '****>', @IP)
- RETURN 1
- END
- END
- GO
- /****** Object: StoredProcedure [dbo].[pcPaMainByUserNameExist] Script Date: 2018/12/13 19:09:04 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- -- =============================================
- -- 检查: Sean
- -- 日期: 2010-10-5
- -- 描述: 检查Email是否存在
- -- =============================================
- CREATE PROCEDURE [dbo].[pcPaMainByUserNameExist]
- (
- @UserName VARCHAR(50)
- )
- AS
- BEGIN
- IF EXISTS(SELECT ID FROM paMain WITH(NOLOCK) WHERE UserNameLower = @UserName)
- RETURN 1
- ELSE
- RETURN 0
- END
- GO
- /****** Object: StoredProcedure [dbo].[pcPaMainByUsernameUpdate] Script Date: 2018/12/13 19:09:04 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- -- =============================================
- -- Author: Sean
- -- Create date: 2010-9-15
- -- Description: 修改用户名 ,EMail邮触发器联动修改
- --lambo 20121109
- -- =============================================
- CREATE PROCEDURE [dbo].[pcPaMainByUsernameUpdate]
- (
- @ID INT,
- @Username VARCHAR(50),
- @IP VARCHAR(31)
- )
- AS
- set nocount off
- IF EXISTS(SELECT 'x' FROM Person_BLACK WITH(NOLOCK) WHERE EMail = @Username)
- BEGIN
- ----有黑名单,则增加拒绝次数
- UPDATE Person_Black SET RefuseCount = RefuseCount + 1 WHERE EMail = @Username
- RETURN 20
- END
- SET @Username = dbo.TextTrim(@Username)
- BEGIN TRAN
- BEGIN TRY
- ----用户名不是邮箱格式
- IF dbo.IsEmail(@Username) = 0
- GOTO Err10
- DECLARE @UsernameOld AS VARCHAR(50), @dcProvinceID INT, @AddMan INT,
- @RegDate SMALLDATETIME, @RegisterMode INT, @RegisterType INT,
- @CountDate VARCHAR(8)
- SELECT @UsernameOld = UsernameLower, @dcProvinceID = dcProvinceID
- FROM paMain WITH(NOLOCK INDEX(PK_paMain)) WHERE ID = @ID
- --用户名重复验证,必须与原用户名不同
- IF EXISTS(SELECT 'x' FROM paMain WITH(NOLOCK INDEX(IX_paMain_UserNameLower)) WHERE UserNameLower = @Username)
- GOTO ERR11
- --resume_xinxi的处理,这是删除
- IF @UserNameOld LIKE '%@your_email.com'
- BEGIN
- --160天内,是否推广邮件,IsHistory有计划任务保证
- SELECT TOP 1 @AddMan = AddMan, @RegDate = RegDate FROM Resume_Xinxi WITH( INDEX(IX_Resume_Xinxi_Email) NOLOCK)
- WHERE Email = @UserName AND IsHistory = 0
- AND Province_ID = @dcProvinceID
- ORDER BY RegDate DESC
- ----是160天内推广的
- IF @AddMan > 0
- BEGIN
- SET @CountDate = CONVERT(VARCHAR(8), GETDATE(), 112)
- SELECT @RegisterMode = 1, @RegisterType = 111
- UPDATE DateReport SET ValidResume = ValidResume + 1
- WHERE province_id = @dcProvinceID AND CountDate = CONVERT(VARCHAR(8), GETDATE(), 112)
-
- IF NOT EXISTS(SELECT 'x' FROM Info_DateReport WITH(NOLOCK)
- WHERE CountDate = @CountDate
- AND Province_ID = @dcProvinceID
- AND InfoManager_ID = @AddMan
- )
- INSERT INTO Info_DateReport(Province_ID, Infomanager_ID, CountDate)
- VALUES(@dcProvinceID, @AddMan, @CountDate)
- UPDATE Info_DateReport
- SET ValidResume = ValidResume + 1
- WHERE CountDate = @CountDate
- AND Province_ID = @dcProvinceID
- AND InfoManager_ID = @AddMan
- --Lucifer添加,新的register模式
- UPDATE paMain SET AddMan = @AddMan, SpreadDate = @RegDate, RegisterType=101 WHERE ID=@Id
- END
- END
- IF EXISTS(SELECT 'x' FROM Resume_Xinxi WITH(NOLOCK INDEX(IX_Resume_Xinxi_Email)) WHERE EMail = @Username)
- DELETE FROM Resume_Xinxi WHERE EMail = @Username
- UPDATE paMain SET Username = @Username WHERE ID = @ID
- IF @@RowCount = 0
- GOTO ERR
- ELSE
- INSERT INTO paOperationLog (paMainID, Operation, Details, IP)
- VALUES(@ID, 20, '更新用户名,原用户名:<' + @UsernameOld + '>;新用户名:<' + @Username + '>', @IP)
- END TRY
- BEGIN CATCH
- GOTO ERR
- END CATCH
- COMMIT TRAN
- RETURN 1
- ERR:
- BEGIN
- ROLLBACK TRAN
- RETURN 0
- END
- ERR10:
- BEGIN
- ROLLBACK TRAN
- RETURN 10
- END
- ERR11:
- BEGIN
- ROLLBACK TRAN
- RETURN 11
- END
- ERR21:
- BEGIN
- ROLLBACK TRAN
- RETURN 21
- END
- GO
- /****** Object: StoredProcedure [dbo].[pcPaMainByUsernameUpdate0320] Script Date: 2018/12/13 19:09:04 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- -- =============================================
- -- Author: Sean
- -- Create date: 2010-9-15
- -- Description: 修改用户名 ,EMail邮触发器联动修改
- --lambo 20121109
- -- =============================================
- create PROCEDURE [dbo].[pcPaMainByUsernameUpdate0320]
- (
- @ID INT,
- @Username VARCHAR(50),
- @IP VARCHAR(31)
- )
- AS
- IF EXISTS(SELECT 'x' FROM Person_BLACK WITH(NOLOCK) WHERE EMail = @Username)
- BEGIN
- ----有黑名单,则增加拒绝次数
- UPDATE Person_Black SET RefuseCount = RefuseCount + 1 WHERE EMail = @Username
- RETURN 20
- END
- SET @Username = dbo.TextTrim(@Username)
- BEGIN TRAN
- BEGIN TRY
- ----用户名不是邮箱格式
- IF dbo.IsEmail(@Username) = 0
- GOTO Err10
- DECLARE @UsernameOld AS VARCHAR(50)
- SELECT @UsernameOld = Username FROM paMain WITH(NOLOCK INDEX(PK_paMain)) WHERE ID = @ID
- --用户名重复验证,必须与原用户名不同
- IF EXISTS(SELECT 'x' FROM paMain WITH(NOLOCK INDEX(IX_paMain_UserNameLower))
- WHERE UserNameLower = @Username)
- GOTO ERR11
- --resume_xinxi的处理,这是删除
- IF EXISTS(SELECT 'x' FROM Resume_Xinxi WITH(NOLOCK INDEX(IX_Resume_Xinxi_Email)) WHERE EMail = @Username)
- DELETE FROM Resume_Xinxi WHERE EMail = @Username
-
- UPDATE paMain SET Username = @Username WHERE ID = @ID
- IF @@RowCount = 0
- GOTO ERR
- ELSE
- INSERT INTO paOperationLog (paMainID, Operation, Details, IP)
- VALUES(@ID, 20, '更新用户名,原用户名:<' + @UsernameOld + '>;新用户名:<' + @Username + '>', @IP)
- END TRY
- BEGIN CATCH
- GOTO ERR
- END CATCH
- COMMIT TRAN
- RETURN 1
- ERR:
- BEGIN
- ROLLBACK TRAN
- RETURN 0
- END
- ERR10:
- BEGIN
- ROLLBACK TRAN
- RETURN 10
- END
- ERR11:
- BEGIN
- ROLLBACK TRAN
- RETURN 11
- END
- ERR21:
- BEGIN
- ROLLBACK TRAN
- RETURN 21
- END
- GO
- /****** Object: StoredProcedure [dbo].[pcPaMainByUsernameUpdate2] Script Date: 2018/12/13 19:09:04 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- -- =============================================
- -- Author: Sean
- -- Create date: 2010-9-15
- -- Description: 修改用户名 ,EMail邮触发器联动修改
- --lambo 20121109
- -- =============================================
- CREATE PROCEDURE [dbo].[pcPaMainByUsernameUpdate2]
- (
- @ID INT,
- @Username VARCHAR(50),
- @IP VARCHAR(31)
- )
- AS
- set nocount off
- IF EXISTS(SELECT 'x' FROM Person_BLACK WITH(NOLOCK) WHERE EMail = @Username)
- BEGIN
- ----有黑名单,则增加拒绝次数
- UPDATE Person_Black SET RefuseCount = RefuseCount + 1 WHERE EMail = @Username
- RETURN 20
- END
- SET @Username = dbo.TextTrim(@Username)
- BEGIN TRAN
- BEGIN TRY
- ----用户名不是邮箱格式
- IF dbo.IsEmail(@Username) = 0
- GOTO Err10
- DECLARE @UsernameOld AS VARCHAR(50), @dcProvinceID INT, @AddMan INT,
- @RegDate SMALLDATETIME, @RegisterMode INT, @RegisterType INT,
- @CountDate VARCHAR(8)
- SELECT @UsernameOld = UsernameLower, @dcProvinceID = dcProvinceID
- FROM paMain WITH(NOLOCK INDEX(PK_paMain)) WHERE ID = @ID
- --用户名重复验证,必须与原用户名不同
- IF EXISTS(SELECT 'x' FROM paMain WITH(NOLOCK INDEX(IX_paMain_UserNameLower)) WHERE UserNameLower = @Username)
- GOTO ERR11
- --resume_xinxi的处理,这是删除
- IF @UserNameOld LIKE '%@your_email.com'
- BEGIN
- --160天内,是否推广邮件,IsHistory有计划任务保证
- SELECT TOP 1 @AddMan = AddMan, @RegDate = RegDate FROM Resume_Xinxi WITH( INDEX(IX_Resume_Xinxi_Email) NOLOCK)
- WHERE Email = @UserName AND IsHistory = 0
- AND Province_ID = @dcProvinceID
- ORDER BY RegDate DESC
- ----是160天内推广的
- IF @AddMan > 0
- BEGIN
- SET @CountDate = CONVERT(VARCHAR(8), GETDATE(), 112)
- SELECT @RegisterMode = 1, @RegisterType = 111
- UPDATE DateReport SET ValidResume = ValidResume + 1
- WHERE province_id = @dcProvinceID AND CountDate = CONVERT(VARCHAR(8), GETDATE(), 112)
-
- IF NOT EXISTS(SELECT 'x' FROM Info_DateReport WITH(NOLOCK)
- WHERE CountDate = @CountDate
- AND Province_ID = @dcProvinceID
- AND InfoManager_ID = @AddMan
- )
- INSERT INTO Info_DateReport(Province_ID, Infomanager_ID, CountDate)
- VALUES(@dcProvinceID, @AddMan, @CountDate)
- UPDATE Info_DateReport
- SET ValidResume = ValidResume + 1
- WHERE CountDate = @CountDate
- AND Province_ID = @dcProvinceID
- AND InfoManager_ID = @AddMan
- --Lucifer添加,新的register模式
- UPDATE paMain SET AddMan = @AddMan, SpreadDate = @RegDate, RegisterType=101 WHERE ID=@Id
- END
- END
- IF EXISTS(SELECT 'x' FROM Resume_Xinxi WITH(NOLOCK INDEX(IX_Resume_Xinxi_Email)) WHERE EMail = @Username)
- DELETE FROM Resume_Xinxi WHERE EMail = @Username
- UPDATE paMain SET Username = @Username WHERE ID = @ID
- IF @@RowCount = 0
- GOTO ERR
- ELSE
- INSERT INTO paOperationLog (paMainID, Operation, Details, IP)
- VALUES(@ID, 20, '更新用户名,原用户名:<' + @UsernameOld + '>;新用户名:<' + @Username + '>', @IP)
- END TRY
- BEGIN CATCH
- GOTO ERR
- END CATCH
- COMMIT TRAN
- RETURN 1
- ERR:
- BEGIN
- ROLLBACK TRAN
- RETURN 0
- END
- ERR10:
- BEGIN
- ROLLBACK TRAN
- RETURN 10
- END
- ERR11:
- BEGIN
- ROLLBACK TRAN
- RETURN 11
- END
- ERR21:
- BEGIN
- ROLLBACK TRAN
- RETURN 21
- END
- GO
- /****** Object: StoredProcedure [dbo].[pcPaMainByValidCvNumberSelect] Script Date: 2018/12/13 19:09:04 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- CREATE PROCEDURE [dbo].[pcPaMainByValidCvNumberSelect]
- (
- @paMainID INT
- )
- AS
- BEGIN
- DECLARE @Cnt AS INT
- SELECT @Cnt = COUNT(*) FROM cvMain WITH(NOLOCK)
- WHERE paMainID = @paMainID
- AND (
- AttachMent > ''
- OR(
- cvLevel LIKE '1111_1%'
- AND VerifyResult = 1
- )
- OR(
- cvLevelEng LIKE '1111_1%'
- AND VerifyResultEng = 1
- )
- )
- RETURN @Cnt
- END
- GO
- /****** Object: StoredProcedure [dbo].[pcPaMainByVerifyUpdate] Script Date: 2018/12/13 19:09:04 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- --20180322 Carl 修改
- CREATE PROCEDURE [dbo].[pcPaMainByVerifyUpdate]
- (
- @paMainID INT,
- @Mobile VARCHAR(11),
- @Email VARCHAR(50),
- @VerifyCode VARCHAR(6)
- )
- AS
- SET NOCOUNT ON
- BEGIN
- DECLARE @MobileVerifyDate SMALLDATETIME,@EmailVerifyDate SMALLDATETIME
- SELECT @MobileVerifyDate = MobileVerifyDate,@EmailVerifyDate=EmailVerifyDate FROM paMain WHERE ID=@paMainID
- IF LEN(@Mobile)=0 AND ISNULL(@EmailVerifyDate,'')<>''
- RETURN -1
- DECLARE @paVerifyLogID AS INT
- SET @paVerifyLogID=0
- SELECT @paVerifyLogID=ID FROM paVerifyLog WHERE paMainID=@paMainID AND ISNULL(Mobile,'')=@Mobile AND ISNULL(Email,'')=@Email
- AND VerifyCode=@VerifyCode AND AddDate>DATEADD(HOUR,-1,GETDATE())
-
- IF @paVerifyLogID=0
- RETURN 0
-
- UPDATE paVerifyLog SET VerifyDate=GETDATE() WHERE paMainID=@paMainID AND ISNULL(Mobile,'')=@Mobile AND ISNULL(Email,'')=@Email
- AND VerifyCode=@VerifyCode AND AddDate>DATEADD(HOUR,-1,GETDATE())
-
- IF LEN(@Mobile)=0
- UPDATE paMain SET EmailVerifyDate=GETDATE() WHERE ID=@paMainID
-
- IF LEN(@Email)=0
- BEGIN
- UPDATE paMain SET Mobile = @Mobile WHERE ID = @paMainID
- --修改本手机号对应的其他帐号的认证状态
- UPDATE paMain SET MobileVerifyDate = NULL WHERE Mobile = @Mobile
- UPDATE paMain SET MobileVerifyDate = GETDATE() WHERE ID = @paMainID
- IF @@ROWCOUNT > 0
- DELETE FROM paMain WHERE ID IN(SELECT ID FROM paMain WITH(INDEX(IX_paMain_Mobile)) WHERE Mobile = @Mobile AND ID < @paMainID AND AddDate > DATEADD(MINUTE, -3, GETDATE()))
- IF EXISTS(SELECT 'X' FROM paMobileFollowUp WHERE ISNULL(ContactDate,0)>DATEADD(hh,-1,GETDATE()) AND Mobile = @Mobile)
- UPDATE paMobileFollowUp SET PaMainId=@paMainID WHERE Mobile = @Mobile
- ELSE
- DELETE FROM paMobileFollowUp WHERE Mobile = @Mobile
- END
- RETURN 1
- END
- GO
- /****** Object: StoredProcedure [dbo].[pcPaMainByWordInsert] Script Date: 2018/12/13 19:09:05 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- CREATE PROCEDURE [dbo].[pcPaMainByWordInsert]
- (
- @Username VARCHAR(50),
- @Name NVARCHAR(6),
- @Gender BIT,
- @dcSubSiteID SMALLINT,
- @RegisterIP VARCHAR(31),
- @R VARCHAR(50) OUT
- )
- AS
- BEGIN
- DECLARE @paMainID AS INT
- DECLARE @cvMainID AS INT
- EXEC @paMainID = pcPaMainInsert @Username, '$2a$08$wCjRdWcKgup74i.L3sk6OOlCAQ/qAPmAWE4ZMzpJL7K85N0.x/WIu', @dcSubSiteID, @RegisterIP, 0, 0
- UPDATE paMain SET Name = @Name, Gender = @Gender, IsDefaultPassword = 1 WHERE ID = @paMainID
- EXEC @cvMainID = pcCvMainCreate @paMainID, @RegisterIP
- UPDATE cvMain SET IsOpen = 0 WHERE Id = @cvMainId
- --INSERT INTO cvJobPlace(cvMainId, dcRegionId) SELECT @cvMainId, @dcSubSiteID
- SET @R = CAST(@cvMainID AS VARCHAR(10)) + ',' + CAST(@paMainID AS VARCHAR(10))
- END
- GO
- /****** Object: StoredProcedure [dbo].[pcPaMainByWordInsertNew] Script Date: 2018/12/13 19:09:05 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- CREATE PROCEDURE [dbo].[pcPaMainByWordInsertNew]
- (
- @Username VARCHAR(50),
- @Name NVARCHAR(6),
- @Gender BIT,
- @dcSubSiteID SMALLINT,
- @RegisterIP VARCHAR(31),
- @Mobile VARCHAR(11),
- @txtVeriyCode VARCHAR(6),
- @R VARCHAR(50) OUT
- )
- AS
- SET NOCOUNT ON
- BEGIN
- DECLARE @paMainID AS INT
- DECLARE @cvMainID AS INT
- EXEC @paMainID = pcPaMainInsert @Username, '$2a$08$wCjRdWcKgup74i.L3sk6OOlCAQ/qAPmAWE4ZMzpJL7K85N0.x/WIu', @dcSubSiteID, @RegisterIP, 0, 0
- UPDATE paMain SET Name = @Name, Gender = @Gender, IsDefaultPassword = 1 WHERE ID = @paMainID
-
- IF CHARINDEX('$', @RegisterIP) > 0
- SET @RegisterIP = REPLACE(@RegisterIP,'|1$10', '')
-
- EXEC pcPaVerifyLogUpdate @paMainID, @Mobile, @RegisterIP
- EXEC pcPaMainByVerifyUpdate @paMainID, @Mobile, '', @txtVeriyCode
- EXEC @cvMainID = pcCvMainCreate @paMainID, @RegisterIP
- UPDATE cvMain SET IsOpen = 0 WHERE Id = @cvMainId
- SET @R = CAST(@cvMainID AS VARCHAR(10)) + ','+ CAST(@paMainID AS VARCHAR(10))
- END
- GO
- /****** Object: StoredProcedure [dbo].[pcPaMainEmailExist] Script Date: 2018/12/13 19:09:05 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- -- =============================================
- -- 检查: Sean
- -- 日期: 2010-10-5
- -- 描述: 检查Email是否存在
- -- =============================================
- CREATE PROCEDURE [dbo].[pcPaMainEmailExist]
- (
- @Email VARCHAR(50)
- )
- AS
- BEGIN
- IF EXISTS(SELECT ID FROM paMain WITH(NOLOCK) WHERE Email = @Email)
- RETURN 1
- ELSE
- RETURN 0
- END
- GO
- /****** Object: StoredProcedure [dbo].[pcPaMainImport] Script Date: 2018/12/13 19:09:05 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- --创建:Max 2013-8-14
- --说明:北大青鸟简历导入注册个人存储过程。没有IP限制。
- --注册新用户,记录到dateReport
- --过程:
- --检查是否在黑名单 -1
- --检查是否在paMain -2
- --检查是否在推广表
- -- 在推广表,并且160天内推广过的
- -- 认为是推广有效,记录Addman,registermode=1
- --删除推广表中的该邮件
- --检查发帖来源
- --检查连接来源
- --保存错误 -3
- --加密后的注册 暂时保留明文PlainPassword
- ---------------------------------------------------
- CREATE PROCEDURE [dbo].[pcPaMainImport]
- (
- @Email VARCHAR(50),
- @Password VARCHAR(60),
- @dcSubSiteID SMALLINT,
- @RegisterIP VARCHAR(31),
- @UrlID INT,
- @InfoID INT
- )
- AS
- SET NOCOUNT ON
- IF (@RegisterIP = '180.129.225.52' OR @RegisterIP = '180.129.225.50' OR @RegisterIP = '220.164.162.215') AND LEN(@Email) > 30
- RETURN 1
- BEGIN TRAN
- ----在黑名单中则终止
- IF EXISTS(SELECT 'X' FROM Person_Black WITH(NOLOCK) WHERE Email = @Email)
- BEGIN
- UPDATE Person_black SET refusecount=refusecount+1 where email = @Email
- COMMIT
- RETURN -1
- END
- ----在paMain中邮件重复则终止,新注册的都要是新邮箱
- IF EXISTS(SELECT 'X' FROM paMain WITH(NOLOCK) WHERE EMail = @Email)
- BEGIN
- ROLLBACK TRAN
- RETURN -2
- END
- DECLARE @MaxId AS INT
- DECLARE @AddMan SMALLINT
- DECLARE @RegisterMode TINYINT
- DECLARE @dcProvinceID TINYINT
- SELECT @RegisterMode = 0, @dcProvinceID = LEFT(@dcSubSiteID, 2)
- SET @Email = REPLACE(@Email, ' ', '')
- --160天内,是否推广邮件,IsHistory有计划任务保证
- SELECT TOP 1 @AddMan = AddMan FROM Resume_Xinxi WITH( INDEX(IX_Resume_Xinxi_Email) NOLOCK)
- WHERE Email = @Email AND IsHistory = 0
- AND Province_ID = @dcProvinceID
- ORDER BY RegDate DESC
- ----是160天内推广的
- IF @AddMan > 0
- SET @RegisterMode = 1
- DECLARE @CountDate AS INT
- SET @CountDate = YEAR(GETDATE())*10000+MONTH(GETDATE())*100+DAY(GETDATE())
- IF @RegisterMode = 0 --非推广,自己注册的
- BEGIN
- INSERT INTO paMain(Username, Password, dcProvinceID, dcSubSiteID, Email, RegisterIP, LastLoginDate, TotalLoginNum)
- VALUES(@Email, @Password, @dcProvinceID, @dcSubSiteID, @Email, @RegisterIP, GETDATE(), 1)
- SET @MaxId = @@IDENTITY
- UPDATE DateReport SET PersonRegNum = PersonRegNum + 1, PersonLoginNum_Net = PersonLoginNum_Net + 1
- WHERE province_id = @dcSubSiteID AND CountDate = @CountDate
- --INSERT INTO PaMainDateReport SELECT @MaxId, 11, GETDATE() --sean 20130708
- INSERT INTO PaMainDateReport SELECT @MaxId, 2, GETDATE() --sean 20130708
- END
- ELSE --推广的
- BEGIN
- INSERT INTO paMain(Username, Password, dcProvinceID, dcSubSiteID, Email, RegisterIP, AddMan, RegisterMode, LastLoginDate, TotalLoginNum)
- VALUES(@Email, @Password, @dcProvinceID, @dcSubSiteID, @Email, @RegisterIP, @AddMan, @RegisterMode, GETDATE(), 1)
- SET @MaxId = @@IDENTITY
- UPDATE DateReport SET ValidResume = ValidResume + 1, PersonLoginNum_Net = PersonLoginNum_Net + 1
- WHERE province_id = @dcSubSiteID AND CountDate = @CountDate
- INSERT INTO PaMainDateReport SELECT @MaxId, 9, GETDATE() --sean 20130708
- --INSERT INTO PaMainDateReport SELECT @MaxId, 11, GETDATE() --sean 20130708
- IF NOT EXISTS(SELECT 'x' FROM Info_DateReport WITH(NOLOCK)
- WHERE CountDate = @CountDate
- AND Province_ID = @dcProvinceID
- AND InfoManager_ID = @AddMan
- )
- INSERT INTO Info_DateReport(Province_ID, Infomanager_ID, CountDate)
- VALUES(@dcProvinceID, @AddMan, @CountDate)
- UPDATE Info_DateReport
- SET ValidResume = ValidResume + 1
- WHERE CountDate = @CountDate
- AND Province_ID = @dcProvinceID
- AND InfoManager_ID = @AddMan
- END
-
- INSERT INTO paOperationLog (paMainID,Operation,Details,IP) VALUES(@MaxID,10,'注册个人账号成功。',@RegisterIP)
- INSERT INTO paLoginLog (paMainID, LoginIP, AddDate, LoginFrom, Browser) VALUES(@MaxID, @RegisterIP, GETDATE(), 1, '50:From Import')
- COMMIT
- BEGIN TRY
- IF @UrlID>0
- UPDATE Url SET AllResume=AllResume+1,TodayResume=TodayResume+1 WHERE ID=@UrlID
- IF @InfoID>0
- BEGIN
- IF NOT EXISTS(SELECT 'x' FROM Info_DateReport WITH(NOLOCK)
- WHERE CountDate = @CountDate
- AND Province_ID = @dcProvinceID
- AND InfoManager_ID = @InfoID
- )
- INSERT INTO Info_DateReport(Province_ID, Infomanager_ID, CountDate)
- VALUES(@dcProvinceID, @InfoID, @CountDate)
- UPDATE Info_DateReport
- SET AllResume = AllResume + 1
- WHERE CountDate = @CountDate
- AND Province_ID = @dcSubSiteID
- AND InfoManager_ID = @InfoID
- END
- END TRY
- BEGIN CATCH
- RETURN -4
- END CATCH
- RETURN @MaxID
- ERR:
- BEGIN
- ROLLBACK TRAN
- RETURN -3
- END
- GO
- /****** Object: StoredProcedure [dbo].[pcPaMainInsert] Script Date: 2018/12/13 19:09:06 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- ---------------------------------------------------
- --修改:Sean 2010-9-14
- --说明:这是用户自己注册的主要存储过程
- --注册新用户,记录到dateReport
- --过程:
- --检查是否在黑名单 -1
- --检查是否在paMain -2
- --检查是否在推广表
- -- 在推广表,并且160天内推广过的
- -- 认为是推广有效,记录Addman,registermode=1
- --删除推广表中的该邮件
- --检查发帖来源
- --检查连接来源
- --保存错误 -3
- --加密后的注册 暂时保留明文PlainPassword
- --Lucifer添加 修改registermode,将注册的类型和方式放到@RegisterIP传过来,举例192.168.1.1|1$120
- --20180228 Carl 如果RegisterType=200,不进行时间限制
- ---------------------------------------------------
- CREATE PROCEDURE [dbo].[pcPaMainInsert]
- (
- @Email VARCHAR(50),
- @Password VARCHAR(60),
- @dcSubSiteID SMALLINT,
- @RegisterIP VARCHAR(50),
- @UrlID INT,
- @InfoID INT
- )
- AS
- SET NOCOUNT ON
- IF EXISTS(SELECT 'x' FROM Ip_Black WITH(NOLOCK) WHERE Ip = @RegisterIP)
- RETURN 0
- BEGIN TRY
- --Lucifer添加,拆解@RegisterIP
- DECLARE @RegisterParam AS VARCHAR(20), @RegisterFrom AS VARCHAR(5), @RegisterType AS VARCHAR(5), @RegFrom AS VARCHAR(5)
- SELECT @RegisterFrom = 1, @RegFrom = ''
- IF CHARINDEX('|', @RegisterIP) > 0
- BEGIN
- SET @RegisterParam = SUBSTRING(@RegisterIP, CHARINDEX('|', @RegisterIP) + 1, LEN(@RegisterIP) - CHARINDEX('|', @RegisterIP))
- SET @RegisterIP = SUBSTRING(@RegisterIP, 1, CHARINDEX('|', @RegisterIP) - 1)
- IF (LEN(@RegisterIP) > 31)
- SET @RegisterIp = LEFT(@RegisterIp, 31)
- --Lucifer添加,拆解@RegisterIP
- IF LEN(ISNULL(@RegisterParam, '')) > 0
- BEGIN
- SELECT @RegisterFrom = SUBSTRING(@RegisterParam, 1, CHARINDEX('$',@RegisterParam) - 1),
- @RegisterType = SUBSTRING(@RegisterParam, CHARINDEX('$', @RegisterParam) + 1, LEN(@RegisterParam) - CHARINDEX('$', @RegisterParam))
- IF @RegisterFrom = 'a'
- SELECT @RegisterFrom = 1, @RegFrom = 'a'
- END
- END
- --ELSE
- --BEGIN
- -- SELECT @RegisterFrom = 9, @RegisterType = 9
- --END
- IF @RegisterType = 0
- SELECT @RegisterType = NULL
- --IF (@RegisterIP = '180.129.225.52' OR @RegisterIP = '180.129.225.50' OR @RegisterIP = '220.164.162.215') AND LEN(@Email) > 30
- -- RETURN 1
- IF (SELECT COUNT(*) FROM paMain WITH(NOLOCK) WHERE RegisterIp = @RegisterIp AND AddDate > DATEADD(MINUTE, -10, GETDATE())) > 10 AND @RegisterType<>200
- RETURN 1
- -- IF NOT EXISTS(SELECT 'x' FROM Ip_White WHERE CHARINDEX(ip, @RegisterIp) > 0)
- -- BEGIN
- -- IF (SELECT COUNT(*) FROM paMain WITH(NOLOCK) WHERE RegisterIp = @RegisterIp AND AddDate > DATEADD(MINUTE, -30, GETDATE())) > 10
- -- RETURN -1
- -- --IF EXISTS(SELECT 'x' FROM tmp_limitip2 WHERE ip = @RegisterIP)
- -- -- RETURN -1
- -- END
- BEGIN TRAN
- ----在黑名单中则终止
- IF LEN(@Email) > 6 AND EXISTS(SELECT 'X' FROM Person_Black WITH(NOLOCK) WHERE Email = @Email)
- BEGIN
- UPDATE Person_black SET refusecount = refusecount + 1 where email = @Email
- COMMIT
- RETURN -1
- END
- ----在paMain中邮件重复则终止,新注册的都要是新邮箱
- IF EXISTS(SELECT 'X' FROM paMain WITH(NOLOCK) WHERE EMail = @Email)
- BEGIN
- ROLLBACK TRAN
- RETURN -2
- END
- DECLARE @MaxId AS INT, @AddMan SMALLINT, @RegisterMode TINYINT, @dcProvinceID TINYINT, @RegDate DATETIME
- SELECT @RegisterMode = 0, @dcProvinceID = LEFT(@dcSubSiteID, 2)
- IF @RegisterType NOT IN(101)
- BEGIN
- SET @Email = dbo.SafeSQL(REPLACE(@Email, ' ', ''))
- --160天内,是否推广邮件,IsHistory有计划任务保证
- SELECT TOP 1 @AddMan = AddMan, @RegDate = RegDate FROM Resume_Xinxi WITH( INDEX(IX_Resume_Xinxi_Email) NOLOCK)
- WHERE Email = @Email AND IsHistory = 0
- AND Province_ID = @dcProvinceID AND @RegisterType<>200
- ORDER BY RegDate DESC
- ----是160天内推广的
- IF @AddMan > 0
- SELECT @RegisterMode = 1, @RegisterType = 111
- END
- IF @RegisterMode = 0 AND @InfoID BETWEEN 201 AND 499
- BEGIN
- SELECT @RegisterMode = 1, @RegisterType = 111, @AddMan = @InfoID
- END
- DECLARE @CountDate AS INT
- SET @CountDate = YEAR(GETDATE()) * 10000 + MONTH(GETDATE()) * 100 + DAY(GETDATE())
-
- IF @RegisterMode = 0 --非推广,自己注册的
- BEGIN
- INSERT INTO paMain(Username, Password, dcProvinceID, dcSubSiteID, Email, RegisterIP, LastLoginDate, TotalLoginNum, RegisterFrom, RegisterType)
- VALUES(@Email, @Password, @dcProvinceID, @dcSubSiteID, @Email, @RegisterIP, GETDATE(), 1, @RegisterFrom, @RegisterType)
- SET @MaxId = @@IDENTITY
- IF @RegisterType <> 200
- BEGIN
- UPDATE DateReport SET PersonRegNum = PersonRegNum + 1, PersonLoginNum_Net = PersonLoginNum_Net + 1
- WHERE province_id = @dcSubSiteID AND CountDate = @CountDate
-
- INSERT INTO PaMainDateReport SELECT @MaxId, 2, GETDATE() --sean 20130708
- END
- ELSE
- INSERT INTO PaMainDateReport SELECT @MaxId, 3, GETDATE() --sean 20130708
- END
- ELSE --推广的
- BEGIN
- INSERT INTO paMain(Username, Password, dcProvinceID, dcSubSiteID, Email, RegisterIP, AddMan, RegisterMode, LastLoginDate, TotalLoginNum, AddDate, SpreadDate, RegisterFrom, RegisterType)
- VALUES(@Email, @Password, @dcProvinceID, @dcSubSiteID, @Email, @RegisterIP, @AddMan, @RegisterMode, GETDATE(), 1, GETDATE(), @RegDate, @RegisterFrom, @RegisterType)
- SET @MaxId = @@IDENTITY
- UPDATE DateReport SET ValidResume = ValidResume + 1, PersonLoginNum_Net = PersonLoginNum_Net + 1
- WHERE province_id = @dcSubSiteID AND CountDate = @CountDate
- INSERT INTO PaMainDateReport SELECT @MaxId, 9, GETDATE() --sean 20130708
- --INSERT INTO PaMainDateReport SELECT @MaxId, 11, GETDATE() --sean 20130708
- IF NOT EXISTS(SELECT 'x' FROM Info_DateReport WITH(NOLOCK)
- WHERE CountDate = @CountDate
- AND Province_ID = @dcProvinceID
- AND InfoManager_ID = @AddMan
- )
- INSERT INTO Info_DateReport(Province_ID, Infomanager_ID, CountDate)
- VALUES(@dcProvinceID, @AddMan, @CountDate)
- UPDATE Info_DateReport
- SET ValidResume = ValidResume + 1
- WHERE CountDate = @CountDate
- AND Province_ID = @dcProvinceID
- AND InfoManager_ID = @AddMan
- --Lucifer添加,新的register模式
- UPDATE paMain SET SpreadDate = @RegDate, RegisterType=101 WHERE ID=@MaxId
- END
-
- INSERT INTO paOperationLog (paMainID,Operation,Details,IP) VALUES(@MaxID,10,'注册个人账号成功。',@RegisterIP)
- INSERT INTO paLoginLog (paMainID, LoginIP, AddDate, LoginFrom, Browser) VALUES(@MaxID, @RegisterIP, GETDATE(), 60, '51:From Register')
- COMMIT
- END TRY
- BEGIN CATCH
- ROLLBACK TRAN
- INSERT INTO LogDb..RegisterErrorLog SELECT @MaxId, '10|' + @RegisterIP+'|'+@RegisterFrom, @Email + ' ' + @Password, GETDATE()
- END CATCH
- BEGIN TRY
- IF @UrlID>0
- BEGIN
- UPDATE Url SET AllResume=AllResume+1,TodayResume=TodayResume+1 WHERE ID=@UrlID
- --Lucifer添加,如果是百度竞价
- IF EXISTS(SELECT 'X' FROM Url WHERE ID=@UrlID AND DescrIption LIKE '%百度竞价%')
- INSERT INTO UrlAccount VALUES(@UrlID,@MaxID,NULL,GETDATE())
- END
- IF @InfoID > 0
- BEGIN
- IF NOT EXISTS(SELECT 'x' FROM Info_DateReport WITH(NOLOCK)
- WHERE CountDate = @CountDate
- AND Province_ID = @dcProvinceID
- AND InfoManager_ID = @InfoID
- )
- INSERT INTO Info_DateReport(Province_ID, Infomanager_ID, CountDate)
- VALUES(@dcProvinceID, @InfoID, @CountDate)
- UPDATE Info_DateReport
- SET AllResume = AllResume + 1
- WHERE CountDate = @CountDate
- AND Province_ID = @dcSubSiteID
- AND InfoManager_ID = @InfoID
- INSERT INTO InfoLog(InfoManager_Id, Ip, Referer, paMainId)
- VALUES(@InfoID, @RegisterIp, '', @MaxID)
- END
- IF @RegFrom = 'a'
- INSERT INTO paFromSeoLog SELECT @MaxId, GETDATE()
- END TRY
- BEGIN CATCH
- INSERT INTO LogDb..RegisterErrorLog SELECT @MaxId, '11|' + @RegisterIP, @Email + ' ' + @Password, GETDATE()
- RETURN -4
- END CATCH
- RETURN @MaxID
- ERR:
- BEGIN
- ROLLBACK TRAN
- INSERT INTO LogDb..RegisterErrorLog SELECT @MaxId, '12|' + @RegisterIP, @Email + ' ' + @Password, GETDATE()
- RETURN -3
- END
- GO
- /****** Object: StoredProcedure [dbo].[pcPaMainSelect] Script Date: 2018/12/13 19:09:06 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- CREATE PROCEDURE [dbo].[pcPaMainSelect]
- (
- @ID INT
- )
- AS
- BEGIN
- SELECT a.*, b.Name AS MapPlaceName,c.Description LiveRegion,d.Description AccountRegion,e.Description GrowRegion,dbo.BirthToAge(a.BirthDay) Age,
- (SELECT COUNT(1) FROM paMain WITH(NOLOCK) WHERE Mobile = a.Mobile) AS MobileCount,
- (SELECT TOP 1 LoginIP FROM paLoginLog WITH(NOLOCK) WHERE paLoginLog.paMainID = a.ID ORDER BY ID DESC) AS LastLoginIP,
- (SELECT COUNT(1) FROM paLoginLog WITH(NOLOCK) WHERE paLoginLog.paMainID = a.ID AND AddDate > CONVERT(VARCHAR(10), GETDATE(), 120)) AS TodayLoginNum,
- (SELECT TOP 1 AddDate FROM PaLoginLog WITH(NOLOCK) WHERE paLoginLog.paMainID = a.ID AND paLoginLog.AddDate < DATEADD(MINUTE, -2, a.LastLoginDate) ORDER BY Adddate DESC) AS PrevLoginDate,
- (SELECT COUNT(1) FROM MainDB..WxFans WHERE PaMainID = a.ID AND Status = 2) WechatBind,
- (SELECT TOP 1 PhotoProcessed FROM paPhoto WITH(NOLOCK INDEX(IX_paPhoto_paMainId)) WHERE paMainID = a.ID AND a.HasPhoto <> 2) AS PhotoProcessed,
- (SELECT TOP 1 Description FROM dcCareerStatus WITH(NOLOCK) WHERE ID = a.dcCareerStatus) AS CareerStatus
- FROM paMain a WITH(NOLOCK INDEX(PK_paMain)) LEFT JOIN dcMapPlace b WITH(NOLOCK) ON a.dcMapPlaceID = b.ID
- LEFT JOIN dcRegion c WITH(NOLOCK) ON c.ID = a.LivePlace
- LEFT JOIN dcRegion d WITH(NOLOCK) ON d.ID = a.AccountPlace
- LEFT JOIN dcRegion e WITH(NOLOCK) ON e.ID = a.GrowPlace
- WHERE a.ID = @ID
- END
- GO
- /****** Object: StoredProcedure [dbo].[pcPaMainSelect1] Script Date: 2018/12/13 19:09:06 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- -- =============================================
- -- 检查: Sean
- -- 日期: 2010-10-5
- -- 描述: 提取个人账号信息
- -- =============================================
- -- =============================================
- -- 修改: Peter
- -- 日期: 2013-9-5
- -- 描述: 添加获取上一次登录的登录时间
- -- =============================================
- CREATE PROCEDURE [dbo].[pcPaMainSelect1]
- @ID INT
- AS
- BEGIN
- SELECT *
- ,(SELECT TOP 1 LoginIP FROM paLoginLog WITH(NOLOCK) WHERE paLoginLog.paMainID = paMain.ID ORDER BY ID DESC) AS LastLoginIP
- ,(SELECT COUNT(1) FROM paLoginLog WITH(NOLOCK) WHERE paLoginLog.paMainID = paMain.ID AND AddDate > CONVERT(VARCHAR(10), GETDATE(), 120)) AS TodayLoginNum
- ,(SELECT TOP 1 AddDate FROM PaLoginLog WITH(NOLOCK) WHERE paLoginLog.paMainID = paMain.ID AND paLoginLog.AddDate < DATEADD(MINUTE, -2, paMain.LastLoginDate) ORDER BY Adddate DESC) AS PrevLoginDate
- FROM paMain WITH(NOLOCK INDEX(PK_paMain))
- WHERE ID=@ID
- END
- GO
- /****** Object: StoredProcedure [dbo].[pcPaMainSelectByPhone] Script Date: 2018/12/13 19:09:06 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- CREATE PROCEDURE [dbo].[pcPaMainSelectByPhone]
- @ID INT
- AS
- BEGIN
- SELECT a.*,b.FullName LiveRegion,c.FullName GrowRegion,d.FullName AccountRegion,e.Description CareerStatus
- ,(SELECT TOP 1 LoginIP FROM paLoginLog WITH(NOLOCK) WHERE paLoginLog.paMainID = a.ID ORDER BY ID DESC) AS LastLoginIP,
- (SELECT COUNT(1) FROM paLoginLog WITH(NOLOCK) WHERE paLoginLog.paMainID = a.ID AND AddDate > CONVERT(VARCHAR(10), GETDATE(), 120)) AS TodayLoginNum
- FROM paMain a WITH(NOLOCK INDEX(PK_paMain))
- INNER JOIN dcRegion b WITH(NOLOCK) ON a.LivePlace=b.ID
- INNER JOIN dcRegion c WITH(NOLOCK) ON a.GrowPlace=c.ID
- INNER JOIN dcRegion d WITH(NOLOCK) ON a.AccountPlace=d.ID
- INNER JOIN dcCareerStatus e WITH(NOLOCK) ON a.dcCareerStatus=e.ID
- WHERE a.ID=@ID
- END
- GO
- /****** Object: StoredProcedure [dbo].[pcPaMainUpdate] Script Date: 2018/12/13 19:09:06 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- -- =============================================
- -- Author: Sean
- -- Check date: 2010-9-17
- -- Description: 修改账号信息 ,cvMainID为0时不修改cvmain信息
- --修改:Peter 2016-03-30 一分钟填写简历同时修改求职状态
- --修改harry 2018-7-5 处理liveplace等
- -- =============================================
- CREATE PROCEDURE [dbo].[pcPaMainUpdate]
- (
- @Type INT,
- @paMainID INT,
- @cvMainID INT,
- @Name VARCHAR(30),
- @Gender BIT,
- @BirthDay INT,
- @LivePlace VARCHAR(6),
- @AccountPlace VARCHAR(6),
- @GrowPlace VARCHAR(6),
- @Mobile VARCHAR(13),
- @OnlineContact TINYINT,
- @OnlineContactNo VARCHAR(50),
- @Homepage VARCHAR(200),
- @Marriage TINYINT,
- @Nation TINYINT,
- @Height TINYINT,
- @dcCareerStatus TINYINT,
- @IP VARCHAR(39)
- )
- AS
- SET NOCOUNT ON
- IF CHARINDEX('<', @Name) > 0
- SET @Name = REPLACE(@Name, '<', '')
- IF CHARINDEX('<', @OnlineContactNo) > 0
- SET @OnlineContactNo = REPLACE(@OnlineContactNo, '<', '')
- IF CHARINDEX('<', @Homepage) > 0
- SET @Homepage = REPLACE(@Homepage, '<', '')
- IF ISNULL(@paMainID, 0) = 0
- RETURN -9
- IF dbo.TrimNULL(@Name) IS NULL
- RETURN -8
- IF dbo.TrimNULL(@Mobile) IS NULL
- RETURN -7
- IF @dcCareerStatus = 0
- SET @dcCareerStatus = NULL
- IF @Marriage = 0
- SET @Marriage = NULL
- IF @Nation = 0
- SET @Nation = NULL
- IF EXISTS(SELECT 'x' FROM Person_BLACK WITH(NOLOCK) WHERE Mobile = @Mobile)
- BEGIN
- ----有黑名单,则增加拒绝次数
- UPDATE Person_Black SET RefuseCount = RefuseCount + 1 WHERE Mobile = @Mobile
- RETURN -1
- END
- BEGIN TRAN
- BEGIN TRY
-
- IF CHARINDEX(' ', @LivePlace) >2
- BEGIN
- SET @LivePlace=substring(@LivePlace,1,charindex(' ',@LivePlace)-1)
- END
- IF CHARINDEX(' ', @AccountPlace) >2
- BEGIN
- SET @AccountPlace=substring(@AccountPlace,1,charindex(' ',@AccountPlace)-1)
- END
- IF CHARINDEX(' ', @GrowPlace) >2
- BEGIN
- SET @GrowPlace=substring(@GrowPlace,1,charindex(' ',@GrowPlace)-1)
- END
-
- DECLARE @NameEngOld AS VARCHAR(30)
- DECLARE @NameOld AS VARCHAR(12)
- DECLARE @OnlineContactNoOld AS VARCHAR(50)
- DECLARE @HomepageOld AS VARCHAR(200)
- DECLARE @MobileOld AS VARCHAR(13)
- DECLARE @Modify AS INT
- -- @Modify=-1未修改需审核项, @Modify=0修改中文项目; @Modify=1修改了英文项目
- SET @Modify=-1
- --检查在线联系方式和号码
- IF @OnlineContact IS NULL
- SET @OnlineContactNo = ''
- ELSE
- SET @OnlineContactNo = dbo.SafeSql(@OnlineContactNo)
- --取消不正确的主页格式
- SET @Homepage=REPLACE(@Homepage,'http%3A//','http://')
- SET @Homepage=REPLACE(@Homepage,'http://','')
- IF LTRIM(RTRIM(@Homepage)) = 'http://'
- SET @Homepage = null
- IF ISNULL(@Homepage, '') = ''
- SET @Homepage = null
- IF ISNULL(@OnlineContactNo, '') = ''
- SET @OnlineContactNo = null
- --获得原始数据
- SELECT @NameOld=Name,@NameEngOld=NameEng,@OnlineContactNoOld=OnlineContactNo,@HomepageOld=Homepage,@MobileOld=Mobile
- FROM paMain WITH(NOLOCK INDEX(PK_paMain))
- WHERE ID = @paMainID
- --0中文,1英文,只有姓名不同
- IF @TYPE=0
- BEGIN
- DECLARE @CNAME AS VARCHAR(12)
- SET @CNAME = @Name
- UPDATE paMain
- SET Name=@CNAME,
- Gender=@Gender,
- BirthDay=@BirthDay,
- LivePlace=@LivePlace,
- AccountPlace=@AccountPlace,
- GrowPlace=@GrowPlace,
- Mobile=@Mobile,
- OnlineContact=@OnlineContact,
- OnlineContactNo=@OnlineContactNo,
- Homepage=@Homepage,
- Marriage=@Marriage,
- Nation=@Nation,
- Height=@Height,
- dcCareerStatus=@dcCareerStatus,
- LastModifyDate=GETDATE()
- WHERE ID=@paMainID
- END
- ELSE
- UPDATE paMain
- SET NameENG=@Name,
- Gender=@Gender,
- BirthDay=@BirthDay,
- LivePlace=@LivePlace,
- AccountPlace=@AccountPlace,
- GrowPlace=@GrowPlace,
- Mobile=@Mobile,
- OnlineContact=@OnlineContact,
- OnlineContactNo=@OnlineContactNo,
- Homepage=@Homepage,
- Marriage=@Marriage,
- Nation=@Nation,
- Height=@Height,
- dcCareerStatus=@dcCareerStatus,
- LastModifyDate=GETDATE()
- WHERE ID=@paMainID
- --保存到bsCvModify,姓名
- IF @TYPE=0
- BEGIN
- IF ISNULL(@NameOld, '') <> @CNAME
- BEGIN
- DELETE FROM bsCvModify WHERE paMainID = @paMainID AND Location = 'ac1'
- INSERT INTO bsCvModify(paMainID,Location,ColValue) VALUES(@paMainID,'ac1',@CNAME)
- SET @Modify=0
- INSERT INTO paOperationLog (paMainID, Operation, Details, IP)
- VALUES(@paMainID, 30,'更新姓名,原姓名:<' + ISNULL(@NameOld, '') + '>;新姓名:<' + @CName + '>', @IP)
- END
- END
- ELSE
- IF ISNULL(@NameOld, '') <> @Name
- BEGIN
- DELETE FROM bsCvModify WHERE paMainID = @paMainID AND Location = 'ae1'
- INSERT INTO bsCvModify(paMainID,Location,ColValue) VALUES(@paMainID,'ae1',@CNAME)
- SET @Modify=1
- INSERT INTO paOperationLog (paMainID, Operation, Details, IP)
- VALUES(@paMainID, 31,'更新英文名,原英文名:<' + ISNULL(@NameOld, '') + '>;新英文名:<' + @Name + '>', @IP)
- END
- --在线联系号码
- IF @OnlineContactNo IS NULL
- DELETE FROM bsCvModify WHERE paMainID = @paMainID AND Location = 'ac2'
- ELSE
- IF @OnlineContactNo <> ISNULL(@OnlineContactNoOld, '')
- BEGIN
- DELETE FROM bsCvModify WHERE paMainID = @paMainID AND Location = 'ac2'
- INSERT INTO bsCvModify(paMainID,Location,ColValue) VALUES(@paMainID,'ac2',@OnlineContactNo)
- SET @Modify=0
- END
- --主页
- IF @Homepage IS NULL
- DELETE FROM bsCvModify WHERE paMainID = @paMainID AND Location = 'ac3'
- ELSE
- IF @Homepage <> ISNULL(@HomepageOld, '')
- BEGIN
- DELETE FROM bsCvModify WHERE paMainID = @paMainID AND Location = 'ac3'
- INSERT INTO bsCvModify(paMainID,Location,ColValue) VALUES(@paMainID,'ac3',@Homepage)
- SET @Modify=0
- END
- --手机号码
- IF ISNULL(@MobileOld, '') <> @Mobile
- BEGIN
- DELETE FROM bsCvModify WHERE paMainID = @paMainID AND Location = 'ac4'
- --INSERT INTO bsCvModify(paMainID,Location,ColValue) VALUES(@paMainID,'ac4',@Mobile)
- --SET @Modify=0
- INSERT INTO paOperationLog (paMainID, Operation, Details, IP)
- VALUES(@paMainID, 35,'更新手机号,原手机号:<' + ISNULL(@MobileOld, '') + '>;新手机号:<' + @Mobile + '>', @IP)
- END
-
- ----修改cvMain.cvLevel
- IF @TYPE=0
- UPDATE cvMain SET cvLevel='11' + RIGHT(cvLevel,8) WHERE paMainID = @paMainID
- ELSE
- UPDATE cvMain SET cvLevelEng='11' + RIGHT(cvLevelEng,8) WHERE paMainID = @paMainID
- --1小时内不重复刷新,防止刷新排名
- UPDATE cvmain SET RefreshDate = GETDATE() WHERE ID=@cvMainID AND DATEADD(HOUR, 1, RefreshDate) < GETDATE() AND paMainID = @paMainID
- ----12小时内只保留一次修改记录
- DELETE FROM paOperationLog WHERE paMainID=@paMainID AND Operation=11 AND AddDate>GETDATE()-0.5
- INSERT INTO paOperationLog (paMainID,Operation,Details,IP) VALUES(@paMainID,11,'更新基本信息成功。',@IP)
- END TRY
- BEGIN CATCH
- GOTO ERR
- END CATCH
- COMMIT TRAN
- RETURN 1
- ERR:
- BEGIN
- ROLLBACK TRAN
- RETURN 0
- END
- GO
- /****** Object: StoredProcedure [dbo].[pcPaMainUpdate20171108] Script Date: 2018/12/13 19:09:08 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- -- =============================================
- -- Author: Sean
- -- Check date: 2010-9-17
- -- Description: 修改账号信息 ,cvMainID为0时不修改cvmain信息
- --修改:Peter 2016-03-30 一分钟填写简历同时修改求职状态
- --修改harry 2018-7-5 处理liveplace等
- -- =============================================
- CREATE PROCEDURE [dbo].[pcPaMainUpdate20171108]
- (
- @Type INT,
- @paMainID INT,
- @cvMainID INT,
- @Name VARCHAR(30),
- @Gender BIT,
- @BirthDay INT,
- @LivePlace VARCHAR(6),
- @AccountPlace VARCHAR(6),
- @GrowPlace VARCHAR(6),
- @Mobile VARCHAR(13),
- @OnlineContact TINYINT,
- @OnlineContactNo VARCHAR(50),
- @Homepage VARCHAR(200),
- @Marriage TINYINT,
- @Nation TINYINT,
- @Height TINYINT,
- @dcCareerStatus TINYINT,
- @IP VARCHAR(39),
- @dcMapPlaceId INT
- )
- AS
- SET NOCOUNT ON
- IF CHARINDEX('<', @Name) > 0
- SET @Name = REPLACE(@Name, '<', '')
- IF CHARINDEX('<', @OnlineContactNo) > 0
- SET @OnlineContactNo = REPLACE(@OnlineContactNo, '<', '')
- IF CHARINDEX('<', @Homepage) > 0
- SET @Homepage = REPLACE(@Homepage, '<', '')
- IF ISNULL(@paMainID, 0) = 0
- RETURN -9
- IF dbo.TrimNULL(@Name) IS NULL
- RETURN -8
- IF dbo.TrimNULL(@Mobile) IS NULL
- RETURN -7
- IF @dcCareerStatus = 0
- SET @dcCareerStatus = NULL
- IF @Marriage = 0
- SET @Marriage = NULL
- IF @Nation = 0
- SET @Nation = NULL
- IF EXISTS(SELECT 'x' FROM Person_BLACK WITH(NOLOCK) WHERE Mobile = @Mobile)
- BEGIN
- ----有黑名单,则增加拒绝次数
- UPDATE Person_Black SET RefuseCount = RefuseCount + 1 WHERE Mobile = @Mobile
- RETURN -1
- END
- BEGIN TRAN
- BEGIN TRY
-
- IF CHARINDEX(' ', @LivePlace) >2
- BEGIN
- SET @LivePlace=substring(@LivePlace,1,charindex(' ',@LivePlace)-1)
- END
- IF CHARINDEX(' ', @AccountPlace) >2
- BEGIN
- SET @AccountPlace=substring(@AccountPlace,1,charindex(' ',@AccountPlace)-1)
- END
- IF CHARINDEX(' ', @GrowPlace) >2
- BEGIN
- SET @GrowPlace=substring(@GrowPlace,1,charindex(' ',@GrowPlace)-1)
- END
-
- DECLARE @NameEngOld AS VARCHAR(30)
- DECLARE @NameOld AS VARCHAR(12)
- DECLARE @OnlineContactNoOld AS VARCHAR(50)
- DECLARE @HomepageOld AS VARCHAR(200)
- DECLARE @MobileOld AS VARCHAR(13)
- DECLARE @Modify AS INT
- -- @Modify=-1未修改需审核项, @Modify=0修改中文项目; @Modify=1修改了英文项目
- SET @Modify=-1
- --检查在线联系方式和号码
- IF @OnlineContact IS NULL
- SET @OnlineContactNo = ''
- ELSE
- SET @OnlineContactNo = dbo.SafeSql(@OnlineContactNo)
- --取消不正确的主页格式
- SET @Homepage=REPLACE(@Homepage,'http%3A//','http://')
- SET @Homepage=REPLACE(@Homepage,'http://','')
- IF LTRIM(RTRIM(@Homepage)) = 'http://'
- SET @Homepage = null
- IF ISNULL(@Homepage, '') = ''
- SET @Homepage = null
- IF ISNULL(@OnlineContactNo, '') = ''
- SET @OnlineContactNo = null
- --获得原始数据
- SELECT @NameOld=Name,@NameEngOld=NameEng,@OnlineContactNoOld=OnlineContactNo,@HomepageOld=Homepage,@MobileOld=Mobile
- FROM paMain WITH(NOLOCK INDEX(PK_paMain))
- WHERE ID = @paMainID
- --0中文,1英文,只有姓名不同
- IF @TYPE=0
- BEGIN
- DECLARE @CNAME AS VARCHAR(12)
- SET @CNAME = @Name
- UPDATE paMain
- SET Name=@CNAME,
- Gender=@Gender,
- BirthDay=@BirthDay,
- LivePlace=@LivePlace,
- AccountPlace=@AccountPlace,
- GrowPlace=@GrowPlace,
- Mobile=@Mobile,
- OnlineContact=@OnlineContact,
- OnlineContactNo=@OnlineContactNo,
- Homepage=@Homepage,
- Marriage=@Marriage,
- Nation=@Nation,
- Height=@Height,
- dcCareerStatus=@dcCareerStatus,
- dcMapPlaceId = @dcMapPlaceId,
- LastModifyDate=GETDATE()
- WHERE ID=@paMainID
- END
- ELSE
- UPDATE paMain
- SET NameENG=@Name,
- Gender=@Gender,
- BirthDay=@BirthDay,
- LivePlace=@LivePlace,
- AccountPlace=@AccountPlace,
- GrowPlace=@GrowPlace,
- Mobile=@Mobile,
- OnlineContact=@OnlineContact,
- OnlineContactNo=@OnlineContactNo,
- Homepage=@Homepage,
- Marriage=@Marriage,
- Nation=@Nation,
- Height=@Height,
- dcCareerStatus=@dcCareerStatus,
- dcMapPlaceId = @dcMapPlaceId,
- LastModifyDate=GETDATE()
- WHERE ID=@paMainID
- --保存到bsCvModify,姓名
- IF @TYPE=0
- BEGIN
- IF ISNULL(@NameOld, '') <> @CNAME
- BEGIN
- DELETE FROM bsCvModify WHERE paMainID = @paMainID AND Location = 'ac1'
- INSERT INTO bsCvModify(paMainID,Location,ColValue) VALUES(@paMainID,'ac1',@CNAME)
- SET @Modify=0
- INSERT INTO paOperationLog (paMainID, Operation, Details, IP)
- VALUES(@paMainID, 30,'更新姓名,原姓名:<' + ISNULL(@NameOld, '') + '>;新姓名:<' + @CName + '>', @IP)
- END
- END
- ELSE
- IF ISNULL(@NameOld, '') <> @Name
- BEGIN
- DELETE FROM bsCvModify WHERE paMainID = @paMainID AND Location = 'ae1'
- INSERT INTO bsCvModify(paMainID,Location,ColValue) VALUES(@paMainID,'ae1',@CNAME)
- SET @Modify=1
- INSERT INTO paOperationLog (paMainID, Operation, Details, IP)
- VALUES(@paMainID, 31,'更新英文名,原英文名:<' + ISNULL(@NameOld, '') + '>;新英文名:<' + @Name + '>', @IP)
- END
- --在线联系号码
- IF @OnlineContactNo IS NULL
- DELETE FROM bsCvModify WHERE paMainID = @paMainID AND Location = 'ac2'
- ELSE
- IF @OnlineContactNo <> ISNULL(@OnlineContactNoOld, '')
- BEGIN
- DELETE FROM bsCvModify WHERE paMainID = @paMainID AND Location = 'ac2'
- INSERT INTO bsCvModify(paMainID,Location,ColValue) VALUES(@paMainID,'ac2',@OnlineContactNo)
- SET @Modify=0
- END
- --主页
- IF @Homepage IS NULL
- DELETE FROM bsCvModify WHERE paMainID = @paMainID AND Location = 'ac3'
- ELSE
- IF @Homepage <> ISNULL(@HomepageOld, '')
- BEGIN
- DELETE FROM bsCvModify WHERE paMainID = @paMainID AND Location = 'ac3'
- INSERT INTO bsCvModify(paMainID,Location,ColValue) VALUES(@paMainID,'ac3',@Homepage)
- SET @Modify=0
- END
- --手机号码
- IF ISNULL(@MobileOld, '') <> @Mobile
- BEGIN
- DELETE FROM bsCvModify WHERE paMainID = @paMainID AND Location = 'ac4'
- --INSERT INTO bsCvModify(paMainID,Location,ColValue) VALUES(@paMainID,'ac4',@Mobile)
- --SET @Modify=0
- INSERT INTO paOperationLog (paMainID, Operation, Details, IP)
- VALUES(@paMainID, 35,'更新手机号,原手机号:<' + ISNULL(@MobileOld, '') + '>;新手机号:<' + @Mobile + '>', @IP)
- END
-
- ----修改cvMain.cvLevel
- IF @TYPE=0
- UPDATE cvMain SET cvLevel='11' + RIGHT(cvLevel,8) WHERE paMainID = @paMainID
- ELSE
- UPDATE cvMain SET cvLevelEng='11' + RIGHT(cvLevelEng,8) WHERE paMainID = @paMainID
- --1小时内不重复刷新,防止刷新排名
- UPDATE cvmain SET RefreshDate = GETDATE() WHERE ID=@cvMainID AND DATEADD(HOUR, 1, RefreshDate) < GETDATE() AND paMainID = @paMainID
- ----12小时内只保留一次修改记录
- DELETE FROM paOperationLog WHERE paMainID=@paMainID AND Operation=11 AND AddDate>GETDATE()-0.5
- INSERT INTO paOperationLog (paMainID,Operation,Details,IP) VALUES(@paMainID,11,'更新基本信息成功。',@IP)
- END TRY
- BEGIN CATCH
- GOTO ERR
- END CATCH
- COMMIT TRAN
- RETURN 1
- ERR:
- BEGIN
- ROLLBACK TRAN
- RETURN 0
- END
- GO
- /****** Object: StoredProcedure [dbo].[pcPaNotifyByIsViewedUpdate] Script Date: 2018/12/13 19:09:08 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- -----------------
- --个人会员中心首页,修改网站消息是否查看
- -----------------
- CREATE PROCEDURE [dbo].[pcPaNotifyByIsViewedUpdate]
- (
- @paNotifyID INT,
- @paMainID INT
- )
- AS
- BEGIN
- IF EXISTS(SELECT 'x' FROM paNotify WITH(NOLOCK)
- WHERE ID = @paNotifyID
- AND paMainID = @paMainID
- AND IsViewed = 0)
- UPDATE paNotify SET IsViewed = 1
- WHERE ID = @paNotifyID
- AND paMainID = @paMainID
- END
- GO
- /****** Object: StoredProcedure [dbo].[pcPaNotifyByPaMainIDSelect] Script Date: 2018/12/13 19:09:08 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- -----------------
- --网站消息列表
- -----------------
- CREATE PROCEDURE [dbo].[pcPaNotifyByPaMainIDSelect]
- (
- @paMainID INT
- )
- AS
- BEGIN
- SELECT ID, AddDate, NotifyType, Substring(Message, 0 ,20) Message, IsViewed, ENDDate
- FROM PaNotify WITH(NOLOCK)
- WHERE paMainID = @paMainID
- ORDER BY ID DESC
- END
- GO
- /****** Object: StoredProcedure [dbo].[pcPaNotifySelect] Script Date: 2018/12/13 19:09:08 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- -----------------
- --个人会员中心首页,显示网站消息通知
- -----------------
- CREATE PROCEDURE [dbo].[pcPaNotifySelect]
- (
- @paMainID INT
- )
- AS
- BEGIN
- SELECT ID, AddDate, NotifyType, Message
- FROM PaNotify WITH(NOLOCK)
- WHERE paMainID = @paMainID
- AND (
- (NotifyType = 1 AND IsViewed = 0) --一次性消息,看过就不再通知了
- OR (NotifyType=2 AND ENDDate > GETDATE()) --即时消息,到期前(ENDdate)一直通知
- )
- ORDER BY ID DESC
- END
- GO
- /****** Object: StoredProcedure [dbo].[pcpaOperationLogSelect] Script Date: 2018/12/13 19:09:08 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- --=============================================
- -- 创建: sean
- -- 检查: 2010-10-6
- -- 说明: 操作记录列表
- --=============================================
- CREATE PROCEDURE [dbo].[pcpaOperationLogSelect]
- (
- @paMainID INT
- )
- AS
- BEGIN
- SELECT TOP 1000 * FROM paOperationLog WITH(NOLOCK INDEX(IX_paOperationLog_paMainID))
- WHERE paMainID = @paMainID
- ORDER BY ID DESC
- END
- GO
- /****** Object: StoredProcedure [dbo].[pcpaPhoto_beforeInsert] Script Date: 2018/12/13 19:09:09 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- -- lambo
- -- 2011-05-24
- -- 将上传照片的信息先放在paPhoto_before中
- CREATE PROCEDURE [dbo].[pcpaPhoto_beforeInsert]
- @paMainID INT,
- @Photo VARCHAR(50)
- AS
- DECLARE @MaxId AS INT
- INSERT INTO paPhoto_before (paMainID,FileUrl)
- VALUES(@paMainID,dbo.SafeSQL(@Photo))
- SET @MaxID = @@IDENTITY
- RETURN @MaxID
- GO
- /****** Object: StoredProcedure [dbo].[pcpaPhotoDelete] Script Date: 2018/12/13 19:09:09 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- --=============================================
- -- 创建: sean
- -- 检查: 2010-10-6
- -- 说明: 照片删除
- --=============================================
- CREATE PROCEDURE [dbo].[pcpaPhotoDelete]
- (
- @paMainID INT,
- @IP VARCHAR(39)
- )
- AS
- BEGIN TRAN
- BEGIN TRY
- DELETE FROM paPhoto WHERE paMainID=@paMainID
- UPDATE paMain SET HasPhoto=NULL WHERE ID=@paMainID
- INSERT INTO paOperationLog (paMainID, Operation, Details, IP)
- VALUES(@paMainID, 41, '删除照片', @IP)
- END TRY
- BEGIN CATCH
- GOTO ERR
- END CATCH
- COMMIT TRAN
- RETURN 1
- ERR:
- BEGIN
- ROLLBACK TRAN
- RETURN 0
- END
- GO
- /****** Object: StoredProcedure [dbo].[pcpaPhotoInsert] Script Date: 2018/12/13 19:09:09 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- --=============================================
- -- 创建: sean
- -- 检查: 2010-10-6
- -- 说明: 照片上传
- --=============================================
- CREATE PROCEDURE [dbo].[pcpaPhotoInsert]
- @paMainID INT
- AS
- BEGIN TRAN
- DECLARE @MaxId AS INT
- BEGIN TRY
- DELETE FROM paPhoto WHERE paMainID=@paMainID
- UPDATE paMain SET HasPhoto=0 WHERE ID=@paMainID
- INSERT INTO paPhoto (paMainID,Photo,PhotoProcessed)
- SELECT TOP 1 paMainID , FileUrl,FileUrl FROM paPhoto_before WHERE paMainID = @paMainID ORDER BY ID DESC
- DELETE FROM paPhoto_before WHERE ID = (SELECT TOP 1 ID FROM paPhoto_before WHERE paMainID = @paMainID ORDER BY ID DESC)
- INSERT INTO paOperationLog (paMainID,Operation,Details,IP)
- VALUES(@paMainID,40,'更新照片', '')
- SET @MaxID = @@IDENTITY
- END TRY
- BEGIN cATCH
- GOTO ERR
- END CATCH
- COMMIT TRAN
- RETURN @MaxID
- ERR:
- BEGIN
- ROLLBACK TRAN
- RETURN 0
- END
- GO
- /****** Object: StoredProcedure [dbo].[pcpaPhotoSelect] Script Date: 2018/12/13 19:09:09 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- --=============================================
- -- 创建: sean
- -- 检查: 2010-10-6
- -- 说明: 照片信息提取
- --=============================================
- CREATE PROCEDURE [dbo].[pcpaPhotoSelect]
- @paMainID INT
- AS
- BEGIN
- SELECT a.*,b.HasPhoto
- FROM paPhoto a WITH(NOLOCK INDEX(IX_paPhoto_paMainId)),paMain b with(NOLOCK) WHERE a.paMainID = b.ID AND a.paMainID=@paMainID
- END
- GO
- /****** Object: StoredProcedure [dbo].[pcPaPlaintByIsViewedUpdate] Script Date: 2018/12/13 19:09:09 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- --==================================================
- --检查 Alen 2017-9-15
- --描述 修改投诉记录为已查看
- --==================================================
- CREATE PROCEDURE [dbo].[pcPaPlaintByIsViewedUpdate]
- (
- @paMainID INT
- )
- AS
- BEGIN
- UPDATE MainDB..paplaint
- SET IsViewed = 1
- WHERE paMainID = @paMainID
- AND IsViewed = 0
- AND ReplyType > 0
- END
- GO
- /****** Object: StoredProcedure [dbo].[pcPaPlaintByNameInsert] Script Date: 2018/12/13 19:09:09 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- --修改harry,增加顾问提醒2017-9-26
- --修改harry 无顾问的提醒给客服
- --修改 Sunshine 顾问为空号的提醒给上级
- CREATE PROCEDURE [dbo].[pcPaPlaintByNameInsert]
- (
- @paMainID INT,
- @caMainID INT,
- @jobID INT,
- @IP VARCHAR(50),
- @Name NVARCHAR(50),
- @Telephone VARCHAR(11),
- @Email VARCHAR(50),
- @Plaint NVARCHAR(200)
- )
- AS
- SET NOCOUNT ON
- BEGIN
- INSERT INTO mainDB..paPlaint(paMainID, caMainID, jobID, IP, Name, Telephone, Email, Plaint, AddDate, ReplyType)
- VALUES(@paMainID, @caMainID, @jobID, @IP, @Name, @Telephone, @Email, @Plaint, GETDATE(), 0)
-
- IF EXISTS (SELECT 'x' FROM caMain a, cpMain b, managerUser c
- WHERE a.cpMainId = b.Id
- AND b.ConsultantId > 0 AND a.id =@caMainID AND c.id=b.ConsultantId AND c.status<3)
- BEGIN
- INSERT INTO RtxNotifyLog(Receiver, RtxTitle, RtxMessage, SendType, DelayTime, ShowType)
- SELECT ConsultantId, '个人投诉企业通知','投诉内容:'+@Plaint+ ' http://sysback.51rc.com/newoa/operate/complaint/paPlaint?isReply=3&selType=2&selOption=0&txtSearch='+CONVERT(CHAR(10),@caMainID), 1, 0, 0
- FROM caMain a, cpMain b WHERE a.cpMainId = b.Id AND b.ConsultantId > 0 AND a.id =@caMainID
- END
- ELSE IF EXISTS(SELECT 'x' FROM caMain a, cpMain b, managerUser c --20181108 Sunshine 添加 顾问为空号的提醒给上级
- WHERE a.cpMainId = b.Id
- AND b.ConsultantId > 0 AND a.id =@caMainID AND c.id=b.ConsultantId AND c.status >= 3)
- BEGIN
- INSERT INTO RtxNotifyLog(Receiver, RtxTitle, RtxMessage, SendType, DelayTime, ShowType)
- SELECT (SELECT superior FROM managerUser WHERE id = b.ConsultantId), '个人投诉企业通知','投诉内容:'+@Plaint+ ' http://sysback.51rc.com/newoa/operate/complaint/paPlaint?isReply=3&selType=2&selOption=0&txtSearch='+CONVERT(CHAR(10),@caMainID), 1, 0, 0
- FROM caMain a, cpMain b WHERE a.cpMainId = b.Id AND b.ConsultantId > 0 AND a.id =@caMainID
- END
- ELSE --20181108 Sunshine 添加 顾问为空号的提醒给上级
- BEGIN
- INSERT INTO RtxNotifyLog(Receiver, RtxTitle, RtxMessage, SendType, DelayTime, ShowType)
- SELECT '180,182,222,223,216,155', '个人投诉企业通知','投诉内容:'+@Plaint+ ' http://sysback.51rc.com/newoa/operate/complaint/paPlaint?isReply=3&selType=2&selOption=0&txtSearch='+CONVERT(CHAR(10),@caMainID), 1, 0, 0
- FROM caMain a, cpMain b WHERE a.cpMainId = b.Id AND a.id =@caMainID
- END
- END
- SET NOCOUNT OFF
- GO
- /****** Object: StoredProcedure [dbo].[pcPaPlaintInsert] Script Date: 2018/12/13 19:09:10 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- CREATE PROCEDURE [dbo].[pcPaPlaintInsert]
- (
- @paMainID INT,
- @caMainID INT,
- @Plaint VARCHAR(1000),
- @JobID INT,
- @ConsultantId INT OUTPUT
- )
- AS
- BEGIN TRY
- IF NOT EXISTS(SELECT 'X' FROM paPlaint
- WHERE paMainID = @paMainID AND JobID = @JobID AND AddDate > GETDATE() - 30)
- BEGIN
- INSERT INTO paPlaint(paMainID, caMainID, PlaINT, JobID)
- VALUES(@paMainID, @caMainID, dbo.SafeSQL(@PlaINT), @JobID)
-
- SELECT @ConsultantId = ConsultantID FROM cpMain a WITH(NOLOCK), caMain b WITH(NOLOCK)
- WHERE a.Id = b.cpMainId
- AND b.Id = @caMainId
-
- RETURN 1
- END
- ELSE
- BEGIN
- SELECT @ConsultantId = 0
- RETURN 0
- END
- END TRY
- BEGIN CATCH
- RETURN 0
- END CATCH
- GO
- /****** Object: StoredProcedure [dbo].[pcPaPlaintSelect] Script Date: 2018/12/13 19:09:10 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- --=================================
- --检查 sean 2010-10-9
- --描述 个人查看自己的投诉记录
- --修改 Alen 个人投诉二次改版 2017-9-15
- --=================================
- CREATE PROCEDURE [dbo].[pcPaPlaintSelect]
- (
- @paMainID INT,
- @isIndex TINYINT
- )
- AS
- BEGIN
- IF @isIndex = 0
- BEGIN
- SELECT a.*,c.ID cpMainID,c.Name CompanyName,c.secondID
- FROM PaPlaint a WITH(NOLOCK)
- LEFT JOIN caMain b WITH(NOLOCK) ON a.caMainID = b.ID
- LEFT JOIN cpMain c WITH(NOLOCK) ON b.cpMainID = c.ID
- WHERE paMainID = @paMainID
- ORDER BY ID DESC
- END
- ELSE
- BEGIN
- SELECT a.*,c.ID cpMainID,c.Name CompanyName,c.secondID
- FROM PaPlaint a WITH(NOLOCK)
- LEFT JOIN caMain b WITH(NOLOCK) ON a.caMainID = b.ID
- LEFT JOIN cpMain c WITH(NOLOCK) ON b.cpMainID = c.ID
- WHERE paMainID = @paMainID
- AND IsViewed = 0
- AND ReplyType > 0
- ORDER BY ID DESC
- END
- END
- GO
- /****** Object: StoredProcedure [dbo].[PcPaRefererInsert] Script Date: 2018/12/13 19:09:11 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- CREATE PROCEDURE [dbo].[PcPaRefererInsert]
- (
- @PaMainId INT,
- @Referer VARCHAR(500)
- )
- AS
- SET NOCOUNT ON
- BEGIN TRY
- --IF EXISTS(SELECT 'x' FROM paMain WITH(NOLOCK)
- -- WHERE Id = @paMainId AND AddDate > DATEADD(MINUTE, -2, GETDATE()))
- INSERT INTO paReferer(paMainId, Referer)
- SELECT @paMainId, @Referer
- END TRY
- BEGIN CATCH
- END CATCH
- GO
- /****** Object: StoredProcedure [dbo].[pcPaVerifyLogByLoginInsert] Script Date: 2018/12/13 19:09:11 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- --个人手机号登录验证码插入
- --peter 2018-2-28
- CREATE PROCEDURE [dbo].[pcPaVerifyLogByLoginInsert]
- (
- @Mobile VARCHAR(11),
- @IP VARCHAR(31),
- @PaMainID INT
- )
- AS
- SET NOCOUNT ON
- BEGIN
- IF CHARINDEX(', ', @Ip) > 0
- SET @Ip = RIGHT(@ip, LEN(@ip) - CHARINDEX(', ', @ip))
- DECLARE @VerifyCount SMALLINT
- SELECT @VerifyCount = COUNT(1) FROM paVerifyLog WITH(NOLOCK)
- WHERE IP = @IP
- AND AddDate > CONVERT(VARCHAR(10), GETDATE(), 120)
- IF @VerifyCount > 10 --一天同一IP验证超过三次
- RETURN -2
- SELECT @VerifyCount = COUNT(1) FROM paVerifyLog WITH(NOLOCK)
- WHERE Mobile = @Mobile
- AND AddDate > CONVERT(VARCHAR(10), GETDATE(), 120)
- IF @VerifyCount > 5 --一天同一手机号验证超过两次
- RETURN -3
- SELECT @VerifyCount = COUNT(1) FROM paVerifyLog WITH(NOLOCK)
- WHERE Mobile = @Mobile
- AND AddDate > DATEADD(MINUTE, -5, GETDATE()) --五分钟内同一手机号超过三次
- IF @VerifyCount > 3
- RETURN -4
- DECLARE @VerifyCode AS VARCHAR(6)
- SELECT @VerifyCode = RAND() * 899999 + 100000
- INSERT INTO paVerifyLog(paMainID, Email, Mobile, VerifyCode, VerifyDate, AddDate, ip)
- VALUES(@PaMainID, '', @Mobile, @VerifyCode, NULL, GETDATE(), @IP)
- RETURN @VerifyCode
- END
- GO
- /****** Object: StoredProcedure [dbo].[pcPaVerifyLogByMobileIpSelect] Script Date: 2018/12/13 19:09:11 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- --#####################################################
- --创建时间:2014.11.4
- --创建人:John
- --说明:获取个人手机/邮件验证日志
- --#####################################################
- CREATE PROCEDURE [dbo].[pcPaVerifyLogByMobileIpSelect]
- (
- @Mobile VARCHAR(11),
- @ip VARCHAR(31)
- )
- AS
- BEGIN
- SELECT TOP 1 * FROM paVerifyLog WITH(NOLOCK)
- WHERE Mobile = @Mobile AND AddDate > DATEADD(HOUR,-1,GETDATE()) ORDER BY id DESC
- END
- GO
- /****** Object: StoredProcedure [dbo].[pcPaVerifyLogInsert] Script Date: 2018/12/13 19:09:11 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- --lambo 20140909
- --手机号注册,前台发送验证码
- --20180327 Carl 修改 增加个人黑名单
- CREATE PROCEDURE [dbo].[pcPaVerifyLogInsert]
- (
- @Mobile VARCHAR(11),
- @IP VARCHAR(31)
- )
- AS
- SET NOCOUNT ON
- BEGIN
- IF EXISTS(SELECT 'X' FROM Person_Black WITH(NOLOCK) WHERE Mobile = @Mobile)
- RETURN -5
- IF EXISTS(SELECT 'x' FROM tmp_limitmobile WITH(NOLOCK) WHERE Mobile = @Mobile)
- RETURN -1
- IF DATEPART(HOUR, GETDATE()) > 22 OR DATEPART(HOUR, GETDATE()) < 7
- RETURN -1
- --IF CHARINDEX(', ', @Ip) > 0
- -- RETURN -1
- IF CHARINDEX(', ', @Ip) > 0
- SET @Ip = RIGHT(@ip, LEN(@ip) - CHARINDEX(', ', @ip))
- DECLARE @MobileVerifyDate DATETIME
- SELECT @MobileVerifyDate = MobileVerifyDate FROM paMain WITH(NOLOCK INDEX(IX_paMain_Mobile))
- WHERE Mobile = @Mobile
- AND MobileVerifyDate IS NOT NULL
- IF @MobileVerifyDate IS NOT NULL
- IF DATEDIFF(DAY, @MobileVerifyDate, GETDATE()) < 60
- RETURN -2
- DECLARE @VerifyCount SMALLINT
- SELECT @VerifyCount = COUNT(1) FROM paVerifyLog WITH(NOLOCK)
- WHERE IP = @IP
- AND AddDate > CONVERT(VARCHAR(10), GETDATE(), 120)
- IF @VerifyCount > 3 --IF @VerifyCount > 3
- RETURN -1
- SELECT @VerifyCount = COUNT(1) FROM paVerifyLog WITH(NOLOCK)
- WHERE Mobile = @Mobile
- AND AddDate > CONVERT(VARCHAR(10), GETDATE(), 120)
- IF @VerifyCount > 2 --IF @VerifyCount > 2
- RETURN 0
- SELECT @VerifyCount = COUNT(1) FROM paVerifyLog WITH(NOLOCK)
- WHERE Mobile = @Mobile
- AND AddDate > DATEADD(MINUTE, -5, GETDATE())
- IF @VerifyCount > 3 --IF @VerifyCount > 3
- RETURN 0
- DECLARE @VerifyCode AS VARCHAR(6)
- SELECT @VerifyCode = RAND() * 899999 + 100000
- INSERT INTO paVerifyLog(paMainID, Email, Mobile, VerifyCode, VerifyDate, AddDate, ip)
- VALUES(0, '', @Mobile, @VerifyCode, NULL, GETDATE(), @IP)
- RETURN @VerifyCode
- END
- GO
- /****** Object: StoredProcedure [dbo].[pcPaVerifyLogPaMainIDSelect] Script Date: 2018/12/13 19:09:11 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- --#####################################################
- --创建时间:2014.11.4
- --创建人:John
- --说明:获取1小时内是否发送过认证请求
- --#####################################################
- CREATE PROCEDURE [dbo].[pcPaVerifyLogPaMainIDSelect]
- (
- @Mobile VARCHAR(11),
- @paMainID INT,
- @Email VARCHAR(50)
- )
- AS
- BEGIN
- IF @Mobile <> ''
- BEGIN
- SELECT paMainID FROM paVerifyLog WITH(NOLOCK)
- WHERE paMainID = @paMainID AND Mobile = @Mobile AND AddDate > DATEADD(HOUR,-1,GETDATE()) AND VerifyDate IS NULL
- END
- ELSE
- BEGIN
- SELECT paMainID FROM paVerifyLog WITH(NOLOCK)
- WHERE paMainID = @paMainID AND Email = @Email AND AddDate> DATEADD(HOUR,-1,GETDATE())
- END
- END
- GO
- /****** Object: StoredProcedure [dbo].[pcPaVerifyLogUpdate] Script Date: 2018/12/13 19:09:12 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- --#####################################################
- --创建时间:2014.11.4
- --创建人:John
- --说明:更新个人手机/邮件验证日志
- --#####################################################
- CREATE PROCEDURE [dbo].[pcPaVerifyLogUpdate]
- (
- @paMainID INT,
- @Mobile VARCHAR(11),
- @ip VARCHAR(31)
- )
- AS
- BEGIN
- UPDATE paVerifyLog SET paMainID = @paMainID
- WHERE id = (
- SELECT TOP 1 id FROM paVerifyLog WITH(NOLOCK)
- WHERE Mobile = @Mobile AND AddDate > DATEADD(HOUR,-1,GETDATE()) AND ip = @ip
- ORDER BY id DESC
- )
- END
- GO
- /****** Object: StoredProcedure [dbo].[pcPaYourFoodSelect] Script Date: 2018/12/13 19:09:12 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- CREATE PROCEDURE [dbo].[pcPaYourFoodSelect]
- (
- @paMainId INT
- )
- AS
- SET NOCOUNT ON
- BEGIN
- SELECT a.Id, a.paMainID, a.cvMainId, a.JobId,b.camainid, b.Name JobName,
- c.Name cpName, d.Description Region,
- (SELECT Description FROM dcSalary WHERE Id = dcSalaryId) Salary,
- dbo.GetCvMatch(a.cvMainId, a.JobId) MatvhRate ,
- (
- SELECT COUNT(1) FROM ExJobApply WITH(NOLOCK)
- WHERE cvMainId IN(
- SELECT Id FROM cvMain WITH(NOLOCK)
- WHERE paMainId = @paMainId)
- AND JobId = a.JobId
- ) HasApply,
- a.AddDate, b.RefreshDate, b.SecondID EnJobID , c.SecondID EnCpMainID ,
- b.Welfare1,b.Welfare2,b.Welfare3,b.Welfare4,b.Welfare5,b.Welfare6,b.Welfare7,b.Welfare8,
- b.Welfare9,b.Welfare10,b.Welfare11,b.Welfare12,b.Welfare13,b.Welfare14,b.Welfare15,b.Welfare16,
- b.Welfare17,b.Welfare18,b.Welfare19,ISNULL((SELECT IsOnline FROM caOnline WHERE caMainId =b.caMainID), 0) AS IsOnline,
- c.HasLicence, c.ReplyRate
- FROM paYourFood a WITH(NOLOCK),
- Job b WITH(NOLOCK),
- cpMain c WITH(NOLOCK),
- dcRegion d WITH(NOLOCK)
- WHERE a.paMainId = @paMainId
- AND a.JobId = b.Id
- AND b.cpMainId = c.Id
- AND b.dcRegionId = d.ID
- ORDER BY a.AddDate DESC
- END
- GO
- /****** Object: StoredProcedure [dbo].[pcPerson_BlackEmailExist] Script Date: 2018/12/13 19:09:12 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- CREATE PROCEDURE [dbo].[pcPerson_BlackEmailExist]
- (
- @Email VARCHAR(50)
- )
- AS
- BEGIN
- IF EXISTS(SELECT 'X' FROM Person_Black WITH(NOLOCK) WHERE Email=@Email)
- RETURN 1
- ELSE
- RETURN 0
- END
- GO
- /****** Object: StoredProcedure [dbo].[pcRecruitmentCpMainByRmIDSelect] Script Date: 2018/12/13 19:09:12 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- --#####################################################
- --创建时间:2014.11.4
- --创建人:John
- --说明:得到谁在关注我列表
- --#####################################################
- CREATE PROCEDURE [dbo].[pcRecruitmentCpMainByRmIDSelect]
- (
- @RecruitmentID INT
- )
- AS
- BEGIN
- SELECT d.RecruitmentName,a.AddDate,a.cpMainID,b.Name AS caName,b.Email,b.Mobile,b.Telephone,b.Gender,b.IsPhoneHide,b.IsNameHide,
- b.IsMobileHide,c.Name as cpName,c.Address,c.HasLicence,c.SecondId,c.IsAgent,c.Membertype
- FROM RecruitmentCpMain a WITH(NOLOCK) INNER JOIN caMain b WITH(NOLOCK) ON a.cpMainID = b.cpMainID
- INNER JOIN cpMain c WITH(NOLOCK) ON c.ID = b.cpMainID JOIN Recruitment d on a.RecruitmentID = d.id
- WHERE a.RecruitmentID = @RecruitmentID
- END
- GO
- /****** Object: StoredProcedure [dbo].[pcRecruitmentListByPhone] Script Date: 2018/12/13 19:09:12 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- CREATE PROCEDURE [dbo].[pcRecruitmentListByPhone]
- (
- @dcProvinceID AS SMALLINT,
- @PageNum AS INT,
- @PageSize AS INT
- )
- AS
- BEGIN
- DECLARE @COUNT INT
- SELECT @COUNT=COUNT(*)
- FROM Recruitment a,dcRegion b,RecruitmentPlace c,RecruitmentDept d
- WHERE d.ID=a.RecruitmentDeptID AND d.ID<>1767 AND b.ID=c.dcRegionID AND a.RecruitmentPlaceId=c.id
- AND LEFT(c.dcRegionID,2)=@dcProvinceID AND EndDate>GetDate() AND a.IsPause=0 AND Len(ManagerUserID)>0
- IF @COUNT > 200
- SET @COUNT = 200
- SELECT *,@COUNT AS cnt FROM(
- SELECT TOP 200 ROW_NUMBER() OVER(ORDER BY OrderBy,a.EndDate DESC) AS Rows,a.ID,a.RecruitmentName,a.EndDate,a.BeginDate,c.PlaceName,c.Address,b.Description City
- FROM Recruitment a,dcRegion b,RecruitmentPlace c,RecruitmentDept d
- WHERE d.ID=a.RecruitmentDeptID AND d.ID<>1767 AND b.ID=c.dcRegionID AND a.RecruitmentPlaceId=c.id
- AND LEFT(c.dcRegionID,2)=@dcProvinceID AND EndDate>GetDate() AND a.IsPause=0 AND Len(ManagerUserID)>0
- ) AS a
- WHERE a.Rows BETWEEN (@PageNum-1)*@PageSize+1 AND @PageNum*@PageSize ORDER BY Rows
- END
- GO
- /****** Object: StoredProcedure [dbo].[pcResumeInformSelect] Script Date: 2018/12/13 19:09:13 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- -----------------
- --个人会员中心首页,网站分类通知
- -----------------
- CREATE PROCEDURE [dbo].[pcResumeInformSelect]
- (
- @ProvinceID INT
- )
- AS
- BEGIN
- SELECT TOP 1 ID, Title,Content,link,Type
- FROM ResumeInform WITH(NOLOCK)
- WHERE Status=1
- AND Province like '%' + LTRIM(str(@ProvinceID)) + '%'
- AND EndDate > GETDATE()
- ORDER BY ID DESC
- END
- GO
- /****** Object: StoredProcedure [dbo].[pcResumeXinxiPasswordUpdate] Script Date: 2018/12/13 19:09:13 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- --#####################################################
- --创建时间:2014.11.4
- --创建人:John
- --说明:重置resume_xinxi里的密碼
- --#####################################################
- CREATE PROCEDURE [dbo].[pcResumeXinxiPasswordUpdate]
- (
- @username VARCHAR(50),
- @password VARCHAR(50),
- @email VARCHAR(50)
- )
- AS
- BEGIN
- UPDATE resume_xinxi SET password = @password WHERE username = @username AND email = @email
- END
- GO
- /****** Object: StoredProcedure [dbo].[pcRmInvitationCodeByPaMainIDSelect] Script Date: 2018/12/13 19:09:13 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- --#####################################################
- --创建时间:2014.10.31
- --创建人:Nick
- --说明:获取RmInvitationCode
- --#####################################################
- CREATE PROCEDURE [dbo].[pcRmInvitationCodeByPaMainIDSelect]
- (
- @PamainID INT
- )
- AS
- BEGIN TRY
- SELECT AddDate
- FROM marketdb..RmInvitationCode WITH(NOLOCK)
- WHERE pamainid=@PamainID
- AND valid = 1
- AND rmprojectid = 1
- AND adddate > GETDATE()-90
- END TRY
- BEGIN CATCH
- RETURN 0
- END CATCH
- GO
- /****** Object: StoredProcedure [dbo].[pcViInterviewRecordReplyViewDateUpdate] Script Date: 2018/12/13 19:09:13 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- --#####################################################
- --创建时间:2014.10.30
- --创建人:John
- --说明:修改未查看面试记录的回复时间-个人
- --#####################################################
- CREATE PROCEDURE [dbo].[pcViInterviewRecordReplyViewDateUpdate]
- (
- @paMainID INT
- )
- AS
- BEGIN
- UPDATE a SET ReplyViewDate = GETDATE()
- FROM viinterviewrecord a,viroom b,job c ,cpMain d,caMain e
- WHERE c.camainid = e.id
- AND a.viroomid = b.id
- AND a.jobid = c.id
- AND c.cpMainid = d.id
- AND Applytype = 0
- AND b.enddate IS NULL
- AND a.ReplyDate IS NOT NULL
- AND a.ReplyViewDate IS NULL
- AND cvMainID IN ( SELECT id FROM cvMain WHERE pamainid = @paMainID)
- END
- GO
- /****** Object: StoredProcedure [dbo].[pcViInterviewRecordViewDateUpdate] Script Date: 2018/12/13 19:09:14 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- --#####################################################
- --创建时间:2014.10.30
- --创建人:John
- --说明:修改未查看面试记录的查看时间-个人
- --#####################################################
- CREATE PROCEDURE [dbo].[pcViInterviewRecordViewDateUpdate]
- (
- @paMainID INT
- )
- AS
- BEGIN
- UPDATE a SET viewdate = GETDATE()
- FROM viinterviewrecord a,viroom b,job c ,cpMain d,caMain e
- WHERE c.camainid = e.id
- AND a.viroomid = b.id
- AND a.jobid = c.id
- AND c.cpMainid = d.id
- AND Applytype = 1
- AND b.enddate IS NULL
- AND a.viewdate IS NULL
- AND cvMainID IN ( SELECT id FROM cvMain WHERE pamainid = @paMainID)
- END
- GO
- /****** Object: StoredProcedure [dbo].[pcViInterviewStatusSelect] Script Date: 2018/12/13 19:09:14 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- --#####################################################
- --创建时间:2014.10.31
- --创建人:John
- --说明:个人面试状态 2正在排队或正在面试 3已经申请过 4已经申请过职位
- --#####################################################
- CREATE PROCEDURE [dbo].[pcViInterviewStatusSelect]
- (
- @cvMainID INT,
- @jobID INT,
- @viRoomID INT
- )
- AS
- BEGIN
- IF EXISTS (
- SELECT TOP 1 'x'
- FROM ViInterviewRecord WITH(NOLOCK)
- WHERE ((WaitBeginDate IS NOT NULL AND WaitEndDate IS NULL)
- OR (BeginDate IS NOT NULL AND EndDate IS NULL))
- AND cvMainid = @cvMainID
- )
- BEGIN
- RETURN 2
- END
- ELSE IF EXISTS (
- SELECT TOP 1 'x'
- FROM ViInterviewRecord WITH(NOLOCK)
- WHERE cvMainid = @cvMainID AND viRoomID = @viRoomID
- )
- BEGIN
- RETURN 3
- END
- ELSE IF EXISTS (
- SELECT TOP 1 'x'
- FROM exjobapply WITH(NOLOCK)
- WHERE cvMainID = @cvMainID AND AddDate > GETDATE()-30 AND jobID = @jobID
- )
- BEGIN
- RETURN 4
- END
- ELSE
- BEGIN
- RETURN 0
- END
- END
- GO
- /****** Object: StoredProcedure [dbo].[pcViPlanInviteLogExpiredSelect] Script Date: 2018/12/13 19:09:14 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- --#####################################################
- --创建时间:2014.10.30
- --创建人:John
- --说明:获取已过期的预约邀请记录
- --#####################################################
- CREATE PROCEDURE [dbo].[pcViPlanInviteLogExpiredSelect]
- (
- @paMainID INT,
- @cvMainID INT,
- @addType INT,
- @companyName VARCHAR(100)
- )
- AS
- BEGIN
- DECLARE @SQL VARCHAR(2000)
- SET @SQL = ' SELECT TOP 500 e.interviewdate,a.adddate,a.addtype,ISNULL(b.secondid,b.id) jobid,b.name jobName,ISNULL(c.secondid,c.ID) cpMainID,c.Name CompanyName,d.name cvName '
- SET @SQL = @SQL +' FROM viplaninvitelog a WITH(NOLOCK),job b ,cpmain c WITH(NOLOCK),cvmain d WITH(NOLOCK),viplan e WITH(NOLOCK) '
- SET @SQL = @SQL +' WHERE a.jobid = b.id AND b.cpmainid = c.id AND a.cvmainid = d.id AND a.viplanid = e.id AND e.interviewdate <= GETDATE() AND d.pamainid = ' + CONVERT(VARCHAR(20),@paMainID)
- IF(@cvMainID > 0)
- BEGIN
- SET @SQL = @SQL + ' AND a.cvMainID = ' + CONVERT(VARCHAR(20),@cvMainID)
- END
- IF(@addType <= 1)
- BEGIN
- SET @SQL = @SQL + ' AND a.AddType= ' + CONVERT(VARCHAR(20),@addType)
- END
- SET @SQL = @SQL +' AND c.Name LIKE ''' + @companyName + ''' ORDER BY interviewdate DESC'
- EXEC(@SQL)
- END
- GO
- /****** Object: StoredProcedure [dbo].[pcViPlanInviteLogSelect] Script Date: 2018/12/13 19:09:14 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- --#####################################################
- --创建时间:2014.10.30
- --创建人:John
- --说明:获取未过期预约邀请记录
- --#####################################################
- CREATE PROCEDURE [dbo].[pcViPlanInviteLogSelect]
- (
- @paMainID INT,
- @cvMainID INT,
- @addType INT,
- @companyName VARCHAR(100)
- )
- AS
- BEGIN
- DECLARE @SQL VARCHAR(2000)
- SET @SQL = ' SELECT TOP 500 e.interviewdate,a.adddate,a.addtype,ISNULL(b.secondid,b.ID) jobid,b.name jobName,ISNULL(c.secondid,c.ID) cpMainID,c.Name CompanyName,d.name cvName '
- SET @SQL = @SQL +' FROM viplaninvitelog a WITH(NOLOCK),job b ,cpmain c WITH(NOLOCK),cvmain d WITH(NOLOCK),viplan e WITH(NOLOCK) '
- SET @SQL = @SQL +' WHERE a.jobid = b.id AND b.cpmainid = c.id AND a.cvmainid = d.id AND a.viplanid = e.id AND e.interviewdate > GETDATE() AND d.pamainid = ' + CONVERT(VARCHAR(20),@paMainID)
- IF(@cvMainID > 0)
- BEGIN
- SET @SQL = @SQL + ' AND a.cvMainID = ' + CONVERT(VARCHAR(20),@cvMainID)
- END
- IF(@addType <= 1)
- BEGIN
- SET @SQL = @SQL + ' AND a.AddType= ' + CONVERT(VARCHAR(20),@addType)
- END
- SET @SQL = @SQL +' AND c.Name LIKE ''' + @companyName + ''' ORDER BY interviewdate '
- EXEC(@SQL)
- END
- GO
- /****** Object: StoredProcedure [dbo].[pcViPlanInviteLogViewDateUpdate] Script Date: 2018/12/13 19:09:14 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- --#####################################################
- --创建时间:2014.10.30
- --创建人:John
- --说明:修改未查看面试计划邀请记录的查看时间-个人
- --#####################################################
- CREATE PROCEDURE [dbo].[pcViPlanInviteLogViewDateUpdate]
- (
- @paMainID INT
- )
- AS
- BEGIN
- UPDATE a SET viewdate = GETDATE()
- FROM viplaninvitelog a,viplan b
- WHERE a.viplanid = b.id
- AND addtype = 1
- AND viewdate IS NULL
- AND cvMainID IN (SELECT id FROM cvMain WHERE pamainid = @paMainID)
- END
- GO
- /****** Object: StoredProcedure [dbo].[pcViRoomByJobIDCpMainIDSelect] Script Date: 2018/12/13 19:09:15 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- --#####################################################
- --创建时间:2014.10.30
- --创建人:John
- --说明:获取企业当前的面试室
- --#####################################################
- CREATE PROCEDURE [dbo].[pcViRoomByJobIDCpMainIDSelect]
- (
- @jobID INT,
- @cpMainID INT
- )
- AS
- BEGIN
- DECLARE @SQL VARCHAR(1000)
- IF(@jobID > 0)
- BEGIN
- SET @SQL = ' SELECT TOP 1 * FROM viroom WHERE camainid = ( SELECT camainid FROM job WHERE id= ' + CONVERT(VARCHAR(20),@jobID) + ' ) AND enddate IS NULL AND LastRefreshTime > GETDATE()-0.1 ORDER BY id DESC '
- END
- ELSE
- BEGIN
- SET @SQL = ' SELECT TOP 1 * FROM viroom WHERE camainid = ( SELECT TOP 1 id FROM camain WHERE cpMainid = ' + CONVERT(VARCHAR(20),@cpMainID) + ' ) AND enddate IS NULL AND LastRefreshTime > GETDATE()-0.1 ORDER BY id DESC '
- END
- EXEC(@SQL)
- END
- GO
- /****** Object: StoredProcedure [dbo].[pcViWaitingHallByPaMainEnterInsert] Script Date: 2018/12/13 19:09:15 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- ----Peter 2014-04-15 个人进入视频面试等待大厅
- ----Lambo 2014-05-26 修改表结构
- CREATE PROCEDURE [dbo].[pcViWaitingHallByPaMainEnterInsert]
- (
- @ViRoomID INT,
- @cvMainID INT
- )
- AS
- BEGIN TRY
- DECLARE @ViWaitingHallID INT
- SELECT @ViWaitingHallID = ID FROM ViWaitingHall WHERE cvMainID = @cvMainID AND viRoomID = @ViRoomID
- IF @ViWaitingHallID IS NOT NULL
- UPDATE ViWaitingHall SET BeginDate = GETDATE(),
- LastRefreshTime = GETDATE(),
- EndDate = NULL,
- Status = 1
- WHERE ID = @ViWaitingHallID
- ELSE
- INSERT INTO ViWaitingHall(viRoomID,cvMainID,LastRefreshTime,BeginDate,Status)
- VALUES(@viRoomID,@cvMainID,GETDATE(),GETDATE(),1)
- DECLARE @BeginDate DATETIME
- ---下面的是新的 系统上线后 将上面的删除
- SELECT top 1 @ViWaitingHallID = ID,@BeginDate=WaitBeginDate FROM viinterviewrecord WHERE cvMainID = @cvMainID AND viRoomID = @ViRoomID ORDER BY ID DESC
- IF @BeginDate IS NOT NULL
- UPDATE viinterviewrecord SET
- WaitLastRefreshTime = GETDATE(),
- Status = 1
- WHERE ID = @ViWaitingHallID
- ELSE
- UPDATE viinterviewrecord SET WaitBeginDate= GETDATE(),
- WaitLastRefreshTime = GETDATE(),
- Status = 1
- WHERE ID = @ViWaitingHallID
- END TRY
- BEGIN CATCH
- END CATCH
- GO
- /****** Object: StoredProcedure [dbo].[pcViWaitingHallByPaMainRefreshUpDate] Script Date: 2018/12/13 19:09:15 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- ----Peter 2014-04-15 个人刷新视频面试等待大厅
- CREATE PROCEDURE [dbo].[pcViWaitingHallByPaMainRefreshUpDate]
- (
- @ViRoomID INT,
- @cvMainID INT
- )
- AS
- BEGIN TRY
- CREATE TABLE #T(
- WaitingNum INT,
- BeforeNum INT,
- WaitingStatus INT,--1.等待,2.自己退出,3.拒绝邀请,4.邀请成功,5.被邀请无响应,6.被踢出
- ViRoomStatus INT,--1.正常面试中,2.面试官离线
- )
- INSERT INTO #T VALUES(0,0,0,0)
-
- UPDATE ViWaitingHall SET LastRefreshTime = GETDATE()
- WHERE viRoomID = @viRoomID AND cvMainID = @cvMainID
-
- DECLARE @BeginDateTemp DateTime
- DECLARE @WaitingStatus INT
- SELECT @BeginDateTemp = BeginDate,@WaitingStatus = Status FROM viWaitingHall WHERE viRoomID = @viRoomID AND cvMainID = @cvMainID
- DECLARE @ViRoomStatus INT
- SELECT @ViRoomStatus = CASE EndDate WHEN NULL THEN 1 ELSE 2 END FROM ViRoom WHERE ID = @viRoomID
- UPDATE #T SET
- WaitingNum =
- (SELECT COUNT(1) FROM viWaitingHall
- WHERE viRoomID = @viRoomID AND Status = 1),
- BeforeNum =
- (SELECT COUNT(1) FROM viWaitingHall
- WHERE viRoomID = @viRoomID AND Status = 1 AND BeginDate < @BeginDateTemp),
- WaitingStatus = @WaitingStatus,
- ViRoomStatus = @ViRoomStatus
-
- SELECT TOP 1 * FROM #T
- DROP TABLE #T
- END TRY
- BEGIN CATCH
- END CATCH
- GO
- /****** Object: StoredProcedure [dbo].[pcViWaitingHallByPaMainRefreshUpDateNew] Script Date: 2018/12/13 19:09:15 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- ----Peter 2014-04-15 个人刷新视频面试等待大厅
- --Lambo 2014-5-26 修改表结构
- CREATE PROCEDURE [dbo].[pcViWaitingHallByPaMainRefreshUpDateNew]
- (
- @ViRoomID INT,
- @cvMainID INT
- )
- AS
- BEGIN TRY
- CREATE TABLE #T(
- WaitingNum INT,
- BeforeNum INT,
- WaitingStatus INT,--1.等待,2.自己退出,3.拒绝邀请,4.邀请成功,5.被邀请无响应,6.被踢出
- ViRoomStatus INT,--1.正常面试中,2.面试官离线,
- InterViewStatus int,
- paNames NVARCHAR(100)
- )
- INSERT INTO #T VALUES(0,0,0,0,0,'')
-
- UPDATE viinterviewrecord SET WaitLastRefreshTime = GETDATE()
- WHERE viRoomID = @viRoomID AND cvMainID = @cvMainID
-
- DECLARE @BeginDateTemp DateTime
- DECLARE @WaitingStatus INT
- SELECT TOP 1 @BeginDateTemp = WaitBeginDate,@WaitingStatus = Status FROM viinterviewrecord WHERE viRoomID = @viRoomID AND cvMainID = @cvMainID order by id DESC
- DECLARE @ViRoomStatus INT
- SELECT @ViRoomStatus = CASE EndDate WHEN NULL THEN 1 ELSE 2 END FROM ViRoom WHERE ID = @viRoomID
- UPDATE #T SET
- WaitingNum =
- (SELECT COUNT(1) FROM viinterviewrecord
- WHERE viRoomID = @viRoomID AND Status = 1 and WaitEndDate is null ),
- BeforeNum =
- (SELECT COUNT(1) FROM viinterviewrecord
- WHERE viRoomID = @viRoomID AND Status = 1 AND WaitEndDate is null and WaitBeginDate< @BeginDateTemp),
- paNames = STUFF((SELECT top 6 ','+c.name FROM viinterviewrecord a,cvMain b,paMain c where a.cvmainid=b.id and b.paMainid=c.id and viRoomID = @viRoomID AND Status = 1 and WaitEndDate is null order by waitbegindate FOR XML PATH('')),1,1,''),
- InterViewStatus = (SELECT COUNT(1) FROM viinterviewrecord
- WHERE viRoomID = @viRoomID AND begindate is not null and enddate is null),
- WaitingStatus = @WaitingStatus,
- ViRoomStatus = @ViRoomStatus
-
- SELECT TOP 1 * FROM #T
- DROP TABLE #T
- END TRY
- BEGIN CATCH
- END CATCH
- GO
- /****** Object: StoredProcedure [dbo].[pcViWaitingHallRejectInviteUpdate] Script Date: 2018/12/13 19:09:15 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- --#####################################################
- --创建时间:2014.10.30
- --创建人:John
- --说明:求职者拒绝邀请
- --#####################################################
- CREATE PROCEDURE [dbo].[pcViWaitingHallRejectInviteUpdate]
- (
- @cvMainID INT
- )
- AS
- BEGIN
- UPDATE ViWaitingHall SET Status = 3, [enddate] = GETDATE()
- WHERE ID =
- (
- SELECT TOP 1 ID
- FROM ViWaitingHall
- WHERE cvMainID = @cvMainID
- ORDER BY id DESC
- )
- END
- GO
- /****** Object: StoredProcedure [dbo].[pcWXQrImageByIdSelect] Script Date: 2018/12/13 19:09:16 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- --lambo 20140904
- --根据ID获取一条微信二维码记录
- CREATE PROCEDURE [dbo].[pcWXQrImageByIdSelect]
- (
- @ID INT
- )
- AS
- --INSERT INTO ProcLog SELECT 'pcWXQrImageByIdSelect', '', GETDATE()
- SET NOCOUNT ON
- BEGIN
- SELECT * FROM WXQrImage WITH(NOLOCK) WHERE ID=@ID
- END
- GO
- /****** Object: StoredProcedure [dbo].[pcWXQrImageInsert] Script Date: 2018/12/13 19:09:16 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- --lambo 20140904
- --lucifer 20160415 小于0的为企业用户绑定
- --插入一条微信二维码生成记录
- CREATE PROCEDURE [dbo].[pcWXQrImageInsert]
- (
- @PageType INT,
- @ip varchar(31)
- )
- AS
- BEGIN
- DECLARE @paMainID INT
- IF @PageType > 100
- BEGIN
- SET @paMainID = @PageType
- SET @PageType = 3
- END
- ELSE IF @PageType < 0
- BEGIN
- SET @paMainID = @PageType
- SET @PageType = 52
- END
- INSERT INTO WXQrImage (Ticket, PageType, ip, paMainid)
- SELECT '', @PageType, @ip, @paMainID
- RETURN @@IDENTITY
- END
- GO
- /****** Object: StoredProcedure [dbo].[pcWXQrImageInsertNew] Script Date: 2018/12/13 19:09:16 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- --Lucifer 20160901
- --插入一条微信二维码生成记录
- CREATE PROCEDURE [dbo].[pcWXQrImageInsertNew]
- (
- @PageType INT,
- @Ip VARCHAR(31),
- @TypeID INT
- )
- AS
- BEGIN
- INSERT INTO WXQrImage (Ticket, PageType, Ip, paMainID)
- SELECT '', @PageType, @Ip, @TypeID
- RETURN @@IDENTITY
- END
- GO
- /****** Object: StoredProcedure [dbo].[pcWxTokenUpdate] Script Date: 2018/12/13 19:09:16 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- --创建:Nick
- --创建日期:2015-3-4
- --获取token
- --------------------------------------------------
- CREATE PROCEDURE [dbo].[pcWxTokenUpdate]
- (
- @token VARCHAR(200),
- @provinceID INT
- )
- AS
- BEGIN
- SET NOCOUNT ON
- UPDATE dcWxToken SET Token=@token,AddDate=GETDATE()
- WHERE dcProvinceId = @provinceID
- SET NOCOUNT OFF
- END
- GO
- /****** Object: StoredProcedure [dbo].[ppp] Script Date: 2018/12/13 19:09:17 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- create proc [dbo].[ppp]
- as
- create table #t(id int,c1 varchar(100))
- declare @id int
- set @id = 0
- while 1=1
- begin
- insert into #t
- select @id, newid()
- set @id = @id +1
- end
-
- GO
- /****** Object: StoredProcedure [dbo].[probsCvModifyByPamainIDSelect] Script Date: 2018/12/13 19:09:17 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- --#####################################################
- --创建时间:2014.10.31
- --创建人:Nick
- --说明:
- --#####################################################
- CREATE PROCEDURE [dbo].[probsCvModifyByPamainIDSelect]
- (
- @PamainID INT
- )
- AS
- BEGIN TRY
- SELECT a.ID,cvMainID,a.Location,a.VerifyInfo,b.Name
- FROM bsCvModify a WITH(NOLOCK),cvMain b WITH(NOLOCK)
- WHERE a.cvMainID=b.ID And b.paMainID=@PamainID
- ORDER BY cvMainID, Location
- END TRY
- BEGIN CATCH
- RETURN 0
- END CATCH
- GO
- /****** Object: StoredProcedure [dbo].[probsCvVerifyByPamainIDSelect] Script Date: 2018/12/13 19:09:17 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- --#####################################################
- --创建时间:2014.10.31
- --创建人:Nick
- --说明:
- --#####################################################
- CREATE PROCEDURE [dbo].[probsCvVerifyByPamainIDSelect]
- (
- @PamainID INT
- )
- AS
- BEGIN TRY
- SELECT TOP 1 VerifyResult, VerifyInfo
- FROM bsCvVerify WITH(NOLOCK)
- WHERE cvMainID In(
- SELECT ID FROM cvMain WITH(NOLOCK)
- WHERE paMainID=@PamainID)
- ORDER BY ID DESC
- END TRY
- BEGIN CATCH
- RETURN 0
- END CATCH
- GO
- /****** Object: StoredProcedure [dbo].[proc51JobRegionToOurIDSelect] Script Date: 2018/12/13 19:09:17 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- --#####################################################
- --创建时间:2014.10.31
- --创建人:Nick
- --说明:由地区名称获取地区ID 51
- --#####################################################
- CREATE PROCEDURE [dbo].[proc51JobRegionToOurIDSelect]
- (
- @RegionName VARCHAR(20)
- )
- AS
- BEGIN TRY
- SELECT dbo._51JobRegionToOurID(@RegionName) ID
- END TRY
- BEGIN CATCH
- RETURN 0
- END CATCH
- GO
- /****** Object: StoredProcedure [dbo].[procA_TempCheckInsert] Script Date: 2018/12/13 19:09:18 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- CREATE PROCEDURE [dbo].[procA_TempCheckInsert]
- (
- @province_id SMALLINT,
- @VersionID SMALLINT,
- @referer VARCHAR(190),
- @ip VARCHAR(15),
- @Url VARCHAR(max)
- )
- AS
- RETURN
- GO
- /****** Object: StoredProcedure [dbo].[ProcActivationLogInsert] Script Date: 2018/12/13 19:09:18 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- --创建:Max 2013-8-26
- --说明:对推广邮件多长时间会登录、注册进行统计
- ---------------------------------------------------
- CREATE PROCEDURE [dbo].[ProcActivationLogInsert]
- AS
- BEGIN TRAN
- IF EXISTS(
- SELECT TOP 1 'x'
- FROM LogDB..CpActivationLog
- WHERE Countdate = CONVERT(VARCHAR(8),getdate()-1, 112)
- )
- GOTO ERR
- DECLARE @MaxID AS INT
- DECLARE @MaxID2 AS INT
- DECLARE @Day1 AS INT
- DECLARE @Day2 AS INT
- DECLARE @Day3 AS INT
- DECLARE @Day7 AS INT
- DECLARE @Day15 AS INT
- DECLARE @Day30 AS INT
- DECLARE @DayOther AS INT
- BEGIN TRY
- SET @MaxID=0
- -------------------------------个人统计------------------------------------
- ---取前天正常注册的最大ID
- SELECT @MaxID = MAX(ID)
- FROM Pamain
- WHERE Adddate > (CONVERT(VARCHAR(100), GETDATE()-2, 23) + ' 00:00:00')
- AND Adddate < (CONVERT(VARCHAR(100), GETDATE()-1, 23) + ' 00:00:00')
- AND RegisterMode NOT IN (1,11) AND RegisterType NOT IN (101,102)
- ---取昨天正常注册的最大ID
- SELECT @MaxID2 = MAX(ID)
- FROM Pamain
- WHERE Adddate > (CONVERT(VARCHAR(100), GETDATE()-1, 23) + ' 00:00:00')
- AND Adddate < (CONVERT(VARCHAR(100), GETDATE(), 23) + ' 00:00:00')
- AND RegisterMode NOT IN (1,11) AND RegisterType NOT IN (101,102)
- --PRINT @MaxID
- --PRINT @MaxID2
- DECLARE @TempTable TABLE(ID INT IDENTITY(1,1), CountDate INT,AllCount INT)
- INSERT @TempTable
- SELECT CONVERT(VARCHAR(8),adddate, 112) CountDate,COUNT(*) AllCount
- FROM pamain WHERE id > @MaxID AND id < @MaxID2
- AND (registermode IN(1, 11) OR RegisterType IN (101,102))
- GROUP BY CONVERT(VARCHAR(8),adddate, 112)
- SELECT * FROM @TempTable ORDER BY countDate DESC
- --取 day1
- SELECT @Day1 = SUM(AllCount)
- FROM @TempTable
- WHERE CountDate > CONVERT(VARCHAR(8),getdate()-2, 112)
- --PRINT @Day1
- --取 day2
- SELECT @Day2 = SUM(AllCount)
- FROM @TempTable
- WHERE CountDate > CONVERT(VARCHAR(8),getdate()-3, 112)
- --PRINT @Day2
- --取 day3
- SELECT @Day3 = SUM(AllCount)
- FROM @TempTable
- WHERE CountDate > CONVERT(VARCHAR(8),getdate()-4, 112)
- --PRINT @Day3
- --取 day7
- SELECT @Day7 = SUM(AllCount)
- FROM @TempTable
- WHERE CountDate > CONVERT(VARCHAR(8),getdate()-8, 112)
- --PRINT @Day7
- --取 day15
- SELECT @Day15 = SUM(AllCount)
- FROM @TempTable
- WHERE CountDate > CONVERT(VARCHAR(8),getdate()-16, 112)
- --PRINT @Day15
- --取 day30
- SELECT @Day30 = SUM(AllCount)
- FROM @TempTable
- WHERE CountDate > CONVERT(VARCHAR(8),getdate()-31, 112)
- --PRINT @Day30
- --取 dayOther
- SELECT @DayOther = SUM(AllCount)
- FROM @TempTable
- WHERE CountDate <= CONVERT(VARCHAR(8),getdate()-31, 112)
- --PRINT @DayOther
- --插入日志表
- INSERT INTO LogDB..CvActivationLog(countdate,day1,day2,day3,day7,day15,day30,dayOther)
- VALUES(CONVERT(VARCHAR(8),getdate()-1, 112),@Day1,@Day2-@Day1,@Day3-@Day2,@Day7-@Day3,@Day15-@Day7,@Day30-@Day15,@DayOther)
-
- -------------------------------企业统计------------------------------------
- ---取前天正常注册的最大ID
- SELECT @MaxID = MAX(ID)
- FROM CpMain
- WHERE Regdate > (CONVERT(VARCHAR(10), GETDATE()-2, 23) + ' 00:00:00')
- AND Regdate < (CONVERT(VARCHAR(10), GETDATE()-1, 23) + ' 00:00:00')
- AND RegisterMode NOT IN (1,11)
- ---取昨天正常注册的最大ID
- SELECT @MaxID2 = MAX(ID)
- FROM CpMain
- WHERE Regdate > (CONVERT(VARCHAR(10), GETDATE()-1, 23) + ' 00:00:00')
- AND Regdate < (CONVERT(VARCHAR(10), GETDATE(), 23) + ' 00:00:00')
- AND RegisterMode NOT IN (1,11)
-
- --PRINT @MaxID
- --PRINT @MaxID2
- DELETE FROM @TempTable
- INSERT @TempTable
- SELECT CONVERT(VARCHAR(8),Regdate, 112) CountDate,COUNT(*) AllCount
- FROM CpMain WHERE id > @MaxID AND id < @MaxID2
- AND Registermode IN(1, 11)
- GROUP BY CONVERT(VARCHAR(8),Regdate, 112)
- SELECT * FROM @TempTable ORDER BY CountDate DESC
- --取day1
- SELECT @Day1 = SUM(AllCount)
- FROM @TempTable
- WHERE CountDate > CONVERT(VARCHAR(8),getdate()-2, 112)
- --PRINT @Day1
- --取 day2
- SELECT @Day2 = SUM(AllCount)
- FROM @TempTable
- WHERE CountDate > CONVERT(VARCHAR(8),getdate()-3, 112)
- --PRINT @Day2
- --取 day3
- SELECT @Day3 = SUM(AllCount)
- FROM @TempTable
- WHERE CountDate > CONVERT(VARCHAR(8),getdate()-4, 112)
- --PRINT @Day3
- --取 day7
- SELECT @Day7 = SUM(AllCount)
- FROM @TempTable
- WHERE CountDate > CONVERT(VARCHAR(8),getdate()-8, 112)
- --PRINT @Day7
- --取 day15
- SELECT @Day15 = SUM(AllCount)
- FROM @TempTable
- WHERE CountDate > CONVERT(VARCHAR(8),getdate()-16, 112)
- --PRINT @Day15
- --取 day30
- SELECT @Day30 = SUM(AllCount)
- FROM @TempTable
- WHERE CountDate > CONVERT(VARCHAR(8),getdate()-31, 112)
- --PRINT @Day30
- --取 dayOther
- SELECT @DayOther = SUM(AllCount)
- FROM @TempTable
- WHERE CountDate <= CONVERT(VARCHAR(8),getdate()-31, 112)
- --PRINT @DayOther
- --插入日志表
- INSERT INTO LogDB..CpActivationLog(countdate,day1,day2,day3,day7,day15,day30,dayOther)
- VALUES(CONVERT(VARCHAR(8),getdate()-1, 112),@Day1,@Day2-@Day1,@Day3-@Day2,@Day7-@Day3,@Day15-@Day7,@Day30-@Day15,@DayOther)
-
- --统计推广员推广登录量
- INSERT INTO Logdb..ActivationLog(AddMan,CountDate,CvCount,cpCount)
- SELECT a.Addman,a.CountDate,a.cvCount,b.cpCount
- FROM (
- SELECT Addmannew Addman,CONVERT(VARCHAR(8),Regdatenew, 112) CountDate,count(*) cvCount
- FROM logdb..ActivationCvDetail
- WHERE Regdatenew > (CONVERT(VARCHAR(100), GETDATE()-1, 23) + ' 00:00:00')
- AND Regdatenew < (CONVERT(VARCHAR(100), GETDATE(), 23) + ' 00:00:00')
- GROUP BY Addmannew,CONVERT(VARCHAR(8),Regdatenew, 112)
- ) a
- JOIN (
- SELECT Addmannew Addman,CONVERT(VARCHAR(8),Regdatenew, 112) CountDate,count(*) cpCount
- FROM logdb..ActivationCpDetail
- WHERE Regdatenew > (CONVERT(VARCHAR(100), GETDATE()-1, 23) + ' 00:00:00')
- AND Regdatenew < (CONVERT(VARCHAR(100), GETDATE(), 23) + ' 00:00:00')
- GROUP BY Addmannew,CONVERT(VARCHAR(8),Regdatenew, 112)
- ) b ON a.Addman = b.Addman AND a.CountDate=b.CountDate
- END TRY
- BEGIN CATCH
- GOTO ERR
- END CATCH
- COMMIT TRAN
- RETURN 1
- ERR:
- BEGIN
- ROLLBACK TRAN
- RETURN 0
- END
- GO
- /****** Object: StoredProcedure [dbo].[procAdverProjectAutoSort] Script Date: 2018/12/13 19:09:19 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- --Carl 2018-04-23
- --前台广告自动排序
- CREATE PROCEDURE [dbo].[procAdverProjectAutoSort]
- (
- @Method INT, --0上线(新增,valid) 1手动暂停 2自动暂停,预备只替换下线的那一个
- @ProvinceId INT,
- @Type INT --限制 type<>10 不执行
- )
- AS
- SET NOCOUNT OFF
- BEGIN
- IF @ProvinceId=0
- BEGIN
- --PRINT '51人才编辑自己操作'
- RETURN
- END
-
- --IF @ProvinceId<>64 AND @ProvinceId<>83
- --BEGIN
- ----PRINT '不是西藏、新疆的不执行'
- --RETURN
- --END
- IF @Type<>10
- BEGIN
- --PRINT '非首页横排广告不执行'
- RETURN
- END
- DECLARE @Id INT
- DECLARE @Width INT
- DECLARE @LineNum3 INT
- DECLARE @TotalWidth INT
- DECLARE @IsSelf INT
- DECLARE @RemainWidth INT
- SET @LineNum3=0
- SET @TotalWidth=0
- --上下线时的操作,下线所有的自己的
- UPDATE AdverProject SET Valid=0 WHERE ID IN (SELECT Id FROM AdverProject WHERE Province_ID = @ProvinceId
- AND [Type] = 10
- AND BeginTime <= CONVERT(SMALLDATETIME, GETDATE())
- AND EndTime > CONVERT(SMALLDATETIME, GETDATE())
- AND Valid = 1 AND IsSelf=1)
- --查询目前该省份展示的广告,遍历获取 总行数
- DECLARE CurrentInfo CURSOR FOR
- SELECT Id,Width FROM AdverProject WHERE Province_ID = @ProvinceId
- AND [Type] = 10
- AND BeginTime <= CONVERT(SMALLDATETIME, GETDATE())
- AND EndTime > CONVERT(SMALLDATETIME, GETDATE())
- AND Valid = 1
- OPEN CurrentInfo
- FETCH NEXT FROM CurrentInfo INTO @Id,@Width
- WHILE @@fetch_status<>-1
- BEGIN
- IF @Width=948 OR @Width=986 OR @Width=1100 OR @Width=1098
- BEGIN
- SET @Width=6
- END
- ELSE IF @Width=471 OR @Width=488 OR @Width=545 OR @Width=546
- BEGIN
- SET @Width=3
- SET @LineNum3=@LineNum3+1
- END
- ELSE IF @Width=312 OR @Width=322 OR @Width=360 OR @Width=362
- BEGIN
- SET @Width=2
- END
- ELSE IF @Width=153 OR @Width=156 OR @Width=175 OR @Width=178
- BEGIN
- SET @Width=1
- END
- SET @TotalWidth=@TotalWidth+@Width
- FETCH NEXT FROM CurrentInfo INTO @Id,@Width
- END
- CLOSE CurrentInfo
- DEALLOCATE CurrentInfo
- --PRINT '之前总宽度'
- --PRINT @TotalWidth
- IF @LineNum3%2<>0
- BEGIN
- --PRINT '3/6不为整行'
-
- --PRINT '自动下线、手动下线或上线的补自己的'
- UPDATE AdverProject SET Valid=1,BeginTime=GETDATE()-1,EndTime=DATEADD(YEAR,5,GETDATE())
- WHERE ID IN (SELECT TOP 1 ID FROM AdverProject
- WHERE Province_ID = @ProvinceId AND [Type] = 10
- AND IsSelf=1 AND Valid=0 AND Width IN (471,488, 545, 546))
- SET @TotalWidth=@TotalWidth+3
- SET @LineNum3=@LineNum3+1
- END
- --PRINT '现在总宽度'
- --PRINT @TotalWidth
- SET @RemainWidth=6-(@TotalWidth%6)
- --PRINT '遗留空位'
- --PRINT @RemainWidth
-
- --如果遗留空位 为 1 2 3 4 5
- IF @RemainWidth>0 AND @RemainWidth<>6
- BEGIN
- --此时3/6的肯定是整行的了
- --PRINT '遗留空位'
- --PRINT @RemainWidth
- --遍历 自己网站中的数据
- DECLARE MySelfInfo CURSOR FOR
- SELECT Id,Width FROM AdverProject WHERE Province_ID = @ProvinceId
- AND [Type] = 10 AND IsSelf=1 AND Valid=0
- AND Width IN (312,322,360,362,153,156,175,178) ORDER BY Width DESC
- OPEN MySelfInfo
- FETCH NEXT FROM MySelfInfo INTO @Id,@Width
- WHILE @@fetch_status<>-1 AND @RemainWidth>0
- BEGIN
- IF @Width=312 OR @Width=322 OR @Width=360 OR @Width=362
- BEGIN
- SET @Width=2
- END
- ELSE IF @Width=153 OR @Width=156 OR @Width=175 OR @Width=178
- BEGIN
- SET @Width=1
- END
- IF (@RemainWidth-@Width)>=0
- BEGIN
- UPDATE AdverProject SET Valid=1,BeginTime=GETDATE()-1,
- EndTime=DATEADD(YEAR,5,GETDATE()) WHERE ID=@Id
- SET @RemainWidth=@RemainWidth-@Width
- END
- FETCH NEXT FROM MySelfInfo INTO @Id,@Width
- END
- CLOSE MySelfInfo
- DEALLOCATE MySelfInfo
- END
- --重新排序
- UPDATE AdverProject SET AdverProject.OrderBy=b.RowNum
- FROM (SELECT id,ROW_NUMBER() OVER(ORDER BY Width DESC,EndTime) RowNum FROM AdverProject
- WHERE Province_ID = @ProvinceId AND [Type] = 10
- AND BeginTime <= CONVERT(SMALLDATETIME, GETDATE())
- AND EndTime > CONVERT(SMALLDATETIME, GETDATE())
- AND Valid = 1 ) b WHERE AdverProject.id=b.id
- END
- SET NOCOUNT ON
- GO
- /****** Object: StoredProcedure [dbo].[procAdverProjectByCampusSelect] Script Date: 2018/12/13 19:09:19 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- --#####################################################
- --创建时间:2015-10-19
- --创建人:Lucifer
- --说明:根据provincieid得到校园招聘首页图片
- --#####################################################
- CREATE PROCEDURE [dbo].[procAdverProjectByCampusSelect]
- (
- @ProvinceID INT,
- @Type INT
- )
- AS
- BEGIN
- SELECT a.ID, a.ImageFile, a.Url, a.Width, a.Height, a.Remarks, b.SecondID CompanyId
- FROM adverproject a WITH(NOLOCK) LEFT JOIN cpMain b WITH(NOLOCK) ON a.CompanyId = b.ID
- WHERE a.Type=@Type
- AND a.begintime<=CAST(GETDATE() AS SMALLDATETIME)
- AND a.endtime>=CAST(GETDATE() AS SMALLDATETIME)
- AND a.valid=1
- AND a.province_id = @ProvinceID
- ORDER BY a.Orderby
- END
- GO
- /****** Object: StoredProcedure [dbo].[procAdverprojectByClickCountUpdate] Script Date: 2018/12/13 19:09:19 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- CREATE PROCEDURE [dbo].[procAdverprojectByClickCountUpdate]
- (
- @Id INT,
- @CompanyID INT
- )
- AS
- BEGIN
- UPDATE Adverproject SET ClickCount = ClickCount + 1
- WHERE ID = @ID
- AND CompanyID = @CompanyID
- END
- GO
- /****** Object: StoredProcedure [dbo].[ProcAdverProjectByHomepageFloatSelect] Script Date: 2018/12/13 19:09:20 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- CREATE PROCEDURE [dbo].[ProcAdverProjectByHomepageFloatSelect]
- (
- @ProvinceID INT
- )
- AS
- BEGIN
- SELECT * FROM AdverProject
- WHERE Type IN (13, 14, 15)
- AND BeginTime < GETDATE()
- AND EndTime > GETDATE()
- AND Province_ID = @ProvinceId
- AND Valid = 1
- END
- GO
- /****** Object: StoredProcedure [dbo].[procAdverProjectByOfflineUpdate] Script Date: 2018/12/13 19:09:20 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- --Carl 2018-04-26
- --Carl 2018-05-25
- --定时任务存储过程 51编辑自己修改
- CREATE PROCEDURE [dbo].[procAdverProjectByOfflineUpdate]
- (
- @Method INT --1、过期下线 2、自动暂停
- )
- AS
- SET NOCOUNT ON
- BEGIN
- DECLARE @Id INT
- DECLARE @Width INT
- DECLARE @ProvinceId INT
- DECLARE @LineNumNew6 INT --下线6/6的个数
- DECLARE @LineNumNew3 INT --下线3/6的个数
- DECLARE @RemainNum6 INT --剩余6/6的个数
- DECLARE @TotalWidth INT --现有总宽度
- DECLARE @WidthNew INT
- DECLARE @IdNew INT
- DECLARE @BeforeProvinceId INT
- DECLARE @RemainCount INT --剩余空位数量
- DECLARE @MaxLineNum INT --最大行数
- DECLARE @MaxLineNumNew6 INT --6/6最大个数
- DECLARE @MaxLineNumNew3 INT --3/6最大个数
- DECLARE @ReadyWidth INT --预备宽度
- DECLARE @ReadyId INT --预备Id
- DECLARE @CompanyId INT --企业id
- DECLARE @AddMan INT --添加人
- DECLARE @SendList VARCHAR(100) --信息接收人员
- DECLARE @Consultant INT --企业当前顾问
- SET @SendList='153,158,212'
- SET @BeforeProvinceId=0
- SET @LineNumNew6=0
- SET @LineNumNew3=0
- SET @RemainNum6=0
- SET @TotalWidth=0
- SET @MaxLineNum=14
- SET @MaxLineNumNew6=3
- SET @MaxLineNumNew3=8
- --定义游标
- DECLARE @DownLineInfo CURSOR
- --查询目前西藏省份过期的广告,遍历获取 总行数
- IF @Method=1
- BEGIN
- --PRINT '过期下线'
- SET @DownLineInfo=CURSOR FOR
- SELECT Id,Width,Province_Id,CompanyId,AddMan FROM AdverProject WHERE Province_ID<>0 AND [Type] = 10
- --AND EndTime = '2018-04-12 23:59:00'
- AND EndTime = CONVERT(VARCHAR(100), GETDATE()-1, 23)+' 23:59:00'
- --AND EndTime = CONVERT(SMALLDATETIME, GETDATE())
- AND Valid = 1 ORDER BY Province_Id
- END
- ELSE IF @Method=2
- BEGIN
- SET @DownLineInfo = CURSOR FOR
- SELECT Id,Width,Province_Id,CompanyId,AddMan FROM AdverProject WHERE
- Province_ID<>0 AND [Type] = 10 AND BeginTime <= CONVERT(SMALLDATETIME, GETDATE())
- AND EndTime > CONVERT(SMALLDATETIME, GETDATE())
- AND Valid = 1 AND ISNULL(IsSelf,0)<>1
- AND CompanyId IS NOT NULL
- AND NOT EXISTS(SELECT 'X' FROM Job WITH(NOLOCK) WHERE cpMainID =AdverProject.CompanyId
- AND IsDelete = 0 AND IssueEnd> GETDATE() AND IssueDate < GETDATE())
- AND NOT EXISTS(SELECT 'X' FROM CaOrder WITH(NOLOCK) WHERE Id=AdverProject.CaOrderID AND Paid>0)
- ORDER BY Province_Id
- END
- --PRINT '打开游标'
- OPEN @DownLineInfo
- FETCH NEXT FROM @DownLineInfo INTO @Id,@Width,@ProvinceId,@CompanyId,@AddMan
- WHILE @@fetch_status<>-1
- BEGIN
-
- UPDATE AdverProject SET Valid=0 WHERE ID =@Id
- IF @BeforeProvinceId=0
- SET @BeforeProvinceId=@ProvinceId
- IF @BeforeProvinceId<>@ProvinceId
- BEGIN
- --存储过程还需要再执行下(预备里无广告或6/6 3/6无法到前台的情况)
- --PRINT '存储过程1'
- EXEC procAdverProjectAutoSort 2,@BeforeProvinceId,10
- SET @BeforeProvinceId=@ProvinceId
- SET @LineNumNew6=0
- SET @LineNumNew3=0
- SET @TotalWidth=0
- END
- --获取总宽度
- IF @TotalWidth=0
- BEGIN
- --查询目前该省份展示的广告,遍历获取 总行数
- DECLARE TotalInfo CURSOR FOR
- SELECT Width FROM AdverProject WHERE Province_ID = @ProvinceId
- AND [Type] = 10
- AND BeginTime <= CONVERT(SMALLDATETIME, GETDATE())
- AND EndTime > CONVERT(SMALLDATETIME, GETDATE())
- AND Valid = 1
- OPEN TotalInfo
- FETCH NEXT FROM TotalInfo INTO @WidthNew
- WHILE @@fetch_status<>-1
- BEGIN
- IF @WidthNew=948 OR @WidthNew=986 OR @WidthNew=1100 OR @WidthNew=1098
- BEGIN
- SET @WidthNew=6
- SET @LineNumNew6=@LineNumNew6+1
- END
- ELSE IF @WidthNew=471 OR @WidthNew=488 OR @WidthNew=545 OR @WidthNew=546
- BEGIN
- SET @WidthNew=3
- SET @LineNumNew3=@LineNumNew3+1
- END
- ELSE IF @WidthNew=312 OR @WidthNew=322 OR @WidthNew=360 OR @WidthNew=362
- BEGIN
- SET @WidthNew=2
- END
- ELSE IF @WidthNew=153 OR @WidthNew=156 OR @WidthNew=175 OR @WidthNew=178
- BEGIN
- SET @WidthNew=1
- END
- SET @TotalWidth=@TotalWidth+@WidthNew
- FETCH NEXT FROM TotalInfo INTO @WidthNew
- END
- CLOSE TotalInfo
- DEALLOCATE TotalInfo
- END
- IF @Method=2
- BEGIN
- --检查企业广告是否 三天后全部过期
- IF (SELECT CONVERT(VARCHAR,MAX(IssueEnd),23) FROM Job WITH(NOLOCK) WHERE cpMainID =@CompanyId AND IsDelete = 0
- AND IssueEnd> GETDATE() AND IssueDate < GETDATE())<=CONVERT(VARCHAR,GETDATE()+3,23)
- BEGIN
- --PRINT '发送rtx提醒'
- --获取企业当前顾问
- SELECT @Consultant=ISNULL(ConsultantID,0) FROM cpMain WHERE ID=@CompanyId
- INSERT oadb..RtxSend (Receiver, RtxTitle, RtxMessage, SendType, DelayTime, SendTime, AddTime)
- VALUES (CONVERT(VARCHAR,@Consultant),
- '广告通知', '公司id:'+CONVERT(VARCHAR,@CompanyId)+',该企业职位三天内即将全部过期,请联系用户及时发布',
- 1, 0, null, getdate())
- END
- END
- IF @TotalWidth/6>=@MaxLineNum
- BEGIN
- --如果总行数大于14 补自己的 继续下次循环
- FETCH NEXT FROM @DownLineInfo INTO @Id,@Width,@ProvinceId,@CompanyId,@AddMan
- CONTINUE
- END
- ELSE
- BEGIN
- --未到达最大行数
- --PRINT '总行数未到达最大行数'
- --获取遗留空位数,从预备中取,然后执行存储过程自动排序
- SET @RemainCount=(6*@MaxLineNum)-@TotalWidth
- --遍历预备中的广告,6/6 3/6需要单独判断下
- --遍历该省份预备中的数据
- DECLARE ReadyInfo CURSOR FOR
- SELECT Id,Width FROM AdverProject WHERE Province_ID = @BeforeProvinceId
- AND [Type] = 10 AND BeginTime>GETDATE() and Valid=1 ORDER BY OrderBy
- OPEN ReadyInfo
- FETCH NEXT FROM ReadyInfo INTO @ReadyId,@ReadyWidth
- WHILE @@fetch_status<>-1 AND @RemainCount>0
- BEGIN
- IF @ReadyWidth=948 OR @ReadyWidth=986 OR @ReadyWidth=1100 OR @ReadyWidth=1098
- BEGIN
- SET @ReadyWidth=6
- END
- ELSE IF @ReadyWidth=471 OR @ReadyWidth=488 OR @ReadyWidth=545 OR @ReadyWidth=546
- BEGIN
- SET @ReadyWidth=3
- END
- ELSE IF @ReadyWidth=312 OR @ReadyWidth=322 OR @ReadyWidth=360 OR @ReadyWidth=362
- BEGIN
- SET @ReadyWidth=2
- END
- ELSE IF @ReadyWidth=153 OR @ReadyWidth=156 OR @ReadyWidth=175 OR @ReadyWidth=178
- BEGIN
- SET @ReadyWidth=1
- END
-
- IF @ReadyWidth=6
- BEGIN
- --查看6/6 是否到达总行数,若达到,预备进行下次循环
- IF @LineNumNew6>=@MaxLineNumNew6
- BEGIN
- --PRINT '6/6到达最大行数'
- FETCH NEXT FROM ReadyInfo INTO @ReadyId,@ReadyWidth
- CONTINUE
- END
- ELSE
- BEGIN
- IF @RemainCount>=6
- BEGIN
- SET @LineNumNew6=@LineNumNew6+1
- END
-
- END
- END
- IF @ReadyWidth=3
- BEGIN
- IF @LineNumNew3>=@MaxLineNumNew3
- BEGIN
- --PRINT '3/6到达最大行数'
- FETCH NEXT FROM ReadyInfo INTO @ReadyId,@ReadyWidth
- CONTINUE
- END
- ELSE
- BEGIN
- IF @RemainCount>=3
- BEGIN
- SET @LineNumNew3=@LineNumNew3+1
- END
- END
- END
- IF (@RemainCount-@ReadyWidth)>=0
- BEGIN
- UPDATE AdverProject SET BeginTime=CONVERT(SMALLDATETIME,GETDATE()),
- EndTime=CONVERT(VARCHAR,DATEADD(DAY,DATEDIFF(DD,BeginTime,EndTime),GETDATE()),23)+' 23:59:00' WHERE ID=@ReadyId
- SET @RemainCount=@RemainCount-@ReadyWidth
- SET @TotalWidth=@TotalWidth+@ReadyWidth
- END
- FETCH NEXT FROM ReadyInfo INTO @ReadyId,@ReadyWidth
- END
- CLOSE ReadyInfo
- DEALLOCATE ReadyInfo
- END
- FETCH NEXT FROM @DownLineInfo INTO @Id,@Width,@ProvinceId,@CompanyId,@AddMan
- END
- --PRINT '存储过程2'
- --PRINT @BeforeProvinceId
- EXEC procAdverProjectAutoSort 2,@BeforeProvinceId,10
- --PRINT @BeforeProvinceId
- CLOSE @DownLineInfo
- DEALLOCATE @DownLineInfo
- IF @Method=2
- BEGIN
- --PRINT '自动暂停执行完,查下前台广告是否有小于三行的'
-
- DECLARE @SubsiteName VARCHAR(1000)
- SET @BeforeProvinceId=0
- SET @TotalWidth=0
- SET @SubsiteName=''
- DECLARE TotalProvince CURSOR FOR
- SELECT Province_Id FROM AdverProject WHERE Province_Id<>0 AND [Type] = 10
- AND BeginTime <= CONVERT(SMALLDATETIME, GETDATE())
- AND EndTime > CONVERT(SMALLDATETIME, GETDATE()) AND Valid = 1 GROUP BY Province_Id
- OPEN TotalProvince
- FETCH NEXT FROM TotalProvince INTO @ProvinceId
- WHILE @@fetch_status<>-1
- BEGIN
-
- IF @BeforeProvinceId=0
- SET @BeforeProvinceId=@ProvinceId
- IF @BeforeProvinceId<>@ProvinceId
- BEGIN
- IF @TotalWidth/6<3
- BEGIN
- --根据省份id 获取 网站名称
- SELECT @SubsiteName=SubSiteName FROM dcsubsite WHERE ProvinceID=@BeforeProvinceId
- --PRINT '发送rtx提醒'
- IF @SubsiteName<>''
- BEGIN
- INSERT INTO oadb..RtxSend (Receiver, RtxTitle, RtxMessage, SendType, DelayTime, SendTime, AddTime)
- VALUES (@SendList,
- '广告通知', @SubsiteName+',前台广告少于三行',
- 1, 0, null, getdate())
- END
- END
- SET @BeforeProvinceId=@ProvinceId
- SET @TotalWidth=0
- END
- --获取总宽度
- IF @TotalWidth=0
- BEGIN
- --查询目前该省份展示的广告,遍历获取 总行数
- DECLARE TotalInfo CURSOR FOR
- SELECT Width FROM AdverProject WHERE Province_ID = @ProvinceId
- AND [Type] = 10
- AND BeginTime <= CONVERT(SMALLDATETIME, GETDATE())
- AND EndTime > CONVERT(SMALLDATETIME, GETDATE())
- AND Valid = 1
- OPEN TotalInfo
- FETCH NEXT FROM TotalInfo INTO @WidthNew
- WHILE @@fetch_status<>-1
- BEGIN
- IF @WidthNew=948 OR @WidthNew=986 OR @WidthNew=1100 OR @WidthNew=1098
- BEGIN
- SET @WidthNew=6
- END
- ELSE IF @WidthNew=471 OR @WidthNew=488 OR @WidthNew=545 OR @WidthNew=546
- BEGIN
- SET @WidthNew=3
- END
- ELSE IF @WidthNew=312 OR @WidthNew=322 OR @WidthNew=360 OR @WidthNew=362
- BEGIN
- SET @WidthNew=2
- END
- ELSE IF @WidthNew=153 OR @WidthNew=156 OR @WidthNew=175 OR @WidthNew=178
- BEGIN
- SET @WidthNew=1
- END
- SET @TotalWidth=@TotalWidth+@WidthNew
- FETCH NEXT FROM TotalInfo INTO @WidthNew
- END
- CLOSE TotalInfo
- DEALLOCATE TotalInfo
- END
- FETCH NEXT FROM TotalProvince INTO @ProvinceId
- END
- CLOSE TotalProvince
- DEALLOCATE TotalProvince
-
- IF @TotalWidth/6<3
- BEGIN
- --根据省份id 获取 网站名称
- SELECT @SubsiteName=SubSiteName FROM dcsubsite WHERE ProvinceID=@BeforeProvinceId
- --PRINT '发送rtx提醒'
- IF @SubsiteName<>''
- BEGIN
- INSERT INTO oadb..RtxSend (Receiver, RtxTitle, RtxMessage, SendType, DelayTime, SendTime, AddTime)
- VALUES (@SendList,
- '广告通知', @SubsiteName+',前台广告少于三行',
- 1, 0, null, getdate())
- END
- END
- END
- END
- GO
- /****** Object: StoredProcedure [dbo].[procAdverProjectByProvince_IDSelect] Script Date: 2018/12/13 19:09:21 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- --#####################################################
- --创建时间:2014.11.3
- --创建人:NICK
- --说明:根据provincieid得到adverproject
- --#####################################################
- CREATE PROCEDURE [dbo].[procAdverProjectByProvince_IDSelect]
- (
- @ProvinceID INT,
- @Type INT
- )
- AS
- BEGIN
- SELECT top 1 id,imagefile,width,url,companyid,remarks
- FROM adverproject WITH(NOLOCK) WHERE TYPE=@Type
- AND begintime<=CAST(GETDATE() AS SMALLDATETIME)
- AND endtime>=CAST(GETDATE() AS SMALLDATETIME)
- AND valid=1
- AND province_id = @ProvinceID
- ORDER BY id DESC
- END
- GO
- /****** Object: StoredProcedure [dbo].[procAdverProjectByProvinceID16Select] Script Date: 2018/12/13 19:09:21 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- --#####################################################
- --创建时间:2014.11.03
- --创建人:Nick
- --说明:取新职业指导切换图片的数据
- --#####################################################
- CREATE PROCEDURE [dbo].[procAdverProjectByProvinceID16Select]
- (
- @ProvinceID INT
- )
- AS
- BEGIN TRY
- SELECT id, imagefile, remarks, url, companyid
- FROM adverproject WITH(NOLOCK)
- WHERE type = 16
- AND begintime <= CAST(GETDATE() AS SMALLDATETIME)
- AND endtime >= CAST(GETDATE() AS SMALLDATETIME)
- AND valid = 1
- AND province_id = @ProvinceID
- AND inNews = 1
- ORDER BY orderby
- END TRY
- BEGIN CATCH
- RETURN 0
- END CATCH
- GO
- /****** Object: StoredProcedure [dbo].[procAdverprojectChangeadSelect] Script Date: 2018/12/13 19:09:21 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- --创建人 Lambo 20101010
- --用于首页查询切换的广告图片
- CREATE PROCEDURE [dbo].[procAdverprojectChangeadSelect]
- (
- @province_id SMALLINT
- )
- AS
- BEGIN
- SELECT id, imagefile, remarks, url, companyid
- FROM adverproject with(nolock)
- WHERE type=9
- AND begintime<=CAST(GETDATE() AS SMALLDATETIME)
- AND endtime>=CAST(GETDATE() AS SMALLDATETIME)
- AND valid=1
- AND province_id=@province_id
- ORDER BY orderby
- END
- GO
- /****** Object: StoredProcedure [dbo].[procAdverprojectChangeadSelectNew] Script Date: 2018/12/13 19:09:21 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- CREATE PROCEDURE [dbo].[procAdverprojectChangeadSelectNew]
- (
- @province_id SMALLINT
- )
- AS
- BEGIN
- SELECT id, imagefile, remarks, url, companyid
- FROM adverproject with(nolock)
- WHERE type=16
- AND begintime<=CAST(GETDATE() AS SMALLDATETIME)
- AND endtime>=CAST(GETDATE() AS SMALLDATETIME)
- AND valid=1
- AND province_id=@province_id
- ORDER BY orderby
- END
- GO
- /****** Object: StoredProcedure [dbo].[procAdverprojectClickCountByIDUpdate] Script Date: 2018/12/13 19:09:21 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- --#####################################################
- --创建时间:2014.11.03
- --创建人:Nick
- --说明:修改点击次数
- --#####################################################
- CREATE PROCEDURE [dbo].[procAdverprojectClickCountByIDUpdate]
- (
- @ID INT
- )
- AS
- BEGIN TRY
- UPDATE adverproject SET clickcount=clickcount+1 WHERE id = @ID
- RETURN 1
- END TRY
- BEGIN CATCH
- RETURN 0
- END CATCH
- GO
- /****** Object: StoredProcedure [dbo].[ProcAdverProjectErrorLogInsert] Script Date: 2018/12/13 19:09:22 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- --#####################################################
- --创建时间:2014.10.28
- --创建人:Nick
- --说明:插入 广告日志
- --#####################################################
- CREATE PROCEDURE [dbo].[ProcAdverProjectErrorLogInsert]
- @Log VARCHAR(500)
- AS
- BEGIN TRY
- INSERT INTO AdverProject_Errorlog (errorlog)
- VALUES (@Log)
- END TRY
- BEGIN CATCH
- RETURN 0
- END CATCH
- GO
- /****** Object: StoredProcedure [dbo].[ProcAdverProjectHWSelect] Script Date: 2018/12/13 19:09:22 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- --#####################################################
- --创建时间:2014.10.28
- --创建人:Nick
- --说明:获取首页横排广告的宽度信息
- --#####################################################
- CREATE PROCEDURE [dbo].[ProcAdverProjectHWSelect]
- (
- @dcProvinceId VARCHAR(10),
- @Date VARCHAR(50)
- )
- AS
- BEGIN
- SELECT width, height
- FROM AdverProject WITH(Nolock)
- WHERE Province_ID = @dcProvinceId
- AND Type = 10
- AND BeginTime <= CONVERT(SMALLDATETIME, @Date)
- AND EndTime > CONVERT(SMALLDATETIME, @Date)
- AND Valid = 1
- ORDER BY OrderBy
- END
- GO
- /****** Object: StoredProcedure [dbo].[procAdverprojectLogoSelect] Script Date: 2018/12/13 19:09:22 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- CREATE PROCEDURE [dbo].[procAdverprojectLogoSelect]
- (
- @province_id SMALLINT
- )
- AS
- BEGIN
- SELECT id, imagefile, remarks, url, companyid
- FROM adverproject with(nolock)
- WHERE type=17
- AND begintime<=CAST(GETDATE() AS SMALLDATETIME)
- AND endtime>=CAST(GETDATE() AS SMALLDATETIME)
- AND valid=1
- AND province_id=@province_id
- ORDER BY orderby
- END
- GO
- /****** Object: StoredProcedure [dbo].[ProcAdverprojectRowad] Script Date: 2018/12/13 19:09:23 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- --######################################################33
- --创建人 Lambo
- --20101009
- --用于首页查询六分之一模块的广告图片
- --修改 sean 2011-10-11 增加每个企业的职位和简介
- --sean 2014-01-10
- --######################################################33
- CREATE PROCEDURE [dbo].[ProcAdverprojectRowad]
- (
- @Province_Id SMALLINT
- )
- AS
- BEGIN
- IF @Province_Id < 99 OR @Province_Id LIKE '32%'
- BEGIN
- SELECT Id, Type,Province_Id,ImageFile,Url,Width,Height,Remarks,NoFollow + CompanyId CompanyId,Orderby,JobID,JobName,CompanyBiref
- FROM SearchDb..AdverProjectShot WITH(NOLOCK)
- WHERE Type=10
- AND Province_Id = @Province_Id
- ORDER BY OrderBy
- END
- ELSE
- BEGIN
- DECLARE @t AS TABLE(
- oId INT identity(1, 1),
- id INT,
- Type Int,
- Province_Id int,
- ImageFile VARCHAR(100),
- Url VARCHAR(200),
- Width int,
- Height int,
- Remarks NVARCHAR(200),
- CompanyId VARCHAR(20),
- OrderBy INT,
- JobId VARCHAR(200),
- JobName NVARCHAR(1000),
- CompanyBiref NVARCHAR(200)
- )
- INSERT @t(Id, Type, Province_Id, ImageFile, Url, Width, Height, Remarks, CompanyId, Orderby, JobID, JobName, CompanyBiref)
- SELECT Id, Type, Province_Id, ImageFile, Url, Width, Height, Remarks, NoFollow + CompanyId CompanyId, Orderby, JobID, JobName, CompanyBiref
- FROM SearchDb..AdverProjectShot WITH(NOLOCK)
- WHERE Type=10
- AND Province_Id = @Province_Id
- ORDER BY OrderBy
- INSERT @t(Id, Type, Province_Id, ImageFile, Url, Width, Height, Remarks, CompanyId, Orderby, JobID, JobName, CompanyBiref)
- SELECT Id, Type, Province_Id, ImageFile, Url, Width, Height, Remarks, NoFollow + CompanyId CompanyId, Orderby, JobID, JobName, CompanyBiref
- FROM SearchDb..AdverProjectShot WITH(NOLOCK)
- WHERE Type=10
- AND Province_Id = LEFT(@Province_Id, 2)
- ORDER BY OrderBy
- SELECT Id, Type, Province_Id, ImageFile, Url, Width, Height, Remarks, CompanyId, Orderby, JobID, JobName, CompanyBiref FROM @t ORDER BY Oid
- END
- END
- GO
- /****** Object: StoredProcedure [dbo].[procAdverprojectRowTopadSelect] Script Date: 2018/12/13 19:09:23 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- --创建人 Lambo
- --时间 20101009
- --用于网站首页查询网站头部广告
- CREATE PROCEDURE [dbo].[procAdverprojectRowTopadSelect]
- (
- @province_id int
- )
- AS
- BEGIN
- SELECT id,imagefile,width,url,companyid,remarks
- FROM adverproject WITH(NOLOCK)
- WHERE TYPE=11
- AND begintime<=CAST(GETDATE() AS SMALLDATETIME)
- AND endtime>=CAST(GETDATE()-7 AS SMALLDATETIME)
- AND valid=1
- AND province_id=@province_id
- ORDER BY orderby
- END
- GO
- /****** Object: StoredProcedure [dbo].[procAdverProjectShotByProvinceIDSelect] Script Date: 2018/12/13 19:09:24 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- --#####################################################
- --创建时间:2014.11.10
- --创建人:Nick
- --说明:首页广告
- --#####################################################
- CREATE PROCEDURE [dbo].[procAdverProjectShotByProvinceIDSelect]
- AS
- BEGIN TRY
- SELECT *,b.dcProvinceID
- FROM SearchDb..AdverProjectShot a WITH(NOLOCK)
- left join cpMain b WITH(NOLOCK) on a.CompanyID=b.SecondID
- WHERE type=10
- AND Province_Id = 0
- ORDER BY OrderBy
- END TRY
- BEGIN CATCH
- RETURN 0
- END CATCH
- GO
- /****** Object: StoredProcedure [dbo].[ProcAdverProjectShotRebuild] Script Date: 2018/12/13 19:09:24 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- CREATE PROCEDURE [dbo].[ProcAdverProjectShotRebuild]
- AS
- BEGIN
- SET NOCOUNT ON
- DECLARE @t AS TABLE(
- [Id] [int] NOT NULL,
- [Type] [smallint] NOT NULL,
- [Province_Id] [int] NOT NULL,
- [ImageFile] [varchar](100) NULL,
- [Url] [varchar](200) NULL,
- [Width] [smallint] NULL,
- Height SmallINT NULL,
- [Remarks] [nvarchar](200) NULL,
- [CompanyId] varchar(12) NULL,
- [Orderby] [smallint] NULL,
- [JobID] [varchar](300) NULL,
- [JobName] [nvarchar](1000) NULL,
- [CompanyBiref] [nvarchar](200) NULL,
- RealCpMainID INT,
- NoFollow VARCHAR(1)
- )
- -- DECLARE @OrderBy1 AS INT
- -- DECLARE @OrderBy2 AS INT
- -- SELECT @ORderBy1 = OrderBy FROM AdverProject WITH(NOLOCK) WHERE ID = 28078 AND Valid = 1
- -- SELECT @ORderBy2 = OrderBy FROM AdverProject WITH(NOLOCK) WHERE ID = 31536 AND Valid = 1
- -- IF @OrderBy1 > 0 AND @OrderBy2 > 0
- -- BEGIN
- -- UPDATE AdverProject SET OrderBy = @OrderBy1 WHERE ID = 31536
- -- UPDATE AdverProject SET OrderBy = @OrderBy2 WHERE ID = 28078
- -- END
- INSERT INTO @t(Id, Imagefile, Width, Height, Url, Companyid, Remarks, Province_Id, Type, ORderBy, RealCpMainID, NoFollow)
- SELECT Id, Imagefile, Width, Height, Url, Companyid, Remarks, Province_Id, Type, ORderBy, Companyid, '_'
- FROM AdverProject WITH(NOLOCK)
- WHERE Type=10
- AND BeginTime <= CAST(GETDATE() AS SMALLDATETIME)
- AND EndTime > CAST(GETDATE() AS SMALLDATETIME)
- AND Valid = 1
- DECLARE @RUN AS INT
- SET @Run = 0
- UPDATE @t SET JobID = dbo.GetJobSecondIds(Companyid), JobName = dbo.GetJobNames(Companyid)
- UPDATE a SET a.Companyid = b.SecondId
- FROM @t a, cpMain b WITH(NOLOCK)
- WHERE a.RealCpMainID = b.Id
- UPDATE a
- SET a.CompanyBiref = LEFT(ISNULL(b.Brief, ''), 200)
- FROM @t a,
- cpMain b WITH(NOLOCK)
- WHERE b.ID = a.RealCpMainID
-
- UPDATE @t SET NoFollow = ''
- --WHERE CompanyID IN(SELECT PageId FROM MarketDb..PageBaiduInclude WHERE PageType = 1 AND IncludeDate IS Null)
- TRUNCATE TABLE SearchDB..AdverProjectShot
- INSERT INTO SearchDB..AdverProjectShot
- SELECT * FROM @t
- END
- GO
- /****** Object: StoredProcedure [dbo].[procAgent_BlackSelect] Script Date: 2018/12/13 19:09:24 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- --#####################################################
- --创建时间:2014.11.03
- --创建人:Nick
- --说明:Agent黑名单
- --#####################################################
- CREATE PROCEDURE [dbo].[procAgent_BlackSelect]
- AS
- BEGIN TRY
- SELECT * FROM agent_Black With(Nolock) ORDER BY ID
- END TRY
- BEGIN CATCH
- RETURN 0
- END CATCH
- GO
- /****** Object: StoredProcedure [dbo].[procAgent_WhiteSelect] Script Date: 2018/12/13 19:09:24 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- --#####################################################
- --创建时间:2014.11.03
- --创建人:Nick
- --说明:Agent白名单
- --#####################################################
- CREATE PROCEDURE [dbo].[procAgent_WhiteSelect]
- AS
- BEGIN TRY
- SELECT * FROM agent_White With(Nolock) ORDER BY ID
- END TRY
- BEGIN CATCH
- RETURN 0
- END CATCH
- GO
- /****** Object: StoredProcedure [dbo].[procAssessCpInviteByOverUpdate] Script Date: 2018/12/13 19:09:24 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- --#####################################################
- --创建时间:20181119
- --创建人:Peter
- --修改过期的邀请并返还
- --#####################################################
- CREATE PROCEDURE [dbo].[procAssessCpInviteByOverUpdate]
- AS
- SET NOCOUNT ON
- BEGIN
- SELECT ROW_NUMBER() OVER(ORDER BY a.AddDate) RowNo,b.CaOrderID,1 UseCnt,a.ID RelateID,3 RelateType,b.CaMainID,b.IP,CONVERT(INT,0) RemainCnt
- INTO #T
- FROM AssessCpInvite a WITH(NOLOCK)
- INNER JOIN AssessOrderUselog b WITH(NOLOCK) ON b.RelateID = a.ID AND b.RelateType = 2
- WHERE a.EndDate < GETDATE()
- AND NOT EXISTS(SELECT 'x' FROM AssessOrderUselog WHERE RelateType = 3 AND RelateID = a.ID)
- DECLARE cur_OrderInfo CURSOR FOR
- SELECT RowNo,CaOrderID,UseCnt,CaMainID
- FROM #T
- DECLARE @RowNo INT,@CaOrderID INT,@UseCnt INT,@CaMainID INT
- OPEN cur_OrderInfo
- FETCH NEXT FROM cur_OrderInfo INTO @RowNo,@CaOrderID, @UseCnt, @CaMainID
- WHILE @@FETCH_STATUS = 0
- BEGIN
- UPDATE CaOrder
- SET RemainAssessReportQuota = RemainAssessReportQuota + @UseCnt
- WHERE ID = @CaOrderID
- UPDATE #T
- SET RemainCnt = (
- SELECT SUM(RemainAssessReportQuota)
- FROM CaOrder WITH(NOLOCK)
- WHERE cpMainID = (SELECT TOP 1 CpMainID FROM CaMain WITH(NOLOCK) WHERE ID = @CaMainID)
- AND RemainAssessReportQuota > 0
- AND BeginDate < GETDATE()
- AND EndDate > GETDATE()
- AND IsDeleted = 0
- )
- WHERE RowNo = @RowNo
- FETCH NEXT FROM cur_OrderInfo INTO @RowNo,@CaOrderID, @UseCnt, @CaMainID
- END
- CLOSE cur_OrderInfo
- DEALLOCATE cur_OrderInfo
- INSERT INTO AssessOrderUseLog(CaOrderID,UseCnt,RelateID,RelateType,CaMainID,IP,RemainCnt)
- SELECT CaOrderID,UseCnt,RelateID,RelateType,CaMainID,IP,RemainCnt
- FROM #T
- ORDER BY RemainCnt DESC
- DROP TABLE #T
- END
- GO
- /****** Object: StoredProcedure [dbo].[procAvgSalarySelect] Script Date: 2018/12/13 19:09:25 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- --#####################################################
- --创建时间:2014.11.03
- --创建人:Nick
- --说明:得到平均工资信息
- --#####################################################
- CREATE PROCEDURE [dbo].[procAvgSalarySelect]
- (
- @RegionID INT,
- @JobTypeID INT,
- @Cnt INT
- )
- AS
- BEGIN TRY
- SELECT dcsalaryid,d.description,CONVERT(decimal(18,1),count(*)/CONVERT(DECIMAL(18,1),@Cnt)*100) pct,count(*) cnt
- FROM job a WITH(NOLOCK),dcsalary d WITH(NOLOCK)
- WHERE d.id=a.dcsalaryid
- AND a.dcjobtypeid = @JobTypeID
- AND a.dcregionid like ''+CONVERT(VARCHAR(6),@RegionID)+'%'
- AND a.dcSalaryID<>100
- AND a.Valid > 0
- AND a.dcSalaryID IS NOT NULL AND a.RefreshDate>GetDate()-365
- GROUP BY a.dcsalaryid, d.description
- ORDER BY a.dcsalaryid
- END TRY
- BEGIN CATCH
- RETURN 0
- END CATCH
- GO
- /****** Object: StoredProcedure [dbo].[ProcBaiduLinkLogSelect] Script Date: 2018/12/13 19:09:25 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- CREATE PROCEDURE [dbo].[ProcBaiduLinkLogSelect]
- (
- @ProvinceId TINYINT
- )
- AS
- BEGIN
- SELECT TOP 480 *, SPACE(200) Url INTO #T FROM LogDb..BaiduLinkLog WHERE AddSubmitDate IS NULL AND ProvinceID = @ProvinceId
- DECLARE @Site VARCHAR(50)
- SELECT @Site = ProvinceDomain FROM dcProvince WHERE ID = @ProvinceId
-
- UPDATE #t
- SET Url = 'http://www.' + @Site + '/personal/cp' + SecondId + '.html'
- WHERE cpMainId > 0
-
- UPDATE #t
- SET Url = 'http://www.' + @Site + '/personal/jb' + SecondId + '.html'
- WHERE JobId > 0
- SELECT Url FROM #t
- UPDATE LogDb..BaiduLinkLog SET AddSubmitDate = GETDATE() WHERE Id IN(SELECT Id FROM #t)
- DROP TABLE #T
- END
- GO
- /****** Object: StoredProcedure [dbo].[procBaiduMapLogByJobIDSelect] Script Date: 2018/12/13 19:09:25 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- --#####################################################
- --创建时间:2014.11.04
- --创建人:Nick
- --说明:获取职位标注地点
- --#####################################################
- CREATE PROCEDURE [dbo].[procBaiduMapLogByJobIDSelect]
- (
- @JobID VARCHAR(20)
- )
- AS
- BEGIN TRY
- SELECT FullName FROM LogDB..BaiduMapLog WITH(NOLOCK) WHERE JobID=@JobID
- END TRY
- BEGIN CATCH
- RETURN 0
- END CATCH
- GO
- /****** Object: StoredProcedure [dbo].[procBaiduMapLogSelect] Script Date: 2018/12/13 19:09:25 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- --#####################################################
- --创建时间:2014.11.10
- --创建人:John
- --说明:获取待同步的地图信息
- --#####################################################
- CREATE PROCEDURE [dbo].[procBaiduMapLogSelect]
- AS
- BEGIN
- SELECT TOP 30000 JobId, JobName, Address, cpMainName, Lng, Lat, Salary, JobUrl, cpMainUrl, Status
- FROM BaiduMapLog WITH(NOLOCK) WHERE Status IN(1, 2, 3)
- END
- GO
- /****** Object: StoredProcedure [dbo].[procBaiduMapLogUpdate] Script Date: 2018/12/13 19:09:25 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- --#####################################################
- --创建时间:2014.11.10
- --创建人:John
- --说明:更新地图信息
- --#####################################################
- CREATE PROCEDURE [dbo].[procBaiduMapLogUpdate]
- (
- @JobID INT
- )
- AS
- BEGIN
- UPDATE BaiduMapLog SET [Status] = 0, UploadDate = GETDATE() WHERE Status IN(1, 2) AND JobID = @JobID
- DELETE BaiduMapLog WHERE Status = 3 AND JobID = @JobID
- END
- GO
- /****** Object: StoredProcedure [dbo].[ProcBaiduSiteFileByExpiredCpMainSelect] Script Date: 2018/12/13 19:09:26 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- ------------------
- --sean 2013-12-12
- CREATE PROCEDURE [dbo].[ProcBaiduSiteFileByExpiredCpMainSelect]
- (
- @ProvinceId INT
- )
- AS
- BEGIN
- DECLARE @i INT, @Sd DATETIME
- SELECT @i = DATEDIFF(DAY, '2013-12-11', GETDATE()),
- @sd = CONVERT(VARCHAR(10), GETDATE() - @i* 2, 120)
-
- DELETE BaiduExpiredCpMain WHERE cpMainId IN(SELECT ID FROM cpMain WITH(NOLOCK) WHERE Valid = 1)
- SELECT TOP 0 cpMainId, SecondId INTO #t FROM BaiduExpiredCpMain
- --------7天内受限制的职位
- INSERT #t
- SELECT ID, SecondId
- FROM cpMain WITH(NOLOCK)
- WHERE isLimitlogin = 9
- AND Id in(SELECT cpMainid FROM bsCpstatus WHERE statusId=9 AND AddDate > GETDATE() - 7)
- AND dcProvinceId = @ProvinceID
- -------2天内删除的职位
- INSERT INTO #t
- SELECT Id, SecondID
- FROM company_deleted
- WHERE AddDate > GETDATE() - 2
- AND Province_ID = @ProvinceID
- -------不在CpMain表中的职位
- INSERT INTO #t
- SELECT Id, SecondId
- FROM LogDb..AllCpMainLog
- WHERE Id NOT IN(SELECT Id FROM cpMain WITH(NOLOCK))
- DELETE #t WHERE cpMainId IN (SELECT cpMainId FROM BaiduExpiredCpMain WHERE AddDate < GETDATE() - 1)
- SELECT DISTINCT * INTO #t1 FROM #t
- INSERT BaiduExpiredCpMain
- SELECT DISTINCT *, GETDATE()
- FROM #t
- WHERE cpMainID NOT IN(SELECT cpMainId FROM BaiduExpiredCpMain)
- ORDER BY cpMainId
- SELECT '/personal/cp' + CONVERT(VARCHAR, SecondID) + '.html' Link
- FROM #t1 order by SecondID desc
- END
- GO
- /****** Object: StoredProcedure [dbo].[ProcBaiduSiteFileByExpiredJobSelect] Script Date: 2018/12/13 19:09:26 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- --sean 2013-12-12
- CREATE PROCEDURE [dbo].[ProcBaiduSiteFileByExpiredJobSelect]
- (
- @ProvinceId INT
- )
- AS
- BEGIN
- DECLARE @i INT, @Sd DATETIME
- SELECT @i = DATEDIFF(DAY, '2013-12-11', GETDATE()),
- @sd = CONVERT(VARCHAR(10), GETDATE() - @i* 2, 120)
-
- DELETE BaiduExpiredJob WHERE JobId IN(
- SELECT a.ID FROM Job a WITH(NOLOCK), cpMain b WITH(NOLOCK)
- WHERE a.cpMainId = b.Id
- AND a.Valid = 1 AND b.Valid = 1)
- SELECT TOP 0 * INTO #t FROM BaiduExpiredJob
- --------7天内受限制的职位
- INSERT #t
- SELECT a.ID, a.SecondId, GETDATE()
- FROM Job a WITH(NOLOCK),
- cpMain b WITH(NOLOCK)
- WHERE a.cpMainid = b.id
- AND b.isLimitlogin = 9
- AND b.Id in(SELECT cpMainid FROM bsCpstatus WHERE statusId=9 AND AddDate > GETDATE() - 7)
- AND b.dcProvinceId = @ProvinceID
- -------2天内删除的职位
- INSERT INTO #t
- SELECT JobId, SecondID, GETDATE()
- FROM JobDeleted
- WHERE DeleteDate > @sd
- AND ProvinceID = @ProvinceID
- -------不在Job表中的职位
- INSERT INTO #t
- SELECT JobId, JobSecondId, GETDATE() FROM LogDb..AllJobLog WHERE JobId NOT IN(SELECT Id FROM Job WITH(NOLOCK))
- DELETE #t WHERE JobId IN (SELECT JobId FROM BaiduExpiredJob WHERE AddDate < GETDATE() - 1)
- SELECT DISTINCT * INTO #t1 FROM #t
- INSERT BaiduExpiredJob
- SELECT DISTINCT * FROM #t
- WHERE JobId NOT IN(SELECT JobId FROM BaiduExpiredJob)
- ORDER BY JobId
- DELETE LogDb..AllJobLog WHERE JobId IN(SELECT JobId FROM #t)
- SELECT '/personal/jb' + CONVERT(VARCHAR, SecondID) + '.html' Link
- FROM #t order by SecondID desc
- END
- GO
- /****** Object: StoredProcedure [dbo].[ProcBaiduSiteFileByExpiredSelect] Script Date: 2018/12/13 19:09:26 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- --sean 2013-12-12
- CREATE PROCEDURE [dbo].[ProcBaiduSiteFileByExpiredSelect]
- (
- @ProvinceId INT
- )
- AS
- BEGIN
- --SELECT TOP 0 NULL Link
- --RETURN
- DECLARE @i INT, @Sd DATETIME
- SELECT @i = DATEDIFF(DAY, '2013-12-11', GETDATE()),
- @sd = CONVERT(VARCHAR(10), GETDATE() - @i* 2, 120)
-
- DELETE BaiduExpiredJob WHERE JobId IN(
- SELECT a.ID FROM Job a WITH(NOLOCK), cpMain b WITH(NOLOCK)
- WHERE a.cpMainId = b.Id
- AND a.Valid = 1 AND b.Valid = 1)
- SELECT TOP 0 * INTO #t FROM BaiduExpiredJob
- --------7天内受限制的职位
- INSERT #t
- SELECT a.ID, a.SecondId, GETDATE()
- FROM Job a WITH(NOLOCK),
- cpMain b WITH(NOLOCK)
- WHERE a.cpMainid = b.id
- AND b.isLimitlogin = 9
- AND b.Id in(SELECT cpMainid FROM bsCpstatus WHERE statusId=9 AND AddDate > GETDATE() - 7)
- AND b.dcProvinceId = @ProvinceID
- -------2天内删除的职位
- INSERT INTO #t
- SELECT JobId, SecondID, GETDATE()
- FROM JobDeleted
- WHERE DeleteDate > @sd
- AND ProvinceID = @ProvinceID
- -------不在Job表中的职位
- INSERT INTO #t
- SELECT JobId, JobSecondId, GETDATE() FROM LogDb..AllJobLog WHERE JobId NOT IN(SELECT Id FROM Job WITH(NOLOCK))
- DELETE #t WHERE JobId IN (SELECT JobId FROM BaiduExpiredJob WHERE AddDate < GETDATE() - 1)
- SELECT DISTINCT * INTO #t1 FROM #t
- INSERT BaiduExpiredJob
- SELECT DISTINCT * FROM #t
- WHERE JobId NOT IN(SELECT JobId FROM BaiduExpiredJob)
- ORDER BY JobId
- DELETE LogDb..AllJobLog WHERE JobId IN(SELECT JobId FROM #t)
- SELECT '/personal/jb' + CONVERT(VARCHAR, SecondID) + '.html' Link
- FROM #t order by SecondID desc
- END
- GO
- /****** Object: StoredProcedure [dbo].[ProcBaiduSiteFileCompanySelect] Script Date: 2018/12/13 19:09:26 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- --++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- --sean 2014-2-27 update,modify secondid
- --++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- CREATE PROCEDURE [dbo].[ProcBaiduSiteFileCompanySelect]
- (
- @SiteId INT
- )
- AS
- BEGIN
- IF EXISTS(SELECT 'x' FROM dcSubSite WHERE IsMainSite = 1 AND ID = @SiteId)
- BEGIN
- IF @SiteId < 99
- BEGIN
- SELECT TOP 50000 '/personal/cp' + SecondId + '.html' link FROM CpMainPublish WITH(NOLOCK)
- WHERE Valid>0 --AND RefreshDate > CONVERT(varchar(10),GetDate(),120)
- AND dcRegionID LIKE LTRIM(STR(@SiteId)) + '%'
- AND SecondId IN(SELECT PageId FROM MarketDb..PageBaiduInclude WITH(NOLOCK) WHERE IncludeDate IS NULL)
- END
- ELSE
- BEGIN
- SELECT TOP 50000 '/personal/cp' + SecondId + '.html' link FROM CpMainPublish WITH(NOLOCK)
- WHERE Valid>0 --AND RefreshDate > CONVERT(varchar(10),GetDate(),120)
- AND dcRegionID LIKE LTRIM(STR(@SiteId)) + '%'
- AND SecondId IN(SELECT PageId FROM MarketDb..PageBaiduInclude WITH(NOLOCK) WHERE IncludeDate IS NULL)
-
- END
- END
- ELSE
- BEGIN
- IF @SiteId LIKE '35__'
- BEGIN
- SELECT TOP 50000 '/personal/cp' + SecondId + '.html' link FROM CpMain WITH(NOLOCK)
- WHERE Valid>0 AND RefreshDate > CONVERT(varchar(10), GetDate(),120) AND dcProvinceID=LEFT(@SiteId, 2)
- AND SecondId IN(SELECT PageId FROM MarketDb..PageBaiduInclude WITH(NOLOCK) WHERE IncludeDate IS NULL)
- UNION
- SELECT TOP 50000 '/corp/cp-' + SecondId + '.html' link FROM CpMain WITH(NOLOCK)
- WHERE Valid>0 AND RefreshDate > CONVERT(varchar(10), GetDate(),120) AND dcProvinceID=LEFT(@SiteId, 2)
- AND SecondId IN(SELECT PageId FROM MarketDb..PageBaiduInclude WITH(NOLOCK) WHERE IncludeDate IS NULL)
- END
- ELSE
- BEGIN
- SELECT TOP 50000 '/personal/cp' + SecondId + '.html' link FROM CpMainPublish WITH(NOLOCK)
- WHERE Valid>0 --AND RefreshDate>CONVERT(varchar(10),GetDate(),120) AND dcProvinceID=LEFT(@SiteId, 2)
- AND dcRegionID LIKE LTRIM(STR(@SiteId)) + '%'
- AND SecondId IN(SELECT PageId FROM MarketDb..PageBaiduInclude WITH(NOLOCK) WHERE IncludeDate IS NULL)
- END
- END
- END
- GO
- /****** Object: StoredProcedure [dbo].[ProcBaiduSiteFileCpJobSelect] Script Date: 2018/12/13 19:09:26 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- --++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- --sean 2014-2-27 update,modify secondid
- --++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- CREATE PROCEDURE [dbo].[ProcBaiduSiteFileCpJobSelect]
- (
- @SiteId INT
- )
- AS
- BEGIN
- IF EXISTS(SELECT 'x' FROM dcSubSite WHERE IsMainSite = 1 AND ID = @SiteId)
- BEGIN
- IF @SiteId < 99
- BEGIN
- SELECT TOP 50000 '/personal/cpjob' + SecondId + '.html' link
- FROM CpMainPublish WITH(NOLOCK)
- WHERE Valid > 0 --AND RefreshDate > CONVERT(varchar(10),GetDate(),120)
- AND dcRegionID LIKE LTRIM(STR(@SiteId)) + '%'
- AND SecondId IN(SELECT PageId FROM MarketDb..PageBaiduInclude WITH(NOLOCK) WHERE IncludeDate IS NULL)
- END
- ELSE
- BEGIN
- SELECT TOP 50000 '/personal/cpJob' + SecondId + '.html' link FROM CpMainPublish WITH(NOLOCK)
- WHERE Valid > 0 --AND RefreshDate > CONVERT(varchar(10),GetDate(),120)
- AND dcRegionID LIKE LTRIM(STR(@SiteId)) + '%'
- AND SecondId IN(SELECT PageId FROM MarketDb..PageBaiduInclude WITH(NOLOCK) WHERE IncludeDate IS NULL)
- END
- END
- ELSE
- BEGIN
- SELECT TOP 50000 '/personal/cpjob' + SecondId + '.html' link FROM CpMainPublish WITH(NOLOCK)
- WHERE Valid > 0 --AND RefreshDate>CONVERT(varchar(10),GetDate(),120) AND dcProvinceID=LEFT(@SiteId, 2)
- AND dcRegionID LIKE LTRIM(STR(@SiteId)) + '%'
- AND SecondId IN(SELECT PageId FROM MarketDb..PageBaiduInclude WITH(NOLOCK) WHERE IncludeDate IS NULL)
- END
- END
- GO
- /****** Object: StoredProcedure [dbo].[ProcBaiduSiteFileJobSelect] Script Date: 2018/12/13 19:09:27 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- CREATE PROCEDURE [dbo].[ProcBaiduSiteFileJobSelect]
- (
- @SiteId INT
- )
- AS
- BEGIN
- CREATE TABLE #t(ID INT, SecondId VARCHAR(12))
- IF EXISTS(SELECT 'x' FROM dcSubSite WHERE IsMainSite = 1 AND ID = @SiteId)
- BEGIN
- IF @SiteId < 99
- BEGIN
- INSERT INTO #t
- SELECT a.Id, a.SecondId
- FROM Job a, cpMain b
- WHERE a.cpMainID = b.ID
- AND a.Valid>0 AND a.RefreshDate > CONVERT(VARCHAR(10), GETDATE(), 120)
- AND b.dcProvinceID = @SiteId
- DELETE #t WHERE SecondId IN(SELECT PageId FROM MarketDb..PageBaiduInclude WITH(NOLOCK) WHERE IncludeDate IS NOT NULL)
- SELECT TOP 50000 '/personal/jb' + SecondID + '.html' link
- FROM Job
- WHERE ID IN(SELECT ID FROM #t)
- END
- ELSE
- BEGIN
- INSERT INTO #t
- SELECT a.Id, a.SecondId
- FROM Job a, cpMain b
- WHERE a.cpMainID = b.ID
- AND a.Valid>0 AND a.RefreshDate > CONVERT(VARCHAR(10), GETDATE(), 120)
- AND b.dcSubSiteID = @SiteId
- DELETE #t WHERE SecondId IN(SELECT PageId FROM MarketDb..PageBaiduInclude WITH(NOLOCK) WHERE IncludeDate IS NOT NULL)
- SELECT TOP 50000 '/personal/jb' + SecondID + '.html' link
- FROM Job
- WHERE ID IN(SELECT ID FROM #t)
- END
- END
- ELSE
- BEGIN
- IF @SiteId LIKE '35__'
- BEGIN
- INSERT INTO #t
- SELECT a.Id, a.SecondId
- FROM Job a, cpMain b
- WHERE a.cpMainID = b.ID
- AND a.Valid > 0 AND a.RefreshDate > CONVERT(VARCHAR(10), GETDATE(), 120)
- AND b.dcProvinceID = LEFT(@SiteId, 2)
- DELETE #t WHERE SecondId IN(SELECT PageId FROM MarketDb..PageBaiduInclude WITH(NOLOCK) WHERE IncludeDate IS NOT NULL)
- SELECT TOP 50000 '/personal/jb' + SecondID + '.html' link
- FROM Job
- WHERE ID IN(SELECT ID FROM #t)
- UNION
- SELECT TOP 50000 '/Job/jb-' + SecondID + '.html' link
- FROM Job
- WHERE ID IN(SELECT ID FROM #t)
- END
- ELSE
- BEGIN
- INSERT INTO #t
- SELECT a.Id, a.SecondId
- FROM Job a, cpMain b
- WHERE a.cpMainID = b.ID
- AND a.Valid>0 AND a.RefreshDate > CONVERT(VARCHAR(10), GETDATE(), 120)
- AND b.dcProvinceID = LEFT(@SiteId, 2)
- DELETE #t WHERE SecondId IN(SELECT PageId FROM MarketDb..PageBaiduInclude WITH(NOLOCK) WHERE IncludeDate IS NOT NULL)
- SELECT TOP 50000 '/personal/jb' + SecondID + '.html' link
- FROM Job
- WHERE ID IN(SELECT ID FROM #t)
- END
- END
- END
- GO
- /****** Object: StoredProcedure [dbo].[ProcBaiduSubSiteByUrlSelect] Script Date: 2018/12/13 19:09:27 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- --#####################################################
- --创建时间:2014.10.28
- --创建人:John
- --说明:获取网站站点数据 用于百度数据
- --@subSiteUrl 网站Url
- --#####################################################
- CREATE PROCEDURE [dbo].[ProcBaiduSubSiteByUrlSelect]
- (
- @subSiteUrl VARCHAR(50)
- )
- AS
- BEGIN TRY
- SELECT id, SecondSiteName WebSite, SubSiteUrl Domain
- FROM dcSubSite WITH(NOLOCK)
- WHERE SubSiteUrl = @subSiteUrl
- END TRY
- BEGIN CATCH
- RETURN 0
- END CATCH
- GO
- /****** Object: StoredProcedure [dbo].[ProcBaiduXmlBy51rcSelect] Script Date: 2018/12/13 19:09:27 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- CREATE PROCEDURE [dbo].[ProcBaiduXmlBy51rcSelect]
- AS
- SET NOCOUNT ON
- BEGIN
- SELECT * FROM ShortDb..BaiduXmlJob51rcOut ORDER By RefreshDate DESC
- END
- GO
- /****** Object: StoredProcedure [dbo].[ProcBaiduXMLByAllSelect] Script Date: 2018/12/13 19:09:27 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- --------------------------------------------------
- --创建人:SEAN
- --创建日期:2016-09-06
- --功能说明:查询生成百度XML全部数据
- --------------------------------------------------
- CREATE PROCEDURE [dbo].[ProcBaiduXMLByAllSelect]
- (
- @dcProvinceID SMALLINT,
- @ServerId SMALLINT
- )
- AS
- SET NOCOUNT ON
- IF @ServerId IS NULL
- SET @ServerId = 99
- IF @dcProvinceID IS NULL
- RETURN
- BEGIN
- DECLARE @PageNo SMALLINT, @GetRows INT, @BeginJobId INT, @PageCount INT,
- @AddDate DATETIME, @Id INT, @CurrentStatus TINYINT, @MaxJobId INT,
- @PageRows INT
- SELECT @PageRows = 1500
- SELECT @Id = Id, @PageNo = PageNo, @BeginJobId = BeginJobId, @PageCount = [PageCount],
- @AddDate = AddDate, @CurrentStatus = CurrentStatus, @GetRows = GetRows
- FROM LogDb..BaiduXmlRunLog WITH(NOLOCK)
- WHERE ServerID = @ServerID
- AND dcProvinceID = @dcProvinceID
- IF @PageNo IS NULL OR @AddDate < DATEADD(HOUR, -4, GETDATE())
- BEGIN
- DELETE FROM LogDb..BaiduXmlRunLog WHERE Id = @Id
- SELECT TOP 1 @MaxJobId = RowNo + 10 FROM Shortdb..BaiduXMLJobOut WITH(NOLOCK) ORDER BY RowNo DESC
- SELECT @PageNo = 1, @CurrentStatus = 0, @BeginJobId = @MaxJobId, @CurrentStatus = 0, @GetRows = NULL
- INSERT INTO Logdb..BaiduXmlRunLog(ServerId, dcProvinceId, PageNo, BeginJobId, CurrentStatus, AddDate)
- SELECT @ServerId, @dcProvinceID, @PageNo, @BeginJobId, @CurrentStatus, GETDATE()
- END
- IF @CurrentStatus = 10
- BEGIN
- SELECT TOP 0 * FROM LogDb..BaiduXmlRunLog
- RETURN
- END
- IF @CurrentStatus = 2
- BEGIN
- SELECT * FROM LogDb..BaiduXmlRunLog WHERE Id = @Id
- RETURN
- END
- --判断最后一次是否成功
- IF @CurrentStatus = 1
- BEGIN
- IF @GetRows = @PageRows
- UPDATE LogDb..BaiduXmlRunLog
- SET CurrentStatus = 0, GetRows = 0, PageNo = PageNo + 1
- WHERE Id = @Id
- ELSE
- UPDATE LogDb..BaiduXmlRunLog
- SET CurrentStatus = 0, GetRows = 0
- WHERE Id = @Id
- END
-
- SELECT @Id = Id, @PageNo = PageNo, @BeginJobId = BeginJobId,
- @AddDate = AddDate, @CurrentStatus = CurrentStatus, @PageCount = [PageCount]
- FROM LogDb..BaiduXmlRunLog WITH(NOLOCK)
- WHERE ServerID = @ServerID
- AND dcProvinceID = @dcProvinceID
- --------------------------------------
- CREATE TABLE #t
- (
- id int,
- jobname nvarchar(80),
- JobDESC varchar(max),
- JobDemand varchar(max),
- jobregion varchar(6),
- companyname varchar(100),
- edulevel tinyint,
- IsDelete bit,
- experiencelevel tinyint,
- AnnounceDate datetime,
- dcSalaryID tinyint,
- dcjobtypeID smallint,
- ShortName varchar(40),
- Address nvarchar(100),
- dcCompanySizeID tinyint,
- Brief varchar(6000),
- EmployType tinyint,
- adddate smalldatetime,
- dcCompanyKindID smallint,
- enddate smalldatetime,
- email varchar(50),
- EnJobID varchar(12),
- EnCpMainID varchar(10),
- IndustryId smallint,
- SubSiteUrl varchar(50),
- SubSiteName varchar(50),
- NeedNumber nvarchar(10),
- Welfare1 bit,
- Welfare2 bit,
- Welfare3 bit,
- Welfare4 bit,
- Welfare5 bit,
- Welfare6 bit,
- Welfare7 bit,
- Welfare8 bit,
- Welfare9 bit,
- Welfare10 bit,
- Welfare11 bit,
- Welfare12 bit,
- Welfare13 bit,
- Welfare14 bit,
- Welfare15 bit,
- Welfare16 bit,
- Welfare17 bit,
- Welfare18 bit,
- RowNo int,
- IsVip BIt
- )
- IF @dcProvinceID = 32 AND @ServerId > 900
- BEGIN
- IF @PageCount = 0
- BEGIN
- SELECT @PageCount = (COUNT(*) - 1) / @PageRows + 1
- FROM ShortDb..BaiduXMLJobOut WITH(NOLOCK)
- WHERE SiteId = @dcProvinceID AND RowNo > 0
- UPDATE LogDb..BaiduXmlRunLog SET PageCount = @PageCount WHERE Id = @Id
- END
- INSERT INTO #t
- SELECT TOP (@PageRows) id, jobname, JobDESC, JobDemand, jobregion, companyname, edulevel, IsDelete,
- experiencelevel, AnnounceDate, dcSalaryID, dcjobtypeID, ShortName, Address, dcCompanySizeID, Brief,
- EmployType, adddate, dcCompanyKindID, enddate, email, EnJobID, EnCpMainID,
- IndustryId, SubSiteUrl, SubSiteName, NeedNumber, Welfare1, Welfare2, Welfare3, Welfare4, Welfare5,
- Welfare6, Welfare7, Welfare8, Welfare9, Welfare10, Welfare11, Welfare12, Welfare13, Welfare14,
- Welfare15, Welfare16, Welfare17, Welfare18, RowNo
- FROM ShortDb..BaiduXMLJobOut WITH(NOLOCK)
- WHERE SiteId = @dcProvinceID
- AND RowNo < @BeginJobId
- ORDER BY RowNo DESC
- END
- ELSE
- BEGIN
- IF @PageCount = 0
- BEGIN
- SELECT @PageCount = (COUNT(*) - 1) / @PageRows + 1
- FROM ShortDb..BaiduXMLJobOut WITH(NOLOCK)
- WHERE SiteId = @dcProvinceID AND RowNo > 0
- UPDATE LogDb..BaiduXmlRunLog SET [PageCount] = @PageCount WHERE Id = @Id
- END
-
- INSERT INTO #t
- SELECT TOP (@PageRows) id, jobname, JobDESC, JobDemand, jobregion, companyname, edulevel, IsDelete,
- experiencelevel, AnnounceDate, dcSalaryID, dcjobtypeID, ShortName, Address, dcCompanySizeID, Brief,
- EmployType, adddate, dcCompanyKindID, enddate, email, EnJobID, EnCpMainID,
- IndustryId, SubSiteUrl, SubSiteName, NeedNumber, Welfare1, Welfare2, Welfare3, Welfare4, Welfare5,
- Welfare6, Welfare7, Welfare8, Welfare9, Welfare10, Welfare11, Welfare12, Welfare13, Welfare14,
- Welfare15, Welfare16, Welfare17, Welfare18, RowNo, IsVip
- FROM ShortDb..BaiduXMLJobOut WITH(NOLOCK)
- WHERE SiteId = @dcProvinceID
- AND RowNo < @BeginJobId
- ORDER BY RowNo DESC
- END
- UPDATE #t SET EndDate = GETDATE() + 10 WHERE EndDate < GETDATE() + 1
- DECLARE @JobCount INT
-
- SELECT @JobCount = COUNT(1) FROM #T
-
- IF @JobCount > 0
- BEGIN
- DECLARE @MinJobID INT
-
- SELECT @MinJobID = MIN(RowNo) FROM #T
-
- UPDATE LogDb..BaiduXmlRunLog
- SET EndJobId = @MinJobID, GetRows = @JobCount, LastRunDate = GETDATE()
- WHERE Id = @Id
-
- SELECT *
- FROM Logdb..BaiduXmlRunLog WITH(NOLOCK)
- WHERE id = @id
-
- SELECT * FROM #T
- END
- ELSE
- BEGIN
- UPDATE LogDb..BaiduXmlRunLog
- SET CurrentStatus = 2, LastRunDate = GETDATE()
- WHERE Id = @Id
- SELECT *
- FROM LogDb..BaiduXmlRunLog WITH(NOLOCK)
- WHERE Id = @Id
- END
-
- DROP TABLE #T
- END
- GO
- /****** Object: StoredProcedure [dbo].[ProcBaiduXmlByNewstSelect] Script Date: 2018/12/13 19:09:28 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- --获取10分钟内的数据
- CREATE PROCEDURE [dbo].[ProcBaiduXmlByNewstSelect]
- (
- @SiteId INT
- )
- AS
- SET NOCOUNT ON
- BEGIN
- CREATE TABLE #t
- (
- RowNo INT IDENTITY(1, 1),
- [Id] [int] NOT NULL,
- [JobName] [nvarchar](80) NOT NULL,
- [JobDESC] [varchar](max) NOT NULL,
- [JobDemand] [varchar](max) NOT NULL,
- [JobRegion] [varchar](6) NULL,
- [CompanyName] [varchar](100) NOT NULL,
- [EduLevel] [tinyint] NOT NULL,
- [IsDelete] [bit] NOT NULL,
- [ExperienceLevel] [tinyint] NOT NULL,
- [Announcedate] [datetime] NOT NULL,
- [dcSalaryID] [tinyint] NOT NULL,
- [dcJobtypeID] [smallint] NOT NULL,
- [ShortName] [varchar](40) NULL,
- [Address] [nvarchar](100) NULL,
- [dcCompanySizeID] [tinyint] NULL,
- [Brief] [varchar](6000) NULL,
- [EmployType] [tinyint] NOT NULL,
- [AddDate] [smalldatetime] NOT NULL,
- [dcCompanyKindID] [smallint] NULL,
- [EndDate] [smalldatetime] NULL,
- [Email] [varchar](50) NOT NULL,
- [EnJobID] [varchar](12) NULL,
- [EnCpMainID] [varchar](10) NULL,
- [IndustryId] [smallint] NULL,
- [SubSiteUrl] [varchar](50) NOT NULL,
- [SubSiteName] [varchar](50) NOT NULL,
- NeedNumber VARCHAR(10),
- [Welfare1] [bit] NULL,
- [Welfare2] [bit] NULL,
- [Welfare3] [bit] NULL,
- [Welfare4] [bit] NULL,
- [Welfare5] [bit] NULL,
- [Welfare6] [bit] NULL,
- [Welfare7] [bit] NULL,
- [Welfare8] [bit] NULL,
- [Welfare9] [bit] NULL,
- [Welfare10] [bit] NULL,
- [Welfare11] [bit] NULL,
- [Welfare12] [bit] NULL,
- [Welfare13] [bit] NULL,
- [Welfare14] [bit] NULL,
- [Welfare15] [bit] NULL,
- [Welfare16] [bit] NULL,
- [Welfare17] [bit] NULL,
- [Welfare18] [bit] NULL,
- RegionDesc NVARCHAR(50),
- CompanyRegionId VARCHAR(6),
- IsVip BIT
- )
- DECLARE @SubSiteUrl VARCHAR(100), @SubSiteName VARCHAR(100)
- SELECT @SubSiteUrl = SubSiteUrl, @SubSiteName = SubSiteName
- FROM dcsubsite WITH(NOLOCK)
- WHERE Id = LEFT(@SiteId, 2)
- IF @SiteId > 99
- INSERT INTO #t
- SELECT a.Id, a.Name JobName, a.Responsibility JobDESC, a.Demand JobDemand,
- a.dcRegionId JobRegion, b.Name CompanyName, a.dcEducationID EduLevel, a.IsDelete,
- a.MinExperience ExperienceLevel, GETDATE() Announcedate, --a.RefreshDate Announcedate,
- a.dcSalaryID, a.dcJobtypeID, ISNULL(b.ShortName, b.Name) ShortName, b.Address, dcCompanySizeID, Brief,
- a.EmployType, a.AddDate, b.dcCompanyKindID, a.IssueEnd EndDate, c.Email, a.SecondId EnJobID, b.SecondId EnCpMainID,
- (SELECT TOP 1 dcIndustryId FROM cpIndustry WITH(NOLOCK) WHERE cpIndustry.cpMainID = b.ID) IndustryId,
- @SubSiteUrl SubSiteUrl, @SubSiteName SubSiteName, a.NeedNumber, a.Welfare1, a.Welfare2, a.Welfare3, a.Welfare4, a.Welfare5, a.Welfare6, a.Welfare7, a.Welfare8, a.Welfare9, a.Welfare10, a.Welfare11, a.Welfare12, a.Welfare13, a.Welfare14, a.Welfare15, a.Welfare16, a.Welfare17, a.Welfare18, '',
- b.dcRegionId, CASE WHEN b.MemberType = 3 THEN 1 ELSE 0 END IsVip
- FROM job a WITH(NOLOCK), cpmain b WITH(NOLOCK), camain c WITH(NOLOCK)
- WHERE c.Id = a.caMainId AND a.cpMainId = b.Id
- AND a.Valid = 1 AND b.Valid = 1
- AND IssueEnd > CONVERT(VARCHAR(10), GETDATE() + 1, 120) AND b.VerifyCount > 0
- AND b.dcProvinceID = LEFT(@SiteId, 2)
- AND a.dcRegionId LIKE LTRIM(STR(@SiteId)) + '%'
- AND LEN(RTRIM(a.Name)) > 1
- AND a.LastModifyDate > DATEADD(MINUTe, -10, GETDATE())
- ORDER BY a.RefreshDate DESC
- ELSE
- BEGIN
- IF EXISTS(SELECT 'x' FROM Job WITH(NOLOCK) WHERE dcRegionId LIKE LTRIM(STR(@SiteId)) + '%' AND Valid = 1 AND LastModifyDate > DATEADD(MINUTe, -10, GETDATE()))
- INSERT INTO #t
- SELECT a.id, a.name jobname, a.responsibility JobDESC, a.Demand JobDemand,
- a.dcregionid jobregion, b.name companyname, a.dcEducationID edulevel, a.IsDelete,
- a.MinExperience experiencelevel, GETDATE() announcedate,
- a.dcSalaryID, a.dcjobtypeID, ISNULL(b.ShortName, b.Name) ShortName, b.Address, dcCompanySizeID, Brief,
- a.EmployType, a.adddate, b.dcCompanyKindID, a.IssueEnd enddate, c.email, a.SecondId EnJobID, b.SecondId EnCpMainID,
- (SELECT TOP 1 dcIndustryId FROM cpindustry WITH(NOLOCK) WHERE cpindustry.cpMainID = b.ID) IndustryId,
- @SubSiteUrl SubSiteUrl, @SubSiteName SubSiteName, a.NeedNumber, a.Welfare1, a.Welfare2, a.Welfare3, a.Welfare4, a.Welfare5, a.Welfare6, a.Welfare7, a.Welfare8, a.Welfare9, a.Welfare10, a.Welfare11, a.Welfare12, a.Welfare13, a.Welfare14, a.Welfare15, a.Welfare16, a.Welfare17, a.Welfare18, '',
- b.dcREgionId, CASE WHEN b.MemberType = 3 THEN 1 ELSE 0 END IsVip
- FROM job a WITH(NOLOCK), cpmain b WITH(NOLOCK), camain c
- WHERE a.camainid=c.id AND a.cpmainid=b.id AND a.valid=1
- AND issueend>CONVERT(VARCHAR(10), GETDATE()+1, 120)
- AND b.valid=1 AND b.VerifyCount > 0
- AND b.dcprovinceid = @SiteId
- AND LEN(RTRIM(a.name)) > 1
- AND a.dcRegionId LIKE LTRIM(STR(@SiteId)) + '%'
- AND a.LastModifyDate > DATEADD(MINUTe, -15, GETDATE())
- ORDER BY a.RefreshDate DESC
- ELSE
- INSERT INTO #t
- SELECT TOP 20 a.id, a.name jobname, a.responsibility JobDESC, a.Demand JobDemand,
- a.dcregionid jobregion, b.name companyname, a.dcEducationID edulevel, a.IsDelete,
- a.MinExperience experiencelevel, GETDATE() announcedate,
- a.dcSalaryID, a.dcjobtypeID, ISNULL(b.ShortName, b.Name) ShortName, b.Address, dcCompanySizeID, Brief,
- a.EmployType, a.adddate, b.dcCompanyKindID, a.IssueEnd enddate, c.email, a.SecondId EnJobID, b.SecondId EnCpMainID,
- (SELECT TOP 1 dcIndustryId FROM cpindustry WITH(NOLOCK) WHERE cpindustry.cpMainID = b.ID) IndustryId,
- @SubSiteUrl SubSiteUrl, @SubSiteName SubSiteName, a.NeedNumber, a.Welfare1, a.Welfare2, a.Welfare3, a.Welfare4, a.Welfare5, a.Welfare6, a.Welfare7, a.Welfare8, a.Welfare9, a.Welfare10, a.Welfare11, a.Welfare12, a.Welfare13, a.Welfare14, a.Welfare15, a.Welfare16, a.Welfare17, a.Welfare18, '',
- b.dcREgionId, CASE WHEN b.MemberType = 3 THEN 1 ELSE 0 END IsVip
- FROM job a WITH(NOLOCK), cpmain b WITH(NOLOCK), camain c
- WHERE a.camainid=c.id AND a.cpmainid=b.id AND a.valid=1
- AND issueend>CONVERT(VARCHAR(10), GETDATE()+1, 120)
- AND b.valid=1 AND b.VerifyCount > 0
- AND b.dcprovinceid = @SiteId
- AND LEN(RTRIM(a.name)) > 1
- AND a.dcRegionId LIKE LTRIM(STR(@SiteId)) + '%'
- --AND a.LastModifyDate > DATEADD(MINUTe, -10, GETDATE())
- ORDER BY a.LastModifyDate DESC
- END
- ALTER TABLE #t ADD RegionName VARCHAR(50)
- ALTER TABLE #t ADD RegionName2 VARCHAR(50)
- UPDATE a SET a.RegionName = b.Description FROM #t a, dcRegion b WHERE LEFT(a.JobRegion, 4) = b.Id
- UPDATE #t SET RegionName2 = LEFT(RegionName, LEN(RegionName) - 1) WHERE LEN(RegionName) > 2
- UPDATE #t SET JobName = RegionName + JobName WHERE CHARINDEX(RegionName2, JobName) = 0
- UPDATE #t SET JobName = JobName + '招聘' WHERE CHARINDEX('聘', JobName) = 0
- DECLARE @t AS TABLE(Id INT, Description NVARCHAR(110))
- INSERT INTO @t SELECT DetailId, REPLACE(Description, '以上', '') FROM dcOthers WHERE Category = '招聘人数' AND Description NOT LIKE '%~%'
- INSERT INTO @t SELECT DetailId, LEFT(Description, CHARINDEX('~', Description) - 1) + '人' FROM dcOthers WHERE Category = '招聘人数' AND Description LIKE '%~%'
- UPDATE a SET NeedNumber = b.Description FROM #t a, @t b WHERE a.NeedNumber = b.Id
- UPDATE #t
- SET JobDesc = REPLACE(JobDesc, '', ''),
- JobDemand = REPLACE(JobDemand, '', ''),
- Brief = REPLACE(Brief, '', '')
- WHERE CHARINDEX('', JobDesc) > 0
- OR CHARINDEX('', JobDemand) > 0
- OR CHARINDEX('', Brief) > 0
- UPDATE a
- SET a.RegionDesc = b.FullName
- FROM #t a, MainDb..dcRegion b
- WHERE a.CompanyRegionId = b.Id
- UPDATE #t SET RegionDesc = '' WHERE CHARINDEX(RegionDesc, Address) > 0
- UPDATE #t
- SET Address = RIGHT(Address, LEN(Address) - 3)
- WHERE CHARINDEX(LEFT(Address, 3), RegionDesc) > 0
- AND LEN(Address) > 3 AND LEN(RegionDesc) > 0
- UPDATE #t
- SET Address = RIGHT(Address, LEN(Address) - 3)
- WHERE CHARINDEX(LEFT(Address, 3), RegionDesc) > 0
- AND LEN(Address) > 3 AND LEN(RegionDesc) > 0
- UPDATE #t
- SET Address = RIGHT(Address, LEN(Address) - 3)
- WHERE CHARINDEX(LEFT(Address, 3), RegionDesc) > 0
- AND LEN(Address) > 3 AND LEN(RegionDesc) > 0
- UPDATE #t SET Address = '' WHERE CHARINDEX(Address, RegionDesc) > 0 AND LEN(RegionDesc) > 0
- UPDATE #t SET Address = RegionDesc + Address WHERE LEN(RegionDesc) > 0
- SELECT id, jobname, JobDESC, JobDemand, jobregion, companyname, edulevel, IsDelete,
- experiencelevel, AnnounceDate, dcSalaryID, dcjobtypeID, ShortName, Address, dcCompanySizeID, Brief,
- EmployType, adddate, dcCompanyKindID, enddate, email, EnJobID, EnCpMainID,
- IndustryId, SubSiteUrl, SubSiteName, NeedNumber, Welfare1, Welfare2, Welfare3, Welfare4, Welfare5,
- Welfare6, Welfare7, Welfare8, Welfare9, Welfare10, Welfare11, Welfare12, Welfare13, Welfare14,
- Welfare15, Welfare16, Welfare17, Welfare18, IsVip
- FROM #t ORDER BY RowNo
- END
- GO
- /****** Object: StoredProcedure [dbo].[ProcBaiduXmlJob51rcOutSave] Script Date: 2018/12/13 19:09:29 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- CREATE PROCEDURE [dbo].[ProcBaiduXmlJob51rcOutSave]
- AS
- SET NOCOUNT ON
- BEGIN
- IF EXISTS(SELECT 'x' FROM ShortDb..BaiduXmlJob51rcOut WHERE crDate > DATEADD(MINUTE, -480, GETDATE()))
- RETURN
- SELECT a.id, a.name jobname, a.responsibility JobDESC, a.Demand JobDemand,
- LEFT(a.dcregionid,4) jobregion, b.name companyname, b.shortName, b.[Address], b.dcCompanySizeID, a.dcEducationID edulevel,
- a.MinExperience experiencelevel, a.IsDelete, a.EmployType, a.adddate,
- a.IssueDate AnnounceDate,
- a.dcSalaryID, a.dcjobtypeID, b.dcCompanyKindID, b.Brief,
- a.IssueEnd enddate, c.email, a.SecondId EnJobID, b.SecondId EnCpMainID,
- (SELECT TOP 1 dcIndustryId FROM cpindustry WITH(NOLOCK) WHERE cpindustry.cpMainID = b.ID) industryid,
- 'www.51rc.com' SubSiteUrl, '伍亿人才网' SubSiteName,
- ISNULL((SELECT PinYin FROM dcRegion WITH(NOLOCK) WHERE dcRegion.id= LEFT(a.dcRegionId, 2)), 'shandong') pinyin,
- SPACE(50) RegionName, SPACE(50) RegionName2, a.Refreshdate
- --ISNULL((SELECT SubSiteUrl FROM dcsubsite WITH(NOLOCK) WHERE dcsubsite.id= LEFT(a.dcregionid, 2)),'www.qlrc.com') SubSiteUrl,
- --ISNULL((SELECT SubSiteName FROM dcsubsite WITH(NOLOCK) WHERE dcsubsite.id= LEFT(a.dcregionid, 2)),'齐鲁人才网') SubSiteName
- INTO #t
- FROM job a WITH(NOLOCK), cpmain b WITH(NOLOCK),camain c
- WHERE a.camainid=c.id AND a.cpmainid=b.id AND a.valid=1
- AND issueend>CONVERT(VARCHAR(10),GETDATE()+1,120) AND b.valid=1 AND b.VerifyCount > 0
- AND LEN(RTRIM(a.name)) > 2
- AND a.Refreshdate > CONVERT(VARCHAR(10), GETDATE() -1, 120)
- AND LEFT(a.dcRegionId, 2) = b.dcProvinceId
- ORDER BY a.RefreshDate DESC
- UPDATE a SET a.RegionName = b.Description FROM #t a, dcRegion b WHERE LEFT(a.JobRegion, 4) = b.Id
- UPDATE #t SET RegionName2 = LEFT(RegionName, LEN(RegionName) - 1) WHERE LEN(RegionName) > 2
- UPDATE #t SET JobName = LEFT(RegionName + JobName, 50) WHERE CHARINDEX(RegionName2, JobName) = 0
- UPDATE #t SET JobName = LEFT(JobName + '招聘', 50) WHERE CHARINDEX('聘', JobName) = 0
- UPDATE #t
- SET Brief = REPLACE(REPLACE(REPLACE(REPLACE(Brief, ' ', ''), '<', ''), '>', ''), '&#', '')
- WHERE Brief LIKE '%&%'
- UPDATE #t SET Brief = REPLACE(Brief, ' ', '') WHERE Brief LIKE '% %'
- TRUNCATE TABLE ShortDb..BaiduXmlJob51rcOut
- INSERT INTO ShortDb..BaiduXmlJob51rcOut
- SELECT *, GETDATE() FROM #t ORDER By RefreshDate DESC
- END
- GO
- /****** Object: StoredProcedure [dbo].[ProcBaiduXmlOutByAllSave] Script Date: 2018/12/13 19:09:29 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- CREATE PROCEDURE [dbo].[ProcBaiduXmlOutByAllSave]
- AS
- BEGIN
- TRUNCATE TABLE ShortDb..BaiduXMLJobTemp
- DECLARE @MinId INT
- SELECT TOP 1 @MinId = Id FROM ShortDb..BaiduXMLJobOut WITH(NOLOCK) ORDER BY Id DESC
- INSERT INTO ShortDb..BaiduXMLJobTemp
- SELECT TOP 10000 b.dcProvinceId, a.id, a.Name JobName, a.responsibility JobDESC, a.Demand JobDemand,
- a.dcregionid Jobregion, b.Name companyName, a.dcEducationID eduLevel,
- a.MinExperience experienceLevel, a.IsDELETE, a.EmployType, a.adddate,
- a.IssueDate AnnounceDate,
- a.dcSalaryID, a.dcJobtypeID, b.dcCompanyKindID, ISNULL(b.ShortName, b.Name) ShortName,
- b.Address, dcCompanySizeID, Brief,
- a.IssueEnd enddate, c.email, a.SecondId EnJobID, b.SecondId EncpMainID,
- (SELECT TOP 1 dcIndustryId FROM cpindustry WITH(NOLOCK) WHERE cpindustry.cpMainID = b.ID) IndustryId,
- d.SubSiteUrl, d.SubSiteName, a.RefreshDate RDate, a.NeedNumber, a.Welfare1,
- a.Welfare2, a.Welfare3, a.Welfare4, a.Welfare5, a.Welfare6, a.Welfare7, a.Welfare8, a.Welfare9,
- a.Welfare10, a.Welfare11, a.Welfare12, a.Welfare13, a.Welfare14, a.Welfare15, a.Welfare16,
- a.Welfare17, a.Welfare18, '', '', '', b.dcRegionId
- FROM Job a WITH(NOLOCK),
- cpMain b WITH(NOLOCK),
- caMain c WITH(NOLOCK),
- dcSubSite d WITH(NOLOCK)
- WHERE b.dcProvinceId = d.Id
- AND a.caMainid = c.id
- AND a.cpMainid = b.id
- AND LEN(RTRIM(a.Name)) > 1
- AND b.IsDELETE = 0
- AND a.IsDELETE = 0
- AND b.IsLimitLogin < 9
- --AND a.Id > ISNULL(@MinId, 0)
- AND LEFT(a.dcRegionId, 2) = b.dcProvinceId
- AND a.Id NOT IN(SELECT ID FROM ShortDb..BaiduXMLJobOut WITH(NOLOCK))
- AND a.Valid = 1
- AND b.Valid = 1
- ORDER BY a.RefreshDate
- UPDATE ShortDb..BaiduXMLJobTemp
- SET Brief = REPLACE(REPLACE(REPLACE(REPLACE(Brief, ' ', ''), '<', ''), '>', ''), '&#', '')
- WHERE Brief LIKE '%&%'
- UPDATE ShortDb..BaiduXMLJobTemp SET Brief = REPLACE(Brief, ' ', '') WHERE Brief LIKE '% %'
- UPDATE ShortDb..BaiduXMLJobTemp
- SET JobDesc = REPLACE(JobDesc, '', ''),
- JobDemand = REPLACE(JobDemand, '', ''),
- Brief = REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(Brief, ' ', ''), ' ', ''), '<', ''), '>', ''), '&#', ''), '', '')
- WHERE CHARINDEX('', JobDesc) > 0
- OR CHARINDEX('', JobDemand) > 0
- OR CHARINDEX('', Brief) > 0
- UPDATE a
- SET a.RegionDesc = b.FullName
- FROM ShortDb..BaiduXMLJobTemp a, MainDb..dcRegion b
- WHERE a.CompanyRegionId = b.Id
- UPDATE ShortDb..BaiduXMLJobTemp SET RegionDesc = '' WHERE CHARINDEX(RegionDesc, Address) > 0
- UPDATE ShortDb..BaiduXMLJobTemp
- SET Address = RIGHT(Address, LEN(Address) - 3)
- WHERE CHARINDEX(LEFT(Address, 3), RegionDesc) > 0
- AND LEN(Address) > 3 AND LEN(RegionDesc) > 0
- UPDATE ShortDb..BaiduXMLJobTemp
- SET Address = RIGHT(Address, LEN(Address) - 3)
- WHERE CHARINDEX(LEFT(Address, 3), RegionDesc) > 0
- AND LEN(Address) > 3 AND LEN(RegionDesc) > 0
- UPDATE ShortDb..BaiduXMLJobTemp
- SET Address = RIGHT(Address, LEN(Address) - 3)
- WHERE CHARINDEX(LEFT(Address, 3), RegionDesc) > 0
- AND LEN(Address) > 3 AND LEN(RegionDesc) > 0
- UPDATE ShortDb..BaiduXMLJobTemp SET Address = '' WHERE CHARINDEX(Address, RegionDesc) > 0 AND LEN(RegionDesc) > 0
- UPDATE ShortDb..BaiduXMLJobTemp SET Address = RegionDesc + Address WHERE LEN(RegionDesc) > 0
- UPDATE a SET a.RegionName = b.Description FROM ShortDb..BaiduXMLJobTemp a, dcRegion b WHERE LEFT(a.JobRegion, 4) = b.Id
- UPDATE ShortDb..BaiduXMLJobTemp SET RegionName2 = LEFT(RegionName, LEN(RegionName) - 1) WHERE LEN(RegionName) > 2
- UPDATE ShortDb..BaiduXMLJobTemp SET JobName = LEFT(RegionName + JobName, 50) WHERE CHARINDEX(RegionName2, JobName) = 0
- UPDATE ShortDb..BaiduXMLJobTemp SET JobName = LEFT(JobName + '招聘', 50) WHERE CHARINDEX('聘', JobName) = 0
- DECLARE @t AS TABLE(Id INT, Description NVARCHAR(110))
- INSERT INTO @t SELECT DetailId, REPLACE(Description, '以上', '') FROM dcOthers WHERE Category = '招聘人数' AND Description NOT LIKE '%~%'
- INSERT INTO @t SELECT DetailId, LEFT(Description, CHARINDEX('~', Description) - 1) + '人' FROM dcOthers WHERE Category = '招聘人数' AND Description LIKE '%~%'
- UPDATE a SET NeedNumber = b.Description FROM ShortDb..BaiduXMLJobTemp a, @t b WHERE a.NeedNumber = b.Id
- --TRUNCATE TABLE ShortDb..BaiduXMLJobOut
- DECLARE @Mr INT
- SELECT @Mr = MAX(RowNo) FROM ShortDb..BaiduXMLJobOut
- INSERT INTO ShortDb..BaiduXMLJobOut(SiteId, id, JobName, JobDESC, JobDemand, Jobregion, companyName, eduLevel, IsDELETE,
- experienceLevel, AnnounceDate, dcSalaryID, dcJobtypeID, ShortName, Address, dcCompanySizeID, Brief,
- EmployType, adddate, dcCompanyKindID, enddate, email, EnJobID, EncpMainID,
- IndustryId, SubSiteUrl, SubSiteName, NeedNumber, Welfare1, Welfare2, Welfare3, Welfare4, Welfare5,
- Welfare6, Welfare7, Welfare8, Welfare9, Welfare10, Welfare11, Welfare12, Welfare13, Welfare14,
- Welfare15, Welfare16, Welfare17, Welfare18, crDate, RowNo)
- SELECT SiteId, id, JobName, JobDESC, JobDemand, Jobregion, companyName, eduLevel, IsDELETE,
- experienceLevel, AnnounceDate, dcSalaryID, dcJobtypeID, ShortName, Address, dcCompanySizeID, Brief,
- EmployType, adddate, dcCompanyKindID, enddate, email, EnJobID, EncpMainID,
- IndustryId, SubSiteUrl, SubSiteName, NeedNumber, Welfare1, Welfare2, Welfare3, Welfare4, Welfare5,
- Welfare6, Welfare7, Welfare8, Welfare9, Welfare10, Welfare11, Welfare12, Welfare13, Welfare14,
- Welfare15, Welfare16, Welfare17, Welfare18, GETDATE(), @Mr + RowNo
- FROM ShortDb..BaiduXMLJobTemp
- ORDER BY RDate DESC, id DESC
- DELETE FROM ShortDb..BaiduXMLJobOut WHERE Id IN(SELECT ID FROM Job WITH(NOLOCK) WHERE Id IN(SELECT SubId FROM bsCvModify WHERE AddDate < GETDATE() - 15) AND Valid = 0)
- SELECT id INTO #t FROM ShortDb..BaiduXMLJobOut
- DELETE #t WHERE id in(SELECT id FROM maindb..Job WHERE IsDelete = 0)
- DELETE ShortDb..BaiduXMLJobOut WHERE id IN(SELECT id FROM #t)
- SELECT id INTO #c FROM MainDb..cpMain WHERE (IsDelete = 1 OR islimitlogin = 9 OR Valid = 0)
- SELECT id INTO #j FROM MainDb..Job WHERE cpMainid IN(SELECT id FROM #c)
- DELETE ShortDb..BaiduXMLJobOut WHERE id IN(SELECT id FROM #j)
- -----------==============================
- DELETE FROM ShortDb..BaiduXMLJobOut WHERE Id IN(SELECT Id FROM Job WHERE Issueend < GETDATE() AND cpMainId IN(SELECT cpMainId FROM noshowoldjob))
- SELECT a.id INTO #vj FROM JobPublish a, cpMainPubLish b WHERE a.cpMainId = b.Id AND a.Valid = 1 AND b.Valid = 1
- UPDATE Shortdb..BaiduXMLJobOut
- SET RowNo = Id + 80000000
- WHERE RowNo < 80000000
- AND Id IN(SELECT id FROM #vj)
- CREATE TABLE #JobOrder(id INT, RowNo INT IDENTITY(1, 1))
- INSERT INTO #JobOrder
- SELECT Id FROM Shortdb..BaiduXMLJobOut
- WHERE RowNo > 80000000
- AND Id NOT IN(SELECT id FROM #vj)
- DECLARE @MaxRowNo INT
- SELECT TOP 1 @MaxRowNo = RowNo FROM Shortdb..BaiduXMLJobOut WHERE RowNo < 80000000 ORDER BY ROwNo DESC
- IF @MaxRowNo < 70000000
- BEGIN
- UPDATE a
- SET a.RowNo = @MaxRowNo + b.RowNo
- FROM Shortdb..BaiduXMLJobOut a, #JobOrder b
- WHERE a.Id = b.Id
- END
- ELSE
- BEGIN
- UPDATE a
- SET a.RowNo = @MaxRowNo + b.RowNo
- FROM Shortdb..BaiduXMLJobOut a, #JobOrder b
- WHERE a.Id = b.Id
- TRUNCATE TABLE #JobOrder
- INSERT INTO #JobOrder
- SELECT a.id
- FROM Shortdb..BaiduXMLJobOut a, Job b
- WHERE a.RowNo < 80000000
- AND a.Id = b.Id
- ORDER BY IssueEnd, Id Desc
- --INSERT INTO #JobOrder
- --SELECT Id FROM Shortdb..BaiduXMLJobOut WHERE RowNo < 80000000 ORDER BY ROwNo DESC
- UPDATE a
- SET a.RowNo = b.RowNo
- FROM Shortdb..BaiduXMLJobOut a, #JobOrder b
- WHERE a.Id = b.Id
- END
- /*
- CREATE TABLE #tb(JobId INT, RowNo INT IDENTITY(1, 1))
- CREATE TABLE #tb1(JobId INT, RowNo INT IDENTITY(1, 1))
- INSERT INTO #tb1
- SELECT a.Id
- FROM MainDB..Job a, MainDb..cpMain b, Shortdb..BaiduXMLJobOut c
- WHERE a.Id = c.Id
- AND a.CpMainId = b.Id
- AND a.Valid = 1
- AND b.Valid = 1
- ORDER BY a.IssueDate, a.Id
- INSERT INTO #tb
- SELECT a.Id
- FROM MainDB..Job a, MainDb..cpMain b, Shortdb..BaiduXMLJobOut c
- WHERE a.Id = c.Id
- AND a.CpMainId = b.Id
- AND a.Id NOT IN(SELECT JobId FROM #tb1)
- ORDER BY a.IssueDate, a.Id
- INSERT INTO #tb SELECT JobID FROM #tb1 ORDER BY RowNo
- UPDATE a SET a.RowNo = b.RowNo FROM Shortdb..BaiduXMLJobOut a, #tb b WHERE a.Id = b.JobId
- */
- END
- GO
- /****** Object: StoredProcedure [dbo].[ProcBaiduXmlOutByNewstSave] Script Date: 2018/12/13 19:09:30 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- CREATE PROCEDURE [dbo].[ProcBaiduXmlOutByNewstSave]
- AS
- SET NOCOUNT ON
- IF (DATEPART(HOUR, GETDATE()) - 7) % 4 > 0
- RETURN
- BEGIN
- SELECT TOP 0 * INTO #t FROM ShortDb..BaiduXMLJobTemp
- INSERT INTO #t
- SELECT b.dcProvinceId, a.id, a.Name JobName, a.responsibility JobDESC, a.Demand JobDemand,
- a.dcregionid Jobregion, b.Name companyName, a.dcEducationID eduLevel,
- a.MinExperience experienceLevel, a.IsDelete, a.EmployType, a.adddate,
- a.IssueDate AnnounceDate,
- a.dcSalaryID, a.dcJobtypeID, b.dcCompanyKindID, ISNULL(b.ShortName, b.Name) ShortName,
- b.Address, dcCompanySizeID, Brief,
- a.IssueEnd enddate, c.email, a.SecondId EnJobID, b.SecondId EncpMainID,
- (SELECT TOP 1 dcIndustryId FROM cpindustry WITH(NOLOCK) WHERE cpindustry.cpMainID = b.ID) IndustryId,
- d.SubSiteUrl, d.SubSiteName, a.RefreshDate RDate, a.NeedNumber, a.Welfare1,
- a.Welfare2, a.Welfare3, a.Welfare4, a.Welfare5, a.Welfare6, a.Welfare7, a.Welfare8, a.Welfare9,
- a.Welfare10, a.Welfare11, a.Welfare12, a.Welfare13, a.Welfare14, a.Welfare15, a.Welfare16,
- a.Welfare17, a.Welfare18, '', '', '', b.dcRegionId
- FROM Job a WITH(NOLOCK),
- cpMain b WITH(NOLOCK),
- caMain c WITH(NOLOCK),
- dcSubSite d WITH(NOLOCK)
- WHERE b.dcProvinceId = d.Id
- AND a.caMainid = c.id
- AND a.cpMainid = b.id
- AND LEN(RTRIM(a.Name)) > 1
- AND b.IsDelete = 0
- AND a.IsDelete = 0
- AND b.IsLimitLogin < 9
- AND LEFT(a.dcRegionId, 2) = b.dcProvinceId
- AND (a.LastModifyDate > CONVERT(VARCHAR(10), GETDATE() - 1, 120)
- OR a.IssueEnd BETWEEN CONVERT(VARCHAR(10), GETDATE() - 1, 120) AND GETDATE() + 0.2
- OR a.IssueDate > CONVERT(VARCHAR(10), GETDATE() - 1, 120))
- ORDER BY a.Refreshdate
- UPDATE #t
- SET Brief = REPLACE(REPLACE(REPLACE(REPLACE(Brief, ' ', ''), '<', ''), '>', ''), '&#', '')
- WHERE Brief LIKE '%&%'
- UPDATE #t SET Brief = REPLACE(Brief, ' ', '') WHERE Brief LIKE '% %'
- UPDATE #t
- SET JobDesc = REPLACE(JobDesc, '', ''),
- JobDemand = REPLACE(JobDemand, '', ''),
- Brief = REPLACE(Brief, '', '')
- WHERE CHARINDEX('', JobDesc) > 0
- OR CHARINDEX('', JobDemand) > 0
- OR CHARINDEX('', Brief) > 0
- UPDATE a
- SET a.RegionDesc = b.FullName
- FROM #t a, MainDb..dcRegion b
- WHERE a.CompanyRegionId = b.Id
- UPDATE #t SET RegionDesc = '' WHERE CHARINDEX(RegionDesc, Address) > 0
- UPDATE #t
- SET Address = RIGHT(Address, LEN(Address) - 3)
- WHERE CHARINDEX(LEFT(Address, 3), RegionDesc) > 0
- AND LEN(Address) > 3 AND LEN(RegionDesc) > 0
- UPDATE #t
- SET Address = RIGHT(Address, LEN(Address) - 3)
- WHERE CHARINDEX(LEFT(Address, 3), RegionDesc) > 0
- AND LEN(Address) > 3 AND LEN(RegionDesc) > 0
- UPDATE #t
- SET Address = RIGHT(Address, LEN(Address) - 3)
- WHERE CHARINDEX(LEFT(Address, 3), RegionDesc) > 0
- AND LEN(Address) > 3 AND LEN(RegionDesc) > 0
- UPDATE #t SET Address = '' WHERE CHARINDEX(Address, RegionDesc) > 0 AND LEN(RegionDesc) > 0
- UPDATE #t SET Address = RegionDesc + Address WHERE LEN(RegionDesc) > 0
- UPDATE a SET a.RegionName = b.Description FROM #t a, dcRegion b WHERE LEFT(a.JobRegion, 4) = b.Id
- UPDATE #t SET RegionName2 = LEFT(RegionName, LEN(RegionName) - 1) WHERE LEN(RegionName) > 2
- UPDATE #t SET JobName = LEFT(RegionName + JobName, 50) WHERE CHARINDEX(RegionName2, JobName) = 0
- UPDATE #t SET JobName = LEFT(JobName + '招聘', 50) WHERE CHARINDEX('聘', JobName) = 0
- DECLARE @t AS TABLE(Id INT, Description NVARCHAR(110))
- INSERT INTO @t SELECT DetailId, REPLACE(Description, '以上', '') FROM dcOthers WHERE Category = '招聘人数' AND Description NOT LIKE '%~%'
- INSERT INTO @t SELECT DetailId, LEFT(Description, CHARINDEX('~', Description) - 1) + '人' FROM dcOthers WHERE Category = '招聘人数' AND Description LIKE '%~%'
- UPDATE a SET NeedNumber = b.Description FROM #t a, @t b WHERE a.NeedNumber = b.Id
- UPDATE #t SET EndDate = DATEADD(MONTH, DATEDIFF(MONTH, EndDate, GETDATE()) + 3, EndDate) WHERE EndDate < CONVERT(VARCHAR(10), GETDATE() + 2, 120)
- UPDATE #t SET EndDate = DATEADD(MONTH, 3, EndDate) WHERE EndDate < CONVERT(VARCHAR(10), GETDATE() + 2, 120)
- UPDATE #t SET EndDate = DATEADD(MONTH, 3, EndDate) WHERE EndDate < CONVERT(VARCHAR(10), GETDATE() + 2, 120)
- UPDATE #t SET AnnounceDate = DATEADD(MONTH, -3, AnnounceDate) WHERE AnnounceDate > GETDATE()
- UPDATE #t SET AnnounceDate = DATEADD(MONTH, -3, AnnounceDate) WHERE AnnounceDate > GETDATE()
- UPDATE #t SET AnnounceDate = DATEADD(MONTH, -3, AnnounceDate) WHERE AnnounceDate > GETDATE()
- DELETE FROM ShortDb..BaiduXMLJobOut WHERE Id IN(SELECT ID FROM #t WITH(NOLOCK))
- DECLARE @Mr INT
- SELECT @Mr = MAX(RowNo) FROM ShortDb..BaiduXMLJobOut
- INSERT INTO ShortDb..BaiduXMLJobOut(SiteId, id, JobName, JobDESC, JobDemand, Jobregion, companyName, eduLevel, IsDelete,
- experienceLevel, AnnounceDate, dcSalaryID, dcJobtypeID, ShortName, Address, dcCompanySizeID, Brief,
- EmployType, adddate, dcCompanyKindID, enddate, email, EnJobID, EncpMainID,
- IndustryId, SubSiteUrl, SubSiteName, NeedNumber, Welfare1, Welfare2, Welfare3, Welfare4, Welfare5,
- Welfare6, Welfare7, Welfare8, Welfare9, Welfare10, Welfare11, Welfare12, Welfare13, Welfare14,
- Welfare15, Welfare16, Welfare17, Welfare18, crDate, RowNo)
- SELECT SiteId, id, JobName, JobDESC, JobDemand, Jobregion, companyName, eduLevel, IsDelete,
- experienceLevel, AnnounceDate, dcSalaryID, dcJobtypeID, ShortName, Address, dcCompanySizeID, Brief,
- EmployType, adddate, dcCompanyKindID, enddate, email, EnJobID, EncpMainID,
- IndustryId, SubSiteUrl, SubSiteName, NeedNumber, Welfare1, Welfare2, Welfare3, Welfare4, Welfare5,
- Welfare6, Welfare7, Welfare8, Welfare9, Welfare10, Welfare11, Welfare12, Welfare13, Welfare14,
- Welfare15, Welfare16, Welfare17, Welfare18, GETDATE(), @Mr + RowNo
- FROM #t
- ORDER BY RowNo
- END
- GO
- /****** Object: StoredProcedure [dbo].[ProcBaiduXmlOutByQlrcSave] Script Date: 2018/12/13 19:09:31 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- CREATE PROCEDURE [dbo].[ProcBaiduXmlOutByQlrcSave]
- AS
- SET NOCOUNT ON
- IF (DATEPART(HOUR, GETDATE()) - 7) % 4 > 0
- RETURN
- BEGIN
- DECLARE @SiteId INT
- SET @SiteId = 32
- SELECT TOP 0 * INTO #t FROM ShortDb..BaiduXMLJobTemp
- DECLARE @SubSiteUrl VARCHAR(100), @SubSiteName VARCHAR(100)
- SELECT @SubSiteUrl = SubSiteUrl, @SubSiteName = SubSiteName
- FROM dcsubsite WITH(NOLOCK)
- WHERE Id = @SiteId
- INSERT INTO #t
- SELECT @SiteId, a.id, a.name jobname, a.responsibility JobDESC, a.Demand JobDemand,
- a.dcregionid jobregion, b.name companyname, a.dcEducationID edulevel,
- a.MinExperience experiencelevel, a.IsDelete, a.EmployType, a.adddate,
- a.IssueDate AnnounceDate,
- a.dcSalaryID, a.dcjobtypeID, b.dcCompanyKindID, ISNULL(b.ShortName, b.Name) ShortName, b.Address, dcCompanySizeID, Brief,
- a.IssueEnd enddate, c.email, a.SecondId EnJobID, b.SecondId EnCpMainID,
- (SELECT TOP 1 dcIndustryId FROM cpindustry WITH(NOLOCK) WHERE cpindustry.cpMainID = b.ID) IndustryId,
- @SubSiteUrl SubSiteUrl, @SubSiteName SubSiteName, a.RefreshDate RDate, a.NeedNumber, a.Welfare1,
- a.Welfare2, a.Welfare3, a.Welfare4, a.Welfare5, a.Welfare6, a.Welfare7, a.Welfare8, a.Welfare9,
- a.Welfare10, a.Welfare11, a.Welfare12, a.Welfare13, a.Welfare14, a.Welfare15, a.Welfare16,
- a.Welfare17, a.Welfare18, '', '', '', b.dcRegionId
- FROM job a WITH(NOLOCK), cpmain b WITH(NOLOCK), camain c
- WHERE a.camainid = c.id AND a.cpmainid = b.id AND a.valid = 1
- AND issueend>CONVERT(VARCHAR(10), GETDATE() + 1, 120)
- AND b.valid = 1 AND b.VerifyCount > 0
- AND b.dcprovinceid = 32
- AND LEN(RTRIM(a.name)) > 1
- AND LEFT(a.dcRegionId, 2) = b.dcProvinceId
- ORDER BY a.Refreshdate DESC
-
- UPDATE #t
- SET Brief = REPLACE(REPLACE(REPLACE(REPLACE(Brief, ' ', ''), '<', ''), '>', ''), '&#', '')
- WHERE Brief LIKE '%&%'
- UPDATE #t SET Brief = REPLACE(Brief, ' ', '') WHERE Brief LIKE '% %'
- UPDATE #t
- SET JobDesc = REPLACE(JobDesc, '', ''),
- JobDemand = REPLACE(JobDemand, '', ''),
- Brief = REPLACE(Brief, '', '')
- WHERE CHARINDEX('', JobDesc) > 0
- OR CHARINDEX('', JobDemand) > 0
- OR CHARINDEX('', Brief) > 0
- UPDATE a
- SET a.RegionDesc = b.FullName
- FROM #t a, MainDb..dcRegion b
- WHERE a.CompanyRegionId = b.Id
- UPDATE #t SET RegionDesc = '' WHERE CHARINDEX(RegionDesc, Address) > 0
- UPDATE #t
- SET Address = RIGHT(Address, LEN(Address) - 3)
- WHERE CHARINDEX(LEFT(Address, 3), RegionDesc) > 0
- AND LEN(Address) > 3 AND LEN(RegionDesc) > 0
- UPDATE #t
- SET Address = RIGHT(Address, LEN(Address) - 3)
- WHERE CHARINDEX(LEFT(Address, 3), RegionDesc) > 0
- AND LEN(Address) > 3 AND LEN(RegionDesc) > 0
- UPDATE #t
- SET Address = RIGHT(Address, LEN(Address) - 3)
- WHERE CHARINDEX(LEFT(Address, 3), RegionDesc) > 0
- AND LEN(Address) > 3 AND LEN(RegionDesc) > 0
- UPDATE #t SET Address = '' WHERE CHARINDEX(Address, RegionDesc) > 0 AND LEN(RegionDesc) > 0
- UPDATE #t SET Address = RegionDesc + Address WHERE LEN(RegionDesc) > 0
- UPDATE a SET a.RegionName = b.Description FROM #t a, dcRegion b WHERE LEFT(a.JobRegion, 4) = b.Id
- UPDATE #t SET RegionName2 = LEFT(RegionName, LEN(RegionName) - 1) WHERE LEN(RegionName) > 2
- UPDATE #t SET JobName = LEFT(RegionName + JobName, 50) WHERE CHARINDEX(RegionName2, JobName) = 0
- UPDATE #t SET JobName = LEFT(JobName + '招聘', 50) WHERE CHARINDEX('聘', JobName) = 0
- DECLARE @t AS TABLE(Id INT, Description NVARCHAR(110))
- INSERT INTO @t SELECT DetailId, REPLACE(Description, '以上', '') FROM dcOthers WHERE Category = '招聘人数' AND Description NOT LIKE '%~%'
- INSERT INTO @t SELECT DetailId, LEFT(Description, CHARINDEX('~', Description) - 1) + '人' FROM dcOthers WHERE Category = '招聘人数' AND Description LIKE '%~%'
- UPDATE a SET NeedNumber = b.Description FROM #t a, @t b WHERE a.NeedNumber = b.Id
-
- TRUNCATE TABLE ShortDb..BaiduXMLJobQlrcOut
- INSERT INTO ShortDb..BaiduXMLJobQlrcOut(SiteId, id, jobname, JobDESC, JobDemand, jobregion, companyname, edulevel, IsDelete,
- experiencelevel, AnnounceDate, dcSalaryID, dcjobtypeID, ShortName, Address, dcCompanySizeID, Brief,
- EmployType, adddate, dcCompanyKindID, enddate, email, EnJobID, EnCpMainID,
- IndustryId, SubSiteUrl, SubSiteName, NeedNumber, Welfare1, Welfare2, Welfare3, Welfare4, Welfare5,
- Welfare6, Welfare7, Welfare8, Welfare9, Welfare10, Welfare11, Welfare12, Welfare13, Welfare14,
- Welfare15, Welfare16, Welfare17, Welfare18, crDate)
- SELECT @SiteId, id, jobname, JobDESC, JobDemand, jobregion, companyname, edulevel, IsDelete,
- experiencelevel, AnnounceDate, dcSalaryID, dcjobtypeID, ShortName, Address, dcCompanySizeID, Brief,
- EmployType, adddate, dcCompanyKindID, enddate, email, EnJobID, EnCpMainID,
- IndustryId, SubSiteUrl, SubSiteName, NeedNumber, Welfare1, Welfare2, Welfare3, Welfare4, Welfare5,
- Welfare6, Welfare7, Welfare8, Welfare9, Welfare10, Welfare11, Welfare12, Welfare13, Welfare14,
- Welfare15, Welfare16, Welfare17, Welfare18, GETDATE()
- FROM #t
- ORDER BY RDate DESC, Id DESC
- END
- GO
- /****** Object: StoredProcedure [dbo].[ProcBaiduXmlOutSave1026] Script Date: 2018/12/13 19:09:31 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- CREATE PROCEDURE [dbo].[ProcBaiduXmlOutSave1026]
- (
- @SiteId INT
- )
- AS
- RETURN
- SET NOCOUNT ON
- BEGIN
- DECLARE @crDate DATETIME
- CREATE TABLE #t
- (
- RowNo INT IDENTITY(1, 1),
- [Id] [int] NOT NULL,
- [JobName] [nvarchar](80) NOT NULL,
- [JobDESC] [varchar](max) NOT NULL,
- [JobDemand] [varchar](max) NOT NULL,
- [JobRegion] [varchar](6) NULL,
- [CompanyName] [varchar](100) NOT NULL,
- [EduLevel] [tinyint] NOT NULL,
- [IsDelete] [bit] NOT NULL,
- [ExperienceLevel] [tinyint] NOT NULL,
- [Announcedate] [datetime] NOT NULL,
- [dcSalaryID] [tinyint] NOT NULL,
- [dcJobtypeID] [smallint] NOT NULL,
- [ShortName] [varchar](40) NULL,
- [Address] [nvarchar](100) NULL,
- [dcCompanySizeID] [tinyint] NULL,
- [Brief] [varchar](6000) NULL,
- [EmployType] [tinyint] NOT NULL,
- [AddDate] [smalldatetime] NOT NULL,
- [dcCompanyKindID] [smallint] NULL,
- [EndDate] [smalldatetime] NULL,
- [Email] [varchar](50) NOT NULL,
- [EnJobID] [varchar](12) NULL,
- [EnCpMainID] [varchar](10) NULL,
- [IndustryId] [smallint] NULL,
- [SubSiteUrl] [varchar](50) NOT NULL,
- [SubSiteName] [varchar](50) NOT NULL,
- NeedNumber VARCHAR(10),
- [Welfare1] [bit] NULL,
- [Welfare2] [bit] NULL,
- [Welfare3] [bit] NULL,
- [Welfare4] [bit] NULL,
- [Welfare5] [bit] NULL,
- [Welfare6] [bit] NULL,
- [Welfare7] [bit] NULL,
- [Welfare8] [bit] NULL,
- [Welfare9] [bit] NULL,
- [Welfare10] [bit] NULL,
- [Welfare11] [bit] NULL,
- [Welfare12] [bit] NULL,
- [Welfare13] [bit] NULL,
- [Welfare14] [bit] NULL,
- [Welfare15] [bit] NULL,
- [Welfare16] [bit] NULL,
- [Welfare17] [bit] NULL,
- [Welfare18] [bit] NULL,
- RegionDesc NVARCHAR(50)
- )
- DECLARE @SubSiteUrl VARCHAR(100), @SubSiteName VARCHAR(100)
- SELECT @SubSiteUrl = SubSiteUrl, @SubSiteName = SubSiteName
- FROM dcsubsite WITH(NOLOCK)
- WHERE Id = @SiteId
- TRUNCATE TABLE ShortDb..BaiduXMLJobTemp
- IF @SiteId = 32
- INSERT INTO ShortDb..BaiduXMLJobTemp
- SELECT @SiteId, a.id, a.name jobname, a.responsibility JobDESC, a.Demand JobDemand,
- a.dcregionid jobregion, b.name companyname, a.dcEducationID edulevel,
- a.MinExperience experiencelevel, a.IsDelete, a.EmployType, a.adddate,
- a.IssueDate AnnounceDate,
- a.dcSalaryID, a.dcjobtypeID, b.dcCompanyKindID, ISNULL(b.ShortName, b.Name) ShortName, b.Address, dcCompanySizeID, Brief,
- a.IssueEnd enddate, c.email, a.SecondId EnJobID, b.SecondId EnCpMainID,
- (SELECT TOP 1 dcIndustryId FROM cpindustry WITH(NOLOCK) WHERE cpindustry.cpMainID = b.ID) IndustryId,
- @SubSiteUrl SubSiteUrl, @SubSiteName SubSiteName, a.RefreshDate RDate, a.NeedNumber, a.Welfare1,
- a.Welfare2, a.Welfare3, a.Welfare4, a.Welfare5, a.Welfare6, a.Welfare7, a.Welfare8, a.Welfare9,
- a.Welfare10, a.Welfare11, a.Welfare12, a.Welfare13, a.Welfare14, a.Welfare15, a.Welfare16,
- a.Welfare17, a.Welfare18, '', '', ''
- FROM job a WITH(NOLOCK), cpmain b WITH(NOLOCK), camain c
- WHERE a.camainid = c.id AND a.cpmainid = b.id AND a.valid = 1
- AND issueend>CONVERT(VARCHAR(10), GETDATE()+1, 120)
- AND b.valid = 1 AND b.VerifyCount > 0
- AND b.dcprovinceid = @SiteId
- AND LEN(RTRIM(a.name)) > 1
- AND a.dcRegionId LIKE LTRIM(STR(@SiteId)) + '%'
- --AND a.Refreshdate>CONVERT(VARCHAR(10), GETDATE() - 1, 120)
- ORDER BY a.Refreshdate DESC
- ELSE
- INSERT INTO ShortDb..BaiduXMLJobTemp
- SELECT @SiteId, a.id, a.name jobname, a.responsibility JobDESC, a.Demand JobDemand,
- a.dcregionid jobregion, b.name companyname, a.dcEducationID edulevel,
- a.MinExperience experiencelevel, a.IsDelete, a.EmployType, a.adddate,
- a.IssueDate AnnounceDate,
- a.dcSalaryID, a.dcjobtypeID, b.dcCompanyKindID, ISNULL(b.ShortName, b.Name) ShortName, b.Address, dcCompanySizeID, Brief,
- a.IssueEnd enddate, c.email, a.SecondId EnJobID, b.SecondId EnCpMainID,
- (SELECT TOP 1 dcIndustryId FROM cpindustry WITH(NOLOCK) WHERE cpindustry.cpMainID = b.ID) IndustryId,
- @SubSiteUrl SubSiteUrl, @SubSiteName SubSiteName, a.RefreshDate RDate, a.NeedNumber, a.Welfare1,
- a.Welfare2, a.Welfare3, a.Welfare4, a.Welfare5, a.Welfare6, a.Welfare7, a.Welfare8, a.Welfare9,
- a.Welfare10, a.Welfare11, a.Welfare12, a.Welfare13, a.Welfare14, a.Welfare15, a.Welfare16,
- a.Welfare17, a.Welfare18, '', '', ''
- FROM job a WITH(NOLOCK), cpmain b WITH(NOLOCK), camain c
- WHERE a.camainid = c.id
- AND a.cpmainid = b.id
- AND b.dcprovinceid = @SiteId
- AND LEN(RTRIM(a.name)) > 1
- AND a.dcRegionId LIKE LTRIM(STR(@SiteId)) + '%'
- --AND a.Refreshdate>CONVERT(VARCHAR(10), GETDATE() - 1, 120)
- ORDER BY a.Refreshdate DESC
- UPDATE ShortDb..BaiduXMLJobTemp
- SET Brief = REPLACE(REPLACE(REPLACE(REPLACE(Brief, ' ', ''), '<', ''), '>', ''), '&#', '')
- WHERE Brief LIKE '%&%'
- UPDATE ShortDb..BaiduXMLJobTemp SET Brief = REPLACE(Brief, ' ', '') WHERE Brief LIKE '% %'
- UPDATE ShortDb..BaiduXMLJobTemp
- SET JobDesc = REPLACE(JobDesc, '', ''),
- JobDemand = REPLACE(JobDemand, '', ''),
- Brief = REPLACE(Brief, '', '')
- WHERE CHARINDEX('', JobDesc) > 0
- OR CHARINDEX('', JobDemand) > 0
- OR CHARINDEX('', Brief) > 0
- UPDATE a
- SET a.RegionDesc = b.FullName
- FROM ShortDb..BaiduXMLJobTemp a, MainDb..dcRegion b
- WHERE a.JobREgion = b.Id
- UPDATE ShortDb..BaiduXMLJobTemp SET RegionDesc = '' WHERE CHARINDEX(RegionDesc, Address) > 0
- UPDATE ShortDb..BaiduXMLJobTemp
- SET Address = RIGHT(Address, LEN(Address) - 3)
- WHERE CHARINDEX(LEFT(Address, 3), RegionDesc) > 0
- AND LEN(Address) > 3 AND LEN(RegionDesc) > 0
- UPDATE ShortDb..BaiduXMLJobTemp
- SET Address = RIGHT(Address, LEN(Address) - 3)
- WHERE CHARINDEX(LEFT(Address, 3), RegionDesc) > 0
- AND LEN(Address) > 3 AND LEN(RegionDesc) > 0
- UPDATE ShortDb..BaiduXMLJobTemp
- SET Address = RIGHT(Address, LEN(Address) - 3)
- WHERE CHARINDEX(LEFT(Address, 3), RegionDesc) > 0
- AND LEN(Address) > 3 AND LEN(RegionDesc) > 0
- UPDATE ShortDb..BaiduXMLJobTemp SET Address = '' WHERE CHARINDEX(Address, RegionDesc) > 0 AND LEN(RegionDesc) > 0
- UPDATE ShortDb..BaiduXMLJobTemp SET Address = RegionDesc + Address WHERE LEN(RegionDesc) > 0
- UPDATE a SET a.RegionName = b.Description FROM ShortDb..BaiduXMLJobTemp a, dcRegion b WHERE LEFT(a.JobRegion, 4) = b.Id
- UPDATE ShortDb..BaiduXMLJobTemp SET RegionName2 = LEFT(RegionName, LEN(RegionName) - 1) WHERE LEN(RegionName) > 2
- UPDATE ShortDb..BaiduXMLJobTemp SET JobName = LEFT(RegionName + JobName, 50) WHERE CHARINDEX(RegionName2, JobName) = 0
- UPDATE ShortDb..BaiduXMLJobTemp SET JobName = LEFT(JobName + '招聘', 50) WHERE CHARINDEX('聘', JobName) = 0
- DECLARE @t AS TABLE(Id INT, Description NVARCHAR(110))
- INSERT INTO @t SELECT DetailId, REPLACE(Description, '以上', '') FROM dcOthers WHERE Category = '招聘人数' AND Description NOT LIKE '%~%'
- INSERT INTO @t SELECT DetailId, LEFT(Description, CHARINDEX('~', Description) - 1) + '人' FROM dcOthers WHERE Category = '招聘人数' AND Description LIKE '%~%'
- UPDATE a SET NeedNumber = b.Description FROM ShortDb..BaiduXMLJobTemp a, @t b WHERE a.NeedNumber = b.Id
-
- INSERT INTO #t
- SELECT id, jobname, JobDESC, JobDemand, jobregion, companyname, edulevel, IsDelete,
- experiencelevel, AnnounceDate, dcSalaryID, dcjobtypeID, ShortName, Address, dcCompanySizeID, Brief,
- EmployType, adddate, dcCompanyKindID, enddate, email, EnJobID, EnCpMainID,
- IndustryId, SubSiteUrl, SubSiteName, NeedNumber, Welfare1, Welfare2, Welfare3, Welfare4, Welfare5,
- Welfare6, Welfare7, Welfare8, Welfare9, Welfare10, Welfare11, Welfare12, Welfare13, Welfare14,
- Welfare15, Welfare16, Welfare17, Welfare18, ''
- FROM ShortDb..BaiduXMLJobTemp ORDER BY RDate DESC, id
- IF (SELECT COUNT(*) FROM #t) % 500 = 0
- DELETE #t WHERE ID IN(SELECT TOP 2 ID FROM #t ORDER BY Announcedate)
- DELETE ShortDb..BaiduXMLJobOut WHERE SiteId = @SiteId
- INSERT INTO ShortDb..BaiduXMLJobOut(SiteId, id, jobname, JobDESC, JobDemand, jobregion, companyname, edulevel, IsDelete,
- experiencelevel, AnnounceDate, dcSalaryID, dcjobtypeID, ShortName, Address, dcCompanySizeID, Brief,
- EmployType, adddate, dcCompanyKindID, enddate, email, EnJobID, EnCpMainID,
- IndustryId, SubSiteUrl, SubSiteName, NeedNumber, Welfare1, Welfare2, Welfare3, Welfare4, Welfare5,
- Welfare6, Welfare7, Welfare8, Welfare9, Welfare10, Welfare11, Welfare12, Welfare13, Welfare14,
- Welfare15, Welfare16, Welfare17, Welfare18, crDate)
- SELECT @SiteId, id, jobname, JobDESC, JobDemand, jobregion, companyname, edulevel, IsDelete,
- experiencelevel, AnnounceDate, dcSalaryID, dcjobtypeID, ShortName, Address, dcCompanySizeID, Brief,
- EmployType, adddate, dcCompanyKindID, enddate, email, EnJobID, EnCpMainID,
- IndustryId, SubSiteUrl, SubSiteName, NeedNumber, Welfare1, Welfare2, Welfare3, Welfare4, Welfare5,
- Welfare6, Welfare7, Welfare8, Welfare9, Welfare10, Welfare11, Welfare12, Welfare13, Welfare14,
- Welfare15, Welfare16, Welfare17, Welfare18, GETDATE()
- FROM #t
- ORDER BY RowNo
- END
- GO
- /****** Object: StoredProcedure [dbo].[ProcBaiduXmlRunLogBySuccesssUpdate] Script Date: 2018/12/13 19:09:31 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- CREATE PROCEDURE [dbo].[ProcBaiduXmlRunLogBySuccesssUpdate]
- (
- @ID INT
- )
- AS
- SET NOCOUNT ON
- BEGIN
- IF (SELECT CurrentStatus FROM LogDb..BaiduXmlRunLog WHERE Id = @Id) < 2
- UPDATE LogDb..BaiduXmlRunLog
- SET CurrentStatus = 1,
- BeginJobId = EndJobId
- WHERE Id = @Id
- ELSE
- UPDATE LogDb..BaiduXmlRunLog
- SET CurrentStatus = 10,
- BeginJobId = EndJobId
- WHERE Id = @Id
- END
- GO
|