| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559 |
- <?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" />
- </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
- </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
- )
- 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}
- )
- </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>
- </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>
- </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>
- </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}
- 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 ,
- date_format(a.`final_Receivables_time`, '%Y-%m-%d %H:%i:%s')finalReceivablesTime,a.order_receivables orderReceivables,a.order_arrears orderArrears
- 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 approval in(0,1,2)
- 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>
- </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="o.departmentId != null and o.departmentId != """>
- and o.order_dep = #{o.departmentId,jdbcType=INTEGER}
- </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.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 approval in(0,1,2) 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>
- </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="o.departmentId != null and o.departmentId != """>
- and o.order_dep = #{o.departmentId,jdbcType=INTEGER}
- </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.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 order_no orderNo ,salesman_id as salesmanId, a.name as salesmanName,
- o.contract_no contractNo,a.email ,u.nickname as userName,o.order_dep orderDep,
- d.name departmentName,d.finance_id financeId
- 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 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.order_status as orderStatus, a.liquidation_status as liquidationStatus,a.approval,c.salesman_name as salesmanName,
- dep.name as depName,c.finance_name as financeName,c.invoice_amount invoiceAmount,a.settlement_amount settlementAmount
- <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">
- ,f.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 (select min(id)id,order_no from t_order_task where main=1 group by order_no) ex on ex.order_no=a.order_no
- left join t_order_task e on e.id = ex.id
- left join admin f on e.task_receiver=f.id
- 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>
- 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">
- and a.order_status not in(3,5,6,7) and a.approval !=3
- and a.salesman_id = #{aid,jdbcType=VARCHAR}
- </if>
- <if test="specially == 1">
- and a.process_status = 1 and a.order_status = 1
- and a.order_dep in
- <foreach close=")" collection="deps" item="deps" open="(" separator=",">
- #{deps.id}
- </foreach>
- </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 and a.process_status != 99
- <if test="approval ==0">
- and a.approval > 0
- </if>
- <if test="approval ==1">
- and a.process_status = 7
- and a.approval = 1
- </if>
- <if test="approval ==2">
- and a.approval > 1
- </if>
- </if>
- <if test="specially == 4">
- and a.process_status in (4,5,6,99)
- and a.order_status not in(5,7)
- </if>
- <if test="specially == 5">
- and a.order_dep in
- <foreach close=")" collection="deps" item="deps" open="(" separator=",">
- #{deps.id}
- </foreach>
- </if>
- <if test="distribution == 0">
- and a.process_status < 5
- </if>
- <if test="distribution == 1">
- and a.process_status = 5
- </if>
- <if test="distribution == 2">
- and a.process_status = 6
- </if>
- <if test="name != null">
- and b.nickname like CONCAT('%',#{name,jdbcType=VARCHAR},'%')
- </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="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="depId != null">
- and a.order_dep = #{depId,jdbcType=VARCHAR}
- </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>
- 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">
- and a.order_status not in(3,5,6,7) and a.approval !=3
- and a.salesman_id = #{aid,jdbcType=VARCHAR}
- </if>
- <if test="specially == 1">
- and a.process_status = 1 and a.order_status = 1
- <!-- and c.department_id in (#{deps,jdbcType=VARCHAR}) -->
- and a.order_dep in
- <foreach close=")" collection="deps" item="deps" open="(" separator=",">
- #{deps.id}
- </foreach>
- </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 and a.process_status != 99
- <if test="approval ==0">
- and a.approval > 0
- </if>
- <if test="approval ==1">
- and a.process_status = 7
- and a.approval = 1
- </if>
- <if test="approval ==2">
- and a.approval > 1
- </if>
- </if>
- <if test="specially == 4">
- and a.process_status in (4,5,6,99)
- and a.order_status not in(5,7)
- </if>
- <if test="specially == 5">
- and a.order_dep in
- <foreach close=")" collection="deps" item="deps" open="(" separator=",">
- #{deps.id}
- </foreach>
- </if>
- <if test="distribution == 0">
- and a.process_status < 5
- </if>
- <if test="distribution == 1">
- and a.process_status = 5
- </if>
- <if test="distribution == 2">
- and a.process_status = 6
- </if>
- <if test="name != null">
- and b.nickname like CONCAT('%',#{name,jdbcType=VARCHAR},'%')
- </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="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="depId != null">
- and a.order_dep = #{depId,jdbcType=VARCHAR}
- </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,
- <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="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="depId != null">
- and b.order_dep= #{depId,jdbcType=VARCHAR}
- </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="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="depId != null">
- and b.order_dep= #{depId,jdbcType=VARCHAR}
- </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.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.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
- 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 (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 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 sum(o.settlement_amount) actuallyTotalAmount,sum(o.total_amount) 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 = 0 or o.approval = 2) 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>
- </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="o.departmentId != null and o.departmentId != """>
- and o.order_dep = #{o.departmentId,jdbcType=INTEGER}
- </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.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>
- <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="depId != null">
- and b.order_dep= #{depId,jdbcType=VARCHAR}
- </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="depId != null">
- and b.order_dep= #{depId,jdbcType=VARCHAR}
- </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>
- <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}
- </select>
- </mapper>
|