InsAreaCompanyMapper.xml 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508
  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.InsAreaCompanyMapper">
  6. <resultMap id="BaseResultMap" type="com.ydtech.modules.order.entity.InsAreaCompany">
  7. <id property="id" column="id" jdbcType="VARCHAR"/>
  8. <result property="reqtxt" column="reqtxt" javaType="com.alibaba.fastjson.JSONObject"
  9. typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler" jdbcType="VARCHAR"/>
  10. <result property="reptxt" column="reptxt" javaType="com.alibaba.fastjson.JSONObject"
  11. typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler" jdbcType="VARCHAR"/>
  12. <result property="riskinfo" column="riskinfo" javaType="com.alibaba.fastjson.JSONArray"
  13. typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler" jdbcType="VARCHAR"/>
  14. <result property="kindinfo" column="kindinfo" javaType="com.alibaba.fastjson.JSONArray"
  15. typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler" jdbcType="VARCHAR"/>
  16. <result property="accidentInfo" column="accident_info" javaType="com.alibaba.fastjson.JSONArray"
  17. typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler" jdbcType="VARCHAR"/>
  18. <result property="taxArrears" column="tax_arrears" javaType="com.alibaba.fastjson.JSONArray"
  19. typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler" jdbcType="VARCHAR"/>
  20. <result property="crossInsurance" column="cross_insurance" javaType="com.alibaba.fastjson.JSONArray"
  21. typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler" jdbcType="VARCHAR"/>
  22. <result property="orderno" column="orderno" jdbcType="VARCHAR"/>
  23. <result property="agreementId" column="agreement_id" jdbcType="BIGINT"/>
  24. <result property="apiType" column="api_type" jdbcType="TINYINT"/>
  25. <result property="orderstatus" column="orderstatus" jdbcType="VARCHAR"/>
  26. <result property="companyId" column="company_id" jdbcType="VARCHAR"/>
  27. <result property="inscompany" column="inscompany" jdbcType="VARCHAR"/>
  28. <result property="jqapplyno" column="jqapplyno" jdbcType="VARCHAR"/>
  29. <result property="jqpolicyno" column="jqpolicyno" jdbcType="VARCHAR"/>
  30. <result property="syapplyno" column="syapplyno" jdbcType="VARCHAR"/>
  31. <result property="sypolicyno" column="sypolicyno" jdbcType="VARCHAR"/>
  32. <result property="jqpremium" column="jqpremium" jdbcType="DECIMAL"/>
  33. <result property="sypremium" column="sypremium" jdbcType="DECIMAL"/>
  34. <result property="jypremium" column="jypremium" jdbcType="DECIMAL"/>
  35. <result property="sumpremium" column="sumpremium" jdbcType="DECIMAL"/>
  36. <result property="taxamount" column="taxamount" jdbcType="DECIMAL"/>
  37. <result property="jqdiscountrate" column="jqdiscountrate" jdbcType="DOUBLE"/>
  38. <result property="sydiscountrate" column="sydiscountrate" jdbcType="DOUBLE"/>
  39. <result property="feerate" column="feerate" jdbcType="DOUBLE"/>
  40. <result property="disrate" column="disrate" jdbcType="DOUBLE"/>
  41. <result property="auditid" column="auditid" jdbcType="VARCHAR"/>
  42. <result property="auditname" column="auditname" jdbcType="VARCHAR"/>
  43. <result property="audittime" column="audittime" jdbcType="TIMESTAMP"/>
  44. <result property="auditopinion" column="auditopinion" jdbcType="VARCHAR"/>
  45. <result property="jqappoint" column="jqappoint" jdbcType="VARCHAR"/>
  46. <result property="syappoint" column="syappoint" jdbcType="VARCHAR"/>
  47. <result property="createtime" column="createtime" jdbcType="TIMESTAMP"/>
  48. <result property="payDate" column="pay_date" jdbcType="TIMESTAMP"/>
  49. <result property="paymentLink" column="payment_link" jdbcType="VARCHAR"/>
  50. <result property="insOrderNo" column="ins_order_no" jdbcType="VARCHAR"/>
  51. <result property="attributionId" column="attribution_id" jdbcType="VARCHAR"/>
  52. <result property="jqStartDate" column="jq_start_date" jdbcType="VARCHAR"/>
  53. <result property="jqEndDate" column="jq_end_date" jdbcType="VARCHAR"/>
  54. <result property="syStartDate" column="sy_start_date" jdbcType="VARCHAR"/>
  55. <result property="syEndDate" column="sy_end_date" jdbcType="VARCHAR"/>
  56. <result property="accidentStrInfo" column="accident_str_info" jdbcType="VARCHAR"/>
  57. <result property="score" column="score" jdbcType="VARCHAR"/>
  58. <result property="jqScore" column="jq_score" jdbcType="VARCHAR"/>
  59. <result property="syScore" column="sy_score" jdbcType="VARCHAR"/>
  60. <result property="lossRation" column="loss_ration" jdbcType="DOUBLE"/>
  61. <result property="jqLossRation" column="jq_loss_ration" jdbcType="DOUBLE"/>
  62. <result property="syLossRation" column="sy_loss_ration" jdbcType="DOUBLE"/>
  63. <result property="totalAdjustRate" column="total_adjust_rate" jdbcType="DOUBLE"/>
  64. <result property="jqAdjustRate" column="jq_adjust_rate" jdbcType="DOUBLE"/>
  65. <result property="syAdjustRate" column="sy_adjust_rate" jdbcType="DOUBLE"/>
  66. <result property="insideOrderStatus" column="inside_order_status" jdbcType="TINYINT"/>
  67. <result property="insidePayTime" column="inside_pay_time" jdbcType="TIMESTAMP"/>
  68. <result property="signingTime" column="signing_time" jdbcType="TIMESTAMP"/>
  69. <result property="jqRenewal" column="jq_renewal" jdbcType="VARCHAR"/>
  70. <result property="syRenewal" column="sy_renewal" jdbcType="VARCHAR"/>
  71. <result property="jqClaims" column="jq_claims" jdbcType="VARCHAR"/>
  72. <result property="syClaims" column="sy_claims" jdbcType="VARCHAR"/>
  73. </resultMap>
  74. <resultMap id="InsAreaCompanyQueryDto" type="com.ydtech.modules.order.entity.dto.InsAreaCompanyQueryDto"
  75. extends="BaseResultMap">
  76. <result property="agreementName" column="agreement_name" jdbcType="VARCHAR"/>
  77. </resultMap>
  78. <sql id="Base_Column_List">
  79. id,orderno,inscompany,
  80. reqtxt,reptxt,jqapplyno,
  81. jqpolicyno,syapplyno,sypolicyno,
  82. riskinfo,kindinfo,jqpremium,
  83. sypremium,taxamount,sumpremium,
  84. jqdiscountrate,sydiscountrate,feerate,
  85. disrate,auditid,auditname,
  86. audittime,auditopinion,jqappoint,
  87. syappoint,createtime,payment_link
  88. </sql>
  89. <select id="selectByOrderNo" resultMap="InsAreaCompanyQueryDto">
  90. SELECT iac.*, pa.agreement_name
  91. FROM ins_area_company as iac
  92. left join ptl_agreement as pa on pa.id = iac.agreement_id
  93. INNER JOIN (SELECT company_id, max(createtime) AS max_createtime
  94. FROM ins_area_company
  95. WHERE orderno = #{orderNo}
  96. GROUP BY company_id) t ON t.company_id = iac.company_id
  97. AND t.max_createtime = iac.createtime
  98. WHERE iac.orderno = #{orderNo}
  99. </select>
  100. <select id="selectAcceptInsurance" resultMap="InsAreaCompanyQueryDto">
  101. SELECT iac.*, pa.agreement_name
  102. FROM ins_area_company as iac
  103. left join ptl_agreement as pa on pa.id = iac.agreement_id
  104. WHERE iac.orderstatus = 3
  105. and orderno = #{orderNo};
  106. </select>
  107. <select id="queryLatestStatus" resultType="java.lang.String">
  108. SELECT iac.orderstatus
  109. FROM ins_area_company as iac
  110. INNER JOIN (SELECT company_id, max(createtime) AS max_createtime
  111. FROM ins_area_company
  112. WHERE orderno = #{orderNo}
  113. GROUP BY company_id) t ON t.company_id = iac.company_id
  114. AND t.max_createtime = iac.createtime
  115. WHERE iac.orderno = #{orderNo}
  116. ORDER BY orderstatus DESC
  117. LIMIT 1
  118. </select>
  119. <select id="getorDerIds" resultType="com.ydtech.modules.order.entity.InsAreaCompany">
  120. SELECT a.id as "id",
  121. a.orderno as "orderno"
  122. FROM ins_area_company a
  123. LEFT JOIN ins_fee_order_new b ON a.id = b.ins_order_no
  124. WHERE a.orderstatus = '3'
  125. or a.orderstatus = '2'
  126. and b.id is not null
  127. </select>
  128. <select id="getAuditOrders" resultType="com.ydtech.modules.order.entity.InsOrders">
  129. SELECT
  130. io.orderno,
  131. io.quoteno,
  132. io.orderstatus,
  133. io.company_id,
  134. io.ins_company,
  135. io.carinfo,
  136. io.userid,
  137. io.username,
  138. io.deptid,
  139. io.deptname,
  140. io.agreeid,
  141. iac.productid,
  142. iac.product,
  143. iac.createtime,
  144. io.frameno,
  145. io.licenseno,
  146. io.insuredname,
  147. iac.jq_start_date as jqstartdate,
  148. iac.jq_end_date as jqenddate,
  149. iac.sy_start_date as systartdate,
  150. iac.sy_end_date as syenddate,
  151. io.vehicle_and_vessel_tax,
  152. io.operatorid,
  153. sd.management_source,
  154. CASE ifa.audituser
  155. WHEN '自动审核' THEN ifa.audituser
  156. ELSE su2.name END
  157. AS auditUser,
  158. ifa.audittime as auditTime,
  159. ifa.auditstatus as auditStatus,
  160. eic.namesimple as partnerCompaniesName,
  161. iac.id as subOrderId,
  162. iac.signing_time as signingTime,
  163. iac.pay_date as payDate,
  164. pa.agreement_code as agreementCode,
  165. pa.agreement_name as agreementName
  166. FROM
  167. ins_orders io
  168. LEFT JOIN ins_area_company iac ON iac.orderno = io.orderno and iac.orderstatus = 3
  169. LEFT JOIN ins_fee_audit ifa ON ifa.ins_order_no = iac.id
  170. LEFT JOIN sys_user su ON su.id = io.userid
  171. LEFT JOIN sys_dept sd ON sd.id = su.dept_id
  172. LEFT JOIN sys_user su2 ON ifa.audituser = su2.id
  173. LEFT JOIN ptl_agreement pa ON pa.id = iac.agreement_id
  174. LEFT JOIN esm_ins_company eic on eic.id = pa.partner_companies_id
  175. WHERE
  176. io.orderno IN (
  177. SELECT
  178. orderno
  179. FROM
  180. ins_area_company iac,(
  181. SELECT
  182. ins_order_no
  183. FROM
  184. ins_fee_order_new AS o
  185. WHERE
  186. <if test="params.auditStatus != null and params.auditStatus == 0">
  187. NOT EXISTS
  188. </if>
  189. <if test="params.auditStatus != null and params.auditStatus == 1">
  190. ins_order_no in
  191. </if>
  192. ( SELECT ins_order_no FROM ins_fee_audit AS a WHERE a.ins_order_no = o.ins_order_no )
  193. ) a
  194. WHERE
  195. iac.id = a.ins_order_no
  196. AND orderstatus = 3
  197. <if test="params.quoteStartDateStr != null and params.quoteStartDateStr != '' and params.quoteEndDateStr != null and params.quoteEndDateStr != ''">
  198. and DATE_FORMAT(iac.createtime, '%Y-%m-%d') between #{params.quoteStartDateStr} AND
  199. #{params.quoteEndDateStr}
  200. </if>
  201. )
  202. <if test="params.taskNo != null and params.taskNo != ''">
  203. AND io.orderno = #{params.taskNo}
  204. </if>
  205. <if test="params.orderNo != null and params.orderNo != ''">
  206. AND iac.id = #{params.orderNo}
  207. </if>
  208. <if test="params.licenseNo != null and params.licenseNo != ''">
  209. AND io.licenseno = #{params.licenseNo}
  210. </if>
  211. <if test="params.frameNo != null and params.frameNo != ''">
  212. AND io.frameno = #{params.frameNo}
  213. </if>
  214. <if test="params.insuredName != null and params.insuredName != ''">
  215. AND io.insuredname = #{params.insuredName}
  216. </if>
  217. <if test="params.companyId != null and params.companyId != ''">
  218. AND io.company_id = #{params.companyId}
  219. </if>
  220. <if test="params.engineNo != null and params.engineNo != ''">
  221. and JSON_EXTRACT( io.carinfo, '$.engineNo' ) = #{params.engineNo}
  222. </if>
  223. <if test="params.riskCode != null and params.riskCode != ''">
  224. and iac.product = #{params.riskCode}
  225. </if>
  226. <if test="params.attachStartDateStr != null and params.attachStartDateStr != '' and params.attachStartDateStr != null and params.attachStartDateStr != '' ">
  227. and ((
  228. DATE_FORMAT(iac.jq_start_date, '%Y-%m-%d') BETWEEN #{params.attachStartDateStr}
  229. AND #{params.attachEndDateStr}
  230. )
  231. OR ( DATE_FORMAT(iac.sy_start_date, '%Y-%m-%d') BETWEEN #{params.attachStartDateStr} AND
  232. #{params.attachEndDateStr} )
  233. )
  234. </if>
  235. <if test="params.provinceId != null and params.provinceId != ''">
  236. and io.deptid like "${params.provinceId}%"
  237. </if>
  238. <if test="params.cityId != null and params.cityId != ''">
  239. and io.deptid like "${params.cityId}%"
  240. </if>
  241. <if test="params.countyId != null and params.countyId != ''">
  242. and io.deptid like "${params.countyId}%"
  243. </if>
  244. <if test="params.houseId != null and params.houseId != ''">
  245. and io.deptid like "${params.houseId}%"
  246. </if>
  247. <if test="params.operatorId != null and params.operatorId != ''">
  248. and io.userid = #{params.operatorId}
  249. </if>
  250. <if test="params.operatorName != null and params.operatorName != ''">
  251. and io.username = #{params.operatorName}
  252. </if>
  253. <if test="params.auditId != null and params.auditId != ''">
  254. and iac.new_operator_id = #{params.auditId}
  255. </if>
  256. <if test="params.agreeId != null and params.agreeId != ''">
  257. and iac.agreement_id = #{params.agreeId}
  258. </if>
  259. <if test="params.managementSource != null and params.managementSource != ''">
  260. and sd.management_source = #{params.managementSource}
  261. </if>
  262. <if test="params.signStartDateStr != null and params.signStartDateStr != '' and params.signEndDateStr != null and params.signEndDateStr != ''">
  263. and DATE_FORMAT(iac.signing_time, '%Y-%m-%d') between #{params.signStartDateStr} AND
  264. #{params.signEndDateStr}
  265. </if>
  266. <if test="params.payStartDateStr != null and params.payStartDateStr != '' and params.payEndDateStr != null and params.payEndDateStr != ''">
  267. and DATE_FORMAT(iac.pay_date, '%Y-%m-%d') between #{params.payStartDateStr} AND #{params.payEndDateStr}
  268. </if>
  269. order by iac.createtime desc
  270. </select>
  271. <select id="getByUserId" resultType="com.ydtech.modules.order.entity.InsOrders">
  272. SELECT
  273. io.*,
  274. sd.management_source
  275. FROM
  276. ins_orders io left join sys_user su on su.id = io.userid left join sys_dept sd on sd.id = su.dept_id
  277. WHERE
  278. orderno IN (
  279. SELECT
  280. orderno
  281. FROM
  282. ins_area_company
  283. WHERE
  284. id IN ( SELECT ins_order_no FROM ins_fee_order_new WHERE id NOT IN ( SELECT ins_order_no FROM ins_fee_audit ) )
  285. AND orderstatus = 3
  286. )
  287. AND
  288. io.orderstatus= 3
  289. <if test="orderNo != null and orderNo != ''">
  290. AND orderno = #{orderNo}
  291. </if>
  292. <if test="licenseNo != null and licenseNo != ''">
  293. AND licenseno = #{licenseNo}
  294. </if>
  295. <if test="frameNo != null and frameNo != ''">
  296. AND frameno = #{frameNo}
  297. </if>
  298. <if test="userId != null and userId != ''">
  299. AND userid = #{userId}
  300. </if>
  301. <if test="insuredname != null and insuredname != ''">
  302. AND insuredname = #{insuredname}
  303. </if>
  304. <if test="startDateStr != null and startDateStr != ''">
  305. AND createtime BETWEEN #{startDateStr} and #{endDateStr}
  306. </if>
  307. </select>
  308. <select id="selectFirstPromotionBy" resultType="com.ydtech.modules.order.entity.InsOrders">
  309. SELECT
  310. sum(a.first_detail_premiums) as "willFirstPremiums"
  311. FROM
  312. ins_fee_order_new a
  313. LEFT JOIN ins_area_company iac on iac.id=a.ins_order_no
  314. WHERE
  315. a.ins_order_no NOT IN (
  316. SELECT
  317. ins_order_no
  318. FROM
  319. ins_fee_audit
  320. )
  321. AND iac.orderstatus =3
  322. <if test="firstUserId != null and firstUserId != ''">
  323. AND a.first_level_user_id = #{firstUserId}
  324. </if>
  325. <if test="secondUserId != null and secondUserId != ''">
  326. AND a.two_level_user_id = #{secondUserId}
  327. </if>
  328. <if test="thirdUserId != null and thirdUserId != ''">
  329. AND a.three_level_user_id = #{thirdUserId}
  330. </if>
  331. <if test="id != null and id != ''">
  332. AND a.id = #{id}
  333. </if>
  334. </select>
  335. <select id="selectSecondPromotionBy" resultType="com.ydtech.modules.order.entity.InsOrders">
  336. SELECT
  337. sum( fee.p ) as "willFirstPremiums"
  338. FROM
  339. (
  340. SELECT
  341. sum( a.first_detail_premiums ) AS p
  342. FROM
  343. ins_fee_order_new a
  344. LEFT JOIN ins_area_company iac ON iac.id = a.ins_order_no
  345. <where>
  346. NOT EXISTS ( SELECT ins_order_no FROM ins_fee_audit AS b WHERE b.ins_order_no = a.ins_order_no )
  347. and iac.orderstatus = '3'
  348. <if test="userId!=null and userId!= ''">
  349. AND a.first_level_user_id = #{userId}
  350. </if>
  351. <if test="id != null and id!=''">
  352. AND a.id =#{id}
  353. </if>
  354. </where>
  355. UNION
  356. SELECT
  357. sum( a.third_detail_premiums ) AS p
  358. FROM
  359. ins_fee_order_new a
  360. LEFT JOIN ins_area_company iac ON iac.id = a.ins_order_no
  361. <where>
  362. NOT EXISTS ( SELECT ins_order_no FROM ins_fee_audit AS b WHERE b.ins_order_no = a.ins_order_no )
  363. and iac.orderstatus = '3'
  364. <if test="userId!=null and userId!= ''">
  365. AND a.three_level_user_id = #{userId}
  366. </if>
  367. <if test="id != null and id!=''">
  368. AND a.id =#{id}
  369. </if>
  370. </where>
  371. UNION
  372. SELECT
  373. sum( a.second_detail_premiums ) AS p
  374. FROM
  375. ins_fee_order_new a
  376. LEFT JOIN ins_area_company iac ON iac.id = a.ins_order_no
  377. <where>
  378. NOT EXISTS ( SELECT ins_order_no FROM ins_fee_audit AS b WHERE b.ins_order_no = a.ins_order_no )
  379. and iac.orderstatus = '3'
  380. <if test="userId!=null and userId!= ''">
  381. AND a.two_level_user_id = #{userId}
  382. </if>
  383. <if test="id != null and id!=''">
  384. AND a.id =#{id}
  385. </if>
  386. </where>
  387. ) AS fee
  388. </select>
  389. <select id="selectThirdPromotionBy" resultType="com.ydtech.modules.order.entity.InsOrders">
  390. SELECT
  391. sum(a.third_detail_premiums) as "willThreePremiums"
  392. FROM
  393. ins_fee_order_new a
  394. LEFT JOIN ins_area_company iac on iac.id=a.ins_order_no
  395. WHERE
  396. NOT EXISTS ( SELECT ins_order_no FROM ins_fee_audit AS b WHERE b.ins_order_no = a.ins_order_no )
  397. AND iac.orderstatus =3
  398. <if test="firstUserId != null and firstUserId != ''">
  399. AND a.first_level_user_id = #{firstUserId}
  400. </if>
  401. <if test="secondUserId != null and secondUserId != ''">
  402. AND a.two_level_user_id = #{secondUserId}
  403. </if>
  404. <if test="thirdUserId != null and thirdUserId != ''">
  405. AND a.three_level_user_id = #{thirdUserId}
  406. </if>
  407. <if test="id != null and id != ''">
  408. AND a.id = #{id}
  409. </if>
  410. </select>
  411. <select id="getAlreadyAuditOrders" resultType="com.ydtech.modules.order.entity.InsOrders">
  412. SELECT
  413. io.*,
  414. sd.management_source,
  415. su2.name AS auditUser,
  416. ifa.audittime as auditTime
  417. FROM
  418. ins_orders io
  419. LEFT JOIN ins_fee_audit ifa ON ifa.orderno = io.orderno
  420. LEFT JOIN sys_user su ON su.id = io.userid
  421. LEFT JOIN sys_dept sd ON sd.id = su.dept_id
  422. LEFT JOIN sys_user su2 on ifa.audituser = su2.id
  423. WHERE
  424. io.orderno IN (
  425. SELECT
  426. orderno
  427. FROM
  428. ins_area_company
  429. WHERE
  430. id IN (
  431. SELECT
  432. ifon.ins_order_no
  433. FROM
  434. ins_fee_order_new ifon
  435. RIGHT JOIN ins_fee_audit ifa ON ifon.ins_order_no = ifa.ins_order_no
  436. WHERE
  437. ifa.auditstatus = #{params.auditStatus}
  438. )
  439. )
  440. AND orderstatus = 3
  441. <!-- <if test="params.orderNo != null and params.orderNo != ''">-->
  442. <!-- AND orderno = #{params.orderNo}-->
  443. <!-- </if>-->
  444. <if test="params.licenseNo != null and params.licenseNo != ''">
  445. AND licenseno = #{params.licenseNo}
  446. </if>
  447. <if test="params.frameNo != null and params.frameNo != ''">
  448. AND frameno = #{params.frameNo}
  449. </if>
  450. <if test="params.insuredName != null and params.insuredName != ''">
  451. AND insuredname = #{params.insuredName}
  452. </if>
  453. <if test="params.companyId != null and params.companyId != ''">
  454. AND company_id = #{params.companyId}
  455. </if>
  456. <if test="params.startDateStr != null and params.startDateStr != ''">
  457. AND createtime BETWEEN #{params.startDateStr} and #{params.endDateStr}
  458. </if>
  459. </select>
  460. <select id="selectListByDateStr" resultType="com.ydtech.modules.order.entity.InsAreaCompany">
  461. -- 查询订单信息
  462. SELECT
  463. iac.*
  464. FROM
  465. ins_area_company iac
  466. JOIN ins_orders AS io ON io.orderno = iac.orderno
  467. WHERE
  468. 1=1
  469. <if test="dateStr != null and dateStr != ''">
  470. AND DATE_FORMAT(io.createtime, '%Y-%m') =#{dateStr}
  471. </if>
  472. </select>
  473. <select id="selectListById" resultMap="BaseResultMap">
  474. SELECT
  475. iac.*
  476. FROM
  477. ins_area_company iac
  478. WHERE
  479. 1=1
  480. <if test="id != null and id != ''">
  481. AND iac.id =#{id}
  482. </if>
  483. </select>
  484. </mapper>