InsureApplicantMapper.xml 13.4 KB
Newer Older
翁国栋 committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
<?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="cn.timer.api.dao.insure.InsureApplicantMapper">

    <!-- 可根据自己的需求,是否要使用 -->
    <resultMap type="cn.timer.api.bean.insure.InsureApplicant" id="insureApplicantMap">
        <result property="id" column="id"/>
        <result property="applicantEName" column="applicant_e_name"/>
        <result property="applicantEAddress" column="applicant_e_address"/>
        <result property="applicantEmployeeList" column="applicant_employee_list"/>
        <result property="applicantEContacts" column="applicant_e_contacts"/>
        <result property="applicantEPhone" column="applicant_e_phone"/>
        <result property="applicantENoType" column="applicant_e_no_type"/>
        <result property="applicantENo" column="applicant_e_no"/>
        <result property="applicantEMail" column="applicant_e_mail"/>
        <result property="applicantProvinceCity" column="applicant_province_city"/>
        <result property="applicantInvoiceReceivingAddress" column="applicant_invoice_receiving_address"/>
        <result property="applicantInvoiceBillingPhone" column="applicant_invoice_billing_phone"/>
        <result property="applicantBusinessBankName" column="applicant_business_bank_name"/>
        <result property="policyNo" column="policy_no"/>
        <result property="applicantType" column="applicant_type"/>
        <result property="transId" column="trans_id"/>
        <result property="currency" column="currency"/>
        <result property="applicantInvoicedAmount" column="applicant_invoiced_amount"/>
翁国栋 committed
26
        <result property="applicantCorporateBankAccount" column="applicant_corporate_bank_account"/>
