1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300 |
- <?xml version="1.0" encoding="UTF-8"?>
- <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
- <mapper namespace="com.e3.zl.wc.dao.QueryCodeMapper">
- <resultMap id="BaseResultMap" type="com.e3.zl.wc.bo.SevenStarCodeBo">
- <result column="first0" jdbcType="INTEGER" property="first0" />
- <result column="first1" jdbcType="INTEGER" property="first1" />
- <result column="first2" jdbcType="INTEGER" property="first2" />
- <result column="first3" jdbcType="INTEGER" property="first3" />
- <result column="first4" jdbcType="INTEGER" property="first4" />
- <result column="first5" jdbcType="INTEGER" property="first5" />
- <result column="first6" jdbcType="INTEGER" property="first6" />
- <result column="first7" jdbcType="INTEGER" property="first7" />
- <result column="first8" jdbcType="INTEGER" property="first8" />
- <result column="first9" jdbcType="INTEGER" property="first9" />
-
- <result column="second0" jdbcType="INTEGER" property="second0" />
- <result column="second1" jdbcType="INTEGER" property="second1" />
- <result column="second2" jdbcType="INTEGER" property="second2" />
- <result column="second3" jdbcType="INTEGER" property="second3" />
- <result column="second4" jdbcType="INTEGER" property="second4" />
- <result column="second5" jdbcType="INTEGER" property="second5" />
- <result column="second6" jdbcType="INTEGER" property="second6" />
- <result column="second7" jdbcType="INTEGER" property="second7" />
- <result column="second8" jdbcType="INTEGER" property="second8" />
- <result column="second9" jdbcType="INTEGER" property="second9" />
-
- <result column="third0" jdbcType="INTEGER" property="third0" />
- <result column="third1" jdbcType="INTEGER" property="third1" />
- <result column="third2" jdbcType="INTEGER" property="third2" />
- <result column="third3" jdbcType="INTEGER" property="third3" />
- <result column="third4" jdbcType="INTEGER" property="third4" />
- <result column="third5" jdbcType="INTEGER" property="third5" />
- <result column="third6" jdbcType="INTEGER" property="third6" />
- <result column="third7" jdbcType="INTEGER" property="third7" />
- <result column="third8" jdbcType="INTEGER" property="third8" />
- <result column="third9" jdbcType="INTEGER" property="third9" />
-
- <result column="fourth0" jdbcType="INTEGER" property="fourth0" />
- <result column="fourth1" jdbcType="INTEGER" property="fourth1" />
- <result column="fourth2" jdbcType="INTEGER" property="fourth2" />
- <result column="fourth3" jdbcType="INTEGER" property="fourth3" />
- <result column="fourth4" jdbcType="INTEGER" property="fourth4" />
- <result column="fourth5" jdbcType="INTEGER" property="fourth5" />
- <result column="fourth6" jdbcType="INTEGER" property="fourth6" />
- <result column="fourth7" jdbcType="INTEGER" property="fourth7" />
- <result column="fourth8" jdbcType="INTEGER" property="fourth8" />
- <result column="fourth9" jdbcType="INTEGER" property="fourth9" />
-
- <result column="fifth0" jdbcType="INTEGER" property="fifth0" />
- <result column="fifth1" jdbcType="INTEGER" property="fifth1" />
- <result column="fifth2" jdbcType="INTEGER" property="fifth2" />
- <result column="fifth3" jdbcType="INTEGER" property="fifth3" />
- <result column="fifth4" jdbcType="INTEGER" property="fifth4" />
- <result column="fifth5" jdbcType="INTEGER" property="fifth5" />
- <result column="fifth6" jdbcType="INTEGER" property="fifth6" />
- <result column="fifth7" jdbcType="INTEGER" property="fifth7" />
- <result column="fifth8" jdbcType="INTEGER" property="fifth8" />
- <result column="fifth9" jdbcType="INTEGER" property="fifth9" />
-
- <result column="sixth0" jdbcType="INTEGER" property="sixth0" />
- <result column="sixth1" jdbcType="INTEGER" property="sixth1" />
- <result column="sixth2" jdbcType="INTEGER" property="sixth2" />
- <result column="sixth3" jdbcType="INTEGER" property="sixth3" />
- <result column="sixth4" jdbcType="INTEGER" property="sixth4" />
- <result column="sixth5" jdbcType="INTEGER" property="sixth5" />
- <result column="sixth6" jdbcType="INTEGER" property="sixth6" />
- <result column="sixth7" jdbcType="INTEGER" property="sixth7" />
- <result column="sixth8" jdbcType="INTEGER" property="sixth8" />
- <result column="sixth9" jdbcType="INTEGER" property="sixth9" />
-
- <result column="seventh0" jdbcType="INTEGER" property="seventh0" />
- <result column="seventh1" jdbcType="INTEGER" property="seventh1" />
- <result column="seventh2" jdbcType="INTEGER" property="seventh2" />
- <result column="seventh3" jdbcType="INTEGER" property="seventh3" />
- <result column="seventh4" jdbcType="INTEGER" property="seventh4" />
- <result column="seventh5" jdbcType="INTEGER" property="seventh5" />
- <result column="seventh6" jdbcType="INTEGER" property="seventh6" />
- <result column="seventh7" jdbcType="INTEGER" property="seventh7" />
- <result column="seventh8" jdbcType="INTEGER" property="seventh8" />
- <result column="seventh9" jdbcType="INTEGER" property="seventh9" />
-
- </resultMap>
-
- <resultMap id="CBResultMap" type="com.e3.zl.wc.bo.CodeBo">
- <result column="first0" jdbcType="INTEGER" property="first0" />
- <result column="first1" jdbcType="INTEGER" property="first1" />
- <result column="first2" jdbcType="INTEGER" property="first2" />
- <result column="first3" jdbcType="INTEGER" property="first3" />
- <result column="first4" jdbcType="INTEGER" property="first4" />
- <result column="first5" jdbcType="INTEGER" property="first5" />
- <result column="first6" jdbcType="INTEGER" property="first6" />
- <result column="first7" jdbcType="INTEGER" property="first7" />
- <result column="first8" jdbcType="INTEGER" property="first8" />
- <result column="first9" jdbcType="INTEGER" property="first9" />
-
- <result column="second0" jdbcType="INTEGER" property="second0" />
- <result column="second1" jdbcType="INTEGER" property="second1" />
- <result column="second2" jdbcType="INTEGER" property="second2" />
- <result column="second3" jdbcType="INTEGER" property="second3" />
- <result column="second4" jdbcType="INTEGER" property="second4" />
- <result column="second5" jdbcType="INTEGER" property="second5" />
- <result column="second6" jdbcType="INTEGER" property="second6" />
- <result column="second7" jdbcType="INTEGER" property="second7" />
- <result column="second8" jdbcType="INTEGER" property="second8" />
- <result column="second9" jdbcType="INTEGER" property="second9" />
-
- <result column="third0" jdbcType="INTEGER" property="third0" />
- <result column="third1" jdbcType="INTEGER" property="third1" />
- <result column="third2" jdbcType="INTEGER" property="third2" />
- <result column="third3" jdbcType="INTEGER" property="third3" />
- <result column="third4" jdbcType="INTEGER" property="third4" />
- <result column="third5" jdbcType="INTEGER" property="third5" />
- <result column="third6" jdbcType="INTEGER" property="third6" />
- <result column="third7" jdbcType="INTEGER" property="third7" />
- <result column="third8" jdbcType="INTEGER" property="third8" />
- <result column="third9" jdbcType="INTEGER" property="third9" />
-
- <result column="fourth0" jdbcType="INTEGER" property="fourth0" />
- <result column="fourth1" jdbcType="INTEGER" property="fourth1" />
- <result column="fourth2" jdbcType="INTEGER" property="fourth2" />
- <result column="fourth3" jdbcType="INTEGER" property="fourth3" />
- <result column="fourth4" jdbcType="INTEGER" property="fourth4" />
- <result column="fourth5" jdbcType="INTEGER" property="fourth5" />
- <result column="fourth6" jdbcType="INTEGER" property="fourth6" />
- <result column="fourth7" jdbcType="INTEGER" property="fourth7" />
- <result column="fourth8" jdbcType="INTEGER" property="fourth8" />
- <result column="fourth9" jdbcType="INTEGER" property="fourth9" />
-
- <result column="fifth0" jdbcType="INTEGER" property="fifth0" />
- <result column="fifth1" jdbcType="INTEGER" property="fifth1" />
- <result column="fifth2" jdbcType="INTEGER" property="fifth2" />
- <result column="fifth3" jdbcType="INTEGER" property="fifth3" />
- <result column="fifth4" jdbcType="INTEGER" property="fifth4" />
- <result column="fifth5" jdbcType="INTEGER" property="fifth5" />
- <result column="fifth6" jdbcType="INTEGER" property="fifth6" />
- <result column="fifth7" jdbcType="INTEGER" property="fifth7" />
- <result column="fifth8" jdbcType="INTEGER" property="fifth8" />
- <result column="fifth9" jdbcType="INTEGER" property="fifth9" />
-
- <result column="sixth0" jdbcType="INTEGER" property="sixth0" />
- <result column="sixth1" jdbcType="INTEGER" property="sixth1" />
- <result column="sixth2" jdbcType="INTEGER" property="sixth2" />
- <result column="sixth3" jdbcType="INTEGER" property="sixth3" />
- <result column="sixth4" jdbcType="INTEGER" property="sixth4" />
- <result column="sixth5" jdbcType="INTEGER" property="sixth5" />
- <result column="sixth6" jdbcType="INTEGER" property="sixth6" />
- <result column="sixth7" jdbcType="INTEGER" property="sixth7" />
- <result column="sixth8" jdbcType="INTEGER" property="sixth8" />
- <result column="sixth9" jdbcType="INTEGER" property="sixth9" />
-
- <result column="seventh0" jdbcType="INTEGER" property="seventh0" />
- <result column="seventh1" jdbcType="INTEGER" property="seventh1" />
- <result column="seventh2" jdbcType="INTEGER" property="seventh2" />
- <result column="seventh3" jdbcType="INTEGER" property="seventh3" />
- <result column="seventh4" jdbcType="INTEGER" property="seventh4" />
- <result column="seventh5" jdbcType="INTEGER" property="seventh5" />
- <result column="seventh6" jdbcType="INTEGER" property="seventh6" />
- <result column="seventh7" jdbcType="INTEGER" property="seventh7" />
- <result column="seventh8" jdbcType="INTEGER" property="seventh8" />
- <result column="seventh9" jdbcType="INTEGER" property="seventh9" />
-
- </resultMap>
-
- <resultMap id="CHResultMap" type="com.e3.zl.wc.bo.CodeHiatusBo">
- <result column="per_no" jdbcType="INTEGER" property="perNo" />
- <result column="per_num" jdbcType="INTEGER" property="perNum" />
- <result column="first_code" jdbcType="TINYINT" property="firstCode" />
- <result column="second_code" jdbcType="TINYINT" property="secondCode" />
- <result column="third_code" jdbcType="TINYINT" property="thirdCode" />
- <result column="fourth_code" jdbcType="TINYINT" property="fourthCode" />
- <result column="fifth_code" jdbcType="TINYINT" property="fifthCode" />
-
- <result column="fc0" jdbcType="INTEGER" property="fc0" />
- <result column="fc1" jdbcType="INTEGER" property="fc1" />
- <result column="fc2" jdbcType="INTEGER" property="fc2" />
- <result column="fc3" jdbcType="INTEGER" property="fc3" />
- <result column="fc4" jdbcType="INTEGER" property="fc4" />
- <result column="fc5" jdbcType="INTEGER" property="fc5" />
- <result column="fc6" jdbcType="INTEGER" property="fc6" />
- <result column="fc7" jdbcType="INTEGER" property="fc7" />
- <result column="fc8" jdbcType="INTEGER" property="fc8" />
- <result column="fc9" jdbcType="INTEGER" property="fc9" />
-
- <result column="sc0" jdbcType="INTEGER" property="sc0" />
- <result column="sc1" jdbcType="INTEGER" property="sc1" />
- <result column="sc2" jdbcType="INTEGER" property="sc2" />
- <result column="sc3" jdbcType="INTEGER" property="sc3" />
- <result column="sc4" jdbcType="INTEGER" property="sc4" />
- <result column="sc5" jdbcType="INTEGER" property="sc5" />
- <result column="sc6" jdbcType="INTEGER" property="sc6" />
- <result column="sc7" jdbcType="INTEGER" property="sc7" />
- <result column="sc8" jdbcType="INTEGER" property="sc8" />
- <result column="sc9" jdbcType="INTEGER" property="sc9" />
-
- <result column="tc0" jdbcType="INTEGER" property="tc0" />
- <result column="tc1" jdbcType="INTEGER" property="tc1" />
- <result column="tc2" jdbcType="INTEGER" property="tc2" />
- <result column="tc3" jdbcType="INTEGER" property="tc3" />
- <result column="tc4" jdbcType="INTEGER" property="tc4" />
- <result column="tc5" jdbcType="INTEGER" property="tc5" />
- <result column="tc6" jdbcType="INTEGER" property="tc6" />
- <result column="tc7" jdbcType="INTEGER" property="tc7" />
- <result column="tc8" jdbcType="INTEGER" property="tc8" />
- <result column="tc9" jdbcType="INTEGER" property="tc9" />
-
- <result column="fo0" jdbcType="INTEGER" property="fo0" />
- <result column="fo1" jdbcType="INTEGER" property="fo1" />
- <result column="fo2" jdbcType="INTEGER" property="fo2" />
- <result column="fo3" jdbcType="INTEGER" property="fo3" />
- <result column="fo4" jdbcType="INTEGER" property="fo4" />
- <result column="fo5" jdbcType="INTEGER" property="fo5" />
- <result column="fo6" jdbcType="INTEGER" property="fo6" />
- <result column="fo7" jdbcType="INTEGER" property="fo7" />
- <result column="fo8" jdbcType="INTEGER" property="fo8" />
- <result column="fo9" jdbcType="INTEGER" property="fo9" />
-
- <result column="fi0" jdbcType="INTEGER" property="fi0" />
- <result column="fi1" jdbcType="INTEGER" property="fi1" />
- <result column="fi2" jdbcType="INTEGER" property="fi2" />
- <result column="fi3" jdbcType="INTEGER" property="fi3" />
- <result column="fi4" jdbcType="INTEGER" property="fi4" />
- <result column="fi5" jdbcType="INTEGER" property="fi5" />
- <result column="fi6" jdbcType="INTEGER" property="fi6" />
- <result column="fi7" jdbcType="INTEGER" property="fi7" />
- <result column="fi8" jdbcType="INTEGER" property="fi8" />
- <result column="fi9" jdbcType="INTEGER" property="fi9" />
-
- </resultMap>
-
- <select id="queryMaxPerNum" parameterType="java.lang.Integer" resultType="java.lang.Integer">
- select MAX(per_num) from seven_star_color;
- </select>
-
- <select id="querySevenStarCodeNumByPerNum" parameterType="java.lang.Integer" resultMap="BaseResultMap">
- select
- SUM(if(t.first_code = 0, 1, 0)) as first0,
- SUM(if(t.first_code = 1, 1, 0)) as first1,
- SUM(if(t.first_code = 2, 1, 0)) as first2,
- SUM(if(t.first_code = 3, 1, 0)) as first3,
- SUM(if(t.first_code = 4, 1, 0)) as first4,
- SUM(if(t.first_code = 5, 1, 0)) as first5,
- SUM(if(t.first_code = 6, 1, 0)) as first6,
- SUM(if(t.first_code = 7, 1, 0)) as first7,
- SUM(if(t.first_code = 8, 1, 0)) as first8,
- SUM(if(t.first_code = 9, 1, 0)) as first9,
- SUM(if(t.second_code = 0, 1, 0)) as second0,
- SUM(if(t.second_code = 1, 1, 0)) as second1,
- SUM(if(t.second_code = 2, 1, 0)) as second2,
- SUM(if(t.second_code = 3, 1, 0)) as second3,
- SUM(if(t.second_code = 4, 1, 0)) as second4,
- SUM(if(t.second_code = 5, 1, 0)) as second5,
- SUM(if(t.second_code = 6, 1, 0)) as second6,
- SUM(if(t.second_code = 7, 1, 0)) as second7,
- SUM(if(t.second_code = 8, 1, 0)) as second8,
- SUM(if(t.second_code = 9, 1, 0)) as second9,
- SUM(if(t.third_code = 0, 1, 0)) as third0,
- SUM(if(t.third_code = 1, 1, 0)) as third1,
- SUM(if(t.third_code = 2, 1, 0)) as third2,
- SUM(if(t.third_code = 3, 1, 0)) as third3,
- SUM(if(t.third_code = 4, 1, 0)) as third4,
- SUM(if(t.third_code = 5, 1, 0)) as third5,
- SUM(if(t.third_code = 6, 1, 0)) as third6,
- SUM(if(t.third_code = 7, 1, 0)) as third7,
- SUM(if(t.third_code = 8, 1, 0)) as third8,
- SUM(if(t.third_code = 9, 1, 0)) as third9,
- SUM(if(t.fourth_code = 0, 1, 0)) as fourth0,
- SUM(if(t.fourth_code = 1, 1, 0)) as fourth1,
- SUM(if(t.fourth_code = 2, 1, 0)) as fourth2,
- SUM(if(t.fourth_code = 3, 1, 0)) as fourth3,
- SUM(if(t.fourth_code = 4, 1, 0)) as fourth4,
- SUM(if(t.fourth_code = 5, 1, 0)) as fourth5,
- SUM(if(t.fourth_code = 6, 1, 0)) as fourth6,
- SUM(if(t.fourth_code = 7, 1, 0)) as fourth7,
- SUM(if(t.fourth_code = 8, 1, 0)) as fourth8,
- SUM(if(t.fourth_code = 9, 1, 0)) as fourth9,
- SUM(if(t.fifth_code = 0, 1, 0)) as fifth0,
- SUM(if(t.fifth_code = 1, 1, 0)) as fifth1,
- SUM(if(t.fifth_code = 2, 1, 0)) as fifth2,
- SUM(if(t.fifth_code = 3, 1, 0)) as fifth3,
- SUM(if(t.fifth_code = 4, 1, 0)) as fifth4,
- SUM(if(t.fifth_code = 5, 1, 0)) as fifth5,
- SUM(if(t.fifth_code = 6, 1, 0)) as fifth6,
- SUM(if(t.fifth_code = 7, 1, 0)) as fifth7,
- SUM(if(t.fifth_code = 8, 1, 0)) as fifth8,
- SUM(if(t.fifth_code = 9, 1, 0)) as fifth9,
- SUM(if(t.sixth_code = 0, 1, 0)) as sixth0,
- SUM(if(t.sixth_code = 1, 1, 0)) as sixth1,
- SUM(if(t.sixth_code = 2, 1, 0)) as sixth2,
- SUM(if(t.sixth_code = 3, 1, 0)) as sixth3,
- SUM(if(t.sixth_code = 4, 1, 0)) as sixth4,
- SUM(if(t.sixth_code = 5, 1, 0)) as sixth5,
- SUM(if(t.sixth_code = 6, 1, 0)) as sixth6,
- SUM(if(t.sixth_code = 7, 1, 0)) as sixth7,
- SUM(if(t.sixth_code = 8, 1, 0)) as sixth8,
- SUM(if(t.sixth_code = 9, 1, 0)) as sixth9,
- SUM(if(t.seventh_code = 0, 1, 0)) as seventh0,
- SUM(if(t.seventh_code = 1, 1, 0)) as seventh1,
- SUM(if(t.seventh_code = 2, 1, 0)) as seventh2,
- SUM(if(t.seventh_code = 3, 1, 0)) as seventh3,
- SUM(if(t.seventh_code = 4, 1, 0)) as seventh4,
- SUM(if(t.seventh_code = 5, 1, 0)) as seventh5,
- SUM(if(t.seventh_code = 6, 1, 0)) as seventh6,
- SUM(if(t.seventh_code = 7, 1, 0)) as seventh7,
- SUM(if(t.seventh_code = 8, 1, 0)) as seventh8,
- SUM(if(t.seventh_code = 9, 1, 0)) as seventh9
- from seven_star_color t where EXISTS (
- select 1 from seven_star_color c
- join seven_star_color l on l.first_code = c.first_code
- where c.per_num = #{perNum,jdbcType=INTEGER} and l.per_num < c.per_num and l.per_num + 1 = t.per_num
- )
- UNION
- select
- SUM(if(t.first_code = 0, 1, 0)) as first0,
- SUM(if(t.first_code = 1, 1, 0)) as first1,
- SUM(if(t.first_code = 2, 1, 0)) as first2,
- SUM(if(t.first_code = 3, 1, 0)) as first3,
- SUM(if(t.first_code = 4, 1, 0)) as first4,
- SUM(if(t.first_code = 5, 1, 0)) as first5,
- SUM(if(t.first_code = 6, 1, 0)) as first6,
- SUM(if(t.first_code = 7, 1, 0)) as first7,
- SUM(if(t.first_code = 8, 1, 0)) as first8,
- SUM(if(t.first_code = 9, 1, 0)) as first9,
- SUM(if(t.second_code = 0, 1, 0)) as second0,
- SUM(if(t.second_code = 1, 1, 0)) as second1,
- SUM(if(t.second_code = 2, 1, 0)) as second2,
- SUM(if(t.second_code = 3, 1, 0)) as second3,
- SUM(if(t.second_code = 4, 1, 0)) as second4,
- SUM(if(t.second_code = 5, 1, 0)) as second5,
- SUM(if(t.second_code = 6, 1, 0)) as second6,
- SUM(if(t.second_code = 7, 1, 0)) as second7,
- SUM(if(t.second_code = 8, 1, 0)) as second8,
- SUM(if(t.second_code = 9, 1, 0)) as second9,
- SUM(if(t.third_code = 0, 1, 0)) as third0,
- SUM(if(t.third_code = 1, 1, 0)) as third1,
- SUM(if(t.third_code = 2, 1, 0)) as third2,
- SUM(if(t.third_code = 3, 1, 0)) as third3,
- SUM(if(t.third_code = 4, 1, 0)) as third4,
- SUM(if(t.third_code = 5, 1, 0)) as third5,
- SUM(if(t.third_code = 6, 1, 0)) as third6,
- SUM(if(t.third_code = 7, 1, 0)) as third7,
- SUM(if(t.third_code = 8, 1, 0)) as third8,
- SUM(if(t.third_code = 9, 1, 0)) as third9,
- SUM(if(t.fourth_code = 0, 1, 0)) as fourth0,
- SUM(if(t.fourth_code = 1, 1, 0)) as fourth1,
- SUM(if(t.fourth_code = 2, 1, 0)) as fourth2,
- SUM(if(t.fourth_code = 3, 1, 0)) as fourth3,
- SUM(if(t.fourth_code = 4, 1, 0)) as fourth4,
- SUM(if(t.fourth_code = 5, 1, 0)) as fourth5,
- SUM(if(t.fourth_code = 6, 1, 0)) as fourth6,
- SUM(if(t.fourth_code = 7, 1, 0)) as fourth7,
- SUM(if(t.fourth_code = 8, 1, 0)) as fourth8,
- SUM(if(t.fourth_code = 9, 1, 0)) as fourth9,
- SUM(if(t.fifth_code = 0, 1, 0)) as fifth0,
- SUM(if(t.fifth_code = 1, 1, 0)) as fifth1,
- SUM(if(t.fifth_code = 2, 1, 0)) as fifth2,
- SUM(if(t.fifth_code = 3, 1, 0)) as fifth3,
- SUM(if(t.fifth_code = 4, 1, 0)) as fifth4,
- SUM(if(t.fifth_code = 5, 1, 0)) as fifth5,
- SUM(if(t.fifth_code = 6, 1, 0)) as fifth6,
- SUM(if(t.fifth_code = 7, 1, 0)) as fifth7,
- SUM(if(t.fifth_code = 8, 1, 0)) as fifth8,
- SUM(if(t.fifth_code = 9, 1, 0)) as fifth9,
- SUM(if(t.sixth_code = 0, 1, 0)) as sixth0,
- SUM(if(t.sixth_code = 1, 1, 0)) as sixth1,
- SUM(if(t.sixth_code = 2, 1, 0)) as sixth2,
- SUM(if(t.sixth_code = 3, 1, 0)) as sixth3,
- SUM(if(t.sixth_code = 4, 1, 0)) as sixth4,
- SUM(if(t.sixth_code = 5, 1, 0)) as sixth5,
- SUM(if(t.sixth_code = 6, 1, 0)) as sixth6,
- SUM(if(t.sixth_code = 7, 1, 0)) as sixth7,
- SUM(if(t.sixth_code = 8, 1, 0)) as sixth8,
- SUM(if(t.sixth_code = 9, 1, 0)) as sixth9,
- SUM(if(t.seventh_code = 0, 1, 0)) as seventh0,
- SUM(if(t.seventh_code = 1, 1, 0)) as seventh1,
- SUM(if(t.seventh_code = 2, 1, 0)) as seventh2,
- SUM(if(t.seventh_code = 3, 1, 0)) as seventh3,
- SUM(if(t.seventh_code = 4, 1, 0)) as seventh4,
- SUM(if(t.seventh_code = 5, 1, 0)) as seventh5,
- SUM(if(t.seventh_code = 6, 1, 0)) as seventh6,
- SUM(if(t.seventh_code = 7, 1, 0)) as seventh7,
- SUM(if(t.seventh_code = 8, 1, 0)) as seventh8,
- SUM(if(t.seventh_code = 9, 1, 0)) as seventh9
- from seven_star_color t where EXISTS (
- select 1 from seven_star_color c
- join seven_star_color l on l.second_code = c.second_code
- where c.per_num = #{perNum,jdbcType=INTEGER} and l.per_num < c.per_num and l.per_num + 1 = t.per_num
- )
- UNION
- select
- SUM(if(t.first_code = 0, 1, 0)) as first0,
- SUM(if(t.first_code = 1, 1, 0)) as first1,
- SUM(if(t.first_code = 2, 1, 0)) as first2,
- SUM(if(t.first_code = 3, 1, 0)) as first3,
- SUM(if(t.first_code = 4, 1, 0)) as first4,
- SUM(if(t.first_code = 5, 1, 0)) as first5,
- SUM(if(t.first_code = 6, 1, 0)) as first6,
- SUM(if(t.first_code = 7, 1, 0)) as first7,
- SUM(if(t.first_code = 8, 1, 0)) as first8,
- SUM(if(t.first_code = 9, 1, 0)) as first9,
- SUM(if(t.second_code = 0, 1, 0)) as second0,
- SUM(if(t.second_code = 1, 1, 0)) as second1,
- SUM(if(t.second_code = 2, 1, 0)) as second2,
- SUM(if(t.second_code = 3, 1, 0)) as second3,
- SUM(if(t.second_code = 4, 1, 0)) as second4,
- SUM(if(t.second_code = 5, 1, 0)) as second5,
- SUM(if(t.second_code = 6, 1, 0)) as second6,
- SUM(if(t.second_code = 7, 1, 0)) as second7,
- SUM(if(t.second_code = 8, 1, 0)) as second8,
- SUM(if(t.second_code = 9, 1, 0)) as second9,
- SUM(if(t.third_code = 0, 1, 0)) as third0,
- SUM(if(t.third_code = 1, 1, 0)) as third1,
- SUM(if(t.third_code = 2, 1, 0)) as third2,
- SUM(if(t.third_code = 3, 1, 0)) as third3,
- SUM(if(t.third_code = 4, 1, 0)) as third4,
- SUM(if(t.third_code = 5, 1, 0)) as third5,
- SUM(if(t.third_code = 6, 1, 0)) as third6,
- SUM(if(t.third_code = 7, 1, 0)) as third7,
- SUM(if(t.third_code = 8, 1, 0)) as third8,
- SUM(if(t.third_code = 9, 1, 0)) as third9,
- SUM(if(t.fourth_code = 0, 1, 0)) as fourth0,
- SUM(if(t.fourth_code = 1, 1, 0)) as fourth1,
- SUM(if(t.fourth_code = 2, 1, 0)) as fourth2,
- SUM(if(t.fourth_code = 3, 1, 0)) as fourth3,
- SUM(if(t.fourth_code = 4, 1, 0)) as fourth4,
- SUM(if(t.fourth_code = 5, 1, 0)) as fourth5,
- SUM(if(t.fourth_code = 6, 1, 0)) as fourth6,
- SUM(if(t.fourth_code = 7, 1, 0)) as fourth7,
- SUM(if(t.fourth_code = 8, 1, 0)) as fourth8,
- SUM(if(t.fourth_code = 9, 1, 0)) as fourth9,
- SUM(if(t.fifth_code = 0, 1, 0)) as fifth0,
- SUM(if(t.fifth_code = 1, 1, 0)) as fifth1,
- SUM(if(t.fifth_code = 2, 1, 0)) as fifth2,
- SUM(if(t.fifth_code = 3, 1, 0)) as fifth3,
- SUM(if(t.fifth_code = 4, 1, 0)) as fifth4,
- SUM(if(t.fifth_code = 5, 1, 0)) as fifth5,
- SUM(if(t.fifth_code = 6, 1, 0)) as fifth6,
- SUM(if(t.fifth_code = 7, 1, 0)) as fifth7,
- SUM(if(t.fifth_code = 8, 1, 0)) as fifth8,
- SUM(if(t.fifth_code = 9, 1, 0)) as fifth9,
- SUM(if(t.sixth_code = 0, 1, 0)) as sixth0,
- SUM(if(t.sixth_code = 1, 1, 0)) as sixth1,
- SUM(if(t.sixth_code = 2, 1, 0)) as sixth2,
- SUM(if(t.sixth_code = 3, 1, 0)) as sixth3,
- SUM(if(t.sixth_code = 4, 1, 0)) as sixth4,
- SUM(if(t.sixth_code = 5, 1, 0)) as sixth5,
- SUM(if(t.sixth_code = 6, 1, 0)) as sixth6,
- SUM(if(t.sixth_code = 7, 1, 0)) as sixth7,
- SUM(if(t.sixth_code = 8, 1, 0)) as sixth8,
- SUM(if(t.sixth_code = 9, 1, 0)) as sixth9,
- SUM(if(t.seventh_code = 0, 1, 0)) as seventh0,
- SUM(if(t.seventh_code = 1, 1, 0)) as seventh1,
- SUM(if(t.seventh_code = 2, 1, 0)) as seventh2,
- SUM(if(t.seventh_code = 3, 1, 0)) as seventh3,
- SUM(if(t.seventh_code = 4, 1, 0)) as seventh4,
- SUM(if(t.seventh_code = 5, 1, 0)) as seventh5,
- SUM(if(t.seventh_code = 6, 1, 0)) as seventh6,
- SUM(if(t.seventh_code = 7, 1, 0)) as seventh7,
- SUM(if(t.seventh_code = 8, 1, 0)) as seventh8,
- SUM(if(t.seventh_code = 9, 1, 0)) as seventh9
- from seven_star_color t where EXISTS (
- select 1 from seven_star_color c
- join seven_star_color l on l.third_code = c.third_code
- where c.per_num = #{perNum,jdbcType=INTEGER} and l.per_num < c.per_num and l.per_num + 1 = t.per_num
- )
- UNION
- select
- SUM(if(t.first_code = 0, 1, 0)) as first0,
- SUM(if(t.first_code = 1, 1, 0)) as first1,
- SUM(if(t.first_code = 2, 1, 0)) as first2,
- SUM(if(t.first_code = 3, 1, 0)) as first3,
- SUM(if(t.first_code = 4, 1, 0)) as first4,
- SUM(if(t.first_code = 5, 1, 0)) as first5,
- SUM(if(t.first_code = 6, 1, 0)) as first6,
- SUM(if(t.first_code = 7, 1, 0)) as first7,
- SUM(if(t.first_code = 8, 1, 0)) as first8,
- SUM(if(t.first_code = 9, 1, 0)) as first9,
- SUM(if(t.second_code = 0, 1, 0)) as second0,
- SUM(if(t.second_code = 1, 1, 0)) as second1,
- SUM(if(t.second_code = 2, 1, 0)) as second2,
- SUM(if(t.second_code = 3, 1, 0)) as second3,
- SUM(if(t.second_code = 4, 1, 0)) as second4,
- SUM(if(t.second_code = 5, 1, 0)) as second5,
- SUM(if(t.second_code = 6, 1, 0)) as second6,
- SUM(if(t.second_code = 7, 1, 0)) as second7,
- SUM(if(t.second_code = 8, 1, 0)) as second8,
- SUM(if(t.second_code = 9, 1, 0)) as second9,
- SUM(if(t.third_code = 0, 1, 0)) as third0,
- SUM(if(t.third_code = 1, 1, 0)) as third1,
- SUM(if(t.third_code = 2, 1, 0)) as third2,
- SUM(if(t.third_code = 3, 1, 0)) as third3,
- SUM(if(t.third_code = 4, 1, 0)) as third4,
- SUM(if(t.third_code = 5, 1, 0)) as third5,
- SUM(if(t.third_code = 6, 1, 0)) as third6,
- SUM(if(t.third_code = 7, 1, 0)) as third7,
- SUM(if(t.third_code = 8, 1, 0)) as third8,
- SUM(if(t.third_code = 9, 1, 0)) as third9,
- SUM(if(t.fourth_code = 0, 1, 0)) as fourth0,
- SUM(if(t.fourth_code = 1, 1, 0)) as fourth1,
- SUM(if(t.fourth_code = 2, 1, 0)) as fourth2,
- SUM(if(t.fourth_code = 3, 1, 0)) as fourth3,
- SUM(if(t.fourth_code = 4, 1, 0)) as fourth4,
- SUM(if(t.fourth_code = 5, 1, 0)) as fourth5,
- SUM(if(t.fourth_code = 6, 1, 0)) as fourth6,
- SUM(if(t.fourth_code = 7, 1, 0)) as fourth7,
- SUM(if(t.fourth_code = 8, 1, 0)) as fourth8,
- SUM(if(t.fourth_code = 9, 1, 0)) as fourth9,
- SUM(if(t.fifth_code = 0, 1, 0)) as fifth0,
- SUM(if(t.fifth_code = 1, 1, 0)) as fifth1,
- SUM(if(t.fifth_code = 2, 1, 0)) as fifth2,
- SUM(if(t.fifth_code = 3, 1, 0)) as fifth3,
- SUM(if(t.fifth_code = 4, 1, 0)) as fifth4,
- SUM(if(t.fifth_code = 5, 1, 0)) as fifth5,
- SUM(if(t.fifth_code = 6, 1, 0)) as fifth6,
- SUM(if(t.fifth_code = 7, 1, 0)) as fifth7,
- SUM(if(t.fifth_code = 8, 1, 0)) as fifth8,
- SUM(if(t.fifth_code = 9, 1, 0)) as fifth9,
- SUM(if(t.sixth_code = 0, 1, 0)) as sixth0,
- SUM(if(t.sixth_code = 1, 1, 0)) as sixth1,
- SUM(if(t.sixth_code = 2, 1, 0)) as sixth2,
- SUM(if(t.sixth_code = 3, 1, 0)) as sixth3,
- SUM(if(t.sixth_code = 4, 1, 0)) as sixth4,
- SUM(if(t.sixth_code = 5, 1, 0)) as sixth5,
- SUM(if(t.sixth_code = 6, 1, 0)) as sixth6,
- SUM(if(t.sixth_code = 7, 1, 0)) as sixth7,
- SUM(if(t.sixth_code = 8, 1, 0)) as sixth8,
- SUM(if(t.sixth_code = 9, 1, 0)) as sixth9,
- SUM(if(t.seventh_code = 0, 1, 0)) as seventh0,
- SUM(if(t.seventh_code = 1, 1, 0)) as seventh1,
- SUM(if(t.seventh_code = 2, 1, 0)) as seventh2,
- SUM(if(t.seventh_code = 3, 1, 0)) as seventh3,
- SUM(if(t.seventh_code = 4, 1, 0)) as seventh4,
- SUM(if(t.seventh_code = 5, 1, 0)) as seventh5,
- SUM(if(t.seventh_code = 6, 1, 0)) as seventh6,
- SUM(if(t.seventh_code = 7, 1, 0)) as seventh7,
- SUM(if(t.seventh_code = 8, 1, 0)) as seventh8,
- SUM(if(t.seventh_code = 9, 1, 0)) as seventh9
- from seven_star_color t where EXISTS (
- select 1 from seven_star_color c
- join seven_star_color l on l.fourth_code = c.fourth_code
- where c.per_num = #{perNum,jdbcType=INTEGER} and l.per_num < c.per_num and l.per_num + 1 = t.per_num
- )
- UNION
- select
- SUM(if(t.first_code = 0, 1, 0)) as first0,
- SUM(if(t.first_code = 1, 1, 0)) as first1,
- SUM(if(t.first_code = 2, 1, 0)) as first2,
- SUM(if(t.first_code = 3, 1, 0)) as first3,
- SUM(if(t.first_code = 4, 1, 0)) as first4,
- SUM(if(t.first_code = 5, 1, 0)) as first5,
- SUM(if(t.first_code = 6, 1, 0)) as first6,
- SUM(if(t.first_code = 7, 1, 0)) as first7,
- SUM(if(t.first_code = 8, 1, 0)) as first8,
- SUM(if(t.first_code = 9, 1, 0)) as first9,
- SUM(if(t.second_code = 0, 1, 0)) as second0,
- SUM(if(t.second_code = 1, 1, 0)) as second1,
- SUM(if(t.second_code = 2, 1, 0)) as second2,
- SUM(if(t.second_code = 3, 1, 0)) as second3,
- SUM(if(t.second_code = 4, 1, 0)) as second4,
- SUM(if(t.second_code = 5, 1, 0)) as second5,
- SUM(if(t.second_code = 6, 1, 0)) as second6,
- SUM(if(t.second_code = 7, 1, 0)) as second7,
- SUM(if(t.second_code = 8, 1, 0)) as second8,
- SUM(if(t.second_code = 9, 1, 0)) as second9,
- SUM(if(t.third_code = 0, 1, 0)) as third0,
- SUM(if(t.third_code = 1, 1, 0)) as third1,
- SUM(if(t.third_code = 2, 1, 0)) as third2,
- SUM(if(t.third_code = 3, 1, 0)) as third3,
- SUM(if(t.third_code = 4, 1, 0)) as third4,
- SUM(if(t.third_code = 5, 1, 0)) as third5,
- SUM(if(t.third_code = 6, 1, 0)) as third6,
- SUM(if(t.third_code = 7, 1, 0)) as third7,
- SUM(if(t.third_code = 8, 1, 0)) as third8,
- SUM(if(t.third_code = 9, 1, 0)) as third9,
- SUM(if(t.fourth_code = 0, 1, 0)) as fourth0,
- SUM(if(t.fourth_code = 1, 1, 0)) as fourth1,
- SUM(if(t.fourth_code = 2, 1, 0)) as fourth2,
- SUM(if(t.fourth_code = 3, 1, 0)) as fourth3,
- SUM(if(t.fourth_code = 4, 1, 0)) as fourth4,
- SUM(if(t.fourth_code = 5, 1, 0)) as fourth5,
- SUM(if(t.fourth_code = 6, 1, 0)) as fourth6,
- SUM(if(t.fourth_code = 7, 1, 0)) as fourth7,
- SUM(if(t.fourth_code = 8, 1, 0)) as fourth8,
- SUM(if(t.fourth_code = 9, 1, 0)) as fourth9,
- SUM(if(t.fifth_code = 0, 1, 0)) as fifth0,
- SUM(if(t.fifth_code = 1, 1, 0)) as fifth1,
- SUM(if(t.fifth_code = 2, 1, 0)) as fifth2,
- SUM(if(t.fifth_code = 3, 1, 0)) as fifth3,
- SUM(if(t.fifth_code = 4, 1, 0)) as fifth4,
- SUM(if(t.fifth_code = 5, 1, 0)) as fifth5,
- SUM(if(t.fifth_code = 6, 1, 0)) as fifth6,
- SUM(if(t.fifth_code = 7, 1, 0)) as fifth7,
- SUM(if(t.fifth_code = 8, 1, 0)) as fifth8,
- SUM(if(t.fifth_code = 9, 1, 0)) as fifth9,
- SUM(if(t.sixth_code = 0, 1, 0)) as sixth0,
- SUM(if(t.sixth_code = 1, 1, 0)) as sixth1,
- SUM(if(t.sixth_code = 2, 1, 0)) as sixth2,
- SUM(if(t.sixth_code = 3, 1, 0)) as sixth3,
- SUM(if(t.sixth_code = 4, 1, 0)) as sixth4,
- SUM(if(t.sixth_code = 5, 1, 0)) as sixth5,
- SUM(if(t.sixth_code = 6, 1, 0)) as sixth6,
- SUM(if(t.sixth_code = 7, 1, 0)) as sixth7,
- SUM(if(t.sixth_code = 8, 1, 0)) as sixth8,
- SUM(if(t.sixth_code = 9, 1, 0)) as sixth9,
- SUM(if(t.seventh_code = 0, 1, 0)) as seventh0,
- SUM(if(t.seventh_code = 1, 1, 0)) as seventh1,
- SUM(if(t.seventh_code = 2, 1, 0)) as seventh2,
- SUM(if(t.seventh_code = 3, 1, 0)) as seventh3,
- SUM(if(t.seventh_code = 4, 1, 0)) as seventh4,
- SUM(if(t.seventh_code = 5, 1, 0)) as seventh5,
- SUM(if(t.seventh_code = 6, 1, 0)) as seventh6,
- SUM(if(t.seventh_code = 7, 1, 0)) as seventh7,
- SUM(if(t.seventh_code = 8, 1, 0)) as seventh8,
- SUM(if(t.seventh_code = 9, 1, 0)) as seventh9
- from seven_star_color t where EXISTS (
- select 1 from seven_star_color c
- join seven_star_color l on l.fifth_code = c.fifth_code
- where c.per_num = #{perNum,jdbcType=INTEGER} and l.per_num < c.per_num and l.per_num + 1 = t.per_num
- )
- UNION
- select
- SUM(if(t.first_code = 0, 1, 0)) as first0,
- SUM(if(t.first_code = 1, 1, 0)) as first1,
- SUM(if(t.first_code = 2, 1, 0)) as first2,
- SUM(if(t.first_code = 3, 1, 0)) as first3,
- SUM(if(t.first_code = 4, 1, 0)) as first4,
- SUM(if(t.first_code = 5, 1, 0)) as first5,
- SUM(if(t.first_code = 6, 1, 0)) as first6,
- SUM(if(t.first_code = 7, 1, 0)) as first7,
- SUM(if(t.first_code = 8, 1, 0)) as first8,
- SUM(if(t.first_code = 9, 1, 0)) as first9,
- SUM(if(t.second_code = 0, 1, 0)) as second0,
- SUM(if(t.second_code = 1, 1, 0)) as second1,
- SUM(if(t.second_code = 2, 1, 0)) as second2,
- SUM(if(t.second_code = 3, 1, 0)) as second3,
- SUM(if(t.second_code = 4, 1, 0)) as second4,
- SUM(if(t.second_code = 5, 1, 0)) as second5,
- SUM(if(t.second_code = 6, 1, 0)) as second6,
- SUM(if(t.second_code = 7, 1, 0)) as second7,
- SUM(if(t.second_code = 8, 1, 0)) as second8,
- SUM(if(t.second_code = 9, 1, 0)) as second9,
- SUM(if(t.third_code = 0, 1, 0)) as third0,
- SUM(if(t.third_code = 1, 1, 0)) as third1,
- SUM(if(t.third_code = 2, 1, 0)) as third2,
- SUM(if(t.third_code = 3, 1, 0)) as third3,
- SUM(if(t.third_code = 4, 1, 0)) as third4,
- SUM(if(t.third_code = 5, 1, 0)) as third5,
- SUM(if(t.third_code = 6, 1, 0)) as third6,
- SUM(if(t.third_code = 7, 1, 0)) as third7,
- SUM(if(t.third_code = 8, 1, 0)) as third8,
- SUM(if(t.third_code = 9, 1, 0)) as third9,
- SUM(if(t.fourth_code = 0, 1, 0)) as fourth0,
- SUM(if(t.fourth_code = 1, 1, 0)) as fourth1,
- SUM(if(t.fourth_code = 2, 1, 0)) as fourth2,
- SUM(if(t.fourth_code = 3, 1, 0)) as fourth3,
- SUM(if(t.fourth_code = 4, 1, 0)) as fourth4,
- SUM(if(t.fourth_code = 5, 1, 0)) as fourth5,
- SUM(if(t.fourth_code = 6, 1, 0)) as fourth6,
- SUM(if(t.fourth_code = 7, 1, 0)) as fourth7,
- SUM(if(t.fourth_code = 8, 1, 0)) as fourth8,
- SUM(if(t.fourth_code = 9, 1, 0)) as fourth9,
- SUM(if(t.fifth_code = 0, 1, 0)) as fifth0,
- SUM(if(t.fifth_code = 1, 1, 0)) as fifth1,
- SUM(if(t.fifth_code = 2, 1, 0)) as fifth2,
- SUM(if(t.fifth_code = 3, 1, 0)) as fifth3,
- SUM(if(t.fifth_code = 4, 1, 0)) as fifth4,
- SUM(if(t.fifth_code = 5, 1, 0)) as fifth5,
- SUM(if(t.fifth_code = 6, 1, 0)) as fifth6,
- SUM(if(t.fifth_code = 7, 1, 0)) as fifth7,
- SUM(if(t.fifth_code = 8, 1, 0)) as fifth8,
- SUM(if(t.fifth_code = 9, 1, 0)) as fifth9,
- SUM(if(t.sixth_code = 0, 1, 0)) as sixth0,
- SUM(if(t.sixth_code = 1, 1, 0)) as sixth1,
- SUM(if(t.sixth_code = 2, 1, 0)) as sixth2,
- SUM(if(t.sixth_code = 3, 1, 0)) as sixth3,
- SUM(if(t.sixth_code = 4, 1, 0)) as sixth4,
- SUM(if(t.sixth_code = 5, 1, 0)) as sixth5,
- SUM(if(t.sixth_code = 6, 1, 0)) as sixth6,
- SUM(if(t.sixth_code = 7, 1, 0)) as sixth7,
- SUM(if(t.sixth_code = 8, 1, 0)) as sixth8,
- SUM(if(t.sixth_code = 9, 1, 0)) as sixth9,
- SUM(if(t.seventh_code = 0, 1, 0)) as seventh0,
- SUM(if(t.seventh_code = 1, 1, 0)) as seventh1,
- SUM(if(t.seventh_code = 2, 1, 0)) as seventh2,
- SUM(if(t.seventh_code = 3, 1, 0)) as seventh3,
- SUM(if(t.seventh_code = 4, 1, 0)) as seventh4,
- SUM(if(t.seventh_code = 5, 1, 0)) as seventh5,
- SUM(if(t.seventh_code = 6, 1, 0)) as seventh6,
- SUM(if(t.seventh_code = 7, 1, 0)) as seventh7,
- SUM(if(t.seventh_code = 8, 1, 0)) as seventh8,
- SUM(if(t.seventh_code = 9, 1, 0)) as seventh9
- from seven_star_color t where EXISTS (
- select 1 from seven_star_color c
- join seven_star_color l on l.sixth_code = c.sixth_code
- where c.per_num = #{perNum,jdbcType=INTEGER} and l.per_num < c.per_num and l.per_num + 1 = t.per_num
- )
- UNION
- select
- SUM(if(t.first_code = 0, 1, 0)) as first0,
- SUM(if(t.first_code = 1, 1, 0)) as first1,
- SUM(if(t.first_code = 2, 1, 0)) as first2,
- SUM(if(t.first_code = 3, 1, 0)) as first3,
- SUM(if(t.first_code = 4, 1, 0)) as first4,
- SUM(if(t.first_code = 5, 1, 0)) as first5,
- SUM(if(t.first_code = 6, 1, 0)) as first6,
- SUM(if(t.first_code = 7, 1, 0)) as first7,
- SUM(if(t.first_code = 8, 1, 0)) as first8,
- SUM(if(t.first_code = 9, 1, 0)) as first9,
- SUM(if(t.second_code = 0, 1, 0)) as second0,
- SUM(if(t.second_code = 1, 1, 0)) as second1,
- SUM(if(t.second_code = 2, 1, 0)) as second2,
- SUM(if(t.second_code = 3, 1, 0)) as second3,
- SUM(if(t.second_code = 4, 1, 0)) as second4,
- SUM(if(t.second_code = 5, 1, 0)) as second5,
- SUM(if(t.second_code = 6, 1, 0)) as second6,
- SUM(if(t.second_code = 7, 1, 0)) as second7,
- SUM(if(t.second_code = 8, 1, 0)) as second8,
- SUM(if(t.second_code = 9, 1, 0)) as second9,
- SUM(if(t.third_code = 0, 1, 0)) as third0,
- SUM(if(t.third_code = 1, 1, 0)) as third1,
- SUM(if(t.third_code = 2, 1, 0)) as third2,
- SUM(if(t.third_code = 3, 1, 0)) as third3,
- SUM(if(t.third_code = 4, 1, 0)) as third4,
- SUM(if(t.third_code = 5, 1, 0)) as third5,
- SUM(if(t.third_code = 6, 1, 0)) as third6,
- SUM(if(t.third_code = 7, 1, 0)) as third7,
- SUM(if(t.third_code = 8, 1, 0)) as third8,
- SUM(if(t.third_code = 9, 1, 0)) as third9,
- SUM(if(t.fourth_code = 0, 1, 0)) as fourth0,
- SUM(if(t.fourth_code = 1, 1, 0)) as fourth1,
- SUM(if(t.fourth_code = 2, 1, 0)) as fourth2,
- SUM(if(t.fourth_code = 3, 1, 0)) as fourth3,
- SUM(if(t.fourth_code = 4, 1, 0)) as fourth4,
- SUM(if(t.fourth_code = 5, 1, 0)) as fourth5,
- SUM(if(t.fourth_code = 6, 1, 0)) as fourth6,
- SUM(if(t.fourth_code = 7, 1, 0)) as fourth7,
- SUM(if(t.fourth_code = 8, 1, 0)) as fourth8,
- SUM(if(t.fourth_code = 9, 1, 0)) as fourth9,
- SUM(if(t.fifth_code = 0, 1, 0)) as fifth0,
- SUM(if(t.fifth_code = 1, 1, 0)) as fifth1,
- SUM(if(t.fifth_code = 2, 1, 0)) as fifth2,
- SUM(if(t.fifth_code = 3, 1, 0)) as fifth3,
- SUM(if(t.fifth_code = 4, 1, 0)) as fifth4,
- SUM(if(t.fifth_code = 5, 1, 0)) as fifth5,
- SUM(if(t.fifth_code = 6, 1, 0)) as fifth6,
- SUM(if(t.fifth_code = 7, 1, 0)) as fifth7,
- SUM(if(t.fifth_code = 8, 1, 0)) as fifth8,
- SUM(if(t.fifth_code = 9, 1, 0)) as fifth9,
- SUM(if(t.sixth_code = 0, 1, 0)) as sixth0,
- SUM(if(t.sixth_code = 1, 1, 0)) as sixth1,
- SUM(if(t.sixth_code = 2, 1, 0)) as sixth2,
- SUM(if(t.sixth_code = 3, 1, 0)) as sixth3,
- SUM(if(t.sixth_code = 4, 1, 0)) as sixth4,
- SUM(if(t.sixth_code = 5, 1, 0)) as sixth5,
- SUM(if(t.sixth_code = 6, 1, 0)) as sixth6,
- SUM(if(t.sixth_code = 7, 1, 0)) as sixth7,
- SUM(if(t.sixth_code = 8, 1, 0)) as sixth8,
- SUM(if(t.sixth_code = 9, 1, 0)) as sixth9,
- SUM(if(t.seventh_code = 0, 1, 0)) as seventh0,
- SUM(if(t.seventh_code = 1, 1, 0)) as seventh1,
- SUM(if(t.seventh_code = 2, 1, 0)) as seventh2,
- SUM(if(t.seventh_code = 3, 1, 0)) as seventh3,
- SUM(if(t.seventh_code = 4, 1, 0)) as seventh4,
- SUM(if(t.seventh_code = 5, 1, 0)) as seventh5,
- SUM(if(t.seventh_code = 6, 1, 0)) as seventh6,
- SUM(if(t.seventh_code = 7, 1, 0)) as seventh7,
- SUM(if(t.seventh_code = 8, 1, 0)) as seventh8,
- SUM(if(t.seventh_code = 9, 1, 0)) as seventh9
- from seven_star_color t where EXISTS (
- select 1 from seven_star_color c
- join seven_star_color l on l.seventh_code = c.seventh_code
- where c.per_num = #{perNum,jdbcType=INTEGER} and l.per_num < c.per_num and l.per_num + 1 = t.per_num
- );
- </select>
-
- <select id="queryRankFiveCodeNumByPerNum" parameterType="com.e3.zl.wc.model.RankFive" resultMap="CBResultMap">
- select
- SUM(if(t.first_code = 0, 1, 0)) as first0,
- SUM(if(t.first_code = 1, 1, 0)) as first1,
- SUM(if(t.first_code = 2, 1, 0)) as first2,
- SUM(if(t.first_code = 3, 1, 0)) as first3,
- SUM(if(t.first_code = 4, 1, 0)) as first4,
- SUM(if(t.first_code = 5, 1, 0)) as first5,
- SUM(if(t.first_code = 6, 1, 0)) as first6,
- SUM(if(t.first_code = 7, 1, 0)) as first7,
- SUM(if(t.first_code = 8, 1, 0)) as first8,
- SUM(if(t.first_code = 9, 1, 0)) as first9,
- SUM(if(t.second_code = 0, 1, 0)) as second0,
- SUM(if(t.second_code = 1, 1, 0)) as second1,
- SUM(if(t.second_code = 2, 1, 0)) as second2,
- SUM(if(t.second_code = 3, 1, 0)) as second3,
- SUM(if(t.second_code = 4, 1, 0)) as second4,
- SUM(if(t.second_code = 5, 1, 0)) as second5,
- SUM(if(t.second_code = 6, 1, 0)) as second6,
- SUM(if(t.second_code = 7, 1, 0)) as second7,
- SUM(if(t.second_code = 8, 1, 0)) as second8,
- SUM(if(t.second_code = 9, 1, 0)) as second9,
- SUM(if(t.third_code = 0, 1, 0)) as third0,
- SUM(if(t.third_code = 1, 1, 0)) as third1,
- SUM(if(t.third_code = 2, 1, 0)) as third2,
- SUM(if(t.third_code = 3, 1, 0)) as third3,
- SUM(if(t.third_code = 4, 1, 0)) as third4,
- SUM(if(t.third_code = 5, 1, 0)) as third5,
- SUM(if(t.third_code = 6, 1, 0)) as third6,
- SUM(if(t.third_code = 7, 1, 0)) as third7,
- SUM(if(t.third_code = 8, 1, 0)) as third8,
- SUM(if(t.third_code = 9, 1, 0)) as third9,
- SUM(if(t.fourth_code = 0, 1, 0)) as fourth0,
- SUM(if(t.fourth_code = 1, 1, 0)) as fourth1,
- SUM(if(t.fourth_code = 2, 1, 0)) as fourth2,
- SUM(if(t.fourth_code = 3, 1, 0)) as fourth3,
- SUM(if(t.fourth_code = 4, 1, 0)) as fourth4,
- SUM(if(t.fourth_code = 5, 1, 0)) as fourth5,
- SUM(if(t.fourth_code = 6, 1, 0)) as fourth6,
- SUM(if(t.fourth_code = 7, 1, 0)) as fourth7,
- SUM(if(t.fourth_code = 8, 1, 0)) as fourth8,
- SUM(if(t.fourth_code = 9, 1, 0)) as fourth9,
- SUM(if(t.fifth_code = 0, 1, 0)) as fifth0,
- SUM(if(t.fifth_code = 1, 1, 0)) as fifth1,
- SUM(if(t.fifth_code = 2, 1, 0)) as fifth2,
- SUM(if(t.fifth_code = 3, 1, 0)) as fifth3,
- SUM(if(t.fifth_code = 4, 1, 0)) as fifth4,
- SUM(if(t.fifth_code = 5, 1, 0)) as fifth5,
- SUM(if(t.fifth_code = 6, 1, 0)) as fifth6,
- SUM(if(t.fifth_code = 7, 1, 0)) as fifth7,
- SUM(if(t.fifth_code = 8, 1, 0)) as fifth8,
- SUM(if(t.fifth_code = 9, 1, 0)) as fifth9
- from rank_five t
- join rank_five l on t.per_num = l.per_num + 1
- where l.first_code = #{firstCode} and l.per_num < #{perNum}
- union
- select
- SUM(if(t.first_code = 0, 1, 0)) as first0,
- SUM(if(t.first_code = 1, 1, 0)) as first1,
- SUM(if(t.first_code = 2, 1, 0)) as first2,
- SUM(if(t.first_code = 3, 1, 0)) as first3,
- SUM(if(t.first_code = 4, 1, 0)) as first4,
- SUM(if(t.first_code = 5, 1, 0)) as first5,
- SUM(if(t.first_code = 6, 1, 0)) as first6,
- SUM(if(t.first_code = 7, 1, 0)) as first7,
- SUM(if(t.first_code = 8, 1, 0)) as first8,
- SUM(if(t.first_code = 9, 1, 0)) as first9,
- SUM(if(t.second_code = 0, 1, 0)) as second0,
- SUM(if(t.second_code = 1, 1, 0)) as second1,
- SUM(if(t.second_code = 2, 1, 0)) as second2,
- SUM(if(t.second_code = 3, 1, 0)) as second3,
- SUM(if(t.second_code = 4, 1, 0)) as second4,
- SUM(if(t.second_code = 5, 1, 0)) as second5,
- SUM(if(t.second_code = 6, 1, 0)) as second6,
- SUM(if(t.second_code = 7, 1, 0)) as second7,
- SUM(if(t.second_code = 8, 1, 0)) as second8,
- SUM(if(t.second_code = 9, 1, 0)) as second9,
- SUM(if(t.third_code = 0, 1, 0)) as third0,
- SUM(if(t.third_code = 1, 1, 0)) as third1,
- SUM(if(t.third_code = 2, 1, 0)) as third2,
- SUM(if(t.third_code = 3, 1, 0)) as third3,
- SUM(if(t.third_code = 4, 1, 0)) as third4,
- SUM(if(t.third_code = 5, 1, 0)) as third5,
- SUM(if(t.third_code = 6, 1, 0)) as third6,
- SUM(if(t.third_code = 7, 1, 0)) as third7,
- SUM(if(t.third_code = 8, 1, 0)) as third8,
- SUM(if(t.third_code = 9, 1, 0)) as third9,
- SUM(if(t.fourth_code = 0, 1, 0)) as fourth0,
- SUM(if(t.fourth_code = 1, 1, 0)) as fourth1,
- SUM(if(t.fourth_code = 2, 1, 0)) as fourth2,
- SUM(if(t.fourth_code = 3, 1, 0)) as fourth3,
- SUM(if(t.fourth_code = 4, 1, 0)) as fourth4,
- SUM(if(t.fourth_code = 5, 1, 0)) as fourth5,
- SUM(if(t.fourth_code = 6, 1, 0)) as fourth6,
- SUM(if(t.fourth_code = 7, 1, 0)) as fourth7,
- SUM(if(t.fourth_code = 8, 1, 0)) as fourth8,
- SUM(if(t.fourth_code = 9, 1, 0)) as fourth9,
- SUM(if(t.fifth_code = 0, 1, 0)) as fifth0,
- SUM(if(t.fifth_code = 1, 1, 0)) as fifth1,
- SUM(if(t.fifth_code = 2, 1, 0)) as fifth2,
- SUM(if(t.fifth_code = 3, 1, 0)) as fifth3,
- SUM(if(t.fifth_code = 4, 1, 0)) as fifth4,
- SUM(if(t.fifth_code = 5, 1, 0)) as fifth5,
- SUM(if(t.fifth_code = 6, 1, 0)) as fifth6,
- SUM(if(t.fifth_code = 7, 1, 0)) as fifth7,
- SUM(if(t.fifth_code = 8, 1, 0)) as fifth8,
- SUM(if(t.fifth_code = 9, 1, 0)) as fifth9
- from rank_five t
- join rank_five l on t.per_num = l.per_num + 1
- where l.second_code = #{secondCode} and l.per_num < #{perNum}
- union
- select
- SUM(if(t.first_code = 0, 1, 0)) as first0,
- SUM(if(t.first_code = 1, 1, 0)) as first1,
- SUM(if(t.first_code = 2, 1, 0)) as first2,
- SUM(if(t.first_code = 3, 1, 0)) as first3,
- SUM(if(t.first_code = 4, 1, 0)) as first4,
- SUM(if(t.first_code = 5, 1, 0)) as first5,
- SUM(if(t.first_code = 6, 1, 0)) as first6,
- SUM(if(t.first_code = 7, 1, 0)) as first7,
- SUM(if(t.first_code = 8, 1, 0)) as first8,
- SUM(if(t.first_code = 9, 1, 0)) as first9,
- SUM(if(t.second_code = 0, 1, 0)) as second0,
- SUM(if(t.second_code = 1, 1, 0)) as second1,
- SUM(if(t.second_code = 2, 1, 0)) as second2,
- SUM(if(t.second_code = 3, 1, 0)) as second3,
- SUM(if(t.second_code = 4, 1, 0)) as second4,
- SUM(if(t.second_code = 5, 1, 0)) as second5,
- SUM(if(t.second_code = 6, 1, 0)) as second6,
- SUM(if(t.second_code = 7, 1, 0)) as second7,
- SUM(if(t.second_code = 8, 1, 0)) as second8,
- SUM(if(t.second_code = 9, 1, 0)) as second9,
- SUM(if(t.third_code = 0, 1, 0)) as third0,
- SUM(if(t.third_code = 1, 1, 0)) as third1,
- SUM(if(t.third_code = 2, 1, 0)) as third2,
- SUM(if(t.third_code = 3, 1, 0)) as third3,
- SUM(if(t.third_code = 4, 1, 0)) as third4,
- SUM(if(t.third_code = 5, 1, 0)) as third5,
- SUM(if(t.third_code = 6, 1, 0)) as third6,
- SUM(if(t.third_code = 7, 1, 0)) as third7,
- SUM(if(t.third_code = 8, 1, 0)) as third8,
- SUM(if(t.third_code = 9, 1, 0)) as third9,
- SUM(if(t.fourth_code = 0, 1, 0)) as fourth0,
- SUM(if(t.fourth_code = 1, 1, 0)) as fourth1,
- SUM(if(t.fourth_code = 2, 1, 0)) as fourth2,
- SUM(if(t.fourth_code = 3, 1, 0)) as fourth3,
- SUM(if(t.fourth_code = 4, 1, 0)) as fourth4,
- SUM(if(t.fourth_code = 5, 1, 0)) as fourth5,
- SUM(if(t.fourth_code = 6, 1, 0)) as fourth6,
- SUM(if(t.fourth_code = 7, 1, 0)) as fourth7,
- SUM(if(t.fourth_code = 8, 1, 0)) as fourth8,
- SUM(if(t.fourth_code = 9, 1, 0)) as fourth9,
- SUM(if(t.fifth_code = 0, 1, 0)) as fifth0,
- SUM(if(t.fifth_code = 1, 1, 0)) as fifth1,
- SUM(if(t.fifth_code = 2, 1, 0)) as fifth2,
- SUM(if(t.fifth_code = 3, 1, 0)) as fifth3,
- SUM(if(t.fifth_code = 4, 1, 0)) as fifth4,
- SUM(if(t.fifth_code = 5, 1, 0)) as fifth5,
- SUM(if(t.fifth_code = 6, 1, 0)) as fifth6,
- SUM(if(t.fifth_code = 7, 1, 0)) as fifth7,
- SUM(if(t.fifth_code = 8, 1, 0)) as fifth8,
- SUM(if(t.fifth_code = 9, 1, 0)) as fifth9
- from rank_five t
- join rank_five l on t.per_num = l.per_num + 1
- where l.third_code = #{thirdCode} and l.per_num < #{perNum}
- union
- select
- SUM(if(t.first_code = 0, 1, 0)) as first0,
- SUM(if(t.first_code = 1, 1, 0)) as first1,
- SUM(if(t.first_code = 2, 1, 0)) as first2,
- SUM(if(t.first_code = 3, 1, 0)) as first3,
- SUM(if(t.first_code = 4, 1, 0)) as first4,
- SUM(if(t.first_code = 5, 1, 0)) as first5,
- SUM(if(t.first_code = 6, 1, 0)) as first6,
- SUM(if(t.first_code = 7, 1, 0)) as first7,
- SUM(if(t.first_code = 8, 1, 0)) as first8,
- SUM(if(t.first_code = 9, 1, 0)) as first9,
- SUM(if(t.second_code = 0, 1, 0)) as second0,
- SUM(if(t.second_code = 1, 1, 0)) as second1,
- SUM(if(t.second_code = 2, 1, 0)) as second2,
- SUM(if(t.second_code = 3, 1, 0)) as second3,
- SUM(if(t.second_code = 4, 1, 0)) as second4,
- SUM(if(t.second_code = 5, 1, 0)) as second5,
- SUM(if(t.second_code = 6, 1, 0)) as second6,
- SUM(if(t.second_code = 7, 1, 0)) as second7,
- SUM(if(t.second_code = 8, 1, 0)) as second8,
- SUM(if(t.second_code = 9, 1, 0)) as second9,
- SUM(if(t.third_code = 0, 1, 0)) as third0,
- SUM(if(t.third_code = 1, 1, 0)) as third1,
- SUM(if(t.third_code = 2, 1, 0)) as third2,
- SUM(if(t.third_code = 3, 1, 0)) as third3,
- SUM(if(t.third_code = 4, 1, 0)) as third4,
- SUM(if(t.third_code = 5, 1, 0)) as third5,
- SUM(if(t.third_code = 6, 1, 0)) as third6,
- SUM(if(t.third_code = 7, 1, 0)) as third7,
- SUM(if(t.third_code = 8, 1, 0)) as third8,
- SUM(if(t.third_code = 9, 1, 0)) as third9,
- SUM(if(t.fourth_code = 0, 1, 0)) as fourth0,
- SUM(if(t.fourth_code = 1, 1, 0)) as fourth1,
- SUM(if(t.fourth_code = 2, 1, 0)) as fourth2,
- SUM(if(t.fourth_code = 3, 1, 0)) as fourth3,
- SUM(if(t.fourth_code = 4, 1, 0)) as fourth4,
- SUM(if(t.fourth_code = 5, 1, 0)) as fourth5,
- SUM(if(t.fourth_code = 6, 1, 0)) as fourth6,
- SUM(if(t.fourth_code = 7, 1, 0)) as fourth7,
- SUM(if(t.fourth_code = 8, 1, 0)) as fourth8,
- SUM(if(t.fourth_code = 9, 1, 0)) as fourth9,
- SUM(if(t.fifth_code = 0, 1, 0)) as fifth0,
- SUM(if(t.fifth_code = 1, 1, 0)) as fifth1,
- SUM(if(t.fifth_code = 2, 1, 0)) as fifth2,
- SUM(if(t.fifth_code = 3, 1, 0)) as fifth3,
- SUM(if(t.fifth_code = 4, 1, 0)) as fifth4,
- SUM(if(t.fifth_code = 5, 1, 0)) as fifth5,
- SUM(if(t.fifth_code = 6, 1, 0)) as fifth6,
- SUM(if(t.fifth_code = 7, 1, 0)) as fifth7,
- SUM(if(t.fifth_code = 8, 1, 0)) as fifth8,
- SUM(if(t.fifth_code = 9, 1, 0)) as fifth9
- from rank_five t
- join rank_five l on t.per_num = l.per_num + 1
- where l.fourth_code = #{fourthCode} and l.per_num < #{perNum}
- union
- select
- SUM(if(t.first_code = 0, 1, 0)) as first0,
- SUM(if(t.first_code = 1, 1, 0)) as first1,
- SUM(if(t.first_code = 2, 1, 0)) as first2,
- SUM(if(t.first_code = 3, 1, 0)) as first3,
- SUM(if(t.first_code = 4, 1, 0)) as first4,
- SUM(if(t.first_code = 5, 1, 0)) as first5,
- SUM(if(t.first_code = 6, 1, 0)) as first6,
- SUM(if(t.first_code = 7, 1, 0)) as first7,
- SUM(if(t.first_code = 8, 1, 0)) as first8,
- SUM(if(t.first_code = 9, 1, 0)) as first9,
- SUM(if(t.second_code = 0, 1, 0)) as second0,
- SUM(if(t.second_code = 1, 1, 0)) as second1,
- SUM(if(t.second_code = 2, 1, 0)) as second2,
- SUM(if(t.second_code = 3, 1, 0)) as second3,
- SUM(if(t.second_code = 4, 1, 0)) as second4,
- SUM(if(t.second_code = 5, 1, 0)) as second5,
- SUM(if(t.second_code = 6, 1, 0)) as second6,
- SUM(if(t.second_code = 7, 1, 0)) as second7,
- SUM(if(t.second_code = 8, 1, 0)) as second8,
- SUM(if(t.second_code = 9, 1, 0)) as second9,
- SUM(if(t.third_code = 0, 1, 0)) as third0,
- SUM(if(t.third_code = 1, 1, 0)) as third1,
- SUM(if(t.third_code = 2, 1, 0)) as third2,
- SUM(if(t.third_code = 3, 1, 0)) as third3,
- SUM(if(t.third_code = 4, 1, 0)) as third4,
- SUM(if(t.third_code = 5, 1, 0)) as third5,
- SUM(if(t.third_code = 6, 1, 0)) as third6,
- SUM(if(t.third_code = 7, 1, 0)) as third7,
- SUM(if(t.third_code = 8, 1, 0)) as third8,
- SUM(if(t.third_code = 9, 1, 0)) as third9,
- SUM(if(t.fourth_code = 0, 1, 0)) as fourth0,
- SUM(if(t.fourth_code = 1, 1, 0)) as fourth1,
- SUM(if(t.fourth_code = 2, 1, 0)) as fourth2,
- SUM(if(t.fourth_code = 3, 1, 0)) as fourth3,
- SUM(if(t.fourth_code = 4, 1, 0)) as fourth4,
- SUM(if(t.fourth_code = 5, 1, 0)) as fourth5,
- SUM(if(t.fourth_code = 6, 1, 0)) as fourth6,
- SUM(if(t.fourth_code = 7, 1, 0)) as fourth7,
- SUM(if(t.fourth_code = 8, 1, 0)) as fourth8,
- SUM(if(t.fourth_code = 9, 1, 0)) as fourth9,
- SUM(if(t.fifth_code = 0, 1, 0)) as fifth0,
- SUM(if(t.fifth_code = 1, 1, 0)) as fifth1,
- SUM(if(t.fifth_code = 2, 1, 0)) as fifth2,
- SUM(if(t.fifth_code = 3, 1, 0)) as fifth3,
- SUM(if(t.fifth_code = 4, 1, 0)) as fifth4,
- SUM(if(t.fifth_code = 5, 1, 0)) as fifth5,
- SUM(if(t.fifth_code = 6, 1, 0)) as fifth6,
- SUM(if(t.fifth_code = 7, 1, 0)) as fifth7,
- SUM(if(t.fifth_code = 8, 1, 0)) as fifth8,
- SUM(if(t.fifth_code = 9, 1, 0)) as fifth9
- from rank_five t
- join rank_five l on t.per_num = l.per_num + 1
- where l.fifth_code = #{fifthCode} and l.per_num < #{perNum};
- </select>
-
- <select id="queryRankFiveCodeNumByCodeAndPerNum" parameterType="com.e3.zl.wc.model.RankFive" resultMap="CBResultMap">
- select
- SUM(if(t.first_code = 0, 1, 0)) as first0,
- SUM(if(t.first_code = 1, 1, 0)) as first1,
- SUM(if(t.first_code = 2, 1, 0)) as first2,
- SUM(if(t.first_code = 3, 1, 0)) as first3,
- SUM(if(t.first_code = 4, 1, 0)) as first4,
- SUM(if(t.first_code = 5, 1, 0)) as first5,
- SUM(if(t.first_code = 6, 1, 0)) as first6,
- SUM(if(t.first_code = 7, 1, 0)) as first7,
- SUM(if(t.first_code = 8, 1, 0)) as first8,
- SUM(if(t.first_code = 9, 1, 0)) as first9,
- SUM(if(t.second_code = 0, 1, 0)) as second0,
- SUM(if(t.second_code = 1, 1, 0)) as second1,
- SUM(if(t.second_code = 2, 1, 0)) as second2,
- SUM(if(t.second_code = 3, 1, 0)) as second3,
- SUM(if(t.second_code = 4, 1, 0)) as second4,
- SUM(if(t.second_code = 5, 1, 0)) as second5,
- SUM(if(t.second_code = 6, 1, 0)) as second6,
- SUM(if(t.second_code = 7, 1, 0)) as second7,
- SUM(if(t.second_code = 8, 1, 0)) as second8,
- SUM(if(t.second_code = 9, 1, 0)) as second9,
- SUM(if(t.third_code = 0, 1, 0)) as third0,
- SUM(if(t.third_code = 1, 1, 0)) as third1,
- SUM(if(t.third_code = 2, 1, 0)) as third2,
- SUM(if(t.third_code = 3, 1, 0)) as third3,
- SUM(if(t.third_code = 4, 1, 0)) as third4,
- SUM(if(t.third_code = 5, 1, 0)) as third5,
- SUM(if(t.third_code = 6, 1, 0)) as third6,
- SUM(if(t.third_code = 7, 1, 0)) as third7,
- SUM(if(t.third_code = 8, 1, 0)) as third8,
- SUM(if(t.third_code = 9, 1, 0)) as third9,
- SUM(if(t.fourth_code = 0, 1, 0)) as fourth0,
- SUM(if(t.fourth_code = 1, 1, 0)) as fourth1,
- SUM(if(t.fourth_code = 2, 1, 0)) as fourth2,
- SUM(if(t.fourth_code = 3, 1, 0)) as fourth3,
- SUM(if(t.fourth_code = 4, 1, 0)) as fourth4,
- SUM(if(t.fourth_code = 5, 1, 0)) as fourth5,
- SUM(if(t.fourth_code = 6, 1, 0)) as fourth6,
- SUM(if(t.fourth_code = 7, 1, 0)) as fourth7,
- SUM(if(t.fourth_code = 8, 1, 0)) as fourth8,
- SUM(if(t.fourth_code = 9, 1, 0)) as fourth9,
- SUM(if(t.fifth_code = 0, 1, 0)) as fifth0,
- SUM(if(t.fifth_code = 1, 1, 0)) as fifth1,
- SUM(if(t.fifth_code = 2, 1, 0)) as fifth2,
- SUM(if(t.fifth_code = 3, 1, 0)) as fifth3,
- SUM(if(t.fifth_code = 4, 1, 0)) as fifth4,
- SUM(if(t.fifth_code = 5, 1, 0)) as fifth5,
- SUM(if(t.fifth_code = 6, 1, 0)) as fifth6,
- SUM(if(t.fifth_code = 7, 1, 0)) as fifth7,
- SUM(if(t.fifth_code = 8, 1, 0)) as fifth8,
- SUM(if(t.fifth_code = 9, 1, 0)) as fifth9
- from rank_five t
- join rank_five l on t.per_num = l.per_num + 1
- where l.per_num < #{perNum}
- <if test="firstCode != null">
- and l.first_code = #{firstCode}
- </if>
- <if test="secondCode != null">
- and l.second_code = #{secondCode}
- </if>
- <if test="thirdCode != null">
- and l.third_code = #{thirdCode}
- </if>
- <if test="fourthCode != null">
- and l.fourth_code = #{fourthCode}
- </if>
- <if test="fifthCode != null">
- and l.fifth_code = #{fifthCode}
- </if>
- </select>
-
- <select id="queryRankFiveHistoryCodeNum" parameterType="java.lang.Integer" resultMap="CBResultMap">
- select
- SUM(if(first_code = 0, 1, 0)) as first0,
- SUM(if(first_code = 1, 1, 0)) as first1,
- SUM(if(first_code = 2, 1, 0)) as first2,
- SUM(if(first_code = 3, 1, 0)) as first3,
- SUM(if(first_code = 4, 1, 0)) as first4,
- SUM(if(first_code = 5, 1, 0)) as first5,
- SUM(if(first_code = 6, 1, 0)) as first6,
- SUM(if(first_code = 7, 1, 0)) as first7,
- SUM(if(first_code = 8, 1, 0)) as first8,
- SUM(if(first_code = 9, 1, 0)) as first9,
- SUM(if(second_code = 0, 1, 0)) as second0,
- SUM(if(second_code = 1, 1, 0)) as second1,
- SUM(if(second_code = 2, 1, 0)) as second2,
- SUM(if(second_code = 3, 1, 0)) as second3,
- SUM(if(second_code = 4, 1, 0)) as second4,
- SUM(if(second_code = 5, 1, 0)) as second5,
- SUM(if(second_code = 6, 1, 0)) as second6,
- SUM(if(second_code = 7, 1, 0)) as second7,
- SUM(if(second_code = 8, 1, 0)) as second8,
- SUM(if(second_code = 9, 1, 0)) as second9,
- SUM(if(third_code = 0, 1, 0)) as third0,
- SUM(if(third_code = 1, 1, 0)) as third1,
- SUM(if(third_code = 2, 1, 0)) as third2,
- SUM(if(third_code = 3, 1, 0)) as third3,
- SUM(if(third_code = 4, 1, 0)) as third4,
- SUM(if(third_code = 5, 1, 0)) as third5,
- SUM(if(third_code = 6, 1, 0)) as third6,
- SUM(if(third_code = 7, 1, 0)) as third7,
- SUM(if(third_code = 8, 1, 0)) as third8,
- SUM(if(third_code = 9, 1, 0)) as third9,
- SUM(if(fourth_code = 0, 1, 0)) as fourth0,
- SUM(if(fourth_code = 1, 1, 0)) as fourth1,
- SUM(if(fourth_code = 2, 1, 0)) as fourth2,
- SUM(if(fourth_code = 3, 1, 0)) as fourth3,
- SUM(if(fourth_code = 4, 1, 0)) as fourth4,
- SUM(if(fourth_code = 5, 1, 0)) as fourth5,
- SUM(if(fourth_code = 6, 1, 0)) as fourth6,
- SUM(if(fourth_code = 7, 1, 0)) as fourth7,
- SUM(if(fourth_code = 8, 1, 0)) as fourth8,
- SUM(if(fourth_code = 9, 1, 0)) as fourth9,
- SUM(if(fifth_code = 0, 1, 0)) as fifth0,
- SUM(if(fifth_code = 1, 1, 0)) as fifth1,
- SUM(if(fifth_code = 2, 1, 0)) as fifth2,
- SUM(if(fifth_code = 3, 1, 0)) as fifth3,
- SUM(if(fifth_code = 4, 1, 0)) as fifth4,
- SUM(if(fifth_code = 5, 1, 0)) as fifth5,
- SUM(if(fifth_code = 6, 1, 0)) as fifth6,
- SUM(if(fifth_code = 7, 1, 0)) as fifth7,
- SUM(if(fifth_code = 8, 1, 0)) as fifth8,
- SUM(if(fifth_code = 9, 1, 0)) as fifth9
- from rank_five
- where per_num < #{perNum};
- </select>
-
- <select id="queryRankFiveHiatusCodeNum" parameterType="java.lang.Integer" resultMap="CHResultMap">
- select o.*,
- (select max(rf0.per_num) from rank_five rf0 where rf0.first_code = 0 and rf0.per_num < o.per_num) as fc0,
- (select max(rf1.per_num) from rank_five rf1 where rf1.first_code = 1 and rf1.per_num < o.per_num) as fc1,
- (select max(rf2.per_num) from rank_five rf2 where rf2.first_code = 2 and rf2.per_num < o.per_num) as fc2,
- (select max(rf3.per_num) from rank_five rf3 where rf3.first_code = 3 and rf3.per_num < o.per_num) as fc3,
- (select max(rf4.per_num) from rank_five rf4 where rf4.first_code = 4 and rf4.per_num < o.per_num) as fc4,
- (select max(rf5.per_num) from rank_five rf5 where rf5.first_code = 5 and rf5.per_num < o.per_num) as fc5,
- (select max(rf6.per_num) from rank_five rf6 where rf6.first_code = 6 and rf6.per_num < o.per_num) as fc6,
- (select max(rf7.per_num) from rank_five rf7 where rf7.first_code = 7 and rf7.per_num < o.per_num) as fc7,
- (select max(rf8.per_num) from rank_five rf8 where rf8.first_code = 8 and rf8.per_num < o.per_num) as fc8,
- (select max(rf9.per_num) from rank_five rf9 where rf9.first_code = 9 and rf9.per_num < o.per_num) as fc9,
- (select max(rfs0.per_num) from rank_five rfs0 where rfs0.second_code = 0 and rfs0.per_num < o.per_num) as sc0,
- (select max(rfs1.per_num) from rank_five rfs1 where rfs1.second_code = 1 and rfs1.per_num < o.per_num) as sc1,
- (select max(rfs2.per_num) from rank_five rfs2 where rfs2.second_code = 2 and rfs2.per_num < o.per_num) as sc2,
- (select max(rfs3.per_num) from rank_five rfs3 where rfs3.second_code = 3 and rfs3.per_num < o.per_num) as sc3,
- (select max(rfs4.per_num) from rank_five rfs4 where rfs4.second_code = 4 and rfs4.per_num < o.per_num) as sc4,
- (select max(rfs5.per_num) from rank_five rfs5 where rfs5.second_code = 5 and rfs5.per_num < o.per_num) as sc5,
- (select max(rfs6.per_num) from rank_five rfs6 where rfs6.second_code = 6 and rfs6.per_num < o.per_num) as sc6,
- (select max(rfs7.per_num) from rank_five rfs7 where rfs7.second_code = 7 and rfs7.per_num < o.per_num) as sc7,
- (select max(rfs8.per_num) from rank_five rfs8 where rfs8.second_code = 8 and rfs8.per_num < o.per_num) as sc8,
- (select max(rfs9.per_num) from rank_five rfs9 where rfs9.second_code = 9 and rfs9.per_num < o.per_num) as sc9,
- (select max(rft0.per_num) from rank_five rft0 where rft0.third_code = 0 and rft0.per_num < o.per_num) as tc0,
- (select max(rft1.per_num) from rank_five rft1 where rft1.third_code = 1 and rft1.per_num < o.per_num) as tc1,
- (select max(rft2.per_num) from rank_five rft2 where rft2.third_code = 2 and rft2.per_num < o.per_num) as tc2,
- (select max(rft3.per_num) from rank_five rft3 where rft3.third_code = 3 and rft3.per_num < o.per_num) as tc3,
- (select max(rft4.per_num) from rank_five rft4 where rft4.third_code = 4 and rft4.per_num < o.per_num) as tc4,
- (select max(rft5.per_num) from rank_five rft5 where rft5.third_code = 5 and rft5.per_num < o.per_num) as tc5,
- (select max(rft6.per_num) from rank_five rft6 where rft6.third_code = 6 and rft6.per_num < o.per_num) as tc6,
- (select max(rft7.per_num) from rank_five rft7 where rft7.third_code = 7 and rft7.per_num < o.per_num) as tc7,
- (select max(rft8.per_num) from rank_five rft8 where rft8.third_code = 8 and rft8.per_num < o.per_num) as tc8,
- (select max(rft9.per_num) from rank_five rft9 where rft9.third_code = 9 and rft9.per_num < o.per_num) as tc9,
- (select max(rfo0.per_num) from rank_five rfo0 where rfo0.fourth_code = 0 and rfo0.per_num < o.per_num) as fo0,
- (select max(rfo1.per_num) from rank_five rfo1 where rfo1.fourth_code = 1 and rfo1.per_num < o.per_num) as fo1,
- (select max(rfo2.per_num) from rank_five rfo2 where rfo2.fourth_code = 2 and rfo2.per_num < o.per_num) as fo2,
- (select max(rfo3.per_num) from rank_five rfo3 where rfo3.fourth_code = 3 and rfo3.per_num < o.per_num) as fo3,
- (select max(rfo4.per_num) from rank_five rfo4 where rfo4.fourth_code = 4 and rfo4.per_num < o.per_num) as fo4,
- (select max(rfo5.per_num) from rank_five rfo5 where rfo5.fourth_code = 5 and rfo5.per_num < o.per_num) as fo5,
- (select max(rfo6.per_num) from rank_five rfo6 where rfo6.fourth_code = 6 and rfo6.per_num < o.per_num) as fo6,
- (select max(rfo7.per_num) from rank_five rfo7 where rfo7.fourth_code = 7 and rfo7.per_num < o.per_num) as fo7,
- (select max(rfo8.per_num) from rank_five rfo8 where rfo8.fourth_code = 8 and rfo8.per_num < o.per_num) as fo8,
- (select max(rfo9.per_num) from rank_five rfo9 where rfo9.fourth_code = 9 and rfo9.per_num < o.per_num) as fo9,
- (select max(rfi0.per_num) from rank_five rfi0 where rfi0.fifth_code = 0 and rfi0.per_num < o.per_num) as fi0,
- (select max(rfi1.per_num) from rank_five rfi1 where rfi1.fifth_code = 1 and rfi1.per_num < o.per_num) as fi1,
- (select max(rfi2.per_num) from rank_five rfi2 where rfi2.fifth_code = 2 and rfi2.per_num < o.per_num) as fi2,
- (select max(rfi3.per_num) from rank_five rfi3 where rfi3.fifth_code = 3 and rfi3.per_num < o.per_num) as fi3,
- (select max(rfi4.per_num) from rank_five rfi4 where rfi4.fifth_code = 4 and rfi4.per_num < o.per_num) as fi4,
- (select max(rfi5.per_num) from rank_five rfi5 where rfi5.fifth_code = 5 and rfi5.per_num < o.per_num) as fi5,
- (select max(rfi6.per_num) from rank_five rfi6 where rfi6.fifth_code = 6 and rfi6.per_num < o.per_num) as fi6,
- (select max(rfi7.per_num) from rank_five rfi7 where rfi7.fifth_code = 7 and rfi7.per_num < o.per_num) as fi7,
- (select max(rfi8.per_num) from rank_five rfi8 where rfi8.fifth_code = 8 and rfi8.per_num < o.per_num) as fi8,
- (select max(rfi9.per_num) from rank_five rfi9 where rfi9.fifth_code = 9 and rfi9.per_num < o.per_num) as fi9
- from rank_five o order by o.per_num desc limit 0, #{showNum};
- </select>
-
- <select id="getMaxRankFiveHiatusCodeNum" parameterType="java.lang.Integer" resultMap="CHResultMap">
- select o.*,
- (select max(rf0.per_num) from rank_five rf0 where rf0.first_code = 0 and rf0.per_num < o.per_num) as fc0,
- (select max(rf1.per_num) from rank_five rf1 where rf1.first_code = 1 and rf1.per_num < o.per_num) as fc1,
- (select max(rf2.per_num) from rank_five rf2 where rf2.first_code = 2 and rf2.per_num < o.per_num) as fc2,
- (select max(rf3.per_num) from rank_five rf3 where rf3.first_code = 3 and rf3.per_num < o.per_num) as fc3,
- (select max(rf4.per_num) from rank_five rf4 where rf4.first_code = 4 and rf4.per_num < o.per_num) as fc4,
- (select max(rf5.per_num) from rank_five rf5 where rf5.first_code = 5 and rf5.per_num < o.per_num) as fc5,
- (select max(rf6.per_num) from rank_five rf6 where rf6.first_code = 6 and rf6.per_num < o.per_num) as fc6,
- (select max(rf7.per_num) from rank_five rf7 where rf7.first_code = 7 and rf7.per_num < o.per_num) as fc7,
- (select max(rf8.per_num) from rank_five rf8 where rf8.first_code = 8 and rf8.per_num < o.per_num) as fc8,
- (select max(rf9.per_num) from rank_five rf9 where rf9.first_code = 9 and rf9.per_num < o.per_num) as fc9,
- (select max(rfs0.per_num) from rank_five rfs0 where rfs0.second_code = 0 and rfs0.per_num < o.per_num) as sc0,
- (select max(rfs1.per_num) from rank_five rfs1 where rfs1.second_code = 1 and rfs1.per_num < o.per_num) as sc1,
- (select max(rfs2.per_num) from rank_five rfs2 where rfs2.second_code = 2 and rfs2.per_num < o.per_num) as sc2,
- (select max(rfs3.per_num) from rank_five rfs3 where rfs3.second_code = 3 and rfs3.per_num < o.per_num) as sc3,
- (select max(rfs4.per_num) from rank_five rfs4 where rfs4.second_code = 4 and rfs4.per_num < o.per_num) as sc4,
- (select max(rfs5.per_num) from rank_five rfs5 where rfs5.second_code = 5 and rfs5.per_num < o.per_num) as sc5,
- (select max(rfs6.per_num) from rank_five rfs6 where rfs6.second_code = 6 and rfs6.per_num < o.per_num) as sc6,
- (select max(rfs7.per_num) from rank_five rfs7 where rfs7.second_code = 7 and rfs7.per_num < o.per_num) as sc7,
- (select max(rfs8.per_num) from rank_five rfs8 where rfs8.second_code = 8 and rfs8.per_num < o.per_num) as sc8,
- (select max(rfs9.per_num) from rank_five rfs9 where rfs9.second_code = 9 and rfs9.per_num < o.per_num) as sc9,
- (select max(rft0.per_num) from rank_five rft0 where rft0.third_code = 0 and rft0.per_num < o.per_num) as tc0,
- (select max(rft1.per_num) from rank_five rft1 where rft1.third_code = 1 and rft1.per_num < o.per_num) as tc1,
- (select max(rft2.per_num) from rank_five rft2 where rft2.third_code = 2 and rft2.per_num < o.per_num) as tc2,
- (select max(rft3.per_num) from rank_five rft3 where rft3.third_code = 3 and rft3.per_num < o.per_num) as tc3,
- (select max(rft4.per_num) from rank_five rft4 where rft4.third_code = 4 and rft4.per_num < o.per_num) as tc4,
- (select max(rft5.per_num) from rank_five rft5 where rft5.third_code = 5 and rft5.per_num < o.per_num) as tc5,
- (select max(rft6.per_num) from rank_five rft6 where rft6.third_code = 6 and rft6.per_num < o.per_num) as tc6,
- (select max(rft7.per_num) from rank_five rft7 where rft7.third_code = 7 and rft7.per_num < o.per_num) as tc7,
- (select max(rft8.per_num) from rank_five rft8 where rft8.third_code = 8 and rft8.per_num < o.per_num) as tc8,
- (select max(rft9.per_num) from rank_five rft9 where rft9.third_code = 9 and rft9.per_num < o.per_num) as tc9,
- (select max(rfo0.per_num) from rank_five rfo0 where rfo0.fourth_code = 0 and rfo0.per_num < o.per_num) as fo0,
- (select max(rfo1.per_num) from rank_five rfo1 where rfo1.fourth_code = 1 and rfo1.per_num < o.per_num) as fo1,
- (select max(rfo2.per_num) from rank_five rfo2 where rfo2.fourth_code = 2 and rfo2.per_num < o.per_num) as fo2,
- (select max(rfo3.per_num) from rank_five rfo3 where rfo3.fourth_code = 3 and rfo3.per_num < o.per_num) as fo3,
- (select max(rfo4.per_num) from rank_five rfo4 where rfo4.fourth_code = 4 and rfo4.per_num < o.per_num) as fo4,
- (select max(rfo5.per_num) from rank_five rfo5 where rfo5.fourth_code = 5 and rfo5.per_num < o.per_num) as fo5,
- (select max(rfo6.per_num) from rank_five rfo6 where rfo6.fourth_code = 6 and rfo6.per_num < o.per_num) as fo6,
- (select max(rfo7.per_num) from rank_five rfo7 where rfo7.fourth_code = 7 and rfo7.per_num < o.per_num) as fo7,
- (select max(rfo8.per_num) from rank_five rfo8 where rfo8.fourth_code = 8 and rfo8.per_num < o.per_num) as fo8,
- (select max(rfo9.per_num) from rank_five rfo9 where rfo9.fourth_code = 9 and rfo9.per_num < o.per_num) as fo9,
- (select max(rfi0.per_num) from rank_five rfi0 where rfi0.fifth_code = 0 and rfi0.per_num < o.per_num) as fi0,
- (select max(rfi1.per_num) from rank_five rfi1 where rfi1.fifth_code = 1 and rfi1.per_num < o.per_num) as fi1,
- (select max(rfi2.per_num) from rank_five rfi2 where rfi2.fifth_code = 2 and rfi2.per_num < o.per_num) as fi2,
- (select max(rfi3.per_num) from rank_five rfi3 where rfi3.fifth_code = 3 and rfi3.per_num < o.per_num) as fi3,
- (select max(rfi4.per_num) from rank_five rfi4 where rfi4.fifth_code = 4 and rfi4.per_num < o.per_num) as fi4,
- (select max(rfi5.per_num) from rank_five rfi5 where rfi5.fifth_code = 5 and rfi5.per_num < o.per_num) as fi5,
- (select max(rfi6.per_num) from rank_five rfi6 where rfi6.fifth_code = 6 and rfi6.per_num < o.per_num) as fi6,
- (select max(rfi7.per_num) from rank_five rfi7 where rfi7.fifth_code = 7 and rfi7.per_num < o.per_num) as fi7,
- (select max(rfi8.per_num) from rank_five rfi8 where rfi8.fifth_code = 8 and rfi8.per_num < o.per_num) as fi8,
- (select max(rfi9.per_num) from rank_five rfi9 where rfi9.fifth_code = 9 and rfi9.per_num < o.per_num) as fi9
- from (select max(n.per_num) + 1 as per_num from rank_five n) o;
- </select>
-
- </mapper>
|