<?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.ContractSubTemplateMapper">
    <resultMap id="BaseResultMap" type="org.linlinjava.jz.db.domain.ContractSubTemplate">
        <!--
          WARNING - @mbg.generated
          This element is automatically generated by MyBatis Generator, do not modify.
        -->
        <id column="id" jdbcType="BIGINT" property="id"/>
        <result column="order_no" jdbcType="VARCHAR" property="orderNo"/>
        <result column="sub_contract_no" jdbcType="VARCHAR" property="subContractNo"/>
        <result column="service_address" jdbcType="VARCHAR" property="serviceAddress"/>
        <result column="service_term" jdbcType="VARCHAR" property="serviceTerm"/>
        <result column="service_start_time" jdbcType="TIMESTAMP" property="serviceStartTime"/>
        <result column="service_end_time" jdbcType="TIMESTAMP" property="serviceEndTime"/>
        <result column="day_work_time" jdbcType="TIMESTAMP" property="dayWorkTime"/>
        <result column="month_rest_days" jdbcType="INTEGER" property="monthRestDays"/>
        <result column="off_day" jdbcType="VARCHAR" property="offDay"/>
        <result column="monthly_salary" jdbcType="DECIMAL" property="monthlySalary"/>
        <result column="day_salary" jdbcType="DECIMAL" property="daySalary"/>
        <result column="hourly_salary" jdbcType="DECIMAL" property="hourlySalary"/>
        <result column="off_multiple" jdbcType="REAL" property="offMultiple"/>
        <result column="worker_multiple" jdbcType="REAL" property="workerMultiple"/>
        <result column="payday" jdbcType="INTEGER" property="payday"/>
        <result column="create_time" jdbcType="TIMESTAMP" property="createTime"/>
    </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, order_no, sub_contract_no, service_address, service_term, service_start_time,
        service_end_time,day_work_time, month_rest_days, off_day, monthly_salary, day_salary, hourly_salary,
        off_multiple, worker_multiple, payday, create_time
    </sql>
    <select id="selectByExample" parameterType="org.linlinjava.jz.db.domain.ContractSubTemplateExample"
            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_sub_template
        <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 &gt; 0">
                <foreach collection="selective" item="column" separator=",">
                    ${column.aliasedEscapedColumnName}
                </foreach>
            </when>
            <otherwise>
                <include refid="Base_Column_List"/>
            </otherwise>
        </choose>
        from contract_sub_template
        <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_sub_template
        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 &gt; 0">
                <foreach collection="selective" item="column" separator=",">
                    ${column.aliasedEscapedColumnName}
                </foreach>
            </when>
            <otherwise>
                <include refid="Base_Column_List"/>
            </otherwise>
        </choose>
        from contract_sub_template
        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_sub_template
        where id = #{id,jdbcType=BIGINT}
    </delete>
    <delete id="deleteByExample" parameterType="org.linlinjava.jz.db.domain.ContractSubTemplateExample">
        <!--
          WARNING - @mbg.generated
          This element is automatically generated by MyBatis Generator, do not modify.
        -->
        delete from contract_sub_template
        <if test="_parameter != null">
            <include refid="Example_Where_Clause"/>
        </if>
    </delete>
    <insert id="insert" parameterType="org.linlinjava.jz.db.domain.ContractSubTemplate">
        <!--
          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_sub_template (order_no, sub_contract_no, service_address,
        service_term, service_start_time, service_end_time,
        month_rest_days, off_day, monthly_salary,
        day_salary, hourly_salary, off_multiple,
        worker_multiple, payday, create_time
        )
        values (#{orderNo,jdbcType=VARCHAR}, #{subContractNo,jdbcType=VARCHAR}, #{serviceAddress,jdbcType=VARCHAR},
        #{serviceTerm,jdbcType=VARCHAR}, #{serviceStartTime,jdbcType=TIMESTAMP}, #{serviceEndTime,jdbcType=TIMESTAMP},
        #{monthRestDays,jdbcType=INTEGER}, #{offDay,jdbcType=VARCHAR}, #{monthlySalary,jdbcType=DECIMAL},
        #{daySalary,jdbcType=DECIMAL}, #{hourlySalary,jdbcType=DECIMAL}, #{offMultiple,jdbcType=REAL},
        #{workerMultiple,jdbcType=REAL}, #{payday,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP}
        )
    </insert>
    <insert id="insertSelective" parameterType="org.linlinjava.jz.db.domain.ContractSubTemplate">
        <!--
          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_sub_template
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="orderNo != null">
                order_no,
            </if>
            <if test="subContractNo != null">
                sub_contract_no,
            </if>
            <if test="serviceAddress != null">
                service_address,
            </if>
            <if test="serviceTerm != null">
                service_term,
            </if>
            <if test="serviceStartTime != null">
                service_start_time,
            </if>
            <if test="serviceEndTime != null">
                service_end_time,
            </if>
            <if test="monthRestDays != null">
                month_rest_days,
            </if>
            <if test="offDay != null">
                off_day,
            </if>
            <if test="monthlySalary != null">
                monthly_salary,
            </if>
            <if test="daySalary != null">
                day_salary,
            </if>
            <if test="hourlySalary != null">
                hourly_salary,
            </if>
            <if test="offMultiple != null">
                off_multiple,
            </if>
            <if test="workerMultiple != null">
                worker_multiple,
            </if>
            <if test="payday != null">
                payday,
            </if>
            <if test="createTime != null">
                create_time,
            </if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="orderNo != null">
                #{orderNo,jdbcType=VARCHAR},
            </if>
            <if test="subContractNo != null">
                #{subContractNo,jdbcType=VARCHAR},
            </if>
            <if test="serviceAddress != null">
                #{serviceAddress,jdbcType=VARCHAR},
            </if>
            <if test="serviceTerm != null">
                #{serviceTerm,jdbcType=VARCHAR},
            </if>
            <if test="serviceStartTime != null">
                #{serviceStartTime,jdbcType=TIMESTAMP},
            </if>
            <if test="serviceEndTime != null">
                #{serviceEndTime,jdbcType=TIMESTAMP},
            </if>
            <if test="monthRestDays != null">
                #{monthRestDays,jdbcType=INTEGER},
            </if>
            <if test="offDay != null">
                #{offDay,jdbcType=VARCHAR},
            </if>
            <if test="monthlySalary != null">
                #{monthlySalary,jdbcType=DECIMAL},
            </if>
            <if test="daySalary != null">
                #{daySalary,jdbcType=DECIMAL},
            </if>
            <if test="hourlySalary != null">
                #{hourlySalary,jdbcType=DECIMAL},
            </if>
            <if test="offMultiple != null">
                #{offMultiple,jdbcType=REAL},
            </if>
            <if test="workerMultiple != null">
                #{workerMultiple,jdbcType=REAL},
            </if>
            <if test="payday != null">
                #{payday,jdbcType=INTEGER},
            </if>
            <if test="createTime != null">
                #{createTime,jdbcType=TIMESTAMP},
            </if>
        </trim>
    </insert>
    <select id="countByExample" parameterType="org.linlinjava.jz.db.domain.ContractSubTemplateExample"
            resultType="java.lang.Long">
        <!--
          WARNING - @mbg.generated
          This element is automatically generated by MyBatis Generator, do not modify.
        -->
        select count(*) from contract_sub_template
        <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_sub_template
        <set>
            <if test="record.id != null">
                id = #{record.id,jdbcType=BIGINT},
            </if>
            <if test="record.orderNo != null">
                order_no = #{record.orderNo,jdbcType=VARCHAR},
            </if>
            <if test="record.subContractNo != null">
                sub_contract_no = #{record.subContractNo,jdbcType=VARCHAR},
            </if>
            <if test="record.serviceAddress != null">
                service_address = #{record.serviceAddress,jdbcType=VARCHAR},
            </if>
            <if test="record.serviceTerm != null">
                service_term = #{record.serviceTerm,jdbcType=VARCHAR},
            </if>
            <if test="record.serviceStartTime != null">
                service_start_time = #{record.serviceStartTime,jdbcType=TIMESTAMP},
            </if>
            <if test="record.serviceEndTime != null">
                service_end_time = #{record.serviceEndTime,jdbcType=TIMESTAMP},
            </if>
            <if test="record.monthRestDays != null">
                month_rest_days = #{record.monthRestDays,jdbcType=INTEGER},
            </if>
            <if test="record.offDay != null">
                off_day = #{record.offDay,jdbcType=VARCHAR},
            </if>
            <if test="record.monthlySalary != null">
                monthly_salary = #{record.monthlySalary,jdbcType=DECIMAL},
            </if>
            <if test="record.daySalary != null">
                day_salary = #{record.daySalary,jdbcType=DECIMAL},
            </if>
            <if test="record.hourlySalary != null">
                hourly_salary = #{record.hourlySalary,jdbcType=DECIMAL},
            </if>
            <if test="record.offMultiple != null">
                off_multiple = #{record.offMultiple,jdbcType=REAL},
            </if>
            <if test="record.workerMultiple != null">
                worker_multiple = #{record.workerMultiple,jdbcType=REAL},
            </if>
            <if test="record.payday != null">
                payday = #{record.payday,jdbcType=INTEGER},
            </if>
            <if test="record.createTime != null">
                create_time = #{record.createTime,jdbcType=TIMESTAMP},
            </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_sub_template
        set id = #{record.id,jdbcType=BIGINT},
        order_no = #{record.orderNo,jdbcType=VARCHAR},
        sub_contract_no = #{record.subContractNo,jdbcType=VARCHAR},
        service_address = #{record.serviceAddress,jdbcType=VARCHAR},
        service_term = #{record.serviceTerm,jdbcType=VARCHAR},
        service_start_time = #{record.serviceStartTime,jdbcType=TIMESTAMP},
        service_end_time = #{record.serviceEndTime,jdbcType=TIMESTAMP},
        month_rest_days = #{record.monthRestDays,jdbcType=INTEGER},
        off_day = #{record.offDay,jdbcType=VARCHAR},
        monthly_salary = #{record.monthlySalary,jdbcType=DECIMAL},
        day_salary = #{record.daySalary,jdbcType=DECIMAL},
        hourly_salary = #{record.hourlySalary,jdbcType=DECIMAL},
        off_multiple = #{record.offMultiple,jdbcType=REAL},
        worker_multiple = #{record.workerMultiple,jdbcType=REAL},
        payday = #{record.payday,jdbcType=INTEGER},
        create_time = #{record.createTime,jdbcType=TIMESTAMP}
        <if test="_parameter != null">
            <include refid="Update_By_Example_Where_Clause"/>
        </if>
    </update>
    <update id="updateByPrimaryKeySelective" parameterType="org.linlinjava.jz.db.domain.ContractSubTemplate">
        <!--
          WARNING - @mbg.generated
          This element is automatically generated by MyBatis Generator, do not modify.
        -->
        update contract_sub_template
        <set>
            <if test="orderNo != null">
                order_no = #{orderNo,jdbcType=VARCHAR},
            </if>
            <if test="subContractNo != null">
                sub_contract_no = #{subContractNo,jdbcType=VARCHAR},
            </if>
            <if test="serviceAddress != null">
                service_address = #{serviceAddress,jdbcType=VARCHAR},
            </if>
            <if test="serviceTerm != null">
                service_term = #{serviceTerm,jdbcType=VARCHAR},
            </if>
            <if test="serviceStartTime != null">
                service_start_time = #{serviceStartTime,jdbcType=TIMESTAMP},
            </if>
            <if test="serviceEndTime != null">
                service_end_time = #{serviceEndTime,jdbcType=TIMESTAMP},
            </if>
            <if test="monthRestDays != null">
                month_rest_days = #{monthRestDays,jdbcType=INTEGER},
            </if>
            <if test="offDay != null">
                off_day = #{offDay,jdbcType=VARCHAR},
            </if>
            <if test="monthlySalary != null">
                monthly_salary = #{monthlySalary,jdbcType=DECIMAL},
            </if>
            <if test="daySalary != null">
                day_salary = #{daySalary,jdbcType=DECIMAL},
            </if>
            <if test="hourlySalary != null">
                hourly_salary = #{hourlySalary,jdbcType=DECIMAL},
            </if>
            <if test="offMultiple != null">
                off_multiple = #{offMultiple,jdbcType=REAL},
            </if>
            <if test="workerMultiple != null">
                worker_multiple = #{workerMultiple,jdbcType=REAL},
            </if>
            <if test="payday != null">
                payday = #{payday,jdbcType=INTEGER},
            </if>
            <if test="createTime != null">
                create_time = #{createTime,jdbcType=TIMESTAMP},
            </if>
        </set>
        where id = #{id,jdbcType=BIGINT}
    </update>
    <update id="updateByPrimaryKey" parameterType="org.linlinjava.jz.db.domain.ContractSubTemplate">
        <!--
          WARNING - @mbg.generated
          This element is automatically generated by MyBatis Generator, do not modify.
        -->
        update contract_sub_template
        set order_no = #{orderNo,jdbcType=VARCHAR},
        sub_contract_no = #{subContractNo,jdbcType=VARCHAR},
        service_address = #{serviceAddress,jdbcType=VARCHAR},
        service_term = #{serviceTerm,jdbcType=VARCHAR},
        service_start_time = #{serviceStartTime,jdbcType=TIMESTAMP},
        service_end_time = #{serviceEndTime,jdbcType=TIMESTAMP},
        month_rest_days = #{monthRestDays,jdbcType=INTEGER},
        off_day = #{offDay,jdbcType=VARCHAR},
        monthly_salary = #{monthlySalary,jdbcType=DECIMAL},
        day_salary = #{daySalary,jdbcType=DECIMAL},
        hourly_salary = #{hourlySalary,jdbcType=DECIMAL},
        off_multiple = #{offMultiple,jdbcType=REAL},
        worker_multiple = #{workerMultiple,jdbcType=REAL},
        payday = #{payday,jdbcType=INTEGER},
        create_time = #{createTime,jdbcType=TIMESTAMP}
        where id = #{id,jdbcType=BIGINT}
    </update>
    <select id="selectOneByExample" parameterType="org.linlinjava.jz.db.domain.ContractSubTemplateExample"
            resultMap="BaseResultMap">
        <!--
          WARNING - @mbg.generated
          This element is automatically generated by MyBatis Generator, do not modify.
        -->
        select
        <include refid="Base_Column_List"/>
        from contract_sub_template
        <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 &gt; 0">
                <foreach collection="selective" item="column" separator=",">
                    ${column.aliasedEscapedColumnName}
                </foreach>
            </when>
            <otherwise>
                <include refid="Base_Column_List"/>
            </otherwise>
        </choose>
        from contract_sub_template
        <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>
</mapper>