123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488 |
- <?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.dayou.mapper.FinanceRealFundMapper">
- <!-- 通用查询映射结果 -->
- <resultMap id="BaseResultMap" type="com.dayou.entity.FinanceRealFund">
- <result column="id" property="id" />
- <result column="deleted" property="deleted" />
- <result column="modified" property="modified" />
- <result column="created" property="created" />
- <result column="payer" property="payer" />
- <result column="payer_bank" property="payerBank" />
- <result column="payer_account" property="payerAccount" />
- <result column="amount" property="amount" />
- <result column="pay_datetime" property="payDatetime" />
- <result column="remark" property="remark" />
- <result column="creator_id" property="creatorId" />
- </resultMap>
- <!-- 通用查询结果列 -->
- <sql id="Base_Column_List">
- id,
- deleted,
- modified,
- created,
- payer, payer_bank, payer_account, amount, pay_datetime, remark, creator_id
- </sql>
- <select id="getPage" parameterType="com.dayou.entity.FinanceRealFund" resultType="com.dayou.vo.FinanceRealFundVO">
- SELECT
- frf.id,
- frf.created,
- frf.payer,
- frf.payer_bank,
- frf.payer_account,
- frf.amount,
- frf.pay_datetime,
- frf.remark,
- frf.creator_id,
- u.name AS creator,
- ifnull(t.ca,0) AS claimAmount,
- ( frf.amount - ifnull(t.ca,0) ) AS notClaimAmount
- FROM
- finance_real_fund frf
- LEFT JOIN user u ON u.id = frf.creator_id
- LEFT JOIN ( SELECT real_fund_id, sum(ifnull(claim_amount,0)) ca FROM finance_claim WHERE deleted = 0 GROUP BY real_fund_id ) t ON t.real_fund_id = frf.id
- WHERE
- frf.deleted = 0
- <if test="keyword!=null and keyword!='' ">
- and (
- frf.payer like concat ('%',#{keyword},'%')
- or frf.payer_bank like concat('%',#{keyword},'%')
- or u.name like concat('%',#{keyword},'%')
- or frf.payer_account like concat('%',#{keyword},'%')
- or frf.amount like concat('%',#{keyword},'%')
- or frf.remark like concat('%',#{keyword},'%')
- )
- </if>
- <if test="vo!=null and vo.startDate!=null and vo.startDate!=''">
- and frf.pay_datetime >= #{vo.startDate}
- </if>
- <if test="vo!=null and vo.endDate!=null and vo.endDate!=''">
- and frf.pay_datetime <= #{vo.endDate}
- </if>
- <if test="vo!=null and vo.xStartDate!=null and vo.xStartDate!=''">
- and frf.created >= #{vo.xStartDate}
- </if>
- <if test="vo!=null and vo.xEndDate!=null and vo.xEndDate!=''">
- and frf.created <= #{vo.xEndDate}
- </if>
- ORDER BY
- frf.created DESC
- </select>
- <select id="getNotClaimAmount" parameterType="java.lang.Long" resultType="java.math.BigDecimal">
- SELECT ( frf.amount -( SELECT ifnull( sum( claim_amount ), 0 ) AS ca FROM finance_claim WHERE deleted = 0 AND real_fund_id = #{realFundId} )
- ) AS notClaimAmount
- FROM
- finance_real_fund frf
- WHERE
- frf.id = #{realFundId}
- AND frf.deleted = 0
- </select>
- <sql id="majorOverdueSql">
- SELECT
- DATEDIFF(
- CURDATE(),
- DATE( mp.repertory_out_time )) AS overdueDay,
- m.allot_type,
- m.order_id,
- m.business_object_type,
- u.NAME AS clientManager,
- u1.NAME AS principal,
- cc1.NAME AS clientName,
- cc2.NAME AS clientSubName,
- pf.production_should_amount,
- of.should_amount,
- mp.*
- FROM
- (
- SELECT
- id,
- major_id,
- report_no,
- ( CASE production WHEN 'STATEMENT' THEN '意见书' WHEN 'REPORT' THEN '报告' WHEN 'LETTER' THEN '复评函' ELSE '' END ) production,
- NAME,
- evaluate_amount,
- repertory_out_time,
- standard_amount
- FROM
- major_production mp
- WHERE
- deleted = 0
- AND repertory_out_time IS NOT NULL and production != 'STATEMENT'
- ) mp
- LEFT JOIN ( SELECT business_id, production_no, production_should_amount, real_amount FROM production_fund WHERE business_type = 'MAJOR_BUSINESS' AND deleted = 0 ) pf ON ( mp.major_id = pf.business_id AND mp.report_no = pf.production_no )
- left join ( SELECT business_id,should_amount FROM order_fund WHERE business_type = 'MAJOR_BUSINESS' AND deleted = 0 ) of ON of.business_id = mp.major_id
- LEFT JOIN major m ON m.id = mp.major_id
- LEFT JOIN user u ON u.id = m.client_manager_id
- LEFT JOIN user u1 ON u1.id = m.principal_id
- LEFT JOIN customer_company cc1 ON cc1.id = m.clientele_id
- LEFT JOIN customer_company cc2 ON cc2.id = m.clientele_sub_id
- WHERE
- mp.production != 'STATEMENT'
- AND ( pf.production_no IS NULL OR pf.real_amount IS NULL )
- AND DATEDIFF(CURDATE(),DATE( mp.repertory_out_time )) >= #{overdueVO.overdueMin}
- <if test="overdueVO!=null and overdueVO.overdueMax!=null">
- AND DATEDIFF(CURDATE(),DATE( mp.repertory_out_time )) <= #{overdueVO.overdueMax}
- </if>
- <if test="overdueVO!=null and overdueVO.orderId!=null and overdueVO.orderId!=''">
- and m.order_id = #{overdueVO.orderId}
- </if>
- <if test="overdueVO!=null and overdueVO.reportNo!=null and overdueVO.reportNo!=''">
- and mp.report_no like concat ('%',#{overdueVO.reportNo},'%')
- </if>
- <if test="overdueVO!=null and overdueVO.principal!=null and overdueVO.principal!=''">
- and u1.NAME like concat ('%',#{overdueVO.principal},'%')
- </if>
- order by overdueDay desc
- </sql>
- <select id="overdueMajor" parameterType="com.dayou.vo.MajorProdOverdueVO" resultType="com.dayou.vo.MajorProdOverdueVO">
- <include refid="majorOverdueSql" />
- </select>
- <select id="overdueMajorExport" parameterType="com.dayou.vo.MajorProdOverdueVO" resultType="com.dayou.vo.MajorProdOverdueVO">
- <include refid="majorOverdueSql" />
- </select>
- <sql id="majorEvaluatorSettleSql">
- SELECT
- mp.id,
- fc.claim_amount,
- m.order_id,
- mp.report_no,
- fc.claim_datetime as claimDate,
- mp.save_file_date,
- IF
- ( fc.claim_datetime > mp.save_file_date, fc.claim_datetime, mp.save_file_date ) AS settleDate,
- mp.NAME,
- m.bailor,
- mp.evaluate_amount,
- u.NAME AS principal,
- u1.NAME AS clientManager,
- cc.NAME AS clientName,
- cc1.NAME AS clientSubName,
- d.NAME AS evaluateDepartmentName,
- (
- SELECT
- GROUP_CONCAT( NAME )
- FROM
- department
- WHERE
- id IN (
- SELECT
- department_id
- FROM
- post
- WHERE
- id IN ( SELECT post_id FROM user_post WHERE user_id = m.client_manager_id ))) AS marketDepartmentName
- FROM
- (
- SELECT
- claim_amount,
- order_fund_id,
- production_fund_id,
- claim_datetime
- FROM
- finance_claim
- WHERE
- deleted = 0
- AND production_fund_id IS NOT NULL
- AND claim_datetime >= #{settleVO.startDate}
- AND claim_datetime <= #{settleVO.endDate} UNION ALL
- SELECT allot_amount AS claim_amount, order_fund_id, production_fund_id, created AS claim_datetime FROM order_fund_allot WHERE deleted = 0
- AND created >= #{settleVO.startDate}
- AND created <= #{settleVO.endDate}
- ) fc
- INNER JOIN ( SELECT id, order_fund_id, business_id, production_no FROM production_fund WHERE business_type = 'MAJOR_BUSINESS' AND deleted = 0 ) pf ON ( pf.id = fc.production_fund_id AND pf.order_fund_id = fc.order_fund_id )
- INNER JOIN ( SELECT id, major_id, NAME, report_no, production, evaluate_amount, save_file_date FROM major_production WHERE deleted = 0 AND save_file_date IS NOT NULL ) mp ON mp.report_no = pf.production_no
- LEFT JOIN major m ON m.id = mp.major_id
- LEFT JOIN user u ON u.id = m.principal_id
- LEFT JOIN user u1 ON u1.id = m.client_manager_id
- LEFT JOIN customer_company cc ON cc.id = m.clientele_id
- LEFT JOIN customer_company cc1 ON cc1.id = m.clientele_sub_id
- LEFT JOIN department d ON d.id = m.department_id
- <where>
- <if test="settleVO!=null and settleVO.orderId!=null and settleVO.orderId!='' ">
- and m.order_id = #{settleVO.orderId}
- </if>
- <if test="settleVO!=null and settleVO.reportNo!=null and settleVO.reportNo!='' ">
- and mp.report_no like concat ('%',#{settleVO.reportNo},'%')
- </if>
- <if test="settleVO!=null and settleVO.principal!=null and settleVO.principal!='' ">
- and u.name like concat ('%',#{settleVO.principal},'%')
- </if>
- <if test="settleVO!=null and settleVO.clientManager!=null and settleVO.clientManager!='' ">
- and u1.name like concat ('%',#{settleVO.clientManager},'%')
- </if>
- </where>
- order by settleDate DESC
- </sql>
- <select id="majorEvaluatorSettleProd" parameterType="com.dayou.vo.SettleMajorProductionVO" resultType="com.dayou.vo.SettleMajorProductionVO">
- <include refid="majorEvaluatorSettleSql" />
- </select>
- <select id="majorEvaluatorSettleExport" parameterType="com.dayou.vo.SettleMajorProductionVO" resultType="com.dayou.vo.SettleMajorProductionVO">
- <include refid="majorEvaluatorSettleSql" />
- </select>
- <sql id="majorMarketerSettleSql">
- SELECT
- mp.id,
- fc.claim_amount,
- m.order_id,
- mp.report_no,
- fc.claim_datetime,
- mp.delivery_date,
- IF
- ( fc.claim_datetime > mp.delivery_date, fc.claim_datetime, mp.delivery_date ) AS settleDate,
- mp.NAME,
- m.bailor,
- mp.evaluate_amount,
- u.NAME AS principal,
- u1.NAME AS clientManager,
- cc.NAME AS clientName,
- cc1.NAME AS clientSubName,
- d.NAME AS evaluateDepartmentName,
- (
- SELECT
- GROUP_CONCAT( NAME )
- FROM
- department
- WHERE
- id IN (
- SELECT
- department_id
- FROM
- post
- WHERE
- id IN ( SELECT post_id FROM user_post WHERE user_id = m.client_manager_id ))) AS marketDepartmentName
- FROM
- (
- SELECT
- claim_amount,
- order_fund_id,
- production_fund_id,
- claim_datetime
- FROM
- finance_claim
- WHERE
- deleted = 0
- AND production_fund_id IS NOT NULL
- AND claim_datetime >= #{settleVO.startDate}
- AND claim_datetime <= #{settleVO.endDate} UNION ALL
- SELECT allot_amount AS claim_amount, order_fund_id, production_fund_id, created AS claim_datetime FROM order_fund_allot WHERE deleted = 0
- AND created >= #{settleVO.startDate}
- AND created <= #{settleVO.endDate}
- ) fc
- INNER JOIN ( SELECT id, order_fund_id, business_id, production_no FROM production_fund WHERE business_type = 'MAJOR_BUSINESS' AND deleted = 0 ) pf ON ( pf.id = fc.production_fund_id AND pf.order_fund_id = fc.order_fund_id )
- INNER JOIN ( SELECT id, major_id, NAME, report_no, production, evaluate_amount, delivery_date FROM major_production WHERE deleted = 0 AND delivery_date IS NOT NULL ) mp ON mp.report_no = pf.production_no
- LEFT JOIN major m ON m.id = mp.major_id
- LEFT JOIN user u ON u.id = m.principal_id
- LEFT JOIN user u1 ON u1.id = m.client_manager_id
- LEFT JOIN customer_company cc ON cc.id = m.clientele_id
- LEFT JOIN customer_company cc1 ON cc1.id = m.clientele_sub_id
- LEFT JOIN department d ON d.id = m.department_id
- <where>
- <if test="settleVO!=null and settleVO.orderId!=null and settleVO.orderId!='' ">
- and m.order_id = #{settleVO.orderId}
- </if>
- <if test="settleVO!=null and settleVO.reportNo!=null and settleVO.reportNo!='' ">
- and mp.report_no like concat ('%',#{settleVO.reportNo},'%')
- </if>
- <if test="settleVO!=null and settleVO.principal!=null and settleVO.principal!='' ">
- and u.name like concat ('%',#{settleVO.principal},'%')
- </if>
- <if test="settleVO!=null and settleVO.clientManager!=null and settleVO.clientManager!='' ">
- and u1.name like concat ('%',#{settleVO.clientManager},'%')
- </if>
- </where>
- order by settleDate DESC
- </sql>
- <select id="majorMarketerSettleProd" parameterType="com.dayou.vo.SettleMajorProductionVO" resultType="com.dayou.vo.SettleMajorProductionVO">
- <include refid="majorMarketerSettleSql" />
- </select>
- <select id="majorMarketSettleExport" parameterType="com.dayou.vo.SettleMajorProductionVO" resultType="com.dayou.vo.SettleMajorProductionVO">
- <include refid="majorMarketerSettleSql" />
- </select>
- <select id="majorEvaluatorCommission" parameterType="com.dayou.vo.UserCommissionTotalAmountVO" resultType="com.dayou.vo.UserCommissionTotalAmountVO">
- SELECT mpa.user_id as id, u.name as userName, sum(( fc.claim_amount * ( bcr.min_ratio / 100 )* mpa.ratio )) AS commissionTotalAmount
- FROM
- (
- SELECT
- claim_amount,
- order_fund_id,
- production_fund_id,
- claim_datetime
- FROM
- finance_claim
- WHERE
- deleted = 0
- AND production_fund_id IS NOT NULL
- AND claim_datetime >= #{vo.startDate}
- AND claim_datetime <= #{vo.endDate}
- UNION ALL
- SELECT
- allot_amount AS claim_amount,
- order_fund_id,
- production_fund_id,
- created AS claim_datetime
- FROM
- order_fund_allot
- WHERE
- deleted = 0
- AND created >= #{vo.startDate}
- AND created <= #{vo.endDate}
- ) fc
- INNER JOIN ( SELECT id, order_fund_id, business_id, production_no FROM production_fund WHERE business_type = 'MAJOR_BUSINESS' AND deleted = 0 ) pf ON ( pf.id = fc.production_fund_id AND pf.order_fund_id = fc.order_fund_id )
- INNER JOIN ( SELECT id, major_id, NAME, report_no, production, save_file_date, created FROM major_production WHERE deleted = 0 AND save_file_date IS NOT NULL ) mp ON mp.report_no = pf.production_no
- LEFT JOIN major m ON m.id = mp.major_id
- INNER JOIN ( SELECT id, business_id, production_id, commission_rate_id FROM commission_declare WHERE business_type = 'COMMISSION_DECLARE_MAJOR_EVALUATE' AND deleted = 0 AND declare_result = '审核通过' ) cd ON (
- cd.business_id = m.id
- AND ( cd.production_id IS NULL OR cd.production_id = mp.id ))
- LEFT JOIN business_commission_rate bcr ON bcr.id = cd.commission_rate_id
- LEFT JOIN dict_data dd ON dd.id = bcr.business_cate_id
- LEFT JOIN ( SELECT major_id, major_production_id, user_id, ratio FROM major_production_allot WHERE deleted = 0 AND user_type = 'EVALUATE'
- ) mpa ON ( mpa.major_id = m.id AND mpa.major_production_id = mp.id)
- LEFT JOIN user u ON u.id = mpa.user_id
- GROUP BY
- mpa.user_id
- having 1=1
- <if test="vo!=null and vo.userName!=null and vo.userName!=''">
- and u.name like concat ('%',#{vo.userName},'%')
- </if>
- order by commissionTotalAmount DESC
- </select>
- <select id="majorEvaluatorCommissionDetail" parameterType="com.dayou.vo.UserCommissionProdVO" resultType="com.dayou.vo.UserCommissionProdVO">
- SELECT
- mp.id,
- fc.claim_amount as realAmount,
- mp.report_no,
- IF
- ( fc.claim_datetime > mp.save_file_date, fc.claim_datetime, mp.save_file_date ) AS settleDate,
- mp.NAME,
- mp.created,
- dd.NAME AS businessCate,
- bcr.min_ratio AS ratio,
- mpa.user_id,
- mpa.ratio AS allotRatio,
- ( fc.claim_amount * ( bcr.min_ratio / 100 )* mpa.ratio ) AS commissionAmount,
- ( fc.claim_amount * ( bcr.min_ratio / 100 ) ) AS totalAmount,
- u.name as userName
- FROM
- (
- SELECT
- claim_amount,
- order_fund_id,
- production_fund_id,
- claim_datetime
- FROM
- finance_claim
- WHERE
- deleted = 0
- AND production_fund_id IS NOT NULL
- AND claim_datetime >= #{vo.startDate}
- AND claim_datetime <= #{vo.endDate}
- UNION ALL
- SELECT
- allot_amount AS claim_amount,
- order_fund_id,
- production_fund_id,
- created AS claim_datetime
- FROM
- order_fund_allot
- WHERE
- deleted = 0
- AND created >= #{vo.startDate}
- AND created <= #{vo.endDate}
- ) fc
- INNER JOIN ( SELECT id, order_fund_id, business_id, production_no FROM production_fund WHERE business_type = 'MAJOR_BUSINESS' AND deleted = 0 ) pf ON ( pf.id = fc.production_fund_id AND pf.order_fund_id = fc.order_fund_id )
- INNER JOIN ( SELECT id, major_id, NAME, report_no, production, save_file_date, created FROM major_production WHERE deleted = 0 AND save_file_date IS NOT NULL ) mp ON mp.report_no = pf.production_no
- LEFT JOIN major m ON m.id = mp.major_id
- INNER JOIN ( SELECT id, business_id, production_id, commission_rate_id FROM commission_declare WHERE business_type = 'COMMISSION_DECLARE_MAJOR_EVALUATE' AND deleted = 0 AND declare_result = '审核通过' ) cd ON (
- cd.business_id = m.id
- AND ( cd.production_id IS NULL OR cd.production_id = mp.id ))
- LEFT JOIN business_commission_rate bcr ON bcr.id = cd.commission_rate_id
- LEFT JOIN dict_data dd ON dd.id = bcr.business_cate_id
- LEFT JOIN ( SELECT major_id, major_production_id, user_id, ratio FROM major_production_allot WHERE deleted = 0 AND user_type = 'EVALUATE' ) mpa ON ( mpa.major_id = m.id AND mpa.major_production_id = mp.id)
- LEFT JOIN user u on u.id = mpa.user_id
- WHERE
- mpa.user_id = #{vo.userId}
- order by settleDate DESC
- </select>
- <select id="majorEvaluatorTotalAmountExport" parameterType="com.dayou.vo.UserCommissionTotalAmountVO" resultType="com.dayou.vo.UserCommissionTotalAmountVO">
- SELECT mpa.user_id as id, u.name as userName, ROUND(sum(( fc.claim_amount * ( bcr.min_ratio / 100 )* mpa.ratio )),2) AS commissionTotalAmount,
- '评估人员' as userType,
- '大中型业务' as businessType,
- #{vo.startDate} as startDate,
- #{vo.endDate} as endDate
- FROM
- (
- SELECT
- claim_amount,
- order_fund_id,
- production_fund_id,
- claim_datetime
- FROM
- finance_claim
- WHERE
- deleted = 0
- AND production_fund_id IS NOT NULL
- AND claim_datetime >= #{vo.startDate}
- AND claim_datetime <= #{vo.endDate}
- UNION ALL
- SELECT
- allot_amount AS claim_amount,
- order_fund_id,
- production_fund_id,
- created AS claim_datetime
- FROM
- order_fund_allot
- WHERE
- deleted = 0
- AND created >= #{vo.startDate}
- AND created <= #{vo.endDate}
- ) fc
- INNER JOIN ( SELECT id, order_fund_id, business_id, production_no FROM production_fund WHERE business_type = 'MAJOR_BUSINESS' AND deleted = 0 ) pf ON ( pf.id = fc.production_fund_id AND pf.order_fund_id = fc.order_fund_id )
- INNER JOIN ( SELECT id, major_id, NAME, report_no, production, save_file_date, created FROM major_production WHERE deleted = 0 AND save_file_date IS NOT NULL ) mp ON mp.report_no = pf.production_no
- LEFT JOIN major m ON m.id = mp.major_id
- INNER JOIN ( SELECT id, business_id, production_id, commission_rate_id FROM commission_declare WHERE business_type = 'COMMISSION_DECLARE_MAJOR_EVALUATE' AND deleted = 0 AND declare_result = '审核通过' ) cd ON (
- cd.business_id = m.id
- AND ( cd.production_id IS NULL OR cd.production_id = mp.id ))
- LEFT JOIN business_commission_rate bcr ON bcr.id = cd.commission_rate_id
- LEFT JOIN dict_data dd ON dd.id = bcr.business_cate_id
- LEFT JOIN ( SELECT major_id, major_production_id, user_id, ratio FROM major_production_allot WHERE deleted = 0 AND user_type = 'EVALUATE'
- ) mpa ON ( mpa.major_id = m.id AND mpa.major_production_id = mp.id)
- LEFT JOIN user u ON u.id = mpa.user_id
- GROUP BY
- mpa.user_id
- </select>
- <select id="evaluatorUserDetailExport" parameterType="com.dayou.vo.UserCommissionProdVO" resultType="com.dayou.vo.UserCommissionProdVO">
- SELECT
- mp.id,
- ROUND(fc.claim_amount,2) as realAmount,
- mp.report_no,
- IF
- ( fc.claim_datetime > mp.save_file_date, fc.claim_datetime, mp.save_file_date ) AS settleDate,
- mp.NAME,
- mp.created,
- dd.NAME AS businessCate,
- ROUND(bcr.min_ratio,2) AS ratio,
- mpa.user_id,
- ROUND(mpa.ratio*100,2) AS allotRatio,
- ROUND(( fc.claim_amount * ( bcr.min_ratio / 100 )* mpa.ratio ),2) AS commissionAmount,
- ROUND(( fc.claim_amount * ( bcr.min_ratio / 100 ) ),2) AS totalAmount,
- u.name as userName
- FROM
- (
- SELECT
- claim_amount,
- order_fund_id,
- production_fund_id,
- claim_datetime
- FROM
- finance_claim
- WHERE
- deleted = 0
- AND production_fund_id IS NOT NULL
- AND claim_datetime >= #{vo.startDate}
- AND claim_datetime <= #{vo.endDate}
- UNION ALL
- SELECT
- allot_amount AS claim_amount,
- order_fund_id,
- production_fund_id,
- created AS claim_datetime
- FROM
- order_fund_allot
- WHERE
- deleted = 0
- AND created >= #{vo.startDate}
- AND created <= #{vo.endDate}
- ) fc
- INNER JOIN ( SELECT id, order_fund_id, business_id, production_no FROM production_fund WHERE business_type = 'MAJOR_BUSINESS' AND deleted = 0 ) pf ON ( pf.id = fc.production_fund_id AND pf.order_fund_id = fc.order_fund_id )
- INNER JOIN ( SELECT id, major_id, NAME, report_no, production, save_file_date, created FROM major_production WHERE deleted = 0 AND save_file_date IS NOT NULL ) mp ON mp.report_no = pf.production_no
- LEFT JOIN major m ON m.id = mp.major_id
- INNER JOIN ( SELECT id, business_id, production_id, commission_rate_id FROM commission_declare WHERE business_type = 'COMMISSION_DECLARE_MAJOR_EVALUATE' AND deleted = 0 AND declare_result = '审核通过' ) cd ON (
- cd.business_id = m.id
- AND ( cd.production_id IS NULL OR cd.production_id = mp.id ))
- LEFT JOIN business_commission_rate bcr ON bcr.id = cd.commission_rate_id
- LEFT JOIN dict_data dd ON dd.id = bcr.business_cate_id
- LEFT JOIN ( SELECT major_id, major_production_id, user_id, ratio FROM major_production_allot WHERE deleted = 0 AND user_type = 'EVALUATE' ) mpa ON ( mpa.major_id = m.id AND mpa.major_production_id = mp.id)
- LEFT JOIN user u on u.id = mpa.user_id
- <where>
- <if test="vo!=null and vo.userId!=null">
- and mpa.user_id = #{vo.userId}
- </if>
- </where>
- order by mpa.user_id
- </select>
- <select id="majorMarketCommission" parameterType="com.dayou.vo.UserCommissionTotalAmountVO" resultType="com.dayou.vo.UserCommissionTotalAmountVO">
- SELECT mpa.user_id as id, u.name as userName, sum(( fc.claim_amount * ( bcr.min_ratio / 100 )* mpa.ratio )) AS commissionTotalAmount
- FROM
- (
- SELECT
- claim_amount,
- order_fund_id,
- production_fund_id,
- claim_datetime
- FROM
- finance_claim
- WHERE
- deleted = 0
- AND production_fund_id IS NOT NULL
- AND claim_datetime >= #{vo.startDate}
- AND claim_datetime <= #{vo.endDate}
- UNION ALL SELECT allot_amount AS claim_amount, order_fund_id, production_fund_id, created AS claim_datetime FROM order_fund_allot WHERE deleted = 0
- AND created >= #{vo.startDate}
- AND created <= #{vo.endDate}
- ) fc
- INNER JOIN ( SELECT id, order_fund_id, business_id, production_no FROM production_fund WHERE business_type = 'MAJOR_BUSINESS' AND deleted = 0 ) pf ON ( pf.id = fc.production_fund_id AND pf.order_fund_id = fc.order_fund_id )
- INNER JOIN ( SELECT id, major_id, NAME, report_no, production, save_file_date, created FROM major_production WHERE deleted = 0 AND delivery_date IS NOT NULL ) mp ON mp.report_no = pf.production_no
- LEFT JOIN major m ON m.id = mp.major_id
- INNER JOIN ( SELECT id, business_id, production_id, commission_rate_id FROM commission_declare WHERE business_type = 'COMMISSION_DECLARE_MAJOR_MARKET' AND deleted = 0 AND declare_result = '审核通过' ) cd ON (
- cd.business_id = m.id
- AND ( cd.production_id IS NULL OR cd.production_id = mp.id ))
- LEFT JOIN business_commission_rate bcr ON bcr.id = cd.commission_rate_id
- LEFT JOIN dict_data dd ON dd.id = bcr.business_cate_id
- LEFT JOIN ( SELECT major_id, major_production_id,declare_id, user_id, ratio FROM major_production_allot WHERE deleted = 0 AND user_type = 'MARKET'
- ) mpa ON ( mpa.major_id = m.id AND cd.id = mpa.declare_id AND (mpa.major_production_id is null or mpa.major_production_id = mp.id ))
- LEFT JOIN user u ON u.id = mpa.user_id
- GROUP BY
- mpa.user_id
- having 1=1
- <if test="vo!=null and vo.userName!=null and vo.userName!=''">
- and u.name like concat ('%',#{vo.userName},'%')
- </if>
- order by commissionTotalAmount DESC
- </select>
- <select id="majorMarketCommissionDetail" parameterType="com.dayou.vo.UserCommissionProdVO" resultType="com.dayou.vo.UserCommissionProdVO">
- SELECT
- mp.id,
- fc.claim_amount as realAmount,
- mp.report_no,
- IF
- ( fc.claim_datetime > mp.save_file_date, fc.claim_datetime, mp.save_file_date ) AS settleDate,
- mp.NAME,
- mp.created,
- dd.NAME AS businessCate,
- bcr.min_ratio AS ratio,
- mpa.user_id,
- mpa.ratio AS allotRatio,
- ( fc.claim_amount * ( bcr.min_ratio / 100 )* mpa.ratio ) AS commissionAmount,
- ( fc.claim_amount * ( bcr.min_ratio / 100 ) ) AS totalAmount,
- u.name as userName
- FROM
- (
- SELECT
- claim_amount,
- order_fund_id,
- production_fund_id,
- claim_datetime
- FROM
- finance_claim
- WHERE
- deleted = 0
- AND production_fund_id IS NOT NULL
- AND claim_datetime >= #{vo.startDate}
- AND claim_datetime <= #{vo.endDate}
- UNION ALL
- SELECT
- allot_amount AS claim_amount,
- order_fund_id,
- production_fund_id,
- created AS claim_datetime
- FROM
- order_fund_allot
- WHERE
- deleted = 0
- AND created >= #{vo.startDate}
- AND created <= #{vo.endDate}
- ) fc
- INNER JOIN ( SELECT id, order_fund_id, business_id, production_no FROM production_fund WHERE business_type = 'MAJOR_BUSINESS' AND deleted = 0 ) pf ON ( pf.id = fc.production_fund_id AND pf.order_fund_id = fc.order_fund_id )
- INNER JOIN ( SELECT id, major_id, NAME, report_no, production, save_file_date, created FROM major_production WHERE deleted = 0 AND delivery_date IS NOT NULL ) mp ON mp.report_no = pf.production_no
- LEFT JOIN major m ON m.id = mp.major_id
- INNER JOIN ( SELECT id, business_id, production_id, commission_rate_id FROM commission_declare WHERE business_type = 'COMMISSION_DECLARE_MAJOR_MARKET' AND deleted = 0 AND declare_result = '审核通过' ) cd ON (
- cd.business_id = m.id
- AND ( cd.production_id IS NULL OR cd.production_id = mp.id ))
- LEFT JOIN business_commission_rate bcr ON bcr.id = cd.commission_rate_id
- LEFT JOIN dict_data dd ON dd.id = bcr.business_cate_id
- LEFT JOIN ( SELECT major_id, major_production_id, user_id, ratio,declare_id FROM major_production_allot WHERE deleted = 0 AND user_type = 'MARKET' ) mpa ON ( mpa.major_id = m.id AND cd.id = mpa.declare_id AND (mpa.major_production_id is null or mpa.major_production_id = mp.id ))
- LEFT JOIN user u on u.id = mpa.user_id
- WHERE
- mpa.user_id = #{vo.userId}
- order by settleDate DESC
- </select>
- <select id="majorMarketTotalAmountExport" parameterType="com.dayou.vo.UserCommissionTotalAmountVO" resultType="com.dayou.vo.UserCommissionTotalAmountVO">
- SELECT mpa.user_id as id, u.name as userName, ROUND(sum(( fc.claim_amount * ( bcr.min_ratio / 100 )* mpa.ratio )),2) AS commissionTotalAmount,
- '市场人员' as userType,
- '大中型业务' as businessType,
- #{vo.startDate} as startDate,
- #{vo.endDate} as endDate
- FROM
- (
- SELECT
- claim_amount,
- order_fund_id,
- production_fund_id,
- claim_datetime
- FROM
- finance_claim
- WHERE
- deleted = 0
- AND production_fund_id IS NOT NULL
- AND claim_datetime >= #{vo.startDate}
- AND claim_datetime <= #{vo.endDate}
- UNION ALL
- SELECT allot_amount AS claim_amount, order_fund_id, production_fund_id, created AS claim_datetime FROM order_fund_allot WHERE deleted = 0
- AND created >= #{vo.startDate}
- AND created <= #{vo.endDate}
- ) fc
- INNER JOIN ( SELECT id, order_fund_id, business_id, production_no FROM production_fund WHERE business_type = 'MAJOR_BUSINESS' AND deleted = 0 ) pf ON ( pf.id = fc.production_fund_id AND pf.order_fund_id = fc.order_fund_id )
- INNER JOIN ( SELECT id, major_id, NAME, report_no, production, save_file_date, created FROM major_production WHERE deleted = 0 AND delivery_date IS NOT NULL ) mp ON mp.report_no = pf.production_no
- LEFT JOIN major m ON m.id = mp.major_id
- INNER JOIN ( SELECT id, business_id, production_id, commission_rate_id FROM commission_declare WHERE business_type = 'COMMISSION_DECLARE_MAJOR_MARKET' AND deleted = 0 AND declare_result = '审核通过' ) cd ON (
- cd.business_id = m.id
- AND ( cd.production_id IS NULL OR cd.production_id = mp.id ))
- LEFT JOIN business_commission_rate bcr ON bcr.id = cd.commission_rate_id
- LEFT JOIN dict_data dd ON dd.id = bcr.business_cate_id
- LEFT JOIN ( SELECT major_id, major_production_id,declare_id, user_id, ratio FROM major_production_allot WHERE deleted = 0 AND user_type = 'MARKET'
- ) mpa ON ( mpa.major_id = m.id AND cd.id = mpa.declare_id AND (mpa.major_production_id is null or mpa.major_production_id = mp.id ))
- LEFT JOIN user u ON u.id = mpa.user_id
- GROUP BY
- mpa.user_id
- order by commissionTotalAmount DESC
- </select>
- <select id="marketUserDetailExport" parameterType="com.dayou.vo.UserCommissionProdVO" resultType="com.dayou.vo.UserCommissionProdVO">
- SELECT
- mp.id,
- ROUND(fc.claim_amount,2) as realAmount,
- mp.report_no,
- IF
- ( fc.claim_datetime > mp.save_file_date, fc.claim_datetime, mp.save_file_date ) AS settleDate,
- mp.NAME,
- mp.created,
- dd.NAME AS businessCate,
- ROUND(bcr.min_ratio,2) AS ratio,
- mpa.user_id,
- ROUND(mpa.ratio*100,2) AS allotRatio,
- ROUND(( fc.claim_amount * ( bcr.min_ratio / 100 )* mpa.ratio ),2) AS commissionAmount,
- ROUND(( fc.claim_amount * ( bcr.min_ratio / 100 ) ),2) AS totalAmount,
- u.name as userName
- FROM
- (
- SELECT
- claim_amount,
- order_fund_id,
- production_fund_id,
- claim_datetime
- FROM
- finance_claim
- WHERE
- deleted = 0
- AND production_fund_id IS NOT NULL
- AND claim_datetime >= #{vo.startDate}
- AND claim_datetime <= #{vo.endDate}
- UNION ALL
- SELECT
- allot_amount AS claim_amount,
- order_fund_id,
- production_fund_id,
- created AS claim_datetime
- FROM
- order_fund_allot
- WHERE
- deleted = 0
- AND created >= #{vo.startDate}
- AND created <= #{vo.endDate}
- ) fc
- INNER JOIN ( SELECT id, order_fund_id, business_id, production_no FROM production_fund WHERE business_type = 'MAJOR_BUSINESS' AND deleted = 0 ) pf ON ( pf.id = fc.production_fund_id AND pf.order_fund_id = fc.order_fund_id )
- INNER JOIN ( SELECT id, major_id, NAME, report_no, production, save_file_date, created FROM major_production WHERE deleted = 0 AND delivery_date IS NOT NULL ) mp ON mp.report_no = pf.production_no
- LEFT JOIN major m ON m.id = mp.major_id
- INNER JOIN ( SELECT id, business_id, production_id, commission_rate_id FROM commission_declare WHERE business_type = 'COMMISSION_DECLARE_MAJOR_MARKET' AND deleted = 0 AND declare_result = '审核通过' ) cd ON (
- cd.business_id = m.id
- AND ( cd.production_id IS NULL OR cd.production_id = mp.id ))
- LEFT JOIN business_commission_rate bcr ON bcr.id = cd.commission_rate_id
- LEFT JOIN dict_data dd ON dd.id = bcr.business_cate_id
- LEFT JOIN ( SELECT major_id, major_production_id, user_id, ratio,declare_id FROM major_production_allot WHERE deleted = 0 AND user_type = 'MARKET' ) mpa ON ( mpa.major_id = m.id AND cd.id = mpa.declare_id AND (mpa.major_production_id is null or mpa.major_production_id = mp.id ))
- LEFT JOIN user u on u.id = mpa.user_id
- <where>
- <if test="vo!=null and vo.userId!=null">
- and mpa.user_id = #{vo.userId}
- </if>
- </where>
- order by mpa.user_id
- </select>
- <select id="overduePersonal" parameterType="com.dayou.vo.PersonalProdOverdueVO" resultType="com.dayou.vo.PersonalProdOverdueVO">
- </select>
- <!--资产评估人员提成计算-->
- <select id="assetsEvaluatorCommission" resultType="com.dayou.vo.UserCommissionTotalAmountVO">
- SELECT bpd.member_id as id,
- u.name as userName,
- SUM(IF(cd.defined_low_limit_amount < fc.claim_amount,
- fc.claim_amount * (cd.ratio / 100) * (bpd.performance_distribution / 100),
- cd.defined_low_limit_amount * (cd.ratio / 100) * (bpd.performance_distribution / 100)
- )) AS commissionTotalAmount
- FROM
- (
- SELECT
- claim_amount,
- order_fund_id,
- production_fund_id,
- claim_datetime
- FROM
- finance_claim
- WHERE
- deleted = 0
- AND production_fund_id IS NOT NULL
- AND claim_datetime >= #{vo.startDate}
- AND claim_datetime <= #{vo.endDate}
- UNION ALL
- SELECT
- allot_amount AS claim_amount,
- order_fund_id,
- production_fund_id,
- created AS claim_datetime
- FROM
- order_fund_allot
- WHERE
- deleted = 0
- AND created >= #{vo.startDate}
- AND created <= #{vo.endDate}
- ) fc
- INNER JOIN ( SELECT id, order_fund_id, business_id, production_no FROM production_fund WHERE business_type =
- 'ASSET_BUSINESS' AND deleted = 0 ) pf ON ( pf.id = fc.production_fund_id AND pf.order_fund_id = fc.order_fund_id
- )
- INNER JOIN ( SELECT id, business_id, project_name, production_no, production_type, save_file_date, created FROM
- assets_production
- WHERE deleted = 0 AND save_file_date IS NOT NULL ) ap ON ap.production_no = pf.production_no
- LEFT JOIN assets a ON a.id = ap.business_id
- INNER JOIN ( SELECT id, business_id, production_id, commission_rate_id, ratio, defined_low_limit_amount FROM
- commission_declare WHERE
- business_type = 'COMMISSION_DECLARE_ASSET_EVALUATE' AND deleted = 0 AND declare_result = '审核通过' ) cd ON (
- cd.business_id = a.id
- AND ( cd.production_id IS NULL OR cd.production_id = ap.id ))
- LEFT JOIN business_commission_rate bcr ON bcr.id = cd.commission_rate_id
- LEFT JOIN dict_data dd ON dd.id = bcr.business_cate_id
- LEFT JOIN ( SELECT business_id, report_no, member_id, performance_distribution FROM
- business_performance_distribution WHERE deleted = 0
- AND user_type = '评估人员'
- ) bpd ON ( bpd.business_id = a.id AND bpd.report_no = ap.production_no)
- LEFT JOIN user u ON u.id = bpd.member_id
- GROUP BY
- bpd.member_id
- # ,
- # u.name,
- # commissionTotalAmount
- having 1=1
- <if test="vo!=null and vo.userName!=null and vo.userName!=''">
- and u.name like concat ('%',#{vo.userName},'%')
- </if>
- order by commissionTotalAmount DESC
- </select>
- <!--资产评估人员提成计算详情-->
- <select id="assetsEvaluatorCommissionDetail" resultType="com.dayou.vo.UserCommissionProdVO">
- SELECT
- ap.id,
- fc.claim_amount as realAmount,
- ap.production_no AS reportNo,
- IF
- ( fc.claim_datetime > ap.save_file_date, fc.claim_datetime, ap.save_file_date ) AS settleDate,
- ap.project_name AS name,
- ap.created,
- dd.NAME AS businessCate,
- bcr.min_ratio AS ratio,
- bpd.member_id,
- bpd.performance_distribution AS allotRatio,
- IF(cd.defined_low_limit_amount < fc.claim_amount,
- fc.claim_amount * (cd.ratio / 100) * (bpd.performance_distribution / 100),
- cd.defined_low_limit_amount * (cd.ratio / 100) * (bpd.performance_distribution / 100)
- ) AS commissionAmount,
- IF(cd.defined_low_limit_amount < fc.claim_amount,
- fc.claim_amount * (cd.ratio / 100),
- cd.defined_low_limit_amount * (cd.ratio / 100)
- ) AS totalAmount,
- u.name as userName
- FROM
- (
- SELECT
- claim_amount,
- order_fund_id,
- production_fund_id,
- claim_datetime
- FROM
- finance_claim
- WHERE
- deleted = 0
- AND production_fund_id IS NOT NULL
- AND claim_datetime >= #{vo.startDate}
- AND claim_datetime <= #{vo.endDate}
- UNION ALL
- SELECT
- allot_amount AS claim_amount,
- order_fund_id,
- production_fund_id,
- created AS claim_datetime
- FROM
- order_fund_allot
- WHERE
- deleted = 0
- AND created >= #{vo.startDate}
- AND created <= #{vo.endDate}
- ) fc
- INNER JOIN ( SELECT id, order_fund_id, business_id, production_no FROM production_fund WHERE business_type = 'ASSET_BUSINESS' AND deleted = 0 ) pf ON ( pf.id = fc.production_fund_id AND pf.order_fund_id = fc.order_fund_id )
- INNER JOIN ( SELECT id, business_id, project_name, production_no, production_type, save_file_date, created FROM assets_production WHERE deleted = 0 AND save_file_date IS NOT NULL ) ap ON ap.production_no = pf.production_no
- LEFT JOIN assets a ON a.id = ap.business_id
- INNER JOIN ( SELECT id, business_id, production_id, commission_rate_id, ratio,defined_low_limit_amount FROM commission_declare WHERE business_type = 'COMMISSION_DECLARE_ASSET_EVALUATE' AND deleted = 0 AND declare_result = '审核通过' ) cd ON (
- cd.business_id = a.id
- AND ( cd.production_id IS NULL OR cd.production_id = ap.id ))
- LEFT JOIN business_commission_rate bcr ON bcr.id = cd.commission_rate_id
- LEFT JOIN dict_data dd ON dd.id = bcr.business_cate_id
- LEFT JOIN ( SELECT business_id, report_no, member_id, performance_distribution FROM business_performance_distribution WHERE deleted = 0 AND user_type = '评估人员' ) bpd ON ( bpd.business_id = a.id AND bpd.report_no = ap.production_no)
- LEFT JOIN user u on u.id = bpd.member_id
- WHERE
- bpd.member_id = #{vo.userId}
- order by settleDate DESC
- </select>
- <!--资产评估人员合计导出-->
- <select id="assetsEvaluatorTotalAmountExport" resultType="com.dayou.vo.UserCommissionTotalAmountVO">
- SELECT bpd.member_id as id,
- u.name as userName,
- ROUND(SUM(IF(cd.defined_low_limit_amount < fc.claim_amount,
- fc.claim_amount * (cd.ratio / 100) * (bpd.performance_distribution / 100),
- cd.defined_low_limit_amount * (cd.ratio / 100) * (bpd.performance_distribution / 100)
- )), 2) AS commissionTotalAmount,
- '评估人员' as userType,
- '资产业务' as businessType,
- #{vo.startDate} as startDate,
- #{vo.endDate} as endDate
- FROM (SELECT claim_amount,
- order_fund_id,
- production_fund_id,
- claim_datetime
- FROM finance_claim
- WHERE deleted = 0
- AND production_fund_id IS NOT NULL
- AND claim_datetime >= #{vo.startDate}
- AND claim_datetime <= #{vo.endDate}
- UNION ALL
- SELECT allot_amount AS claim_amount,
- order_fund_id,
- production_fund_id,
- created AS claim_datetime
- FROM order_fund_allot
- WHERE deleted = 0
- AND created >= #{vo.startDate}
- AND created <= #{vo.endDate}) fc
- INNER JOIN (SELECT id, order_fund_id, business_id, production_no
- FROM production_fund
- WHERE business_type = 'ASSET_BUSINESS'
- AND deleted = 0) pf
- ON (pf.id = fc.production_fund_id AND pf.order_fund_id = fc.order_fund_id)
- INNER JOIN (SELECT id,
- business_id,
- project_name,
- production_no,
- production_type,
- save_file_date,
- created
- FROM assets_production
- WHERE deleted = 0
- AND save_file_date IS NOT NULL) ap ON ap.production_no = pf.production_no
- LEFT JOIN assets a ON a.id = ap.business_id
- INNER JOIN (SELECT id, business_id, production_id, commission_rate_id, defined_low_limit_amount, ratio
- FROM commission_declare
- WHERE business_type = 'COMMISSION_DECLARE_ASSET_EVALUATE'
- AND deleted = 0
- AND declare_result = '审核通过') cd ON (
- cd.business_id = a.id
- AND (cd.production_id IS NULL OR cd.production_id = ap.id))
- LEFT JOIN business_commission_rate bcr ON bcr.id = cd.commission_rate_id
- LEFT JOIN dict_data dd ON dd.id = bcr.business_cate_id
- LEFT JOIN (SELECT business_id, report_no, member_id, performance_distribution
- FROM business_performance_distribution
- WHERE deleted = 0
- AND user_type = '评估人员') bpd
- ON (bpd.business_id = a.id AND bpd.report_no = ap.production_no)
- LEFT JOIN user u ON u.id = bpd.member_id
- GROUP BY bpd.member_id
- </select>
- <!--资产评估人员提成信息导出-->
- <select id="assetsEvaluatorUserDetailExport" resultType="com.dayou.vo.UserCommissionProdVO">
- SELECT
- ap.id,
- ROUND(fc.claim_amount,2) as realAmount,
- ap.production_no AS reportNo,
- IF
- ( fc.claim_datetime > ap.save_file_date, fc.claim_datetime, ap.save_file_date ) AS settleDate,
- ap.project_name AS name,
- ap.created,
- dd.NAME AS businessCate,
- ROUND(bcr.min_ratio,2) AS ratio,
- bpd.member_id AS userId,
- ROUND(bpd.performance_distribution,2) AS allotRatio,
- ROUND(IF(cd.defined_low_limit_amount < fc.claim_amount,
- fc.claim_amount * (cd.ratio / 100) * (bpd.performance_distribution / 100),
- cd.defined_low_limit_amount * (cd.ratio / 100) * (bpd.performance_distribution / 100)
- ),2) AS commissionAmount,
- ROUND(IF(cd.defined_low_limit_amount < fc.claim_amount,
- fc.claim_amount * (cd.ratio / 100),
- cd.defined_low_limit_amount * (cd.ratio / 100)
- ),2) AS totalAmount,
- u.name as userName
- FROM
- (
- SELECT
- claim_amount,
- order_fund_id,
- production_fund_id,
- claim_datetime
- FROM
- finance_claim
- WHERE
- deleted = 0
- AND production_fund_id IS NOT NULL
- AND claim_datetime >= #{vo.startDate}
- AND claim_datetime <= #{vo.endDate}
- UNION ALL
- SELECT
- allot_amount AS claim_amount,
- order_fund_id,
- production_fund_id,
- created AS claim_datetime
- FROM
- order_fund_allot
- WHERE
- deleted = 0
- AND created >= #{vo.startDate}
- AND created <= #{vo.endDate}
- ) fc
- INNER JOIN ( SELECT id, order_fund_id, business_id, production_no FROM production_fund WHERE business_type = 'ASSET_BUSINESS' AND deleted = 0 ) pf ON ( pf.id = fc.production_fund_id AND pf.order_fund_id = fc.order_fund_id )
- INNER JOIN ( SELECT id, business_id, project_name, production_no, production_type, save_file_date, created FROM assets_production WHERE deleted = 0 AND save_file_date IS NOT NULL ) ap ON ap.production_no = pf.production_no
- LEFT JOIN assets a ON a.id = ap.business_id
- INNER JOIN ( SELECT id, business_id, production_id, commission_rate_id, ratio, defined_low_limit_amount FROM commission_declare WHERE business_type = 'COMMISSION_DECLARE_ASSET_EVALUATE' AND deleted = 0 AND declare_result = '审核通过' ) cd ON (
- cd.business_id = a.id
- AND ( cd.production_id IS NULL OR cd.production_id = ap.id ))
- LEFT JOIN business_commission_rate bcr ON bcr.id = cd.commission_rate_id
- LEFT JOIN dict_data dd ON dd.id = bcr.business_cate_id
- LEFT JOIN ( SELECT business_id, report_no, member_id, performance_distribution FROM business_performance_distribution WHERE deleted = 0 AND user_type = '评估人员' ) bpd ON ( bpd.business_id = a.id AND bpd.report_no = ap.production_no)
- LEFT JOIN user u on u.id = bpd.member_id
- <where>
- <if test="vo!=null and vo.userId!=null">
- and bpd.member_id = #{vo.userId}
- </if>
- </where>
- order by bpd.member_id
- </select>
- <!--资产市场人员提成计算-->
- <select id="assetsMarketCommission" resultType="com.dayou.vo.UserCommissionTotalAmountVO">
- SELECT bpd.member_id as id,
- u.name as userName,
- SUM(( fc.claim_amount * ( bcr.min_ratio / 100 ) * (bpd.performance_distribution / 100))) AS commissionTotalAmount
- FROM
- (
- SELECT
- claim_amount,
- order_fund_id,
- production_fund_id,
- claim_datetime
- FROM
- finance_claim
- WHERE
- deleted = 0
- AND production_fund_id IS NOT NULL
- AND claim_datetime >= #{vo.startDate}
- AND claim_datetime <= #{vo.endDate}
- UNION ALL SELECT allot_amount AS claim_amount, order_fund_id, production_fund_id, created AS claim_datetime FROM order_fund_allot WHERE deleted = 0
- AND created >= #{vo.startDate}
- AND created <= #{vo.endDate}
- ) fc
- INNER JOIN ( SELECT id, order_fund_id, business_id, production_no FROM production_fund WHERE business_type = 'ASSET_BUSINESS' AND deleted = 0 ) pf ON ( pf.id = fc.production_fund_id AND pf.order_fund_id = fc.order_fund_id )
- INNER JOIN ( SELECT id, business_id, project_name, production_no, production_type, save_file_date, created FROM assets_production WHERE deleted = 0 AND delivery = TRUE ) ap ON ap.production_no = pf.production_no
- LEFT JOIN assets a ON a.id = ap.business_id
- INNER JOIN ( SELECT id, business_id, production_id, commission_rate_id FROM commission_declare WHERE business_type = 'COMMISSION_DECLARE_ASSET_MARKET' AND deleted = 0 AND declare_result = '审核通过' ) cd ON (
- cd.business_id = a.id
- AND ( cd.production_id IS NULL OR cd.production_id = ap.id ))
- LEFT JOIN business_commission_rate bcr ON bcr.id = cd.commission_rate_id
- LEFT JOIN dict_data dd ON dd.id = bcr.business_cate_id
- LEFT JOIN ( SELECT business_id, report_no,declare_id, member_id, performance_distribution FROM business_performance_distribution WHERE deleted = 0 AND user_type = '市场人员'
- ) bpd ON ( bpd.business_id = a.id AND cd.id = bpd.declare_id AND (bpd.report_no is null or bpd.report_no = ap.production_no ))
- LEFT JOIN user u ON u.id = bpd.member_id
- GROUP BY
- bpd.member_id
- having 1=1
- <if test="vo!=null and vo.userName!=null and vo.userName!=''">
- and u.name like concat ('%',#{vo.userName},'%')
- </if>
- order by commissionTotalAmount DESC
- </select>
- <!--资产市场人员提成计算详情-->
- <select id="assetsMarketCommissionDetail" resultType="com.dayou.vo.UserCommissionProdVO">
- SELECT
- ap.id,
- fc.claim_amount as realAmount,
- ap.production_no AS reportNo,
- IF
- ( fc.claim_datetime > ap.save_file_date, fc.claim_datetime, ap.save_file_date ) AS settleDate,
- ap.project_name AS name,
- ap.created,
- dd.NAME AS businessCate,
- bcr.min_ratio AS ratio,
- bpd.member_id AS userId,
- bpd.performance_distribution AS allotRatio,
- ( fc.claim_amount * ( bcr.min_ratio / 100 ) * (bpd.performance_distribution / 100) ) AS commissionAmount,
- ( fc.claim_amount * ( bcr.min_ratio / 100 ) ) AS totalAmount,
- u.name as userName
- FROM
- (
- SELECT
- claim_amount,
- order_fund_id,
- production_fund_id,
- claim_datetime
- FROM
- finance_claim
- WHERE
- deleted = 0
- AND production_fund_id IS NOT NULL
- AND claim_datetime >= #{vo.startDate}
- AND claim_datetime <= #{vo.endDate}
- UNION ALL
- SELECT
- allot_amount AS claim_amount,
- order_fund_id,
- production_fund_id,
- created AS claim_datetime
- FROM
- order_fund_allot
- WHERE
- deleted = 0
- AND created >= #{vo.startDate}
- AND created <= #{vo.endDate}
- ) fc
- INNER JOIN ( SELECT id, order_fund_id, business_id, production_no FROM production_fund WHERE business_type = 'ASSET_BUSINESS' AND deleted = 0 ) pf ON ( pf.id = fc.production_fund_id AND pf.order_fund_id = fc.order_fund_id )
- INNER JOIN ( SELECT id, business_id, project_name, production_no, production_type, save_file_date, created FROM assets_production WHERE deleted = 0 AND delivery = TRUE ) ap ON ap.production_no = pf.production_no
- LEFT JOIN assets a ON a.id = ap.business_id
- INNER JOIN ( SELECT id, business_id, production_id, commission_rate_id FROM commission_declare WHERE business_type = 'COMMISSION_DECLARE_ASSET_MARKET' AND deleted = 0 AND declare_result = '审核通过' ) cd ON (
- cd.business_id = a.id
- AND ( cd.production_id IS NULL OR cd.production_id = ap.id ))
- LEFT JOIN business_commission_rate bcr ON bcr.id = cd.commission_rate_id
- LEFT JOIN dict_data dd ON dd.id = bcr.business_cate_id
- LEFT JOIN ( SELECT business_id, report_no, member_id, performance_distribution,declare_id FROM business_performance_distribution WHERE deleted = 0 AND user_type = '市场人员' ) bpd
- ON ( bpd.business_id = a.id AND cd.id = bpd.declare_id AND (bpd.report_no is null or bpd.report_no = ap.production_no ))
- LEFT JOIN user u on u.id = bpd.member_id
- WHERE
- bpd.member_id = #{vo.userId}
- order by settleDate DESC
- </select>
- <!--资产市场人员提成合计导出-->
- <select id="assetsMarketTotalAmountExport" resultType="com.dayou.vo.UserCommissionTotalAmountVO">
- SELECT bpd.member_id as id,
- u.name as userName,
- ROUND(SUM((fc.claim_amount * (bcr.min_ratio / 100) * (bpd.performance_distribution / 100))),
- 2) AS commissionTotalAmount,
- '市场人员' as userType,
- '资产业务' as businessType,
- #{vo.startDate} as startDate,
- #{vo.endDate} as endDate
- FROM (SELECT claim_amount,
- order_fund_id,
- production_fund_id,
- claim_datetime
- FROM finance_claim
- WHERE deleted = 0
- AND production_fund_id IS NOT NULL
- AND claim_datetime >= #{vo.startDate}
- AND claim_datetime <= #{vo.endDate}
- UNION ALL
- SELECT allot_amount AS claim_amount, order_fund_id, production_fund_id, created AS claim_datetime
- FROM order_fund_allot
- WHERE deleted = 0
- AND created >= #{vo.startDate}
- AND created <= #{vo.endDate}) fc
- INNER JOIN (SELECT id, order_fund_id, business_id, production_no
- FROM production_fund
- WHERE business_type = 'ASSET_BUSINESS'
- AND deleted = 0) pf
- ON (pf.id = fc.production_fund_id AND pf.order_fund_id = fc.order_fund_id)
- INNER JOIN (SELECT id,
- business_id,
- project_name,
- production_no,
- production_type,
- save_file_date,
- created
- FROM assets_production
- WHERE deleted = 0
- AND delivery = true) ap ON ap.production_no = pf.production_no
- LEFT JOIN assets a ON a.id = ap.business_id
- INNER JOIN (SELECT id, business_id, production_id, commission_rate_id
- FROM commission_declare
- WHERE business_type = 'COMMISSION_DECLARE_ASSET_MARKET'
- AND deleted = 0
- AND declare_result = '审核通过') cd ON (
- cd.business_id = a.id
- AND (cd.production_id IS NULL OR cd.production_id = ap.id))
- LEFT JOIN business_commission_rate bcr ON bcr.id = cd.commission_rate_id
- LEFT JOIN dict_data dd ON dd.id = bcr.business_cate_id
- LEFT JOIN (SELECT business_id, report_no, declare_id, member_id, performance_distribution
- FROM business_performance_distribution
- WHERE deleted = 0
- AND user_type = '市场人员') bpd ON (bpd.business_id = a.id AND cd.id = bpd.declare_id AND
- (bpd.report_no is null or bpd.report_no = ap.production_no))
- LEFT JOIN user u ON u.id = bpd.member_id
- GROUP BY bpd.member_id
- ORDER BY commissionTotalAmount DESC
- </select>
- <!--资产市场人员提成信息导出-->
- <select id="assetsMarketUserDetailExport" resultType="com.dayou.vo.UserCommissionProdVO">
- SELECT
- ap.id,
- ROUND(fc.claim_amount,2) as realAmount,
- ap.production_no AS reportNo,
- IF
- ( fc.claim_datetime > ap.save_file_date, fc.claim_datetime, ap.save_file_date ) AS settleDate,
- ap.project_name AS name,
- ap.created,
- dd.`name` AS businessCate,
- ROUND(bcr.min_ratio,2) AS ratio,
- bpd.member_id AS userId,
- ROUND(bpd.performance_distribution,2) AS allotRatio,
- ROUND(( fc.claim_amount * ( bcr.min_ratio / 100 ) * (bpd.performance_distribution / 100) ),2) AS
- commissionAmount,
- ROUND(( fc.claim_amount * ( bcr.min_ratio / 100 ) ),2) AS totalAmount,
- u.name as userName
- FROM
- (
- SELECT
- claim_amount,
- order_fund_id,
- production_fund_id,
- claim_datetime
- FROM
- finance_claim
- WHERE
- deleted = 0
- AND production_fund_id IS NOT NULL
- AND claim_datetime >= #{vo.startDate}
- AND claim_datetime <= #{vo.endDate}
- UNION ALL
- SELECT
- allot_amount AS claim_amount,
- order_fund_id,
- production_fund_id,
- created AS claim_datetime
- FROM
- order_fund_allot
- WHERE
- deleted = 0
- AND created >= #{vo.startDate}
- AND created <= #{vo.endDate}
- ) fc
- INNER JOIN ( SELECT id, order_fund_id, business_id, production_no FROM production_fund WHERE business_type =
- 'ASSET_BUSINESS' AND deleted = 0 ) pf ON ( pf.id = fc.production_fund_id AND pf.order_fund_id = fc.order_fund_id
- )
- INNER JOIN ( SELECT id, business_id, project_name, production_no, production_type, save_file_date, created FROM
- assets_production WHERE deleted = 0 AND delivery = true ) ap ON ap.production_no = pf.production_no
- LEFT JOIN assets a ON a.id = ap.business_id
- INNER JOIN ( SELECT id, business_id, production_id, commission_rate_id FROM commission_declare WHERE
- business_type = 'COMMISSION_DECLARE_ASSET_MARKET' AND deleted = 0 AND declare_result = '审核通过' ) cd ON (
- cd.business_id = a.id
- AND ( cd.production_id IS NULL OR cd.production_id = ap.id ))
- LEFT JOIN business_commission_rate bcr ON bcr.id = cd.commission_rate_id
- LEFT JOIN dict_data dd ON dd.id = bcr.business_cate_id
- LEFT JOIN ( SELECT business_id, report_no, member_id, performance_distribution, declare_id FROM
- business_performance_distribution WHERE deleted = 0 AND user_type = '市场人员' ) bpd
- ON ( bpd.business_id = a.id AND cd.id = bpd.declare_id AND (bpd.report_no is null or bpd.report_no =
- ap.production_no ))
- LEFT JOIN user u on u.id = bpd.member_id
- <where>
- <if test="vo!=null and vo.userId!=null">
- and bpd.member_id = #{vo.userId}
- </if>
- </where>
- order by bpd.member_id
- </select>
- <!--资产收款逾期查询Sql-->
- <sql id="assetsOverdueSql">
- SELECT
- DATEDIFF(CURDATE(), DATE( ap.repertory_out_time )) AS overdueDay,
- a.allot_type,
- a.order_id,
- a.assets_business_gener,
- u.name AS clientManager,
- u1.name AS principal,
- cc1.name AS clientName,
- cc2.name AS clientSubName,
- pf.production_should_amount,
- `of`.should_amount,
- pf.standard_amount,
- ap.*
- FROM
- (
- SELECT
- id,
- business_id,
- production_no,
- ( CASE production_type WHEN 'STATEMENT' THEN '意见书' WHEN 'REPORT' THEN '评估报告' WHEN 'LETTER' THEN '意见函' WHEN 'CONSULT' THEN '咨询报告' ELSE '' END ) productionType,
- project_name,
- evaluate_amount,
- repertory_out_time
- FROM
- assets_production ap
- WHERE
- deleted = 0
- AND repertory_out_time IS NOT NULL
- AND production_type != 'STATEMENT'
- ) ap
- LEFT JOIN ( SELECT business_id, production_no, production_should_amount, real_amount, standard_amount FROM production_fund WHERE business_type = 'ASSET_BUSINESS' AND deleted = 0 ) pf
- ON ( ap.business_id = pf.business_id AND ap.production_no = pf.production_no )
- LEFT JOIN ( SELECT business_id,should_amount FROM order_fund WHERE business_type = 'ASSET_BUSINESS' AND deleted = 0 ) `of` ON `of`.business_id = ap.business_id
- LEFT JOIN assets a ON a.id = ap.business_id
- LEFT JOIN user u ON u.id = a.client_manager_id
- LEFT JOIN user u1 ON u1.id = a.principal_id
- LEFT JOIN customer_company cc1 ON cc1.id = a.clientele_id
- LEFT JOIN customer_company cc2 ON cc2.id = a.clientele_sub_id
- WHERE
- ap.productionType != 'STATEMENT'
- AND ( pf.production_no IS NULL OR pf.real_amount IS NULL )
- AND DATEDIFF(CURDATE(),DATE( ap.repertory_out_time )) >= #{overdueVO.overdueMin}
- <if test="overdueVO!=null and overdueVO.overdueMax!=null">
- AND DATEDIFF(CURDATE(),DATE( ap.repertory_out_time )) <= #{overdueVO.overdueMax}
- </if>
- <if test="overdueVO!=null and overdueVO.orderId!=null and overdueVO.orderId!=''">
- and a.order_id = #{overdueVO.orderId}
- </if>
- <if test="overdueVO!=null and overdueVO.productionNo!=null and overdueVO.productionNo!=''">
- and ap.production_no like concat ('%',#{overdueVO.productionNo},'%')
- </if>
- <if test="overdueVO!=null and overdueVO.principal!=null and overdueVO.principal!=''">
- and u1.name like concat ('%',#{overdueVO.principal},'%')
- </if>
- order by overdueDay desc
- </sql>
- <!--资产收款逾期列表-->
- <select id="overdueAssets" resultType="com.dayou.vo.AssetsProdOverdueVO">
- <include refid="assetsOverdueSql" />
- </select>
- <!--资产收款逾期列表导出-->
- <select id="overdueAssetsExport" resultType="com.dayou.vo.AssetsProdOverdueVO">
- <include refid="assetsOverdueSql" />
- </select>
- <!--资产市场人员结算项目Sql-->
- <sql id="assetsMarketerSettleSql">
- SELECT
- ap.id,
- fc.claim_amount,
- a.order_id,
- ap.production_no,
- fc.claim_datetime as claimDate,
- ap.delivery_date,
- ap.save_file_date,
- IF
- ( fc.claim_datetime > ap.delivery_date, fc.claim_datetime, ap.delivery_date ) AS settleDate,
- ap.project_name,
- a.bailor,
- ap.evaluate_amount,
- u.name AS principal,
- u1.name AS clientManager,
- cc.name AS clientName,
- cc1.name AS clientSubName,
- d.name AS evaluateDepartmentName,
- (
- SELECT
- GROUP_CONCAT( department.name )
- FROM
- department
- WHERE
- id IN (
- SELECT
- department_id
- FROM
- post
- WHERE
- id IN ( SELECT post_id FROM user_post WHERE user_id = a.client_manager_id ))) AS marketDepartmentName
- FROM
- (
- SELECT
- claim_amount,
- order_fund_id,
- production_fund_id,
- claim_datetime
- FROM
- finance_claim
- WHERE
- deleted = 0
- AND production_fund_id IS NOT NULL
- AND claim_datetime >= #{settleVO.startDate}
- AND claim_datetime <= #{settleVO.endDate} UNION ALL
- SELECT allot_amount AS claim_amount, order_fund_id, production_fund_id, created AS claim_datetime FROM
- order_fund_allot WHERE deleted = 0
- AND created >= #{settleVO.startDate}
- AND created <= #{settleVO.endDate}
- ) fc
- INNER JOIN ( SELECT id, order_fund_id, business_id, production_no FROM production_fund WHERE business_type =
- 'ASSET_BUSINESS' AND deleted = 0 ) pf ON ( pf.id = fc.production_fund_id AND pf.order_fund_id = fc.order_fund_id
- )
- INNER JOIN ( SELECT id, business_id, project_name, production_no, production_type, evaluate_amount,
- delivery_date, save_file_date FROM assets_production WHERE deleted = 0 AND delivery = true ) ap ON ap.production_no =
- pf.production_no
- LEFT JOIN assets a ON a.id = ap.business_id
- LEFT JOIN user u ON u.id = a.principal_id
- LEFT JOIN user u1 ON u1.id = a.client_manager_id
- LEFT JOIN customer_company cc ON cc.id = a.clientele_id
- LEFT JOIN customer_company cc1 ON cc1.id = a.clientele_sub_id
- LEFT JOIN department d ON d.id = a.department_id
- <where>
- <if test="settleVO!=null and settleVO.orderId!=null and settleVO.orderId!='' ">
- and a.order_id = #{settleVO.orderId}
- </if>
- <if test="settleVO!=null and settleVO.productionNo!=null and settleVO.productionNo!='' ">
- and ap.report_no like concat ('%',#{settleVO.productionNo},'%')
- </if>
- <if test="settleVO!=null and settleVO.principal!=null and settleVO.principal!='' ">
- and u.name like concat ('%',#{settleVO.principal},'%')
- </if>
- <if test="settleVO!=null and settleVO.clientManager!=null and settleVO.clientManager!='' ">
- and u1.name like concat ('%',#{settleVO.clientManager},'%')
- </if>
- </where>
- order by settleDate DESC
- </sql>
- <!--资产结算项目查询-->
- <select id="assetsMarketSettleProd" resultType="com.dayou.vo.SettleAssetsProductionVO">
- <include refid="assetsMarketerSettleSql" />
- </select>
- <!--资产结算项目导出-->
- <select id="assetsMarketSettleExport" resultType="com.dayou.vo.SettleAssetsProductionVO">
- <include refid="assetsMarketerSettleSql" />
- </select>
- <!--资产评估人员结算项目Sql-->
- <sql id="assetsEvaluatorSettleSql">
- SELECT
- ap.id,
- fc.claim_amount,
- a.order_id,
- ap.production_no,
- fc.claim_datetime as claimDate,
- ap.save_file_date,
- IF
- ( fc.claim_datetime > ap.save_file_date, fc.claim_datetime, ap.save_file_date ) AS settleDate,
- ap.project_name,
- a.bailor,
- ap.evaluate_amount,
- u.name AS principal,
- u1.name AS clientManager,
- cc.name AS clientName,
- cc1.name AS clientSubName,
- d.name AS evaluateDepartmentName,
- (
- SELECT
- GROUP_CONCAT( NAME )
- FROM
- department
- WHERE
- id IN (
- SELECT
- department_id
- FROM
- post
- WHERE
- id IN ( SELECT post_id FROM user_post WHERE user_id = a.client_manager_id ))) AS marketDepartmentName
- FROM
- (
- SELECT
- claim_amount,
- order_fund_id,
- production_fund_id,
- claim_datetime
- FROM
- finance_claim
- WHERE
- deleted = 0
- AND production_fund_id IS NOT NULL
- AND claim_datetime >= #{settleVO.startDate}
- AND claim_datetime <= #{settleVO.endDate} UNION ALL
- SELECT allot_amount AS claim_amount, order_fund_id, production_fund_id, created AS claim_datetime FROM order_fund_allot WHERE deleted = 0
- AND created >= #{settleVO.startDate}
- AND created <= #{settleVO.endDate}
- ) fc
- INNER JOIN ( SELECT id, order_fund_id, business_id, production_no FROM production_fund WHERE business_type = 'ASSET_BUSINESS' AND deleted = 0 ) pf ON ( pf.id = fc.production_fund_id AND pf.order_fund_id = fc.order_fund_id )
- INNER JOIN ( SELECT id, business_id, project_name, production_no, production_type, evaluate_amount, save_file_date FROM assets_production WHERE deleted = 0 AND save_file_date IS NOT NULL ) ap ON ap.production_no = pf.production_no
- LEFT JOIN assets a ON a.id = ap.business_id
- LEFT JOIN user u ON u.id = a.principal_id
- LEFT JOIN user u1 ON u1.id = a.client_manager_id
- LEFT JOIN customer_company cc ON cc.id = a.clientele_id
- LEFT JOIN customer_company cc1 ON cc1.id = a.clientele_sub_id
- LEFT JOIN department d ON d.id = a.department_id
- <where>
- <if test="settleVO!=null and settleVO.orderId!=null and settleVO.orderId!='' ">
- and a.order_id = #{settleVO.orderId}
- </if>
- <if test="settleVO!=null and settleVO.productionNo!=null and settleVO.productionNo!='' ">
- and ap.production_no like concat ('%',#{settleVO.productionNo},'%')
- </if>
- <if test="settleVO!=null and settleVO.principal!=null and settleVO.principal!='' ">
- and u.name like concat ('%',#{settleVO.principal},'%')
- </if>
- <if test="settleVO!=null and settleVO.clientManager!=null and settleVO.clientManager!='' ">
- and u1.name like concat ('%',#{settleVO.clientManager},'%')
- </if>
- </where>
- order by settleDate DESC
- </sql>
- <!--资产评估人员结算项目查询-->
- <select id="assetsEvaluatorSettleProd" resultType="com.dayou.vo.SettleAssetsProductionVO">
- <include refid="assetsEvaluatorSettleSql" />
- </select>
- <!--资产评估人员结算项目导出-->
- <select id="assetsEvaluatorSettleExport" resultType="com.dayou.vo.SettleAssetsProductionVO">
- <include refid="assetsEvaluatorSettleSql" />
- </select>
- </mapper>
|