翁国栋 committed
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148
    </resultMap>

    <select id="queryObject" resultType="cn.timer.api.bean.insure.InsureApplicant">
        select *
        from insure_applicant
        where id = #{value}
    </select>

    <select id="queryList" resultType="cn.timer.api.bean.insure.InsureApplicant">
        select * from insure_applicant
        <where>
            <if test="applicantEName != null and applicantEName != ''">AND `applicant_e_name` = #{applicantEName}</if>
            <if test="applicantEAddress != null and applicantEAddress != ''">AND `applicant_e_address` =
                #{applicantEAddress}
            </if>
            <if test="applicantEmployeeList != null and applicantEmployeeList != ''">AND `applicant_employee_list` =
                #{applicantEmployeeList}
            </if>
            <if test="applicantEContacts != null and applicantEContacts != ''">AND `applicant_e_contacts` =
                #{applicantEContacts}
            </if>
            <if test="applicantEPhone != null and applicantEPhone != ''">AND `applicant_e_phone` = #{applicantEPhone}
            </if>
            <if test="applicantENoType != null and applicantENoType != ''">AND `applicant_e_no_type` =
                #{applicantENoType}
            </if>
            <if test="applicantENo != null and applicantENo != ''">AND `applicant_e_no` = #{applicantENo}</if>
            <if test="applicantEMail != null and applicantEMail != ''">AND `applicant_e_mail` = #{applicantEMail}</if>
            <if test="applicantProvinceCity != null and applicantProvinceCity != ''">AND `applicant_province_city` =
                #{applicantProvinceCity}
            </if>
            <if test="applicantInvoiceReceivingAddress != null and applicantInvoiceReceivingAddress != ''">AND
                `applicant_invoice_receiving_address` = #{applicantInvoiceReceivingAddress}
            </if>
            <if test="applicantInvoiceBillingPhone != null and applicantInvoiceBillingPhone != ''">AND
                `applicant_invoice_billing_phone` = #{applicantInvoiceBillingPhone}
            </if>
            <if test="applicantBusinessBankName != null and applicantBusinessBankName != ''">AND
                `applicant_business_bank_name` = #{applicantBusinessBankName}
            </if>
            <if test="policyNo != null and policyNo != ''">AND `policy_no` = #{policyNo}</if>
            <if test="applicantType != null and applicantType != ''">AND `applicant_type` = #{applicantType}</if>
            <if test="transId != null and transId != ''">AND `trans_id` = #{transId}</if>
            <if test="currency != null and currency != ''">AND `currency` = #{currency}</if>
            <if test="applicantInvoicedAmount != null and applicantInvoicedAmount != ''">AND `applicant_invoiced_amount`
                = #{applicantInvoicedAmount}
            </if>
        </where>
        <choose>
            <when test="sidx != null and sidx.trim() != ''">
                order by ${sidx} ${order}
            </when>
            <otherwise>
                order by id desc
            </otherwise>
        </choose>
        <if test="offset != null and limit != null">
            limit #{offset}, #{limit}
        </if>
    </select>

    <select id="queryTotal" resultType="int">
        select count(*) from insure_applicant
        <where>
            <if test="applicantEName != null and applicantEName != ''">AND `applicant_e_name` = #{applicantEName}</if>
            <if test="applicantEAddress != null and applicantEAddress != ''">AND `applicant_e_address` =
                #{applicantEAddress}
            </if>
            <if test="applicantEmployeeList != null and applicantEmployeeList != ''">AND `applicant_employee_list` =
                #{applicantEmployeeList}
            </if>
            <if test="applicantEContacts != null and applicantEContacts != ''">AND `applicant_e_contacts` =
                #{applicantEContacts}
            </if>
            <if test="applicantEPhone != null and applicantEPhone != ''">AND `applicant_e_phone` = #{applicantEPhone}
            </if>
            <if test="applicantENoType != null and applicantENoType != ''">AND `applicant_e_no_type` =
                #{applicantENoType}
            </if>
            <if test="applicantENo != null and applicantENo != ''">AND `applicant_e_no` = #{applicantENo}</if>
            <if test="applicantEMail != null and applicantEMail != ''">AND `applicant_e_mail` = #{applicantEMail}</if>
            <if test="applicantProvinceCity != null and applicantProvinceCity != ''">AND `applicant_province_city` =
                #{applicantProvinceCity}
            </if>
            <if test="applicantInvoiceReceivingAddress != null and applicantInvoiceReceivingAddress != ''">AND
                `applicant_invoice_receiving_address` = #{applicantInvoiceReceivingAddress}
            </if>
            <if test="applicantInvoiceBillingPhone != null and applicantInvoiceBillingPhone != ''">AND
                `applicant_invoice_billing_phone` = #{applicantInvoiceBillingPhone}
            </if>
            <if test="applicantBusinessBankName != null and applicantBusinessBankName != ''">AND
                `applicant_business_bank_name` = #{applicantBusinessBankName}
            </if>
            <if test="policyNo != null and policyNo != ''">AND `policy_no` = #{policyNo}</if>
            <if test="applicantType != null and applicantType != ''">AND `applicant_type` = #{applicantType}</if>
            <if test="transId != null and transId != ''">AND `trans_id` = #{transId}</if>
            <if test="currency != null and currency != ''">AND `currency` = #{currency}</if>
            <if test="applicantInvoicedAmount != null and applicantInvoicedAmount != ''">AND `applicant_invoiced_amount`
                = #{applicantInvoicedAmount}
            </if>
        </where>
    </select>

    <insert id="save" parameterType="cn.timer.api.bean.insure.InsureApplicant" useGeneratedKeys="true"
            keyProperty="id">
        insert into insure_applicant
        (`applicant_e_name`,
         `applicant_e_address`,
         `applicant_employee_list`,
         `applicant_e_contacts`,
         `applicant_e_phone`,
         `applicant_e_no_type`,
         `applicant_e_no`,
         `applicant_e_mail`,
         `applicant_province_city`,
         `applicant_invoice_receiving_address`,
         `applicant_invoice_billing_phone`,
         `applicant_business_bank_name`,
         `policy_no`,
         `applicant_type`,
         `trans_id`,
         `currency`,
翁国栋 committed
149 150
         `applicant_invoiced_amount`,
         `applicant_corporate_bank_account`)
