<?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.linlinjava.jz.db.dao.ContractMasterMapper">
    <resultMap id="BaseResultMap" type="org.linlinjava.jz.db.domain.ContractMaster">
        <!--
          WARNING - @mbg.generated
          This element is automatically generated by MyBatis Generator, do not modify.
        -->
        <id column="id" jdbcType="BIGINT" property="id"/>
        <result column="master_contract_no" jdbcType="VARCHAR" property="masterContractNo"/>
        <result column="master_order_no" jdbcType="VARCHAR" property="masterOrderNo"/>
        <result column="clue_no" jdbcType="VARCHAR" property="clueNo"/>
        <result column="customer_client_id" jdbcType="BIGINT" property="customerClientId"/>
        <result column="customer_name" jdbcType="VARCHAR" property="customerName"/>
        <result column="customer_tel" jdbcType="VARCHAR" property="customerTel"/>
        <result column="customer_addr" jdbcType="VARCHAR" property="customerAddr"/>
        <result column="first_party_name" jdbcType="VARCHAR" property="firstPartyName"/>
        <result column="signer" jdbcType="VARCHAR" property="signer"/>
        <result column="agent_contractor" jdbcType="VARCHAR" property="agentContractor"/>
        <result column="signing_time" jdbcType="TIMESTAMP" property="signingTime"/>
        <result column="contract_type" jdbcType="INTEGER" property="contractType"/>
        <result column="contract_state" jdbcType="INTEGER" property="contractState"/>
        <result column="file_id" jdbcType="VARCHAR" property="fileId"/>
        <result column="service_type" jdbcType="INTEGER" property="serviceType"/>
        <result column="service_model" jdbcType="INTEGER" property="serviceModel"/>
        <result column="servant_salary" jdbcType="DOUBLE" property="servantSalary"/>
        <result column="contract_amount" jdbcType="DOUBLE" property="contractAmount"/>
        <result column="intermediary_cost" jdbcType="DOUBLE" property="intermediaryCost"/>
        <result column="payable_contract_money" jdbcType="DOUBLE" property="payableContractMoney"/>
        <result column="payment_money" jdbcType="DOUBLE" property="paymentMoney"/>
        <result column="obligations_money" jdbcType="DOUBLE" property="obligationsMoney"/>
        <result column="pay_state" jdbcType="INTEGER" property="payState"/>
        <result column="pay_time" jdbcType="TIMESTAMP" property="payTime"/>
        <result column="contract_start_date" jdbcType="DATE" property="contractStartDate"/>
        <result column="contract_end_date" jdbcType="DATE" property="contractEndDate"/>
        <result column="review_type" jdbcType="INTEGER" property="reviewType"/>
        <result column="refund_amount" jdbcType="DOUBLE" property="refundAmount"/>
        <result column="contract_terminate_date" jdbcType="DATE" property="contractTerminateDate"/>
        <result column="cancel_file_id" jdbcType="VARCHAR" property="cancelFileId"/>
        <result column="relation_pay_no" jdbcType="VARCHAR" property="relationPayNo"/>
        <result column="create_time" jdbcType="TIMESTAMP" property="createTime"/>
        <result column="create_user_id" jdbcType="BIGINT" property="createUserId"/>
        <result column="update_time" jdbcType="TIMESTAMP" property="updateTime"/>
        <result column="update_user_id" jdbcType="BIGINT" property="updateUserId"/>
        <result column="remark" jdbcType="VARCHAR" property="remark"/>
    </resultMap>
    <sql id="Example_Where_Clause">
        <!--
          WARNING - @mbg.generated
          This element is automatically generated by MyBatis Generator, do not modify.
        -->
        <where>
            <foreach collection="oredCriteria" item="criteria" separator="or">
                <if test="criteria.valid">
                    <trim prefix="(" prefixOverrides="and" suffix=")">
                        <foreach collection="criteria.criteria" item="criterion">
                            <choose>
                                <when test="criterion.noValue">
                                    and ${criterion.condition}
                                </when>
                                <when test="criterion.singleValue">
                                    and ${criterion.condition} #{criterion.value}
                                </when>
                                <when test="criterion.betweenValue">
                                    and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
                                </when>
                                <when test="criterion.listValue">
                                    and ${criterion.condition}
                                    <foreach close=")" collection="criterion.value" item="listItem" open="("
                                             separator=",">
                                        #{listItem}
                                    </foreach>
                                </when>
                            </choose>
                        </foreach>
                    </trim>
                </if>
            </foreach>
        </where>
    </sql>
    <sql id="Update_By_Example_Where_Clause">
        <!--
          WARNING - @mbg.generated
          This element is automatically generated by MyBatis Generator, do not modify.
        -->
        <where>
            <foreach collection="example.oredCriteria" item="criteria" separator="or">
                <if test="criteria.valid">
                    <trim prefix="(" prefixOverrides="and" suffix=")">
                        <foreach collection="criteria.criteria" item="criterion">
                            <choose>
                                <when test="criterion.noValue">
                                    and ${criterion.condition}
                                </when>
                                <when test="criterion.singleValue">
                                    and ${criterion.condition} #{criterion.value}
                                </when>
                                <when test="criterion.betweenValue">
                                    and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
                                </when>
                                <when test="criterion.listValue">
                                    and ${criterion.condition}
                                    <foreach close=")" collection="criterion.value" item="listItem" open="("
                                             separator=",">
                                        #{listItem}
                                    </foreach>
                                </when>
                            </choose>
                        </foreach>
                    </trim>
                </if>
            </foreach>
        </where>
    </sql>
    <sql id="Base_Column_List">
        <!--
          WARNING - @mbg.generated
          This element is automatically generated by MyBatis Generator, do not modify.
        -->
        id, master_contract_no, master_order_no, clue_no, customer_client_id, customer_name,
        customer_tel, customer_addr, first_party_name, signer, agent_contractor, signing_time,
        contract_type, contract_state, file_id, service_type, service_model, servant_salary,
        contract_amount, intermediary_cost, payable_contract_money, payment_money, obligations_money,
        pay_state, pay_time, contract_start_date, contract_end_date, review_type, refund_amount,
        contract_terminate_date, cancel_file_id, relation_pay_no, create_time, create_user_id,
        update_time, update_user_id, remark
    </sql>
    <select id="selectByExample" parameterType="org.linlinjava.jz.db.domain.ContractMasterExample"
            resultMap="BaseResultMap">
        <!--
          WARNING - @mbg.generated
          This element is automatically generated by MyBatis Generator, do not modify.
        -->
        select
        <if test="distinct">
            distinct
        </if>
        <include refid="Base_Column_List"/>
        from contract_master
        <if test="_parameter != null">
            <include refid="Example_Where_Clause"/>
        </if>
        <if test="orderByClause != null">
            order by ${orderByClause}
        </if>
    </select>
    <select id="selectByExampleSelective" parameterType="map" resultMap="BaseResultMap">
        <!--
          WARNING - @mbg.generated
          This element is automatically generated by MyBatis Generator, do not modify.
        -->
        select
        <if test="example != null and example.distinct">
            distinct
        </if>
        <choose>
            <when test="selective != null and selective.length > 0">
                <foreach collection="selective" item="column" separator=",">
                    ${column.aliasedEscapedColumnName}
                </foreach>
            </when>
            <otherwise>
                <include refid="Base_Column_List"/>
            </otherwise>
        </choose>
        from contract_master
        <if test="example != null">
            <include refid="Update_By_Example_Where_Clause"/>
        </if>
        <if test="example != null and example.orderByClause != null">
            order by ${example.orderByClause}
        </if>
    </select>
    <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
        <!--
          WARNING - @mbg.generated
          This element is automatically generated by MyBatis Generator, do not modify.
        -->
        select
        <include refid="Base_Column_List"/>
        from contract_master
        where id = #{id,jdbcType=BIGINT}
    </select>
    <select id="selectByPrimaryKeySelective" parameterType="map" resultMap="BaseResultMap">
        <!--
          WARNING - @mbg.generated
          This element is automatically generated by MyBatis Generator, do not modify.
        -->
        select
        <choose>
            <when test="selective != null and selective.length > 0">
                <foreach collection="selective" item="column" separator=",">
                    ${column.aliasedEscapedColumnName}
                </foreach>
            </when>
            <otherwise>
                <include refid="Base_Column_List"/>
            </otherwise>
        </choose>
        from contract_master
        where id = #{id,jdbcType=BIGINT}
    </select>
    <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
        <!--
          WARNING - @mbg.generated
          This element is automatically generated by MyBatis Generator, do not modify.
        -->
        delete from contract_master
        where id = #{id,jdbcType=BIGINT}
    </delete>
    <delete id="deleteByExample" parameterType="org.linlinjava.jz.db.domain.ContractMasterExample">
        <!--
          WARNING - @mbg.generated
          This element is automatically generated by MyBatis Generator, do not modify.
        -->
        delete from contract_master
        <if test="_parameter != null">
            <include refid="Example_Where_Clause"/>
        </if>
    </delete>
    <insert id="insert" parameterType="org.linlinjava.jz.db.domain.ContractMaster">
        <!--
          WARNING - @mbg.generated
          This element is automatically generated by MyBatis Generator, do not modify.
        -->
        <selectKey keyProperty="id" order="AFTER" resultType="java.lang.Long">
            SELECT LAST_INSERT_ID()
        </selectKey>
        insert into contract_master (master_contract_no, master_order_no,
        clue_no, customer_client_id, customer_name,
        customer_tel, customer_addr, first_party_name,
        signer, agent_contractor, signing_time,
        contract_type, contract_state, file_id,
        service_type, service_model, servant_salary,
        contract_amount, intermediary_cost, payable_contract_money,
        payment_money, obligations_money, pay_state,
        pay_time, contract_start_date, contract_end_date,
        review_type, refund_amount, contract_terminate_date,
        cancel_file_id, relation_pay_no, create_time,
        create_user_id, update_time, update_user_id,
        remark)
        values (#{masterContractNo,jdbcType=VARCHAR}, #{masterOrderNo,jdbcType=VARCHAR},
        #{clueNo,jdbcType=VARCHAR}, #{customerClientId,jdbcType=BIGINT}, #{customerName,jdbcType=VARCHAR},
        #{customerTel,jdbcType=VARCHAR}, #{customerAddr,jdbcType=VARCHAR}, #{firstPartyName,jdbcType=VARCHAR},
        #{signer,jdbcType=VARCHAR}, #{agentContractor,jdbcType=VARCHAR}, #{signingTime,jdbcType=TIMESTAMP},
        #{contractType,jdbcType=INTEGER}, #{contractState,jdbcType=INTEGER}, #{fileId,jdbcType=VARCHAR},
        #{serviceType,jdbcType=INTEGER}, #{serviceModel,jdbcType=INTEGER}, #{servantSalary,jdbcType=DOUBLE},
        #{contractAmount,jdbcType=DOUBLE}, #{intermediaryCost,jdbcType=DOUBLE}, #{payableContractMoney,jdbcType=DOUBLE},
        #{paymentMoney,jdbcType=DOUBLE}, #{obligationsMoney,jdbcType=DOUBLE}, #{payState,jdbcType=INTEGER},
        #{payTime,jdbcType=TIMESTAMP}, #{contractStartDate,jdbcType=DATE}, #{contractEndDate,jdbcType=DATE},
        #{reviewType,jdbcType=INTEGER}, #{refundAmount,jdbcType=DOUBLE}, #{contractTerminateDate,jdbcType=DATE},
        #{cancelFileId,jdbcType=VARCHAR}, #{relationPayNo,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP},
        #{createUserId,jdbcType=BIGINT}, #{updateTime,jdbcType=TIMESTAMP}, #{updateUserId,jdbcType=BIGINT},
        #{remark,jdbcType=VARCHAR})
    </insert>
    <insert id="insertSelective" parameterType="org.linlinjava.jz.db.domain.ContractMaster">
        <!--
          WARNING - @mbg.generated
          This element is automatically generated by MyBatis Generator, do not modify.
        -->
        <selectKey keyProperty="id" order="AFTER" resultType="java.lang.Long">
            SELECT LAST_INSERT_ID()
        </selectKey>
        insert into contract_master
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="masterContractNo != null">
                master_contract_no,
            </if>
            <if test="masterOrderNo != null">
                master_order_no,
            </if>
            <if test="clueNo != null">
                clue_no,
            </if>
            <if test="customerClientId != null">
                customer_client_id,
            </if>
            <if test="customerName != null">
                customer_name,
            </if>
            <if test="customerTel != null">
                customer_tel,
            </if>
            <if test="customerAddr != null">
                customer_addr,
            </if>
            <if test="firstPartyName != null">
                first_party_name,
            </if>
            <if test="signer != null">
                signer,
            </if>
            <if test="agentContractor != null">
                agent_contractor,
            </if>
            <if test="signingTime != null">
                signing_time,
            </if>
            <if test="contractType != null">
                contract_type,
            </if>
            <if test="contractState != null">
                contract_state,
            </if>
            <if test="fileId != null">
                file_id,
            </if>
            <if test="serviceType != null">
                service_type,
            </if>
            <if test="serviceModel != null">
                service_model,
            </if>
            <if test="servantSalary != null">
                servant_salary,
            </if>
            <if test="contractAmount != null">
                contract_amount,
            </if>
            <if test="intermediaryCost != null">
                intermediary_cost,
            </if>
            <if test="payableContractMoney != null">
                payable_contract_money,
            </if>
            <if test="paymentMoney != null">
                payment_money,
            </if>
            <if test="obligationsMoney != null">
                obligations_money,
            </if>
            <if test="payState != null">
                pay_state,
            </if>
            <if test="payTime != null">
                pay_time,
            </if>
            <if test="contractStartDate != null">
                contract_start_date,
            </if>
            <if test="contractEndDate != null">
                contract_end_date,
            </if>
            <if test="reviewType != null">
                review_type,
            </if>
            <if test="refundAmount != null">
                refund_amount,
            </if>
            <if test="contractTerminateDate != null">
                contract_terminate_date,
            </if>
            <if test="cancelFileId != null">
                cancel_file_id,
            </if>
            <if test="relationPayNo != null">
                relation_pay_no,
            </if>
            <if test="createTime != null">
                create_time,
            </if>
            <if test="createUserId != null">
                create_user_id,
            </if>
            <if test="updateTime != null">
                update_time,
            </if>
            <if test="updateUserId != null">
                update_user_id,
            </if>
            <if test="remark != null">
                remark,
            </if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="masterContractNo != null">
                #{masterContractNo,jdbcType=VARCHAR},
            </if>
            <if test="masterOrderNo != null">
                #{masterOrderNo,jdbcType=VARCHAR},
            </if>
            <if test="clueNo != null">
                #{clueNo,jdbcType=VARCHAR},
            </if>
            <if test="customerClientId != null">
                #{customerClientId,jdbcType=BIGINT},
            </if>
            <if test="customerName != null">
                #{customerName,jdbcType=VARCHAR},
            </if>
            <if test="customerTel != null">
                #{customerTel,jdbcType=VARCHAR},
            </if>
            <if test="customerAddr != null">
                #{customerAddr,jdbcType=VARCHAR},
            </if>
            <if test="firstPartyName != null">
                #{firstPartyName,jdbcType=VARCHAR},
            </if>
            <if test="signer != null">
                #{signer,jdbcType=VARCHAR},
            </if>
            <if test="agentContractor != null">
                #{agentContractor,jdbcType=VARCHAR},
            </if>
            <if test="signingTime != null">
                #{signingTime,jdbcType=TIMESTAMP},
            </if>
            <if test="contractType != null">
                #{contractType,jdbcType=INTEGER},
            </if>
            <if test="contractState != null">
                #{contractState,jdbcType=INTEGER},
            </if>
            <if test="fileId != null">
                #{fileId,jdbcType=VARCHAR},
            </if>
            <if test="serviceType != null">
                #{serviceType,jdbcType=INTEGER},
            </if>
            <if test="serviceModel != null">
                #{serviceModel,jdbcType=INTEGER},
            </if>
            <if test="servantSalary != null">
                #{servantSalary,jdbcType=DOUBLE},
            </if>
            <if test="contractAmount != null">
                #{contractAmount,jdbcType=DOUBLE},
            </if>
            <if test="intermediaryCost != null">
                #{intermediaryCost,jdbcType=DOUBLE},
            </if>
            <if test="payableContractMoney != null">
                #{payableContractMoney,jdbcType=DOUBLE},
            </if>
            <if test="paymentMoney != null">
                #{paymentMoney,jdbcType=DOUBLE},
            </if>
            <if test="obligationsMoney != null">
                #{obligationsMoney,jdbcType=DOUBLE},
            </if>
            <if test="payState != null">
                #{payState,jdbcType=INTEGER},
            </if>
            <if test="payTime != null">
                #{payTime,jdbcType=TIMESTAMP},
            </if>
            <if test="contractStartDate != null">
                #{contractStartDate,jdbcType=DATE},
            </if>
            <if test="contractEndDate != null">
                #{contractEndDate,jdbcType=DATE},
            </if>
            <if test="reviewType != null">
                #{reviewType,jdbcType=INTEGER},
            </if>
            <if test="refundAmount != null">
                #{refundAmount,jdbcType=DOUBLE},
            </if>
            <if test="contractTerminateDate != null">
                #{contractTerminateDate,jdbcType=DATE},
            </if>
            <if test="cancelFileId != null">
                #{cancelFileId,jdbcType=VARCHAR},
            </if>
            <if test="relationPayNo != null">
                #{relationPayNo,jdbcType=VARCHAR},
            </if>
            <if test="createTime != null">
                #{createTime,jdbcType=TIMESTAMP},
            </if>
            <if test="createUserId != null">
                #{createUserId,jdbcType=BIGINT},
            </if>
            <if test="updateTime != null">
                #{updateTime,jdbcType=TIMESTAMP},
            </if>
            <if test="updateUserId != null">
                #{updateUserId,jdbcType=BIGINT},
            </if>
            <if test="remark != null">
                #{remark,jdbcType=VARCHAR},
            </if>
        </trim>
    </insert>
    <select id="countByExample" parameterType="org.linlinjava.jz.db.domain.ContractMasterExample"
            resultType="java.lang.Long">
        <!--
          WARNING - @mbg.generated
          This element is automatically generated by MyBatis Generator, do not modify.
        -->
        select count(*) from contract_master
        <if test="_parameter != null">
            <include refid="Example_Where_Clause"/>
        </if>
    </select>
    <update id="updateByExampleSelective" parameterType="map">
        <!--
          WARNING - @mbg.generated
          This element is automatically generated by MyBatis Generator, do not modify.
        -->
        update contract_master
        <set>
            <if test="record.id != null">
                id = #{record.id,jdbcType=BIGINT},
            </if>
            <if test="record.masterContractNo != null">
                master_contract_no = #{record.masterContractNo,jdbcType=VARCHAR},
            </if>
            <if test="record.masterOrderNo != null">
                master_order_no = #{record.masterOrderNo,jdbcType=VARCHAR},
            </if>
            <if test="record.clueNo != null">
                clue_no = #{record.clueNo,jdbcType=VARCHAR},
            </if>
            <if test="record.customerClientId != null">
                customer_client_id = #{record.customerClientId,jdbcType=BIGINT},
            </if>
            <if test="record.customerName != null">
                customer_name = #{record.customerName,jdbcType=VARCHAR},
            </if>
            <if test="record.customerTel != null">
                customer_tel = #{record.customerTel,jdbcType=VARCHAR},
            </if>
            <if test="record.customerAddr != null">
                customer_addr = #{record.customerAddr,jdbcType=VARCHAR},
            </if>
            <if test="record.firstPartyName != null">
                first_party_name = #{record.firstPartyName,jdbcType=VARCHAR},
            </if>
            <if test="record.signer != null">
                signer = #{record.signer,jdbcType=VARCHAR},
            </if>
            <if test="record.agentContractor != null">
                agent_contractor = #{record.agentContractor,jdbcType=VARCHAR},
            </if>
            <if test="record.signingTime != null">
                signing_time = #{record.signingTime,jdbcType=TIMESTAMP},
            </if>
            <if test="record.contractType != null">
                contract_type = #{record.contractType,jdbcType=INTEGER},
            </if>
            <if test="record.contractState != null">
                contract_state = #{record.contractState,jdbcType=INTEGER},
            </if>
            <if test="record.fileId != null">
                file_id = #{record.fileId,jdbcType=VARCHAR},
            </if>
            <if test="record.serviceType != null">
                service_type = #{record.serviceType,jdbcType=INTEGER},
            </if>
            <if test="record.serviceModel != null">
                service_model = #{record.serviceModel,jdbcType=INTEGER},
            </if>
            <if test="record.servantSalary != null">
                servant_salary = #{record.servantSalary,jdbcType=DOUBLE},
            </if>
            <if test="record.contractAmount != null">
                contract_amount = #{record.contractAmount,jdbcType=DOUBLE},
            </if>
            <if test="record.intermediaryCost != null">
                intermediary_cost = #{record.intermediaryCost,jdbcType=DOUBLE},
            </if>
            <if test="record.payableContractMoney != null">
                payable_contract_money = #{record.payableContractMoney,jdbcType=DOUBLE},
            </if>
            <if test="record.paymentMoney != null">
                payment_money = #{record.paymentMoney,jdbcType=DOUBLE},
            </if>
            <if test="record.obligationsMoney != null">
                obligations_money = #{record.obligationsMoney,jdbcType=DOUBLE},
            </if>
            <if test="record.payState != null">
                pay_state = #{record.payState,jdbcType=INTEGER},
            </if>
            <if test="record.payTime != null">
                pay_time = #{record.payTime,jdbcType=TIMESTAMP},
            </if>
            <if test="record.contractStartDate != null">
                contract_start_date = #{record.contractStartDate,jdbcType=DATE},
            </if>
            <if test="record.contractEndDate != null">
                contract_end_date = #{record.contractEndDate,jdbcType=DATE},
            </if>
            <if test="record.reviewType != null">
                review_type = #{record.reviewType,jdbcType=INTEGER},
            </if>
            <if test="record.refundAmount != null">
                refund_amount = #{record.refundAmount,jdbcType=DOUBLE},
            </if>
            <if test="record.contractTerminateDate != null">
                contract_terminate_date = #{record.contractTerminateDate,jdbcType=DATE},
            </if>
            <if test="record.cancelFileId != null">
                cancel_file_id = #{record.cancelFileId,jdbcType=VARCHAR},
            </if>
            <if test="record.relationPayNo != null">
                relation_pay_no = #{record.relationPayNo,jdbcType=VARCHAR},
            </if>
            <if test="record.createTime != null">
                create_time = #{record.createTime,jdbcType=TIMESTAMP},
            </if>
            <if test="record.createUserId != null">
                create_user_id = #{record.createUserId,jdbcType=BIGINT},
            </if>
            <if test="record.updateTime != null">
                update_time = #{record.updateTime,jdbcType=TIMESTAMP},
            </if>
            <if test="record.updateUserId != null">
                update_user_id = #{record.updateUserId,jdbcType=BIGINT},
            </if>
            <if test="record.remark != null">
                remark = #{record.remark,jdbcType=VARCHAR},
            </if>
        </set>
        <if test="_parameter != null">
            <include refid="Update_By_Example_Where_Clause"/>
        </if>
    </update>
    <update id="updateByExample" parameterType="map">
        <!--
          WARNING - @mbg.generated
          This element is automatically generated by MyBatis Generator, do not modify.
        -->
        update contract_master
        set id = #{record.id,jdbcType=BIGINT},
        master_contract_no = #{record.masterContractNo,jdbcType=VARCHAR},
        master_order_no = #{record.masterOrderNo,jdbcType=VARCHAR},
        clue_no = #{record.clueNo,jdbcType=VARCHAR},
        customer_client_id = #{record.customerClientId,jdbcType=BIGINT},
        customer_name = #{record.customerName,jdbcType=VARCHAR},
        customer_tel = #{record.customerTel,jdbcType=VARCHAR},
        customer_addr = #{record.customerAddr,jdbcType=VARCHAR},
        first_party_name = #{record.firstPartyName,jdbcType=VARCHAR},
        signer = #{record.signer,jdbcType=VARCHAR},
        agent_contractor = #{record.agentContractor,jdbcType=VARCHAR},
        signing_time = #{record.signingTime,jdbcType=TIMESTAMP},
        contract_type = #{record.contractType,jdbcType=INTEGER},
        contract_state = #{record.contractState,jdbcType=INTEGER},
        file_id = #{record.fileId,jdbcType=VARCHAR},
        service_type = #{record.serviceType,jdbcType=INTEGER},
        service_model = #{record.serviceModel,jdbcType=INTEGER},
        servant_salary = #{record.servantSalary,jdbcType=DOUBLE},
        contract_amount = #{record.contractAmount,jdbcType=DOUBLE},
        intermediary_cost = #{record.intermediaryCost,jdbcType=DOUBLE},
        payable_contract_money = #{record.payableContractMoney,jdbcType=DOUBLE},
        payment_money = #{record.paymentMoney,jdbcType=DOUBLE},
        obligations_money = #{record.obligationsMoney,jdbcType=DOUBLE},
        pay_state = #{record.payState,jdbcType=INTEGER},
        pay_time = #{record.payTime,jdbcType=TIMESTAMP},
        contract_start_date = #{record.contractStartDate,jdbcType=DATE},
        contract_end_date = #{record.contractEndDate,jdbcType=DATE},
        review_type = #{record.reviewType,jdbcType=INTEGER},
        refund_amount = #{record.refundAmount,jdbcType=DOUBLE},
        contract_terminate_date = #{record.contractTerminateDate,jdbcType=DATE},
        cancel_file_id = #{record.cancelFileId,jdbcType=VARCHAR},
        relation_pay_no = #{record.relationPayNo,jdbcType=VARCHAR},
        create_time = #{record.createTime,jdbcType=TIMESTAMP},
        create_user_id = #{record.createUserId,jdbcType=BIGINT},
        update_time = #{record.updateTime,jdbcType=TIMESTAMP},
        update_user_id = #{record.updateUserId,jdbcType=BIGINT},
        remark = #{record.remark,jdbcType=VARCHAR}
        <if test="_parameter != null">
            <include refid="Update_By_Example_Where_Clause"/>
        </if>
    </update>
    <update id="updateByPrimaryKeySelective" parameterType="org.linlinjava.jz.db.domain.ContractMaster">
        <!--
          WARNING - @mbg.generated
          This element is automatically generated by MyBatis Generator, do not modify.
        -->
        update contract_master
        <set>
            <if test="masterContractNo != null">
                master_contract_no = #{masterContractNo,jdbcType=VARCHAR},
            </if>
            <if test="masterOrderNo != null">
                master_order_no = #{masterOrderNo,jdbcType=VARCHAR},
            </if>
            <if test="clueNo != null">
                clue_no = #{clueNo,jdbcType=VARCHAR},
            </if>
            <if test="customerClientId != null">
                customer_client_id = #{customerClientId,jdbcType=BIGINT},
            </if>
            <if test="customerName != null">
                customer_name = #{customerName,jdbcType=VARCHAR},
            </if>
            <if test="customerTel != null">
                customer_tel = #{customerTel,jdbcType=VARCHAR},
            </if>
            <if test="customerAddr != null">
                customer_addr = #{customerAddr,jdbcType=VARCHAR},
            </if>
            <if test="firstPartyName != null">
                first_party_name = #{firstPartyName,jdbcType=VARCHAR},
            </if>
            <if test="signer != null">
                signer = #{signer,jdbcType=VARCHAR},
            </if>
            <if test="agentContractor != null">
                agent_contractor = #{agentContractor,jdbcType=VARCHAR},
            </if>
            <if test="signingTime != null">
                signing_time = #{signingTime,jdbcType=TIMESTAMP},
            </if>
            <if test="contractType != null">
                contract_type = #{contractType,jdbcType=INTEGER},
            </if>
            <if test="contractState != null">
                contract_state = #{contractState,jdbcType=INTEGER},
            </if>
            <if test="fileId != null">
                file_id = #{fileId,jdbcType=VARCHAR},
            </if>
            <if test="serviceType != null">
                service_type = #{serviceType,jdbcType=INTEGER},
            </if>
            <if test="serviceModel != null">
                service_model = #{serviceModel,jdbcType=INTEGER},
            </if>
            <if test="servantSalary != null">
                servant_salary = #{servantSalary,jdbcType=DOUBLE},
            </if>
            <if test="contractAmount != null">
                contract_amount = #{contractAmount,jdbcType=DOUBLE},
            </if>
            <if test="intermediaryCost != null">
                intermediary_cost = #{intermediaryCost,jdbcType=DOUBLE},
            </if>
            <if test="payableContractMoney != null">
                payable_contract_money = #{payableContractMoney,jdbcType=DOUBLE},
            </if>
            <if test="paymentMoney != null">
                payment_money = #{paymentMoney,jdbcType=DOUBLE},
            </if>
            <if test="obligationsMoney != null">
                obligations_money = #{obligationsMoney,jdbcType=DOUBLE},
            </if>
            <if test="payState != null">
                pay_state = #{payState,jdbcType=INTEGER},
            </if>
            <if test="payTime != null">
                pay_time = #{payTime,jdbcType=TIMESTAMP},
            </if>
            <if test="contractStartDate != null">
                contract_start_date = #{contractStartDate,jdbcType=DATE},
            </if>
            <if test="contractEndDate != null">
                contract_end_date = #{contractEndDate,jdbcType=DATE},
            </if>
            <if test="reviewType != null">
                review_type = #{reviewType,jdbcType=INTEGER},
            </if>
            <if test="refundAmount != null">
                refund_amount = #{refundAmount,jdbcType=DOUBLE},
            </if>
            <if test="contractTerminateDate != null">
                contract_terminate_date = #{contractTerminateDate,jdbcType=DATE},
            </if>
            <if test="cancelFileId != null">
                cancel_file_id = #{cancelFileId,jdbcType=VARCHAR},
            </if>
            <if test="relationPayNo != null">
                relation_pay_no = #{relationPayNo,jdbcType=VARCHAR},
            </if>
            <if test="createTime != null">
                create_time = #{createTime,jdbcType=TIMESTAMP},
            </if>
            <if test="createUserId != null">
                create_user_id = #{createUserId,jdbcType=BIGINT},
            </if>
            <if test="updateTime != null">
                update_time = #{updateTime,jdbcType=TIMESTAMP},
            </if>
            <if test="updateUserId != null">
                update_user_id = #{updateUserId,jdbcType=BIGINT},
            </if>
            <if test="remark != null">
                remark = #{remark,jdbcType=VARCHAR},
            </if>
        </set>
        where id = #{id,jdbcType=BIGINT}
    </update>
    <update id="updateByPrimaryKey" parameterType="org.linlinjava.jz.db.domain.ContractMaster">
        <!--
          WARNING - @mbg.generated
          This element is automatically generated by MyBatis Generator, do not modify.
        -->
        update contract_master
        set master_contract_no = #{masterContractNo,jdbcType=VARCHAR},
        master_order_no = #{masterOrderNo,jdbcType=VARCHAR},
        clue_no = #{clueNo,jdbcType=VARCHAR},
        customer_client_id = #{customerClientId,jdbcType=BIGINT},
        customer_name = #{customerName,jdbcType=VARCHAR},
        customer_tel = #{customerTel,jdbcType=VARCHAR},
        customer_addr = #{customerAddr,jdbcType=VARCHAR},
        first_party_name = #{firstPartyName,jdbcType=VARCHAR},
        signer = #{signer,jdbcType=VARCHAR},
        agent_contractor = #{agentContractor,jdbcType=VARCHAR},
        signing_time = #{signingTime,jdbcType=TIMESTAMP},
        contract_type = #{contractType,jdbcType=INTEGER},
        contract_state = #{contractState,jdbcType=INTEGER},
        file_id = #{fileId,jdbcType=VARCHAR},
        service_type = #{serviceType,jdbcType=INTEGER},
        service_model = #{serviceModel,jdbcType=INTEGER},
        servant_salary = #{servantSalary,jdbcType=DOUBLE},
        contract_amount = #{contractAmount,jdbcType=DOUBLE},
        intermediary_cost = #{intermediaryCost,jdbcType=DOUBLE},
        payable_contract_money = #{payableContractMoney,jdbcType=DOUBLE},
        payment_money = #{paymentMoney,jdbcType=DOUBLE},
        obligations_money = #{obligationsMoney,jdbcType=DOUBLE},
        pay_state = #{payState,jdbcType=INTEGER},
        pay_time = #{payTime,jdbcType=TIMESTAMP},
        contract_start_date = #{contractStartDate,jdbcType=DATE},
        contract_end_date = #{contractEndDate,jdbcType=DATE},
        review_type = #{reviewType,jdbcType=INTEGER},
        refund_amount = #{refundAmount,jdbcType=DOUBLE},
        contract_terminate_date = #{contractTerminateDate,jdbcType=DATE},
        cancel_file_id = #{cancelFileId,jdbcType=VARCHAR},
        relation_pay_no = #{relationPayNo,jdbcType=VARCHAR},
        create_time = #{createTime,jdbcType=TIMESTAMP},
        create_user_id = #{createUserId,jdbcType=BIGINT},
        update_time = #{updateTime,jdbcType=TIMESTAMP},
        update_user_id = #{updateUserId,jdbcType=BIGINT},
        remark = #{remark,jdbcType=VARCHAR}
        where id = #{id,jdbcType=BIGINT}
    </update>
    <select id="selectOneByExample" parameterType="org.linlinjava.jz.db.domain.ContractMasterExample"
            resultMap="BaseResultMap">
        <!--
          WARNING - @mbg.generated
          This element is automatically generated by MyBatis Generator, do not modify.
        -->
        select
        <include refid="Base_Column_List"/>
        from contract_master
        <if test="_parameter != null">
            <include refid="Example_Where_Clause"/>
        </if>
        <if test="orderByClause != null">
            order by ${orderByClause}
        </if>
        limit 1
    </select>
    <select id="selectOneByExampleSelective" parameterType="map" resultMap="BaseResultMap">
        <!--
          WARNING - @mbg.generated
          This element is automatically generated by MyBatis Generator, do not modify.
        -->
        select
        <choose>
            <when test="selective != null and selective.length > 0">
                <foreach collection="selective" item="column" separator=",">
                    ${column.aliasedEscapedColumnName}
                </foreach>
            </when>
            <otherwise>
                <include refid="Base_Column_List"/>
            </otherwise>
        </choose>
        from contract_master
        <if test="example != null">
            <include refid="Update_By_Example_Where_Clause"/>
        </if>
        <if test="example != null and example.orderByClause != null">
            order by ${example.orderByClause}
        </if>
        limit 1
    </select>
    <select id="selectByOrderNo" resultType="java.util.Map">
        SELECT m.`service_model`,
               m.`contract_amount`,
               m.`contract_start_date`,
               m.`contract_end_date`,
               m.`master_order_no`,
               m.contract_state,
               (SELECT user_name
                FROM `sys_user`
                WHERE id =
                      (SELECT `charge_id`
                       FROM `customer_order_charge`
                       WHERE order_no = m.`master_order_no`
                         AND state = 0))     AS charge_name,
               (SELECT city_name
                FROM `sys_city`
                WHERE id = c.`service_city`) AS city_name
        FROM `contract_master` m
                 LEFT JOIN `customer_clue` c
                           ON m.`clue_no` = c.`clue_no`
        WHERE m.`master_order_no` = #{orderNo}
    </select>
</mapper>