PtlAgreementMapper.xml 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  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.protocol.dao.PtlAgreementMapper">
  6. <resultMap id="BaseResultMap" type="com.ydtech.modules.protocol.entity.po.PtlAgreement">
  7. <id property="id" column="id" jdbcType="BIGINT"/>
  8. <result property="companiesType" column="companies_type" jdbcType="INTEGER"/>
  9. <result property="agreementType" column="agreement_type" jdbcType="VARCHAR"/>
  10. <result property="agreementCode" column="agreement_code" jdbcType="VARCHAR"/>
  11. <result property="agreementName" column="agreement_name" jdbcType="VARCHAR"/>
  12. <result property="agreementAbbreviation" column="agreement_abbreviation" jdbcType="VARCHAR"/>
  13. <result property="insuranceCompany" column="insurance_company" jdbcType="VARCHAR"/>
  14. <result property="insuranceCompanyId" column="insurance_company_id" jdbcType="VARCHAR"/>
  15. <result property="partnerCompaniesId" column="partner_companies_id" jdbcType="VARCHAR"/>
  16. <result property="associationCompaniesId" column="association_companies_id" jdbcType="VARCHAR"/>
  17. <result property="startDate" column="start_date" jdbcType="DATE"/>
  18. <result property="endDate" column="end_date" jdbcType="DATE"/>
  19. <result property="moneyTime" column="money_time" jdbcType="INTEGER"/>
  20. <result property="matchType" column="match_type" jdbcType="VARCHAR"/>
  21. <result property="dockingPerson" column="docking_person" jdbcType="VARCHAR"/>
  22. <result property="dockingPhone" column="docking_phone" jdbcType="VARCHAR"/>
  23. <result property="withTax" column="with_tax" jdbcType="VARCHAR"/>
  24. <result property="moneyType" column="money_type" jdbcType="VARCHAR"/>
  25. <result property="validStatus" column="valid_status" jdbcType="VARCHAR"/>
  26. <result property="fileId" column="file_id" jdbcType="VARCHAR"/>
  27. <result property="auditContent" column="audit_content" jdbcType="VARCHAR"/>
  28. <result property="auditStatus" column="audit_status" jdbcType="TINYINT"/>
  29. <result property="creator" column="creator" jdbcType="VARCHAR"/>
  30. <result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
  31. <result property="modifiedBy" column="modified_by" jdbcType="VARCHAR"/>
  32. <result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
  33. </resultMap>
  34. <resultMap id="AgreementCompanyResultMap" type="com.ydtech.modules.protocol.entity.dto.PtlAgreementInsCompanyDto">
  35. <id property="id" column="id" jdbcType="VARCHAR"/>
  36. <result property="name" column="name" jdbcType="VARCHAR"/>
  37. <result property="parentId" column="parent_id" jdbcType="VARCHAR"/>
  38. <result property="namesimple" column="namesimple" jdbcType="VARCHAR"/>
  39. <result property="remark" column="remark" jdbcType="VARCHAR"/>
  40. <result property="orderNum" column="order_num" jdbcType="INTEGER"/>
  41. <result property="createBy" column="create_by" jdbcType="VARCHAR"/>
  42. <result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
  43. <result property="lastUpdateBy" column="last_update_by" jdbcType="VARCHAR"/>
  44. <result property="lastUpdateTime" column="last_update_time" jdbcType="TIMESTAMP"/>
  45. <result property="cnName" column="cn_name" jdbcType="VARCHAR"/>
  46. <result property="logo" column="logo" jdbcType="VARCHAR"/>
  47. <collection property="agreement" ofType="com.ydtech.modules.protocol.entity.dto.PtlAgreementDto">
  48. <id property="id" column="agreement_id"/>
  49. <result property="agreementName" column="agreement_name"/>
  50. <result property="underwritingDescription" column="underwriting_description"/>
  51. <result property="apiType" column="api_type"/>
  52. <result property="productsCode" column="products_code"/>
  53. </collection>
  54. </resultMap>
  55. <sql id="Base_Column_List">
  56. id,agreement_type,agreement_code,
  57. agreement_name,agreement_abbreviation,insurance_company,
  58. start_date,end_date,money_time,
  59. match_type,docking_person,docking_phone,
  60. with_tax,money_type,cooperation_channels,
  61. valid_status,file_id,audit_status,
  62. creator,create_time,modified_by,
  63. update_time
  64. </sql>
  65. <select id="getAgreementCompany" resultMap="AgreementCompanyResultMap">
  66. select eic.*, pa.id as agreement_id, pa.agreement_name,pa.products_code, paa.api_type, pa.underwriting_description
  67. from esm_ins_company as eic
  68. left join ptl_agreement as pa on pa.insurance_company_id = eic.id
  69. left join ptl_agreement_attribution as paa on paa.id = pa.id
  70. where (#{localDate} between start_date and end_date)
  71. and (paa.template_id is not null)
  72. and pa.valid_status = 1
  73. and pa.id in (select distinct agreement_id
  74. from ptl_agreement_dept
  75. <if test="deptId != null and deptId != ''">
  76. where dept_id = #{deptId}
  77. </if>
  78. )
  79. order by pa.serial_number
  80. </select>
  81. <select id="getAgreementCompanyByCompanyId" resultMap="AgreementCompanyResultMap">
  82. select eic.*, pa.id as agreement_id, pa.agreement_name, paa.api_type, pa.underwriting_description
  83. from esm_ins_company as eic
  84. left join ptl_agreement as pa on pa.insurance_company_id = eic.id
  85. left join ptl_agreement_attribution as paa on paa.id = pa.id
  86. where (#{localDate} between start_date and end_date)
  87. and (paa.template_id is not null)
  88. and pa.valid_status = 1
  89. and pa.id in (select distinct agreement_id
  90. from ptl_agreement_dept
  91. <if test="deptId != null and deptId != ''">
  92. where dept_id = #{deptId}
  93. </if>
  94. <if test="companyId != null and companyId != ''">
  95. and company_id = #{companyId}
  96. </if>
  97. )
  98. order by pa.serial_number
  99. </select>
  100. <select id="getByAgreementIdNew" resultType="com.ydtech.modules.protocol.entity.po.PtlAgreement">
  101. select
  102. *
  103. from ptl_agreement
  104. <where>
  105. <if test="agreementId!=null and agreementId !=''">
  106. id=#{agreementId}
  107. </if>
  108. </where>
  109. </select>
  110. <select id="getDockingPersonList" resultType="java.util.HashMap">
  111. SELECT docking_person
  112. FROM `ptl_agreement`
  113. GROUP BY docking_person
  114. </select>
  115. <select id="selectAgreeId" resultType="com.ydtech.modules.protocol.entity.po.PtlAgreement">
  116. select
  117. *
  118. from ptl_agreement a
  119. <where>
  120. <if test="companyId !=null and companyId !=''" >
  121. a.association_companies_id =#{companyId}
  122. </if>
  123. <if test="partnerCompaniesId !=null and partnerCompaniesId !=''" >
  124. and a.partner_companies_id =#{partnerCompaniesId}
  125. </if>
  126. </where>
  127. </select>
  128. </mapper>