|
@@ -26,8 +26,10 @@
|
|
|
<result property="createTime" column="create_time" />
|
|
|
<result property="updateBy" column="update_by" />
|
|
|
<result property="updateTime" column="update_time" />
|
|
|
+ <result property="latestApplicationId" column="latest_application_id"/>
|
|
|
+ <result property="companyId" column="company_id"/>
|
|
|
<association property="agent" column="agent_id" select="com.jpsoft.picc.modules.base.dao.InsuranceAgentDAO.get"></association>
|
|
|
- </resultMap>
|
|
|
+ </resultMap>
|
|
|
<insert id="insert" parameterType="com.jpsoft.picc.modules.business.entity.InsurancePolicy">
|
|
|
<!--
|
|
|
<selectKey resultType="java.lang.String" order="BEFORE" keyProperty="id">
|
|
@@ -38,7 +40,8 @@
|
|
|
insert into business_insurance_policy
|
|
|
(id_,definition_id,status_,process_status,insurance_fee,start_time,end_time,
|
|
|
number_,account_bank,issuing_bank,singl_number,transfer_time,
|
|
|
- agent_id,insurance_policy_file,no_,effective_date,del_flag,create_by,create_time,update_by,update_time)
|
|
|
+ agent_id,insurance_policy_file,no_,effective_date,del_flag,create_by,create_time,update_by,update_time,
|
|
|
+ company_id,latest_application_id)
|
|
|
values
|
|
|
(
|
|
|
#{id,jdbcType=VARCHAR}
|
|
@@ -62,6 +65,8 @@
|
|
|
,#{createTime,jdbcType= TIMESTAMP }
|
|
|
,#{updateBy,jdbcType=VARCHAR}
|
|
|
,#{updateTime,jdbcType= TIMESTAMP }
|
|
|
+ ,#{companyId,jdbcType=VARCHAR}
|
|
|
+ ,#{latestApplicationId,jdbcType=VARCHAR}
|
|
|
)
|
|
|
]]>
|
|
|
</insert>
|
|
@@ -131,6 +136,12 @@
|
|
|
<if test="updateTime!=null">
|
|
|
update_time=#{updateTime,jdbcType= TIMESTAMP },
|
|
|
</if>
|
|
|
+ <if test="companyId!=null">
|
|
|
+ company_id=#{companyId,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="latestApplicationId!=null">
|
|
|
+ latest_application_id=#{latestApplicationId,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
</set>
|
|
|
where id_=#{id}
|
|
|
</update>
|
|
@@ -145,22 +156,38 @@
|
|
|
</select>
|
|
|
<select id="search" parameterType="hashmap" resultMap="InsurancePolicyMap">
|
|
|
<![CDATA[
|
|
|
- SELECT a.* FROM business_insurance_policy a LEFT JOIN business_application_policy b ON a.id_ = b.policy_id
|
|
|
+ SELECT
|
|
|
+ a.id_ as policy_id,
|
|
|
+ a.latest_application_id as application_id
|
|
|
+ from business_insurance_policy a,business_insurance_application b
|
|
|
]]>
|
|
|
<where>
|
|
|
- <if test="searchParams.delFlag != null">
|
|
|
- and a.del_flag = #{searchParams.delFlag}
|
|
|
- </if>
|
|
|
- <if test="searchParams.applicationId != null">
|
|
|
- and b.application_id like #{searchParams.applicationId}
|
|
|
+ and a.latest_application_id = b.id_
|
|
|
+ and a.del_flag = false and no_ > 1
|
|
|
+ <if test="searchParams.definitionId != null">
|
|
|
+ and a.definition_id = #{searchParams.definitionId}
|
|
|
</if>
|
|
|
<if test="searchParams.status != null">
|
|
|
- and b.status_ like #{searchParams.status}
|
|
|
+ and a.status_ = #{searchParams.status}
|
|
|
+ </if>
|
|
|
+ <if test="searchParams.userType != null">
|
|
|
+ and (a.status_='30' or a.status_='60' or a.status_='70')
|
|
|
+ </if>
|
|
|
+ <if test="searchParams.startTime != null">
|
|
|
+ <![CDATA[
|
|
|
+ and a.start_time >= #{searchParams.startTime}
|
|
|
+ ]]>
|
|
|
+ </if>
|
|
|
+ <if test="searchParams.endTime != null">
|
|
|
+ <![CDATA[
|
|
|
+ and a.start_time <= #{searchParams.endTime}
|
|
|
+ ]]>
|
|
|
+ </if>
|
|
|
+ <if test="searchParams.companyName != null">
|
|
|
+ and b.company_name = #{searchParams.companyName}
|
|
|
</if>
|
|
|
- <if test="searchParams.ids != null">
|
|
|
- <foreach item="id" collection="ids" open=" " separator=" ">
|
|
|
- or a.id_ = ${id}
|
|
|
- </foreach>
|
|
|
+ <if test="searchParams.insuredName != null">
|
|
|
+ and b.insured_name = #{searchParams.insuredName}
|
|
|
</if>
|
|
|
</where>
|
|
|
<foreach item="sort" collection="sortList" open="order by" separator=",">
|
|
@@ -186,11 +213,7 @@
|
|
|
<where>
|
|
|
del_flag=0 and no_>1
|
|
|
<if test="searchParams.companyId != null">
|
|
|
- and id_ in(
|
|
|
- select b.policy_id from business_insurance_application a,business_application_policy b
|
|
|
- where a.id_=b.application_id
|
|
|
- and a.company_id = #{searchParams.companyId}
|
|
|
- )
|
|
|
+ and company_id = #{searchParams.companyId}
|
|
|
</if>
|
|
|
<if test="searchParams.status != null">
|
|
|
and status_ = #{searchParams.status}
|