InsOrdersMapper.xml 84 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE mapper
  3. PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  4. "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  5. <mapper namespace="com.ydtech.modules.order.dao.InsOrdersMapper">
  6. <resultMap id="BaseResultMap" type="com.ydtech.modules.order.entity.InsOrders">
  7. <id property="orderno" column="orderno" jdbcType="VARCHAR"/>
  8. <result property="quoteno" column="quoteno" jdbcType="VARCHAR"/>
  9. <result property="orderstatus" column="orderstatus" jdbcType="VARCHAR"/>
  10. <result property="companyId" column="company_id" jdbcType="VARCHAR"/>
  11. <result property="insCompany" column="ins_company" jdbcType="VARCHAR"/>
  12. <result property="carinfo" column="carinfo" javaType="com.alibaba.fastjson.JSONObject"
  13. typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler" jdbcType="VARCHAR"/>
  14. <result property="userid" column="userid" jdbcType="VARCHAR"/>
  15. <result property="username" column="username" jdbcType="VARCHAR"/>
  16. <result property="deptid" column="deptid" jdbcType="VARCHAR"/>
  17. <result property="deptname" column="deptname" jdbcType="VARCHAR"/>
  18. <result property="ownerinfo" column="ownerinfo" javaType="com.alibaba.fastjson.JSONObject"
  19. typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler" jdbcType="VARCHAR"/>
  20. <result property="applyinfo" column="applyinfo" javaType="com.alibaba.fastjson.JSONObject"
  21. typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler" jdbcType="VARCHAR"/>
  22. <result property="insureinfo" column="insureinfo" javaType="com.alibaba.fastjson.JSONObject"
  23. typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler"
  24. jdbcType="VARCHAR"/>
  25. <result property="agreeid" column="agreeid" jdbcType="VARCHAR"/>
  26. <result property="productid" column="productid" jdbcType="VARCHAR"/>
  27. <result property="product" column="product" jdbcType="VARCHAR"/>
  28. <result property="createtime" column="createtime" jdbcType="TIMESTAMP"/>
  29. <result property="frameno" column="frameno" jdbcType="VARCHAR"/>
  30. <result property="licenseno" column="licenseno" jdbcType="VARCHAR"/>
  31. <result property="insuredname" column="insuredname" jdbcType="VARCHAR"/>
  32. <result property="jqstartdate" column="jqstartdate" jdbcType="VARCHAR"/>
  33. <result property="jqenddate" column="jqenddate" jdbcType="VARCHAR"/>
  34. <result property="systartdate" column="systartdate" jdbcType="VARCHAR"/>
  35. <result property="syenddate" column="syenddate" jdbcType="VARCHAR"/>
  36. <result property="jqpremium" column="jqpremium" jdbcType="VARCHAR"/>
  37. <result property="sypremium" column="sypremium" jdbcType="VARCHAR"/>
  38. <result property="jypremium" column="jypremium" jdbcType="VARCHAR"/>
  39. <result property="taxamount" column="taxamount" jdbcType="VARCHAR"/>
  40. <result property="risk" column="risk" javaType="com.alibaba.fastjson.JSONArray"
  41. typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler" jdbcType="VARCHAR"/>
  42. <result property="king" column="king" javaType="com.alibaba.fastjson.JSONArray"
  43. typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler" jdbcType="VARCHAR"/>
  44. <result property="vehicleAndVesselTax" column="vehicle_and_vessel_tax"
  45. javaType="com.alibaba.fastjson.JSONObject"
  46. typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler" jdbcType="VARCHAR"/>
  47. <result property="subOrderId" column="subOrderId" jdbcType="VARCHAR"/>
  48. <result property="agreementCode" column="agreementCode" jdbcType="VARCHAR"/>
  49. <result property="agreementName" column="agreementName" jdbcType="VARCHAR"/>
  50. <result property="partnerCompaniesName" column="partnerCompaniesName" jdbcType="VARCHAR"/>
  51. <result property="managementSource" column="managementSource" jdbcType="VARCHAR"/>
  52. <result property="leaderName" column="leader_name" jdbcType="VARCHAR"/>
  53. <result property="leaderId" column="leader_id" jdbcType="VARCHAR"/>
  54. <result property="underwritingStatus" column="underwritingStatus" jdbcType="INTEGER"/>
  55. <result property="entryStatus" column="entryStatus" jdbcType="VARCHAR"/>
  56. </resultMap>
  57. <resultMap id="OrderResultMap" type="com.ydtech.modules.order.entity.vo.OrderVo">
  58. <id property="orderno" column="orderno" jdbcType="VARCHAR"/>
  59. <result property="quoteno" column="quoteno" jdbcType="VARCHAR"/>
  60. <result property="apiType" column="api_type" jdbcType="VARCHAR"/>
  61. <result property="orderstatus" column="orderstatus" jdbcType="VARCHAR"/>
  62. <result property="carinfo" column="carinfo" javaType="com.alibaba.fastjson.JSONObject"
  63. typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler" jdbcType="VARCHAR"/>
  64. <result property="userid" column="userid" jdbcType="VARCHAR"/>
  65. <result property="username" column="username" jdbcType="VARCHAR"/>
  66. <result property="deptid" column="deptid" jdbcType="VARCHAR"/>
  67. <result property="deptname" column="deptname" jdbcType="VARCHAR"/>
  68. <result property="ownerinfo" column="ownerinfo" javaType="com.alibaba.fastjson.JSONObject"
  69. typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler" jdbcType="VARCHAR"/>
  70. <result property="applyinfo" column="applyinfo" javaType="com.alibaba.fastjson.JSONObject"
  71. typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler" jdbcType="VARCHAR"/>
  72. <result property="insureinfo" column="insureinfo" javaType="com.alibaba.fastjson.JSONObject"
  73. typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler"
  74. jdbcType="VARCHAR"/>
  75. <result property="agreeid" column="agreeid" jdbcType="VARCHAR"/>
  76. <result property="productid" column="productid" jdbcType="VARCHAR"/>
  77. <result property="product" column="product" jdbcType="VARCHAR"/>
  78. <result property="frameno" column="frameno" jdbcType="VARCHAR"/>
  79. <result property="licenseno" column="licenseno" jdbcType="VARCHAR"/>
  80. <result property="insuredname" column="insuredname" jdbcType="VARCHAR"/>
  81. <result property="jqstartdate" column="jqstartdate" jdbcType="VARCHAR"/>
  82. <result property="jqenddate" column="jqenddate" jdbcType="VARCHAR"/>
  83. <result property="systartdate" column="systartdate" jdbcType="VARCHAR"/>
  84. <result property="syenddate" column="syenddate" jdbcType="VARCHAR"/>
  85. <result property="id" column="id" jdbcType="BIGINT"/>
  86. <result property="companyId" column="company_id" jdbcType="BIGINT"/>
  87. <result property="reptxt" column="reptxt" javaType="com.alibaba.fastjson.JSONObject"
  88. typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler" jdbcType="VARCHAR"/>
  89. <result property="vehicleAndVesselTax" column="vehicle_and_vessel_tax"
  90. javaType="com.alibaba.fastjson.JSONObject"
  91. typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler" jdbcType="VARCHAR"/>
  92. <result property="inscompany" column="inscompany" jdbcType="VARCHAR"/>
  93. <result property="jqapplyno" column="jqapplyno" jdbcType="VARCHAR"/>
  94. <result property="jqpolicyno" column="jqpolicyno" jdbcType="VARCHAR"/>
  95. <result property="syapplyno" column="syapplyno" jdbcType="VARCHAR"/>
  96. <result property="sypolicyno" column="sypolicyno" jdbcType="VARCHAR"/>
  97. <result property="riskinfo" column="riskinfo" javaType="com.alibaba.fastjson.JSONArray"
  98. typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler" jdbcType="VARCHAR"/>
  99. <result property="kindinfo" column="kindinfo" javaType="com.alibaba.fastjson.JSONArray"
  100. typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler" jdbcType="VARCHAR"/>
  101. <result property="jqpremium" column="jqpremium" jdbcType="DECIMAL"/>
  102. <result property="sypremium" column="sypremium" jdbcType="DECIMAL"/>
  103. <result property="jypremium" column="jypremium" jdbcType="DECIMAL"/>
  104. <result property="taxamount" column="taxamount" jdbcType="DECIMAL"/>
  105. <result property="sumpremium" column="sumpremium" jdbcType="DECIMAL"/>
  106. <result property="jqdiscountrate" column="jqdiscountrate" jdbcType="DOUBLE"/>
  107. <result property="sydiscountrate" column="sydiscountrate" jdbcType="DOUBLE"/>
  108. <result property="feerate" column="feerate" jdbcType="DOUBLE"/>
  109. <result property="disrate" column="disrate" jdbcType="DOUBLE"/>
  110. <result property="auditid" column="auditid" jdbcType="VARCHAR"/>
  111. <result property="auditname" column="auditname" jdbcType="VARCHAR"/>
  112. <result property="audittime" column="audittime" jdbcType="TIMESTAMP"/>
  113. <result property="auditopinion" column="auditopinion" jdbcType="VARCHAR"/>
  114. <result property="jqappoint" column="jqappoint" jdbcType="VARCHAR"/>
  115. <result property="syappoint" column="syappoint" jdbcType="VARCHAR"/>
  116. <result property="createtime" column="createtime" jdbcType="TIMESTAMP"/>
  117. <result property="paymentLink" column="payment_link" jdbcType="VARCHAR"/>
  118. <result property="accidentInfo" column="accident_info" javaType="com.alibaba.fastjson.JSONArray"
  119. typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler" jdbcType="VARCHAR"/>
  120. <result property="taxArrears" column="tax_arrears" javaType="com.alibaba.fastjson.JSONArray"
  121. typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler" jdbcType="VARCHAR"/>
  122. <result property="crossInsurance" column="cross_insurance" javaType="com.alibaba.fastjson.JSONArray"
  123. typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler" jdbcType="VARCHAR"/>
  124. <result property="ubiPredictedInfoScore" column="ubi_predicted_info_score" jdbcType="VARCHAR"/>
  125. <result property="signingTime" column="signingTime" jdbcType="TIMESTAMP"/>
  126. <result property="payDate" column="payDate" jdbcType="TIMESTAMP"/>
  127. <result property="partnerCompaniesName" column="partnerCompaniesName" jdbcType="VARCHAR"/>
  128. </resultMap>
  129. <resultMap id="OrderExcelResultMap" type="com.ydtech.modules.ins.model.InsOrdersExcel">
  130. <id property="orderNo" column="orderno" jdbcType="VARCHAR"/>
  131. <result property="licenseNo" column="licenseno" jdbcType="VARCHAR"/>
  132. <result property="fraMeno" column="frameno" jdbcType="VARCHAR"/>
  133. <result property="carInfo" column="carinfo" javaType="com.alibaba.fastjson.JSONObject" typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler" jdbcType="VARCHAR"/>
  134. <result property="score" column="score" jdbcType="VARCHAR"/>
  135. <result property="ownerInfo" column="ownerinfo" javaType="com.alibaba.fastjson.JSONObject" typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler" jdbcType="VARCHAR"/>
  136. <result property="jqpRemIum" column="jqpremium" jdbcType="VARCHAR"/>
  137. <result property="apiType" column="api_type" jdbcType="VARCHAR"/>
  138. <result property="jqPolicyno" column="jqpolicyno" jdbcType="VARCHAR"/>
  139. <result property="sypRemIum" column="sypremium" jdbcType="VARCHAR"/>
  140. <result property="syPolicyno" column="sypolicyno" jdbcType="VARCHAR"/>
  141. <result property="jypRemIum" column="jypremium" jdbcType="VARCHAR"/>
  142. <result property="taxaMount" column="taxamount" jdbcType="VARCHAR"/>
  143. <result property="jqStartDate" column="jq_start_date" jdbcType="VARCHAR"/>
  144. <result property="jqEndDate" column="jq_end_date" jdbcType="VARCHAR"/>
  145. <result property="syStartDate" column="sy_start_date" jdbcType="VARCHAR"/>
  146. <result property="syEndDate" column="sy_end_date" jdbcType="VARCHAR"/>
  147. <result property="jqScore" column="jq_score" jdbcType="VARCHAR"/>
  148. <result property="syScore" column="sy_score" jdbcType="VARCHAR"/>
  149. <result property="lossRation" column="loss_ration" jdbcType="VARCHAR"/>
  150. <result property="jqLossRation" column="jq_loss_ration" jdbcType="VARCHAR"/>
  151. <result property="syLossRation" column="sy_loss_ration" jdbcType="VARCHAR"/>
  152. <result property="insCompany" column="inscompany" jdbcType="VARCHAR"/>
  153. <result property="agreementId" column="agreement_id" jdbcType="VARCHAR"/>
  154. <result property="userId" column="userid" jdbcType="VARCHAR"/>
  155. <result property="userName" column="username" jdbcType="VARCHAR"/>
  156. <result property="applyInfo" column="applyinfo" javaType="com.alibaba.fastjson.JSONObject"
  157. typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler" jdbcType="VARCHAR"/>
  158. <result property="insureInfo" column="insureinfo" javaType="com.alibaba.fastjson.JSONObject"
  159. typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler" jdbcType="VARCHAR"/>
  160. <result property="kindInfo" column="kindinfo" javaType="com.alibaba.fastjson.JSONArray"
  161. typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler" jdbcType="VARCHAR"/>
  162. <result property="payDate" column="pay_date" jdbcType="VARCHAR"/>
  163. <result property="signingTime" column="signing_time" jdbcType="VARCHAR"/>
  164. <result property="crossInsurance" column="cross_insurance" javaType="com.alibaba.fastjson.JSONArray"
  165. typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler" jdbcType="VARCHAR"/>
  166. </resultMap>
  167. <sql id="Base_Column_List">
  168. orderno,quoteno,orderstatus,
  169. carinfo,userid,username,
  170. deptid,deptname,ownerinfo,
  171. applyinfo,insureinfo,agreeid,
  172. productid,product,createtime,
  173. frameno,licenseno,insuredname,
  174. jqstartdate,jqenddate,systartdate,
  175. syenddate
  176. </sql>
  177. <select id="getOrderAndAreaCompany" parameterType="java.lang.String" resultMap="OrderResultMap">
  178. select o.orderno,
  179. o.quoteno,
  180. o.carinfo,
  181. o.userid,
  182. o.username,
  183. o.deptid,
  184. o.deptname,
  185. o.ownerinfo,
  186. o.applyinfo,
  187. o.insureinfo,
  188. o.agreeid,
  189. o.productid,
  190. o.product,
  191. o.frameno,
  192. o.licenseno,
  193. o.insuredname,
  194. o.vehicle_and_vessel_tax,
  195. o.is_external,
  196. iac.jq_start_date as jqstartdate,
  197. iac.jq_end_date as jqenddate,
  198. iac.sy_start_date as systartdate,
  199. iac.sy_end_date as syenddate,
  200. iac.id,
  201. iac.api_type,
  202. iac.company_id,
  203. iac.reptxt,
  204. iac.orderstatus,
  205. iac.inscompany,
  206. iac.jqapplyno,
  207. iac.jqpolicyno,
  208. iac.syapplyno,
  209. iac.sypolicyno,
  210. iac.riskinfo,
  211. iac.kindinfo,
  212. iac.jqpremium,
  213. iac.sypremium,
  214. iac.jypremium,
  215. iac.taxamount,
  216. iac.sumpremium,
  217. iac.jqdiscountrate,
  218. iac.sydiscountrate,
  219. iac.feerate,
  220. iac.disrate,
  221. iac.auditid,
  222. iac.auditname,
  223. iac.audittime,
  224. iac.auditopinion,
  225. iac.jqappoint,
  226. iac.syappoint,
  227. iac.createtime,
  228. iac.payment_link,
  229. iac.accident_info,
  230. iac.tax_arrears,
  231. iac.cross_insurance,
  232. iac.ubi_predicted_info_score,
  233. iac.signing_time as signingTime,
  234. iac.pay_date as payDate,
  235. eic.namesimple as partnerCompaniesName
  236. from ins_orders as o
  237. join ins_area_company iac on o.orderno = iac.orderno
  238. LEFT JOIN ptl_agreement pa ON pa.id = iac.agreement_id
  239. LEFT JOIN esm_ins_company eic on eic.id = pa.partner_companies_id
  240. where iac.id = #{companyId}
  241. </select>
  242. <select id="getByUseridAndLicenseNo" resultType="com.ydtech.modules.order.entity.InsOrders"
  243. parameterType="com.ydtech.modules.order.entity.vo.VerifyOrdersVo">
  244. select orderno,
  245. quoteno,
  246. orderstatus,
  247. carinfo,
  248. userid,
  249. username,
  250. deptid,
  251. deptname,
  252. ownerinfo,
  253. applyinfo,
  254. insureinfo,
  255. agreeid,
  256. productid,
  257. product,
  258. createtime,
  259. frameno,
  260. licenseno,
  261. insuredname,
  262. jqstartdate,
  263. jqenddate,
  264. systartdate,
  265. syenddate,
  266. risk,
  267. king,
  268. vehicle_and_vessel_tax
  269. from ins_orders
  270. where userid = #{userId, jdbcType=VARCHAR}
  271. and licenseno = #{licenseNo, jdbcType=VARCHAR}
  272. and createtime > DATE_SUB(CURDATE(), INTERVAL 6 MONTH)
  273. </select>
  274. <select id="queryPageOrderCount" resultType="Long">
  275. select
  276. count(1)
  277. from (
  278. select
  279. io.orderno
  280. from
  281. ins_orders io
  282. <!--如果存在 公司查询则进行连表 -->
  283. <if test="orderQueryVo.companyId != null and orderQueryVo.companyId != ''">
  284. left JOIN
  285. ins_area_company iac on iac.orderno = io.orderno
  286. </if>
  287. <where>
  288. <if test="orderQueryVo.orderNo != null and orderQueryVo.orderNo != ''">
  289. and io.orderno = #{orderQueryVo.orderNo}
  290. </if>
  291. <if test="orderQueryVo.deptId != null and orderQueryVo.deptId != ''">
  292. and io.deptid like "${orderQueryVo.deptId}%"
  293. </if>
  294. <if test="orderQueryVo.orderStatus != null and orderQueryVo.orderStatus != ''">
  295. and io.orderstatus = #{orderQueryVo.orderStatus}
  296. </if>
  297. <if test="orderQueryVo.frameNo != null and orderQueryVo.frameNo != ''">
  298. and io.frameno = #{orderQueryVo.frameNo}
  299. </if>
  300. <if test="orderQueryVo.licenseNo != null and orderQueryVo.licenseNo != ''">
  301. and io.licenseno = #{orderQueryVo.licenseNo}
  302. </if>
  303. <if test="orderQueryVo.insuredName != null and orderQueryVo.insuredName != ''">
  304. and io.insuredname = #{orderQueryVo.insuredName}
  305. </if>
  306. <if test="orderQueryVo.startDate != null and orderQueryVo.endDate != null">
  307. and DATE_FORMAT(io.createtime, '%Y-%m-%d') between #{orderQueryVo.startDate} AND #{orderQueryVo.endDate}
  308. </if>
  309. <if test="orderQueryVo.companyId != null and orderQueryVo.companyId != ''">
  310. and iac.company_id = #{orderQueryVo.companyId}
  311. </if>
  312. <!--
  313. <if test="orderQueryVo.userId != null and orderQueryVo.userId != '' and isCdy">
  314. and io.operatorid = #{orderQueryVo.userId}
  315. </if>
  316. -->
  317. <choose>
  318. <when test="isCdy">
  319. <if test="deptId != null and deptId != '' ">
  320. and io.deptid like "${deptId}%"
  321. </if>
  322. </when>
  323. <when test="isDxFlag">
  324. <if test="orderQueryVo.userId != null and orderQueryVo.userId != '' ">
  325. and ( exists ( select id from sys_user where manager_id = #{orderQueryVo.userId}) or io.userid = #{orderQueryVo.userId} )
  326. </if>
  327. </when>
  328. <otherwise>
  329. <if test="orderQueryVo.userId != null and orderQueryVo.userId != '' and !isTeamLeader">
  330. and io.userid = #{orderQueryVo.userId}
  331. </if>
  332. </otherwise>
  333. </choose>
  334. </where>
  335. group by io.orderno
  336. ) as s
  337. </select>
  338. <select id="queryPageOrder" resultMap="BaseResultMap">
  339. select
  340. io.*
  341. from
  342. ins_orders io
  343. <!--如果存在 公司查询则进行连表 -->
  344. <if test="orderQueryVo.companyId != null and orderQueryVo.companyId != ''">
  345. left JOIN
  346. ins_area_company iac on iac.orderno = io.orderno
  347. </if>
  348. <where>
  349. <if test="orderQueryVo.orderNo != null and orderQueryVo.orderNo != ''">
  350. and io.orderno = #{orderQueryVo.orderNo}
  351. </if>
  352. <if test="orderQueryVo.deptId != null and orderQueryVo.deptId != ''">
  353. and io.deptid like "${orderQueryVo.deptId}%"
  354. </if>
  355. <if test="orderQueryVo.orderStatus != null and orderQueryVo.orderStatus != ''">
  356. and io.orderstatus = #{orderQueryVo.orderStatus}
  357. </if>
  358. <if test="orderQueryVo.frameNo != null and orderQueryVo.frameNo != ''">
  359. and io.frameno = #{orderQueryVo.frameNo}
  360. </if>
  361. <if test="orderQueryVo.licenseNo != null and orderQueryVo.licenseNo != ''">
  362. and io.licenseno = #{orderQueryVo.licenseNo}
  363. </if>
  364. <if test="orderQueryVo.insuredName != null and orderQueryVo.insuredName != ''">
  365. and io.insuredname = #{orderQueryVo.insuredName}
  366. </if>
  367. <if test="orderQueryVo.startDate != null and orderQueryVo.endDate != null">
  368. and DATE_FORMAT(io.createtime, '%Y-%m-%d') between #{orderQueryVo.startDate} AND #{orderQueryVo.endDate}
  369. </if>
  370. <if test="orderQueryVo.companyId != null and orderQueryVo.companyId != ''">
  371. and iac.company_id = #{orderQueryVo.companyId}
  372. </if>
  373. <if test="orderQueryVo.product != null and orderQueryVo.product != ''">
  374. and io.product = #{orderQueryVo.product}
  375. </if>
  376. <if test="orderQueryVo.productid != null and orderQueryVo.productid != ''">
  377. and io.productid = #{orderQueryVo.productid}
  378. </if>
  379. <!--
  380. <if test="orderQueryVo.userId != null and orderQueryVo.userId != '' and isCdy">
  381. and io.operatorid = #{orderQueryVo.userId}
  382. </if>
  383. -->
  384. <choose>
  385. <when test="isCdy">
  386. <if test="deptId != null and deptId != '' ">
  387. and io.deptid like "${deptId}%"
  388. </if>
  389. </when>
  390. <when test="isDxFlag">
  391. <if test="orderQueryVo.userId != null and orderQueryVo.userId != '' ">
  392. and ( exists ( select id from sys_user where manager_id = #{orderQueryVo.userId}) or io.userid = #{orderQueryVo.userId} )
  393. </if>
  394. </when>
  395. <otherwise>
  396. <if test="orderQueryVo.userId != null and orderQueryVo.userId != '' and !isTeamLeader">
  397. and io.userid = #{orderQueryVo.userId}
  398. </if>
  399. </otherwise>
  400. </choose>
  401. </where>
  402. group by
  403. orderno
  404. order by io.createtime desc
  405. </select>
  406. <select id="queryOrderList" parameterType="com.ydtech.modules.ins.model.InsOrdersExcelVo" resultMap="OrderExcelResultMap">
  407. select
  408. a.orderno,
  409. a.licenseno,
  410. a.frameno,
  411. a.carinfo,
  412. b.api_type,
  413. b.score,
  414. a.ownerinfo,
  415. b.jqpremium,
  416. b.jqpolicyno,
  417. b.sypremium,
  418. b.sypolicyno,
  419. b.jypremium,
  420. b.taxamount,
  421. b.jq_start_date,
  422. b.jq_end_date,
  423. b.sy_start_date,
  424. b.sy_end_date,
  425. b.score,
  426. b.jq_score,
  427. b.sy_score,
  428. b.loss_ration,
  429. b.jq_loss_ration,
  430. b.sy_loss_ration,
  431. b.score,
  432. b.inscompany,
  433. b.agreement_id,
  434. a.userid,
  435. a.username,
  436. a.applyinfo,
  437. a.insureinfo,
  438. b.kindinfo,
  439. b.pay_date,
  440. b.signing_time,
  441. b.cross_insurance
  442. FROM ins_orders a LEFT JOIN ins_area_company b on a.orderno = b.orderno
  443. WHERE
  444. 1 = 1
  445. <if test="orderstatus != null and orderstatus != '' ">
  446. and b.orderstatus = #{orderstatus}
  447. </if>
  448. <if test="startDate != null ">
  449. and b.signing_time &gt;= #{startDate}
  450. </if>
  451. <if test="endDate != null ">
  452. and b.signing_time &lt;= #{endDate}
  453. </if>
  454. </select>
  455. <resultMap id="PolicyInsuranceReportMap" type="com.ydtech.modules.order.entity.vo.PolicyInsuranceReportResVo">
  456. <result property="insCompany" column="insCompany" jdbcType="VARCHAR"/>
  457. <result property="agreementName" column="agreementName" jdbcType="VARCHAR"/>
  458. <result property="policyNo" column="policyNo" jdbcType="VARCHAR"/>
  459. <result property="quoteDate" column="quoteDate" jdbcType="VARCHAR"/>
  460. <result property="policyStartDate" column="policyStartDate" jdbcType="VARCHAR"/>
  461. <result property="riskName" column="riskName" jdbcType="VARCHAR"/>
  462. <result property="sumPremium" column="sumPremium" jdbcType="DECIMAL"/>
  463. <result property="taxPremium" column="taxPremium" jdbcType="DECIMAL"/>
  464. <result property="taxLaterPremium" column="taxLaterPremium" jdbcType="DECIMAL"/>
  465. <result property="insuranceSubAmount" column="insuranceSubAmount" jdbcType="VARCHAR"/>
  466. <result property="licenseNo" column="licenseNo" jdbcType="VARCHAR"/>
  467. <result property="vehicleUse" column="vehicleUse" jdbcType="VARCHAR"/>
  468. <result property="powerType" column="powerType" jdbcType="VARCHAR"/>
  469. <result property="ciModelClass" column="ciModelClass" jdbcType="VARCHAR"/>
  470. <result property="limitLoad" column="limitLoad" jdbcType="VARCHAR"/>
  471. <result property="appliName" column="appliName" jdbcType="VARCHAR"/>
  472. <result property="insureName" column="insureName" jdbcType="VARCHAR"/>
  473. <result property="deptName" column="deptName" jdbcType="VARCHAR"/>
  474. <result property="userName" column="username" jdbcType="VARCHAR"/>
  475. </resultMap>
  476. <select id="getPolicyInsuranceReport" resultMap="PolicyInsuranceReportMap">
  477. /*交强数据*/
  478. SELECT a.`inscompany` AS insCompany,
  479. (SELECT agreement_name FROM ptl_agreement t WHERE t.`id`= a.`agreement_id`) AS agreementName,
  480. a.`jqpolicyno` AS policyNo,
  481. <if test="policyReqVo.queryFlag=='queryPayDate'.toString()">
  482. a.pay_date AS quoteDate,
  483. </if>
  484. <if test="policyReqVo.queryFlag=='queryPayTime'.toString()">
  485. a.inside_pay_time AS quoteDate,
  486. </if>
  487. a.`jq_start_date` AS policyStartDate,
  488. '交强险' AS riskName,
  489. a.`jqpremium` AS sumPremium,
  490. a.`taxamount` AS taxPremium,
  491. getCarShipLateFee(a.`id`) AS taxLaterPremium,
  492. '交强险 : 200000.00,' AS insuranceSubAmount,
  493. b.`licenseno` AS licenseNo,
  494. getCodeName(REPLACE(JSON_EXTRACT(b.carinfo, '$.vehicleUse'),'"',''),'3') AS vehicleUse,
  495. getCodeName(REPLACE(JSON_EXTRACT(b.carinfo, '$.powertype'),'"',''),'2') AS powerType,
  496. getCodeName(REPLACE(JSON_EXTRACT(b.carinfo, '$.cimodelclass'),'"',''),'4') AS ciModelClass,
  497. REPLACE(JSON_EXTRACT(b.carinfo, '$.limitLoad'),'"','') AS limitLoad,
  498. REPLACE(JSON_EXTRACT(applyinfo, '$.name'),'"','') AS appliName,
  499. REPLACE(JSON_EXTRACT(insureinfo, '$.name'),'"','') AS insureName,
  500. b.`deptname` AS deptName,
  501. b.`username` AS userName
  502. FROM ins_area_company a,ins_orders b WHERE a.`jqpolicyno` IS NOT NULL AND a.`jqpolicyno`!='' AND a.`agreement_id` IS NOT NULL
  503. AND a.`orderno`=b.`orderno`
  504. <if test="policyReqVo.deptId != null and policyReqVo.deptId != ''">
  505. and b.deptid = #{policyReqVo.deptId}
  506. </if>
  507. <if test="policyReqVo.userId != null and policyReqVo.userId != ''">
  508. and b.userid = #{policyReqVo.userId}
  509. </if>
  510. <if test="policyReqVo.userName != null and policyReqVo.userName != ''">
  511. and b.username = #{policyReqVo.userName}
  512. </if>
  513. <if test="policyReqVo.appliName != null and policyReqVo.appliName != ''">
  514. and REPLACE(JSON_EXTRACT(applyinfo, '$.name'),'"','') = #{policyReqVo.appliName}
  515. </if>
  516. <if test="policyReqVo.insureName != null and policyReqVo.insureName != ''">
  517. and REPLACE(JSON_EXTRACT(insureinfo, '$.name'),'"','') = #{policyReqVo.insureName}
  518. </if>
  519. <if test="policyReqVo.productId != null and policyReqVo.productId != ''">
  520. and b.productid = #{policyReqVo.productId}
  521. </if>
  522. <if test="policyReqVo.insCompany != null and policyReqVo.insCompany != ''">
  523. and a.company_id = #{policyReqVo.insCompany}
  524. </if>
  525. <if test="policyReqVo.operatorId != null and policyReqVo.operatorId != ''">
  526. and a.operatorid = #{policyReqVo.operatorId}
  527. </if>
  528. <if test="policyReqVo.quoteStartDate != null and policyReqVo.quoteEndDate != null">
  529. <if test="policyReqVo.queryFlag=='queryPayDate'.toString()">
  530. and a.pay_date between #{policyReqVo.quoteStartDate} AND #{policyReqVo.quoteEndDate}
  531. </if>
  532. <if test="policyReqVo.queryFlag=='queryPayTime'.toString()">
  533. and a.inside_pay_time between #{policyReqVo.quoteStartDate} AND #{policyReqVo.quoteEndDate}
  534. </if>
  535. </if>
  536. <if test="policyReqVo.policyStartDate != null and policyReqVo.policyEndDate != null">
  537. and a.jq_start_date between #{policyReqVo.policyStartDate} AND #{policyReqVo.policyEndDate}
  538. </if>
  539. UNION ALL
  540. /*##商业数据*/
  541. SELECT a.`inscompany` AS insCompany,
  542. (SELECT agreement_name FROM ptl_agreement t WHERE t.`id`= a.`agreement_id`) AS agreementName,
  543. a.`sypolicyno` AS policyNo,
  544. <if test="policyReqVo.queryFlag=='queryPayDate'.toString()">
  545. a.pay_date AS quoteDate,
  546. </if>
  547. <if test="policyReqVo.queryFlag=='queryPayTime'.toString()">
  548. a.inside_pay_time AS quoteDate,
  549. </if>
  550. a.`sy_start_date` AS policyStartDate,
  551. '商业险' AS riskName,
  552. a.`sypremium` AS sumPremium,
  553. '' AS taxPremium,
  554. '' AS taxLaterPremium,
  555. getSyAmount(a.`orderno`) AS insuranceSubAmount,
  556. b.`licenseno` AS licenseNo,
  557. getCodeName(REPLACE(JSON_EXTRACT(b.carinfo, '$.vehicleUse'),'"',''),'3') AS vehicleUse,
  558. getCodeName(REPLACE(JSON_EXTRACT(b.carinfo, '$.powertype'),'"',''),'2') AS powerType,
  559. getCodeName(REPLACE(JSON_EXTRACT(b.carinfo, '$.cimodelclass'),'"',''),'4') AS ciModelClass,
  560. REPLACE(JSON_EXTRACT(b.carinfo, '$.limitLoad'),'"','') AS limitLoad,
  561. REPLACE(JSON_EXTRACT(applyinfo, '$.name'),'"','') AS appliName,
  562. REPLACE(JSON_EXTRACT(insureinfo, '$.name'),'"','') AS insureName,
  563. b.`deptname` AS deptName,
  564. b.`username` AS userName
  565. FROM ins_area_company a,ins_orders b WHERE a.`sypolicyno` IS NOT NULL AND a.`syapplyno`!='' AND a.`agreement_id` IS NOT NULL
  566. AND a.`orderno`=b.`orderno`
  567. <if test="policyReqVo.deptId != null and policyReqVo.deptId != ''">
  568. and b.deptid = #{policyReqVo.deptId}
  569. </if>
  570. <if test="policyReqVo.userId != null and policyReqVo.userId != ''">
  571. and b.userid = #{policyReqVo.userId}
  572. </if>
  573. <if test="policyReqVo.userName != null and policyReqVo.userName != ''">
  574. and b.username = #{policyReqVo.userName}
  575. </if>
  576. <if test="policyReqVo.appliName != null and policyReqVo.appliName != ''">
  577. and REPLACE(JSON_EXTRACT(applyinfo, '$.name'),'"','') = #{policyReqVo.appliName}
  578. </if>
  579. <if test="policyReqVo.insureName != null and policyReqVo.insureName != ''">
  580. and REPLACE(JSON_EXTRACT(insureinfo, '$.name'),'"','') = #{policyReqVo.insureName}
  581. </if>
  582. <if test="policyReqVo.productId != null and policyReqVo.productId != ''">
  583. and b.productid = #{policyReqVo.productId}
  584. </if>
  585. <if test="policyReqVo.insCompany != null and policyReqVo.insCompany != ''">
  586. and a.company_id = #{policyReqVo.insCompany}
  587. </if>
  588. <if test="policyReqVo.operatorId != null and policyReqVo.operatorId != ''">
  589. and a.operatorid = #{policyReqVo.operatorId}
  590. </if>
  591. <if test="policyReqVo.quoteStartDate != null and policyReqVo.quoteEndDate != null">
  592. <if test="policyReqVo.queryFlag=='queryPayDate'.toString()">
  593. and a.pay_date between #{policyReqVo.quoteStartDate} AND #{policyReqVo.quoteEndDate}
  594. </if>
  595. <if test="policyReqVo.queryFlag=='queryPayTime'.toString()">
  596. and a.inside_pay_time between #{policyReqVo.quoteStartDate} AND #{policyReqVo.quoteEndDate}
  597. </if>
  598. </if>
  599. <if test="policyReqVo.policyStartDate != null and policyReqVo.policyEndDate != null">
  600. and a.sy_start_date between #{policyReqVo.policyStartDate} AND #{policyReqVo.policyEndDate}
  601. </if>
  602. </select>
  603. <select id="getPolicyInsuranceReportCount" resultType="Long">
  604. select
  605. count(1)
  606. from (
  607. /*交强数据*/
  608. SELECT a.`inscompany` AS insCompany,
  609. (SELECT agreement_name FROM ptl_agreement t WHERE t.`id`= a.`agreement_id`) AS agreementName,
  610. a.`jqpolicyno` AS policyNo,
  611. <if test="policyReqVo.queryFlag=='queryPayDate'.toString()">
  612. a.pay_date AS quoteDate,
  613. </if>
  614. <if test="policyReqVo.queryFlag=='queryPayTime'.toString()">
  615. a.inside_pay_time AS quoteDate,
  616. </if>
  617. a.`jq_start_date` AS policyStartDate,
  618. '交强险' AS riskName,
  619. a.`jqpremium` AS sumPremium,
  620. a.`taxamount` AS taxPremium,
  621. getCarShipLateFee(a.`id`) AS taxLaterPremium,
  622. '交强险 : 200000.00,' AS insuranceSubAmount,
  623. b.`licenseno` AS licenseNo,
  624. getCodeName(REPLACE(JSON_EXTRACT(b.carinfo, '$.vehicleUse'),'"',''),'3') AS vehicleUse,
  625. getCodeName(REPLACE(JSON_EXTRACT(b.carinfo, '$.powertype'),'"',''),'2') AS powerType,
  626. getCodeName(REPLACE(JSON_EXTRACT(b.carinfo, '$.cimodelclass'),'"',''),'4') AS ciModelClass,
  627. REPLACE(JSON_EXTRACT(b.carinfo, '$.limitLoad'),'"','') AS limitLoad,
  628. REPLACE(JSON_EXTRACT(applyinfo, '$.name'),'"','') AS appliName,
  629. REPLACE(JSON_EXTRACT(insureinfo, '$.name'),'"','') AS insureName,
  630. b.`deptname` AS deptName,
  631. b.`username` AS userName
  632. FROM ins_area_company a,ins_orders b WHERE a.`jqpolicyno` IS NOT NULL AND a.`jqpolicyno`!='' AND a.`agreement_id` IS NOT NULL
  633. AND a.`orderno`=b.`orderno`
  634. <if test="policyReqVo.deptId != null and policyReqVo.deptId != ''">
  635. and b.deptid = #{policyReqVo.deptId}
  636. </if>
  637. <if test="policyReqVo.userId != null and policyReqVo.userId != ''">
  638. and b.userid = #{policyReqVo.userId}
  639. </if>
  640. <if test="policyReqVo.userName != null and policyReqVo.userName != ''">
  641. and b.username = #{policyReqVo.userName}
  642. </if>
  643. <if test="policyReqVo.appliName != null and policyReqVo.appliName != ''">
  644. and REPLACE(JSON_EXTRACT(applyinfo, '$.name'),'"','') = #{policyReqVo.appliName}
  645. </if>
  646. <if test="policyReqVo.insureName != null and policyReqVo.insureName != ''">
  647. and REPLACE(JSON_EXTRACT(insureinfo, '$.name'),'"','') = #{policyReqVo.insureName}
  648. </if>
  649. <if test="policyReqVo.productId != null and policyReqVo.productId != ''">
  650. and b.productid = #{policyReqVo.productId}
  651. </if>
  652. <if test="policyReqVo.insCompany != null and policyReqVo.insCompany != ''">
  653. and a.company_id = #{policyReqVo.insCompany}
  654. </if>
  655. <if test="policyReqVo.operatorId != null and policyReqVo.operatorId != ''">
  656. and a.operatorid = #{policyReqVo.operatorId}
  657. </if>
  658. <if test="policyReqVo.quoteStartDate != null and policyReqVo.quoteEndDate != null">
  659. <if test="policyReqVo.queryFlag=='queryPayDate'.toString()">
  660. and a.pay_date between #{policyReqVo.quoteStartDate} AND #{policyReqVo.quoteEndDate}
  661. </if>
  662. <if test="policyReqVo.queryFlag=='queryPayTime'.toString()">
  663. and a.inside_pay_time between #{policyReqVo.quoteStartDate} AND #{policyReqVo.quoteEndDate}
  664. </if>
  665. </if>
  666. <if test="policyReqVo.policyStartDate != null and policyReqVo.policyEndDate != null">
  667. and a.jq_start_date between #{policyReqVo.policyStartDate} AND #{policyReqVo.policyEndDate}
  668. </if>
  669. UNION ALL
  670. /*##商业数据*/
  671. SELECT a.`inscompany` AS insCompany,
  672. (SELECT agreement_name FROM ptl_agreement t WHERE t.`id`= a.`agreement_id`) AS agreementName,
  673. a.`sypolicyno` AS policyNo,
  674. <if test="policyReqVo.queryFlag=='queryPayDate'.toString()">
  675. a.pay_date AS quoteDate,
  676. </if>
  677. <if test="policyReqVo.queryFlag=='queryPayTime'.toString()">
  678. a.inside_pay_time AS quoteDate,
  679. </if>
  680. a.`sy_start_date` AS policyStartDate,
  681. '商业险' AS riskName,
  682. a.`sypremium` AS sumPremium,
  683. '' AS taxPremium,
  684. '' AS taxLaterPremium,
  685. getSyAmount(a.`orderno`) AS insuranceSubAmount,
  686. b.`licenseno` AS licenseNo,
  687. getCodeName(REPLACE(JSON_EXTRACT(b.carinfo, '$.vehicleUse'),'"',''),'3') AS vehicleUse,
  688. getCodeName(REPLACE(JSON_EXTRACT(b.carinfo, '$.powertype'),'"',''),'2') AS powerType,
  689. getCodeName(REPLACE(JSON_EXTRACT(b.carinfo, '$.cimodelclass'),'"',''),'4') AS ciModelClass,
  690. REPLACE(JSON_EXTRACT(b.carinfo, '$.limitLoad'),'"','') AS limitLoad,
  691. REPLACE(JSON_EXTRACT(applyinfo, '$.name'),'"','') AS appliName,
  692. REPLACE(JSON_EXTRACT(insureinfo, '$.name'),'"','') AS insureName,
  693. b.`deptname` AS deptName,
  694. b.`username` AS userName
  695. FROM ins_area_company a,ins_orders b WHERE a.`sypolicyno` IS NOT NULL AND a.`syapplyno`!='' AND a.`agreement_id` IS NOT NULL
  696. AND a.`orderno`=b.`orderno`
  697. <if test="policyReqVo.deptId != null and policyReqVo.deptId != ''">
  698. and b.deptid = #{policyReqVo.deptId}
  699. </if>
  700. <if test="policyReqVo.userId != null and policyReqVo.userId != ''">
  701. and b.userid = #{policyReqVo.userId}
  702. </if>
  703. <if test="policyReqVo.userName != null and policyReqVo.userName != ''">
  704. and b.username = #{policyReqVo.userName}
  705. </if>
  706. <if test="policyReqVo.appliName != null and policyReqVo.appliName != ''">
  707. and REPLACE(JSON_EXTRACT(applyinfo, '$.name'),'"','') = #{policyReqVo.appliName}
  708. </if>
  709. <if test="policyReqVo.insureName != null and policyReqVo.insureName != ''">
  710. and REPLACE(JSON_EXTRACT(insureinfo, '$.name'),'"','') = #{policyReqVo.insureName}
  711. </if>
  712. <if test="policyReqVo.productId != null and policyReqVo.productId != ''">
  713. and b.productid = #{policyReqVo.productId}
  714. </if>
  715. <if test="policyReqVo.insCompany != null and policyReqVo.insCompany != ''">
  716. and a.company_id = #{policyReqVo.insCompany}
  717. </if>
  718. <if test="policyReqVo.operatorId != null and policyReqVo.operatorId != ''">
  719. and a.operatorid = #{policyReqVo.operatorId}
  720. </if>
  721. <if test="policyReqVo.quoteStartDate != null and policyReqVo.quoteEndDate != null">
  722. <if test="policyReqVo.queryFlag=='queryPayDate'.toString()">
  723. and a.pay_date between #{policyReqVo.quoteStartDate} AND #{policyReqVo.quoteEndDate}
  724. </if>
  725. <if test="policyReqVo.queryFlag=='queryPayTime'.toString()">
  726. and a.inside_pay_time between #{policyReqVo.quoteStartDate} AND #{policyReqVo.quoteEndDate}
  727. </if>
  728. </if>
  729. <if test="policyReqVo.policyStartDate != null and policyReqVo.policyEndDate != null">
  730. and a.sy_start_date between #{policyReqVo.policyStartDate} AND #{policyReqVo.policyEndDate}
  731. </if>
  732. ) as s
  733. </select>
  734. <update id="updateStatus">
  735. update ins_orders set orderstatus = #{status} where orderno = #{orderno}
  736. </update>
  737. <select id="queryPageHospitalityOrder" resultMap="BaseResultMap">
  738. select
  739. io.*,
  740. iac.orderno
  741. <if test="orderQueryVo.orderStatus != null and orderQueryVo.orderStatus == 3">
  742. ,eic.namesimple as partnerCompaniesName
  743. </if>
  744. from
  745. ins_orders io
  746. left JOIN
  747. ins_area_company iac on iac.orderno = io.orderno
  748. LEFT JOIN
  749. ptl_agreement pa on pa.id = iac.agreement_id
  750. <if test="orderQueryVo.orderStatus != null and orderQueryVo.orderStatus == 3">
  751. LEFT JOIN
  752. esm_ins_company eic on eic.id = pa.partner_companies_id
  753. </if>
  754. <where>
  755. <if test="orderQueryVo.orderNo != null and orderQueryVo.orderNo != ''">
  756. and io.orderno = #{orderQueryVo.orderNo}
  757. </if>
  758. <if test="orderQueryVo.deptId != null and orderQueryVo.deptId != '' ">
  759. and io.deptid like "${orderQueryVo.deptId}%"
  760. </if>
  761. <if test="orderQueryVo.orderStatus != null and orderQueryVo.orderStatus != ''">
  762. and io.orderstatus = #{orderQueryVo.orderStatus}
  763. <if test="orderQueryVo.orderStatus != null and orderQueryVo.orderStatus == 3">
  764. and iac.orderstatus = #{orderQueryVo.orderStatus}
  765. </if>
  766. </if>
  767. <if test="orderQueryVo.frameNo != null and orderQueryVo.frameNo != ''">
  768. and io.frameno = #{orderQueryVo.frameNo}
  769. </if>
  770. <if test="orderQueryVo.licenseNo != null and orderQueryVo.licenseNo != ''">
  771. and io.licenseno = #{orderQueryVo.licenseNo}
  772. </if>
  773. <if test="orderQueryVo.insuredName != null and orderQueryVo.insuredName != ''">
  774. and io.insuredname = #{orderQueryVo.insuredName}
  775. </if>
  776. <if test="orderQueryVo.startDate != null and orderQueryVo.endDate != null">
  777. and io.createtime between #{orderQueryVo.startDate} AND #{orderQueryVo.endDate}
  778. </if>
  779. <if test="orderQueryVo.companyId != null and orderQueryVo.companyId != ''">
  780. and iac.company_id = #{orderQueryVo.companyId}
  781. </if>
  782. <if test="orderQueryVo.userId != null and orderQueryVo.userId != ''">
  783. and io.userid = #{orderQueryVo.userId}
  784. </if>
  785. </where>
  786. group by io.orderno
  787. <if test="orderQueryVo.orderStatus != null and orderQueryVo.orderStatus == 3">
  788. ,eic.namesimple
  789. </if>
  790. order by io.createtime desc
  791. </select>
  792. <select id="queryPageHospitalityOrderCount" resultType="Long">
  793. select
  794. count(1)
  795. from (
  796. select
  797. io.orderno
  798. <if test="orderQueryVo.orderStatus != null and orderQueryVo.orderStatus == 3">
  799. ,eic.namesimple as partnerCompaniesName
  800. </if>
  801. from
  802. ins_orders io
  803. left JOIN
  804. ins_area_company iac on iac.orderno = io.orderno
  805. LEFT JOIN
  806. ptl_agreement pa on pa.id = iac.agreement_id
  807. <if test="orderQueryVo.orderStatus != null and orderQueryVo.orderStatus == 3">
  808. LEFT JOIN
  809. esm_ins_company eic on eic.id = pa.partner_companies_id
  810. </if>
  811. <where>
  812. <if test="orderQueryVo.orderNo != null and orderQueryVo.orderNo != ''">
  813. and io.orderno = #{orderQueryVo.orderNo}
  814. </if>
  815. <if test="orderQueryVo.deptId != null and orderQueryVo.deptId != '' ">
  816. and io.deptid like "${orderQueryVo.deptId}%"
  817. </if>
  818. <if test="orderQueryVo.orderStatus != null and orderQueryVo.orderStatus != ''">
  819. and io.orderstatus = #{orderQueryVo.orderStatus}
  820. <if test="orderQueryVo.orderStatus != null and orderQueryVo.orderStatus == 3">
  821. and iac.orderstatus = #{orderQueryVo.orderStatus}
  822. </if>
  823. </if>
  824. <if test="orderQueryVo.frameNo != null and orderQueryVo.frameNo != ''">
  825. and io.frameno = #{orderQueryVo.frameNo}
  826. </if>
  827. <if test="orderQueryVo.licenseNo != null and orderQueryVo.licenseNo != ''">
  828. and io.licenseno = #{orderQueryVo.licenseNo}
  829. </if>
  830. <if test="orderQueryVo.insuredName != null and orderQueryVo.insuredName != ''">
  831. and io.insuredname = #{orderQueryVo.insuredName}
  832. </if>
  833. <if test="orderQueryVo.startDate != null and orderQueryVo.endDate != null">
  834. and io.createtime between #{orderQueryVo.startDate} AND #{orderQueryVo.endDate}
  835. </if>
  836. <if test="orderQueryVo.companyId != null and orderQueryVo.companyId != ''">
  837. and iac.company_id = #{orderQueryVo.companyId}
  838. </if>
  839. <if test="orderQueryVo.userId != null and orderQueryVo.userId != ''">
  840. and io.userid = #{orderQueryVo.userId}
  841. </if>
  842. </where>
  843. group by io.orderno
  844. <if test="orderQueryVo.orderStatus != null and orderQueryVo.orderStatus == 3">
  845. ,eic.namesimple
  846. </if>
  847. order by io.createtime desc
  848. ) as s
  849. </select>
  850. <select id="queryPageOrderByLinkType" resultMap="BaseResultMap">
  851. select
  852. io.orderno as orderno,
  853. io.quoteno as quoteno,
  854. iac.orderstatus as orderstatus,
  855. io.carinfo as carinfo,
  856. io.userid as userid,
  857. io.username as username,
  858. io.deptid as deptid,
  859. io.deptname as deptname,
  860. io.ownerinfo as ownerinfo,
  861. io.applyinfo as applyinfo,
  862. io.insureinfo as insureinfo,
  863. io.agreeid as agreeid,
  864. iac.productid as productid,
  865. iac.product as product,
  866. iac.createtime as createtime,
  867. io.frameno as frameno,
  868. io.licenseno as licenseno,
  869. io.insuredname as insuredname,
  870. iac.jq_start_date as jqstartdate,
  871. iac.jq_end_date as jqenddate,
  872. iac.sy_start_date as systartdate,
  873. iac.sy_end_date as syenddate,
  874. iac.jqpremium as jqpremium,
  875. iac.sypremium as sypremium,
  876. iac.jypremium as jypremium,
  877. iac.taxamount as taxamount,
  878. io.risk as risk,
  879. io.king as king,
  880. io.vehicle_and_vessel_tax as vehicleAndVesselTax,
  881. iac.id as subOrderId,
  882. iac.underwriting_status as underwritingStatus,
  883. iac.company_id as company_id,
  884. iac.inscompany as ins_company,
  885. agree.agreement_code as agreementCode,
  886. agree.agreement_name as agreementName,
  887. company.namesimple as partnerCompaniesName,
  888. iac.api_type,
  889. io.is_external,
  890. u.leader_name,
  891. u.leader_id,
  892. CASE dept.management_source
  893. WHEN '1' THEN '渠道'
  894. WHEN '2' THEN '个代'
  895. WHEN '3' THEN '电销'
  896. ELSE '' END
  897. AS managementSource,
  898. io.entry_status as entryStatus
  899. from
  900. ins_area_company iac
  901. left JOIN
  902. ins_orders io on iac.orderno = io.orderno
  903. left join
  904. ptl_agreement agree on iac.agreement_id= agree.id
  905. left join
  906. esm_ins_company company on agree.partner_companies_id= company.id
  907. LEFT JOIN
  908. sys_dept dept ON dept.id = io.deptid
  909. LEFT JOIN
  910. sys_user u on io.userid = u.id
  911. <where>
  912. <if test="agentUserIds != null and agentUserIds.size>0" >
  913. AND (
  914. (io.userid in
  915. <foreach collection="agentUserIds" item="item" open="(" separator="," close=")">
  916. #{item}
  917. </foreach>
  918. AND ( iac.new_operator_id IS NULL OR iac.new_operator_id = #{orderQueryVo.userId} )
  919. <if test="deptIds != null and deptIds.size>0" >
  920. AND (
  921. <foreach collection="deptIds" item="item" open="(" separator="OR" close=")">
  922. io.deptid like CONCAT('', #{item}, '%')
  923. </foreach>
  924. )
  925. </if>
  926. )
  927. <if test="flag" >
  928. OR iac.operator_id = #{orderQueryVo.userId}
  929. </if>
  930. )
  931. </if>
  932. <if test="agreeIds != null and agreeIds.size>0">
  933. AND (
  934. (iac.agreement_id in
  935. <foreach collection="agreeIds" item="item" open="(" separator="," close=")">
  936. #{item}
  937. </foreach>
  938. AND ( iac.new_operator_id IS NULL OR iac.new_operator_id = #{orderQueryVo.userId} ) )
  939. <if test="flag" >
  940. OR iac.operator_id = #{orderQueryVo.userId}
  941. </if>
  942. )
  943. </if>
  944. <if test="orderQueryVo.orderNo != null and orderQueryVo.orderNo != ''">
  945. and iac.id = #{orderQueryVo.orderNo}
  946. </if>
  947. <if test="orderQueryVo.managementSource != null and orderQueryVo.managementSource != ''">
  948. and dept.management_source = #{orderQueryVo.managementSource}
  949. </if>
  950. <if test="orderQueryVo.deptId != null and orderQueryVo.deptId != ''">
  951. and io.deptid like "${orderQueryVo.deptId}%"
  952. </if>
  953. <if test="orderQueryVo.orderStatus != null and orderQueryVo.orderStatus != ''">
  954. and iac.orderstatus= #{orderQueryVo.orderStatus}
  955. </if>
  956. <if test="orderQueryVo.frameNo != null and orderQueryVo.frameNo != ''">
  957. and io.frameno = #{orderQueryVo.frameNo}
  958. </if>
  959. <if test="orderQueryVo.licenseNo != null and orderQueryVo.licenseNo != ''">
  960. and io.licenseno = #{orderQueryVo.licenseNo}
  961. </if>
  962. <if test="orderQueryVo.insuredName != null and orderQueryVo.insuredName != ''">
  963. and io.insuredname = #{orderQueryVo.insuredName}
  964. </if>
  965. <if test="orderQueryVo.quoteStartDateStr != null and orderQueryVo.quoteEndDateStr != null">
  966. and DATE_FORMAT(iac.createtime, '%Y-%m-%d') between #{orderQueryVo.quoteStartDateStr} AND #{orderQueryVo.quoteEndDateStr}
  967. </if>
  968. <if test="orderQueryVo.companyId != null and orderQueryVo.companyId != ''">
  969. and iac.company_id = #{orderQueryVo.companyId}
  970. </if>
  971. <if test="orderQueryVo.operatorId != null and orderQueryVo.operatorId != ''">
  972. and io.userid = #{orderQueryVo.operatorId}
  973. </if>
  974. <if test="orderQueryVo.operatorName != null and orderQueryVo.operatorName != ''">
  975. and io.username = #{orderQueryVo.operatorName}
  976. </if>
  977. <if test="orderQueryVo.engineNo != null and orderQueryVo.engineNo != ''">
  978. and JSON_EXTRACT( io.carinfo, '$.engineNo' ) = #{orderQueryVo.engineNo}
  979. </if>
  980. <if test="orderQueryVo.provinceId != null and orderQueryVo.provinceId != ''">
  981. and io.deptid like "${orderQueryVo.provinceId}%"
  982. </if>
  983. <if test="orderQueryVo.cityId != null and orderQueryVo.cityId != ''">
  984. and io.deptid like "${orderQueryVo.cityId}%"
  985. </if>
  986. <if test="orderQueryVo.countyId != null and orderQueryVo.countyId != ''">
  987. and io.deptid like "${orderQueryVo.countyId}%"
  988. </if>
  989. <if test="orderQueryVo.houseId != null and orderQueryVo.houseId != ''">
  990. and io.deptid like "${orderQueryVo.houseId}%"
  991. </if>
  992. <if test="orderQueryVo.agreeId != null and orderQueryVo.agreeId != ''">
  993. and iac.agreement_id = #{orderQueryVo.agreeId}
  994. </if>
  995. <if test="orderQueryVo.taskNo != null and orderQueryVo.taskNo != ''">
  996. and io.orderno = #{orderQueryVo.taskNo}
  997. </if>
  998. <if test="orderQueryVo.riskCode != null and orderQueryVo.riskCode != ''">
  999. and iac.product = #{orderQueryVo.riskCode}
  1000. </if>
  1001. <if test="orderQueryVo.auditId != null and orderQueryVo.auditId != ''">
  1002. and IFNULL( iac.new_operator_id, '' ) = #{orderQueryVo.auditId}
  1003. </if>
  1004. <if test="orderQueryVo.leaderId != null and orderQueryVo.leaderId != ''">
  1005. and u.leader_id = #{orderQueryVo.leaderId}
  1006. </if>
  1007. <if test="orderQueryVo.leaderName != null and orderQueryVo.leaderName != ''">
  1008. and u.leader_name = #{orderQueryVo.leaderName}
  1009. </if>
  1010. <if test="orderQueryVo.attachStartDateStr != null and orderQueryVo.attachEndDateStr != ''">
  1011. and ((
  1012. DATE_FORMAT(iac.jq_start_date, '%Y-%m-%d') BETWEEN #{orderQueryVo.attachStartDateStr}
  1013. AND #{orderQueryVo.attachEndDateStr}
  1014. )
  1015. OR ( DATE_FORMAT(iac.sy_start_date, '%Y-%m-%d') BETWEEN #{orderQueryVo.attachStartDateStr} AND #{orderQueryVo.attachEndDateStr} )
  1016. )
  1017. </if>
  1018. <choose>
  1019. <when test="type==1">
  1020. and dept.management_source=1
  1021. </when>
  1022. <when test="type==2">
  1023. and dept.management_source=2
  1024. </when>
  1025. </choose>
  1026. <if test="orderQueryVo.signStartDateStr != null and orderQueryVo.signEndDateStr != null">
  1027. and DATE_FORMAT(iac.signing_time, '%Y-%m-%d') between #{orderQueryVo.signStartDateStr} AND #{orderQueryVo.signEndDateStr}
  1028. </if>
  1029. <if test="orderQueryVo.entryStatus != null and orderQueryVo.entryStatus != ''">
  1030. and io.entry_status = #{orderQueryVo.entryStatus }
  1031. </if>
  1032. </where>
  1033. order by io.createtime desc
  1034. </select>
  1035. <select id="queryPageOrderByLinkTypeCount" resultType="Long">
  1036. select
  1037. count(1)
  1038. from (
  1039. select
  1040. (0)
  1041. from
  1042. ins_area_company iac
  1043. left JOIN
  1044. ins_orders io on iac.orderno = io.orderno
  1045. LEFT JOIN
  1046. sys_dept dept ON dept.id = io.deptid
  1047. LEFT JOIN
  1048. sys_user u on io.userid = u.id
  1049. <where>
  1050. <if test="agentUserIds != null and agentUserIds.size>0" >
  1051. AND (
  1052. (io.userid in
  1053. <foreach collection="agentUserIds" item="item" open="(" separator="," close=")">
  1054. #{item}
  1055. </foreach>
  1056. AND ( iac.new_operator_id IS NULL OR iac.new_operator_id = #{orderQueryVo.userId} )
  1057. <if test="deptIds != null and deptIds.size>0" >
  1058. AND (
  1059. <foreach collection="deptIds" item="item" open="(" separator="OR" close=")">
  1060. io.deptid like CONCAT('', #{item}, '%')
  1061. </foreach>
  1062. )
  1063. </if>
  1064. )
  1065. <if test="flag" >
  1066. OR iac.operator_id = #{orderQueryVo.userId}
  1067. </if>
  1068. )
  1069. </if>
  1070. <if test="agreeIds != null and agreeIds.size>0">
  1071. AND (
  1072. (iac.agreement_id in
  1073. <foreach collection="agreeIds" item="item" open="(" separator="," close=")">
  1074. #{item}
  1075. </foreach>
  1076. AND ( iac.new_operator_id IS NULL OR iac.new_operator_id = #{orderQueryVo.userId} ) )
  1077. <if test="flag" >
  1078. OR iac.operator_id = #{orderQueryVo.userId}
  1079. </if>
  1080. )
  1081. </if>
  1082. <if test="orderQueryVo.orderNo != null and orderQueryVo.orderNo != ''">
  1083. and iac.id = #{orderQueryVo.orderNo}
  1084. </if>
  1085. <if test="orderQueryVo.managementSource != null and orderQueryVo.managementSource != ''">
  1086. and dept.management_source = #{orderQueryVo.managementSource}
  1087. </if>
  1088. <if test="orderQueryVo.deptId != null and orderQueryVo.deptId != ''">
  1089. and io.deptid like "${orderQueryVo.deptId}%"
  1090. </if>
  1091. <if test="orderQueryVo.orderStatus != null and orderQueryVo.orderStatus != ''">
  1092. and iac.orderstatus= #{orderQueryVo.orderStatus}
  1093. </if>
  1094. <if test="orderQueryVo.frameNo != null and orderQueryVo.frameNo != ''">
  1095. and io.frameno = #{orderQueryVo.frameNo}
  1096. </if>
  1097. <if test="orderQueryVo.licenseNo != null and orderQueryVo.licenseNo != ''">
  1098. and io.licenseno = #{orderQueryVo.licenseNo}
  1099. </if>
  1100. <if test="orderQueryVo.insuredName != null and orderQueryVo.insuredName != ''">
  1101. and io.insuredname = #{orderQueryVo.insuredName}
  1102. </if>
  1103. <if test="orderQueryVo.quoteStartDateStr != null and orderQueryVo.quoteEndDateStr != null">
  1104. and DATE_FORMAT(iac.createtime, '%Y-%m-%d') between #{orderQueryVo.quoteStartDateStr} AND #{orderQueryVo.quoteEndDateStr}
  1105. </if>
  1106. <if test="orderQueryVo.companyId != null and orderQueryVo.companyId != ''">
  1107. and iac.company_id = #{orderQueryVo.companyId}
  1108. </if>
  1109. <if test="orderQueryVo.operatorId != null and orderQueryVo.operatorId != ''">
  1110. and io.userid = #{orderQueryVo.operatorId}
  1111. </if>
  1112. <if test="orderQueryVo.operatorName != null and orderQueryVo.operatorName != ''">
  1113. and io.username = #{orderQueryVo.operatorName}
  1114. </if>
  1115. <if test="orderQueryVo.engineNo != null and orderQueryVo.engineNo != ''">
  1116. and JSON_EXTRACT( io.carinfo, '$.engineNo' ) = #{orderQueryVo.engineNo}
  1117. </if>
  1118. <if test="orderQueryVo.provinceId != null and orderQueryVo.provinceId != ''">
  1119. and io.deptid like "${orderQueryVo.provinceId}%"
  1120. </if>
  1121. <if test="orderQueryVo.cityId != null and orderQueryVo.cityId != ''">
  1122. and io.deptid like "${orderQueryVo.cityId}%"
  1123. </if>
  1124. <if test="orderQueryVo.countyId != null and orderQueryVo.countyId != ''">
  1125. and io.deptid like "${orderQueryVo.countyId}%"
  1126. </if>
  1127. <if test="orderQueryVo.houseId != null and orderQueryVo.houseId != ''">
  1128. and io.deptid like "${orderQueryVo.houseId}%"
  1129. </if>
  1130. <if test="orderQueryVo.agreeId != null and orderQueryVo.agreeId != ''">
  1131. and iac.agreement_id = #{orderQueryVo.agreeId}
  1132. </if>
  1133. <if test="orderQueryVo.taskNo != null and orderQueryVo.taskNo != ''">
  1134. and io.orderno = #{orderQueryVo.taskNo}
  1135. </if>
  1136. <if test="orderQueryVo.riskCode != null and orderQueryVo.riskCode != ''">
  1137. and iac.product = #{orderQueryVo.riskCode}
  1138. </if>
  1139. <if test="orderQueryVo.auditId != null and orderQueryVo.auditId != ''">
  1140. and IFNULL( iac.new_operator_id, '' ) = #{orderQueryVo.auditId}
  1141. </if>
  1142. <if test="orderQueryVo.leaderId != null and orderQueryVo.leaderId != ''">
  1143. and u.leader_id = #{orderQueryVo.leaderId}
  1144. </if>
  1145. <if test="orderQueryVo.leaderName != null and orderQueryVo.leaderName != ''">
  1146. and u.leader_name = #{orderQueryVo.leaderName}
  1147. </if>
  1148. <if test="orderQueryVo.attachStartDateStr != null and orderQueryVo.attachEndDateStr != ''">
  1149. and ((
  1150. DATE_FORMAT(iac.jq_start_date, '%Y-%m-%d') BETWEEN #{orderQueryVo.attachStartDateStr}
  1151. AND #{orderQueryVo.attachEndDateStr}
  1152. )
  1153. OR ( DATE_FORMAT(iac.sy_start_date, '%Y-%m-%d') BETWEEN #{orderQueryVo.attachStartDateStr} AND #{orderQueryVo.attachEndDateStr} )
  1154. )
  1155. </if>
  1156. <choose>
  1157. <when test="type==1">
  1158. and dept.management_source=1
  1159. </when>
  1160. <when test="type==2">
  1161. and dept.management_source=2
  1162. </when>
  1163. </choose>
  1164. <if test="orderQueryVo.signStartDateStr != null and orderQueryVo.signEndDateStr != null">
  1165. and DATE_FORMAT(iac.signing_time, '%Y-%m-%d') between #{orderQueryVo.signStartDateStr} AND #{orderQueryVo.signEndDateStr}
  1166. </if>
  1167. <if test="orderQueryVo.entryStatus != null and orderQueryVo.entryStatus != ''">
  1168. and io.entry_status = #{orderQueryVo.entryStatus }
  1169. </if>
  1170. </where>
  1171. ) as s
  1172. </select>
  1173. <select id="queryPageSubOrders" resultMap="BaseResultMap">
  1174. select
  1175. io.*,
  1176. iac.id as subOrderId
  1177. from
  1178. ins_area_company iac
  1179. left JOIN
  1180. ins_orders io on iac.orderno = io.orderno
  1181. <where>
  1182. <if test="orderQueryVo.userId != null and orderQueryVo.userId != ''">
  1183. and io.userid = #{orderQueryVo.userid}
  1184. </if>
  1185. <if test="orderQueryVo.orderNo != null and orderQueryVo.orderNo != ''">
  1186. and io.orderno = #{orderQueryVo.orderNo}
  1187. </if>
  1188. <if test="orderQueryVo.quoteNo != null and orderQueryVo.quoteNo != ''">
  1189. and io.quoteno = #{orderQueryVo.quoteNo}
  1190. </if>
  1191. <if test="orderQueryVo.deptId != null and orderQueryVo.deptId != ''">
  1192. and io.deptid like "${orderQueryVo.deptId}%"
  1193. </if>
  1194. <if test="orderQueryVo.orderStatus != null and orderQueryVo.orderStatus != ''">
  1195. and iac.orderstatus = #{orderQueryVo.orderStatus}
  1196. </if>
  1197. <if test="orderQueryVo.frameNo != null and orderQueryVo.frameNo != ''">
  1198. and io.frameno = #{orderQueryVo.frameNo}
  1199. </if>
  1200. <if test="orderQueryVo.licenseNo != null and orderQueryVo.licenseNo != ''">
  1201. and io.licenseno = #{orderQueryVo.licenseNo}
  1202. </if>
  1203. <if test="orderQueryVo.engineNo != null and orderQueryVo.engineNo != ''">
  1204. and JSON_EXTRACT( io.carinfo, '$.engineNo' ) = #{orderQueryVo.engineNo}
  1205. </if>
  1206. <if test="orderQueryVo.insuredName != null and orderQueryVo.insuredName != ''">
  1207. and io.insuredname = #{orderQueryVo.insuredName}
  1208. </if>
  1209. <if test="orderQueryVo.startDate != null and orderQueryVo.endDate != null">
  1210. and io.createtime between #{orderQueryVo.startDate} AND #{orderQueryVo.endDate}
  1211. </if>
  1212. <if test="orderQueryVo.companyId != null and orderQueryVo.companyId != ''">
  1213. and iac.company_id = #{orderQueryVo.companyId}
  1214. </if>
  1215. <if test="orderQueryVo.riskCode != null and orderQueryVo.riskCode != ''">
  1216. and iac.product = #{orderQueryVo.riskCode}
  1217. </if>
  1218. <if test="orderQueryVo.auditId != null and orderQueryVo.auditId != ''">
  1219. and IFNULL( io.agreeid, '' ) = #{orderQueryVo.auditId}
  1220. </if>
  1221. <if test="orderQueryVo.policyStartDate != null and orderQueryVo.policyEndDate != ''">
  1222. and ((
  1223. io.jqstartdate BETWEEN #{orderQueryVo.policyStartDate}
  1224. AND #{orderQueryVo.policyEndDate}
  1225. )
  1226. OR ( io.systartdate BETWEEN #{orderQueryVo.policyStartDate} AND #{orderQueryVo.policyEndDate} )
  1227. )
  1228. </if>
  1229. </where>
  1230. group by iac.id
  1231. order by io.createtime desc
  1232. </select>
  1233. <select id="queryPageSubOrdersCount" resultType="Long">
  1234. select
  1235. count(1)
  1236. from (
  1237. select
  1238. io.*
  1239. from
  1240. ins_area_company iac
  1241. left JOIN
  1242. ins_orders io on iac.orderno = io.orderno
  1243. <where>
  1244. <if test="orderQueryVo.userId != null and orderQueryVo.userId != ''">
  1245. and io.userid = #{orderQueryVo.userid}
  1246. </if>
  1247. <if test="orderQueryVo.orderNo != null and orderQueryVo.orderNo != ''">
  1248. and io.orderno = #{orderQueryVo.orderNo}
  1249. </if>
  1250. <if test="orderQueryVo.quoteNo != null and orderQueryVo.quoteNo != ''">
  1251. and io.quoteno = #{orderQueryVo.quoteNo}
  1252. </if>
  1253. <if test="orderQueryVo.deptId != null and orderQueryVo.deptId != ''">
  1254. and io.deptid like "${orderQueryVo.deptId}%"
  1255. </if>
  1256. <if test="orderQueryVo.orderStatus != null and orderQueryVo.orderStatus != ''">
  1257. and iac.orderstatus = #{orderQueryVo.orderStatus}
  1258. </if>
  1259. <if test="orderQueryVo.frameNo != null and orderQueryVo.frameNo != ''">
  1260. and io.frameno = #{orderQueryVo.frameNo}
  1261. </if>
  1262. <if test="orderQueryVo.licenseNo != null and orderQueryVo.licenseNo != ''">
  1263. and io.licenseno = #{orderQueryVo.licenseNo}
  1264. </if>
  1265. <if test="orderQueryVo.engineNo != null and orderQueryVo.engineNo != ''">
  1266. and JSON_EXTRACT( io.carinfo, '$.engineNo' ) = #{orderQueryVo.engineNo}
  1267. </if>
  1268. <if test="orderQueryVo.insuredName != null and orderQueryVo.insuredName != ''">
  1269. and io.insuredname = #{orderQueryVo.insuredName}
  1270. </if>
  1271. <if test="orderQueryVo.startDate != null and orderQueryVo.endDate != null">
  1272. and io.createtime between #{orderQueryVo.startDate} AND #{orderQueryVo.endDate}
  1273. </if>
  1274. <if test="orderQueryVo.companyId != null and orderQueryVo.companyId != ''">
  1275. and iac.company_id = #{orderQueryVo.companyId}
  1276. </if>
  1277. <if test="orderQueryVo.riskCode != null and orderQueryVo.riskCode != ''">
  1278. and iac.product = #{orderQueryVo.riskCode}
  1279. </if>
  1280. <if test="orderQueryVo.auditId != null and orderQueryVo.auditId != ''">
  1281. and IFNULL( io.agreeid, '' ) = #{orderQueryVo.auditId}
  1282. </if>
  1283. <if test="orderQueryVo.policyStartDate != null and orderQueryVo.policyEndDate != ''">
  1284. and ((
  1285. io.jqstartdate BETWEEN #{orderQueryVo.policyStartDate}
  1286. AND #{orderQueryVo.policyEndDate}
  1287. )
  1288. OR ( io.systartdate BETWEEN #{orderQueryVo.policyStartDate} AND #{orderQueryVo.policyEndDate} )
  1289. )
  1290. </if>
  1291. </where>
  1292. group by iac.id
  1293. ) as s
  1294. </select>
  1295. <select id="selectEntityByinsOrderNo" resultMap="OrderResultMap">
  1296. select o.orderno,
  1297. o.quoteno,
  1298. o.frameno,
  1299. o.licenseno,
  1300. iac.jq_start_date as jqstartdate,
  1301. iac.jq_end_date as jqenddate,
  1302. iac.sy_start_date as systartdate,
  1303. iac.sy_end_date as syenddate,
  1304. iac.id,
  1305. iac.company_id,
  1306. iac.reptxt,
  1307. iac.orderstatus,
  1308. iac.inscompany,
  1309. iac.jqapplyno,
  1310. iac.jqpolicyno,
  1311. iac.syapplyno,
  1312. iac.sypolicyno,
  1313. iac.riskinfo,
  1314. iac.kindinfo,
  1315. iac.jqpremium,
  1316. iac.sypremium,
  1317. iac.jypremium,
  1318. iac.taxamount,
  1319. iac.sumpremium,
  1320. iac.jqdiscountrate,
  1321. iac.sydiscountrate,
  1322. iac.feerate,
  1323. iac.disrate,
  1324. iac.auditid,
  1325. iac.auditname,
  1326. iac.audittime,
  1327. iac.auditopinion,
  1328. iac.jqappoint,
  1329. iac.syappoint,
  1330. iac.createtime,
  1331. iac.payment_link,
  1332. iac.accident_info,
  1333. iac.tax_arrears,
  1334. iac.cross_insurance,
  1335. iac.ubi_predicted_info_score
  1336. from ins_area_company iac
  1337. join ins_orders as o on o.orderno = iac.orderno
  1338. where
  1339. iac.id = #{insOrderNo}
  1340. <if test="timeFiltering != null and timeFiltering != ''">
  1341. and DATE_FORMAT(iac.signing_time, '%Y-%m') = #{timeFiltering}
  1342. </if>
  1343. </select>
  1344. <select id="getExpirationInsureCount" resultType="Integer">
  1345. SELECT
  1346. count( b.orderno ) AS count
  1347. FROM
  1348. ins_orders a
  1349. left join
  1350. ins_area_company b
  1351. on a.orderno = b.orderno
  1352. WHERE
  1353. <if test="isJq == 1">
  1354. jqenddate BETWEEN #{startDate} AND #{endDate}
  1355. </if>
  1356. <if test="isJq == 2">
  1357. syenddate BETWEEN #{startDate} AND #{endDate}
  1358. </if>
  1359. AND a.orderstatus = 3
  1360. AND b.orderstatus = 3
  1361. <if test="param != null and param != ''">
  1362. AND (a.licenseno = #{param} or a.ins_company = #{param})
  1363. </if>
  1364. <if test="userId != null and userId != ''">
  1365. AND a.userid = #{userId}
  1366. </if>
  1367. </select>
  1368. <select id="getExpirationInsure" resultType="com.ydtech.modules.order.entity.vo.OrderExpirationVo">
  1369. SELECT
  1370. a.ins_company,
  1371. b.id as orderno,
  1372. b.jq_end_date,
  1373. b.sy_end_date,
  1374. b.productid,
  1375. b.product,
  1376. a.licenseno,
  1377. case when b.jq_end_date is not null then DATEDIFF( b.jq_end_date,NOW() ) else null end AS jqDiff,
  1378. case when b.sy_end_date is not null then DATEDIFF( b.sy_end_date,NOW() ) else null end AS syDiff
  1379. FROM ins_orders a,ins_area_company b
  1380. WHERE a.orderno = b.orderno
  1381. AND (b.jq_end_date BETWEEN #{order.jqStartDate} AND #{order.jqEndDate} or b.sy_end_date BETWEEN #{order.syStartDate} AND #{order.syEndDate})
  1382. AND b.orderstatus = 3
  1383. <if test="order.param != null and order.param != ''">
  1384. AND (a.licenseno = #{order.param} or a.ins_company = #{order.param})
  1385. </if>
  1386. <if test="order.userid != null and order.userid != ''">
  1387. AND a.userid = #{order.userid}
  1388. </if>
  1389. ORDER BY least(IFNULL(jqDiff, 9999999) , IFNULL(syDiff, 9999999)) asc
  1390. </select>
  1391. <select id="getCarBusinessDetailList" resultType="com.ydtech.modules.order.entity.vo.CarBusinessDetailVo">
  1392. SELECT
  1393. io.username,
  1394. iac.signing_time as sign_date,
  1395. io.licenseno,
  1396. JSON_UNQUOTE(json_extract(io.applyinfo, '$.name')) as applyname,
  1397. io.product,
  1398. io.ins_company as inscompany,
  1399. iac.jqpremium,
  1400. iac.sypremium,
  1401. iac.jypremium,
  1402. iac.taxamount,
  1403. ifo.jq_costs_export_proportion+ifo.jq_export_other_costs_proportion as jq_export_proportion,
  1404. ifo.sy_costs_export_proportion+ifo.sy_export_other_costs_proportion as sy_export_proportion,
  1405. ifo.no_costs_export_proportion+ifo.no_export_other_costs_proportion as no_export_proportion,
  1406. ifo.jq_export_supervise_costs_premiums + ifo.sy_export_supervise_costs_premiums + ifo.no_export_supervise_costs_premiums + ifo.jq_export_other_costs_premiums + ifo.sy_export_other_costs_premiums + ifo.no_export_other_costs_premiums as settlement,
  1407. CASE ifa.auditstatus
  1408. WHEN 1 THEN
  1409. '已审核'
  1410. ELSE
  1411. '未审核'
  1412. END as audittype,
  1413. ifa.audittime as audit_date
  1414. FROM
  1415. ins_orders io
  1416. LEFT JOIN ins_area_company iac ON io.orderno = iac.orderno
  1417. LEFT JOIN ins_fee_order_new ifo ON iac.id = ifo.ins_order_no
  1418. left join ins_fee_audit ifa on ifo.ins_order_no = ifa.ins_order_no
  1419. WHERE
  1420. io.userid = #{userId}
  1421. AND io.orderstatus = 3
  1422. AND iac.orderstatus = 3
  1423. AND iac.signing_time BETWEEN #{param.signStartDate} and #{param.signEndDate}
  1424. </select>
  1425. <select id="getRevenueExpenditureDetailList" resultType="com.ydtech.modules.order.entity.vo.RevenueExpenditureDetailVo">
  1426. SELECT
  1427. sua.create_time,
  1428. io.licenseno,
  1429. sua.amount,
  1430. sua.business_eegments_type,
  1431. sua.documentary,
  1432. sua.property
  1433. FROM
  1434. sys_user_account_history sua
  1435. left join ins_area_company iac on sua.suborder = iac.id
  1436. left join ins_orders io on iac.orderno = io.orderno
  1437. WHERE
  1438. (sua.property != 1 and sua.property != 2)
  1439. AND
  1440. user_id = #{userId}
  1441. AND
  1442. sua.create_time BETWEEN #{param.signStartDate} and #{param.signEndDate}
  1443. </select>
  1444. <select id="getAuditExportList" resultType="com.ydtech.modules.order.entity.vo.AuditExportVo">
  1445. SELECT
  1446. iac.company_id,
  1447. iac.api_type,
  1448. iac.cross_insurance,
  1449. io.username,
  1450. iac.signing_time,
  1451. io.licenseno,
  1452. JSON_UNQUOTE(json_extract(io.applyinfo, '$.name')) as applyname,
  1453. io.ins_company,
  1454. io.product,
  1455. eic.namesimple,
  1456. iac.jqapplyno,
  1457. iac.syapplyno,
  1458. iac.cross_insurance,
  1459. iac.jqpremium,
  1460. iac.sypremium,
  1461. iac.jypremium,
  1462. iac.taxamount,
  1463. ifo.jq_costs_export_proportion + ifo.jq_export_other_costs_proportion AS jq_export_proportion,
  1464. ifo.sy_costs_export_proportion+ifo.sy_export_other_costs_proportion as sy_export_proportion,
  1465. ifo.no_costs_export_proportion+ifo.no_export_other_costs_proportion as no_export_proportion,
  1466. ifo.jq_export_supervise_costs_premiums + ifo.sy_export_supervise_costs_premiums + ifo.no_export_supervise_costs_premiums + ifo.jq_export_other_costs_premiums + ifo.sy_export_other_costs_premiums + ifo.no_export_other_costs_premiums as settlement,
  1467. ifo.jq_supervise_costs_proportion + ifo.jq_other_costs_proportion as jq_entrance_proportion,
  1468. ifo.sy_supervise_costs_proportion + ifo.sy_other_costs_proportion as sy_entrance_proportion,
  1469. ifo.no_supervise_costs_proportion + ifo.no_other_costs_proportion as no_entrance_proportion,
  1470. ifo.jq_supervise_costs_premiums + ifo.jq_other_costs_premiums + ifo.sy_supervise_costs_premiums + ifo.sy_other_costs_premiums + ifo.no_supervise_costs_premiums + ifo.no_other_costs_premiums as receivable,
  1471. ifo.jq_dept_premiums_level_1 + ifo.sy_dept_premiums_level_1 + ifo.no_dept_premiums_level_1 as dept_premiums_level_1,
  1472. ifo.jq_dept_premiums_level_2 + ifo.sy_dept_premiums_level_2 + ifo.no_dept_premiums_level_2 as dept_premiums_level_2,
  1473. ifo.jq_dept_premiums_level_3 + ifo.sy_dept_premiums_level_3 + ifo.no_dept_premiums_level_3 as dept_premiums_level_3,
  1474. ifo.jq_dept_premiums_level_4 + ifo.sy_dept_premiums_level_4 + ifo.no_dept_premiums_level_4 as dept_premiums_level_4,
  1475. ifo.jq_dept_premiums_level_5 + ifo.sy_dept_premiums_level_5 + ifo.no_dept_premiums_level_5 as dept_premiums_level_5,
  1476. ifo.first_detail_premiums,
  1477. ifo.second_detail_premiums,
  1478. ifo.third_detail_premiums,
  1479. ifo.jq_profit_margin_premiums,
  1480. ifo.sy_profit_margin_premiums,
  1481. ifo.no_profit_margin_premiums,
  1482. io.is_external
  1483. FROM
  1484. ins_fee_order_new ifo
  1485. LEFT JOIN ins_fee_audit ifa ON ifo.ins_order_no = ifa.ins_order_no
  1486. left join ins_area_company iac on ifa.ins_order_no = iac.id
  1487. left join ins_orders io on iac.orderno = io.orderno
  1488. left join ptl_agreement pa on iac.agreement_id = pa.id
  1489. left join esm_ins_company eic on pa.partner_companies_id = eic.id
  1490. WHERE
  1491. iac.signing_time between #{param.signStartDate} and #{param.signEndDate}
  1492. <if test="param.audit != null and param.audit != ''">
  1493. AND
  1494. ifa.auditstatus = #{param.audit}
  1495. AND
  1496. iac.orderstatus = 3
  1497. GROUP BY
  1498. io.orderno,
  1499. iac.api_type,
  1500. iac.cross_insurance,
  1501. iac.signing_time,
  1502. eic.namesimple,
  1503. iac.jqapplyno,
  1504. iac.syapplyno,
  1505. iac.jqpremium,
  1506. iac.company_id,
  1507. iac.sypremium,
  1508. iac.jypremium,
  1509. iac.taxamount,
  1510. ifo.jq_costs_export_proportion,
  1511. ifo.jq_export_other_costs_proportion,
  1512. ifo.sy_costs_export_proportion,
  1513. ifo.sy_export_other_costs_proportion,
  1514. ifo.no_costs_export_proportion,
  1515. ifo.no_export_other_costs_proportion,
  1516. ifo.jq_export_supervise_costs_premiums,
  1517. ifo.sy_export_supervise_costs_premiums,
  1518. ifo.no_export_supervise_costs_premiums,
  1519. ifo.jq_export_other_costs_premiums,
  1520. ifo.sy_export_other_costs_premiums,
  1521. ifo.no_export_other_costs_premiums,
  1522. ifo.jq_supervise_costs_proportion,
  1523. ifo.jq_other_costs_proportion,
  1524. ifo.sy_supervise_costs_proportion,
  1525. ifo.sy_other_costs_proportion,
  1526. ifo.no_supervise_costs_proportion,
  1527. ifo.no_other_costs_proportion,
  1528. ifo.jq_supervise_costs_premiums,
  1529. ifo.jq_other_costs_premiums,
  1530. ifo.sy_supervise_costs_premiums,
  1531. ifo.sy_other_costs_premiums,
  1532. ifo.no_supervise_costs_premiums,
  1533. ifo.no_other_costs_premiums,
  1534. ifo.jq_dept_premiums_level_1,
  1535. ifo.jq_dept_premiums_level_2,
  1536. ifo.jq_dept_premiums_level_3,
  1537. ifo.jq_dept_premiums_level_4,
  1538. ifo.jq_dept_premiums_level_5,
  1539. ifo.sy_dept_premiums_level_1,
  1540. ifo.sy_dept_premiums_level_2,
  1541. ifo.sy_dept_premiums_level_3,
  1542. ifo.sy_dept_premiums_level_4,
  1543. ifo.sy_dept_premiums_level_5,
  1544. ifo.no_dept_premiums_level_1,
  1545. ifo.no_dept_premiums_level_2,
  1546. ifo.no_dept_premiums_level_3,
  1547. ifo.no_dept_premiums_level_4,
  1548. ifo.no_dept_premiums_level_5,
  1549. ifo.first_detail_premiums,
  1550. ifo.second_detail_premiums,
  1551. ifo.third_detail_premiums,
  1552. ifo.jq_profit_margin_premiums,
  1553. ifo.sy_profit_margin_premiums,
  1554. ifo.no_profit_margin_premiums
  1555. </if>
  1556. </select>
  1557. <resultMap id="hxOrderCountMap" type="com.ydtech.modules.order.entity.vo.QueryHxOrdersCountVo">
  1558. <result property="operatorId" column="operatorid" jdbcType="VARCHAR"/>
  1559. <result property="name" column="name" jdbcType="VARCHAR"/>
  1560. <result property="orderStatus0" column="orderstatus0" jdbcType="VARCHAR"/>
  1561. <result property="orderStatus1" column="orderstatus1" jdbcType="VARCHAR"/>
  1562. <result property="orderStatus2" column="orderstatus2" jdbcType="VARCHAR"/>
  1563. <result property="orderStatus3" column="orderstatus3" jdbcType="VARCHAR"/>
  1564. <result property="orderStatus4" column="orderstatus4" jdbcType="VARCHAR"/>
  1565. <result property="createTime" column="createtime" jdbcType="TIMESTAMP"/>
  1566. <result property="createTimeStart" column="createTimeStart" jdbcType="VARCHAR"/>
  1567. <result property="createTimeEnd" column="createTimeEnd" jdbcType="VARCHAR"/>
  1568. <result property="count" column="count1" jdbcType="VARCHAR"/>
  1569. </resultMap>
  1570. <resultMap id="TelemarketingAuditOrderMap" type="com.ydtech.modules.order.entity.dto.TelemarketingAuditOrderDTO">
  1571. <result property="id" column="id" jdbcType="VARCHAR"/>
  1572. <result property="orderNo" column="orderno" jdbcType="VARCHAR"/>
  1573. <result property="userid" column="userid" jdbcType="VARCHAR"/>
  1574. <result property="username" column="username" jdbcType="VARCHAR"/>
  1575. <result property="product" column="product" jdbcType="VARCHAR"/>
  1576. <result property="licenseNo" column="licenseno" jdbcType="VARCHAR"/>
  1577. <result property="orderStatus" column="orderstatus" jdbcType="VARCHAR"/>
  1578. <result property="insuredName" column="insuredname" jdbcType="VARCHAR"/>
  1579. <result property="createTime" column="createtime" jdbcType="VARCHAR"/>
  1580. <result property="auditStatus" column="auditstatus" jdbcType="VARCHAR"/>
  1581. <result property="insCompany" column="insCompany" jdbcType="VARCHAR"/>
  1582. </resultMap>
  1583. <select id="queryHxOrdersCount" resultMap="hxOrderCountMap">
  1584. select
  1585. operatorid,
  1586. su.name,
  1587. count(*) as count1,
  1588. SUM(CASE WHEN orderstatus = '1' THEN 1 ELSE 0 END) AS orderstatus1,
  1589. SUM(CASE WHEN orderstatus = '2' THEN 1 ELSE 0 END) AS orderstatus2,
  1590. SUM(CASE WHEN orderstatus = '3' THEN 1 ELSE 0 END) AS orderstatus3,
  1591. SUM(CASE WHEN orderstatus = '4' THEN 1 ELSE 0 END) AS orderstatus4,
  1592. SUM(CASE WHEN orderstatus = '0' THEN 1 ELSE 0 END) AS orderstatus0
  1593. from
  1594. ins_orders
  1595. LEFT JOIN
  1596. sys_user su ON operatorid = su.id
  1597. WHERE operatorid IS NOT NULL
  1598. AND operatorid NOT LIKE '%M%'
  1599. <if test="queryHxOrdersCountVo.ids != null and !queryHxOrdersCountVo.ids.isEmpty()">
  1600. and operatorid IN
  1601. <foreach item="item" index="index" collection="queryHxOrdersCountVo.ids" open="(" separator="," close=")">
  1602. #{item}
  1603. </foreach>
  1604. </if>
  1605. <if test="queryHxOrdersCountVo.operatorId !=null and queryHxOrdersCountVo.operatorId !=''">
  1606. and operatorid =#{queryHxOrdersCountVo.operatorId}
  1607. </if>
  1608. <if test="queryHxOrdersCountVo.name !=null and queryHxOrdersCountVo.name !=''">
  1609. and su.name =#{queryHxOrdersCountVo.name}
  1610. </if>
  1611. <if test="queryHxOrdersCountVo.createTimeStart != null and queryHxOrdersCountVo.createTimeStart != ''">
  1612. and createtime &gt;= #{queryHxOrdersCountVo.createTimeStart}
  1613. </if>
  1614. <if test="queryHxOrdersCountVo.createTimeEnd != null and queryHxOrdersCountVo.createTimeEnd != ''">
  1615. and createtime &lt;= #{queryHxOrdersCountVo.createTimeEnd}
  1616. </if>
  1617. group by
  1618. operatorid,su.name
  1619. order by
  1620. count1 desc
  1621. </select>
  1622. <select id="getTelemarketingAudit" resultMap="TelemarketingAuditOrderMap">
  1623. SELECT
  1624. iac.id as id,
  1625. iac.orderno as orderno,
  1626. io.userid as userid,
  1627. io.username as username,
  1628. iac.product as product,
  1629. io.licenseno as licenseno,
  1630. io.ins_company as insCompany,
  1631. io.orderstatus as orderstatus,
  1632. io.insuredname as insuredname,
  1633. iac.createtime as createtime,
  1634. ifa.auditstatus as auditstatus
  1635. FROM
  1636. ins_area_company iac
  1637. LEFT JOIN ins_orders io ON iac.orderno = io.orderno
  1638. LEFT JOIN ins_fee_audit ifa ON ifa.ins_order_no = iac.id
  1639. WHERE
  1640. iac.orderstatus = '3'
  1641. AND ifa.auditstatus IN ('4', '5')
  1642. AND io.userid = #{userId}
  1643. <if test="telemarketingAuditOrderQueryVo.orderNo != null and telemarketingAuditOrderQueryVo.orderNo != '' ">
  1644. AND iac.orderno = #{telemarketingAuditOrderQueryVo.orderNo}
  1645. </if>
  1646. <if test="telemarketingAuditOrderQueryVo.auditStatus != null and telemarketingAuditOrderQueryVo.auditStatus != '' ">
  1647. AND ifa.auditstatus = #{telemarketingAuditOrderQueryVo.auditStatus}
  1648. </if>
  1649. <if test="telemarketingAuditOrderQueryVo.companyId != null and telemarketingAuditOrderQueryVo.companyId != '' ">
  1650. AND iac.company_id = #{telemarketingAuditOrderQueryVo.companyId}
  1651. </if>
  1652. <if test="telemarketingAuditOrderQueryVo.licenseNo != null and telemarketingAuditOrderQueryVo.licenseNo != '' ">
  1653. AND io.licenseno = #{telemarketingAuditOrderQueryVo.licenseNo}
  1654. </if>
  1655. <if test="telemarketingAuditOrderQueryVo.frameNo != null and telemarketingAuditOrderQueryVo.frameNo != '' ">
  1656. AND io.frameno = #{telemarketingAuditOrderQueryVo.frameNo}
  1657. </if>
  1658. <if test="telemarketingAuditOrderQueryVo.productId != null and telemarketingAuditOrderQueryVo.productId != '' ">
  1659. AND io.product = #{telemarketingAuditOrderQueryVo.productId}
  1660. </if>
  1661. <if test="telemarketingAuditOrderQueryVo.startDate != null and telemarketingAuditOrderQueryVo.startDate != '' and telemarketingAuditOrderQueryVo.endDate != null and telemarketingAuditOrderQueryVo.endDate != ''">
  1662. AND iac.createtime BETWEEN #{telemarketingAuditOrderQueryVo.startDate} AND
  1663. #{telemarketingAuditOrderQueryVo.endDate}
  1664. </if>
  1665. </select>
  1666. <select id="queryLicense" resultType="java.lang.String">
  1667. SELECT DISTINCT licenseno
  1668. from ins_orders
  1669. WHERE userid = #{userId}
  1670. <if test="queryLicenseInOrderVo.startDate != null and queryLicenseInOrderVo.startDate != '' and queryLicenseInOrderVo.endDate != null and queryLicenseInOrderVo.endDate != ''">
  1671. AND createtime BETWEEN #{queryLicenseInOrderVo.startDate} AND
  1672. #{queryLicenseInOrderVo.endDate}
  1673. </if>
  1674. </select>
  1675. </mapper>