翁国栋 committed
151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166
        values (#{applicantEName},
                #{applicantEAddress},
                #{applicantEmployeeList},
                #{applicantEContacts},
                #{applicantEPhone},
                #{applicantENoType},
                #{applicantENo},
                #{applicantEMail},
                #{applicantProvinceCity},
                #{applicantInvoiceReceivingAddress},
                #{applicantInvoiceBillingPhone},
                #{applicantBusinessBankName},
                #{policyNo},
                #{applicantType},
                #{transId},
                #{currency},
翁国栋 committed
167
                #{applicantCorporateBankAccount})
翁国栋 committed
168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190
    </insert>

    <insert id="saveSelective" parameterType="cn.timer.api.bean.insure.InsureApplicant" useGeneratedKeys="true"
            keyProperty="id">
        insert into insure_applicant
        (
        <if test="applicantEName != null">,`applicant_e_name`</if>
        <if test="applicantEAddress != null">,`applicant_e_address`</if>
        <if test="applicantEmployeeList != null">,`applicant_employee_list`</if>
        <if test="applicantEContacts != null">,`applicant_e_contacts`</if>
        <if test="applicantEPhone != null">,`applicant_e_phone`</if>
        <if test="applicantENoType != null">,`applicant_e_no_type`</if>
        <if test="applicantENo != null">,`applicant_e_no`</if>
        <if test="applicantEMail != null">,`applicant_e_mail`</if>
        <if test="applicantProvinceCity != null">,`applicant_province_city`</if>
        <if test="applicantInvoiceReceivingAddress != null">,`applicant_invoice_receiving_address`</if>
        <if test="applicantInvoiceBillingPhone != null">,`applicant_invoice_billing_phone`</if>
        <if test="applicantBusinessBankName != null">,`applicant_business_bank_name`</if>
        <if test="policyNo != null">,`policy_no`</if>
        <if test="applicantType != null">,`applicant_type`</if>
        <if test="transId != null">,`trans_id`</if>
        <if test="currency != null">,`currency`</if>
        <if test="applicantInvoicedAmount != null">,`applicant_invoiced_amount`</if>
翁国栋 committed
191
        <if test="applicantCorporateBankAccount != null">,`applicant_corporate_bank_account`</if>
翁国栋 committed
192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210
        )
        values
        (
        <if test="applicantEName != null">,#{applicantEName}</if>
        <if test="applicantEAddress != null">,#{applicantEAddress}</if>
        <if test="applicantEmployeeList != null">,#{applicantEmployeeList}</if>
        <if test="applicantEContacts != null">,#{applicantEContacts}</if>
        <if test="applicantEPhone != null">,#{applicantEPhone}</if>
        <if test="applicantENoType != null">,#{applicantENoType}</if>
        <if test="applicantENo != null">,#{applicantENo}</if>
        <if test="applicantEMail != null">,#{applicantEMail}</if>
        <if test="applicantProvinceCity != null">,#{applicantProvinceCity}</if>
        <if test="applicantInvoiceReceivingAddress != null">,#{applicantInvoiceReceivingAddress}</if>
        <if test="applicantInvoiceBillingPhone != null">,#{applicantInvoiceBillingPhone}</if>
        <if test="applicantBusinessBankName != null">,#{applicantBusinessBankName}</if>
        <if test="policyNo != null">,#{policyNo}</if>
        <if test="applicantType != null">,#{applicantType}</if>
        <if test="transId != null">,#{transId}</if>
        <if test="currency != null">,#{currency}</if>
翁国栋 committed
211
        <if test="applicantCorporateBankAccount != null">,#{applicantCorporateBankAccount}</if>
翁国栋 committed
212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269
        )
    </insert>


    <insert id="saveList" parameterType="cn.timer.api.bean.insure.InsureApplicant" useGeneratedKeys="true"
            keyProperty="id">
        insert into insure_applicant
        (
        `applicant_e_name`,
        `applicant_e_address`,
        `applicant_employee_list`,
        `applicant_e_contacts`,
        `applicant_e_phone`,
        `applicant_e_no_type`,
        `applicant_e_no`,
        `applicant_e_mail`,
        `applicant_province_city`,
        `applicant_invoice_receiving_address`,
        `applicant_invoice_billing_phone`,
        `applicant_business_bank_name`,
        `policy_no`,
        `applicant_type`,
        `trans_id`,
        `currency`,
        `applicant_invoiced_amount`
        )
        values
        <foreach collection="list" item="item" index="index" separator=",">
            (
            #{item.applicantEName},
            #{item.applicantEAddress},
            #{item.applicantEmployeeList},
            #{item.applicantEContacts},
            #{item.applicantEPhone},
            #{item.applicantENoType},
            #{item.applicantENo},
            #{item.applicantEMail},
            #{item.applicantProvinceCity},
            #{item.applicantInvoiceReceivingAddress},
            #{item.applicantInvoiceBillingPhone},
            #{item.applicantBusinessBankName},
            #{item.policyNo},
            #{item.applicantType},
            #{item.transId},
            #{item.currency},
            #{item.applicantInvoicedAmount}
            )
        </foreach>
    </insert>

    <delete id="deleteBatch">
        delete from insure_applicant where id in
        <foreach item="id" collection="array" open="(" separator="," close=")">
            #{id}
        </foreach>
    </delete>

</mapper>