<?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.yifu.cloud.plus.v1.yifu.insurances.mapper.ekp.EkpInsurancesInfoMapper">
	<resultMap id="ekpInsurancesInfoMap" type="com.yifu.cloud.plus.v1.yifu.insurances.entity.EkpInsurancesInfo">
		<id property="fd_id" column="fd_id"/>
		<result property="fd_3adfe6af71a1cc" column="fd_3adfe6af71a1cc"/>
		<result property="fd_3adfe658c6229e" column="fd_3adfe658c6229e"/>
		<result property="fd_3adfe6592b4158" column="fd_3adfe6592b4158"/>
		<result property="fd_3adfe67a9f6364" column="fd_3adfe67a9f6364"/>
		<result property="fd_3adfe6598281e8" column="fd_3adfe6598281e8"/>
		<result property="fd_3adfe7a2688902" column="fd_3adfe7a2688902"/>
		<result property="fd_3adfe67c24dace" column="fd_3adfe67c24dace"/>
		<result property="fd_3adfe65d759650" column="fd_3adfe65d759650"/>
		<result property="fd_3adfe65dbd9f68" column="fd_3adfe65dbd9f68"/>
		<result property="fd_3adfe65e0cd094" column="fd_3adfe65e0cd094"/>
		<result property="fd_3adfe65f6599e4" column="fd_3adfe65f6599e4"/>
		<result property="fd_3adfe65ea04728" column="fd_3adfe65ea04728"/>
		<result property="fd_3adfe65e60e110" column="fd_3adfe65e60e110"/>
		<result property="fd_3adfe6b7e0ede8" column="fd_3adfe6b7e0ede8"/>
		<result property="fd_3adfe6b847bfe6" column="fd_3adfe6b847bfe6"/>
		<result property="fd_3adfe6d55384c6" column="fd_3adfe6d55384c6"/>
		<result property="fd_3adfe6610c0d2c" column="fd_3adfe6610c0d2c"/>
		<result property="fd_3adfe66041a996" column="fd_3adfe66041a996"/>
		<result property="fd_3adfe6609aa810" column="fd_3adfe6609aa810"/>
		<result property="fd_3adfe6e30f2a3c" column="fd_3adfe6e30f2a3c"/>
		<result property="fd_3adfe6ec6a8cbe" column="fd_3adfe6ec6a8cbe"/>
		<result property="fd_3adfe6ef5dfaac" column="fd_3adfe6ef5dfaac"/>
		<result property="fd_3adfe79fd04606" column="fd_3adfe79fd04606"/>
		<result property="fd_3adfe7a117f086" column="fd_3adfe7a117f086"/>
		<result property="fd_3adfe6e3911ffe" column="fd_3adfe6e3911ffe"/>
		<result property="fd_3adfe6eda67236" column="fd_3adfe6eda67236"/>
		<result property="fd_3adfe6f05531ec" column="fd_3adfe6f05531ec"/>
		<result property="fd_3adfe7a035849c" column="fd_3adfe7a035849c"/>
		<result property="fd_3adfe7a08eba96" column="fd_3adfe7a08eba96"/>
		<result property="fd_3af9197b31071c" column="fd_3af9197b31071c"/>
		<result property="fd_3af9d11088facc" column="fd_3af9d11088facc"/>
		<result property="fd_3af9d1441ef7b6" column="fd_3af9d1441ef7b6"/>
		<result property="fd_3af9d15f7018fa" column="fd_3af9d15f7018fa"/>
		<result property="fd_3af9d1662141a4" column="fd_3af9d1662141a4"/>
		<result property="fd_3b0a5743acab7e" column="fd_3b0a5743acab7e"/>
		<result property="fd_3b13b3076af5a0" column="fd_3b13b3076af5a0"/>
		<result property="fd_3b13b2ecc164aa" column="fd_3b13b2ecc164aa"/>
		<result property="fd_3b16dfb32778f2_text" column="fd_3b16dfb32778f2_text"/>
		<result property="fd_3b16dfb32778f2" column="fd_3b16dfb32778f2"/>
		<result property="fd_3b178fab62d196" column="fd_3b178fab62d196"/>
		<result property="fd_3b3e4653122c9e" column="fd_3b3e4653122c9e"/>
		<result property="fd_3b5bf1628c5a68" column="fd_3b5bf1628c5a68"/>
		<result property="fd_3b5bf17f2fc25c" column="fd_3b5bf17f2fc25c"/>
		<result property="fd_3b5bf180e08fbe" column="fd_3b5bf180e08fbe"/>
		<result property="fd_3b5bf17ae91f9c" column="fd_3b5bf17ae91f9c"/>
		<result property="fd_3b5bf17c6df310" column="fd_3b5bf17c6df310"/>
		<result property="fd_3b5bf17d9297c2" column="fd_3b5bf17d9297c2"/>
		<result property="fd_3b941cbcea3e1a" column="fd_3b941cbcea3e1a"/>
		<result property="fd_3c6f0108e05c84" column="fd_3c6f0108e05c84"/>
		<result property="fd_usebpo_settle" column="fd_usebpo_settle"/>
		<result property="createTime" column="create_time"/>
	</resultMap>

	<sql id="Base_Column_List" >
		a.fd_id
		,a.fd_3adfe6af71a1cc
		,a.fd_3adfe658c6229e
		,a.fd_3adfe6592b4158
		,a.fd_3adfe67a9f6364
		,a.fd_3adfe6598281e8
		,a.fd_3adfe7a2688902
		,a.fd_3adfe67c24dace
		,a.fd_3adfe65d759650
		,a.fd_3adfe65dbd9f68
		,a.fd_3adfe65e0cd094
		,a.fd_3adfe65f6599e4
		,a.fd_3adfe65ea04728
		,a.fd_3adfe65e60e110
		,a.fd_3adfe6b7e0ede8
		,a.fd_3adfe6b847bfe6
		,a.fd_3adfe6d55384c6
		,a.fd_3adfe6610c0d2c
		,a.fd_3adfe66041a996
		,a.fd_3adfe6609aa810
		,a.fd_3adfe6e30f2a3c
		,a.fd_3adfe6ec6a8cbe
		,a.fd_3adfe6ef5dfaac
		,a.fd_3adfe79fd04606
		,a.fd_3adfe7a117f086
		,a.fd_3adfe6e3911ffe
		,a.fd_3adfe6eda67236
		,a.fd_3adfe6f05531ec
		,a.fd_3adfe7a035849c
		,a.fd_3adfe7a08eba96
		,a.fd_3af9197b31071c
		,a.fd_3af9d11088facc
		,a.fd_3af9d1441ef7b6
		,a.fd_3af9d15f7018fa
		,a.fd_3af9d1662141a4
		,a.fd_3b0a5743acab7e
		,a.fd_3b13b3076af5a0
		,a.fd_3b13b2ecc164aa
		,a.fd_3b16dfb32778f2_text
		,a.fd_3b16dfb32778f2
		,a.fd_3b178fab62d196
		,a.fd_3b3e4653122c9e
		,a.fd_3b5bf1628c5a68
		,a.fd_3b5bf17f2fc25c
		,a.fd_3b5bf180e08fbe
		,a.fd_3b5bf17ae91f9c
		,a.fd_3b5bf17c6df310
		,a.fd_3b5bf17d9297c2
		,a.fd_3b941cbcea3e1a
		,a.fd_3c6f0108e05c84
		,a.fd_usebpo_settle
		,a.create_time
	</sql>

	<!-- ekpInsurancesInfo简单分页查询 -->
	<select id="getEkpInsurancesInfoList" resultMap="ekpInsurancesInfoMap">
		SELECT
		*
		FROM ekp_insurances_info a
		where fd_3adfe6ec6a8cbe = '未结算' and fd_3b0a5743acab7e = #{detailId}
	</select>

	<select id="getEkpInsurancesInfo" resultMap="ekpInsurancesInfoMap">
		SELECT
			*
		FROM ekp_insurances_info a
		where fd_3adfe6ec6a8cbe = '未结算'
		  and fd_3adfe6af71a1cc = '实缴'
		  and fd_3b0a5743acab7e = #{detailId}
		limit 1
	</select>

	<select id="getEkpInsurancesInfoYg" resultMap="ekpInsurancesInfoMap">
		SELECT
			*
		FROM ekp_insurances_info a
		where fd_3adfe6ec6a8cbe = '未结算'
		  and fd_3adfe6af71a1cc = '预估'
		  and fd_3b0a5743acab7e = #{detailId}
			limit 1
	</select>

	<select id="getEkpInsurancesInfoNotSettle" resultMap="ekpInsurancesInfoMap">
		SELECT
			*
		FROM ekp_insurances_info a
		where fd_3adfe6eda67236 != '未结算'
		  and fd_3b0a5743acab7e = #{detailId}
	</select>

	<select id="getEkpInsurancesInfoSettle" resultMap="ekpInsurancesInfoMap">
		SELECT
			*
		FROM ekp_insurances_info a
		where fd_3adfe6eda67236 = '未结算'
		  and fd_3b0a5743acab7e = #{detailId}
	</select>

	<!-- 查找退费的商险明细，用来检查状态，是否允许登记退保，并用来新增或更新 -->
	<select id="getEkpInsurancesInfoByRefund" resultMap="ekpInsurancesInfoMap">
		SELECT
			<include refid="Base_Column_List"/>
		FROM ekp_insurances_info a
		where fd_3adfe6af71a1cc = '退费' and fd_3b0a5743acab7e = #{detailId} limit 1
	</select>

</mapper>
