InsPlyIncomeMapper.xml 70 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  3. <mapper namespace="com.ydtech.modules.fnc.dao.InsPlyIncomeMapper">
  4. <!-- 通用查询映射结果 -->
  5. <resultMap id="BaseResultMap" type="com.ydtech.modules.fnc.entity.InsPlyIncome">
  6. <id column="id" property="id" />
  7. <result column="orderno" property="orderno" />
  8. <result column="policyno" property="policyno" />
  9. <result column="dept_id" property="deptId" />
  10. <result column="dept_name" property="deptName" />
  11. <result column="riskcode" property="riskcode" />
  12. <result column="pay_date" property="payDate" />
  13. <result column="company_id" property="companyId" />
  14. <result column="company_name" property="companyName" />
  15. <result column="agreement_id" property="agreementId" />
  16. <result column="licenseno" property="licenseno" />
  17. <result column="taxamount" property="taxamount" />
  18. <result column="no_tax_premium" property="noTaxPremium" />
  19. <result column="commission_feerate" property="commissionFeerate" />
  20. <result column="other_feerate" property="otherFeerate" />
  21. <result column="commission_feevalue" property="commissionFeevalue" />
  22. <result column="other_feevalue" property="otherFeevalue" />
  23. <result column="all_fee_value" property="allFeeValue" />
  24. <result column="final_fee_value" property="finalFeeValue" />
  25. <result column="doing_fee_value" property="doingFeeValue" />
  26. <result column="create_time" property="createTime" />
  27. <result column="voucher_number" property="voucherNumber"/>
  28. <result column="contract_id" property="contractId"/>
  29. <result column="contract_file_id" property="contractFileId"/>
  30. <result column="handling_fees_status" property="handlingFeesStatus"/>
  31. <result column="documentary_fees_status" property="documentaryFeesStatus"/>
  32. <result column="no_policyno" property="noPolicyno"/>
  33. <result column="sy_policyno" property="syPolicyno"/>
  34. <result column="is_not_car" property="isNotCar"/>
  35. <result column="is_not_documentary" property="isNotDocumentary"/>
  36. <result column="invoic_amount" property="invoicAmount"/>
  37. <result column="invoic_id" property="invoicId"/>
  38. <result column="tax_premium" property="taxPremium"/>
  39. <result column="jq_supervise_costs_premiums" property="jqSuperviseCostsPremiums"/>
  40. <result column="jq_supervise_costs_proportion" property="jqSuperviseCostsProportion"/>
  41. <result column="sy_supervise_costs_premiums" property="sySuperviseCostsPremiums"/>
  42. <result column="sy_supervise_costs_proportion" property="sySuperviseCostsProportion"/>
  43. <result column="no_supervise_costs_premiums" property="noSuperviseCostsPremiums"/>
  44. <result column="no_supervise_costs_proportion" property="noSuperviseCostsProportion"/>
  45. <result column="jq_premium" property="jqPremium"/>
  46. <result column="sy_premium" property="syPremium"/>
  47. <result column="no_premium" property="noPremium"/>
  48. <result column="jq_no_tax_premium" property="jqNoTaxPremium"/>
  49. <result column="sy_no_tax_premium" property="syNoTaxPremium"/>
  50. <result column="no_no_tax_premium" property="noNoTaxPremium"/>
  51. <result column="jq_receivable_proportion" property="jqReceivableProportion"/>
  52. <result column="sy_receivable_proportion" property="syReceivableProportion"/>
  53. <result column="no_receivable_proportion" property="noReceivableProportion"/>
  54. <result column="jq_other_costs_proportion" property="jqOtherCostsProportion"/>
  55. <result column="sy_other_costs_proportion" property="syOtherCostsProportion"/>
  56. <result column="no_other_costs_proportion" property="noOtherCostsProportion"/>
  57. <result column="settlement_time" property="settlementTime"/>
  58. <result column="update_time" property="updateTime"/>
  59. <result column="settlement_user_id" property="settlementUserId"/>
  60. <result column="update_user_id" property="updateUserId"/>
  61. <result column="jq_other_costs_premium" property="jqOtherCostsPremium"/>
  62. <result column="sy_other_costs_premium" property="syOtherCostsPremium"/>
  63. <result column="no_other_costs_premium" property="noOtherCostsPremium"/>
  64. <result column="user_id" property="userId"/>
  65. <result column="update_user_id" property="updateUserId"/>
  66. <result column="partner_companies_id" property="partnerCompaniesId"/>
  67. <result column="partner_companies_name" property="partnerCompaniesName"/>
  68. <result column="receivable_amount" property="receivableAmount"/>
  69. <result column="insured_name" property="insuredName"/>
  70. <result column="invoicing_method" property="invoicingMethod"/>
  71. <result column="remarks" property="remarks"/>
  72. <result column="jq_start_date" property="jqStartDate"/>
  73. <result column="jq_end_date" property="jqEndDate"/>
  74. <result column="sy_start_date" property="syStartDate"/>
  75. <result column="sy_end_date" property="syEndDate"/>
  76. <result column="settle_other_status" property="settleOtherStatus"/>
  77. <result column="settlement_image_id" property="settlementImageId"/>
  78. <result column="task_id" property="taskId"/>
  79. </resultMap>
  80. <sql id="income_com">
  81. a.id as "id",
  82. a.orderno as "orderno",
  83. a.policyno as "policyno",
  84. a.dept_id as "deptId",
  85. a.riskcode as "riskcode",
  86. a.pay_date as "payDate",
  87. a.signdate as "signdate",
  88. a.company_id as "companyId",
  89. a.agreement_id as "agreementId",
  90. a.licenseno as "licenseno",
  91. a.taxamount as "taxamount",
  92. a.no_tax_premium as "noTaxPremium",
  93. a.commission_feerate as "commissionFeerate",
  94. a.other_feerate as "otherFeerate",
  95. a.commission_feevalue as "commissionFeevalue",
  96. a.other_feevalue as "otherFeevalue",
  97. a.all_fee_value as "allFeeValue",
  98. a.final_fee_value as "finalFeeValue",
  99. a.doing_fee_value as "doingFeeValue",
  100. a.voucher_number as "voucherNumber",
  101. a.contract_id as "contractId",
  102. a.contract_file_id as "contractFileId",
  103. a.handling_fees_status as "handlingFeesStatus",
  104. a.no_policyno as "noPolicyno",
  105. a.sy_policyno as "syPolicyno",
  106. a.documentary_fees_status as "documentaryFeesStatus",
  107. a.is_not_car as "isNotCar",
  108. a.is_not_documentary as "isNotDocumentary",
  109. a.invoic_amount as "invoicAmount",
  110. a.invoic_id as "invoicId",
  111. a.tax_premium as "taxPremium",
  112. a.jq_supervise_costs_premiums as "jqSuperviseCostsPremiums",
  113. a.jq_supervise_costs_proportion as "jqSuperviseCostsProportion",
  114. a.sy_supervise_costs_premiums as "sySuperviseCostsPremiums",
  115. a.sy_supervise_costs_proportion as "sySuperviseCostsProportion",
  116. a.no_supervise_costs_premiums as "noSuperviseCostsPremiums",
  117. a.no_supervise_costs_proportion as "noSuperviseCostsProportion",
  118. a.partner_companies_id as "partnerCompaniesId",
  119. a.jq_premium as "jqPremium",
  120. a.sy_premium as "syPremium",
  121. a.no_premium as "noPremium",
  122. a.jq_no_tax_premium as "jqNoTaxPremium",
  123. a.sy_no_tax_premium as "syNoTaxPremium",
  124. a.no_no_tax_premium as "noNoTaxPremium",
  125. a.jq_receivable_proportion as "jqReceivableProportion",
  126. a.sy_receivable_proportion as "syReceivableProportion",
  127. a.no_receivable_proportion as "noReceivableProportion",
  128. a.jq_other_costs_proportion as "jqOtherCostsProportion",
  129. a.sy_other_costs_proportion as "syOtherCostsProportion",
  130. a.no_other_costs_proportion as "noOtherCostsProportion",
  131. a.settlement_time as "settlementTime",
  132. a.update_time as "updateTime",
  133. a.settlement_user_id as "settlementUserId",
  134. a.update_user_id as "updateUserId",
  135. a.jq_other_costs_premium as "jqOtherCostsPremium",
  136. a.sy_other_costs_premium as "syOtherCostsPremium",
  137. a.no_other_costs_premium as "noOtherCostsPremium",
  138. a.partner_companies_name as "partnerCompaniesName",
  139. a.company_name as "companyName",
  140. a.receivable_amount as "receivableAmount",
  141. a.invoic_time as "invoicTime",
  142. a.insured_name as "insuredName",
  143. a.remarks as "remarks",
  144. a.jq_start_date as "jqStartDate",
  145. a.jq_end_date as "jqEndDate",
  146. a.sy_start_date as "syStartDate",
  147. a.sy_end_date as "syEndDate",
  148. a.settle_other_status as "settleOtherStatus",
  149. a.user_id as "userId",
  150. a.invoicing_method as "invoicingMethod",
  151. a.settlement_image_id as "settlementImageId",
  152. a.task_id as "taskId",
  153. a.create_time as "createTime"
  154. </sql>
  155. <select id="queryNew" resultType="com.ydtech.modules.fnc.entity.InsPlyIncome">
  156. select
  157. pa.agreement_name as "agreementName",
  158. pa.agreement_type as "agreementType",
  159. pa.docking_person as "dockingPerson",
  160. upf.url as "imageUrl",
  161. su.name as "userName",
  162. b.name as "deptName",
  163. <include refid="income_com"/>
  164. from ins_ply_income a
  165. LEFT JOIN ptl_agreement pa on a.agreement_id = pa.id
  166. LEFT JOIN sys_user su on su.id=a.user_id
  167. LEFT JOIN ins_upload_files upf on a.settlement_image_id=upf.id
  168. LEFT JOIN esm_ins_company eic on eic.id=a.partner_companies_id
  169. LEFT JOIN sys_dept b on pa.dept_id=b.id
  170. <where>
  171. <if test="startDate !=null and startDate!='' and endDate !=null and endDate !=''">
  172. and DATE_FORMAT( a.signdate, '%Y-%m-%d') between DATE_FORMAT(#{startDate}, '%Y-%m-%d') and DATE_FORMAT(#{endDate}, '%Y-%m-%d')
  173. </if>
  174. <if test="agreementType !=null and agreementType !=''">
  175. and pa.agreement_type =#{agreementType}
  176. </if>
  177. <if test="signDateEnd !=null and signDateEnd!='' and signDateStart !=null and signDateStart !=''">
  178. and a.signdate between #{signDateStart} and #{signDateEnd}
  179. </if>
  180. <if test="handlingFeesStatus !=null and handlingFeesStatus !=''">
  181. and a.handling_fees_status =#{handlingFeesStatus}
  182. </if>
  183. <if test="allPartnerCompaniesId !=null and allPartnerCompaniesId !=''">
  184. AND eic.parent_id LIKE CONCAT(#{allPartnerCompaniesId}, '%')
  185. </if>
  186. <if test="provincePartnerCompaniesId !=null and provincePartnerCompaniesId !=''">
  187. and eic.parent_id =#{provincePartnerCompaniesId}
  188. </if>
  189. <if test="dockingPerson !=null and dockingPerson !=''">
  190. and pa.docking_person =#{dockingPerson}
  191. </if>
  192. <if test="provinceId != null and provinceId != ''">
  193. and pa.dept_id LIKE CONCAT(#{provinceId}, '%')
  194. </if>
  195. <if test="cityId != null and cityId != ''">
  196. and pa.dept_id LIKE CONCAT(#{cityId}, '%')
  197. </if>
  198. <if test="countyId != null and countyId != ''">
  199. and pa.dept_id LIKE CONCAT(#{countyId}, '%')
  200. </if>
  201. <if test="taskId != null and taskId != ''">
  202. and a.task_id = #{taskId}
  203. </if>
  204. <if test="orderno !=null and orderno !=''">
  205. and a.orderno =#{orderno}
  206. </if>
  207. <if test="companyName !=null and companyName !=''">
  208. and a.company_id =#{companyName}
  209. </if>
  210. <if test="policyno !=null and policyno !=''">
  211. and a.policyno =#{policyno}
  212. </if>
  213. <if test="documentaryFeesStatus !=null and documentaryFeesStatus !=''">
  214. and a.documentary_fees_status =#{documentaryFeesStatus}
  215. </if>
  216. <if test="isNotCar !=null and isNotCar !=''">
  217. and a.is_not_car =#{isNotCar}
  218. </if>
  219. <if test="deptId !=null and deptId !=''">
  220. and pa.dept_id =#{deptId}
  221. </if>
  222. <if test="ids != null and ids != '' and ids.length > 0">
  223. and a.id in
  224. <foreach collection="ids" item="item" open="(" separator="," close=")">
  225. #{item}
  226. </foreach>
  227. </if>
  228. <if test="incomeIds != null and incomeIds != '' and incomeIds.size() > 0">
  229. and a.id in
  230. <foreach collection="incomeIds" item="item" open="(" separator="," close=")">
  231. #{item}
  232. </foreach>
  233. </if>
  234. <if test="selectIds != null and selectIds != '' and selectIds.size() > 0">
  235. and a.id in
  236. <foreach collection="selectIds" item="item" open="(" separator="," close=")">
  237. #{item}
  238. </foreach>
  239. </if>
  240. <if test="partnerCompaniesIdList != null and partnerCompaniesIdList != '' and partnerCompaniesIdList.size() > 0">
  241. and a.partner_companies_id in
  242. <foreach collection="partnerCompaniesIdList" item="item" open="(" separator="," close=")">
  243. #{item}
  244. </foreach>
  245. </if>
  246. <if test="isOther !=null and isOther !=''">
  247. and a.is_not_documentary =#{isOther}
  248. </if>
  249. <if test="licenseno != null and licenseno != ''">
  250. and a.licenseno =#{licenseno}
  251. </if>
  252. <if test="syPolicyno != null and syPolicyno != ''">
  253. and a.sy_policyno =#{syPolicyno}
  254. </if>
  255. <if test="noPolicyno != null and noPolicyno != ''">
  256. and a.no_policyno =#{noPolicyno}
  257. </if>
  258. <if test="signdate !=null and signdate !=''">
  259. AND a.signdate =#{signdate}
  260. </if>
  261. <if test="partnerCompaniesId !=null and partnerCompaniesId !=''">
  262. AND a.partner_companies_id =#{partnerCompaniesId}
  263. </if>
  264. <if test="partnerCompaniesName !=null and partnerCompaniesName !=''">
  265. AND a.partner_companies_name =#{partnerCompaniesName}
  266. </if>
  267. <if test="createTime !=null and createTime !=''">
  268. AND a.create_time =#{createTime}
  269. </if>
  270. <if test="settlementTime !=null and settlementTime !=''">
  271. AND a.settlement_time =#{settlementTime}
  272. </if>
  273. <if test="userId !=null and userId !=''">
  274. and a.userId =#{userId}
  275. </if>
  276. <if test="companyId !=null and companyId !=''">
  277. and a.company_id =#{companyId}
  278. </if>
  279. <if test="riskcode !=null and riskcode !=''">
  280. and a.riskcode =#{riskcode}
  281. </if>
  282. <if test="year !=null and year !=''">
  283. AND YEAR(a.signdate) =#{year}
  284. </if>
  285. <if test="month !=null and month !=''">
  286. AND month(a.signdate) =#{month}
  287. </if>
  288. <if test="day !=null and day !=''">
  289. AND day(a.signdate) =#{day}
  290. </if>
  291. <if test="insuredName !=null and insuredName !=''">
  292. AND a.insured_name =#{insuredName}
  293. </if>
  294. <if test="jqStartDate !=null and jqStartDate != '' and jqEndDate != null and jqEndDate !=''">
  295. AND DATE(a.jq_start_date) BETWEEN #{syStartDate} AND #{syEndDate}
  296. </if>
  297. <if test="syStartDate !=null and syStartDate != '' and syEndDate != null and syEndDate !=''">
  298. AND DATE(a.sy_start_date) BETWEEN #{syStartDate} AND #{syEndDate}
  299. </if>
  300. </where>
  301. ORDER BY a.create_time desc
  302. </select>
  303. <select id="getEntityById" resultType="com.ydtech.modules.fnc.entity.InsPlyIncome">
  304. select
  305. pa.agreement_name as "agreementName",
  306. pa.agreement_type as "agreementType",
  307. su.name as "userName",
  308. <include refid="income_com"/>
  309. from ins_ply_income a
  310. LEFT JOIN ptl_agreement pa on a.agreement_id = pa.id
  311. LEFT JOIN sys_user su on su.id=a.user_id
  312. <where>
  313. <if test="id!=null and id!=''">
  314. a.id=#{id}
  315. </if>
  316. </where>
  317. </select>
  318. <select id="totalQuery" resultType="com.ydtech.modules.fnc.entity.InsPlyIncome">
  319. select
  320. count(MONTH(a.signdate)) as "totalorders",
  321. MONTH(a.signdate) as "monthSigdate",
  322. sum(a.other_feevalue) as "allLOtherFeevalue",
  323. GROUP_CONCAT(a.id) as "ids"
  324. from ins_ply_income a
  325. LEFT JOIN ptl_agreement pa on a.agreement_id = pa.id
  326. <where>
  327. <if test="isNotCar !=null and isNotCar !=''" >
  328. a.is_not_car =#{isNotCar}
  329. </if>
  330. <if test="isOther !=null and isOther !=''">
  331. and a.is_not_documentary =#{isOther}
  332. </if>
  333. <if test="agreementType !=null and agreementType !=''">
  334. and pa.agreement_type =#{agreementType}
  335. </if>
  336. <if test="documentaryFeesStatus !=null and documentaryFeesStatus !=''">
  337. and a.documentary_fees_status =#{documentaryFeesStatus}
  338. </if>
  339. <if test="companyId !=null and companyId !=''">
  340. and a.company_id =#{companyId}
  341. </if>
  342. <if test="year !=null and year !=''">
  343. and YEAR(a.signdate) =#{year}
  344. </if>
  345. group by MONTH(a.signdate)
  346. </where>
  347. </select>
  348. <update id="uopdateByOrderno" parameterType="com.ydtech.modules.fnc.entity.InsPlyIncome">
  349. update ins_ply_income
  350. <set>
  351. <if test="contractId != null">
  352. contract_id = #{contractId},
  353. </if>
  354. <if test="voucherNumber != null">
  355. voucher_number = #{voucherNumber},
  356. </if>
  357. <if test="contractFileId != null">
  358. contract_file_id = #{contractFileId},
  359. </if>
  360. <if test="handlingFeesStatus != null">
  361. handling_fees_status = #{handlingFeesStatus}
  362. </if>
  363. <if test="documentaryFeesStatus != null">
  364. documentary_fees_status = #{documentaryFeesStatus}
  365. </if>
  366. </set>
  367. where orderno =#{orderno}
  368. </update>
  369. <select id="NonSettlementQuery" resultType="com.ydtech.modules.fnc.entity.InsPlyIncome">
  370. SELECT
  371. a.companyId as "companyId",
  372. a.totalorders as "totalorders",
  373. a.ids as "ids",
  374. a.allLOtherFeevalue as "allLOtherFeevalue"
  375. FROM
  376. (
  377. SELECT
  378. a.company_id AS "companyId",
  379. count(a.orderno) as "totalorders",
  380. sum( a.other_feevalue ) AS "allLOtherFeevalue",
  381. GROUP_CONCAT(a.id) as "ids"
  382. FROM
  383. ins_ply_income a
  384. LEFT JOIN ptl_agreement pa ON a.agreement_id = pa.id
  385. WHERE
  386. pa.agreement_type = '2'
  387. <if test="isNotCar !=null and isNotCar !=''" >
  388. and a.is_not_car =#{isNotCar}
  389. </if>
  390. <if test="documentaryFeesStatus != null and documentaryFeesStatus != '' ">
  391. AND a.documentary_fees_status = #{documentaryFeesStatus}
  392. </if>
  393. <if test="isOther !=null and isOther !=''">
  394. and a.is_not_documentary =#{isOther}
  395. </if>
  396. <if test="companyId !=null and companyId !=''">
  397. and a.company_id =#{companyId}
  398. </if>
  399. <if test="year !=null and year !=''">
  400. and YEAR(a.signdate) =#{year}
  401. </if>
  402. <if test="month !=null and month !=''">
  403. and month(a.signdate) =#{month}
  404. </if>
  405. GROUP BY
  406. a.company_id
  407. ) a
  408. LEFT JOIN ptl_agreement pa ON a.companyId = pa.association_companies_id
  409. </select>
  410. <select id="findByLicenseno" resultType="com.ydtech.modules.fnc.entity.InsPlyIncome">
  411. select
  412. <include refid="income_com"/>
  413. from ins_ply_income a
  414. <where>
  415. 1=1
  416. <if test="licenseno !=null and licenseno !=''">
  417. AND a.licenseno=#{licenseno}
  418. </if>
  419. <if test="policyno !=null and policyno !=''">
  420. AND a.policyno=#{policyno}
  421. </if>
  422. <if test="syPolicyno !=null and syPolicyno !=''">
  423. AND a.sy_policyno=#{syPolicyno}
  424. </if>
  425. <if test="noPolicyno !=null and noPolicyno !=''">
  426. AND a.no_policyno=#{noPolicyno}
  427. </if>
  428. <if test="isOther !=null and isOther !=''">
  429. and a.is_not_documentary =#{isOther}
  430. </if>
  431. </where>
  432. </select>
  433. <select id="findByBxLicenseno" resultType="com.ydtech.modules.fnc.entity.InsPlyIncome">
  434. select
  435. <include refid="income_com"/>
  436. from ins_ply_income a
  437. <where>
  438. 1=1
  439. <if test="licenseno !=null and licenseno !=''">
  440. AND a.licenseno=#{licenseno}
  441. </if>
  442. <if test="policyno !=null and policyno !=''">
  443. AND a.policyno=#{policyno}
  444. </if>
  445. <if test="syPolicyno !=null and syPolicyno !=''">
  446. AND a.sy_policyno=#{syPolicyno}
  447. </if>
  448. <if test="noPolicyno !=null and noPolicyno !=''">
  449. AND a.no_policyno=#{noPolicyno}
  450. </if>
  451. <if test="isOther !=null and isOther !=''">
  452. and a.is_not_documentary =#{isOther}
  453. </if>
  454. <if test="isNotCar !=null and isNotCar !=''">
  455. and a.is_not_car =#{isNotCar}
  456. </if>
  457. <if test="handlingFeesStatus !=null and handlingFeesStatus !=''">
  458. and a.handling_fees_status =#{handlingFeesStatus}
  459. </if>
  460. <if test="jqSuperviseCostsPremiums !=null and jqSuperviseCostsPremiums !=''">
  461. and a.jq_supervise_costs_premiums =#{jqSuperviseCostsPremiums}
  462. </if>
  463. <if test="jqSuperviseCostsProportion !=null and jqSuperviseCostsProportion !=''">
  464. and a.jq_supervise_costs_proportion =#{jqSuperviseCostsProportion}
  465. </if>
  466. <if test="jqOtherCostsProportion !=null and jqOtherCostsProportion !=''">
  467. and a.jq_other_costs_proportion =#{jqOtherCostsProportion}
  468. </if>
  469. <if test="syOtherCostsProportion !=null and syOtherCostsProportion !=''">
  470. and a.sy_other_costs_proportion =#{syOtherCostsProportion}
  471. </if>
  472. <if test="sySuperviseCostsPremiums !=null and sySuperviseCostsPremiums !=''">
  473. and a.sy_supervise_costs_premiums =#{sySuperviseCostsPremiums}
  474. </if>
  475. <if test="noOtherCostsProportion !=null and noOtherCostsProportion !=''">
  476. and a.no_other_costs_proportion =#{noOtherCostsProportion}
  477. </if>
  478. <if test="sySuperviseCostsProportion !=null and sySuperviseCostsProportion !=''">
  479. and a.sy_supervise_costs_proportion =#{sySuperviseCostsProportion}
  480. </if>
  481. <if test="noSuperviseCostsPremiums !=null and noSuperviseCostsPremiums !=''">
  482. and a.no_supervise_costs_premiums =#{noSuperviseCostsPremiums}
  483. </if>
  484. <if test="noSuperviseCostsProportion !=null and noSuperviseCostsProportion !=''">
  485. and a.no_supervise_costs_proportion =#{noSuperviseCostsProportion}
  486. </if>
  487. <if test="jqPremium !=null and jqPremium !=''">
  488. and a.jq_premium =#{jqPremium}
  489. </if>
  490. <if test="syPremium !=null and syPremium !=''">
  491. and a.sy_premium =#{jqPremium}
  492. </if>
  493. <if test="noPremium !=null and noPremium !=''">
  494. and a.no_premium =#{noPremium}
  495. </if>
  496. </where>
  497. limit 1
  498. </select>
  499. <select id="totalAmount" resultType="java.util.HashMap">
  500. select
  501. COALESCE( sum(a.commission_feevalue),0) as "commissionFeevalue",
  502. COALESCE(sum(a.other_feevalue),0) as "otherFeevalue",
  503. COALESCE(SUM(COALESCE(a.commission_feevalue, 0) + COALESCE(a.other_feevalue, 0)), 0) AS "totalFeevalue"
  504. from ins_ply_income a
  505. LEFT JOIN ptl_agreement pa on pa.id= a.agreement_id
  506. <where>
  507. 1=1
  508. <if test="startDate !=null and startDate!='' and endDate !=null and endDate !=''">
  509. and DATE_FORMAT( a.signdate, '%Y-%m-%d') between DATE_FORMAT(#{startDate}, '%Y-%m-%d') and DATE_FORMAT(#{endDate}, '%Y-%m-%d')
  510. </if>
  511. <if test="agreementType !=null and agreementType !=''">
  512. and pa.agreement_type =#{agreementType}
  513. </if>
  514. <if test="signDateEnd !=null and signDateEnd!='' and signDateStart !=null and signDateStart !=''">
  515. and a.signdate between #{signDateStart} and #{signDateEnd}
  516. </if>
  517. <if test="handlingFeesStatus !=null and handlingFeesStatus !=''">
  518. and a.handling_fees_status =#{handlingFeesStatus}
  519. </if>
  520. <if test="orderno !=null and orderno !=''">
  521. and a.orderno =#{orderno}
  522. </if>
  523. <if test="policyno !=null and policyno !=''">
  524. and a.policyno =#{policyno}
  525. </if>
  526. <if test="documentaryFeesStatus !=null and documentaryFeesStatus !=''">
  527. and a.documentary_fees_status =#{documentaryFeesStatus}
  528. </if>
  529. <if test="selectIds != null and selectIds != '' and selectIds.size() > 0">
  530. and a.id in
  531. <foreach collection="selectIds" item="item" open="(" separator="," close=")">
  532. #{item}
  533. </foreach>
  534. </if>
  535. <if test="isNotCar !=null and isNotCar !=''">
  536. and a.is_not_car =#{isNotCar}
  537. </if>
  538. <if test="isOther !=null and isOther !=''">
  539. and a.is_not_documentary =#{isOther}
  540. </if>
  541. <if test="licenseno != null and licenseno != '' and licenseno.length > 0">
  542. and a.licenseno in
  543. <foreach collection="licenseno" item="item" open="(" separator="," close=")">
  544. #{item}
  545. </foreach>
  546. </if>
  547. <if test="policyno != null and policyno != '' ">
  548. and a.policyno =#{policyno}
  549. </if>
  550. <if test="syPolicyno != null and syPolicyno != '' ">
  551. and a.sy_policyno =#{syPolicyno}
  552. </if>
  553. <if test="noPolicyno != null and noPolicyno != ''">
  554. and a.no_policyno =#{noPolicyno}
  555. </if>
  556. <if test="signdate !=null and signdate !=''">
  557. and a.signdate =#{signdate}
  558. </if>
  559. <if test="partnerCompaniesId !=null and partnerCompaniesId !=''">
  560. and a.partner_companies_id =#{partnerCompaniesId}
  561. </if>
  562. <if test="createTime !=null and createTime !=''">
  563. a.create_time =#{createTime}
  564. </if>
  565. <if test="settlementTime !=null and settlementTime !=''">
  566. a.settlement_time =#{settlementTime}
  567. </if>
  568. <if test="userId !=null and userId !=''">
  569. and a.userId =#{userId}
  570. </if>
  571. <if test="companyId !=null and companyId !=''">
  572. and a.company_id =#{companyId}
  573. </if>
  574. <if test="riskcode !=null and riskcode !=''">
  575. and a.riskcode =#{riskcode}
  576. </if>
  577. <if test="year !=null and year !=''">
  578. AND YEAR(a.signdate) =#{year}
  579. </if>
  580. <if test="month !=null and month !=''">
  581. AND month(a.signdate) =#{month}
  582. </if>
  583. <if test="day !=null and day !=''">
  584. AND day(a.signdate) =#{day}
  585. </if>
  586. </where>
  587. </select>
  588. <select id="bxTotalAmount" resultType="com.ydtech.modules.fnc.entity.InsPlyIncome">
  589. SELECT
  590. SUM(a.commission_feevalue) AS commissionFeevalue,
  591. SUM(CASE WHEN a.handling_fees_status = '2' THEN a.commission_feevalue ELSE 0 END) AS "invoicCommissionFeevalue",
  592. SUM( CASE WHEN a.handling_fees_status = '0' THEN a.commission_feevalue ELSE 0 END ) AS "noInvoicCommissionFeevalue",
  593. SUM(CASE WHEN a.handling_fees_status = '1' THEN a.commission_feevalue ELSE 0 END) AS "readyCommissionFeevalue",
  594. SUM( CASE WHEN ( a.handling_fees_status = '2' or a.handling_fees_status = '1' ) THEN a.commission_feevalue ELSE 0 END ) AS "allInvoicCommissionFeevalue",
  595. SUM( CASE WHEN ( a.handling_fees_status = '2' or a.handling_fees_status = '0' ) THEN a.commission_feevalue ELSE 0 END ) AS "unSettledAmount"
  596. FROM
  597. ins_ply_income a
  598. LEFT JOIN
  599. ptl_agreement pa ON pa.id = a.agreement_id
  600. <where>
  601. 1=1
  602. <if test="startDate !=null and startDate!='' and endDate !=null and endDate !=''">
  603. and DATE_FORMAT( a.signdate, '%Y-%m-%d') between DATE_FORMAT(#{startDate}, '%Y-%m-%d') and DATE_FORMAT(#{endDate}, '%Y-%m-%d')
  604. </if>
  605. <if test="agreementType !=null and agreementType !=''">
  606. and pa.agreement_type =#{agreementType}
  607. </if>
  608. <if test="orderno !=null and orderno !=''">
  609. and a.orderno =#{orderno}
  610. </if>
  611. <if test="companyName !=null and companyName !=''">
  612. and a.company_id =#{companyName}
  613. </if>
  614. <if test="signDateEnd !=null and signDateEnd!='' and signDateStart !=null and signDateStart !=''">
  615. and a.signdate between #{signDateStart} and #{signDateEnd}
  616. </if>
  617. <if test="policyno !=null and policyno !=''">
  618. and a.policyno =#{policyno}
  619. </if>
  620. <if test="handlingFeesStatus !=null and handlingFeesStatus !=''">
  621. and a.handling_fees_status =#{handlingFeesStatus}
  622. </if>
  623. <if test="documentaryFeesStatus !=null and documentaryFeesStatus !=''">
  624. and a.documentary_fees_status =#{documentaryFeesStatus}
  625. </if>
  626. <if test="isNotCar !=null and isNotCar !=''">
  627. and a.is_not_car =#{isNotCar}
  628. </if>
  629. <if test="jqStartDate !=null and jqStartDate != '' and jqEndDate != null and jqEndDate !=''">
  630. AND DATE(a.jq_start_date) BETWEEN #{syStartDate} AND #{syEndDate}
  631. </if>
  632. <if test="syStartDate !=null and syStartDate != '' and syEndDate != null and syEndDate !=''">
  633. AND DATE(a.sy_start_date) BETWEEN #{syStartDate} AND #{syEndDate}
  634. </if>
  635. <if test="isOther !=null and isOther !=''">
  636. and a.is_not_documentary =#{isOther}
  637. </if>
  638. <if test="licenseno != null and licenseno != '' ">
  639. and a.licenseno =#{licenseno}
  640. </if>
  641. <if test="deptId !=null and deptId !=''">
  642. and pa.dept_id =#{deptId}
  643. </if>
  644. <if test="ids != null and ids != '' and ids.length > 0">
  645. and a.id in
  646. <foreach collection="ids" item="item" open="(" separator="," close=")">
  647. #{item}
  648. </foreach>
  649. </if>
  650. <if test="selectIds != null and selectIds != '' and selectIds.size() > 0">
  651. and a.id in
  652. <foreach collection="selectIds" item="item" open="(" separator="," close=")">
  653. #{item}
  654. </foreach>
  655. </if>
  656. <if test="syPolicyno != null and syPolicyno != '' ">
  657. and a.sy_policyno =#{syPolicyno}
  658. </if>
  659. <if test="noPolicyno != null and noPolicyno != ''">
  660. and a.no_policyno =#{noPolicyno}
  661. </if>
  662. <if test="signdate !=null and signdate !=''">
  663. AND a.signdate =#{signdate}
  664. </if>
  665. <if test="partnerCompaniesId !=null and partnerCompaniesId !=''">
  666. AND a.partner_companies_id =#{partnerCompaniesId}
  667. </if>
  668. <if test="createTime !=null and createTime !=''">
  669. AND a.create_time =#{createTime}
  670. </if>
  671. <if test="settlementTime !=null and settlementTime !=''">
  672. AND a.settlement_time =#{settlementTime}
  673. </if>
  674. <if test="partnerCompaniesName !=null and partnerCompaniesName !=''">
  675. AND a.partner_companies_name =#{partnerCompaniesName}
  676. </if>
  677. <if test="userId !=null and userId !=''">
  678. and a.userId =#{userId}
  679. </if>
  680. <if test="companyId !=null and companyId !=''">
  681. and a.company_id =#{companyId}
  682. </if>
  683. <if test="riskcode !=null and riskcode !=''">
  684. and a.riskcode =#{riskcode}
  685. </if>
  686. <if test="year !=null and year !=''">
  687. AND YEAR(a.signdate) =#{year}
  688. </if>
  689. <if test="month !=null and month !=''">
  690. AND month(a.signdate) =#{month}
  691. </if>
  692. <if test="day !=null and day !=''">
  693. AND day(a.signdate) =#{day}
  694. </if>
  695. <if test="insuredName !=null and insuredName !=''">
  696. AND a.insured_name =#{insuredName}
  697. </if>
  698. <if test="partnerCompaniesIdList != null and partnerCompaniesIdList != '' and partnerCompaniesIdList.size() > 0">
  699. and a.partner_companies_id in
  700. <foreach collection="partnerCompaniesIdList" item="item" open="(" separator="," close=")">
  701. #{item}
  702. </foreach>
  703. </if>
  704. </where>
  705. </select>
  706. <select id="ptTotalAmount" resultType="com.ydtech.modules.fnc.entity.InsPlyIncome">
  707. SELECT
  708. SUM(IFNULL(a.commission_feevalue ,0 ) + IFNULL(a.other_feevalue ,0 )) AS commissionFeevalue,
  709. SUM( CASE WHEN a.handling_fees_status = '0' THEN IFNULL(a.commission_feevalue ,0 ) + IFNULL(a.other_feevalue ,0 ) ELSE 0 END ) AS "noInvoicCommissionFeevalue",
  710. SUM(CASE WHEN a.handling_fees_status = '1' THEN IFNULL(a.commission_feevalue ,0 ) + IFNULL(a.other_feevalue ,0 ) ELSE 0 END) AS "readyCommissionFeevalue"
  711. FROM
  712. ins_ply_income a
  713. LEFT JOIN
  714. ptl_agreement pa ON pa.id = a.agreement_id
  715. <where>
  716. 1=1
  717. <if test="startDate !=null and startDate!='' and endDate !=null and endDate !=''">
  718. and DATE_FORMAT( a.signdate, '%Y-%m-%d') between DATE_FORMAT(#{startDate}, '%Y-%m-%d') and DATE_FORMAT(#{endDate}, '%Y-%m-%d')
  719. </if>
  720. <if test="agreementType !=null and agreementType !=''">
  721. and pa.agreement_type =#{agreementType}
  722. </if>
  723. <if test="orderno !=null and orderno !=''">
  724. and a.orderno =#{orderno}
  725. </if>
  726. <if test="companyName !=null and companyName !=''">
  727. and a.company_id =#{companyName}
  728. </if>
  729. <if test="signDateEnd !=null and signDateEnd!='' and signDateStart !=null and signDateStart !=''">
  730. and a.signdate between #{signDateStart} and #{signDateEnd}
  731. </if>
  732. <if test="policyno !=null and policyno !=''">
  733. and a.policyno =#{policyno}
  734. </if>
  735. <if test="handlingFeesStatus !=null and handlingFeesStatus !=''">
  736. and a.handling_fees_status =#{handlingFeesStatus}
  737. </if>
  738. <if test="documentaryFeesStatus !=null and documentaryFeesStatus !=''">
  739. and a.documentary_fees_status =#{documentaryFeesStatus}
  740. </if>
  741. <if test="isNotCar !=null and isNotCar !=''">
  742. and a.is_not_car =#{isNotCar}
  743. </if>
  744. <if test="jqStartDate !=null and jqStartDate != '' and jqEndDate != null and jqEndDate !=''">
  745. AND a.jq_end_date BETWEEN #{jqStartDate} AND #{jqEndDate} AND a.jq_start_date &gt; = #{jqStartDate}
  746. </if>
  747. <if test="syStartDate !=null and syStartDate != '' and syEndDate != null and syEndDate !=''">
  748. AND a.sy_start_date BETWEEN #{syStartDate} AND #{syEndDate} AND a.sy_start_date &gt; = #{syStartDate}
  749. </if>
  750. <if test="isOther !=null and isOther !=''">
  751. and a.is_not_documentary =#{isOther}
  752. </if>
  753. <if test="licenseno != null and licenseno != '' ">
  754. and a.licenseno =#{licenseno}
  755. </if>
  756. <if test="deptId !=null and deptId !=''">
  757. and pa.dept_id =#{deptId}
  758. </if>
  759. <if test="ids != null and ids != '' and ids.length > 0">
  760. and a.id in
  761. <foreach collection="ids" item="item" open="(" separator="," close=")">
  762. #{item}
  763. </foreach>
  764. </if>
  765. <if test="selectIds != null and selectIds != '' and selectIds.size() > 0">
  766. and a.id in
  767. <foreach collection="selectIds" item="item" open="(" separator="," close=")">
  768. #{item}
  769. </foreach>
  770. </if>
  771. <if test="syPolicyno != null and syPolicyno != '' ">
  772. and a.sy_policyno =#{syPolicyno}
  773. </if>
  774. <if test="noPolicyno != null and noPolicyno != ''">
  775. and a.no_policyno =#{noPolicyno}
  776. </if>
  777. <if test="signdate !=null and signdate !=''">
  778. AND a.signdate =#{signdate}
  779. </if>
  780. <if test="partnerCompaniesId !=null and partnerCompaniesId !=''">
  781. AND a.partner_companies_id =#{partnerCompaniesId}
  782. </if>
  783. <if test="createTime !=null and createTime !=''">
  784. AND a.create_time =#{createTime}
  785. </if>
  786. <if test="settlementTime !=null and settlementTime !=''">
  787. AND a.settlement_time =#{settlementTime}
  788. </if>
  789. <if test="partnerCompaniesName !=null and partnerCompaniesName !=''">
  790. AND a.partner_companies_name =#{partnerCompaniesName}
  791. </if>
  792. <if test="userId !=null and userId !=''">
  793. and a.userId =#{userId}
  794. </if>
  795. <if test="companyId !=null and companyId !=''">
  796. and a.company_id =#{companyId}
  797. </if>
  798. <if test="riskcode !=null and riskcode !=''">
  799. and a.riskcode =#{riskcode}
  800. </if>
  801. <if test="year !=null and year !=''">
  802. AND YEAR(a.signdate) =#{year}
  803. </if>
  804. <if test="month !=null and month !=''">
  805. AND month(a.signdate) =#{month}
  806. </if>
  807. <if test="day !=null and day !=''">
  808. AND day(a.signdate) =#{day}
  809. </if>
  810. <if test="insuredName !=null and insuredName !=''">
  811. AND a.insured_name =#{insuredName}
  812. </if>
  813. <if test="partnerCompaniesIdList != null and partnerCompaniesIdList != '' and partnerCompaniesIdList.size() > 0">
  814. and a.partner_companies_id in
  815. <foreach collection="partnerCompaniesIdList" item="item" open="(" separator="," close=")">
  816. #{item}
  817. </foreach>
  818. </if>
  819. </where>
  820. </select>
  821. <select id="totalPinAmount" resultType="com.ydtech.modules.fnc.entity.InsPlyIncome">
  822. select
  823. MAX(a.partner_companies_id) as "partnerCompaniesId",
  824. MAX( ec.name ) AS "companyName",
  825. sum( a.commission_feevalue ) AS "commissionFeevalue",
  826. sum( a.other_feevalue ) AS "otherFeevalue",
  827. SUM( a.commission_feevalue + a.other_feevalue ) AS "totalFeevalue",
  828. GROUP_CONCAT(a.id) as "ids",
  829. MAX( a.partner_companies_name) as "partnerCompaniesName",
  830. MAX(pa.docking_person) as "dockingPerson",
  831. a.agreement_id AS "agreementId"
  832. from ins_ply_income a
  833. LEFT JOIN esm_ins_company ec on ec.id= a.company_id
  834. LEFT JOIN ptl_agreement pa on pa.id= a.agreement_id
  835. <where>
  836. 1=1
  837. <if test="agreementType !=null and agreementType!='' ">
  838. AND pa.agreement_type =#{agreementType}
  839. </if>
  840. <if test="documentaryFeesStatus != null and documentaryFeesStatus != '' ">
  841. AND a.documentary_fees_status = #{documentaryFeesStatus}
  842. </if>
  843. <if test="handlingFeesStatus != null and handlingFeesStatus != ''">
  844. AND a.handling_fees_status = #{handlingFeesStatus}
  845. </if>
  846. <if test="year !=null and year !=''">
  847. AND YEAR(a.signdate) =#{year}
  848. </if>
  849. <if test="month !=null and month !=''">
  850. AND month(a.signdate) =#{month}
  851. </if>
  852. <if test="day !=null and day !=''">
  853. AND day(a.signdate) =#{day}
  854. </if>
  855. </where>
  856. GROUP BY a.agreement_id
  857. </select>
  858. <select id="queryInvoicing" resultType="com.ydtech.modules.fnc.entity.InsPlyIncome">
  859. select
  860. sum(a.commission_feevalue) as "commissionFeevalue",
  861. sum(a.invoic_amount) as "invoicAmount"
  862. from ins_ply_income a
  863. LEFT JOIN ptl_agreement pa on pa.id= a.agreement_id
  864. <where>
  865. 1=1
  866. <if test="startDate !=null and startDate!='' and endDate !=null and endDate !=''">
  867. and DATE_FORMAT( a.signdate, '%Y-%m-%d') between DATE_FORMAT(#{startDate}, '%Y-%m-%d') and DATE_FORMAT(#{endDate}, '%Y-%m-%d')
  868. </if>
  869. <if test="agreementType !=null and agreementType !=''">
  870. and pa.agreement_type =#{agreementType}
  871. </if>
  872. <if test="handlingFeesStatus !=null and handlingFeesStatus !=''">
  873. and a.handling_fees_status =#{handlingFeesStatus}
  874. </if>
  875. <if test="orderno !=null and orderno !=''">
  876. and a.orderno =#{orderno}
  877. </if>
  878. <if test="policyno !=null and policyno !=''">
  879. and a.policyno =#{policyno}
  880. </if>
  881. <if test="documentaryFeesStatus !=null and documentaryFeesStatus !=''">
  882. and a.documentary_fees_status =#{documentaryFeesStatus}
  883. </if>
  884. <if test="isNotCar !=null and isNotCar !=''">
  885. and a.is_not_car =#{isNotCar}
  886. </if>
  887. <if test="isOther !=null and isOther !=''">
  888. and a.is_not_documentary =#{isOther}
  889. </if>
  890. <if test="licenseno != null and licenseno != ''">
  891. and a.licenseno =#{licenseno}
  892. </if>
  893. <if test="syPolicyno != null and syPolicyno != ''">
  894. and a.sy_policyno =#{syPolicyno}
  895. </if>
  896. <if test="noPolicyno != null and noPolicyno != ''">
  897. and a.no_policyno =#{noPolicyno}
  898. </if>
  899. <if test="signdate !=null and signdate !=''">
  900. and a.signdate =#{signdate}
  901. </if>
  902. <if test="partnerCompaniesId !=null and partnerCompaniesId !=''">
  903. and a.partner_companies_id =#{partnerCompaniesId}
  904. </if>
  905. <if test="createTime !=null and createTime !=''">
  906. and a.create_time =#{createTime}
  907. </if>
  908. <if test="settlementTime !=null and settlementTime !=''">
  909. and a.settlement_time =#{settlementTime}
  910. </if>
  911. <if test="userId !=null and userId !=''">
  912. and a.userId =#{userId}
  913. </if>
  914. <if test="companyId !=null and companyId !=''">
  915. and a.company_id =#{companyId}
  916. </if>
  917. <if test="riskcode !=null and riskcode !=''">
  918. and a.riskcode =#{riskcode}
  919. </if>
  920. <if test="year !=null and year !=''">
  921. AND YEAR(a.signdate) =#{year}
  922. </if>
  923. <if test="month !=null and month !=''">
  924. AND month(a.signdate) =#{month}
  925. </if>
  926. <if test="day !=null and day !=''">
  927. AND day(a.signdate) =#{day}
  928. </if>
  929. </where>
  930. </select>
  931. <select id="totalBxAmount" resultType="com.ydtech.modules.fnc.entity.InsPlyIncome">
  932. SELECT
  933. a.partner_companies_id AS "partnerCompaniesId",
  934. MAX( a.company_name ) AS "companyName",
  935. MAX( a.company_id ) AS "companyId",
  936. MAX( a.partner_companies_name ) AS "partnerCompaniesName"
  937. FROM
  938. ins_ply_income a
  939. LEFT JOIN ptl_agreement pa ON a.agreement_id = pa.id
  940. LEFT JOIN esm_ins_company eic on eic.id=a.partner_companies_id
  941. <where>
  942. 1=1
  943. <if test="agreementType !=null and agreementType!='' ">
  944. AND pa.agreement_type =#{agreementType}
  945. </if>
  946. <if test="year !=null and year !=''">
  947. AND YEAR(a.signdate) =#{year}
  948. </if>
  949. <if test="isOther !=null and isOther !=''">
  950. and a.is_not_documentary =#{isOther}
  951. </if>
  952. <if test="isNotCar !=null and isNotCar !=''">
  953. and a.is_not_car =#{isNotCar}
  954. </if>
  955. <if test="month !=null and month !=''">
  956. AND month(a.signdate) =#{month}
  957. </if>
  958. <if test="day !=null and day !=''">
  959. AND day(a.signdate) =#{day}
  960. </if>
  961. <if test="partnerCompaniesName !=null and partnerCompaniesName !=''">
  962. AND a.partner_companies_name =#{partnerCompaniesName}
  963. </if>
  964. <if test="allPartnerCompaniesId !=null and allPartnerCompaniesId !=''">
  965. AND eic.parent_id LIKE CONCAT(#{allPartnerCompaniesId}, '%')
  966. </if>
  967. <if test="provincePartnerCompaniesId !=null and provincePartnerCompaniesId !=''">
  968. and eic.parent_id =#{provincePartnerCompaniesId}
  969. </if>
  970. <if test="companyName !=null and companyName !=''">
  971. and a.company_id =#{companyName}
  972. </if>
  973. </where>
  974. GROUP BY a.partner_companies_id
  975. </select>
  976. <select id="getIncomeIdList" resultType="com.ydtech.modules.fnc.entity.InsPlyIncome">
  977. select
  978. a.partner_companies_id AS "partnerCompaniesId",
  979. a.id as "id"
  980. from ins_ply_income a
  981. LEFT JOIN ptl_agreement pa on pa.id= a.agreement_id
  982. <where>
  983. 1=1
  984. and a.handling_fees_status ='2'
  985. <if test="agreementType !=null and agreementType!='' ">
  986. AND pa.agreement_type =#{agreementType}
  987. </if>
  988. <if test="year !=null and year !=''">
  989. AND YEAR(a.signdate) =#{year}
  990. </if>
  991. <if test="isOther !=null and isOther !=''">
  992. and a.is_not_documentary =#{isOther}
  993. </if>
  994. <if test="isNotCar !=null and isNotCar !=''">
  995. and a.is_not_car =#{isNotCar}
  996. </if>
  997. <if test="month !=null and month !=''">
  998. AND month(a.signdate) =#{month}
  999. </if>
  1000. <if test="day !=null and day !=''">
  1001. AND day(a.signdate) =#{day}
  1002. </if>
  1003. </where>
  1004. </select>
  1005. <select id="allOtherAmount" resultType="com.ydtech.modules.fnc.entity.InsPlyIncome">
  1006. SELECT
  1007. a.partner_companies_id AS "partnerCompaniesId",
  1008. MAX( a.company_name ) AS "companyName",
  1009. MAX( a.company_id ) AS "companyId",
  1010. MAX( a.partner_companies_name ) AS "partnerCompaniesName",
  1011. IFNULL(max(f.settleMentAmount) , 0.00) +IFNULL ( max(d.settleMentAmount),0.00)-IFNULL(max(f.settleMentAmount) , 0.00) AS "allInvoicCommissionFeevalue",
  1012. IFNULL(max(f.settleMentAmount) , 0.00) + IFNULL(max(d.settleMentAmount) , 0.00) as "readyCommissionFeevalue",
  1013. IFNULL(max(d.settleMentAmount) , 0.00) as "invoicCommissionFeevalue",
  1014. sum(COALESCE( a.other_feevalue,0.00) )-IFNULL ( max(d.settleMentAmount),0.00) as "noInvoicCommissionFeevalue",
  1015. sum(COALESCE( a.other_feevalue,0.00) )-COALESCE(max(c.settleMentAmount),0.00)+IFNULL ( max(d.settleMentAmount),0.00) AS "unSettledAmount",
  1016. IFNULL(max(f.taxesFees) , 0.00) as "taxesFees",
  1017. IFNULL(max(f.expendAmount),0) as "expendAmount",
  1018. sum( a.other_feevalue ) AS "otherFeevalue"
  1019. FROM
  1020. ins_ply_income a
  1021. LEFT JOIN ptl_agreement pa ON a.agreement_id = pa.id
  1022. LEFT JOIN esm_ins_company eic on eic.id=a.partner_companies_id
  1023. LEFT JOIN ( SELECT a.partner_companies_id AS "partnerCompaniesId" ,sum(
  1024. settlement_amount ) AS "settleMentAmount" FROM settlement_documentary_fees a
  1025. WHERE ( a.settlement_status = '1' or a.settlement_status = '2')
  1026. and a.handling_fees_status ='1'
  1027. <if test="isNotCar !=null and isNotCar !=''">
  1028. and a.is_not_car =#{isNotCar}
  1029. </if>
  1030. GROUP BY partner_companies_id
  1031. ) c ON c.partnerCompaniesId = a.partner_companies_id
  1032. LEFT JOIN ( SELECT a.partner_companies_id AS "partnerCompaniesId" ,sum(
  1033. settlement_amount ) AS "settleMentAmount" FROM settlement_documentary_fees a
  1034. WHERE a.settlement_status = '1'
  1035. and a.handling_fees_status ='1'
  1036. <if test="isNotCar !=null and isNotCar !=''">
  1037. and a.is_not_car =#{isNotCar}
  1038. </if>
  1039. GROUP BY partner_companies_id
  1040. ) d ON d.partnerCompaniesId = a.partner_companies_id
  1041. LEFT JOIN ( SELECT a.partner_companies_id AS "partnerCompaniesId",sum(
  1042. settlement_amount ) AS "settleMentAmount",
  1043. sum(a.settlement_amount * (1 -a.tax_points/100) ) as 'expendAmount',
  1044. sum(a.settlement_amount * (a.tax_points/100) ) as 'taxesFees',
  1045. SUM(a.tax_points) as "taxPoints"
  1046. FROM settlement_documentary_fees a
  1047. WHERE a.settlement_status = '2'
  1048. and a.handling_fees_status ='1'
  1049. <if test="isNotCar !=null and isNotCar !=''">
  1050. and a.is_not_car =#{isNotCar}
  1051. </if>
  1052. GROUP BY partner_companies_id
  1053. ) f ON f.partnerCompaniesId = a.partner_companies_id
  1054. <where>
  1055. 1=1
  1056. <if test="startDate !=null and startDate!='' and endDate !=null and endDate !=''">
  1057. and DATE_FORMAT( a.signdate, '%Y-%m-%d') between DATE_FORMAT(#{startDate}, '%Y-%m-%d') and DATE_FORMAT(#{endDate}, '%Y-%m-%d')
  1058. </if>
  1059. <if test="agreementType !=null and agreementType !=''">
  1060. and pa.agreement_type =#{agreementType}
  1061. </if>
  1062. <if test="signDateEnd !=null and signDateEnd!='' and signDateStart !=null and signDateStart !=''">
  1063. and a.signdate between #{signDateStart} and #{signDateEnd}
  1064. </if>
  1065. <if test="handlingFeesStatus !=null and handlingFeesStatus !=''">
  1066. and a.handling_fees_status =#{handlingFeesStatus}
  1067. </if>
  1068. <if test="dockingPerson !=null and dockingPerson !=''">
  1069. and pa.docking_person =#{dockingPerson}
  1070. </if>
  1071. <if test="orderno !=null and orderno !=''">
  1072. and a.orderno =#{orderno}
  1073. </if>
  1074. <if test="companyName !=null and companyName !=''">
  1075. and a.company_id =#{companyName}
  1076. </if>
  1077. <if test="policyno !=null and policyno !=''">
  1078. and a.policyno =#{policyno}
  1079. </if>
  1080. <if test="documentaryFeesStatus !=null and documentaryFeesStatus !=''">
  1081. and a.documentary_fees_status =#{documentaryFeesStatus}
  1082. </if>
  1083. <if test="isNotCar !=null and isNotCar !=''">
  1084. and a.is_not_car =#{isNotCar}
  1085. </if>
  1086. <if test="isOther !=null and isOther !=''">
  1087. and a.is_not_documentary =#{isOther}
  1088. </if>
  1089. <if test="allPartnerCompaniesId !=null and allPartnerCompaniesId !=''">
  1090. AND eic.parent_id LIKE CONCAT(#{allPartnerCompaniesId}, '%')
  1091. </if>
  1092. <if test="provincePartnerCompaniesId !=null and provincePartnerCompaniesId !=''">
  1093. and eic.parent_id =#{provincePartnerCompaniesId}
  1094. </if>
  1095. <if test="licenseno != null and licenseno != ''">
  1096. and a.licenseno =#{licenseno}
  1097. </if>
  1098. <if test="syPolicyno != null and syPolicyno != ''">
  1099. and a.sy_policyno =#{syPolicyno}
  1100. </if>
  1101. <if test="noPolicyno != null and noPolicyno != ''">
  1102. and a.no_policyno =#{noPolicyno}
  1103. </if>
  1104. <if test="signdate !=null and signdate !=''">
  1105. AND a.signdate =#{signdate}
  1106. </if>
  1107. <if test="partnerCompaniesId !=null and partnerCompaniesId !=''">
  1108. AND a.partner_companies_id =#{partnerCompaniesId}
  1109. </if>
  1110. <if test="partnerCompaniesName !=null and partnerCompaniesName !=''">
  1111. AND a.partner_companies_name =#{partnerCompaniesName}
  1112. </if>
  1113. <if test="createTime !=null and createTime !=''">
  1114. AND a.create_time =#{createTime}
  1115. </if>
  1116. <if test="settlementTime !=null and settlementTime !=''">
  1117. AND a.settlement_time =#{settlementTime}
  1118. </if>
  1119. <if test="userId !=null and userId !=''">
  1120. and a.userId =#{userId}
  1121. </if>
  1122. <if test="companyId !=null and companyId !=''">
  1123. and a.company_id =#{companyId}
  1124. </if>
  1125. <if test="riskcode !=null and riskcode !=''">
  1126. and a.riskcode =#{riskcode}
  1127. </if>
  1128. <if test="year !=null and year !=''">
  1129. AND YEAR(a.signdate) =#{year}
  1130. </if>
  1131. <if test="month !=null and month !=''">
  1132. AND month(a.signdate) =#{month}
  1133. </if>
  1134. <if test="day !=null and day !=''">
  1135. AND day(a.signdate) =#{day}
  1136. </if>
  1137. <if test="insuredName !=null and insuredName !=''">
  1138. AND a.insured_name =#{insuredName}
  1139. </if>
  1140. </where>
  1141. GROUP BY
  1142. a.partner_companies_id
  1143. </select>
  1144. <select id="getOtherIds" resultType="java.util.HashMap">
  1145. SELECT
  1146. a.id as "id",
  1147. a.partner_companies_id AS "partnerCompaniesId"
  1148. FROM
  1149. ins_ply_income a
  1150. LEFT JOIN ptl_agreement pa ON a.agreement_id = pa.id
  1151. <where>
  1152. 1=1
  1153. <if test="agreementType !=null and agreementType!='' ">
  1154. AND pa.agreement_type =#{agreementType}
  1155. </if>
  1156. <if test="year !=null and year !=''">
  1157. AND YEAR(a.signdate) =#{year}
  1158. </if>
  1159. <if test="isOther !=null and isOther !=''">
  1160. and a.is_not_documentary =#{isOther}
  1161. </if>
  1162. <if test="isNotCar !=null and isNotCar !=''">
  1163. and a.is_not_car =#{isNotCar}
  1164. </if>
  1165. <if test="month !=null and month !=''">
  1166. AND month(a.signdate) =#{month}
  1167. </if>
  1168. <if test="day !=null and day !=''">
  1169. AND day(a.signdate) =#{day}
  1170. </if>
  1171. <if test="documentaryFeesStatus != null and documentaryFeesStatus != '' ">
  1172. AND a.documentary_fees_status = #{documentaryFeesStatus}
  1173. </if>
  1174. </where>
  1175. </select>
  1176. <select id="getById" resultType="com.ydtech.modules.fnc.entity.InsPlyIncome">
  1177. select
  1178. pa.agreement_name as "agreementName",
  1179. su.name as "userName",
  1180. <include refid="income_com"/>
  1181. from ins_ply_income a
  1182. LEFT JOIN ptl_agreement pa on a.agreement_id = pa.id
  1183. LEFT JOIN sys_user su on su.id=a.user_id
  1184. <where>
  1185. <if test="id !=null and id !=''">
  1186. a.id=#{id}
  1187. </if>
  1188. </where>
  1189. </select>
  1190. <select id="groupByInvoic" resultType="java.util.HashMap">
  1191. select
  1192. sum(a.commission_feevalue) as "invoicCommissionFeevalue",
  1193. MAX(invoic_id) as "invoicId",
  1194. MAX(invoic_time) as "invoicTime",
  1195. GROUP_CONCAT(a.id) as "ids"
  1196. from ins_ply_income a
  1197. LEFT JOIN ptl_agreement pa on a.agreement_id = pa.id
  1198. LEFT JOIN sys_user su on su.id=a.user_id
  1199. <where>
  1200. 1=1
  1201. AND a.invoic_id is not null
  1202. <if test="idArr !=null and idArr!=''">
  1203. a.id IN
  1204. <foreach item="item" index="index" collection="idArr" open="(" separator="," close=")">
  1205. #{item}
  1206. </foreach>
  1207. </if>
  1208. <if test="agreementType !=null and agreementType!='' ">
  1209. AND pa.agreement_type =#{agreementType}
  1210. </if>
  1211. <if test="year !=null and year !=''">
  1212. AND YEAR(a.signdate) =#{year}
  1213. </if>
  1214. <if test="isOther !=null and isOther !=''">
  1215. and a.is_not_documentary =#{isOther}
  1216. </if>
  1217. <if test="isNotCar !=null and isNotCar !=''">
  1218. and a.is_not_car =#{isNotCar}
  1219. </if>
  1220. <if test="handlingFeesStatus !=null and handlingFeesStatus !=''">
  1221. and a.handling_fees_status =#{handlingFeesStatus}
  1222. </if>
  1223. <if test="month !=null and month !=''">
  1224. AND month(a.signdate) =#{month}
  1225. </if>
  1226. <if test="day !=null and day !=''">
  1227. AND day(a.signdate) =#{day}
  1228. </if>
  1229. <if test="partnerCompaniesId !=null and partnerCompaniesId !=''">
  1230. AND a.partner_companies_id =#{partnerCompaniesId}
  1231. </if>
  1232. </where>
  1233. group by a.invoic_id
  1234. </select>
  1235. <update id="updateByIds" parameterType="com.ydtech.modules.fnc.entity.InsPlyIncome">
  1236. update ins_ply_income
  1237. set handling_fees_status ='1',
  1238. settlement_time =NOW()
  1239. <where>
  1240. 1=1
  1241. <if test="split != null and split != '' and split.length > 0">
  1242. and id in
  1243. <foreach collection="split" item="item" open="(" separator="," close=")">
  1244. #{item}
  1245. </foreach>
  1246. </if>
  1247. </where>
  1248. </update>
  1249. <select id="otherTimeDetail" resultType="java.util.HashMap">
  1250. SELECT
  1251. i.YEAR as "year",
  1252. i.monthNumber as "monthNumber",
  1253. i.allTotalOtherFeevalue as "allTotalOtherFeevalue",
  1254. IFNULL(s.invoicCommissionFeevalue,0) AS invoicCommissionFeevalue,
  1255. CONCAT(i.YEAR, '-', LPAD(i.monthNumber, 2, '0')) AS "monthYear",
  1256. IFNULL(i.allTotalOtherFeevalue ,0) - IFNULL(s.invoicCommissionFeevalue,0) AS noInvoicCommissionFeevalue
  1257. FROM (
  1258. SELECT
  1259. YEAR(a.signdate) AS YEAR,
  1260. MONTH(a.signdate) AS monthNumber,
  1261. SUM(IFNULL(a.other_feevalue, 0)) AS allTotalOtherFeevalue
  1262. FROM ins_ply_income a
  1263. LEFT JOIN ptl_agreement pa ON a.agreement_id = pa.id
  1264. <where>
  1265. YEAR(a.signdate) BETWEEN YEAR(CURDATE()) AND YEAR(CURDATE()) + 1
  1266. <if test="startDate !=null and startDate!='' and endDate !=null and endDate !=''">
  1267. and DATE_FORMAT( a.signdate, '%Y-%m-%d') between DATE_FORMAT(#{startDate}, '%Y-%m-%d') and DATE_FORMAT(#{endDate}, '%Y-%m-%d')
  1268. </if>
  1269. <if test="agreementType !=null and agreementType !=''">
  1270. and pa.agreement_type =#{agreementType}
  1271. </if>
  1272. <if test="signDateEnd !=null and signDateEnd!='' and signDateStart !=null and signDateStart !=''">
  1273. and a.signdate between #{signDateStart} and #{signDateEnd}
  1274. </if>
  1275. <if test="yeartsStart !=null and yeartsStart !='' and yeartsEnd !=null and yeartsEnd!=''">
  1276. and DATE_FORMAT( a.signdate, '%Y') between #{yeartsStart} and #{yeartsEnd}
  1277. </if>
  1278. <if test="handlingFeesStatus !=null and handlingFeesStatus !=''">
  1279. and a.handling_fees_status =#{handlingFeesStatus}
  1280. </if>
  1281. <if test="dockingPerson !=null and dockingPerson !=''">
  1282. and pa.docking_person =#{dockingPerson}
  1283. </if>
  1284. <if test="cityId != null and cityId != ''">
  1285. and a.dept_id LIKE CONCAT(#{cityId}, '%')
  1286. </if>
  1287. <if test="countyId != null and countyId != ''">
  1288. and a.dept_id LIKE CONCAT(#{countyId}, '%')
  1289. </if>
  1290. <if test="orderno !=null and orderno !=''">
  1291. and a.orderno =#{orderno}
  1292. </if>
  1293. <if test="companyName !=null and companyName !=''">
  1294. and a.company_id =#{companyName}
  1295. </if>
  1296. <if test="policyno !=null and policyno !=''">
  1297. and a.policyno =#{policyno}
  1298. </if>
  1299. <if test="documentaryFeesStatus !=null and documentaryFeesStatus !=''">
  1300. and a.documentary_fees_status =#{documentaryFeesStatus}
  1301. </if>
  1302. <if test="isNotCar !=null and isNotCar !=''">
  1303. and a.is_not_car =#{isNotCar}
  1304. </if>
  1305. <if test="deptId !=null and deptId !=''">
  1306. and pa.dept_id =#{deptId}
  1307. </if>
  1308. <if test="ids != null and ids != '' and ids.length > 0">
  1309. and a.id in
  1310. <foreach collection="ids" item="item" open="(" separator="," close=")">
  1311. #{item}
  1312. </foreach>
  1313. </if>
  1314. <if test="selectIds != null and selectIds != '' and selectIds.size() > 0">
  1315. and a.id in
  1316. <foreach collection="selectIds" item="item" open="(" separator="," close=")">
  1317. #{item}
  1318. </foreach>
  1319. </if>
  1320. <if test="partnerCompaniesIdList != null and partnerCompaniesIdList != '' and partnerCompaniesIdList.size() > 0">
  1321. and a.partner_companies_id in
  1322. <foreach collection="partnerCompaniesIdList" item="item" open="(" separator="," close=")">
  1323. #{item}
  1324. </foreach>
  1325. </if>
  1326. <if test="isOther !=null and isOther !=''">
  1327. and a.is_not_documentary =#{isOther}
  1328. </if>
  1329. <if test="licenseno != null and licenseno != ''">
  1330. and a.licenseno =#{licenseno}
  1331. </if>
  1332. <if test="syPolicyno != null and syPolicyno != ''">
  1333. and a.sy_policyno =#{syPolicyno}
  1334. </if>
  1335. <if test="noPolicyno != null and noPolicyno != ''">
  1336. and a.no_policyno =#{noPolicyno}
  1337. </if>
  1338. <if test="signdate !=null and signdate !=''">
  1339. AND a.signdate =#{signdate}
  1340. </if>
  1341. <if test="partnerCompaniesId !=null and partnerCompaniesId !=''">
  1342. AND a.partner_companies_id =#{partnerCompaniesId}
  1343. </if>
  1344. <if test="partnerCompaniesName !=null and partnerCompaniesName !=''">
  1345. AND a.partner_companies_name =#{partnerCompaniesName}
  1346. </if>
  1347. <if test="createTime !=null and createTime !=''">
  1348. AND a.create_time =#{createTime}
  1349. </if>
  1350. <if test="settlementTime !=null and settlementTime !=''">
  1351. AND a.settlement_time =#{settlementTime}
  1352. </if>
  1353. <if test="userId !=null and userId !=''">
  1354. and a.userId =#{userId}
  1355. </if>
  1356. <if test="companyId !=null and companyId !=''">
  1357. and a.company_id =#{companyId}
  1358. </if>
  1359. <if test="riskcode !=null and riskcode !=''">
  1360. and a.riskcode =#{riskcode}
  1361. </if>
  1362. <if test="year !=null and year !=''">
  1363. AND YEAR(a.signdate) =#{year}
  1364. </if>
  1365. <if test="month !=null and month !=''">
  1366. AND month(a.signdate) =#{month}
  1367. </if>
  1368. <if test="day !=null and day !=''">
  1369. AND day(a.signdate) =#{day}
  1370. </if>
  1371. <if test="insuredName !=null and insuredName !=''">
  1372. AND a.insured_name =#{insuredName}
  1373. </if>
  1374. <if test="jqStartDate !=null and jqStartDate != '' and jqEndDate != null and jqEndDate !=''">
  1375. AND a.jq_end_date BETWEEN #{jqStartDate} AND #{jqEndDate} AND a.jq_start_date &gt; = #{jqStartDate}
  1376. </if>
  1377. <if test="syStartDate !=null and syStartDate != '' and syEndDate != null and syEndDate !=''">
  1378. AND a.sy_start_date BETWEEN #{syStartDate} AND #{syEndDate} AND a.sy_start_date &gt; = #{syStartDate}
  1379. </if>
  1380. </where>
  1381. GROUP BY YEAR(a.signdate), MONTH(a.signdate)
  1382. ) i
  1383. LEFT JOIN (
  1384. SELECT
  1385. YEAR(a.signing_time) AS YEAR,
  1386. MONTH(a.signing_time) AS monthNumber,
  1387. SUM(CASE WHEN a.settlement_status = '1' THEN IFNULL(a.settlement_amount, 0) ELSE 0 END) AS invoicCommissionFeevalue
  1388. FROM settlement_documentary_fees a
  1389. <where>
  1390. YEAR(a.signing_time) BETWEEN YEAR(CURDATE()) AND YEAR(CURDATE()) + 1
  1391. <if test="isNotCar !=null and isNotCar !=''">
  1392. and a.is_not_car =#{isNotCar}
  1393. </if>
  1394. <if test="partnerCompaniesIdList != null and partnerCompaniesIdList != '' and partnerCompaniesIdList.size() > 0">
  1395. and a.partner_companies_id in
  1396. <foreach collection="partnerCompaniesIdList" item="item" open="(" separator="," close=")">
  1397. #{item}
  1398. </foreach>
  1399. </if>
  1400. <if test="partnerCompaniesId !=null and partnerCompaniesId !=''">
  1401. AND a.partner_companies_id =#{partnerCompaniesId}
  1402. </if>
  1403. <if test="companyName !=null and companyName !=''">
  1404. and a.company_id =#{companyName}
  1405. </if>
  1406. <if test="handlingFeesStatus !=null and handlingFeesStatus !=''">
  1407. and a.handling_fees_status =#{handlingFeesStatus}
  1408. </if>
  1409. <if test="yeartsStart !=null and yeartsStart !='' and yeartsEnd !=null and yeartsEnd!=''">
  1410. and DATE_FORMAT( a.signing_time, '%Y') between #{yeartsStart} and #{yeartsEnd}
  1411. </if>
  1412. </where>
  1413. GROUP BY YEAR(a.signing_time), MONTH(a.signing_time)
  1414. ) s ON i.YEAR = s.YEAR AND i.monthNumber = s.monthNumber
  1415. ORDER BY i.YEAR, i.monthNumber;
  1416. </select>
  1417. </mapper>