| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320 |
- <?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.goafanti.common.dao.TOrderNewMapper">
- <resultMap id="BaseResultMap" type="com.goafanti.common.model.TOrderNew">
- <id column="order_no" jdbcType="VARCHAR" property="orderNo" />
- <result column="order_type" jdbcType="INTEGER" property="orderType" />
- <result column="creater" jdbcType="VARCHAR" property="creater" />
- <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
- <result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
- <result column="buyer_id" jdbcType="VARCHAR" property="buyerId" />
- <result column="first_amount" jdbcType="DECIMAL" property="firstAmount" />
- <result column="total_amount" jdbcType="DECIMAL" property="totalAmount" />
- <result column="settlement_amount" jdbcType="DECIMAL" property="settlementAmount" />
- <result column="refund_amount" jdbcType="DECIMAL" property="refundAmount" />
- <result column="order_status" jdbcType="INTEGER" property="orderStatus" />
- <result column="liquidation_status" jdbcType="INTEGER" property="liquidationStatus" />
- <result column="process_status" jdbcType="INTEGER" property="processStatus" />
- <result column="project_status" jdbcType="INTEGER" property="projectStatus" />
- <result column="approval" jdbcType="INTEGER" property="approval" />
- <result column="order_remarks" jdbcType="VARCHAR" property="orderRemarks" />
- <result column="delete_sign" jdbcType="INTEGER" property="deleteSign" />
- <result column="salesman_id" jdbcType="VARCHAR" property="salesmanId" />
- <result column="finance_id" jdbcType="VARCHAR" property="financeId" />
- <result column="technician_id" jdbcType="VARCHAR" property="technicianId" />
- <result column="sign_time" jdbcType="DATE" property="signTime" />
- <result column="settlement_time" jdbcType="DATE" property="settlementTime" />
- <result column="contract_picture_url" jdbcType="VARCHAR" property="contractPictureUrl" />
- <result column="contract_no" jdbcType="VARCHAR" property="contractNo" />
- <result column="contract_type" jdbcType="VARCHAR" property="contractType" />
- <result column="contacts" jdbcType="VARCHAR" property="contacts" />
- <result column="contact_mobile" jdbcType="VARCHAR" property="contactMobile" />
- <result column="legal_person" jdbcType="VARCHAR" property="legalPerson" />
- <result column="legal_person_tel" jdbcType="VARCHAR" property="legalPersonTel" />
- <result column="proof_count" jdbcType="FLOAT" property="proofCount" />
- <result column="proof_aid" jdbcType="VARCHAR" property="proofAid" />
- <result column="proof_time" jdbcType="TIMESTAMP" property="proofTime" />
- <result column="proof_status" jdbcType="INTEGER" property="proofStatus" />
- <result column="order_dep" jdbcType="VARCHAR" property="orderDep" />
- <result column="outsource" jdbcType="INTEGER" property="outsource" />
- <result column="additional_order" jdbcType="VARCHAR" property="additionalOrder" />
- <result column="primary_order" jdbcType="VARCHAR" property="primaryOrder" />
- <result column="old_salesman_id" jdbcType="VARCHAR" property="oldSalesmanId" />
- <result column="back_status" jdbcType="INTEGER" property="backStatus" />
- <result column="agreement_url" jdbcType="VARCHAR" property="agreementUrl" />
- <result column="new_user" jdbcType="INTEGER" property="newUser" />
- <result column="service_content" jdbcType="VARCHAR" property="serviceContent" />
- <result column="sales_type" jdbcType="INTEGER" property="salesType" />
- <result column="channel_id" jdbcType="VARCHAR" property="channelId" />
- <result column="other" jdbcType="VARCHAR" property="other" />
- <result column="user_type" jdbcType="INTEGER" property="userType" />
- <result column="examine_name" jdbcType="VARCHAR" property="examineName" />
- <result column="tag" jdbcType="INTEGER" property="tag" />
- <result column="patent_status" jdbcType="INTEGER" property="patentStatus" />
- </resultMap>
- <sql id="Base_Column_List">
- order_no, order_type, creater, create_time, update_time, buyer_id, first_amount,
- total_amount, settlement_amount, refund_amount, order_status, liquidation_status,
- process_status, project_status, approval, order_remarks, delete_sign, salesman_id,
- finance_id, technician_id, sign_time, settlement_time, contract_picture_url, contract_no,
- contract_type, contacts, contact_mobile, legal_person, legal_person_tel, proof_count,
- proof_aid, proof_time, proof_status, order_dep, outsource, additional_order, primary_order,
- old_salesman_id, back_status, agreement_url, new_user, service_content, sales_type,
- channel_id, other, user_type, examine_name, tag, patent_status
- </sql>
- <select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
- select
- <include refid="Base_Column_List" />
- from t_order_new
- where order_no = #{orderNo,jdbcType=VARCHAR}
- </select>
- <delete id="deleteByPrimaryKey" parameterType="java.lang.String">
- delete from t_order_new
- where order_no = #{orderNo,jdbcType=VARCHAR}
- </delete>
- <insert id="insert" parameterType="com.goafanti.common.model.TOrderNew">
- insert into t_order_new (order_no, order_type, creater,
- create_time, update_time, buyer_id,
- first_amount, total_amount, settlement_amount,
- refund_amount, order_status, liquidation_status,
- process_status, project_status, approval,
- order_remarks, delete_sign, salesman_id,
- finance_id, technician_id, sign_time,
- settlement_time, contract_picture_url, contract_no,
- contract_type, contacts, contact_mobile,
- legal_person, legal_person_tel, proof_count,
- proof_aid, proof_time, proof_status,
- order_dep, outsource, additional_order,
- primary_order, old_salesman_id, back_status,
- agreement_url, new_user, service_content,
- sales_type, channel_id, other,
- user_type, examine_name, tag,
- patent_status)
- values (#{orderNo,jdbcType=VARCHAR}, #{orderType,jdbcType=INTEGER}, #{creater,jdbcType=VARCHAR},
- #{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}, #{buyerId,jdbcType=VARCHAR},
- #{firstAmount,jdbcType=DECIMAL}, #{totalAmount,jdbcType=DECIMAL}, #{settlementAmount,jdbcType=DECIMAL},
- #{refundAmount,jdbcType=DECIMAL}, #{orderStatus,jdbcType=INTEGER}, #{liquidationStatus,jdbcType=INTEGER},
- #{processStatus,jdbcType=INTEGER}, #{projectStatus,jdbcType=INTEGER}, #{approval,jdbcType=INTEGER},
- #{orderRemarks,jdbcType=VARCHAR}, #{deleteSign,jdbcType=INTEGER}, #{salesmanId,jdbcType=VARCHAR},
- #{financeId,jdbcType=VARCHAR}, #{technicianId,jdbcType=VARCHAR}, #{signTime,jdbcType=DATE},
- #{settlementTime,jdbcType=DATE}, #{contractPictureUrl,jdbcType=VARCHAR}, #{contractNo,jdbcType=VARCHAR},
- #{contractType,jdbcType=VARCHAR}, #{contacts,jdbcType=VARCHAR}, #{contactMobile,jdbcType=VARCHAR},
- #{legalPerson,jdbcType=VARCHAR}, #{legalPersonTel,jdbcType=VARCHAR}, #{proofCount,jdbcType=FLOAT},
- #{proofAid,jdbcType=VARCHAR}, #{proofTime,jdbcType=TIMESTAMP}, #{proofStatus,jdbcType=INTEGER},
- #{orderDep,jdbcType=VARCHAR}, #{outsource,jdbcType=INTEGER}, #{additionalOrder,jdbcType=VARCHAR},
- #{primaryOrder,jdbcType=VARCHAR}, #{oldSalesmanId,jdbcType=VARCHAR}, #{backStatus,jdbcType=INTEGER},
- #{agreementUrl,jdbcType=VARCHAR}, #{newUser,jdbcType=INTEGER}, #{serviceContent,jdbcType=VARCHAR},
- #{salesType,jdbcType=INTEGER}, #{channelId,jdbcType=VARCHAR}, #{other,jdbcType=VARCHAR},
- #{userType,jdbcType=INTEGER}, #{examineName,jdbcType=VARCHAR}, #{tag,jdbcType=INTEGER},
- #{patentStatus,jdbcType=INTEGER})
- </insert>
- <insert id="insertSelective" parameterType="com.goafanti.common.model.TOrderNew">
- insert into t_order_new
- <trim prefix="(" suffix=")" suffixOverrides=",">
- <if test="orderNo != null">
- order_no,
- </if>
- <if test="orderType != null">
- order_type,
- </if>
- <if test="creater != null">
- creater,
- </if>
- <if test="createTime != null">
- create_time,
- </if>
- <if test="updateTime != null">
- update_time,
- </if>
- <if test="buyerId != null">
- buyer_id,
- </if>
- <if test="firstAmount != null">
- first_amount,
- </if>
- <if test="totalAmount != null">
- total_amount,
- </if>
- <if test="settlementAmount != null">
- settlement_amount,
- </if>
- <if test="refundAmount != null">
- refund_amount,
- </if>
- <if test="orderStatus != null">
- order_status,
- </if>
- <if test="liquidationStatus != null">
- liquidation_status,
- </if>
- <if test="processStatus != null">
- process_status,
- </if>
- <if test="projectStatus != null">
- project_status,
- </if>
- <if test="approval != null">
- approval,
- </if>
- <if test="orderRemarks != null">
- order_remarks,
- </if>
- <if test="deleteSign != null">
- delete_sign,
- </if>
- <if test="salesmanId != null">
- salesman_id,
- </if>
- <if test="financeId != null">
- finance_id,
- </if>
- <if test="technicianId != null">
- technician_id,
- </if>
- <if test="signTime != null">
- sign_time,
- </if>
- <if test="settlementTime != null">
- settlement_time,
- </if>
- <if test="contractPictureUrl != null">
- contract_picture_url,
- </if>
- <if test="contractNo != null">
- contract_no,
- </if>
- <if test="contractType != null">
- contract_type,
- </if>
- <if test="contacts != null">
- contacts,
- </if>
- <if test="contactMobile != null">
- contact_mobile,
- </if>
- <if test="legalPerson != null">
- legal_person,
- </if>
- <if test="legalPersonTel != null">
- legal_person_tel,
- </if>
- <if test="proofCount != null">
- proof_count,
- </if>
- <if test="proofAid != null">
- proof_aid,
- </if>
- <if test="proofTime != null">
- proof_time,
- </if>
- <if test="proofStatus != null">
- proof_status,
- </if>
- <if test="orderDep != null">
- order_dep,
- </if>
- <if test="outsource != null">
- outsource,
- </if>
- <if test="additionalOrder != null">
- additional_order,
- </if>
- <if test="primaryOrder != null">
- primary_order,
- </if>
- <if test="oldSalesmanId != null">
- old_salesman_id,
- </if>
- <if test="backStatus != null">
- back_status,
- </if>
- <if test="agreementUrl != null">
- agreement_url,
- </if>
- <if test="newUser != null">
- new_user,
- </if>
- <if test="serviceContent != null">
- service_content,
- </if>
- <if test="salesType != null">
- sales_type,
- </if>
- <if test="channelId != null">
- channel_id,
- </if>
- <if test="other != null">
- other,
- </if>
- <if test="userType != null">
- user_type,
- </if>
- <if test="examineName != null">
- examine_name,
- </if>
- <if test="tag != null">
- tag,
- </if>
- <if test="patentStatus != null">
- patent_status,
- </if>
- </trim>
- <trim prefix="values (" suffix=")" suffixOverrides=",">
- <if test="orderNo != null">
- #{orderNo,jdbcType=VARCHAR},
- </if>
- <if test="orderType != null">
- #{orderType,jdbcType=INTEGER},
- </if>
- <if test="creater != null">
- #{creater,jdbcType=VARCHAR},
- </if>
- <if test="createTime != null">
- #{createTime,jdbcType=TIMESTAMP},
- </if>
- <if test="updateTime != null">
- #{updateTime,jdbcType=TIMESTAMP},
- </if>
- <if test="buyerId != null">
- #{buyerId,jdbcType=VARCHAR},
- </if>
- <if test="firstAmount != null">
- #{firstAmount,jdbcType=DECIMAL},
- </if>
- <if test="totalAmount != null">
- #{totalAmount,jdbcType=DECIMAL},
- </if>
- <if test="settlementAmount != null">
- #{settlementAmount,jdbcType=DECIMAL},
- </if>
- <if test="refundAmount != null">
- #{refundAmount,jdbcType=DECIMAL},
- </if>
- <if test="orderStatus != null">
- #{orderStatus,jdbcType=INTEGER},
- </if>
- <if test="liquidationStatus != null">
- #{liquidationStatus,jdbcType=INTEGER},
- </if>
- <if test="processStatus != null">
- #{processStatus,jdbcType=INTEGER},
- </if>
- <if test="projectStatus != null">
- #{projectStatus,jdbcType=INTEGER},
- </if>
- <if test="approval != null">
- #{approval,jdbcType=INTEGER},
- </if>
- <if test="orderRemarks != null">
- #{orderRemarks,jdbcType=VARCHAR},
- </if>
- <if test="deleteSign != null">
- #{deleteSign,jdbcType=INTEGER},
- </if>
- <if test="salesmanId != null">
- #{salesmanId,jdbcType=VARCHAR},
- </if>
- <if test="financeId != null">
- #{financeId,jdbcType=VARCHAR},
- </if>
- <if test="technicianId != null">
- #{technicianId,jdbcType=VARCHAR},
- </if>
- <if test="signTime != null">
- #{signTime,jdbcType=DATE},
- </if>
- <if test="settlementTime != null">
- #{settlementTime,jdbcType=DATE},
- </if>
- <if test="contractPictureUrl != null">
- #{contractPictureUrl,jdbcType=VARCHAR},
- </if>
- <if test="contractNo != null">
- #{contractNo,jdbcType=VARCHAR},
- </if>
- <if test="contractType != null">
- #{contractType,jdbcType=VARCHAR},
- </if>
- <if test="contacts != null">
- #{contacts,jdbcType=VARCHAR},
- </if>
- <if test="contactMobile != null">
- #{contactMobile,jdbcType=VARCHAR},
- </if>
- <if test="legalPerson != null">
- #{legalPerson,jdbcType=VARCHAR},
- </if>
- <if test="legalPersonTel != null">
- #{legalPersonTel,jdbcType=VARCHAR},
- </if>
- <if test="proofCount != null">
- #{proofCount,jdbcType=FLOAT},
- </if>
- <if test="proofAid != null">
- #{proofAid,jdbcType=VARCHAR},
- </if>
- <if test="proofTime != null">
- #{proofTime,jdbcType=TIMESTAMP},
- </if>
- <if test="proofStatus != null">
- #{proofStatus,jdbcType=INTEGER},
- </if>
- <if test="orderDep != null">
- #{orderDep,jdbcType=VARCHAR},
- </if>
- <if test="outsource != null">
- #{outsource,jdbcType=INTEGER},
- </if>
- <if test="additionalOrder != null">
- #{additionalOrder,jdbcType=VARCHAR},
- </if>
- <if test="primaryOrder != null">
- #{primaryOrder,jdbcType=VARCHAR},
- </if>
- <if test="oldSalesmanId != null">
- #{oldSalesmanId,jdbcType=VARCHAR},
- </if>
- <if test="backStatus != null">
- #{backStatus,jdbcType=INTEGER},
- </if>
- <if test="agreementUrl != null">
- #{agreementUrl,jdbcType=VARCHAR},
- </if>
- <if test="newUser != null">
- #{newUser,jdbcType=INTEGER},
- </if>
- <if test="serviceContent != null">
- #{serviceContent,jdbcType=VARCHAR},
- </if>
- <if test="salesType != null">
- #{salesType,jdbcType=INTEGER},
- </if>
- <if test="channelId != null">
- #{channelId,jdbcType=VARCHAR},
- </if>
- <if test="other != null">
- #{other,jdbcType=VARCHAR},
- </if>
- <if test="userType != null">
- #{userType,jdbcType=INTEGER},
- </if>
- <if test="examineName != null">
- #{examineName,jdbcType=VARCHAR},
- </if>
- <if test="tag != null">
- #{tag,jdbcType=INTEGER},
- </if>
- <if test="patentStatus != null">
- #{patentStatus,jdbcType=INTEGER},
- </if>
- </trim>
- </insert>
- <update id="updateByPrimaryKeySelective" parameterType="com.goafanti.common.model.TOrderNew">
- update t_order_new
- <set>
- <if test="orderType != null">
- order_type = #{orderType,jdbcType=INTEGER},
- </if>
- <if test="creater != null">
- creater = #{creater,jdbcType=VARCHAR},
- </if>
- <if test="createTime != null">
- create_time = #{createTime,jdbcType=TIMESTAMP},
- </if>
- <if test="updateTime != null">
- update_time = #{updateTime,jdbcType=TIMESTAMP},
- </if>
- <if test="buyerId != null">
- buyer_id = #{buyerId,jdbcType=VARCHAR},
- </if>
- <if test="firstAmount != null">
- first_amount = #{firstAmount,jdbcType=DECIMAL},
- </if>
- <if test="totalAmount != null">
- total_amount = #{totalAmount,jdbcType=DECIMAL},
- </if>
- <if test="settlementAmount != null">
- settlement_amount = #{settlementAmount,jdbcType=DECIMAL},
- </if>
- <if test="refundAmount != null">
- refund_amount = #{refundAmount,jdbcType=DECIMAL},
- </if>
- <if test="orderStatus != null">
- order_status = #{orderStatus,jdbcType=INTEGER},
- </if>
- <if test="liquidationStatus != null">
- liquidation_status = #{liquidationStatus,jdbcType=INTEGER},
- </if>
- <if test="processStatus != null">
- process_status = #{processStatus,jdbcType=INTEGER},
- </if>
- <if test="projectStatus != null">
- project_status = #{projectStatus,jdbcType=INTEGER},
- </if>
- <if test="approval != null">
- approval = #{approval,jdbcType=INTEGER},
- </if>
- <if test="orderRemarks != null">
- order_remarks = #{orderRemarks,jdbcType=VARCHAR},
- </if>
- <if test="deleteSign != null">
- delete_sign = #{deleteSign,jdbcType=INTEGER},
- </if>
- <if test="salesmanId != null">
- salesman_id = #{salesmanId,jdbcType=VARCHAR},
- </if>
- <if test="financeId != null">
- finance_id = #{financeId,jdbcType=VARCHAR},
- </if>
- <if test="technicianId != null">
- technician_id = #{technicianId,jdbcType=VARCHAR},
- </if>
- <if test="signTime != null">
- sign_time = #{signTime,jdbcType=DATE},
- </if>
- <if test="settlementTime != null">
- settlement_time = #{settlementTime,jdbcType=DATE},
- </if>
- <if test="contractPictureUrl != null">
- contract_picture_url = #{contractPictureUrl,jdbcType=VARCHAR},
- </if>
- <if test="contractNo != null">
- contract_no = #{contractNo,jdbcType=VARCHAR},
- </if>
- <if test="contractType != null">
- contract_type = #{contractType,jdbcType=VARCHAR},
- </if>
- <if test="contacts != null">
- contacts = #{contacts,jdbcType=VARCHAR},
- </if>
- <if test="contactMobile != null">
- contact_mobile = #{contactMobile,jdbcType=VARCHAR},
- </if>
- <if test="legalPerson != null">
- legal_person = #{legalPerson,jdbcType=VARCHAR},
- </if>
- <if test="legalPersonTel != null">
- legal_person_tel = #{legalPersonTel,jdbcType=VARCHAR},
- </if>
- <if test="proofCount != null">
- proof_count = #{proofCount,jdbcType=FLOAT},
- </if>
- <if test="proofAid != null">
- proof_aid = #{proofAid,jdbcType=VARCHAR},
- </if>
- <if test="proofTime != null">
- proof_time = #{proofTime,jdbcType=TIMESTAMP},
- </if>
- <if test="proofStatus != null">
- proof_status = #{proofStatus,jdbcType=INTEGER},
- </if>
- <if test="orderDep != null">
- order_dep = #{orderDep,jdbcType=VARCHAR},
- </if>
- <if test="outsource != null">
- outsource = #{outsource,jdbcType=INTEGER},
- </if>
- <if test="additionalOrder != null">
- additional_order = #{additionalOrder,jdbcType=VARCHAR},
- </if>
- <if test="primaryOrder != null">
- primary_order = #{primaryOrder,jdbcType=VARCHAR},
- </if>
- <if test="oldSalesmanId != null">
- old_salesman_id = #{oldSalesmanId,jdbcType=VARCHAR},
- </if>
- <if test="backStatus != null">
- back_status = #{backStatus,jdbcType=INTEGER},
- </if>
- <if test="agreementUrl != null">
- agreement_url = #{agreementUrl,jdbcType=VARCHAR},
- </if>
- <if test="newUser != null">
- new_user = #{newUser,jdbcType=INTEGER},
- </if>
- <if test="serviceContent != null">
- service_content = #{serviceContent,jdbcType=VARCHAR},
- </if>
- <if test="salesType != null">
- sales_type = #{salesType,jdbcType=INTEGER},
- </if>
- <if test="channelId != null">
- channel_id = #{channelId,jdbcType=VARCHAR},
- </if>
- <if test="other != null">
- other = #{other,jdbcType=VARCHAR},
- </if>
- <if test="userType != null">
- user_type = #{userType,jdbcType=INTEGER},
- </if>
- <if test="examineName != null">
- examine_name = #{examineName,jdbcType=VARCHAR},
- </if>
- <if test="tag != null">
- tag = #{tag,jdbcType=INTEGER},
- </if>
- <if test="patentStatus != null">
- patent_status = #{patentStatus,jdbcType=INTEGER},
- </if>
- </set>
- where order_no = #{orderNo,jdbcType=VARCHAR}
- </update>
- <update id="updateByPrimaryKey" parameterType="com.goafanti.common.model.TOrderNew">
- update t_order_new
- set order_type = #{orderType,jdbcType=INTEGER},
- creater = #{creater,jdbcType=VARCHAR},
- create_time = #{createTime,jdbcType=TIMESTAMP},
- update_time = #{updateTime,jdbcType=TIMESTAMP},
- buyer_id = #{buyerId,jdbcType=VARCHAR},
- first_amount = #{firstAmount,jdbcType=DECIMAL},
- total_amount = #{totalAmount,jdbcType=DECIMAL},
- settlement_amount = #{settlementAmount,jdbcType=DECIMAL},
- refund_amount = #{refundAmount,jdbcType=DECIMAL},
- order_status = #{orderStatus,jdbcType=INTEGER},
- liquidation_status = #{liquidationStatus,jdbcType=INTEGER},
- process_status = #{processStatus,jdbcType=INTEGER},
- project_status = #{projectStatus,jdbcType=INTEGER},
- approval = #{approval,jdbcType=INTEGER},
- order_remarks = #{orderRemarks,jdbcType=VARCHAR},
- delete_sign = #{deleteSign,jdbcType=INTEGER},
- salesman_id = #{salesmanId,jdbcType=VARCHAR},
- finance_id = #{financeId,jdbcType=VARCHAR},
- technician_id = #{technicianId,jdbcType=VARCHAR},
- sign_time = #{signTime,jdbcType=DATE},
- settlement_time = #{settlementTime,jdbcType=DATE},
- contract_picture_url = #{contractPictureUrl,jdbcType=VARCHAR},
- contract_no = #{contractNo,jdbcType=VARCHAR},
- contract_type = #{contractType,jdbcType=VARCHAR},
- contacts = #{contacts,jdbcType=VARCHAR},
- contact_mobile = #{contactMobile,jdbcType=VARCHAR},
- legal_person = #{legalPerson,jdbcType=VARCHAR},
- legal_person_tel = #{legalPersonTel,jdbcType=VARCHAR},
- proof_count = #{proofCount,jdbcType=FLOAT},
- proof_aid = #{proofAid,jdbcType=VARCHAR},
- proof_time = #{proofTime,jdbcType=TIMESTAMP},
- proof_status = #{proofStatus,jdbcType=INTEGER},
- order_dep = #{orderDep,jdbcType=VARCHAR},
- outsource = #{outsource,jdbcType=INTEGER},
- additional_order = #{additionalOrder,jdbcType=VARCHAR},
- primary_order = #{primaryOrder,jdbcType=VARCHAR},
- old_salesman_id = #{oldSalesmanId,jdbcType=VARCHAR},
- back_status = #{backStatus,jdbcType=INTEGER},
- agreement_url = #{agreementUrl,jdbcType=VARCHAR},
- new_user = #{newUser,jdbcType=INTEGER},
- service_content = #{serviceContent,jdbcType=VARCHAR},
- sales_type = #{salesType,jdbcType=INTEGER},
- channel_id = #{channelId,jdbcType=VARCHAR},
- other = #{other,jdbcType=VARCHAR},
- user_type = #{userType,jdbcType=INTEGER},
- examine_name = #{examineName,jdbcType=VARCHAR},
- tag = #{tag,jdbcType=INTEGER},
- patent_status = #{patentStatus,jdbcType=INTEGER}
- where order_no = #{orderNo,jdbcType=VARCHAR}
- </update>
- <!-- 查看所有待财务管理员分配的订单数据 -->
- <select id="getAllUnassignedListOrder" parameterType="Map" resultType="com.goafanti.order.bo.OrderListBo">
- select o.order_no as orderNo, o.order_type orderType, o.create_time as createTime, o.process_status as processStatus,
- o.sign_time as signTime, u.nickname as buyerName,o.total_amount signTotalAmount, o.approval , a.name sellerName
- ,liquidation_status,o.finance_id as financeId,contract_no as contractNo,d.name as departmentName,e.name as outsourceName
- from t_order_new o left join `user` u on o.buyer_id = u.id left join admin a on o.salesman_id = a.id
- left join department d on o.order_dep=d.id left join (select order_no,max(name)as name from outsource_organization group by order_no) e
- on o.order_no=e.order_no left join t_order_outsource f on f.order_no=o.order_no where delete_sign in(0,2,3)
- and approval in (0,2)
- <if test="o.outsource != null">
- and o.outsource=#{o.outsource,jdbcType=INTEGER}
- </if>
- <if test="o.outsource == 1">
- and f.refund_status=1
- </if>
- <if test="o.processStatus == 2">
- and process_status = 2
- </if>
- <if test="o.processStatus == 3">
- and process_status >= 2 and process_status < 7
- </if>
- <if test="o.departmentId != null and o.departmentId != """>
- and o.order_dep= #{o.departmentId,jdbcType=VARCHAR}
- </if>
- <if test="o.orderNo != null and o.orderNo != """>
- and o.order_no = #{o.orderNo,jdbcType=VARCHAR}
- </if>
- <if test="o.financeId != null and o.financeId != """>
- and o.finance_id = #{o.financeId,jdbcType=VARCHAR}
- </if>
- <if test="o.contractNo != null and o.contractNo != """>
- and o.contract_no like CONCAT('%',#{o.contractNo,jdbcType=VARCHAR},'%')
- </if>
- <if test="o.buyerName != null and o.buyerName != """>
- <bind name="n" value="'%' + o.buyerName + '%'" />
- and u.nickname like #{n,jdbcType=VARCHAR}
- </if>
- <if test="o.startTime != null and o.startTime != "" and o.endTime != null and o.endTime != """>
- <bind name="a" value="o.startTime + ' 00:00:00'" />
- <bind name="b" value="o.endTime + ' 23:59:59'" />
- and o.create_time between #{a,jdbcType=VARCHAR} and #{b,jdbcType=VARCHAR}
- </if>
- order by o.process_status,o.create_time desc
- <if test="page_sql != null">
- ${page_sql}
- </if>
- </select>
- <select id="getAllUnassignedCountOrder" parameterType="Map" resultType="java.lang.Integer">
- select count(*) from t_order_new o left join `user` u on o.buyer_id = u.id left join admin a on o.salesman_id = a.id
- left join t_order_outsource f on f.order_no=o.order_no where delete_sign in(0,2,3) and approval in (0,2)
- <if test="o.outsource != null">
- and o.outsource=#{o.outsource,jdbcType=INTEGER}
- </if>
- <if test="o.outsource == 1">
- and f.refund_status=1
- </if>
- <if test="o.processStatus == 2">
- and process_status = 2
- </if>
- <if test="o.processStatus == 3">
- and process_status > 2 and process_status < 7
- </if>
- <if test="o.departmentId != null and o.departmentId != """>
- and o.order_dep= #{o.departmentId,jdbcType=VARCHAR}
- </if>
- <if test="o.orderNo != null and o.orderNo != """>
- and o.order_no = #{o.orderNo,jdbcType=VARCHAR}
- </if>
- <if test="o.financeId != null and o.financeId != """>
- and o.finance_id = #{o.financeId,jdbcType=VARCHAR}
- </if>
- <if test="o.contractNo != null and o.contractNo != """>
- and o.contract_no like CONCAT('%',#{o.contractNo,jdbcType=VARCHAR},'%')
- </if>
- <if test="o.buyerName != null and o.buyerName != """>
- <bind name="n" value="'%' + o.buyerName + '%'" />
- and u.nickname like #{n,jdbcType=VARCHAR}
- </if>
- <if test="o.startTime != null and o.startTime != "" and o.endTime != null and o.endTime != """>
- <bind name="a" value="o.startTime + ' 00:00:00'" />
- <bind name="b" value="o.endTime + ' 23:59:59'" />
- and o.create_time between #{a,jdbcType=VARCHAR} and #{b,jdbcType=VARCHAR}
- </if>
- </select>
- <!-- 查看某订单状态是否符合要求 -->
- <select id="getCountByIdAndStatus" parameterType="com.goafanti.common.model.TOrderNew" resultType="java.lang.Integer">
- select count(*) from t_order_new
- where order_no = #{orderNo,jdbcType=VARCHAR}
- <if test="orderType != null">
- and order_type = #{orderType,jdbcType=INTEGER}
- </if>
- <if test="creater != null">
- and creater = #{creater,jdbcType=VARCHAR}
- </if>
- <if test="buyerId != null">
- and buyer_id = #{buyerId,jdbcType=VARCHAR}
- </if>
- <if test="firstAmount != null">
- and first_amount = #{firstAmount,jdbcType=DECIMAL}
- </if>
- <if test="totalAmount != null">
- and total_amount = #{totalAmount,jdbcType=DECIMAL}
- </if>
- <if test="settlementAmount != null">
- and settlement_amount = #{settlementAmount,jdbcType=DECIMAL}
- </if>
- <if test="orderStatus != null">
- and order_status = #{orderStatus,jdbcType=INTEGER}
- </if>
- <if test="liquidationStatus == 1">
- and liquidation_status between 1 and 2
- </if>
- <if test="processStatus != null">
- and process_status = #{processStatus,jdbcType=INTEGER}
- </if>
- <if test="projectStatus != null">
- and project_status = #{projectStatus,jdbcType=INTEGER}
- </if>
- <if test="approval != null">
- and approval = #{approval,jdbcType=INTEGER}
- </if>
- <if test="orderRemarks != null">
- and order_remarks = #{orderRemarks,jdbcType=VARCHAR}
- </if>
- <if test="deleteSign != null">
- and delete_sign = #{deleteSign,jdbcType=INTEGER}
- </if>
- <if test="salesmanId != null">
- and salesman_id = #{salesmanId,jdbcType=VARCHAR}
- </if>
- <if test="financeId != null">
- and finance_id = #{financeId,jdbcType=VARCHAR}
- </if>
- <if test="technicianId != null">
- and technician_id = #{technicianId,jdbcType=VARCHAR}
- </if>
- <if test="contractNo != null">
- and contract_no = #{contractNo,jdbcType=VARCHAR}
- </if>
- <if test="contractType != null">
- and contract_type = #{contractType,jdbcType=VARCHAR}
- </if>
- <if test="contacts != null">
- and contacts = #{contacts,jdbcType=VARCHAR}
- </if>
- <if test="contactMobile != null">
- and contact_mobile = #{contactMobile,jdbcType=VARCHAR}
- </if>
- <if test="legalPerson != null">
- and legal_person = #{legalPerson,jdbcType=VARCHAR}
- </if>
- <if test="legalPersonTel != null">
- and legal_person_tel = #{legalPersonTel,jdbcType=VARCHAR}
- </if>
- </select>
- <!-- 财务专员查看需要待收款的数据 -->
- <select id="financeList" parameterType="Map" resultType="com.goafanti.order.bo.OrderListBo">
- select o.order_no as orderNo, o.sign_time as signTime, u.nickname as buyerName, o.order_status as orderStatus,a.finance_name financeName,
- a.cost_amount costAmount,a.payment_amount paymentAmount,o.process_status as processStatus, o.settlement_amount as actuallyTotalAmount,
- o.contract_no as contractNo, o.approval, o.back_status backStatus,a.salesman_name as sellerName, o.salesman_id as sellerId,
- o.buyer_id as buyerId, o.liquidation_status as liquidationStatus ,too.amount outsourceAmount, o.first_amount as signFirstPayment,
- o.total_amount as signTotalAmount, date_format(o.create_time, '%Y-%m-%d %H:%i:%s') as createTime, too.company_name as outsourceName,
- 0 as companyId, d.name as departmentName, a.final_receivables finalReceivables ,a.invoice_amount invoiceAmount ,a.order_arrears orderArrears,
- o.order_status orderStatus,a.project_type projectType,o.sales_type salesType,o.other ,o.delete_sign deleteSign, a.order_receivables orderReceivables,
- date_format(a.`final_Receivables_time`, '%Y-%m-%d %H:%i:%s')finalReceivablesTime,a.patent_cost patentCost,a.patent_cost_actual patentCostActual ,
- a.soft_cost softCost ,a.soft_cost_actual softCostActual ,a.audit_cost auditCost ,a.audit_cost_actual auditCostActual ,a.other_cost otherCost ,
- a.other_cost_actual otherCostActual , a.expect_profit expectProfit ,a.actual_profit actualProfit,a.service_type serviceType,
- a.service_project serviceProject,o.examine_name examineName
- from t_order_new o left join department d on o.order_dep = d.id left join `user` u on o.buyer_id = u.id left join t_order_mid a on o.order_no=a.order_no
- left join (select * from t_order_outsource where type=0) too on o.order_no=too.order_no where delete_sign in(0,2) and o.approval in(0,1,2,4,5,7,8)
- and outsource= #{o.outsource,jdbcType=INTEGER}
- <if test="o.processStatus == 3">
- and o.process_status = #{o.processStatus,jdbcType=INTEGER}
- </if>
- <if test="o.processStatus == 4" >
- and o.process_status >= #{o.processStatus,jdbcType=INTEGER}
- </if>
- <if test="o.processStatus == 9">
- and o.back_status = 3
- </if>
- <if test="fids != null and fids.size() > 0">
- and (d.finance_id in
- <foreach close=")" collection="fids" index="" item="item" open="(" separator=",">
- #{item}
- </foreach>
- or d.retrial_finance_id in
- <foreach close=")" collection="fids" index="" item="item" open="(" separator=",">
- #{item}
- </foreach>)
- </if>
- <if test="o.orderStatus != null and o.orderStatus != """>
- and (o.order_status >= #{o.orderStatus,jdbcType=INTEGER} or o.back_status=3)
- </if>
- <if test="deps !=null">
- and o.order_dep in
- <foreach close=")" collection="deps" item="depId" open="(" separator=",">
- #{depId}
- </foreach>
- </if>
- <if test="o.contractNo != null and o.contractNo != """>
- and o.contract_no like CONCAT('%',#{o.contractNo,jdbcType=VARCHAR},'%')
- </if>
- <if test="o.liquidationStatus != null">
- and o.liquidation_status = #{o.liquidationStatus,jdbcType=INTEGER}
- </if>
- <if test="o.amountStatus == 0">
- and o.total_amount < 10
- </if>
- <if test="o.amountStatus == 1">
- and o.total_amount between 10 and 20
- </if>
- <if test="o.amountStatus == 2">
- and o.total_amount between 20 and 30
- </if>
- <if test="o.amountStatus == 3">
- and o.total_amount between 30 and 40
- </if>
- <if test="o.amountStatus == 4">
- and o.total_amount > 40
- </if>
- <if test="o.orderNo != null and o.orderNo != """>
- and o.order_no = #{o.orderNo,jdbcType=VARCHAR}
- </if>
- <if test="o.projectType != null and o.projectType != """>
- and a.project_type = #{o.projectType}
- </if>
- <if test="o.approval != null and o.approval ==1">
- and o.approval in (1,4,7)
- </if>
- <if test="o.approval != null and o.approval ==2">
- and o.approval in (2,5,8)
- </if>
- <if test="o.approval != null and o.approval ==4">
- and o.approval in (1,2,4,5,7,8)
- </if>
- <if test="o.buyerName != null and o.buyerName != """>
- <bind name="n" value="'%' + o.buyerName + '%'" />
- and u.nickname like #{n,jdbcType=VARCHAR}
- </if>
- <if test="o.startTime != null and o.startTime != "" and o.endTime != null and o.endTime != """>
- <bind name="a" value="o.startTime + ' 00:00:00'" />
- <bind name="b" value="o.endTime + ' 23:59:59'" />
- and o.create_time between #{a,jdbcType=VARCHAR} and #{b,jdbcType=VARCHAR}
- </if>
- <if test="o.startFinalReceivablesTime != null and o.startFinalReceivablesTime != "" and o.endFinalReceivablesTime != null and o.endFinalReceivablesTime != """>
- <bind name="c" value="o.startFinalReceivablesTime + ' 00:00:00'" />
- <bind name="d" value="o.endFinalReceivablesTime + ' 23:59:59'" />
- and a.final_Receivables_time between #{c,jdbcType=VARCHAR} and #{d,jdbcType=VARCHAR}
- </if>
- order by o.liquidation_status, o.sign_time desc
- <if test="page_sql != null">
- ${page_sql}
- </if>
- </select>
- <select id="financeCount" parameterType="Map" resultType="java.lang.Integer">
- select count(*) from t_order_new o left join `user` u on o.buyer_id = u.id
- left join department d on o.order_dep = d.id left join t_order_mid a on o.order_no=a.order_no
- where delete_sign in(0,2) and o.approval in(0,1,2,4,5,7,8) and outsource= #{o.outsource,jdbcType=INTEGER}
- <if test="o.processStatus == 3">
- and o.process_status = #{o.processStatus,jdbcType=INTEGER}
- </if>
- <if test="o.processStatus == 4" >
- and o.process_status >= #{o.processStatus,jdbcType=INTEGER}
- </if>
- <if test="o.processStatus == 9">
- and o.back_status = 3
- </if>
- <if test="fids != null and fids.size() > 0">
- and (d.finance_id in
- <foreach close=")" collection="fids" index="" item="item" open="(" separator=",">
- #{item}
- </foreach>
- or d.retrial_finance_id in
- <foreach close=")" collection="fids" index="" item="item" open="(" separator=",">
- #{item}
- </foreach>)
- </if>
- <if test="o.orderStatus != null and o.orderStatus != """>
- and (o.order_status >= #{o.orderStatus,jdbcType=INTEGER} or o.back_status=3)
- </if>
- <if test="deps !=null">
- and o.order_dep in
- <foreach close=")" collection="deps" item="depId" open="(" separator=",">
- #{depId}
- </foreach>
- </if>
- <if test="o.contractNo != null and o.contractNo != """>
- and o.contract_no like CONCAT('%',#{o.contractNo,jdbcType=VARCHAR},'%')
- </if>
- <if test="o.liquidationStatus != null">
- and o.liquidation_status = #{o.liquidationStatus,jdbcType=INTEGER}
- </if>
- <if test="o.amountStatus == 0">
- and o.total_amount < 10
- </if>
- <if test="o.amountStatus == 1">
- and o.total_amount between 10 and 20
- </if>
- <if test="o.amountStatus == 2">
- and o.total_amount between 20 and 30
- </if>
- <if test="o.amountStatus == 3">
- and o.total_amount between 30 and 40
- </if>
- <if test="o.amountStatus == 4">
- and o.total_amount > 40
- </if>
- <if test="o.orderNo != null and o.orderNo != """>
- and o.order_no = #{o.orderNo,jdbcType=VARCHAR}
- </if>
- <if test="o.projectType != null and o.projectType != """>
- and a.project_type = #{o.projectType}
- </if>
- <if test="o.approval != null and o.approval ==1">
- and o.approval in (1,4,7)
- </if>
- <if test="o.approval != null and o.approval ==2">
- and o.approval in (2,5,8)
- </if>
- <if test="o.approval != null and o.approval ==4">
- and o.approval in (1,2,4,5,7,8)
- </if>
- <if test="o.buyerName != null and o.buyerName != """>
- <bind name="n" value="'%' + o.buyerName + '%'" />
- and u.nickname like #{n,jdbcType=VARCHAR}
- </if>
- <if test="o.startTime != null and o.startTime != "" and o.endTime != null and o.endTime != """>
- <bind name="a" value="o.startTime + ' 00:00:00'" />
- <bind name="b" value="o.endTime + ' 23:59:59'" />
- and o.create_time between #{a,jdbcType=VARCHAR} and #{b,jdbcType=VARCHAR}
- </if>
- <if test="o.startFinalReceivablesTime != null and o.startFinalReceivablesTime != "" and o.endFinalReceivablesTime != null and o.endFinalReceivablesTime != """>
- <bind name="c" value="o.startFinalReceivablesTime + ' 00:00:00'" />
- <bind name="d" value="o.endFinalReceivablesTime + ' 23:59:59'" />
- and a.final_Receivables_time between #{c,jdbcType=VARCHAR} and #{d,jdbcType=VARCHAR}
- </if>
- </select>
- <!-- 通过订单编号获得订单的负责人(营销员) -->
- <select id="getSaleIdByOno" parameterType="java.lang.String" resultType="com.goafanti.order.bo.TOrderNewBo">
- select o.order_no orderNo ,o.salesman_id as salesmanId, a.name as salesmanName,e.name managerName,
- o.contract_no contractNo,a.email ,u.nickname as userName,o.order_dep orderDep,d.name departmentName,
- d.finance_id financeId,d.approval approvalStatus,d.approval_aid approvalAid,ad.name approvalName
- from t_order_new o left join admin a on o.salesman_id = a.id left join `user` u on u.id = o.buyer_id
- left join department d on o.order_dep=d.id left join admin e on a.manager_id=e.id
- left join admin ad on d.approval_aid=ad.id
- where order_no = #{_parameter,jdbcType=VARCHAR}
- </select>
- <select id="selectOrderNewListByPage" resultType="com.goafanti.order.bo.TOrderNewBo">
- select a.order_no as orderNo,a.create_time as createTime, date_format(a.sign_time,'%Y-%m-%d' ) as signDate,a.delete_sign deleteSign,
- a.contract_no as contractNo, b.nickname as userName ,a.process_status as processStatus,a.total_amount as totalAmount,a.tag,
- a.contract_picture_url contractPictureUrl,
- a.order_status as orderStatus, a.liquidation_status as liquidationStatus,a.approval,c.salesman_name as salesmanName,c.project_type projectType,
- dep.name as depName,c.finance_name as financeName,c.invoice_amount invoiceAmount,a.settlement_amount settlementAmount,
- a.sales_type salesType, a.channel_id channelId ,a.other,a.examine_name examineName,c.stop_project stopProject
- <if test="specially == 2">
- ,f.name as initiateName ,e.reason ,date_format(e.create_time,'%Y-%m-%d' ) as backDate,e.id as backId
- </if>
- <if test="specially == 4">
- ,e.receiver_name as consultantName,a.settlement_amount as settlementAmount,if(isnull(g.order_no)=0,1,0) ischange
- </if>
- from t_order_new a left join `user` b on a.buyer_id=b.id left join t_order_mid c on a.order_no=c.order_no
- left join department dep on a.order_dep=dep.id
- <if test="specially == 2">
- left join (select * from t_order_back a where back_status=0) e on a.order_no=e.order_no
- left join admin f on e.initiate=f.id
- </if>
- <if test="specially == 4">
- left join t_order_task e on a.order_no=e.order_no and e.main =1
- left join (select order_no from new_order_change group by order_no)g on a.order_no=g.order_no
- </if>
- <if test="specially == 9">
- left join t_order_task tot on a.order_no =tot.order_no
- left join business_project bp on tot.commodity_id =bp.id
- </if>
- <if test="specially == 10">
- left join admin mg on a.salesman_id=mg.id
- </if>
- where a.delete_sign in(0,2)
- <if test="specially ==7">
- and a.process_status > 4
- and a.salesman_id = #{aid,jdbcType=VARCHAR}
- </if>
- <if test="specially ==8">
- and a.process_status > 4
- <if test="uid !=null">
- and a.buyer_id = #{uid}
- </if>
- </if>
- <if test="specially ==9">
- and a.process_status > 4 and bp.type=5
- <if test="aid !=null">
- and a.salesman_id = #{aid,jdbcType=VARCHAR}
- </if>
- </if>
- <if test="outsource != null">
- and a.outsource= #{outsource,jdbcType=INTEGER}
- </if>
- <if test="specially == 0">
- <if test="approval ==null">
- and a.approval in(0,1,2,4,5,7,8)
- </if>
- and a.order_status in(0,1,2,4)
- and a.salesman_id = #{aid,jdbcType=VARCHAR}
- </if>
- <if test="specially == 10">
- and a.process_status = 1 and a.order_status in (0,1,2)
- and mg.manager_id= #{aid}
- </if>
- <if test="specially == 1">
- and a.process_status = 2 and a.order_status in (0,1,2)
- </if>
- <if test="specially == 2">
- and a.order_status in(3,5)
- and a.salesman_id = #{aid,jdbcType=VARCHAR}
- </if>
- <if test="specially == 3">
- and a.order_status=2
- <if test="manageType ==0">
- and dep.approval_aid= #{aid,jdbcType=VARCHAR}
- </if>
- <if test="approval ==0">
- and a.process_status in(4)
- and a.approval = 0
- </if>
- <if test="approval ==1">
- and a.process_status in(4)
- and a.approval in
- <if test="manageType ==0">
- (1)
- </if>
- <if test="manageType ==1">
- (4)
- </if>
- </if>
- <if test="approval ==2">
- and a.approval in
- <if test="manageType ==0">
- (2,3)
- </if>
- <if test="manageType ==1">
- (5,6)
- </if>
- </if>
- </if>
- <if test="specially !=3 ">
- <if test="approval ==0">
- and a.approval = 0
- </if>
- <if test="approval ==1">
- and a.approval in (1,4,7)
- </if>
- <if test="approval ==2">
- and a.approval in (2,5,8)
- </if>
- <if test="approval ==4">
- and a.approval in (1,2,4,5,7,8)
- </if>
- </if>
- <if test="specially == 4">
- and a.process_status in (3,5,6,7,99)
- and a.order_status in(1,2,3,4,6)
- </if>
- <if test="deps!=null">
- and a.order_dep in
- <foreach close=")" collection="deps" item="dep" open="(" separator=",">
- #{dep}
- </foreach>
- </if>
- <if test="distribution == 0">
- and a.process_status = 3
- </if>
- <if test="distribution == 1">
- and a.process_status = 5
- </if>
- <if test="distribution == 2">
- and a.process_status = 6
- </if>
- <if test="distribution == 3">
- and a.process_status = 7
- </if>
- <if test="name != null">
- and b.nickname like CONCAT('%',#{name,jdbcType=VARCHAR},'%')
- </if>
- <if test="projectType != null">
- and c.project_type = #{projectType}
- </if>
- <if test="processStatus != null">
- and a.process_status = #{processStatus}
- </if>
- <if test="orderNo != null">
- and a.order_no like CONCAT('%',#{orderNo,jdbcType=VARCHAR},'%')
- </if>
- <if test="contractNo != null">
- and a.contract_no like CONCAT('%',#{contractNo,jdbcType=VARCHAR},'%')
- </if>
- <if test="liquidationStatus != null">
- and a.liquidation_status = #{liquidationStatus,jdbcType=INTEGER}
- </if>
- <if test="tag != null">
- and a.tag= #{tag}
- </if>
- <if test="amountStatus == 0">
- and a.total_amount < 10
- </if>
- <if test="amountStatus == 1">
- and a.total_amount between 10 and 20
- </if>
- <if test="amountStatus == 2">
- and a.total_amount between 20 and 30
- </if>
- <if test="amountStatus == 3">
- and a.total_amount between 30 and 40
- </if>
- <if test="amountStatus == 4">
- and a.total_amount > 40
- </if>
- <if test="starTime !=null and endTime !=null">
- and a.create_time between #{starTime,jdbcType=VARCHAR} and #{endTime,jdbcType=VARCHAR}
- </if>
- <if test="contractStart !=null and contractEnd !=null">
- and a.sign_time between #{contractStart,jdbcType=VARCHAR} and #{contractEnd,jdbcType=VARCHAR}
- </if>
- order by
- <if test="specially == 3">
- a.approval,
- </if>
- <if test="specially == 4">
- a.process_status,
- </if>
- <if test="specially != 4">
- a.order_status,
- </if>
- a.create_time
- <if test="specially != 4">
- desc
- </if>
- <if test="page_sql!=null">
- ${page_sql}
- </if>
- </select>
- <select id="selectOrderNewListCount" resultType="java.lang.Integer">
- select count(*)
- from t_order_new a left join `user` b on a.buyer_id=b.id left join t_order_mid c on a.order_no=c.order_no
- left join department dep on a.order_dep=dep.id
- <if test="specially == 9">
- left join t_order_task tot on a.order_no =tot.order_no
- left join business_project bp on tot.commodity_id =bp.id
- </if>
- <if test="specially == 10">
- left join admin mg on a.salesman_id=mg.id
- </if>
- where a.delete_sign in(0,2)
- <if test="specially ==7">
- and a.process_status > 4
- and a.salesman_id = #{aid,jdbcType=VARCHAR}
- </if>
- <if test="specially ==8">
- and a.process_status > 4
- <if test="uid !=null">
- and a.buyer_id = #{uid}
- </if>
- </if>
- <if test="specially ==9">
- and a.process_status > 4 and bp.type=5
- <if test="aid !=null">
- and a.salesman_id = #{aid,jdbcType=VARCHAR}
- </if>
- </if>
- <if test="outsource != null">
- and a.outsource= #{outsource,jdbcType=INTEGER}
- </if>
- <if test="specially == 0">
- <if test="approval ==null">
- and a.approval in(0,1,2,4,5,7,8)
- </if>
- and a.order_status in(0,1,2,4)
- and a.salesman_id = #{aid,jdbcType=VARCHAR}
- </if>
- <if test="specially == 10">
- and a.process_status = 1 and a.order_status in (0,1,2)
- and mg.manager_id= #{aid}
- </if>
- <if test="specially == 1">
- and a.process_status = 2 and a.order_status in (0,1,2)
- </if>
- <if test="specially == 2">
- and a.order_status in(3,5)
- and a.salesman_id = #{aid,jdbcType=VARCHAR}
- </if>
- <if test="specially == 3">
- <if test="manageType ==0">
- and dep.approval_aid= #{aid,jdbcType=VARCHAR}
- </if>
- and a.order_status=2
- <if test="approval ==0">
- and a.process_status in(4)
- and a.approval = 0
- </if>
- <if test="approval ==1">
- and a.process_status in(4)
- and a.approval in
- <if test="manageType ==0">
- (1)
- </if>
- <if test="manageType ==1">
- (4)
- </if>
- </if>
- <if test="approval ==2">
- and a.approval in
- <if test="manageType ==0">
- (2,3)
- </if>
- <if test="manageType ==1">
- (5,6)
- </if>
- </if>
- </if>
- <if test="specially !=3 ">
- <if test="approval ==0">
- and a.approval = 0
- </if>
- <if test="approval ==1">
- and a.approval in (1,4,7)
- </if>
- <if test="approval ==2">
- and a.approval in (2,5,8)
- </if>
- <if test="approval ==4">
- and a.approval in (1,2,4,5,7,8)
- </if>
- </if>
- <if test="specially == 4">
- and a.process_status in (3,5,6,7,99)
- and a.order_status in(1,2,3,4,6)
- </if>
- <if test="deps!=null">
- and a.order_dep in
- <foreach close=")" collection="deps" item="dep" open="(" separator=",">
- #{dep}
- </foreach>
- </if>
- <if test="distribution == 0">
- and a.process_status = 3
- </if>
- <if test="distribution == 1">
- and a.process_status = 5
- </if>
- <if test="distribution == 2">
- and a.process_status = 6
- </if>
- <if test="distribution == 3">
- and a.process_status = 7
- </if>
- <if test="name != null">
- and b.nickname like CONCAT('%',#{name,jdbcType=VARCHAR},'%')
- </if>
- <if test="projectType != null">
- and c.project_type = #{projectType}
- </if>
- <if test="processStatus != null">
- and a.process_status = #{processStatus}
- </if>
- <if test="orderNo != null">
- and a.order_no like CONCAT('%',#{orderNo,jdbcType=VARCHAR},'%')
- </if>
- <if test="contractNo != null">
- and a.contract_no like CONCAT('%',#{contractNo,jdbcType=VARCHAR},'%')
- </if>
- <if test="liquidationStatus != null">
- and a.liquidation_status = #{liquidationStatus,jdbcType=INTEGER}
- </if>
- <if test="tag != null">
- and a.tag= #{tag}
- </if>
- <if test="amountStatus == 0">
- and a.total_amount < 10
- </if>
- <if test="amountStatus == 1">
- and a.total_amount between 10 and 20
- </if>
- <if test="amountStatus == 2">
- and a.total_amount between 20 and 30
- </if>
- <if test="amountStatus == 3">
- and a.total_amount between 30 and 40
- </if>
- <if test="amountStatus == 4">
- and a.total_amount > 40
- </if>
- <if test="starTime !=null and endTime !=null">
- and a.create_time between #{starTime,jdbcType=VARCHAR} and #{endTime,jdbcType=VARCHAR}
- </if>
- <if test="contractStart !=null and contractEnd !=null">
- and a.sign_time between #{contractStart,jdbcType=VARCHAR} and #{contractEnd,jdbcType=VARCHAR}
- </if>
- </select>
- <select id="selectDunOrderNewListByPage" resultType="com.goafanti.order.bo.outOrderDunListBo">
- select a.id, b.contract_no contractNo,a.order_no as orderNo,c.nickname as userName,tm.salesman_name as salesmanName,e.project_status projectStatus,
- b.total_amount as totalAmount,b.liquidation_status as liquidationStatus,b.settlement_amount as settlementAmount,a.money as accountsReceivable,
- if((b.total_amount-b.settlement_amount) < 0,0,(b.total_amount-b.settlement_amount)) as uncollectedAmount,b.order_status as orderStatus,
- date_format(a.start_time, '%Y-%m-%d') as startDate,dep.name as depName,date_format(b.sign_time,'%Y-%m-%d') as signDate,
- b.approval ,b.delete_sign deleteSign ,tm.project_type memberType,
- <if test="newStatus == 0 ">
- a.dun_subject as dunSubject,a.dun_status dunStatus
- from t_order_dun a
- </if>
- <if test="newStatus == 1 ">
- a.project_type projectType,a.status dunStatus, a.dun_type dunType,a.appropriation_ratio appropriationRatio,e.commodity_name commodityName,
- e.set_up_amount setUpAmount,date_format(a.customize_time,'%Y-%m-%d') customizeTimes, a.customize_name customizeName
- from new_order_dun a left join t_order_task e on a.tid=e.id
- </if>
- left join t_order_new b on a.order_no=b.order_no left join `user` c on b.buyer_id=c.id
- left join t_order_mid tm on b.order_no=tm.order_no left join department dep on b.order_dep=dep.id
- where b.delete_sign in (0,2)
- <if test="shiroType == 1 and fid !=null">
- and tm.finance_id= #{fid,jdbcType=VARCHAR}
- </if>
- <if test="shiroType == 2 and fid !=null">
- and tm.finance_id in (select id from admin where superior_id= #{fid,jdbcType=VARCHAR})
- </if>
- <if test="amountStatus == 0">
- and b.total_amount < 10
- </if>
- <if test="amountStatus == 1">
- and b.total_amount between 10 and 20
- </if>
- <if test="amountStatus == 2">
- and b.total_amount between 20 and 30
- </if>
- <if test="amountStatus == 3">
- and b.total_amount between 30 and 40
- </if>
- <if test="amountStatus == 4">
- and b.total_amount > 40
- </if>
- <if test="approval != null and approval < 3">
- and b.approval = #{approval}
- </if>
- <if test="approval != null and approval ==4">
- and b.approval in (1,2)
- </if>
- <if test="memberType !=null">
- and tm.project_type= #{memberType}
- </if>
- <if test="name != null">
- and c.nickname like CONCAT('%',#{name,jdbcType=VARCHAR},'%')
- </if>
- <if test="adminName != null">
- and tm.salesman_name like CONCAT('%',#{adminName,jdbcType=VARCHAR},'%')
- </if>
- <if test="orderNo != null">
- and a.order_no like CONCAT('%',#{orderNo,jdbcType=VARCHAR},'%')
- </if>
- <if test="contractNo != null">
- and b.contract_no like CONCAT('%',#{contractNo,jdbcType=VARCHAR},'%')
- </if>
- <if test="deps != null">
- and b.order_dep in
- <foreach close=")" collection="deps" item="depId" open="(" separator=",">
- #{depId}
- </foreach>
- </if>
- <if test="dunStatus != null">
- and a.status= #{dunStatus}
- </if>
- <if test="aid != null">
- and b.salesman_id= #{aid,jdbcType=VARCHAR}
- </if>
- <if test="starTime !=null and endTime !=null">
- and b.sign_time between #{starTime,jdbcType=VARCHAR} and #{endTime,jdbcType=VARCHAR}
- </if>
- order by b.sign_time desc,b.create_time desc
- <if test="page_sql!=null">
- ${page_sql}
- </if>
- </select>
- <select id="selectDunOrderNewListCount" resultType="java.lang.Integer">
- select
- count(*)
- <if test="newStatus == 0 ">
- from t_order_dun a
- </if>
- <if test="newStatus == 1 ">
- from new_order_dun a left join t_order_task e on a.tid=e.id
- </if>
- left join t_order_new b on a.order_no=b.order_no left join `user` c on b.buyer_id=c.id
- left join t_order_mid tm on b.order_no=tm.order_no
- where b.delete_sign in (0,2)
- <if test="shiroType == 1 and fid !=null">
- and tm.finance_id= #{fid,jdbcType=VARCHAR}
- </if>
- <if test="shiroType == 2 and fid !=null">
- and tm.finance_id in (select id from admin where superior_id= #{fid,jdbcType=VARCHAR})
- </if>
- <if test="amountStatus == 0">
- and b.total_amount < 10
- </if>
- <if test="amountStatus == 1">
- and b.total_amount between 10 and 20
- </if>
- <if test="amountStatus == 2">
- and b.total_amount between 20 and 30
- </if>
- <if test="amountStatus == 3">
- and b.total_amount between 30 and 40
- </if>
- <if test="amountStatus == 4">
- and b.total_amount > 40
- </if>
- <if test="approval != null and approval < 3">
- and b.approval = #{approval}
- </if>
- <if test="approval != null and approval ==4">
- and b.approval in (1,2)
- </if>
- <if test="memberType !=null">
- and tm.project_type= #{memberType}
- </if>
- <if test="name != null">
- and c.nickname like CONCAT('%',#{name,jdbcType=VARCHAR},'%')
- </if>
- <if test="adminName != null">
- and salesman_name like CONCAT('%',#{adminName,jdbcType=VARCHAR},'%')
- </if>
- <if test="orderNo != null">
- and a.order_no like CONCAT('%',#{orderNo,jdbcType=VARCHAR},'%')
- </if>
- <if test="contractNo != null">
- and b.contract_no like CONCAT('%',#{contractNo,jdbcType=VARCHAR},'%')
- </if>
- <if test="deps != null">
- and b.order_dep in
- <foreach close=")" collection="deps" item="depId" open="(" separator=",">
- #{depId}
- </foreach>
- </if>
- <if test="dunStatus != null">
- and a.status= #{dunStatus}
- </if>
- <if test="aid != null">
- and b.salesman_id= #{aid,jdbcType=VARCHAR}
- </if>
- <if test="starTime !=null and endTime !=null">
- and b.sign_time between #{starTime,jdbcType=VARCHAR} and #{endTime,jdbcType=VARCHAR}
- </if>
- </select>
- <select id="getOrderNewDetail" parameterType="java.lang.String" resultType="com.goafanti.order.bo.TOrderNewBo">
- select
- a.order_no as orderNo, a.order_type as orderType, a.creater, a.create_time as createTime,a.update_time as updateTime, a.buyer_id as buyerId,a.other,
- a.first_amount as firstAmount,a.total_amount as totalAmount, a.settlement_amount as settlementAmount, order_status as orderStatus,a.user_type userType,
- a.liquidation_status as liquidationStatus, a.process_status as processStatus, a.project_status as projectStatus, a.approval,a.sales_type salesType,
- a.order_remarks as orderRemarks, a.delete_sign as deleteSign, a.salesman_id as salesmanId, a.finance_id as financeId, technician_id as technicianId,
- a.sign_time as signTime, a.settlement_time as settlementTime, a.contract_no as contractNo, a.contract_type as contractType, a.contacts,a.channel_id channelId,
- a.contact_mobile as contactMobile, a.legal_person as legalPerson, a.legal_person_tel as legalPersonTel, a.proof_count as proofCount,a.patent_status patentStatus,
- a.proof_aid as proofAid,contract_picture_url as contractPictureUrl, c.name as salesmanName,dep.name as depName,d.name as financeName,
- c.contact_mobile as salesmanMobile,d.contact_mobile as financeMobile,b.username as userName ,b.nickname as nickname ,e.back_status as backStatus,f.name as initiateName,
- e.reason,date_format(e.create_time,'%Y-%m-%d') as backDate,a.buyer_id as uid,a.order_dep as orderDep, g.location_province as locationProvince,
- g.location_city as locationCity,g.location_area locationArea,g.postal_address postalAddress,outsource,a.primary_order primaryOrder,a.agreement_url agreementUrl,
- h.name NowFinance,h.contact_mobile NowFinanceMobile,a.additional_order additionalOrder,i.name as oldSalesmanName, i.contact_mobile oldSalesmanMobile,
- a.service_content serviceContent,a.examine_name examineName, tht.knowledge_services knowledgeServices, tht.audit_services auditServices,c.manager_id managerId,
- tht.add_deduction_services addDeductionServices, tht.knowledge_other knowledgeOther, tht.audit_other auditOther, tht.add_deduction_other addDeductionOther
- from t_order_new a left join `user` b on a.buyer_id=b.id left join admin i on a.old_salesman_id=i.id
- left join admin c on a.salesman_id=c.id left join department dep on a.order_dep=dep.id
- left join admin d on a.finance_id=d.id left join admin h on dep.finance_id=h.id
- left join t_order_back e on a.order_no=e.order_no and e.back_status=0
- left join admin f on e.initiate=f.id left join organization_identity g on a.buyer_id=g.uid
- left join t_order_high_tech tht on a.order_no=tht.order_no
- where a.order_no = #{orderNo,jdbcType=VARCHAR}
- </select>
- <select id="selectOrderRefundListByPage" resultType="com.goafanti.order.bo.TOrderRefundBo">
- select a.id, date_format(a.create_time,'%Y-%m-%d') as createDate,a.order_no as orderNo,
- c.nickname as userName,b.order_status as orderStatus,a.refund_status as refundStatus,
- a.reason,b.liquidation_status as liquidationStatus
- from t_order_refund a left join t_order_new b on a.order_no=b.order_no
- left join `user` c on b.buyer_id=c.id
- where b.delete_sign in(0,2,3)
- <if test="name != null">
- and c.nickname like CONCAT('%',#{name,jdbcType=VARCHAR},'%')
- </if>
- <if test="aid != null">
- and a.initiate = #{aid,jdbcType=VARCHAR}
- </if>
- <if test="orderNo != null">
- and a.order_no = #{orderNo,jdbcType=VARCHAR}
- </if>
- <if test="starTime !=null and endTime !=null">
- and a.create_time between #{starTime,jdbcType=VARCHAR} and #{endTime,jdbcType=VARCHAR}
- </if>
- order by a.create_time desc
- <if test="page_sql!=null">
- ${page_sql}
- </if>
- </select>
- <select id="selectOrderRefundListCount" resultType="java.lang.Integer">
- select
- count(*)
- from t_order_refund a left join t_order_new b on a.order_no=b.order_no
- left join `user` c on b.buyer_id=c.id
- where b.delete_sign in(0,2,3)
- <if test="name != null">
- and c.nickname like CONCAT('%',#{name,jdbcType=VARCHAR},'%')
- </if>
- <if test="aid != null">
- and a.initiate = #{aid,jdbcType=VARCHAR}
- </if>
- <if test="orderNo != null">
- and a.order_no = #{orderNo,jdbcType=VARCHAR}
- </if>
- <if test="starTime !=null and endTime !=null">
- and a.create_time between #{starTime,jdbcType=VARCHAR} and #{endTime,jdbcType=VARCHAR}
- </if>
- </select>
- <!-- 财务同意退款邮件通知需要的数据 -->
- <select id="agreeEmailData" parameterType="java.lang.Integer" resultType="com.goafanti.order.bo.TOrderNewBo">
- select u.nickname as userName, r.order_no as orderNo, o.order_status as orderStatus, o.salesman_id as salesmanId, o.technician_id as technicianId,
- concat(a.email,"," , ifnull(t.email,"")) as email , concat(a.name,"," , ifnull(t.name,"")) as salesmanName
- from t_order_refund r
- left join t_order_new o on r.order_no = o.order_no
- left join admin a on a.id = o.salesman_id
- left join admin t on t.id = o.technician_id
- left join `user` u on u.id = o.buyer_id
- where r.id = #{id,jdbcType=INTEGER}
- </select>
- <select id="orderRefundDetail" resultType="com.goafanti.order.bo.OrderRefundDetailBo">
- select a.id,date_format(a.create_time,'%Y-%m-%d') as createDate ,a.order_no as orderNo,
- b.order_status as orderStatus,a.refund_status as refundStatus, a.application_url as applicationUrl,
- a.contract_url as contractUrl,a.reason,b.liquidation_status as liquidationStatus
- from t_order_refund a
- left join t_order_new b on a.order_no=b.order_no
- where a.id= #{id,jdbcType=INTEGER}
- </select>
- <update id="updateFinance" parameterType="string">
- update t_order_new set finance_id= #{newFinance,jdbcType=VARCHAR}
- where order_no in
- <foreach close=")" collection="orderNos" item="orderNo" open="(" separator=",">
- #{orderNo}
- </foreach>
- and finance_id= #{aid,jdbcType=VARCHAR}
- </update>
- <select id="checkContractNo" resultType="java.lang.Integer">
- select count(contract_no) from t_order_new
- where contract_no= #{0}
- </select>
- <select id="countTotalAndActually" parameterType="Map" resultType="java.util.Map">
- select IFNULL( sum(o.settlement_amount),0) actuallyTotalAmount,IFNULL(sum(o.total_amount),0) signTotalAmount
- from t_order_new o
- left join department d on o.order_dep=d.id left join `user` u on o.buyer_id = u.id left join t_order_mid a on o.order_no=a.order_no
- where o.delete_sign in(0,2,3) and o.approval in(0,1,2,4,5,7,8) and outsource= #{o.outsource,jdbcType=INTEGER}
- <if test="o.processStatus == 3">
- and o.process_status = #{o.processStatus,jdbcType=INTEGER}
- </if>
- <if test="o.processStatus == 4">
- and o.process_status >= #{o.processStatus,jdbcType=INTEGER}
- </if>
- <if test="o.processStatus == 9">
- and o.back_status = 3
- </if>
- <if test="fids != null and fids.size() > 0">
- and (d.finance_id in
- <foreach close=")" collection="fids" index="" item="item" open="(" separator=",">
- #{item}
- </foreach>
- or d.retrial_finance_id in
- <foreach close=")" collection="fids" index="" item="item" open="(" separator=",">
- #{item}
- </foreach>)
- </if>
- <if test="o.orderStatus != null and o.orderStatus != """>
- and (o.order_status >= #{o.orderStatus,jdbcType=INTEGER} or o.back_status=3)
- </if>
- <if test="deps !=null">
- and o.order_dep in
- <foreach close=")" collection="deps" item="depId" open="(" separator=",">
- #{depId}
- </foreach>
- </if>
- <if test="o.contractNo != null and o.contractNo != """>
- and o.contract_no like CONCAT('%',#{o.contractNo,jdbcType=VARCHAR},'%')
- </if>
- <if test="o.liquidationStatus != null">
- and o.liquidation_status = #{o.liquidationStatus,jdbcType=INTEGER}
- </if>
- <if test="o.amountStatus == 0">
- and o.total_amount < 10
- </if>
- <if test="o.amountStatus == 1">
- and o.total_amount between 10 and 20
- </if>
- <if test="o.amountStatus == 2">
- and o.total_amount between 20 and 30
- </if>
- <if test="o.amountStatus == 3">
- and o.total_amount between 30 and 40
- </if>
- <if test="o.amountStatus == 4">
- and o.total_amount > 40
- </if>
- <if test="o.orderNo != null and o.orderNo != """>
- and o.order_no = #{o.orderNo,jdbcType=VARCHAR}
- </if>
- <if test="o.projectType != null and o.projectType != """>
- and a.project_type = #{o.projectType}
- </if>
- <if test="o.approval != null and o.approval ==1">
- and o.approval in (1,4,7)
- </if>
- <if test="o.approval != null and o.approval ==2">
- and o.approval in (2,5,8)
- </if>
- <if test="o.approval != null and o.approval ==4">
- and o.approval in (1,2,4,5,7,8)
- </if>
- <if test="o.buyerName != null and o.buyerName != """>
- <bind name="n" value="'%' + o.buyerName + '%'" />
- and u.nickname like #{n,jdbcType=VARCHAR}
- </if>
- <if test="o.startTime != null and o.startTime != "" and o.endTime != null and o.endTime != """>
- <bind name="a" value="o.startTime + ' 00:00:00'" />
- <bind name="b" value="o.endTime + ' 23:59:59'" />
- and o.create_time between #{a,jdbcType=VARCHAR} and #{b,jdbcType=VARCHAR}
- </if>
- <if test="o.startFinalReceivablesTime != null and o.startFinalReceivablesTime != "" and o.endFinalReceivablesTime != null and o.endFinalReceivablesTime != """>
- <bind name="c" value="o.startFinalReceivablesTime + ' 00:00:00'" />
- <bind name="d" value="o.endFinalReceivablesTime + ' 23:59:59'" />
- and a.final_Receivables_time between #{c,jdbcType=VARCHAR} and #{d,jdbcType=VARCHAR}
- </if>
- </select>
- <select id="getLastPayment" resultType="com.goafanti.common.model.TOrderBillNew">
- select date_format(create_time, '%Y-%m-%d %H:%i:%s') createTimes,transaction_amount transactionAmount from t_order_bill_new
- where order_no= #{orderNo}
- order by create_time desc limit 1;
- </select>
- <update id="updateSalesmanId">
- update t_order_new set salesman_id= #{transferId},old_salesman_id= #{aid}
- where delete_sign in(0,2,3) and salesman_id= #{aid}
- </update>
- <select id="selectUsedOrderByOrder" resultType="com.goafanti.order.bo.TOrderNewBo">
- select
- a.order_no as orderNo, a.order_type as orderType, a.creater, a.create_time as createTime,a.update_time as updateTime, a.buyer_id as buyerId,
- a.first_amount as firstAmount,a.total_amount as totalAmount, a.settlement_amount as settlementAmount, order_status as orderStatus,
- a.liquidation_status as liquidationStatus, a.process_status as processStatus, a.project_status as projectStatus, a.approval,
- a.order_remarks as orderRemarks, a.delete_sign as deleteSign, a.salesman_id as salesmanId, a.finance_id as financeId, technician_id as technicianId,
- a.sign_time as signTime, a.settlement_time as settlementTime, a.contract_no as contractNo, a.contract_type as contractType, a.contacts,
- a.contact_mobile as contactMobile, a.legal_person as legalPerson, a.legal_person_tel as legalPersonTel, a.proof_count as proofCount,
- a.proof_aid as proofAid,contract_picture_url as contractPictureUrl, c.name as salesmanName,dep.name as depName,d.name as financeName,
- c.contact_mobile as salesmanMobile,d.contact_mobile as financeMobile,b.nickname as userName ,e.back_status as backStatus,f.name as initiateName,
- e.reason,date_format(e.create_time,'%Y-%m-%d') as backDate,a.buyer_id as uid,a.order_dep as orderDep, g.location_province as locationProvince,
- g.location_city as locationCity,g.location_area locationArea,g.postal_address postalAddress,outsource,a.primary_order primaryOrder,
- h.name NowFinance,h.contact_mobile NowFinanceMobile,a.additional_order additionalOrder,i.name as oldSalesmanName, i.contact_mobile oldSalesmanMobile
- from new_order_change noc left join t_order_new a on noc.used_order=a.order_no left join `user` b on a.buyer_id=b.id left join admin i on a.old_salesman_id=i.id
- left join admin c on a.salesman_id=c.id left join department dep on a.order_dep=dep.id left join admin d on a.finance_id=d.id
- left join admin h on dep.finance_id=h.id left join (select * from t_order_back a where back_status=0) e on a.order_no=e.order_no
- left join admin f on e.initiate=f.id left join organization_identity g on a.buyer_id=g.uid
- where noc.order_no= #{orderNo} order by noc.create_time
- </select>
- <update id="updaterefund" parameterType="com.goafanti.common.model.TOrderNew">
- update t_order_new set settlement_amount=settlement_amount-#{refundAmount,jdbcType=DECIMAL},
- refund_amount=#{refundAmount,jdbcType=DECIMAL} where order_no=#{orderNo}
- </update>
- <update id="updateDepExamine">
- update t_order_new a ,(select a.department_id depId,group_concat(a.name) name
- from admin a left join user_role b on a.id=b.uid
- left join `role` c on b.rid =c.id
- where c.role_type ='9996' and a.status ='0' and a.department_id = #{departmentId}
- group by a.department_id ) b
- set a.examine_name =b.name
- where a.order_dep = #{departmentId} and a.order_dep =b.depId
- </update>
- <update id="updateExamineById">
- update t_order_new a
- <if test="type==0 or type==1">
- left join admin b on a.salesman_id =b.id
- left join admin c on b.manager_id =c.id
- set a.examine_name =c.name
- where a.process_status =1 and c.id= #{id}
- </if>
- <if test="type==2">
- left join (select a.department_id depId,group_concat(a.name) name
- from admin a left join admin b on a.department_id =b.department_id
- left join user_role c on a.id=c.uid left join `role` d on c.rid =d.id
- where b.id= #{id} and d.role_type ='9996'
- and a.status ='0' group by b.department_id )x on a.order_dep=x.depId
- set a.examine_name=x.name
- where a.process_status =2
- </if>
- <if test="type==3">
- left join department b on a.order_dep =b.id
- left join admin c on b.finance_id =c.id
- set a.examine_name =c.name
- where a.process_status =3 and c.id =#{id}
- </if>
- <if test="type==5">
- update t_order_new a left join (select group_concat(a.name) name
- from admin a left join user_role b on a.id=b.uid
- left join `role` c on b.rid =c.id
- where c.role_type in ('9998') and a.status ='0' )b on 1=1
- set a.examine_name =b.name
- where a.process_status =5
- </if>
- </update>
- <select id="selectArrearsDunListByPage" resultType="com.goafanti.order.bo.OutArrearsDunListBo">
- select a.id, b.contract_no contractNo,a.order_no as orderNo,c.nickname as userName,tm.salesman_name as salesmanName,
- b.project_status projectStatus, b.total_amount as totalAmount,b.liquidation_status as liquidationStatus,a.`type`,
- b.settlement_amount as settlementAmount, a.order_receivables orderReceivables,a.order_arrears as orderArrears,
- b.order_status as orderStatus, date_format(a.start_time, '%Y-%m-%d %H:%i:%s') as startDate,dep.name as depName,
- date_format(b.sign_time,'%Y-%m-%d') as signDate,a.dun_status dunStatus,x.commodity_name commodityName
- from t_arrears_dun a
- left join (select order_no ,commodity_name from t_order_task where main =1)x on a.order_no =x.order_no
- left join t_order_new b on a.order_no=b.order_no left join `user` c on b.buyer_id=c.id
- left join t_order_mid tm on b.order_no=tm.order_no left join department dep on b.order_dep=dep.id
- where b.delete_sign in(0,2,3) and dun_status in (1,2,3)
- <if test="shiroType == 1 and fid !=null">
- and tm.finance_id= #{fid,jdbcType=VARCHAR}
- </if>
- <if test="shiroType == 2 and fid !=null">
- and tm.finance_id in (select id from admin where superior_id= #{fid,jdbcType=VARCHAR})
- </if>
- <if test="name != null">
- and c.nickname like CONCAT('%',#{name,jdbcType=VARCHAR},'%')
- </if>
- <if test="adminName != null">
- and tm.salesman_name like CONCAT('%',#{adminName,jdbcType=VARCHAR},'%')
- </if>
- <if test="orderNo != null">
- and a.order_no like CONCAT('%',#{orderNo,jdbcType=VARCHAR},'%')
- </if>
- <if test="contractNo != null">
- and b.contract_no like CONCAT('%',#{contractNo,jdbcType=VARCHAR},'%')
- </if>
- <if test="deps != null">
- and b.order_dep in
- <foreach close=")" collection="deps" item="dep" open="(" separator=",">
- #{dep}
- </foreach>
- </if>
- <if test="shiroType !=3 and aid != null">
- and b.salesman_id= #{aid,jdbcType=VARCHAR}
- </if>
- <if test="starTime !=null and endTime !=null">
- and b.sign_time between #{starTime,jdbcType=VARCHAR} and #{endTime,jdbcType=VARCHAR}
- </if>
- <if test="tStarTime !=null and tEndTime !=null">
- and a.start_time between #{tStarTime,jdbcType=VARCHAR} and #{tEndTime,jdbcType=VARCHAR}
- </if>
- order by dun_status,a.start_time desc
- <if test="page_sql!=null">
- ${page_sql}
- </if>
- </select>
- <select id="selectArrearsDunListByCount" resultType="java.lang.Integer">
- select count(*) from t_arrears_dun a
- left join t_order_new b on a.order_no=b.order_no left join `user` c on b.buyer_id=c.id
- left join t_order_mid tm on b.order_no=tm.order_no left join department dep on b.order_dep=dep.id
- where b.delete_sign in(0,2,3) and dun_status in (1,2,3)
- <if test="shiroType == 1 and fid !=null">
- and tm.finance_id= #{fid,jdbcType=VARCHAR}
- </if>
- <if test="shiroType == 2 and fid !=null">
- and tm.finance_id in (select id from admin where superior_id= #{fid,jdbcType=VARCHAR})
- </if>
- <if test="shiroType !=3 and aid != null">
- and b.salesman_id= #{aid,jdbcType=VARCHAR}
- </if>
- <if test="name != null">
- and c.nickname like CONCAT('%',#{name,jdbcType=VARCHAR},'%')
- </if>
- <if test="adminName != null">
- and tm.salesman_name like CONCAT('%',#{adminName,jdbcType=VARCHAR},'%')
- </if>
- <if test="orderNo != null">
- and a.order_no like CONCAT('%',#{orderNo,jdbcType=VARCHAR},'%')
- </if>
- <if test="deps != null">
- and b.order_dep in
- <foreach close=")" collection="deps" item="dep" open="(" separator=",">
- #{dep}
- </foreach>
- </if>
- <if test="shiroType !=3 and aid != null">
- and b.salesman_id= #{aid,jdbcType=VARCHAR}
- </if>
- <if test="starTime !=null and endTime !=null">
- and b.sign_time between #{starTime,jdbcType=VARCHAR} and #{endTime,jdbcType=VARCHAR}
- </if>
- <if test="tStarTime !=null and tEndTime !=null">
- and a.start_time between #{tStarTime,jdbcType=VARCHAR} and #{tEndTime,jdbcType=VARCHAR}
- </if>
- </select>
- <select id="selectByUidAndNewUser" resultType="java.math.BigDecimal">
- select total_amount from t_order_new
- where process_status >4 and buyer_id = #{uid}
- and salesman_id =#{aid}
- and new_user = #{newUser}
- and create_time between #{date} and #{now}
- </select>
- <select id="statisticsList" resultType="com.goafanti.order.bo.OutStatisticsList">
- select z.id,z.province,z.counts,z.quantity,z.total
- from (select y.id,y.province,count(aid)counts,sum(quantity)quantity,sum(total)total
- from (select x.id,x.province,x.aid,sum(quantity)quantity, sum(x.total)total
- from (select d.id,d.name province,a.order_no,a.salesman_id aid,
- if(a.total_amount>0.5,1,if(a.total_amount>0 and a.order_type=1,0.5,0))quantity,
- a.total_amount total
- from t_order_new a left join admin b on a.salesman_id =b.id
- left join department c on b.department_id =c.id left join district_glossory d on c.province =d.id
- where a.process_status >4 and a.delete_sign in(0,2)
- <if test="depId !=null">
- and b.department_id = #{depId}
- </if>
- <if test="province !=null">
- and c.province = #{province}
- </if>
- <if test="startCreate !=null and endCreate !=null">
- and a.create_time between #{startCreate} and #{endCreate}
- </if>
- <if test="startSign !=null and endSign !=null">
- and a.sign_time between #{startSign} and #{endSign}
- </if>
- )x group by x.id,x.province,x.aid)y group by y.id,y.province)z
- order by
- <if test="sort ==0">
- total
- </if>
- <if test="sort ==1">
- quantity
- </if>
- <if test="sort ==2">
- counts
- </if>
- desc
- </select>
- <select id="provinceStatisticsList" resultType="com.goafanti.order.bo.OutProvinceStatisticsList">
- select z.depName,z.aid,z.name,z.quantity,z.total
- from ( select x.depName,x.aid,x.name,sum(quantity)quantity,sum(total)total
- from ( select c.name depName,a.order_no,b.id aid,b.name name,
- if(a.total_amount>0.5,1,if(a.total_amount>0 and a.order_type=1,0.5,0))quantity,
- a.total_amount total
- from t_order_new a left join admin b on a.salesman_id =b.id
- left join department c on b.department_id =c.id left join district_glossory d on c.province =d.id
- where a.process_status >4 and a.delete_sign in(0,2)
- <if test="depId !=null">
- and b.department_id = #{depId}
- </if>
- <if test="province !=null">
- and c.province = #{province}
- </if>
- <if test="startCreate !=null and endCreate !=null">
- and a.create_time between #{startCreate} and #{endCreate}
- </if>
- <if test="startSign !=null and endSign !=null">
- and a.sign_time between #{startSign} and #{endSign}
- </if>
- )x group by x.depName,x.aid,x.name )z order by
- <if test="sort ==0">
- total
- </if>
- <if test="sort ==1">
- quantity
- </if>
- desc
- </select>
- <select id="selectOrderByuid" resultType="java.util.Map">
- select order_no orderNo,contract_no contractNo
- from t_order_new where delete_sign in (0,2) and buyer_id = #{uid}
- order by create_time desc
- </select>
- <select id="orderSalesSourceAmount" resultType="com.goafanti.order.bo.outStatistics.OutOrderSalesSourceAmount">
- select y.province,dg.name ,y.total_amount totalAmount,y.counts,y.dhxkf,
- y.dhxkf/y.total_amount dhxkfl, y.dhzdzy,y.dhzdzy/y.total_amount dhzdzyl,y.wl,y.wl/y.total_amount wll,
- y.qd,y.qd/y.total_amount qdl,y.zjs,y.zjs/y.total_amount zjsl,y.qt,y.qt/y.total_amount qtl,
- y.gxfg,y.gxfg/y.total_amount gxfgl,y.qtfg,y.qtfg/y.total_amount qtfgl
- from (select x.province,sum(x.total_amount)total_amount,sum(x.counts)counts,
- sum(x.dhxkf)dhxkf,sum(x.dhzdzy)dhzdzy,sum(x.wl)wl,sum(x.qd)qd, sum(x.zjs)zjs, sum(x.qt)qt,
- sum(x.gxfg)gxfg, sum(x.qtfg)qtfg
- from ( select b.province ,1 counts,a.total_amount,a.sales_type ,
- case a.sales_type when 0 then a.total_amount else 0 end dhxkf,
- case a.sales_type when 1 then a.total_amount else 0 end dhzdzy,
- case a.sales_type when 2 then a.total_amount else 0 end wl,
- case a.sales_type when 3 then a.total_amount else 0 end qd,
- case a.sales_type when 4 then a.total_amount else 0 end zjs,
- case a.sales_type when 5 then a.total_amount else 0 end qt,
- case a.sales_type when 6 then a.total_amount else 0 end gxfg,
- case a.sales_type when 7 then a.total_amount else 0 end qtfg
- from t_order_new a left join department b on a.order_dep =b.id
- where a.delete_sign in (0,2) and a.process_status > 0 and a.approval in (0,1,2)
- <if test=" startDate !=null and endDate != null">
- and a.create_time between #{startDate} and #{endDate}
- </if>
- <if test=" deps !=null">
- and a.order_dep in
- <foreach close=")" collection="listDep" item="depId" open="(" separator=",">
- #{depId}
- </foreach>
- </if>
- <if test=" province !=null">
- and b.province = #{province}
- </if>
- )x group by x.province)y left join district_glossory dg on y.province=dg.id
- order by y.total_amount desc
- </select>
- <select id="orderSalesSource" resultType="com.goafanti.order.bo.OutOrderSalesSource">
- select y.province,dg.name ,y.total_amount totalAmount,y.counts,y.dhxkf,y.dhxkf/y.counts dhxkfl,
- y.dhzdzy,y.dhzdzy/y.counts dhzdzyl,y.wl,y.wl/y.counts wll,
- y.qd,y.qd/y.counts qdl,y.zjs,y.zjs/y.counts zjsl,y.qt,y.qt/y.counts qtl,
- y.gxfg,y.gxfg/y.counts gxfgl,y.qtfg,y.qtfg/y.counts qtfgl
- from (select x.province,sum(x.total_amount)total_amount,sum(x.counts)counts,
- sum(x.dhxkf)dhxkf,sum(x.dhzdzy)dhzdzy,sum(x.wl)wl,sum(x.qd)qd, sum(x.zjs)zjs, sum(x.qt)qt,
- sum(x.gxfg)gxfg, sum(x.qtfg)qtfg
- from ( select b.province ,1 counts,a.total_amount,a.sales_type ,
- case a.sales_type when 0 then 1 else 0 end dhxkf,
- case a.sales_type when 1 then 1 else 0 end dhzdzy,
- case a.sales_type when 2 then 1 else 0 end wl,
- case a.sales_type when 3 then 1 else 0 end qd,
- case a.sales_type when 4 then 1 else 0 end zjs,
- case a.sales_type when 5 then 1 else 0 end qt,
- case a.sales_type when 6 then 1 else 0 end gxfg,
- case a.sales_type when 7 then 1 else 0 end qtfg
- from t_order_new a left join department b on a.order_dep =b.id
- where a.delete_sign in (0,2) and a.process_status > 0 and a.approval in (0,1,2)
- <if test=" startDate !=null and endDate != null">
- and a.create_time between #{startDate} and #{endDate}
- </if>
- <if test=" deps !=null">
- and a.order_dep in
- <foreach close=")" collection="listDep" item="depId" open="(" separator=",">
- #{depId}
- </foreach>
- </if>
- <if test=" province !=null">
- and b.province = #{province}
- </if>
- )x group by x.province)y left join district_glossory dg on y.province=dg.id
- order by y.counts desc
- </select>
- <select id="selectstatisticsOrderListPage" resultType="com.goafanti.order.bo.TOrderNewBo">
- select a.order_no as orderNo,a.create_time as createTime, date_format(a.sign_time,'%Y-%m-%d' ) as signDate,a.delete_sign deleteSign,
- a.contract_no as contractNo, b.nickname as userName ,a.process_status as processStatus,a.total_amount as totalAmount,
- a.order_status as orderStatus, a.liquidation_status as liquidationStatus,a.approval,c.salesman_name as salesmanName,c.project_type projectType,
- dep.name as depName,c.finance_name as financeName,c.invoice_amount invoiceAmount,a.settlement_amount settlementAmount,
- a.sales_type salesType, a.channel_id channelId ,a.other
- from t_order_new a left join `user` b on a.buyer_id=b.id left join t_order_mid c on a.order_no=c.order_no
- left join department dep on a.order_dep=dep.id
- where a.delete_sign in(0,2) and a.process_status >0 and a.approval in (0,1,2)
- <if test="province !=null ">
- and dep.province = #{province}
- </if>
- <if test="salesType !=null ">
- and a.sales_type = #{salesType}
- </if>
- <if test=" startDate !=null and endDate != null">
- and a.create_time between #{startDate} and #{endDate}
- </if>
- <if test=" depId !=null">
- and a.order_dep= #{depId}
- </if>
- <if test="orderNo != null">
- and a.order_no like CONCAT('%',#{orderNo,jdbcType=VARCHAR},'%')
- </if>
- <if test="name != null">
- and b.nickname like CONCAT('%',#{name,jdbcType=VARCHAR},'%')
- </if>
- <if test="contractNo != null">
- and a.contract_no like CONCAT('%',#{contractNo,jdbcType=VARCHAR},'%')
- </if>
- <if test="liquidationStatus != null">
- and a.liquidation_status = #{liquidationStatus,jdbcType=INTEGER}
- </if>
- <if test="approval ==0">
- and a.approval = 0
- </if>
- <if test="approval ==1">
- and a.approval in (1,2)
- </if>
- <if test="amountStatus == 0">
- and a.total_amount < 10
- </if>
- <if test="amountStatus == 1">
- and a.total_amount between 10 and 20
- </if>
- <if test="amountStatus == 2">
- and a.total_amount between 20 and 30
- </if>
- <if test="amountStatus == 3">
- and a.total_amount between 30 and 40
- </if>
- <if test="amountStatus == 4">
- and a.total_amount > 40
- </if>
- order by a.create_time desc
- <if test="page_sql!=null">
- ${page_sql}
- </if>
- </select>
- <select id="selectstatisticsOrderListCount" resultType="integer">
- select count(*)
- from t_order_new a left join `user` b on a.buyer_id=b.id left join t_order_mid c on a.order_no=c.order_no
- left join department dep on a.order_dep=dep.id
- where a.delete_sign in(0,2) and a.process_status >0 and a.approval in (0,1,2)
- <if test="province !=null ">
- and dep.province = #{province}
- </if>
- <if test="salesType !=null ">
- and a.sales_type = #{salesType}
- </if>
- <if test=" startDate !=null and endDate != null">
- and a.create_time between #{startDate} and #{endDate}
- </if>
- <if test=" depId !=null">
- and a.order_dep= #{depId}
- </if>
- <if test="orderNo != null">
- and a.order_no like CONCAT('%',#{orderNo,jdbcType=VARCHAR},'%')
- </if>
- <if test="name != null">
- and b.nickname like CONCAT('%',#{name,jdbcType=VARCHAR},'%')
- </if>
- <if test="contractNo != null">
- and a.contract_no like CONCAT('%',#{contractNo,jdbcType=VARCHAR},'%')
- </if>
- <if test="liquidationStatus != null">
- and a.liquidation_status = #{liquidationStatus,jdbcType=INTEGER}
- </if>
- <if test="approval ==0">
- and a.approval = 0
- </if>
- <if test="approval ==1">
- and a.approval in (1,2)
- </if>
- <if test="amountStatus == 0">
- and a.total_amount < 10
- </if>
- <if test="amountStatus == 1">
- and a.total_amount between 10 and 20
- </if>
- <if test="amountStatus == 2">
- and a.total_amount between 20 and 30
- </if>
- <if test="amountStatus == 3">
- and a.total_amount between 30 and 40
- </if>
- <if test="amountStatus == 4">
- and a.total_amount > 40
- </if>
- </select>
- <select id="checkOrderProcessStatus" resultMap="BaseResultMap">
- select
- <include refid="Base_Column_List" />
- from t_order_new
- where order_no = (select t_order_task.order_no from t_order_task where id=#{tid})
- </select>
- <select id="selectgetAll" resultType="com.goafanti.common.model.TOrderNew">
- select order_no orderNo,contract_picture_url contractPictureUrl ,agreement_url agreementUrl ,service_content serviceContent
- from t_order_new where delete_sign in (0,2)
- </select>
- <select id="getProcessName" resultType="com.goafanti.order.bo.OrderProcessName">
- select a.order_no orderNo,a.approval,a.process_status processStatus ,b.name yxy,mg.name yxjl,
- yxgly.name yxgly,d.name cwzy, zxsgly.name zxsgly,dsz.name dsz,dep.approval approvalStatus ,da.name approvalName
- from t_order_new a left join admin b on a.salesman_id =b.id
- left join admin mg on b.manager_id =mg.id left join department c on a.order_dep =c.id
- left join (select a.department_id depId,group_concat(a.name) name
- from admin a left join user_role b on a.id=b.uid left join `role` c on b.rid =c.id
- where c.role_type ='9996' and a.status ='0' group by a.department_id )yxgly on c.id =yxgly.depId
- left join (select order_no ,group_concat(aname)name from t_order_examine WHERE type=0 group by order_no ) d on a.order_no=d.order_no
- left join (select group_concat(a.name) name
- from admin a left join user_role b on a.id=b.uid left join `role` c on b.rid =c.id
- where c.role_type in ('99999','99989') and a.status ='0' ) dsz on 1=1
- left join (select group_concat(a.name) name
- from admin a left join user_role b on a.id=b.uid left join `role` c on b.rid =c.id
- where c.role_type in ('9998') and a.status ='0' ) zxsgly on 1=1
- left join department dep on a.order_dep =dep.id left join admin da on dep.approval_aid=da.id
- where a.order_no = #{orderNo}
- </select>
- <select id="selectByuidandAid" resultType="com.goafanti.order.bo.TOrderNewBo">
- select order_no orderNo,sign_time signTime
- from t_order_new
- where buyer_id=#{uid} and salesman_id=#{aid}
- </select>
- <select id="statisticsOrderList" resultType="com.goafanti.order.bo.StatisOrderList">
- select d.id,d.name province,c.name depName,a.order_no,a.salesman_id aid ,b.name aname,
- if(a.total_amount>0.5,1,if(a.total_amount>0 and a.order_type=1,0.5,0))quantity, a.total_amount total
- from t_order_new a left join admin b on a.salesman_id =b.id left join department c on b.department_id =c.id
- left join district_glossory d on c.province =d.id
- where a.process_status >4 and a.delete_sign in(0,2)
- <if test="depId !=null">
- and b.department_id = #{depId}
- </if>
- <if test="province !=null">
- and c.province = #{province}
- </if>
- <if test="startCreate !=null and endCreate !=null">
- and a.create_time between #{startCreate} and #{endCreate}
- </if>
- <if test="startSign !=null and endSign !=null">
- and a.sign_time between #{startSign} and #{endSign}
- </if>
- </select>
- <select id="matchingOrderNoOrUserName" resultType="com.goafanti.order.bo.UserOrder">
- select order_no orderNo ,buyer_id uid ,b.username userName
- from t_order_new a left join `user` b on a.buyer_id =b.id
- where 1=1
- <if test="orderNo !=null">
- and order_no like concat('%',#{orderNo},'%')
- </if>
- <if test="userName !=null">
- and b.nickname like concat('%',#{userName},'%')
- </if>
- limit 0,20
- </select>
- <update id="updateTagByListOrderNo">
- update t_order_new
- set tag = #{param2}
- where order_no in
- <foreach collection="param1" item="e" open="(" close=")" separator=",">
- #{e}
- </foreach>
- </update>
- <update id="updateOrderDepFinanceExamineName">
- update t_order_new x ,(select order_no ,group_concat(aname)name
- from t_order_examine where order_no in
- <foreach collection="list" item="e" close=")" open="(" separator=",">
- #{e}
- </foreach>
- and status =0 group by order_no) y
- set x.examine_name =y.name
- where x.order_no in
- <foreach collection="list" item="e" close=")" open="(" separator=",">
- #{e}
- </foreach>
- and x.order_no =y.order_no
- </update>
- <select id="selectAidAndDate" resultType="java.lang.Integer">
- select count(*)
- from t_order_new
- where process_status >0
- and salesman_id = #{aid}
- and create_time BETWEEN #{startTime} and #{endTime}
- </select>
- <select id="selectCountByFinance" resultType="com.goafanti.common.model.FinanceCount">
- select x.aid, x.dates dateTime, count(*)orderCount, sum(if(x.process_status = 3, 1, 0))orderUnauditedCount
- from (SELECT b.finance_id aid, a.process_status, DATE_FORMAT(a.create_time , '%Y-%m-%d') dates
- from t_order_new a left join department b on a.order_dep = b.id
- where a.delete_sign in (0, 2, 3) and process_status >2 and a.outsource =0
- and b.finance_id = #{aid})x
- group by x.aid, x.dates;
- </select>
- <select id="selectOrderFinance" resultType="com.goafanti.organization.bo.OrganizationListOut">
- select b.id,b.finance_id financeId,c.name financeName,b.retrial_finance_id retrialFinanceId,
- d.name retrialFinanceName
- from t_order_new a left join department b on a.order_dep = b.id
- left join admin c on b.finance_id=c.id
- left join admin d on b.retrial_finance_id=d.id
- where a.order_no =#{orderNo}
- </select>
- <select id="selectDepByOrderNo" resultType="com.goafanti.common.model.Department">
- select a.id,a.name,a.province,a.finance_id financeId,a.approval ,a.approval_aid approvalAid
- from department a left join t_order_new b on a.id =b.order_dep
- where b.order_no= #{orderNo}
- </select>
- <select id="selectByFinanceNotExamine" resultType="string">
- select a.order_no orderNo,a.process_status processStatus
- from t_order_new a left join t_order_examine b on a.order_no=b.order_no
- where b.status=0 and b.aid = #{financeId} and a.process_status = 3
- </select>
- <select id="selectExpenseCount" parameterType="com.goafanti.expenseAccount.bo.ExpenseCountsInput" resultType="com.goafanti.expenseAccount.bo.ExpenseCountsBo">
- select a.order_no orderNo,a.contract_no contractNo,b.buyer_name buyerName,toc.max_duration maxDuration ,toc.actual_duration actualDuration ,
- toc.exceed_duration exceedDuration, a.total_amount totalAmount,a.settlement_amount settlementAmount,b.bid_type bidType,
- c.expenseCount,c.peopleCount,c.notExamine,c.rejectCount,d.paymentAmount,c.days,c.amount expenseAmount
- from t_order_new a left join t_order_mid b on a.order_no =b.order_no
- left join t_order_public_release_count toc on a.order_no =toc.order_no
- left join (select a.order_no,a.expenseCount,b.peopleCount,c.notExamine, c.rejectCount,a.days,a.amount
- from (select a.order_no,count(a.id)expenseCount,sum(a.amount) amount,sum(ROUND(a.duration/7.5) )days
- from expense_account a where a.order_no in (select a.order_no from expense_account a
- where a.target_type = 1 group by order_no)
- and a.status=2
- <if test="startTime !=null and endTime != null">
- and a.create_time BETWEEN #{startTime} and #{endTime}
- </if>
- group by order_no )a
- left join (select order_no,count(aid)peopleCount from (select a.order_no,aid from expense_account a where a.order_no in
- (select a.order_no from expense_account a where a.target_type = 1
- and a.status=2
- group by order_no)
- <if test="startTime !=null and endTime != null">
- and a.create_time BETWEEN #{startTime} and #{endTime}
- </if>
- group by order_no,aid )a group by order_no)b on a.order_no=b.order_no
- left join (select a.order_no,sum(notExamine)notExamine,sum(rejectCount)rejectCount
- from (select a.order_no,status ,IF(status=1,1,0)notExamine,IF(status=3,1,0)rejectCount
- from expense_account a where a.order_no in (select a.order_no from expense_account a where a.target_type = 1
- group by order_no)
- <if test="startTime !=null and endTime != null">
- and a.create_time BETWEEN #{startTime} and #{endTime}
- </if>
- )a group by order_no)c on a.order_no=c.order_no )c on a.order_no =c.order_no
- left join ( select a.order_no ,sum(c.payment_amount) paymentAmount
- from t_order_new a left join t_order_task b on a.order_no =b.order_no left join t_order_payment c on b.id =c.tid
- where c.status =3 and a.order_no in (select a.order_no from expense_account a where a.target_type = 1
- group by order_no)
- <if test="startTime !=null and endTime != null">
- and a.create_time BETWEEN #{startTime} and #{endTime}
- </if>
- group by order_no )d on a.order_no=d.order_no
- where a.order_no in (select a.order_no from expense_account a where a.target_type = 1
- <if test="startTime !=null and endTime != null">
- and a.create_time BETWEEN #{startTime} and #{endTime}
- </if>
- group by order_no)
- <if test="contactNo !=null ">
- and a.contract_no like concat('%' ,#{contactNo},'%')
- </if>
- <if test="buyerName !=null ">
- and b.buyer_name like concat('%' ,#{buyerName},'%')
- </if>
- <if test="depId !=null ">
- and a.order_dep = #{depId}
- </if>
- </select>
- <select id="selectExpenseDepCount" resultType="com.goafanti.expenseAccount.bo.ExpenseCountsBo">
- select a.id depId,a.name depName,ifnull(b.totalAmount,0) totalAmount,ifnull(b.settlementAmount,0) settlementAmount,
- c.amount ExpenseAmount,ifnull(f.paymentAmount,0) paymentAmount,d.peopleCount,c.days,c.expenseCount, e.notExamine,
- e.rejectCount
- from department a
- left join (select a.order_dep ,sum(a.total_amount)totalAmount,sum(a.settlement_amount)settlementAmount
- from t_order_new a where a.order_dep in (select a.apply_dep
- from expense_account a where a.target_type = 0 group by apply_dep)
- <if test="startTime !=null and endTime != null">
- and a.create_time BETWEEN #{startTime} and #{endTime}
- </if>
- group by a.order_dep )b on a.id=b.order_dep
- left join (select a.apply_dep,count(a.id)expenseCount, sum(ROUND(a.duration/7.5) )days ,sum(a.amount)amount
- from expense_account a where a.apply_dep in (select a.apply_dep from expense_account a where a.target_type = 0 group by apply_dep)
- and a.status=2
- <if test="startTime !=null and endTime != null">
- and a.create_time BETWEEN #{startTime} and #{endTime}
- </if>
- group by apply_dep )c on a.id=c.apply_dep
- left join (select apply_dep,count(aid)peopleCount from (select a.apply_dep,aid from expense_account a where a.apply_dep in
- (select a.apply_dep
- from expense_account a where a.target_type = 0 group by apply_dep)
- and a.status=2
- <if test="startTime !=null and endTime != null">
- and a.create_time BETWEEN #{startTime} and #{endTime}
- </if>
- group by apply_dep,aid )a group by apply_dep)d on a.id=d.apply_dep
- left join (select a.apply_dep,sum(notExamine)notExamine,sum(rejectCount)rejectCount
- from (select a.apply_dep,status ,IF(status=1,1,0)notExamine,IF(status=3,1,0)rejectCount
- from expense_account a where a.apply_dep in (select a.apply_dep from expense_account a where a.target_type = 0 group by apply_dep)
- <if test="startTime !=null and endTime != null">
- and a.create_time BETWEEN #{startTime} and #{endTime}
- </if>
- )a group by apply_dep)e on a.id=e.apply_dep
- left join (select a.order_dep ,sum(c.payment_amount) paymentAmount from t_order_new a
- left join t_order_task b on a.order_no =b.order_no left join t_order_payment c on b.id =c.tid
- where c.status =3 and a.order_dep in (select a.apply_dep from expense_account a where a.target_type = 0 group by apply_dep)
- <if test="startTime !=null and endTime != null">
- and a.create_time BETWEEN #{startTime} and #{endTime}
- </if>
- group by order_dep )f on a.id=f.order_dep
- where a.id in (select a.apply_dep
- from expense_account a where a.target_type = 0
- <if test="startTime !=null and endTime != null">
- and a.create_time BETWEEN #{startTime} and #{endTime}
- </if>
- group by apply_dep)
- <if test="depId !=null ">
- and a.id = #{depId}
- </if>
- </select>
- </mapper>
|