<?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="org.jeecg.modules.system.app.mapper.ProtocolMapper">

    <select id="findByType" resultType="org.jeecg.modules.app.vo.agreement.AppAgreementVoResponse">
        select  * from nm_protocol where del_flag=0
        <if test="appAgreementVORequest!=null">
            <if test="appAgreementVORequest.insuranceName!=null and appAgreementVORequest.insuranceName != ''">
                and insurance_name = #{appAgreementVORequest.insuranceName}
            </if>
            <if test="appAgreementVORequest.protocolType!=null and appAgreementVORequest.protocolType != ''">
                and protocol_type = #{appAgreementVORequest.protocolType}
            </if>
        </if>
        limit 1
    </select>
    <select id="findByInsuranceName" resultType="org.jeecg.modules.system.app.entity.Protocol">
        select * from nm_protocol where del_flag=0 and insurance_name = #{insuranceName}
        <if test="id!=null and id != ''">
            and id != #{id}
        </if>
        limit 1
    </select>
</mapper>