| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252 |
- <?xml version="1.0" encoding="UTF-8"?>
- <!DOCTYPE mapper
- PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
- "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
- <mapper namespace="com.ydtech.modules.protocol.dao.PtlAgreementMapper">
- <resultMap id="BaseResultMap" type="com.ydtech.modules.protocol.entity.po.PtlAgreement">
- <id property="id" column="id" jdbcType="BIGINT"/>
- <result property="companiesType" column="companies_type" jdbcType="INTEGER"/>
- <result property="agreementType" column="agreement_type" jdbcType="VARCHAR"/>
- <result property="agreementCode" column="agreement_code" jdbcType="VARCHAR"/>
- <result property="agreementName" column="agreement_name" jdbcType="VARCHAR"/>
- <result property="agreementAbbreviation" column="agreement_abbreviation" jdbcType="VARCHAR"/>
- <result property="insuranceCompany" column="insurance_company" jdbcType="VARCHAR"/>
- <result property="insuranceCompanyId" column="insurance_company_id" jdbcType="VARCHAR"/>
- <result property="partnerCompaniesId" column="partner_companies_id" jdbcType="VARCHAR"/>
- <result property="associationCompaniesId" column="association_companies_id" jdbcType="VARCHAR"/>
- <result property="startDate" column="start_date" jdbcType="DATE"/>
- <result property="endDate" column="end_date" jdbcType="DATE"/>
- <result property="moneyTime" column="money_time" jdbcType="INTEGER"/>
- <result property="matchType" column="match_type" jdbcType="VARCHAR"/>
- <result property="dockingPerson" column="docking_person" jdbcType="VARCHAR"/>
- <result property="dockingPhone" column="docking_phone" jdbcType="VARCHAR"/>
- <result property="withTax" column="with_tax" jdbcType="VARCHAR"/>
- <result property="moneyType" column="money_type" jdbcType="VARCHAR"/>
- <result property="validStatus" column="valid_status" jdbcType="VARCHAR"/>
- <result property="fileId" column="file_id" jdbcType="VARCHAR"/>
- <result property="auditContent" column="audit_content" jdbcType="VARCHAR"/>
- <result property="auditStatus" column="audit_status" jdbcType="TINYINT"/>
- <result property="creator" column="creator" jdbcType="VARCHAR"/>
- <result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
- <result property="modifiedBy" column="modified_by" jdbcType="VARCHAR"/>
- <result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
- <result property="deleted" column="deleted" jdbcType="TINYINT"/>
- </resultMap>
- <resultMap id="AgreementCompanyResultMap" type="com.ydtech.modules.protocol.entity.dto.PtlAgreementInsCompanyDto">
- <id property="id" column="id" jdbcType="VARCHAR"/>
- <result property="name" column="name" jdbcType="VARCHAR"/>
- <result property="parentId" column="parent_id" jdbcType="VARCHAR"/>
- <result property="namesimple" column="namesimple" jdbcType="VARCHAR"/>
- <result property="remark" column="remark" jdbcType="VARCHAR"/>
- <result property="orderNum" column="order_num" jdbcType="INTEGER"/>
- <result property="createBy" column="create_by" jdbcType="VARCHAR"/>
- <result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
- <result property="lastUpdateBy" column="last_update_by" jdbcType="VARCHAR"/>
- <result property="lastUpdateTime" column="last_update_time" jdbcType="TIMESTAMP"/>
- <result property="cnName" column="cn_name" jdbcType="VARCHAR"/>
- <result property="logo" column="logo" jdbcType="VARCHAR"/>
- <collection property="agreement" ofType="com.ydtech.modules.protocol.entity.dto.PtlAgreementDto">
- <id property="id" column="agreement_id"/>
- <result property="agreementName" column="agreement_name"/>
- <result property="underwritingDescription" column="underwriting_description"/>
- <result property="businessDescription" column="business_description"/>
- <result property="jobDescription" column="job_description"/>
- <result property="apiType" column="api_type"/>
- <result property="productsCode" column="products_code"/>
- </collection>
- </resultMap>
- <sql id="Base_Column_List">
- id,agreement_type,agreement_code,
- agreement_name,agreement_abbreviation,insurance_company,
- start_date,end_date,money_time,
- match_type,docking_person,docking_phone,
- with_tax,money_type,cooperation_channels,
- valid_status,file_id,audit_status,
- creator,create_time,modified_by,
- update_time
- </sql>
- <select id="getAgreementCompany" resultMap="AgreementCompanyResultMap">
- select eic.*, pa.id as agreement_id, pa.agreement_name, pa.products_code, paa.api_type, pa.underwriting_description,
- pa.business_description,pa.job_description
- from esm_ins_company as eic
- left join ptl_agreement as pa on pa.insurance_company_id = eic.id
- left join ptl_agreement_attribution as paa on paa.id = pa.id
- where (#{localDate} between start_date and end_date)
- and (paa.template_id is not null)
- and pa.valid_status = 1
- and pa.id in (select distinct agreement_id
- from ptl_agreement_dept
- <if test="deptId != null and deptId != ''">
- where dept_id = #{deptId}
- </if>
- )
- order by pa.serial_number
- </select>
- <select id="getAgreementCompanyExternal" resultMap="AgreementCompanyResultMap">
- select eic.*, pa.id as agreement_id, pa.agreement_name,pa.products_code, paa.api_type, pa.underwriting_description
- from esm_ins_company as eic
- left join ptl_agreement as pa on pa.insurance_company_id = eic.id
- left join ptl_agreement_attribution as paa on paa.id = pa.id
- where (#{localDate} between start_date and end_date)
- and (paa.template_id is not null)
- and pa.valid_status = 1
- and pa.is_external = 1
- and pa.id in (select distinct agreement_id
- from ptl_agreement_dept
- <if test="deptId != null and deptId != ''">
- where dept_id = #{deptId}
- </if>
- )
- order by pa.serial_number
- </select>
- <select id="getAgreementCompanyByCompanyId" resultMap="AgreementCompanyResultMap">
- select eic.*, pa.id as agreement_id, pa.agreement_name, paa.api_type, pa.underwriting_description
- from esm_ins_company as eic
- left join ptl_agreement as pa on pa.insurance_company_id = eic.id
- left join ptl_agreement_attribution as paa on paa.id = pa.id
- where (#{localDate} between start_date and end_date)
- and (paa.template_id is not null)
- and pa.valid_status = 1
- and pa.id in (select distinct agreement_id
- from ptl_agreement_dept
- <if test="deptId != null and deptId != ''">
- where dept_id = #{deptId}
- </if>
- <if test="companyId != null and companyId != ''">
- and company_id = #{companyId}
- </if>
- )
- order by pa.serial_number
- </select>
- <select id="getByAgreementIdNew" resultType="com.ydtech.modules.protocol.entity.po.PtlAgreement">
- select
- *
- from ptl_agreement
- <where>
- <if test="agreementId!=null and agreementId !=''">
- id=#{agreementId}
- </if>
- </where>
- </select>
- <select id="getDockingPersonList" resultType="java.util.HashMap">
- SELECT docking_person
- FROM `ptl_agreement`
- GROUP BY docking_person
- </select>
- <select id="selectAgreeId" resultType="com.ydtech.modules.protocol.entity.po.PtlAgreement">
- select
- *
- from ptl_agreement a
- <where>
- <if test="companyId !=null and companyId !=''" >
- a.insurance_company_id =#{companyId}
- </if>
- <if test="partnerCompaniesId !=null and partnerCompaniesId !=''" >
- and a.partner_companies_id =#{partnerCompaniesId}
- </if>
- <if test="agreeId !=null and agreeId !=''" >
- and a.id =#{agreeId}
- </if>
- </where>
- limit 1
- </select>
- <select id="queryReportPage" resultType="com.ydtech.modules.admin.model.report.user.agree.AgreeReportDto">
- SELECT
- eic.id AS companyId,
- eic.NAME AS companyName,
- eic.namesimple AS namesimple,
- pa.id AS agreeId,
- pa.agreement_name AS agreementName,
- pa.docking_person AS dockingPerson,
- pa.create_time AS createTime,
- pa.valid_status AS validStatus,
- eic_hz.id AS partnerCompaniesId,
- eic_hz.NAME AS partnerCompaniesName,
- pa.partner_companies_id,
- pa.agreement_name AS agreeName,
- pa.agreement_abbreviation AS agreeSimpleName,
- pa.start_date AS agreeStartDate,
- pa.end_date AS agreeEndDate,
- DATEDIFF(
- end_date,
- NOW()) AS dayStr,
- area.area_cname as areaName
- FROM
- esm_ins_company AS eic
- LEFT JOIN ptl_agreement AS pa ON pa.insurance_company_id = eic.id
- LEFT JOIN ptl_agreement_attribution AS paa ON paa.id = pa.id
- LEFT JOIN esm_ins_company eic_hz ON pa.partner_companies_id = eic_hz.id
- left join sys_area area on RPAD(SUBSTRING( pa.partner_companies_id, 6, 4 ),6,0)= area.area_code
- <where>
- ( now() BETWEEN pa.start_date AND pa.end_date )
- AND ( paa.template_id IS NOT NULL )
- AND pa.valid_status = 1
- <if test="vo.deptId !=null and vo.deptId !=''" >
- AND pa.id IN ( SELECT DISTINCT agreement_id FROM ptl_agreement_dept WHERE dept_id LIKE concat(#{vo.deptId},'%') )
- </if>
- <if test="vo.warningDay !=null and vo.warningDay !=''" >
- <choose>
- <when test="warningDay==1">
- DATEDIFF(pa.end_date,NOW()) <= 30
- </when>
- <when test="warningDay==2">
- DATEDIFF(pa.end_date,NOW()) <= 60
- </when>
- </choose>
- </if>
- <if test="vo.warningStatus !=null and vo.warningStatus !=''" >
- <choose>
- <when test="warningStatus==1">
- DATEDIFF(pa.end_date,NOW()) <= 30
- </when>
- <when test="warningStatus==2">
- DATEDIFF(pa.end_date,NOW()) > 30
- </when>
- </choose>
- </if>
- <if test="vo.areaId !=null and vo.areaId !=''" >
- AND ( pa.companies_type = 1 AND RPAD(SUBSTRING( pa.partner_companies_id, 6, 4 ),6,0) = #{vo.areaId})
- </if>
- <if test="vo.partnerCompaniesId !=null and vo.partnerCompaniesId !=''" >
- and pa.partner_companies_id =#{vo.partnerCompaniesId}
- </if>
- <if test="vo.insuranceCompanyId !=null and vo.insuranceCompanyId !=''" >
- and pa.insurance_company_id =#{vo.insuranceCompanyId}
- </if>
- </where>
- ORDER BY
- pa.serial_number
- </select>
- <select id="getInsuranceCompany" resultType="com.ydtech.modules.admin.model.report.user.agree.AgreeReportDto">
- SELECT
- a.insurance_company_id as "insuranceCompanyId",
- eic.logo as "logo",
- eic.namesimple as "namesimple"
- FROM
- `ptl_agreement` a
- LEFT JOIN esm_ins_company eic ON eic.id = a.insurance_company_id
- GROUP BY
- a.insurance_company_id
- </select>
- <select id="findCheckAgreementListNew" resultType="com.ydtech.modules.protocol.entity.po.PtlAgreement">
- select a.*,
- CONCAT_WS( '-', a.agreement_abbreviation, NULLIF(a.business_description, '' ), NULLIF(a.job_description, '' ) ) AS agreementName
- from ptl_agreement a
- order by a.agreement_code
- </select>
- </mapper>
|