| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064 |
- <?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.ydtech.modules.order.dao.InsOrdersMapper">
- <resultMap id="BaseResultMap" type="com.ydtech.modules.order.entity.InsOrders">
- <id property="orderno" column="orderno" jdbcType="VARCHAR"/>
- <result property="quoteno" column="quoteno" jdbcType="VARCHAR"/>
- <result property="orderstatus" column="orderstatus" jdbcType="VARCHAR"/>
- <result property="companyId" column="company_id" jdbcType="VARCHAR"/>
- <result property="insCompany" column="ins_company" jdbcType="VARCHAR"/>
- <result property="carinfo" column="carinfo" javaType="com.alibaba.fastjson.JSONObject"
- typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler" jdbcType="VARCHAR"/>
- <result property="userid" column="userid" jdbcType="VARCHAR"/>
- <result property="username" column="username" jdbcType="VARCHAR"/>
- <result property="deptid" column="deptid" jdbcType="VARCHAR"/>
- <result property="deptname" column="deptname" jdbcType="VARCHAR"/>
- <result property="ownerinfo" column="ownerinfo" javaType="com.alibaba.fastjson.JSONObject"
- typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler" jdbcType="VARCHAR"/>
- <result property="applyinfo" column="applyinfo" javaType="com.alibaba.fastjson.JSONObject"
- typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler" jdbcType="VARCHAR"/>
- <result property="insureinfo" column="insureinfo" javaType="com.alibaba.fastjson.JSONObject"
- typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler"
- jdbcType="VARCHAR"/>
- <result property="agreeid" column="agreeid" jdbcType="VARCHAR"/>
- <result property="productid" column="productid" jdbcType="VARCHAR"/>
- <result property="product" column="product" jdbcType="VARCHAR"/>
- <result property="createtime" column="createtime" jdbcType="TIMESTAMP"/>
- <result property="frameno" column="frameno" jdbcType="VARCHAR"/>
- <result property="licenseno" column="licenseno" jdbcType="VARCHAR"/>
- <result property="insuredname" column="insuredname" jdbcType="VARCHAR"/>
- <result property="jqstartdate" column="jqstartdate" jdbcType="VARCHAR"/>
- <result property="jqenddate" column="jqenddate" jdbcType="VARCHAR"/>
- <result property="systartdate" column="systartdate" jdbcType="VARCHAR"/>
- <result property="syenddate" column="syenddate" jdbcType="VARCHAR"/>
- <result property="jqpremium" column="jqpremium" jdbcType="VARCHAR"/>
- <result property="sypremium" column="sypremium" jdbcType="VARCHAR"/>
- <result property="jypremium" column="jypremium" jdbcType="VARCHAR"/>
- <result property="taxamount" column="taxamount" jdbcType="VARCHAR"/>
- <result property="risk" column="risk" javaType="com.alibaba.fastjson.JSONArray"
- typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler" jdbcType="VARCHAR"/>
- <result property="king" column="king" javaType="com.alibaba.fastjson.JSONArray"
- typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler" jdbcType="VARCHAR"/>
- <result property="vehicleAndVesselTax" column="vehicle_and_vessel_tax"
- javaType="com.alibaba.fastjson.JSONObject"
- typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler" jdbcType="VARCHAR"/>
- <result property="subOrderId" column="subOrderId" jdbcType="VARCHAR"/>
- <result property="agreementCode" column="agreementCode" jdbcType="VARCHAR"/>
- <result property="agreementName" column="agreementName" jdbcType="VARCHAR"/>
- <result property="partnerCompaniesName" column="partnerCompaniesName" jdbcType="VARCHAR"/>
- <result property="managementSource" column="managementSource" jdbcType="VARCHAR"/>
- <result property="leaderName" column="leader_name" jdbcType="VARCHAR"/>
- <result property="leaderId" column="leader_id" jdbcType="VARCHAR"/>
- <result property="underwritingStatus" column="underwritingStatus" jdbcType="INTEGER"/>
- <result property="entryStatus" column="entryStatus" jdbcType="VARCHAR"/>
- <result property="underwritingTime" column="underwritingTime" jdbcType="TIMESTAMP"/>
- <result property="payDate" column="payDate" jdbcType="TIMESTAMP"/>
- <result property="updateStatus" column="updateStatus" jdbcType="VARCHAR"/>
- <result property="updateStatusTime" column="updateStatusTime" jdbcType="TIMESTAMP"/>
- <result property="signingTime" column="signingTime" jdbcType="TIMESTAMP"/>
- </resultMap>
- <resultMap id="OrderResultMap" type="com.ydtech.modules.order.entity.vo.OrderVo">
- <id property="orderno" column="orderno" jdbcType="VARCHAR"/>
- <result property="quoteno" column="quoteno" jdbcType="VARCHAR"/>
- <result property="apiType" column="api_type" jdbcType="VARCHAR"/>
- <result property="orderstatus" column="orderstatus" jdbcType="VARCHAR"/>
- <result property="carinfo" column="carinfo" javaType="com.alibaba.fastjson.JSONObject"
- typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler" jdbcType="VARCHAR"/>
- <result property="userid" column="userid" jdbcType="VARCHAR"/>
- <result property="username" column="username" jdbcType="VARCHAR"/>
- <result property="deptid" column="deptid" jdbcType="VARCHAR"/>
- <result property="deptname" column="deptname" jdbcType="VARCHAR"/>
- <result property="ownerinfo" column="ownerinfo" javaType="com.alibaba.fastjson.JSONObject"
- typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler" jdbcType="VARCHAR"/>
- <result property="applyinfo" column="applyinfo" javaType="com.alibaba.fastjson.JSONObject"
- typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler" jdbcType="VARCHAR"/>
- <result property="insureinfo" column="insureinfo" javaType="com.alibaba.fastjson.JSONObject"
- typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler"
- jdbcType="VARCHAR"/>
- <result property="agreementId" column="agreement_id" jdbcType="VARCHAR"/>
- <result property="entryStatus" column="entry_status" jdbcType="VARCHAR"/>
- <result property="productid" column="productid" jdbcType="VARCHAR"/>
- <result property="product" column="product" jdbcType="VARCHAR"/>
- <result property="frameno" column="frameno" jdbcType="VARCHAR"/>
- <result property="licenseno" column="licenseno" jdbcType="VARCHAR"/>
- <result property="insuredname" column="insuredname" jdbcType="VARCHAR"/>
- <result property="jqstartdate" column="jqstartdate" jdbcType="VARCHAR"/>
- <result property="jqenddate" column="jqenddate" jdbcType="VARCHAR"/>
- <result property="systartdate" column="systartdate" jdbcType="VARCHAR"/>
- <result property="syenddate" column="syenddate" jdbcType="VARCHAR"/>
- <result property="id" column="id" jdbcType="BIGINT"/>
- <result property="companyId" column="company_id" jdbcType="BIGINT"/>
- <result property="reptxt" column="reptxt" javaType="com.alibaba.fastjson.JSONObject"
- typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler" jdbcType="VARCHAR"/>
- <result property="vehicleAndVesselTax" column="vehicle_and_vessel_tax"
- javaType="com.alibaba.fastjson.JSONObject"
- typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler" jdbcType="VARCHAR"/>
- <result property="inscompany" column="inscompany" jdbcType="VARCHAR"/>
- <result property="jqapplyno" column="jqapplyno" jdbcType="VARCHAR"/>
- <result property="jqpolicyno" column="jqpolicyno" jdbcType="VARCHAR"/>
- <result property="syapplyno" column="syapplyno" jdbcType="VARCHAR"/>
- <result property="sypolicyno" column="sypolicyno" jdbcType="VARCHAR"/>
- <result property="riskinfo" column="riskinfo" javaType="com.alibaba.fastjson.JSONArray"
- typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler" jdbcType="VARCHAR"/>
- <result property="kindinfo" column="kindinfo" javaType="com.alibaba.fastjson.JSONArray"
- typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler" jdbcType="VARCHAR"/>
- <result property="jqpremium" column="jqpremium" jdbcType="DECIMAL"/>
- <result property="sypremium" column="sypremium" jdbcType="DECIMAL"/>
- <result property="jypremium" column="jypremium" jdbcType="DECIMAL"/>
- <result property="taxamount" column="taxamount" jdbcType="DECIMAL"/>
- <result property="sumpremium" column="sumpremium" jdbcType="DECIMAL"/>
- <result property="jqdiscountrate" column="jqdiscountrate" jdbcType="DOUBLE"/>
- <result property="sydiscountrate" column="sydiscountrate" jdbcType="DOUBLE"/>
- <result property="feerate" column="feerate" jdbcType="DOUBLE"/>
- <result property="disrate" column="disrate" jdbcType="DOUBLE"/>
- <result property="auditid" column="auditid" jdbcType="VARCHAR"/>
- <result property="auditname" column="auditname" jdbcType="VARCHAR"/>
- <result property="audittime" column="audittime" jdbcType="TIMESTAMP"/>
- <result property="auditopinion" column="auditopinion" jdbcType="VARCHAR"/>
- <result property="jqappoint" column="jqappoint" jdbcType="VARCHAR"/>
- <result property="syappoint" column="syappoint" jdbcType="VARCHAR"/>
- <result property="createtime" column="createtime" jdbcType="TIMESTAMP"/>
- <result property="paymentLink" column="payment_link" jdbcType="VARCHAR"/>
- <result property="accidentInfo" column="accident_info" javaType="com.alibaba.fastjson.JSONArray"
- typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler" jdbcType="VARCHAR"/>
- <result property="taxArrears" column="tax_arrears" javaType="com.alibaba.fastjson.JSONArray"
- typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler" jdbcType="VARCHAR"/>
- <result property="crossInsurance" column="cross_insurance" javaType="com.alibaba.fastjson.JSONArray"
- typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler" jdbcType="VARCHAR"/>
- <result property="ubiPredictedInfoScore" column="ubi_predicted_info_score" jdbcType="VARCHAR"/>
- <result property="mergeCostRate" column="merge_cost_rate" jdbcType="VARCHAR"/>
- <result property="signingTime" column="signingTime" jdbcType="TIMESTAMP"/>
- <result property="payDate" column="payDate" jdbcType="TIMESTAMP"/>
- <result property="partnerCompaniesName" column="partnerCompaniesName" jdbcType="VARCHAR"/>
- <result property="mergecostrate" column="mergecostrate" jdbcType="DOUBLE"/>
- </resultMap>
- <resultMap id="OrderExcelResultMap" type="com.ydtech.modules.ins.model.InsOrdersExcel">
- <id property="orderNo" column="orderno" jdbcType="VARCHAR"/>
- <result property="licenseNo" column="licenseno" jdbcType="VARCHAR"/>
- <result property="fraMeno" column="frameno" jdbcType="VARCHAR"/>
- <result property="carInfo" column="carinfo" javaType="com.alibaba.fastjson.JSONObject" typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler" jdbcType="VARCHAR"/>
- <result property="score" column="score" jdbcType="VARCHAR"/>
- <result property="ownerInfo" column="ownerinfo" javaType="com.alibaba.fastjson.JSONObject" typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler" jdbcType="VARCHAR"/>
- <result property="jqpRemIum" column="jqpremium" jdbcType="VARCHAR"/>
- <result property="apiType" column="api_type" jdbcType="VARCHAR"/>
- <result property="jqPolicyno" column="jqpolicyno" jdbcType="VARCHAR"/>
- <result property="sypRemIum" column="sypremium" jdbcType="VARCHAR"/>
- <result property="syPolicyno" column="sypolicyno" jdbcType="VARCHAR"/>
- <result property="jypRemIum" column="jypremium" jdbcType="VARCHAR"/>
- <result property="taxaMount" column="taxamount" jdbcType="VARCHAR"/>
- <result property="jqStartDate" column="jq_start_date" jdbcType="VARCHAR"/>
- <result property="jqEndDate" column="jq_end_date" jdbcType="VARCHAR"/>
- <result property="syStartDate" column="sy_start_date" jdbcType="VARCHAR"/>
- <result property="syEndDate" column="sy_end_date" jdbcType="VARCHAR"/>
- <result property="jqScore" column="jq_score" jdbcType="VARCHAR"/>
- <result property="syScore" column="sy_score" jdbcType="VARCHAR"/>
- <result property="lossRation" column="loss_ration" jdbcType="VARCHAR"/>
- <result property="jqLossRation" column="jq_loss_ration" jdbcType="VARCHAR"/>
- <result property="syLossRation" column="sy_loss_ration" jdbcType="VARCHAR"/>
- <result property="insCompany" column="inscompany" jdbcType="VARCHAR"/>
- <result property="agreementId" column="agreement_id" jdbcType="VARCHAR"/>
- <result property="userId" column="userid" jdbcType="VARCHAR"/>
- <result property="userName" column="username" jdbcType="VARCHAR"/>
- <result property="applyInfo" column="applyinfo" javaType="com.alibaba.fastjson.JSONObject"
- typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler" jdbcType="VARCHAR"/>
- <result property="insureInfo" column="insureinfo" javaType="com.alibaba.fastjson.JSONObject"
- typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler" jdbcType="VARCHAR"/>
- <result property="kindInfo" column="kindinfo" javaType="com.alibaba.fastjson.JSONArray"
- typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler" jdbcType="VARCHAR"/>
- <result property="payDate" column="pay_date" jdbcType="VARCHAR"/>
- <result property="signingTime" column="signing_time" jdbcType="VARCHAR"/>
- <result property="crossInsurance" column="cross_insurance" javaType="com.alibaba.fastjson.JSONArray"
- typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler" jdbcType="VARCHAR"/>
- <result property="product" column="product" jdbcType="VARCHAR"/>
- <result property="jqBusinessType" column="jq_business_type" jdbcType="VARCHAR"/>
- <result property="syBusinessType" column="sy_business_type" jdbcType="VARCHAR"/>
- </resultMap>
- <sql id="Base_Column_List">
- orderno,quoteno,orderstatus,
- carinfo,userid,username,
- deptid,deptname,ownerinfo,
- applyinfo,insureinfo,agreeid,
- productid,product,createtime,
- frameno,licenseno,insuredname,
- jqstartdate,jqenddate,systartdate,
- syenddate
- </sql>
- <select id="getOrderAndAreaCompany" parameterType="java.lang.String" resultMap="OrderResultMap">
- select o.orderno,
- o.quoteno,
- o.carinfo,
- o.userid,
- o.username,
- o.deptid,
- o.deptname,
- o.ownerinfo,
- o.applyinfo,
- o.insureinfo,
- o.agreeid,
- iac.productid,
- iac.product,
- o.frameno,
- o.licenseno,
- o.insuredname,
- o.vehicle_and_vessel_tax,
- o.is_external,
- iac.jq_start_date as jqstartdate,
- iac.jq_end_date as jqenddate,
- iac.sy_start_date as systartdate,
- iac.sy_end_date as syenddate,
- iac.id,
- iac.api_type,
- iac.company_id,
- iac.reptxt,
- iac.orderstatus,
- iac.inscompany,
- iac.jqapplyno,
- iac.jqpolicyno,
- iac.syapplyno,
- iac.sypolicyno,
- iac.riskinfo,
- iac.kindinfo,
- iac.jqpremium,
- iac.sypremium,
- iac.jypremium,
- iac.taxamount,
- iac.sumpremium,
- iac.jqdiscountrate,
- iac.sydiscountrate,
- iac.feerate,
- iac.disrate,
- iac.auditid,
- iac.auditname,
- iac.audittime,
- iac.auditopinion,
- iac.jqappoint,
- iac.syappoint,
- iac.createtime,
- iac.payment_link,
- iac.accident_info,
- iac.tax_arrears,
- iac.cross_insurance,
- iac.ubi_predicted_info_score,
- iac.merge_cost_rate,
- iac.signing_time as signingTime,
- iac.pay_date as payDate,
- iac.agreement_id,
- o.entry_status,
- eic.namesimple as partnerCompaniesName,
- iac.merge_cost_rate
- from ins_orders as o
- join ins_area_company iac on o.orderno = iac.orderno
- LEFT JOIN ptl_agreement pa ON pa.id = iac.agreement_id
- LEFT JOIN esm_ins_company eic on eic.id = pa.partner_companies_id
- where iac.id = #{companyId}
- </select>
- <select id="getByUseridAndLicenseNo" resultType="com.ydtech.modules.order.entity.InsOrders"
- parameterType="com.ydtech.modules.order.entity.vo.VerifyOrdersVo">
- select orderno,
- quoteno,
- orderstatus,
- carinfo,
- userid,
- username,
- deptid,
- deptname,
- ownerinfo,
- applyinfo,
- insureinfo,
- agreeid,
- productid,
- product,
- createtime,
- frameno,
- licenseno,
- insuredname,
- jqstartdate,
- jqenddate,
- systartdate,
- syenddate,
- risk,
- king,
- vehicle_and_vessel_tax
- from ins_orders
- where userid = #{userId, jdbcType=VARCHAR}
- and licenseno = #{licenseNo, jdbcType=VARCHAR}
- and createtime > DATE_SUB(CURDATE(), INTERVAL 6 MONTH)
- </select>
- <select id="queryPageOrderCount" resultType="Long">
- select
- count(1)
- from (
- select
- io.orderno
- from
- ins_orders io
- <!--如果存在 公司查询则进行连表 -->
- <if test="orderQueryVo.companyId != null and orderQueryVo.companyId != ''">
- left JOIN
- ins_area_company iac on iac.orderno = io.orderno
- </if>
- <where>
- and (io.del_flag IS NULL
- or io.del_flag = 1)
- <if test="orderQueryVo.orderNo != null and orderQueryVo.orderNo != ''">
- and io.orderno = #{orderQueryVo.orderNo}
- </if>
- <if test="orderQueryVo.deptId != null and orderQueryVo.deptId != ''">
- and io.deptid like "${orderQueryVo.deptId}%"
- </if>
- <if test="orderQueryVo.orderStatus != null and orderQueryVo.orderStatus != ''">
- and io.orderstatus = #{orderQueryVo.orderStatus}
- </if>
- <if test="orderQueryVo.frameNo != null and orderQueryVo.frameNo != ''">
- and io.frameno = #{orderQueryVo.frameNo}
- </if>
- <if test="orderQueryVo.licenseNo != null and orderQueryVo.licenseNo != ''">
- and io.licenseno = #{orderQueryVo.licenseNo}
- </if>
- <if test="orderQueryVo.insuredName != null and orderQueryVo.insuredName != ''">
- and io.insuredname = #{orderQueryVo.insuredName}
- </if>
- <if test="orderQueryVo.startDate != null and orderQueryVo.endDate != null">
- and DATE_FORMAT(io.createtime, '%Y-%m-%d') between #{orderQueryVo.startDate} AND #{orderQueryVo.endDate}
- </if>
- <if test="orderQueryVo.companyId != null and orderQueryVo.companyId != ''">
- and iac.company_id = #{orderQueryVo.companyId}
- </if>
- <!--
- <if test="orderQueryVo.userId != null and orderQueryVo.userId != '' and isCdy">
- and io.operatorid = #{orderQueryVo.userId}
- </if>
- -->
- <choose>
- <when test="isCdy">
- <if test="deptId != null and deptId != '' ">
- and io.deptid like "${deptId}%"
- </if>
- </when>
- <when test="isDxFlag">
- <if test="orderQueryVo.userId != null and orderQueryVo.userId != '' ">
- and io.userid in ( select id from sys_user where manager_id = #{orderQueryVo.userId} or id =
- #{orderQueryVo.userId} )
- </if>
- </when>
- <otherwise>
- <if test="orderQueryVo.userId != null and orderQueryVo.userId != '' and !isTeamLeader">
- and io.userid = #{orderQueryVo.userId}
- </if>
- </otherwise>
- </choose>
- </where>
- group by io.orderno
- ) as s
- </select>
- <select id="queryPageOrder" resultMap="BaseResultMap">
- select
- io.*
- from
- ins_orders io
- <!--如果存在 公司查询则进行连表 -->
- <if test="orderQueryVo.companyId != null and orderQueryVo.companyId != ''">
- left JOIN
- ins_area_company iac on iac.orderno = io.orderno
- </if>
- <where>
- and (io.del_flag IS NULL
- or io.del_flag = 1)
- <if test="orderQueryVo.orderNo != null and orderQueryVo.orderNo != ''">
- and io.orderno = #{orderQueryVo.orderNo}
- </if>
- <if test="orderQueryVo.deptId != null and orderQueryVo.deptId != ''">
- and io.deptid like "${orderQueryVo.deptId}%"
- </if>
- <if test="orderQueryVo.orderStatus != null and orderQueryVo.orderStatus != ''">
- and io.orderstatus = #{orderQueryVo.orderStatus}
- </if>
- <if test="orderQueryVo.frameNo != null and orderQueryVo.frameNo != ''">
- and io.frameno = #{orderQueryVo.frameNo}
- </if>
- <if test="orderQueryVo.licenseNo != null and orderQueryVo.licenseNo != ''">
- and io.licenseno = #{orderQueryVo.licenseNo}
- </if>
- <if test="orderQueryVo.insuredName != null and orderQueryVo.insuredName != ''">
- and io.insuredname = #{orderQueryVo.insuredName}
- </if>
- <if test="orderQueryVo.startDate != null and orderQueryVo.endDate != null">
- and DATE_FORMAT(io.createtime, '%Y-%m-%d') between #{orderQueryVo.startDate} AND #{orderQueryVo.endDate}
- </if>
- <if test="orderQueryVo.companyId != null and orderQueryVo.companyId != ''">
- and iac.company_id = #{orderQueryVo.companyId}
- </if>
- <if test="orderQueryVo.product != null and orderQueryVo.product != ''">
- and io.product = #{orderQueryVo.product}
- </if>
- <if test="orderQueryVo.productid != null and orderQueryVo.productid != ''">
- and io.productid = #{orderQueryVo.productid}
- </if>
- <!--
- <if test="orderQueryVo.userId != null and orderQueryVo.userId != '' and isCdy">
- and io.operatorid = #{orderQueryVo.userId}
- </if>
- -->
- <choose>
- <when test="isCdy">
- <if test="deptId != null and deptId != '' ">
- and io.deptid like "${deptId}%"
- </if>
- </when>
- <when test="isDxFlag">
- <if test="orderQueryVo.userId != null and orderQueryVo.userId != '' ">
- and io.userid in ( select id from sys_user where manager_id = #{orderQueryVo.userId} or id =
- #{orderQueryVo.userId} )
- </if>
- </when>
- <otherwise>
- <if test="orderQueryVo.userId != null and orderQueryVo.userId != '' and !isTeamLeader">
- and io.userid = #{orderQueryVo.userId}
- </if>
- </otherwise>
- </choose>
- </where>
- group by
- orderno
- order by io.createtime desc
- </select>
- <select id="queryOrderList" parameterType="com.ydtech.modules.ins.model.InsOrdersExcelVo" resultMap="OrderExcelResultMap">
- select
- a.orderno,
- a.licenseno,
- a.frameno,
- a.carinfo,
- b.api_type,
- b.score,
- a.ownerinfo,
- b.jqpremium,
- b.jqpolicyno,
- b.sypremium,
- b.sypolicyno,
- b.jypremium,
- b.taxamount,
- b.jq_start_date,
- b.jq_end_date,
- b.sy_start_date,
- b.sy_end_date,
- b.score,
- b.jq_score,
- b.sy_score,
- b.loss_ration,
- b.jq_loss_ration,
- b.sy_loss_ration,
- b.score,
- b.inscompany,
- b.agreement_id,
- a.userid,
- a.username,
- a.applyinfo,
- a.insureinfo,
- b.kindinfo,
- b.pay_date,
- b.signing_time,
- b.cross_insurance,
- b.product,
- b.jq_renewal,
- CASE WHEN b.jq_renewal = '0'THEN '转保' WHEN b.jq_renewal = '1'THEN '续保' END AS jq_business_type,
- CASE WHEN b.sy_renewal = '0'THEN '转保' WHEN b.jq_renewal = '1'THEN '续保' END AS sy_business_type
- FROM ins_orders a LEFT JOIN ins_area_company b on a.orderno = b.orderno
- WHERE
- 1 = 1
- <if test="orderstatus != null and orderstatus != '' ">
- and b.orderstatus = #{orderstatus}
- </if>
- <if test="startDate != null ">
- and b.signing_time >= #{startDate}
- </if>
- <if test="endDate != null ">
- and b.signing_time <= #{endDate}
- </if>
- </select>
- <resultMap id="PolicyInsuranceReportMap" type="com.ydtech.modules.order.entity.vo.PolicyInsuranceReportResVo">
- <result property="insCompany" column="insCompany" jdbcType="VARCHAR"/>
- <result property="agreementName" column="agreementName" jdbcType="VARCHAR"/>
- <result property="policyNo" column="policyNo" jdbcType="VARCHAR"/>
- <result property="quoteDate" column="quoteDate" jdbcType="VARCHAR"/>
- <result property="policyStartDate" column="policyStartDate" jdbcType="VARCHAR"/>
- <result property="riskName" column="riskName" jdbcType="VARCHAR"/>
- <result property="sumPremium" column="sumPremium" jdbcType="DECIMAL"/>
- <result property="taxPremium" column="taxPremium" jdbcType="DECIMAL"/>
- <result property="taxLaterPremium" column="taxLaterPremium" jdbcType="DECIMAL"/>
- <result property="insuranceSubAmount" column="insuranceSubAmount" jdbcType="VARCHAR"/>
- <result property="licenseNo" column="licenseNo" jdbcType="VARCHAR"/>
- <result property="vehicleUse" column="vehicleUse" jdbcType="VARCHAR"/>
- <result property="powerType" column="powerType" jdbcType="VARCHAR"/>
- <result property="ciModelClass" column="ciModelClass" jdbcType="VARCHAR"/>
- <result property="limitLoad" column="limitLoad" jdbcType="VARCHAR"/>
- <result property="appliName" column="appliName" jdbcType="VARCHAR"/>
- <result property="insureName" column="insureName" jdbcType="VARCHAR"/>
- <result property="deptName" column="deptName" jdbcType="VARCHAR"/>
- <result property="userName" column="username" jdbcType="VARCHAR"/>
- </resultMap>
- <select id="getPolicyInsuranceReport" resultMap="PolicyInsuranceReportMap">
- /*交强数据*/
- SELECT a.`inscompany` AS insCompany,
- (SELECT agreement_name FROM ptl_agreement t WHERE t.`id`= a.`agreement_id`) AS agreementName,
- a.`jqpolicyno` AS policyNo,
- <if test="policyReqVo.queryFlag=='queryPayDate'.toString()">
- a.pay_date AS quoteDate,
- </if>
- <if test="policyReqVo.queryFlag=='queryPayTime'.toString()">
- a.inside_pay_time AS quoteDate,
- </if>
- a.`jq_start_date` AS policyStartDate,
- '交强险' AS riskName,
- a.`jqpremium` AS sumPremium,
- a.`taxamount` AS taxPremium,
- getCarShipLateFee(a.`id`) AS taxLaterPremium,
- '交强险 : 200000.00,' AS insuranceSubAmount,
- b.`licenseno` AS licenseNo,
- getCodeName(REPLACE(JSON_EXTRACT(b.carinfo, '$.vehicleUse'),'"',''),'3') AS vehicleUse,
- getCodeName(REPLACE(JSON_EXTRACT(b.carinfo, '$.powertype'),'"',''),'2') AS powerType,
- getCodeName(REPLACE(JSON_EXTRACT(b.carinfo, '$.cimodelclass'),'"',''),'4') AS ciModelClass,
- REPLACE(JSON_EXTRACT(b.carinfo, '$.limitLoad'),'"','') AS limitLoad,
- REPLACE(JSON_EXTRACT(applyinfo, '$.name'),'"','') AS appliName,
- REPLACE(JSON_EXTRACT(insureinfo, '$.name'),'"','') AS insureName,
- b.`deptname` AS deptName,
- b.`username` AS userName
- FROM ins_area_company a,ins_orders b WHERE a.`jqpolicyno` IS NOT NULL AND a.`jqpolicyno`!='' AND a.`agreement_id` IS NOT NULL
- AND a.`orderno`=b.`orderno`
- <if test="policyReqVo.deptId != null and policyReqVo.deptId != ''">
- and b.deptid = #{policyReqVo.deptId}
- </if>
- <if test="policyReqVo.userId != null and policyReqVo.userId != ''">
- and b.userid = #{policyReqVo.userId}
- </if>
- <if test="policyReqVo.userName != null and policyReqVo.userName != ''">
- and b.username = #{policyReqVo.userName}
- </if>
- <if test="policyReqVo.appliName != null and policyReqVo.appliName != ''">
- and REPLACE(JSON_EXTRACT(applyinfo, '$.name'),'"','') = #{policyReqVo.appliName}
- </if>
- <if test="policyReqVo.insureName != null and policyReqVo.insureName != ''">
- and REPLACE(JSON_EXTRACT(insureinfo, '$.name'),'"','') = #{policyReqVo.insureName}
- </if>
- <if test="policyReqVo.productId != null and policyReqVo.productId != ''">
- and b.productid = #{policyReqVo.productId}
- </if>
- <if test="policyReqVo.insCompany != null and policyReqVo.insCompany != ''">
- and a.company_id = #{policyReqVo.insCompany}
- </if>
- <if test="policyReqVo.operatorId != null and policyReqVo.operatorId != ''">
- and a.operatorid = #{policyReqVo.operatorId}
- </if>
- <if test="policyReqVo.quoteStartDate != null and policyReqVo.quoteEndDate != null">
- <if test="policyReqVo.queryFlag=='queryPayDate'.toString()">
- and a.pay_date between #{policyReqVo.quoteStartDate} AND #{policyReqVo.quoteEndDate}
- </if>
- <if test="policyReqVo.queryFlag=='queryPayTime'.toString()">
- and a.inside_pay_time between #{policyReqVo.quoteStartDate} AND #{policyReqVo.quoteEndDate}
- </if>
- </if>
- <if test="policyReqVo.policyStartDate != null and policyReqVo.policyEndDate != null">
- and a.jq_start_date between #{policyReqVo.policyStartDate} AND #{policyReqVo.policyEndDate}
- </if>
- UNION ALL
- /*##商业数据*/
- SELECT a.`inscompany` AS insCompany,
- (SELECT agreement_name FROM ptl_agreement t WHERE t.`id`= a.`agreement_id`) AS agreementName,
- a.`sypolicyno` AS policyNo,
- <if test="policyReqVo.queryFlag=='queryPayDate'.toString()">
- a.pay_date AS quoteDate,
- </if>
- <if test="policyReqVo.queryFlag=='queryPayTime'.toString()">
- a.inside_pay_time AS quoteDate,
- </if>
- a.`sy_start_date` AS policyStartDate,
- '商业险' AS riskName,
- a.`sypremium` AS sumPremium,
- '' AS taxPremium,
- '' AS taxLaterPremium,
- getSyAmount(a.`orderno`) AS insuranceSubAmount,
- b.`licenseno` AS licenseNo,
- getCodeName(REPLACE(JSON_EXTRACT(b.carinfo, '$.vehicleUse'),'"',''),'3') AS vehicleUse,
- getCodeName(REPLACE(JSON_EXTRACT(b.carinfo, '$.powertype'),'"',''),'2') AS powerType,
- getCodeName(REPLACE(JSON_EXTRACT(b.carinfo, '$.cimodelclass'),'"',''),'4') AS ciModelClass,
- REPLACE(JSON_EXTRACT(b.carinfo, '$.limitLoad'),'"','') AS limitLoad,
- REPLACE(JSON_EXTRACT(applyinfo, '$.name'),'"','') AS appliName,
- REPLACE(JSON_EXTRACT(insureinfo, '$.name'),'"','') AS insureName,
- b.`deptname` AS deptName,
- b.`username` AS userName
- FROM ins_area_company a,ins_orders b WHERE a.`sypolicyno` IS NOT NULL AND a.`syapplyno`!='' AND a.`agreement_id` IS NOT NULL
- AND a.`orderno`=b.`orderno`
- <if test="policyReqVo.deptId != null and policyReqVo.deptId != ''">
- and b.deptid = #{policyReqVo.deptId}
- </if>
- <if test="policyReqVo.userId != null and policyReqVo.userId != ''">
- and b.userid = #{policyReqVo.userId}
- </if>
- <if test="policyReqVo.userName != null and policyReqVo.userName != ''">
- and b.username = #{policyReqVo.userName}
- </if>
- <if test="policyReqVo.appliName != null and policyReqVo.appliName != ''">
- and REPLACE(JSON_EXTRACT(applyinfo, '$.name'),'"','') = #{policyReqVo.appliName}
- </if>
- <if test="policyReqVo.insureName != null and policyReqVo.insureName != ''">
- and REPLACE(JSON_EXTRACT(insureinfo, '$.name'),'"','') = #{policyReqVo.insureName}
- </if>
- <if test="policyReqVo.productId != null and policyReqVo.productId != ''">
- and b.productid = #{policyReqVo.productId}
- </if>
- <if test="policyReqVo.insCompany != null and policyReqVo.insCompany != ''">
- and a.company_id = #{policyReqVo.insCompany}
- </if>
- <if test="policyReqVo.operatorId != null and policyReqVo.operatorId != ''">
- and a.operatorid = #{policyReqVo.operatorId}
- </if>
- <if test="policyReqVo.quoteStartDate != null and policyReqVo.quoteEndDate != null">
- <if test="policyReqVo.queryFlag=='queryPayDate'.toString()">
- and a.pay_date between #{policyReqVo.quoteStartDate} AND #{policyReqVo.quoteEndDate}
- </if>
- <if test="policyReqVo.queryFlag=='queryPayTime'.toString()">
- and a.inside_pay_time between #{policyReqVo.quoteStartDate} AND #{policyReqVo.quoteEndDate}
- </if>
- </if>
- <if test="policyReqVo.policyStartDate != null and policyReqVo.policyEndDate != null">
- and a.sy_start_date between #{policyReqVo.policyStartDate} AND #{policyReqVo.policyEndDate}
- </if>
- </select>
- <select id="getPolicyInsuranceReportCount" resultType="Long">
- select
- count(1)
- from (
- /*交强数据*/
- SELECT a.`inscompany` AS insCompany,
- (SELECT agreement_name FROM ptl_agreement t WHERE t.`id`= a.`agreement_id`) AS agreementName,
- a.`jqpolicyno` AS policyNo,
- <if test="policyReqVo.queryFlag=='queryPayDate'.toString()">
- a.pay_date AS quoteDate,
- </if>
- <if test="policyReqVo.queryFlag=='queryPayTime'.toString()">
- a.inside_pay_time AS quoteDate,
- </if>
- a.`jq_start_date` AS policyStartDate,
- '交强险' AS riskName,
- a.`jqpremium` AS sumPremium,
- a.`taxamount` AS taxPremium,
- getCarShipLateFee(a.`id`) AS taxLaterPremium,
- '交强险 : 200000.00,' AS insuranceSubAmount,
- b.`licenseno` AS licenseNo,
- getCodeName(REPLACE(JSON_EXTRACT(b.carinfo, '$.vehicleUse'),'"',''),'3') AS vehicleUse,
- getCodeName(REPLACE(JSON_EXTRACT(b.carinfo, '$.powertype'),'"',''),'2') AS powerType,
- getCodeName(REPLACE(JSON_EXTRACT(b.carinfo, '$.cimodelclass'),'"',''),'4') AS ciModelClass,
- REPLACE(JSON_EXTRACT(b.carinfo, '$.limitLoad'),'"','') AS limitLoad,
- REPLACE(JSON_EXTRACT(applyinfo, '$.name'),'"','') AS appliName,
- REPLACE(JSON_EXTRACT(insureinfo, '$.name'),'"','') AS insureName,
- b.`deptname` AS deptName,
- b.`username` AS userName
- FROM ins_area_company a,ins_orders b WHERE a.`jqpolicyno` IS NOT NULL AND a.`jqpolicyno`!='' AND a.`agreement_id` IS NOT NULL
- AND a.`orderno`=b.`orderno`
- <if test="policyReqVo.deptId != null and policyReqVo.deptId != ''">
- and b.deptid = #{policyReqVo.deptId}
- </if>
- <if test="policyReqVo.userId != null and policyReqVo.userId != ''">
- and b.userid = #{policyReqVo.userId}
- </if>
- <if test="policyReqVo.userName != null and policyReqVo.userName != ''">
- and b.username = #{policyReqVo.userName}
- </if>
- <if test="policyReqVo.appliName != null and policyReqVo.appliName != ''">
- and REPLACE(JSON_EXTRACT(applyinfo, '$.name'),'"','') = #{policyReqVo.appliName}
- </if>
- <if test="policyReqVo.insureName != null and policyReqVo.insureName != ''">
- and REPLACE(JSON_EXTRACT(insureinfo, '$.name'),'"','') = #{policyReqVo.insureName}
- </if>
- <if test="policyReqVo.productId != null and policyReqVo.productId != ''">
- and b.productid = #{policyReqVo.productId}
- </if>
- <if test="policyReqVo.insCompany != null and policyReqVo.insCompany != ''">
- and a.company_id = #{policyReqVo.insCompany}
- </if>
- <if test="policyReqVo.operatorId != null and policyReqVo.operatorId != ''">
- and a.operatorid = #{policyReqVo.operatorId}
- </if>
- <if test="policyReqVo.quoteStartDate != null and policyReqVo.quoteEndDate != null">
- <if test="policyReqVo.queryFlag=='queryPayDate'.toString()">
- and a.pay_date between #{policyReqVo.quoteStartDate} AND #{policyReqVo.quoteEndDate}
- </if>
- <if test="policyReqVo.queryFlag=='queryPayTime'.toString()">
- and a.inside_pay_time between #{policyReqVo.quoteStartDate} AND #{policyReqVo.quoteEndDate}
- </if>
- </if>
- <if test="policyReqVo.policyStartDate != null and policyReqVo.policyEndDate != null">
- and a.jq_start_date between #{policyReqVo.policyStartDate} AND #{policyReqVo.policyEndDate}
- </if>
- UNION ALL
- /*##商业数据*/
- SELECT a.`inscompany` AS insCompany,
- (SELECT agreement_name FROM ptl_agreement t WHERE t.`id`= a.`agreement_id`) AS agreementName,
- a.`sypolicyno` AS policyNo,
- <if test="policyReqVo.queryFlag=='queryPayDate'.toString()">
- a.pay_date AS quoteDate,
- </if>
- <if test="policyReqVo.queryFlag=='queryPayTime'.toString()">
- a.inside_pay_time AS quoteDate,
- </if>
- a.`sy_start_date` AS policyStartDate,
- '商业险' AS riskName,
- a.`sypremium` AS sumPremium,
- '' AS taxPremium,
- '' AS taxLaterPremium,
- getSyAmount(a.`orderno`) AS insuranceSubAmount,
- b.`licenseno` AS licenseNo,
- getCodeName(REPLACE(JSON_EXTRACT(b.carinfo, '$.vehicleUse'),'"',''),'3') AS vehicleUse,
- getCodeName(REPLACE(JSON_EXTRACT(b.carinfo, '$.powertype'),'"',''),'2') AS powerType,
- getCodeName(REPLACE(JSON_EXTRACT(b.carinfo, '$.cimodelclass'),'"',''),'4') AS ciModelClass,
- REPLACE(JSON_EXTRACT(b.carinfo, '$.limitLoad'),'"','') AS limitLoad,
- REPLACE(JSON_EXTRACT(applyinfo, '$.name'),'"','') AS appliName,
- REPLACE(JSON_EXTRACT(insureinfo, '$.name'),'"','') AS insureName,
- b.`deptname` AS deptName,
- b.`username` AS userName
- FROM ins_area_company a,ins_orders b WHERE a.`sypolicyno` IS NOT NULL AND a.`syapplyno`!='' AND a.`agreement_id` IS NOT NULL
- AND a.`orderno`=b.`orderno`
- <if test="policyReqVo.deptId != null and policyReqVo.deptId != ''">
- and b.deptid = #{policyReqVo.deptId}
- </if>
- <if test="policyReqVo.userId != null and policyReqVo.userId != ''">
- and b.userid = #{policyReqVo.userId}
- </if>
- <if test="policyReqVo.userName != null and policyReqVo.userName != ''">
- and b.username = #{policyReqVo.userName}
- </if>
- <if test="policyReqVo.appliName != null and policyReqVo.appliName != ''">
- and REPLACE(JSON_EXTRACT(applyinfo, '$.name'),'"','') = #{policyReqVo.appliName}
- </if>
- <if test="policyReqVo.insureName != null and policyReqVo.insureName != ''">
- and REPLACE(JSON_EXTRACT(insureinfo, '$.name'),'"','') = #{policyReqVo.insureName}
- </if>
- <if test="policyReqVo.productId != null and policyReqVo.productId != ''">
- and b.productid = #{policyReqVo.productId}
- </if>
- <if test="policyReqVo.insCompany != null and policyReqVo.insCompany != ''">
- and a.company_id = #{policyReqVo.insCompany}
- </if>
- <if test="policyReqVo.operatorId != null and policyReqVo.operatorId != ''">
- and a.operatorid = #{policyReqVo.operatorId}
- </if>
- <if test="policyReqVo.quoteStartDate != null and policyReqVo.quoteEndDate != null">
- <if test="policyReqVo.queryFlag=='queryPayDate'.toString()">
- and a.pay_date between #{policyReqVo.quoteStartDate} AND #{policyReqVo.quoteEndDate}
- </if>
- <if test="policyReqVo.queryFlag=='queryPayTime'.toString()">
- and a.inside_pay_time between #{policyReqVo.quoteStartDate} AND #{policyReqVo.quoteEndDate}
- </if>
- </if>
- <if test="policyReqVo.policyStartDate != null and policyReqVo.policyEndDate != null">
- and a.sy_start_date between #{policyReqVo.policyStartDate} AND #{policyReqVo.policyEndDate}
- </if>
- ) as s
- </select>
- <update id="updateStatus">
- update ins_orders set orderstatus = #{status} where orderno = #{orderno}
- </update>
- <select id="queryPageHospitalityOrder" resultMap="BaseResultMap">
- select
- io.*,
- iac.orderno
- <if test="orderQueryVo.orderStatus != null and orderQueryVo.orderStatus == 3">
- ,eic.namesimple as partnerCompaniesName
- </if>
- from
- ins_orders io
- left JOIN
- ins_area_company iac on iac.orderno = io.orderno
- LEFT JOIN
- ptl_agreement pa on pa.id = iac.agreement_id
- <if test="orderQueryVo.orderStatus != null and orderQueryVo.orderStatus == 3">
- LEFT JOIN
- esm_ins_company eic on eic.id = pa.partner_companies_id
- </if>
- <where>
- <if test="orderQueryVo.orderNo != null and orderQueryVo.orderNo != ''">
- and io.orderno = #{orderQueryVo.orderNo}
- </if>
- <if test="orderQueryVo.deptId != null and orderQueryVo.deptId != '' ">
- and io.deptid like "${orderQueryVo.deptId}%"
- </if>
- <if test="orderQueryVo.orderStatus != null and orderQueryVo.orderStatus != ''">
- and io.orderstatus = #{orderQueryVo.orderStatus}
- <if test="orderQueryVo.orderStatus != null and orderQueryVo.orderStatus == 3">
- and iac.orderstatus = #{orderQueryVo.orderStatus}
- </if>
- </if>
- <if test="orderQueryVo.frameNo != null and orderQueryVo.frameNo != ''">
- and io.frameno = #{orderQueryVo.frameNo}
- </if>
- <if test="orderQueryVo.licenseNo != null and orderQueryVo.licenseNo != ''">
- and io.licenseno = #{orderQueryVo.licenseNo}
- </if>
- <if test="orderQueryVo.insuredName != null and orderQueryVo.insuredName != ''">
- and io.insuredname = #{orderQueryVo.insuredName}
- </if>
- <if test="orderQueryVo.startDate != null and orderQueryVo.endDate != null">
- and io.createtime between #{orderQueryVo.startDate} AND #{orderQueryVo.endDate}
- </if>
- <if test="orderQueryVo.companyId != null and orderQueryVo.companyId != ''">
- and iac.company_id = #{orderQueryVo.companyId}
- </if>
- <if test="orderQueryVo.userId != null and orderQueryVo.userId != ''">
- and io.userid = #{orderQueryVo.userId}
- </if>
- and (io.del_flag IS NULL
- or io.del_flag = 1)
- </where>
- group by io.orderno
- <if test="orderQueryVo.orderStatus != null and orderQueryVo.orderStatus == 3">
- ,eic.namesimple
- </if>
- order by io.createtime desc
- </select>
- <select id="queryPageHospitalityOrderCount" resultType="Long">
- select
- count(1)
- from (
- select
- io.orderno
- <if test="orderQueryVo.orderStatus != null and orderQueryVo.orderStatus == 3">
- ,eic.namesimple as partnerCompaniesName
- </if>
- from
- ins_orders io
- left JOIN
- ins_area_company iac on iac.orderno = io.orderno
- LEFT JOIN
- ptl_agreement pa on pa.id = iac.agreement_id
- <if test="orderQueryVo.orderStatus != null and orderQueryVo.orderStatus == 3">
- LEFT JOIN
- esm_ins_company eic on eic.id = pa.partner_companies_id
- </if>
- <where>
- <if test="orderQueryVo.orderNo != null and orderQueryVo.orderNo != ''">
- and io.orderno = #{orderQueryVo.orderNo}
- </if>
- <if test="orderQueryVo.deptId != null and orderQueryVo.deptId != '' ">
- and io.deptid like "${orderQueryVo.deptId}%"
- </if>
- <if test="orderQueryVo.orderStatus != null and orderQueryVo.orderStatus != ''">
- and io.orderstatus = #{orderQueryVo.orderStatus}
- <if test="orderQueryVo.orderStatus != null and orderQueryVo.orderStatus == 3">
- and iac.orderstatus = #{orderQueryVo.orderStatus}
- </if>
- </if>
- <if test="orderQueryVo.frameNo != null and orderQueryVo.frameNo != ''">
- and io.frameno = #{orderQueryVo.frameNo}
- </if>
- <if test="orderQueryVo.licenseNo != null and orderQueryVo.licenseNo != ''">
- and io.licenseno = #{orderQueryVo.licenseNo}
- </if>
- <if test="orderQueryVo.insuredName != null and orderQueryVo.insuredName != ''">
- and io.insuredname = #{orderQueryVo.insuredName}
- </if>
- <if test="orderQueryVo.startDate != null and orderQueryVo.endDate != null">
- and io.createtime between #{orderQueryVo.startDate} AND #{orderQueryVo.endDate}
- </if>
- <if test="orderQueryVo.companyId != null and orderQueryVo.companyId != ''">
- and iac.company_id = #{orderQueryVo.companyId}
- </if>
- <if test="orderQueryVo.userId != null and orderQueryVo.userId != ''">
- and io.userid = #{orderQueryVo.userId}
- </if>
- </where>
- group by io.orderno
- <if test="orderQueryVo.orderStatus != null and orderQueryVo.orderStatus == 3">
- ,eic.namesimple
- </if>
- order by io.createtime desc
- ) as s
- </select>
- <select id="queryPageOrderByLinkType" resultMap="BaseResultMap">
- select
- io.orderno as orderno,
- io.quoteno as quoteno,
- iac.orderstatus as orderstatus,
- io.carinfo as carinfo,
- io.userid as userid,
- io.username as username,
- io.deptid as deptid,
- io.deptname as deptname,
- io.ownerinfo as ownerinfo,
- io.applyinfo as applyinfo,
- io.insureinfo as insureinfo,
- io.agreeid as agreeid,
- iac.productid as productid,
- iac.product as product,
- iac.createtime as createtime,
- io.frameno as frameno,
- io.licenseno as licenseno,
- REPLACE(JSON_EXTRACT(io.applyinfo, '$.name'),'"','') as insuredname,
- iac.jq_start_date as jqstartdate,
- iac.jq_end_date as jqenddate,
- iac.sy_start_date as systartdate,
- iac.sy_end_date as syenddate,
- iac.jqpremium as jqpremium,
- iac.sypremium as sypremium,
- iac.jypremium as jypremium,
- iac.taxamount as taxamount,
- io.risk as risk,
- io.king as king,
- io.vehicle_and_vessel_tax as vehicleAndVesselTax,
- iac.id as subOrderId,
- iac.underwriting_status as underwritingStatus,
- iac.company_id as company_id,
- iac.inscompany as ins_company,
- agree.agreement_code as agreementCode,
- agree.agreement_name as agreementName,
- company.namesimple as partnerCompaniesName,
- dept.province,
- dept.city,
- dept.area,
- d1.area_cname as province_name,
- d2.area_cname as city_name,
- d3.area_cname as area_name,
- concat(d1.area_cname,d2.area_cname,d3.area_cname) as area_info,
- iac.api_type,
- io.is_external,
- u.leader_name,
- u.leader_id,
- CASE dept.management_source
- WHEN '1' THEN '渠道'
- WHEN '2' THEN '个代'
- WHEN '3' THEN '电销'
- ELSE '' END
- AS managementSource,
- io.entry_status as entryStatus,
- iac.underwriting_time as underwritingTime,
- iac.pay_date as payDate,
- iac.update_status AS updateStatus,
- iac.update_status_time AS updateStatusTime,
- iac.signing_time as signingTime
- from
- ins_area_company iac
- left JOIN
- ins_orders io on iac.orderno = io.orderno
- left join
- ptl_agreement agree on iac.agreement_id= agree.id
- left join
- esm_ins_company company on agree.partner_companies_id= company.id
- LEFT JOIN
- sys_dept dept ON dept.id = io.deptid
- LEFT JOIN sys_dept pdept on dept.parent_id = pdept.id
- LEFT JOIN sys_area d1 ON d1.area_code = pdept.province
- LEFT JOIN sys_area d2 ON d2.area_code = pdept.city
- LEFT JOIN sys_area d3 ON d3.area_code = pdept.area
- LEFT JOIN
- sys_user u on io.userid = u.id
- <where>
- <if test="agentUserIds != null and agentUserIds.size>0" >
- AND (
- (io.userid in
- <foreach collection="agentUserIds" item="item" open="(" separator="," close=")">
- #{item}
- </foreach>
- AND ( iac.new_operator_id IS NULL OR iac.new_operator_id = #{orderQueryVo.userId} )
- <if test="deptIds != null and deptIds.size>0" >
- AND (
- <foreach collection="deptIds" item="item" open="(" separator="OR" close=")">
- io.deptid like CONCAT('', #{item}, '%')
- </foreach>
- )
- </if>
- )
- <if test="flag" >
- OR iac.operator_id = #{orderQueryVo.userId}
- </if>
- )
- </if>
- <if test="agreeIds != null and agreeIds.size>0">
- AND (
- (iac.company_id in
- <foreach collection="agreeIds" item="item" open="(" separator="," close=")">
- #{item}
- </foreach>
- AND ( iac.new_operator_id IS NULL OR iac.new_operator_id = #{orderQueryVo.userId} ) )
- <if test="flag" >
- OR iac.operator_id = #{orderQueryVo.userId}
- </if>
- )
- </if>
- <if test="orderQueryVo.orderNo != null and orderQueryVo.orderNo != ''">
- and iac.id = #{orderQueryVo.orderNo}
- </if>
- <if test="orderQueryVo.managementSource != null and orderQueryVo.managementSource != ''">
- and dept.management_source = #{orderQueryVo.managementSource}
- </if>
- <if test="orderQueryVo.deptId != null and orderQueryVo.deptId != ''">
- and io.deptid like "${orderQueryVo.deptId}%"
- </if>
- <if test="orderQueryVo.orderStatus != null and orderQueryVo.orderStatus != ''">
- and iac.orderstatus= #{orderQueryVo.orderStatus}
- </if>
- <if test="orderQueryVo.frameNo != null and orderQueryVo.frameNo != ''">
- and io.frameno = #{orderQueryVo.frameNo}
- </if>
- <if test="orderQueryVo.licenseNo != null and orderQueryVo.licenseNo != ''">
- and io.licenseno = #{orderQueryVo.licenseNo}
- </if>
- <if test="orderQueryVo.insuredName != null and orderQueryVo.insuredName != ''">
- and REPLACE(JSON_EXTRACT(io.applyinfo, '$.name'),'"','') = #{orderQueryVo.insuredName}
- </if>
- <if test="orderQueryVo.quoteStartDateStr != null and orderQueryVo.quoteEndDateStr != null">
- and iac.createtime >= #{orderQueryVo.quoteStartDateStr} AND iac.createtime <![CDATA[ <= ]]> #{orderQueryVo.quoteEndDateStr}
- </if>
- <if test="orderQueryVo.companyId != null and orderQueryVo.companyId != ''">
- and iac.company_id = #{orderQueryVo.companyId}
- </if>
- <if test="orderQueryVo.operatorId != null and orderQueryVo.operatorId != ''">
- and io.userid = #{orderQueryVo.operatorId}
- </if>
- <if test="orderQueryVo.operatorName != null and orderQueryVo.operatorName != ''">
- and io.username = #{orderQueryVo.operatorName}
- </if>
- <if test="orderQueryVo.engineNo != null and orderQueryVo.engineNo != ''">
- and JSON_EXTRACT( io.carinfo, '$.engineNo' ) = #{orderQueryVo.engineNo}
- </if>
- <if test="orderQueryVo.provinceId != null and orderQueryVo.provinceId != ''">
- and io.deptid like "${orderQueryVo.provinceId}%"
- </if>
- <if test="orderQueryVo.cityId != null and orderQueryVo.cityId != ''">
- and io.deptid like "${orderQueryVo.cityId}%"
- </if>
- <if test="orderQueryVo.countyId != null and orderQueryVo.countyId != ''">
- and io.deptid like "${orderQueryVo.countyId}%"
- </if>
- <if test="orderQueryVo.houseId != null and orderQueryVo.houseId != ''">
- and io.deptid like "${orderQueryVo.houseId}%"
- </if>
- <if test="orderQueryVo.agreeId != null and orderQueryVo.agreeId != ''">
- and iac.agreement_id = #{orderQueryVo.agreeId}
- </if>
- <if test="orderQueryVo.taskNo != null and orderQueryVo.taskNo != ''">
- and io.orderno = #{orderQueryVo.taskNo}
- </if>
- <if test="orderQueryVo.riskCode != null and orderQueryVo.riskCode != ''">
- and iac.product = #{orderQueryVo.riskCode}
- </if>
- <if test="orderQueryVo.auditId != null and orderQueryVo.auditId != ''">
- and IFNULL( iac.new_operator_id, '' ) = #{orderQueryVo.auditId}
- </if>
- <if test="orderQueryVo.leaderId != null and orderQueryVo.leaderId != ''">
- and u.leader_id = #{orderQueryVo.leaderId}
- </if>
- <if test="orderQueryVo.leaderName != null and orderQueryVo.leaderName != ''">
- and u.leader_name = #{orderQueryVo.leaderName}
- </if>
- <if test="orderQueryVo.attachStartDateStr != null and orderQueryVo.attachEndDateStr != ''">
- and ((
- DATE_FORMAT(iac.jq_start_date, '%Y-%m-%d') BETWEEN #{orderQueryVo.attachStartDateStr}
- AND #{orderQueryVo.attachEndDateStr}
- )
- OR ( DATE_FORMAT(iac.sy_start_date, '%Y-%m-%d') BETWEEN #{orderQueryVo.attachStartDateStr} AND #{orderQueryVo.attachEndDateStr} )
- )
- </if>
- <choose>
- <when test="type==1">
- and dept.management_source=1
- </when>
- <when test="type==2">
- and dept.management_source=2
- </when>
- </choose>
- <if test="orderQueryVo.signStartDateStr != null and orderQueryVo.signEndDateStr != null">
- and iac.signing_time >= #{orderQueryVo.signStartDateStr} AND iac.signing_time <![CDATA[ <= ]]> #{orderQueryVo.signEndDateStr}
- </if>
- <if test="orderQueryVo.entryStatus != null and orderQueryVo.entryStatus != ''">
- and io.entry_status = #{orderQueryVo.entryStatus }
- </if>
- <if test="orderQueryVo.payStartDateStr != null and orderQueryVo.payEndDateStr != null">
- and DATE_FORMAT(iac.pay_date, '%Y-%m-%d') between #{orderQueryVo.payStartDateStr} AND #{orderQueryVo.payEndDateStr}
- </if>
- <if test="orderQueryVo.auditStartDateStr != null and orderQueryVo.auditEndDateStr != null">
- and DATE_FORMAT(iac.underwriting_time, '%Y-%m-%d') between #{orderQueryVo.auditStartDateStr} AND #{orderQueryVo.auditEndDateStr}
- </if>
- <if test="orderQueryVo.updateStartDateStr != null and orderQueryVo.updateEndDateStr != null">
- and DATE_FORMAT( iac.update_status_time, '%Y-%m-%d') between #{orderQueryVo.updateStartDateStr} AND #{orderQueryVo.updateEndDateStr}
- </if>
- <if test="orderQueryVo.updateStatus != null and orderQueryVo.updateStatus != null">
- and iac.update_status = #{orderQueryVo.updateStatus}
- </if>
- <if test="orderQueryVo.partnerCompaniesId != null and orderQueryVo.partnerCompaniesId != null">
- and agree.partner_companies_id = #{orderQueryVo.partnerCompaniesId}
- </if>
- and (iac.del_flag = '1' or io.del_flag IS NULL or io.del_flag = 1)
- </where>
- order by io.createtime desc
- </select>
- <select id="queryPageOrderByLinkTypeCount" resultType="Long">
- select
- count(1)
- from (
- select
- (0)
- from
- ins_area_company iac
- left JOIN
- ins_orders io on iac.orderno = io.orderno
- LEFT JOIN
- sys_dept dept ON dept.id = io.deptid
- LEFT JOIN
- sys_user u on io.userid = u.id
- left join
- ptl_agreement agree on iac.agreement_id= agree.id
- left join
- esm_ins_company company on agree.partner_companies_id= company.id
- <where>
- <if test="agentUserIds != null and agentUserIds.size>0" >
- AND (
- (io.userid in
- <foreach collection="agentUserIds" item="item" open="(" separator="," close=")">
- #{item}
- </foreach>
- AND ( iac.new_operator_id IS NULL OR iac.new_operator_id = #{orderQueryVo.userId} )
- <if test="deptIds != null and deptIds.size>0" >
- AND (
- <foreach collection="deptIds" item="item" open="(" separator="OR" close=")">
- io.deptid like CONCAT('', #{item}, '%')
- </foreach>
- )
- </if>
- )
- <if test="flag" >
- OR iac.operator_id = #{orderQueryVo.userId}
- </if>
- )
- </if>
- <if test="agreeIds != null and agreeIds.size>0">
- AND (
- (iac.company_id in
- <foreach collection="agreeIds" item="item" open="(" separator="," close=")">
- #{item}
- </foreach>
- AND ( iac.new_operator_id IS NULL OR iac.new_operator_id = #{orderQueryVo.userId} ) )
- <if test="flag" >
- OR iac.operator_id = #{orderQueryVo.userId}
- </if>
- )
- </if>
- <if test="orderQueryVo.orderNo != null and orderQueryVo.orderNo != ''">
- and iac.id = #{orderQueryVo.orderNo}
- </if>
- <if test="orderQueryVo.managementSource != null and orderQueryVo.managementSource != ''">
- and dept.management_source = #{orderQueryVo.managementSource}
- </if>
- <if test="orderQueryVo.deptId != null and orderQueryVo.deptId != ''">
- and io.deptid like "${orderQueryVo.deptId}%"
- </if>
- <if test="orderQueryVo.orderStatus != null and orderQueryVo.orderStatus != ''">
- and iac.orderstatus= #{orderQueryVo.orderStatus}
- </if>
- <if test="orderQueryVo.frameNo != null and orderQueryVo.frameNo != ''">
- and io.frameno = #{orderQueryVo.frameNo}
- </if>
- <if test="orderQueryVo.licenseNo != null and orderQueryVo.licenseNo != ''">
- and io.licenseno = #{orderQueryVo.licenseNo}
- </if>
- <if test="orderQueryVo.insuredName != null and orderQueryVo.insuredName != ''">
- and REPLACE(JSON_EXTRACT(io.applyinfo, '$.name'),'"','') = #{orderQueryVo.insuredName}
- </if>
- <if test="orderQueryVo.quoteStartDateStr != null and orderQueryVo.quoteEndDateStr != null">
- and iac.createtime >= #{orderQueryVo.quoteStartDateStr} AND iac.createtime <![CDATA[ <= ]]> #{orderQueryVo.quoteEndDateStr}
- </if>
- <if test="orderQueryVo.companyId != null and orderQueryVo.companyId != ''">
- and iac.company_id = #{orderQueryVo.companyId}
- </if>
- <if test="orderQueryVo.operatorId != null and orderQueryVo.operatorId != ''">
- and io.userid = #{orderQueryVo.operatorId}
- </if>
- <if test="orderQueryVo.operatorName != null and orderQueryVo.operatorName != ''">
- and io.username = #{orderQueryVo.operatorName}
- </if>
- <if test="orderQueryVo.engineNo != null and orderQueryVo.engineNo != ''">
- and JSON_EXTRACT( io.carinfo, '$.engineNo' ) = #{orderQueryVo.engineNo}
- </if>
- <if test="orderQueryVo.provinceId != null and orderQueryVo.provinceId != ''">
- and io.deptid like "${orderQueryVo.provinceId}%"
- </if>
- <if test="orderQueryVo.cityId != null and orderQueryVo.cityId != ''">
- and io.deptid like "${orderQueryVo.cityId}%"
- </if>
- <if test="orderQueryVo.countyId != null and orderQueryVo.countyId != ''">
- and io.deptid like "${orderQueryVo.countyId}%"
- </if>
- <if test="orderQueryVo.houseId != null and orderQueryVo.houseId != ''">
- and io.deptid like "${orderQueryVo.houseId}%"
- </if>
- <if test="orderQueryVo.agreeId != null and orderQueryVo.agreeId != ''">
- and iac.agreement_id = #{orderQueryVo.agreeId}
- </if>
- <if test="orderQueryVo.taskNo != null and orderQueryVo.taskNo != ''">
- and io.orderno = #{orderQueryVo.taskNo}
- </if>
- <if test="orderQueryVo.riskCode != null and orderQueryVo.riskCode != ''">
- and iac.product = #{orderQueryVo.riskCode}
- </if>
- <if test="orderQueryVo.auditId != null and orderQueryVo.auditId != ''">
- and IFNULL( iac.new_operator_id, '' ) = #{orderQueryVo.auditId}
- </if>
- <if test="orderQueryVo.leaderId != null and orderQueryVo.leaderId != ''">
- and u.leader_id = #{orderQueryVo.leaderId}
- </if>
- <if test="orderQueryVo.leaderName != null and orderQueryVo.leaderName != ''">
- and u.leader_name = #{orderQueryVo.leaderName}
- </if>
- <if test="orderQueryVo.attachStartDateStr != null and orderQueryVo.attachEndDateStr != ''">
- and ((
- DATE_FORMAT(iac.jq_start_date, '%Y-%m-%d') BETWEEN #{orderQueryVo.attachStartDateStr}
- AND #{orderQueryVo.attachEndDateStr}
- )
- OR ( DATE_FORMAT(iac.sy_start_date, '%Y-%m-%d') BETWEEN #{orderQueryVo.attachStartDateStr} AND #{orderQueryVo.attachEndDateStr} )
- )
- </if>
- <choose>
- <when test="type==1">
- and dept.management_source=1
- </when>
- <when test="type==2">
- and dept.management_source=2
- </when>
- </choose>
- <if test="orderQueryVo.signStartDateStr != null and orderQueryVo.signEndDateStr != null">
- and iac.signing_time >= #{orderQueryVo.signStartDateStr} AND iac.signing_time <![CDATA[ <= ]]> #{orderQueryVo.signEndDateStr}
- </if>
- <if test="orderQueryVo.entryStatus != null and orderQueryVo.entryStatus != ''">
- and io.entry_status = #{orderQueryVo.entryStatus }
- </if>
- <if test="orderQueryVo.payStartDateStr != null and orderQueryVo.payEndDateStr != null">
- and DATE_FORMAT(iac.pay_date, '%Y-%m-%d') between #{orderQueryVo.payStartDateStr} AND #{orderQueryVo.payEndDateStr}
- </if>
- <if test="orderQueryVo.auditStartDateStr != null and orderQueryVo.auditEndDateStr != null">
- and DATE_FORMAT(iac.underwriting_time, '%Y-%m-%d') between #{orderQueryVo.auditStartDateStr} AND #{orderQueryVo.auditEndDateStr}
- </if>
- <if test="orderQueryVo.updateStartDateStr != null and orderQueryVo.updateEndDateStr != null">
- and DATE_FORMAT( iac.update_status_time, '%Y-%m-%d') between #{orderQueryVo.updateStartDateStr} AND #{orderQueryVo.updateEndDateStr}
- </if>
- <if test="orderQueryVo.updateStatus != null and orderQueryVo.updateStatus != null">
- and iac.update_status = #{orderQueryVo.updateStatus}
- </if>
- <if test="orderQueryVo.partnerCompaniesId != null and orderQueryVo.partnerCompaniesId != null">
- and agree.partner_companies_id = #{orderQueryVo.partnerCompaniesId}
- </if>
- and (iac.del_flag = '1' or io.del_flag IS NULL or io.del_flag = 1)
- </where>
- ) as s
- </select>
- <select id="queryPageSubOrders" resultMap="BaseResultMap">
- select
- io.*,
- iac.id as subOrderId
- from
- ins_area_company iac
- left JOIN
- ins_orders io on iac.orderno = io.orderno
- <where>
- <if test="orderQueryVo.userId != null and orderQueryVo.userId != ''">
- and io.userid = #{orderQueryVo.userid}
- </if>
- <if test="orderQueryVo.orderNo != null and orderQueryVo.orderNo != ''">
- and io.orderno = #{orderQueryVo.orderNo}
- </if>
- <if test="orderQueryVo.quoteNo != null and orderQueryVo.quoteNo != ''">
- and io.quoteno = #{orderQueryVo.quoteNo}
- </if>
- <if test="orderQueryVo.deptId != null and orderQueryVo.deptId != ''">
- and io.deptid like "${orderQueryVo.deptId}%"
- </if>
- <if test="orderQueryVo.orderStatus != null and orderQueryVo.orderStatus != ''">
- and iac.orderstatus = #{orderQueryVo.orderStatus}
- </if>
- <if test="orderQueryVo.frameNo != null and orderQueryVo.frameNo != ''">
- and io.frameno = #{orderQueryVo.frameNo}
- </if>
- <if test="orderQueryVo.licenseNo != null and orderQueryVo.licenseNo != ''">
- and io.licenseno = #{orderQueryVo.licenseNo}
- </if>
- <if test="orderQueryVo.engineNo != null and orderQueryVo.engineNo != ''">
- and JSON_EXTRACT( io.carinfo, '$.engineNo' ) = #{orderQueryVo.engineNo}
- </if>
- <if test="orderQueryVo.insuredName != null and orderQueryVo.insuredName != ''">
- and io.insuredname = #{orderQueryVo.insuredName}
- </if>
- <if test="orderQueryVo.startDate != null and orderQueryVo.endDate != null">
- and io.createtime between #{orderQueryVo.startDate} AND #{orderQueryVo.endDate}
- </if>
- <if test="orderQueryVo.companyId != null and orderQueryVo.companyId != ''">
- and iac.company_id = #{orderQueryVo.companyId}
- </if>
- <if test="orderQueryVo.riskCode != null and orderQueryVo.riskCode != ''">
- and iac.product = #{orderQueryVo.riskCode}
- </if>
- <if test="orderQueryVo.auditId != null and orderQueryVo.auditId != ''">
- and IFNULL( io.agreeid, '' ) = #{orderQueryVo.auditId}
- </if>
- <if test="orderQueryVo.policyStartDate != null and orderQueryVo.policyEndDate != ''">
- and ((
- io.jqstartdate BETWEEN #{orderQueryVo.policyStartDate}
- AND #{orderQueryVo.policyEndDate}
- )
- OR ( io.systartdate BETWEEN #{orderQueryVo.policyStartDate} AND #{orderQueryVo.policyEndDate} )
- )
- </if>
- </where>
- group by iac.id
- order by io.createtime desc
- </select>
- <select id="queryPageSubOrdersCount" resultType="Long">
- select
- count(1)
- from (
- select
- io.*
- from
- ins_area_company iac
- left JOIN
- ins_orders io on iac.orderno = io.orderno
- <where>
- <if test="orderQueryVo.userId != null and orderQueryVo.userId != ''">
- and io.userid = #{orderQueryVo.userid}
- </if>
- <if test="orderQueryVo.orderNo != null and orderQueryVo.orderNo != ''">
- and io.orderno = #{orderQueryVo.orderNo}
- </if>
- <if test="orderQueryVo.quoteNo != null and orderQueryVo.quoteNo != ''">
- and io.quoteno = #{orderQueryVo.quoteNo}
- </if>
- <if test="orderQueryVo.deptId != null and orderQueryVo.deptId != ''">
- and io.deptid like "${orderQueryVo.deptId}%"
- </if>
- <if test="orderQueryVo.orderStatus != null and orderQueryVo.orderStatus != ''">
- and iac.orderstatus = #{orderQueryVo.orderStatus}
- </if>
- <if test="orderQueryVo.frameNo != null and orderQueryVo.frameNo != ''">
- and io.frameno = #{orderQueryVo.frameNo}
- </if>
- <if test="orderQueryVo.licenseNo != null and orderQueryVo.licenseNo != ''">
- and io.licenseno = #{orderQueryVo.licenseNo}
- </if>
- <if test="orderQueryVo.engineNo != null and orderQueryVo.engineNo != ''">
- and JSON_EXTRACT( io.carinfo, '$.engineNo' ) = #{orderQueryVo.engineNo}
- </if>
- <if test="orderQueryVo.insuredName != null and orderQueryVo.insuredName != ''">
- and io.insuredname = #{orderQueryVo.insuredName}
- </if>
- <if test="orderQueryVo.startDate != null and orderQueryVo.endDate != null">
- and io.createtime between #{orderQueryVo.startDate} AND #{orderQueryVo.endDate}
- </if>
- <if test="orderQueryVo.companyId != null and orderQueryVo.companyId != ''">
- and iac.company_id = #{orderQueryVo.companyId}
- </if>
- <if test="orderQueryVo.riskCode != null and orderQueryVo.riskCode != ''">
- and iac.product = #{orderQueryVo.riskCode}
- </if>
- <if test="orderQueryVo.auditId != null and orderQueryVo.auditId != ''">
- and IFNULL( io.agreeid, '' ) = #{orderQueryVo.auditId}
- </if>
- <if test="orderQueryVo.policyStartDate != null and orderQueryVo.policyEndDate != ''">
- and ((
- io.jqstartdate BETWEEN #{orderQueryVo.policyStartDate}
- AND #{orderQueryVo.policyEndDate}
- )
- OR ( io.systartdate BETWEEN #{orderQueryVo.policyStartDate} AND #{orderQueryVo.policyEndDate} )
- )
- </if>
- </where>
- group by iac.id
- ) as s
- </select>
- <select id="selectEntityByinsOrderNo" resultMap="OrderResultMap">
- select o.orderno,
- o.quoteno,
- o.frameno,
- o.licenseno,
- iac.jq_start_date as jqstartdate,
- iac.jq_end_date as jqenddate,
- iac.sy_start_date as systartdate,
- iac.sy_end_date as syenddate,
- iac.id,
- iac.company_id,
- iac.reptxt,
- iac.orderstatus,
- iac.inscompany,
- iac.jqapplyno,
- iac.jqpolicyno,
- iac.syapplyno,
- iac.sypolicyno,
- iac.riskinfo,
- iac.kindinfo,
- iac.jqpremium,
- iac.sypremium,
- iac.jypremium,
- iac.taxamount,
- iac.sumpremium,
- iac.jqdiscountrate,
- iac.sydiscountrate,
- iac.feerate,
- iac.disrate,
- iac.auditid,
- iac.auditname,
- iac.audittime,
- iac.auditopinion,
- iac.jqappoint,
- iac.syappoint,
- iac.createtime,
- iac.payment_link,
- iac.accident_info,
- iac.tax_arrears,
- iac.cross_insurance,
- iac.ubi_predicted_info_score
- from ins_area_company iac
- join ins_orders as o on o.orderno = iac.orderno
- where
- iac.id = #{insOrderNo}
- <if test="timeFiltering != null and timeFiltering != ''">
- and DATE_FORMAT(iac.signing_time, '%Y-%m') = #{timeFiltering}
- </if>
- </select>
- <select id="getExpirationInsureCount" resultType="Integer">
- SELECT
- count( b.orderno ) AS count
- FROM
- ins_orders a
- left join
- ins_area_company b
- on a.orderno = b.orderno
- WHERE
- <if test="isJq == 1">
- jqenddate BETWEEN #{startDate} AND #{endDate}
- </if>
- <if test="isJq == 2">
- syenddate BETWEEN #{startDate} AND #{endDate}
- </if>
- AND a.orderstatus = 3
- AND b.orderstatus = 3
- <if test="param != null and param != ''">
- AND (a.licenseno = #{param} or a.ins_company = #{param})
- </if>
- <if test="userId != null and userId != ''">
- AND a.userid = #{userId}
- </if>
- </select>
- <select id="getExpirationInsure" resultType="com.ydtech.modules.order.entity.vo.OrderExpirationVo">
- SELECT
- a.ins_company,
- b.id as orderno,
- b.jq_end_date,
- b.sy_end_date,
- b.productid,
- b.product,
- a.licenseno,
- case when b.jq_end_date is not null then DATEDIFF( b.jq_end_date,NOW() ) else null end AS jqDiff,
- case when b.sy_end_date is not null then DATEDIFF( b.sy_end_date,NOW() ) else null end AS syDiff
- FROM ins_orders a,ins_area_company b
- WHERE a.orderno = b.orderno
- AND (b.jq_end_date BETWEEN #{order.jqStartDate} AND #{order.jqEndDate} or b.sy_end_date BETWEEN #{order.syStartDate} AND #{order.syEndDate})
- AND b.orderstatus = 3
- <if test="order.param != null and order.param != ''">
- AND (a.licenseno = #{order.param} or a.ins_company = #{order.param})
- </if>
- <if test="order.userid != null and order.userid != ''">
- AND a.userid = #{order.userid}
- </if>
- ORDER BY least(IFNULL(jqDiff, 9999999) , IFNULL(syDiff, 9999999)) asc
- </select>
- <select id="getCarBusinessDetailList" resultType="com.ydtech.modules.order.entity.vo.CarBusinessDetailVo">
- SELECT
- io.username,
- iac.signing_time as sign_date,
- io.licenseno,
- JSON_UNQUOTE(json_extract(io.applyinfo, '$.name')) as applyname,
- io.product,
- io.ins_company as inscompany,
- iac.jqpremium,
- iac.sypremium,
- iac.jypremium,
- iac.taxamount,
- ifo.jq_costs_export_proportion+ifo.jq_export_other_costs_proportion as jq_export_proportion,
- ifo.sy_costs_export_proportion+ifo.sy_export_other_costs_proportion as sy_export_proportion,
- ifo.no_costs_export_proportion+ifo.no_export_other_costs_proportion as no_export_proportion,
- ifo.jq_export_supervise_costs_premiums + ifo.sy_export_supervise_costs_premiums + ifo.no_export_supervise_costs_premiums + ifo.jq_export_other_costs_premiums + ifo.sy_export_other_costs_premiums + ifo.no_export_other_costs_premiums as settlement,
- CASE ifa.auditstatus
- WHEN 1 THEN
- '已审核'
- ELSE
- '未审核'
- END as audittype,
- ifa.audittime as audit_date
- FROM
- ins_orders io
- LEFT JOIN ins_area_company iac ON io.orderno = iac.orderno
- LEFT JOIN ins_fee_order_new ifo ON iac.id = ifo.ins_order_no
- left join ins_fee_audit ifa on ifo.ins_order_no = ifa.ins_order_no
- WHERE
- io.userid = #{userId}
- AND io.orderstatus = 3
- AND iac.orderstatus = 3
- AND iac.signing_time BETWEEN #{param.signStartDate} and #{param.signEndDate}
- </select>
- <select id="getRevenueExpenditureDetailList" resultType="com.ydtech.modules.order.entity.vo.RevenueExpenditureDetailVo">
- SELECT
- sua.create_time,
- io.licenseno,
- sua.amount,
- sua.business_eegments_type,
- sua.documentary,
- sua.property
- FROM
- sys_user_account_history sua
- left join ins_area_company iac on sua.suborder = iac.id
- left join ins_orders io on iac.orderno = io.orderno
- WHERE
- (sua.property != 1 and sua.property != 2)
- AND
- user_id = #{userId}
- AND
- sua.create_time BETWEEN #{param.signStartDate} and #{param.signEndDate}
- </select>
- <select id="getAuditExportList" resultType="com.ydtech.modules.order.entity.vo.AuditExportVo">
- SELECT
- iac.company_id,
- iac.api_type,
- iac.cross_insurance,
- io.username,
- iac.signing_time,
- io.licenseno,
- JSON_UNQUOTE(json_extract(io.applyinfo, '$.name')) as applyname,
- io.ins_company,
- io.product,
- eic.namesimple,
- iac.jqapplyno,
- iac.syapplyno,
- iac.cross_insurance,
- iac.jqpremium,
- iac.sypremium,
- iac.jypremium,
- iac.taxamount,
- ifo.jq_costs_export_proportion + ifo.jq_export_other_costs_proportion AS jq_export_proportion,
- ifo.sy_costs_export_proportion+ifo.sy_export_other_costs_proportion as sy_export_proportion,
- ifo.no_costs_export_proportion+ifo.no_export_other_costs_proportion as no_export_proportion,
- ifo.jq_export_supervise_costs_premiums + ifo.sy_export_supervise_costs_premiums + ifo.no_export_supervise_costs_premiums + ifo.jq_export_other_costs_premiums + ifo.sy_export_other_costs_premiums + ifo.no_export_other_costs_premiums as settlement,
- ifo.jq_supervise_costs_proportion + ifo.jq_other_costs_proportion as jq_entrance_proportion,
- ifo.sy_supervise_costs_proportion + ifo.sy_other_costs_proportion as sy_entrance_proportion,
- ifo.no_supervise_costs_proportion + ifo.no_other_costs_proportion as no_entrance_proportion,
- ifo.jq_supervise_costs_premiums + ifo.jq_other_costs_premiums + ifo.sy_supervise_costs_premiums + ifo.sy_other_costs_premiums + ifo.no_supervise_costs_premiums + ifo.no_other_costs_premiums as receivable,
- ifo.jq_dept_premiums_level_1 + ifo.sy_dept_premiums_level_1 + ifo.no_dept_premiums_level_1 as dept_premiums_level_1,
- ifo.jq_dept_premiums_level_2 + ifo.sy_dept_premiums_level_2 + ifo.no_dept_premiums_level_2 as dept_premiums_level_2,
- ifo.jq_dept_premiums_level_3 + ifo.sy_dept_premiums_level_3 + ifo.no_dept_premiums_level_3 as dept_premiums_level_3,
- ifo.jq_dept_premiums_level_4 + ifo.sy_dept_premiums_level_4 + ifo.no_dept_premiums_level_4 as dept_premiums_level_4,
- ifo.jq_dept_premiums_level_5 + ifo.sy_dept_premiums_level_5 + ifo.no_dept_premiums_level_5 as dept_premiums_level_5,
- ifo.first_detail_premiums,
- ifo.second_detail_premiums,
- ifo.third_detail_premiums,
- ifo.jq_profit_margin_premiums,
- ifo.sy_profit_margin_premiums,
- ifo.no_profit_margin_premiums,
- io.is_external,
- pa.agreement_code,
- pa.job_description,
- pa.docking_person,
- pa.docking_phone
- FROM
- ins_fee_order_new ifo
- LEFT JOIN ins_fee_audit ifa ON ifo.ins_order_no = ifa.ins_order_no
- left join ins_area_company iac on ifa.ins_order_no = iac.id
- left join ins_orders io on iac.orderno = io.orderno
- left join ptl_agreement pa on iac.agreement_id = pa.id
- left join esm_ins_company eic on pa.partner_companies_id = eic.id
- WHERE
- iac.signing_time between #{param.signStartDate} and #{param.signEndDate}
- <if test="param.audit != null and param.audit != ''">
- AND
- ifa.auditstatus = #{param.audit}
- AND
- iac.orderstatus = 3
- GROUP BY
- io.orderno,
- iac.api_type,
- iac.cross_insurance,
- iac.signing_time,
- eic.namesimple,
- iac.jqapplyno,
- iac.syapplyno,
- iac.jqpremium,
- iac.company_id,
- iac.sypremium,
- iac.jypremium,
- iac.taxamount,
- ifo.jq_costs_export_proportion,
- ifo.jq_export_other_costs_proportion,
- ifo.sy_costs_export_proportion,
- ifo.sy_export_other_costs_proportion,
- ifo.no_costs_export_proportion,
- ifo.no_export_other_costs_proportion,
- ifo.jq_export_supervise_costs_premiums,
- ifo.sy_export_supervise_costs_premiums,
- ifo.no_export_supervise_costs_premiums,
- ifo.jq_export_other_costs_premiums,
- ifo.sy_export_other_costs_premiums,
- ifo.no_export_other_costs_premiums,
- ifo.jq_supervise_costs_proportion,
- ifo.jq_other_costs_proportion,
- ifo.sy_supervise_costs_proportion,
- ifo.sy_other_costs_proportion,
- ifo.no_supervise_costs_proportion,
- ifo.no_other_costs_proportion,
- ifo.jq_supervise_costs_premiums,
- ifo.jq_other_costs_premiums,
- ifo.sy_supervise_costs_premiums,
- ifo.sy_other_costs_premiums,
- ifo.no_supervise_costs_premiums,
- ifo.no_other_costs_premiums,
- ifo.jq_dept_premiums_level_1,
- ifo.jq_dept_premiums_level_2,
- ifo.jq_dept_premiums_level_3,
- ifo.jq_dept_premiums_level_4,
- ifo.jq_dept_premiums_level_5,
- ifo.sy_dept_premiums_level_1,
- ifo.sy_dept_premiums_level_2,
- ifo.sy_dept_premiums_level_3,
- ifo.sy_dept_premiums_level_4,
- ifo.sy_dept_premiums_level_5,
- ifo.no_dept_premiums_level_1,
- ifo.no_dept_premiums_level_2,
- ifo.no_dept_premiums_level_3,
- ifo.no_dept_premiums_level_4,
- ifo.no_dept_premiums_level_5,
- ifo.first_detail_premiums,
- ifo.second_detail_premiums,
- ifo.third_detail_premiums,
- ifo.jq_profit_margin_premiums,
- ifo.sy_profit_margin_premiums,
- ifo.no_profit_margin_premiums,
- pa.agreement_code,
- pa.job_description,
- pa.docking_person,
- pa.docking_phone
- </if>
- </select>
- <select id="getExternalOrder" resultType="com.ydtech.modules.order.entity.InsOrders">
- SELECT
- *
- FROM
- ins_orders io
- LEFT JOIN ins_area_company iac ON io.orderno = iac.orderno
- WHERE
- io.entry_status = 3
- AND io.del_flag IS NULL
- <if test="param.jqpolicyno != null and param.jqpolicyno != ''">
- AND iac.jqpolicyno = #{param.jqpolicyno}
- </if>
- <if test="param.sypolicyno != null and param.sypolicyno != ''">
- AND iac.sypolicyno = #{param.sypolicyno}
- </if>
- </select>
- <resultMap id="hxOrderCountMap" type="com.ydtech.modules.order.entity.vo.QueryHxOrdersCountVo">
- <result property="operatorId" column="operatorid" jdbcType="VARCHAR"/>
- <result property="name" column="name" jdbcType="VARCHAR"/>
- <result property="orderStatus0" column="orderstatus0" jdbcType="VARCHAR"/>
- <result property="orderStatus1" column="orderstatus1" jdbcType="VARCHAR"/>
- <result property="orderStatus2" column="orderstatus2" jdbcType="VARCHAR"/>
- <result property="orderStatus3" column="orderstatus3" jdbcType="VARCHAR"/>
- <result property="orderStatus4" column="orderstatus4" jdbcType="VARCHAR"/>
- <result property="createTime" column="createtime" jdbcType="TIMESTAMP"/>
- <result property="createTimeStart" column="createTimeStart" jdbcType="VARCHAR"/>
- <result property="createTimeEnd" column="createTimeEnd" jdbcType="VARCHAR"/>
- <result property="count" column="count1" jdbcType="VARCHAR"/>
- </resultMap>
- <resultMap id="TelemarketingAuditOrderMap" type="com.ydtech.modules.order.entity.dto.TelemarketingAuditOrderDTO">
- <result property="id" column="id" jdbcType="VARCHAR"/>
- <result property="orderNo" column="orderno" jdbcType="VARCHAR"/>
- <result property="userid" column="userid" jdbcType="VARCHAR"/>
- <result property="username" column="username" jdbcType="VARCHAR"/>
- <result property="product" column="product" jdbcType="VARCHAR"/>
- <result property="licenseNo" column="licenseno" jdbcType="VARCHAR"/>
- <result property="orderStatus" column="orderstatus" jdbcType="VARCHAR"/>
- <result property="insuredName" column="insuredname" jdbcType="VARCHAR"/>
- <result property="createTime" column="createtime" jdbcType="VARCHAR"/>
- <result property="auditStatus" column="auditstatus" jdbcType="VARCHAR"/>
- <result property="insCompany" column="insCompany" jdbcType="VARCHAR"/>
- </resultMap>
- <select id="queryHxOrdersCount" resultMap="hxOrderCountMap">
- select
- operatorid,
- su.name,
- count(*) as count1,
- SUM(CASE WHEN orderstatus = '1' THEN 1 ELSE 0 END) AS orderstatus1,
- SUM(CASE WHEN orderstatus = '2' THEN 1 ELSE 0 END) AS orderstatus2,
- SUM(CASE WHEN orderstatus = '3' THEN 1 ELSE 0 END) AS orderstatus3,
- SUM(CASE WHEN orderstatus = '4' THEN 1 ELSE 0 END) AS orderstatus4,
- SUM(CASE WHEN orderstatus = '0' THEN 1 ELSE 0 END) AS orderstatus0
- from
- ins_orders
- LEFT JOIN
- sys_user su ON operatorid = su.id
- WHERE operatorid IS NOT NULL
- AND operatorid NOT LIKE '%M%'
- <if test="queryHxOrdersCountVo.ids != null and !queryHxOrdersCountVo.ids.isEmpty()">
- and operatorid IN
- <foreach item="item" index="index" collection="queryHxOrdersCountVo.ids" open="(" separator="," close=")">
- #{item}
- </foreach>
- </if>
- <if test="queryHxOrdersCountVo.operatorId !=null and queryHxOrdersCountVo.operatorId !=''">
- and operatorid =#{queryHxOrdersCountVo.operatorId}
- </if>
- <if test="queryHxOrdersCountVo.name !=null and queryHxOrdersCountVo.name !=''">
- and su.name =#{queryHxOrdersCountVo.name}
- </if>
- <if test="queryHxOrdersCountVo.createTimeStart != null and queryHxOrdersCountVo.createTimeStart != ''">
- and createtime >= #{queryHxOrdersCountVo.createTimeStart}
- </if>
- <if test="queryHxOrdersCountVo.createTimeEnd != null and queryHxOrdersCountVo.createTimeEnd != ''">
- and createtime <= #{queryHxOrdersCountVo.createTimeEnd}
- </if>
- group by
- operatorid,su.name
- order by
- count1 desc
- </select>
- <select id="getTelemarketingAudit" resultMap="TelemarketingAuditOrderMap">
- SELECT
- iac.id as id,
- iac.orderno as orderno,
- io.userid as userid,
- io.username as username,
- iac.product as product,
- io.licenseno as licenseno,
- io.ins_company as insCompany,
- io.orderstatus as orderstatus,
- io.insuredname as insuredname,
- iac.createtime as createtime,
- ifa.auditstatus as auditstatus
- FROM
- ins_area_company iac
- LEFT JOIN ins_orders io ON iac.orderno = io.orderno
- LEFT JOIN ins_fee_audit ifa ON ifa.ins_order_no = iac.id
- WHERE
- iac.orderstatus = '3'
- AND ifa.auditstatus IN ('4', '5')
- AND io.userid = #{userId}
- <if test="telemarketingAuditOrderQueryVo.orderNo != null and telemarketingAuditOrderQueryVo.orderNo != '' ">
- AND iac.orderno = #{telemarketingAuditOrderQueryVo.orderNo}
- </if>
- <if test="telemarketingAuditOrderQueryVo.auditStatus != null and telemarketingAuditOrderQueryVo.auditStatus != '' ">
- AND ifa.auditstatus = #{telemarketingAuditOrderQueryVo.auditStatus}
- </if>
- <if test="telemarketingAuditOrderQueryVo.companyId != null and telemarketingAuditOrderQueryVo.companyId != '' ">
- AND iac.company_id = #{telemarketingAuditOrderQueryVo.companyId}
- </if>
- <if test="telemarketingAuditOrderQueryVo.licenseNo != null and telemarketingAuditOrderQueryVo.licenseNo != '' ">
- AND io.licenseno = #{telemarketingAuditOrderQueryVo.licenseNo}
- </if>
- <if test="telemarketingAuditOrderQueryVo.frameNo != null and telemarketingAuditOrderQueryVo.frameNo != '' ">
- AND io.frameno = #{telemarketingAuditOrderQueryVo.frameNo}
- </if>
- <if test="telemarketingAuditOrderQueryVo.productId != null and telemarketingAuditOrderQueryVo.productId != '' ">
- AND io.product = #{telemarketingAuditOrderQueryVo.productId}
- </if>
- <if test="telemarketingAuditOrderQueryVo.startDate != null and telemarketingAuditOrderQueryVo.startDate != '' and telemarketingAuditOrderQueryVo.endDate != null and telemarketingAuditOrderQueryVo.endDate != ''">
- AND iac.createtime BETWEEN #{telemarketingAuditOrderQueryVo.startDate} AND
- #{telemarketingAuditOrderQueryVo.endDate}
- </if>
- </select>
- <select id="queryLicense" resultType="java.lang.String">
- SELECT DISTINCT licenseno
- from ins_orders
- WHERE userid = #{userId}
- <if test="queryLicenseInOrderVo.startDate != null and queryLicenseInOrderVo.startDate != '' and queryLicenseInOrderVo.endDate != null and queryLicenseInOrderVo.endDate != ''">
- AND createtime BETWEEN #{queryLicenseInOrderVo.startDate} AND
- #{queryLicenseInOrderVo.endDate}
- </if>
- </select>
- <select id="queryInsured" resultType="java.lang.String">
- SELECT DISTINCT insuredname
- from ins_orders
- WHERE userid = #{userId}
- <if test="queryInsuredInOrderVo.startDate != null and queryInsuredInOrderVo.startDate != '' and queryInsuredInOrderVo.endDate != null and queryInsuredInOrderVo.endDate != ''">
- AND createtime BETWEEN #{queryInsuredInOrderVo.startDate} AND
- #{queryInsuredInOrderVo.endDate}
- </if>
- </select>
- <select id="queryOrderByLinkType" resultType="com.ydtech.modules.order.entity.InsOrders">
- select
- io.orderno as orderno,
- io.quoteno as quoteno,
- iac.orderstatus as orderstatus,
- io.userid as userid,
- io.username as username,
- io.deptid as deptid,
- io.deptname as deptname,
- io.agreeid as agreeid,
- iac.productid as productid,
- iac.product as product,
- iac.createtime as createtime,
- io.frameno as frameno,
- io.licenseno as licenseno,
- iac.jq_start_date as jqstartdate,
- iac.jq_end_date as jqenddate,
- iac.sy_start_date as systartdate,
- iac.sy_end_date as syenddate,
- iac.jqpremium as jqpremium,
- iac.sypremium as sypremium,
- iac.jypremium as jypremium,
- iac.taxamount as taxamount,
- iac.id as subOrderId,
- iac.underwriting_status as underwritingStatus,
- iac.company_id as company_id,
- iac.inscompany as ins_company,
- agree.agreement_code as agreementCode,
- agree.agreement_name as agreementName,
- company.namesimple as partnerCompaniesName,
- dept.province,
- dept.city,
- dept.area,
- d1.area_cname as province_name,
- d2.area_cname as city_name,
- d3.area_cname as area_name,
- concat(d1.area_cname,d2.area_cname,d3.area_cname) as area_info,
- iac.api_type,
- io.is_external,
- u.leader_name,
- u.leader_id,
- CASE dept.management_source
- WHEN '1' THEN '渠道'
- WHEN '2' THEN '个代'
- WHEN '3' THEN '电销'
- ELSE '' END
- AS managementSource,
- io.entry_status as entryStatus,
- iac.underwriting_time as underwritingTime,
- iac.pay_date as payDate,
- iac.update_status AS updateStatus,
- iac.update_status_time AS updateStatusTime,
- iac.signing_time as signingTime
- from
- ins_area_company iac
- left JOIN
- ins_orders io on iac.orderno = io.orderno
- left join
- ptl_agreement agree on iac.agreement_id= agree.id
- left join
- esm_ins_company company on agree.partner_companies_id= company.id
- LEFT JOIN
- sys_dept dept ON dept.id = io.deptid
- LEFT JOIN sys_dept pdept on dept.parent_id = pdept.id
- LEFT JOIN sys_area d1 ON d1.area_code = pdept.province
- LEFT JOIN sys_area d2 ON d2.area_code = pdept.city
- LEFT JOIN sys_area d3 ON d3.area_code = pdept.area
- LEFT JOIN
- sys_user u on io.userid = u.id
- <where>
- <if test="agentUserIds != null and agentUserIds.size>0">
- AND (
- (io.userid in
- <foreach collection="agentUserIds" item="item" open="(" separator="," close=")">
- #{item}
- </foreach>
- AND ( iac.new_operator_id IS NULL OR iac.new_operator_id = #{orderQueryVo.userId} )
- )
- <if test="flag">
- OR iac.operator_id = #{orderQueryVo.userId}
- </if>
- )
- </if>
- <if test="agreeIds != null and agreeIds.size>0">
- AND (
- (iac.company_id in
- <foreach collection="agreeIds" item="item" open="(" separator="," close=")">
- #{item}
- </foreach>
- AND ( iac.new_operator_id IS NULL OR iac.new_operator_id = #{orderQueryVo.userId} ) )
- <if test="flag">
- OR iac.operator_id = #{orderQueryVo.userId}
- </if>
- )
- </if>
- <if test="orderQueryVo.orderNo != null and orderQueryVo.orderNo != ''">
- and iac.id = #{orderQueryVo.orderNo}
- </if>
- <if test="orderQueryVo.managementSource != null and orderQueryVo.managementSource != ''">
- and dept.management_source = #{orderQueryVo.managementSource}
- </if>
- <if test="orderQueryVo.deptId != null and orderQueryVo.deptId != ''">
- and io.deptid like "${orderQueryVo.deptId}%"
- </if>
- <if test="orderQueryVo.orderStatus != null and orderQueryVo.orderStatus != ''">
- and iac.orderstatus= #{orderQueryVo.orderStatus}
- </if>
- <if test="orderQueryVo.frameNo != null and orderQueryVo.frameNo != ''">
- and io.frameno = #{orderQueryVo.frameNo}
- </if>
- <if test="orderQueryVo.licenseNo != null and orderQueryVo.licenseNo != ''">
- and io.licenseno = #{orderQueryVo.licenseNo}
- </if>
- <if test="orderQueryVo.insuredName != null and orderQueryVo.insuredName != ''">
- and REPLACE(JSON_EXTRACT(io.applyinfo, '$.name'),'"','') = #{orderQueryVo.insuredName}
- </if>
- <if test="orderQueryVo.quoteStartDateStr != null and orderQueryVo.quoteEndDateStr != null">
- and DATE_FORMAT(iac.createtime, '%Y-%m-%d') between #{orderQueryVo.quoteStartDateStr} AND
- #{orderQueryVo.quoteEndDateStr}
- </if>
- <if test="orderQueryVo.companyId != null and orderQueryVo.companyId != ''">
- and iac.company_id = #{orderQueryVo.companyId}
- </if>
- <if test="orderQueryVo.operatorId != null and orderQueryVo.operatorId != ''">
- and io.userid = #{orderQueryVo.operatorId}
- </if>
- <if test="orderQueryVo.operatorName != null and orderQueryVo.operatorName != ''">
- and io.username = #{orderQueryVo.operatorName}
- </if>
- <if test="orderQueryVo.engineNo != null and orderQueryVo.engineNo != ''">
- and JSON_EXTRACT( io.carinfo, '$.engineNo' ) = #{orderQueryVo.engineNo}
- </if>
- <if test="orderQueryVo.provinceId != null and orderQueryVo.provinceId != ''">
- and io.deptid like "${orderQueryVo.provinceId}%"
- </if>
- <if test="orderQueryVo.cityId != null and orderQueryVo.cityId != ''">
- and io.deptid like "${orderQueryVo.cityId}%"
- </if>
- <if test="orderQueryVo.countyId != null and orderQueryVo.countyId != ''">
- and io.deptid like "${orderQueryVo.countyId}%"
- </if>
- <if test="orderQueryVo.houseId != null and orderQueryVo.houseId != ''">
- and io.deptid like "${orderQueryVo.houseId}%"
- </if>
- <if test="orderQueryVo.agreeId != null and orderQueryVo.agreeId != ''">
- and iac.agreement_id = #{orderQueryVo.agreeId}
- </if>
- <if test="orderQueryVo.taskNo != null and orderQueryVo.taskNo != ''">
- and io.orderno = #{orderQueryVo.taskNo}
- </if>
- <if test="orderQueryVo.riskCode != null and orderQueryVo.riskCode != ''">
- and iac.product = #{orderQueryVo.riskCode}
- </if>
- <if test="orderQueryVo.auditId != null and orderQueryVo.auditId != ''">
- and IFNULL( iac.new_operator_id, '' ) = #{orderQueryVo.auditId}
- </if>
- <if test="orderQueryVo.leaderId != null and orderQueryVo.leaderId != ''">
- and u.leader_id = #{orderQueryVo.leaderId}
- </if>
- <if test="orderQueryVo.leaderName != null and orderQueryVo.leaderName != ''">
- and u.leader_name = #{orderQueryVo.leaderName}
- </if>
- <if test="orderQueryVo.attachStartDateStr != null and orderQueryVo.attachEndDateStr != ''">
- and ((
- DATE_FORMAT(iac.jq_start_date, '%Y-%m-%d') BETWEEN #{orderQueryVo.attachStartDateStr}
- AND #{orderQueryVo.attachEndDateStr}
- )
- OR ( DATE_FORMAT(iac.sy_start_date, '%Y-%m-%d') BETWEEN #{orderQueryVo.attachStartDateStr} AND
- #{orderQueryVo.attachEndDateStr} )
- )
- </if>
- <choose>
- <when test="type==1">
- and dept.management_source=1
- </when>
- <when test="type==2">
- and dept.management_source=2
- </when>
- </choose>
- <if test="orderQueryVo.signStartDateStr != null and orderQueryVo.signEndDateStr != null">
- and DATE_FORMAT(iac.signing_time, '%Y-%m-%d') between #{orderQueryVo.signStartDateStr} AND
- #{orderQueryVo.signEndDateStr}
- </if>
- <if test="orderQueryVo.entryStatus != null and orderQueryVo.entryStatus != ''">
- and io.entry_status = #{orderQueryVo.entryStatus }
- </if>
- <if test="orderQueryVo.payStartDateStr != null and orderQueryVo.payEndDateStr != null">
- and DATE_FORMAT(iac.pay_date, '%Y-%m-%d') between #{orderQueryVo.payStartDateStr} AND
- #{orderQueryVo.payEndDateStr}
- </if>
- <if test="orderQueryVo.auditStartDateStr != null and orderQueryVo.auditEndDateStr != null">
- and DATE_FORMAT(iac.underwriting_time, '%Y-%m-%d') between #{orderQueryVo.auditStartDateStr} AND
- #{orderQueryVo.auditEndDateStr}
- </if>
- <if test="orderQueryVo.updateStartDateStr != null and orderQueryVo.updateEndDateStr != null">
- and DATE_FORMAT( iac.update_status_time, '%Y-%m-%d') between #{orderQueryVo.updateStartDateStr} AND
- #{orderQueryVo.updateEndDateStr}
- </if>
- <if test="orderQueryVo.updateStatus != null and orderQueryVo.updateStatus != null">
- and iac.update_status = #{orderQueryVo.updateStatus}
- </if>
- <if test="orderQueryVo.partnerCompaniesId != null and orderQueryVo.partnerCompaniesId != null">
- and agree.partner_companies_id = #{orderQueryVo.partnerCompaniesId}
- </if>
- and (iac.del_flag = '1' or io.del_flag IS NULL or io.del_flag = 1)
- </where>
- order by io.createtime desc
- </select>
- </mapper>
|