<?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="com.boman.web.core.mapper.CzrkChangeMapper">
    
    <resultMap type="com.boman.domain.Czrk" id="CzrkResult">
        <result property="id"    column="id"    />
        <result property="czrkJzdzId"    column="czrk_jzdz_id"    />
        <result property="userName"    column="user_name"    />
        <result property="gender"    column="gender"    />
        <result property="age"    column="age"    />
        <result property="birthday"    column="birthday"    />
        <result property="deptId"    column="dept_id"    />
        <result property="idCard"    column="id_card"    />
        <result property="phoneNum"    column="phone_num"    />
        <result property="code"    column="code"    />
        <result property="houseType"    column="house_type"    />
        <result property="rlr"    column="rlr"    />
        <result property="rlrNike"    column="rlr_nike"    />
        <result property="rlTime"    column="rl_time"    />
        <result property="keyIndustries"    column="key_industries"    />
        <result property="yhzgx"    column="yhzgx"    />
        <result property="workUnit"    column="work_unit"    />
        <result property="provinceId"    column="province_id"    />
        <result property="province"    column="province"    />
        <result property="cityId"    column="city_id"    />
        <result property="city"    column="city"    />
        <result property="regionId"    column="region_id"    />
        <result property="isRl"    column="is_rl"    />
        <result property="region"    column="region"    />
        <result property="villageTownsId"    column="village_towns_id"    />
        <result property="villageTowns"    column="village_towns"    />
        <result property="villageId"    column="village_id"    />
        <result property="village"    column="village"    />
        <result property="villagerGroupId"    column="villager_group_id"    />
        <result property="villagerGroup"    column="villager_group"    />
        <result property="nowIn"    column="now_in"    />
        <result property="remark"    column="remark"    />
        <result property="gridId"    column="grid_id"    />
        <result property="status"    column="status"    />
        <result property="changUser"    column="chang_user"    />
        <result property="changNikeUser"    column="chang_nike_user"    />
        <result property="changUserTime"    column="chang_user_time"    />
        <result property="isConfirm"    column="is_confirm"    />
        <result property="confirmInfoUser"    column="confirm_info_user"    />
        <result property="confirmInfoNikeUser"    column="confirm_info_nike_user"    />
        <result property="confirmInfoUserTime"    column="confirm_info_user_time"    />
        <result property="createBy"    column="create_by"    />
        <result property="createTime"    column="create_time"    />
        <result property="updateBy"    column="update_by"    />
        <result property="updateTime"    column="update_time"    />
        <result property="isDel"    column="is_del"    />
        <result property="deleteReason"    column="delete_reason"    />
    </resultMap>


    <sql id="selectCzrkVo">
        select czrk_id as id, user_name, gender, age, birthday,dept_id, id_card, phone_num, code, house_type, rlr,rlr_nike, rl_time, yhzgx
             , work_unit, province_id, province, city_id, city, region_id, region, village_towns_id, village_towns,chang_user,chang_nike_user,chang_user_time
             , village_id, village, villager_group_id, villager_group, now_in, remark,grid_id, status,is_confirm,confirm_info_user,confirm_info_nike_user,confirm_info_user_time, create_by, create_time
             , update_by, update_time, is_del, delete_reason, dept_id, is_rl, key_industries from czrk_change
    </sql>

    <select id="selectListByCzrkId" parameterType="Long" resultMap="CzrkResult">
        <include refid="selectCzrkVo"/>
        where czrk_id = #{id} and is_del = 'N'
    </select>

    <insert id="insertCzrkChange">
        insert into czrk_change
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">czrk_id,</if>
            <if test="userName != null">user_name,</if>
            <if test="gender != null">gender,</if>
            <if test="age != null">age,</if>
            <if test="birthday != null">birthday,</if>
            <if test="deptId != null">dept_id,</if>
            <if test="idCard != null">id_card,</if>
            <if test="phoneNum != null">phone_num,</if>
            <if test="code != null">code,</if>
            <if test="keyIndustries != null">key_Industries,</if>
            <if test="houseType != null">house_type,</if>
            <if test="rlr != null">rlr,</if>
            <if test="isRl != null">is_rl,</if>
            <if test="rlTime != null">rl_time,</if>
            <if test="yhzgx != null">yhzgx,</if>
            <if test="workUnit != null">work_unit,</if>
            <if test="provinceId != null">province_id,</if>
            <if test="province != null">province,</if>
            <if test="cityId != null">city_id,</if>
            <if test="city != null">city,</if>
            <if test="regionId != null">region_id,</if>
            <if test="region != null">region,</if>
            <if test="villageTownsId != null">village_towns_id,</if>
            <if test="villageTowns != null">village_towns,</if>
            <if test="villageId != null">village_id,</if>
            <if test="village != null">village,</if>
            <if test="villagerGroupId != null">villager_group_id,</if>
            <if test="villagerGroup != null">villager_group,</if>
            <if test="nowIn != null">now_in,</if>
            <if test="remark != null">remark,</if>
            <if test="gridId != null">grid_id,</if>
            <if test="status != null">status,</if>
            <if test="isConfirm != null">is_confirm,</if>
            <if test="confirmInfoUser != null and confirmInfoUser != ''">confirm_info_user,</if>
            <if test="confirmInfoUserTime != null ">confirm_info_user_time,</if>
            <if test="changUser != null ">chang_user,</if>
            <if test="changNikeUser != null ">chang_nike_user,</if>
            <if test="changUserTime != null ">chang_user_time,</if>
            <if test="createBy != null">create_by,</if>
            <if test="updateBy != null">update_by,</if>
            <if test="isDel != null and isDel != ''">is_del,</if>
            <if test="deleteReason != null">delete_reason,</if>
            create_time, update_time
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="id != null">#{id},</if>
            <if test="userName != null">#{userName},</if>
            <if test="gender != null">#{gender},</if>
            <if test="age != null">#{age},</if>
            <if test="birthday != null">#{birthday},</if>
            <if test="deptId != null">#{deptId},</if>
            <if test="idCard != null">#{idCard},</if>
            <if test="phoneNum != null">#{phoneNum},</if>
            <if test="code != null">#{code},</if>
            <if test="keyIndustries != null">#{keyIndustries},</if>
            <if test="houseType != null">#{houseType},</if>
            <if test="rlr != null">#{rlr},</if>
            <if test="isRl != null">#{isRl},</if>
            <if test="rlTime != null">#{rlTime},</if>
            <if test="yhzgx != null">#{yhzgx},</if>
            <if test="workUnit != null">#{workUnit},</if>
            <if test="provinceId != null">#{provinceId},</if>
            <if test="province != null">#{province},</if>
            <if test="cityId != null">#{cityId},</if>
            <if test="city != null">#{city},</if>
            <if test="regionId != null">#{regionId},</if>
            <if test="region != null">#{region},</if>
            <if test="villageTownsId != null">#{villageTownsId},</if>
            <if test="villageTowns != null">#{villageTowns},</if>
            <if test="villageId != null">#{villageId},</if>
            <if test="village != null">#{village},</if>
            <if test="villagerGroupId != null">#{villagerGroupId},</if>
            <if test="villagerGroup != null">#{villagerGroup},</if>
            <if test="nowIn != null">#{nowIn},</if>
            <if test="remark != null">#{remark},</if>
            <if test="gridId != null">#{gridId},</if>
            <if test="status != null">#{status},</if>
            <if test="isConfirm != null">#{isConfirm},</if>
            <if test="confirmInfoUser != null and confirmInfoUser != ''">#{confirmInfoUser},</if>
            <if test="confirmInfoUserTime != null ">#{confirmInfoUserTime},</if>
            <if test="changUser != null ">#{changUser},</if>
            <if test="changNikeUser != null ">#{changNikeUser},</if>
            <if test="changUserTime != null ">#{changUserTime},</if>
            <if test="createBy != null">#{createBy},</if>
            <if test="updateBy != null">#{updateBy},</if>
            <if test="isDel != null and isDel != ''">#{isDel},</if>
            <if test="deleteReason != null">#{deleteReason},</if>
            sysdate(), sysdate()
        </trim>
    </insert>

    <update id="updateCzrkChange" >
        update czrk_change
        <trim prefix="SET" suffixOverrides=",">
            <if test="userName != null">user_name = #{userName},</if>
            <if test="gender != null">gender = #{gender},</if>
            <if test="age != null">age = #{age},</if>
            <if test="birthday != null">birthday = #{birthday},</if>
            <if test="idCard != null">id_card = #{idCard},</if>
            <if test="phoneNum != null">phone_num = #{phoneNum},</if>
            <if test="code != null">code = #{code},</if>
            <if test="keyIndustries != null">key_industries = #{keyIndustries},</if>
            <if test="houseType != null">house_type = #{houseType},</if>
            <if test="rlr != null">rlr = #{rlr},</if>
            <if test="rlrNike != null">rlr_nike = #{rlrNike},</if>
            <if test="isRl != null">is_rl = #{isRl},</if>
            <if test="rlTime != null">rl_time = #{rlTime},</if>
            <if test="yhzgx != null">yhzgx = #{yhzgx},</if>
            <if test="workUnit != null">work_unit = #{workUnit},</if>
            <if test="provinceId != ''">province_id = #{provinceId},</if>
            <if test="province != ''">province = #{province},</if>
            <if test="cityId != ''">city_id = #{cityId},</if>
            <if test="city != ''">city = #{city},</if>
            <if test="regionId != ''">region_id = #{regionId},</if>
            <if test="region != ''">region = #{region},</if>
            <if test="villageTownsId != ''">village_towns_id = #{villageTownsId},</if>
            <if test="villageTowns != ''">village_towns = #{villageTowns},</if>
            <if test="villageId != ''">village_id = #{villageId},</if>
            <if test="village != ''">village = #{village},</if>
            <if test="villagerGroupId != ''">villager_group_id = #{villagerGroupId},</if>
            <if test="villagerGroup != ''">villager_group = #{villagerGroup},</if>
            <if test="nowIn != null">now_in = #{nowIn},</if>
            <if test="remark != null">remark = #{remark},</if>
            <if test="gridId != null">grid_id = #{gridId},</if>
            <if test="status != null">status = #{status},</if>
            <if test="isConfirm != null and isConfirm != ''">is_confirm = #{isConfirm},</if>
            <if test="confirmInfoUser != null and confirmInfoUser != ''">confirm_info_user = #{confirmInfoUser},</if>
            <if test="confirmInfoNikeUser != null and confirmInfoNikeUser != ''">confirm_info_nike_user = #{confirmInfoNikeUser},</if>
            <if test="confirmInfoUserTime != null ">confirm_info_user_time = #{confirmInfoUserTime},</if>
            <if test="createBy != null">create_by = #{createBy},</if>
            <if test="createTime != null">create_time = #{createTime},</if>
            <if test="updateBy != null">update_by = #{updateBy},</if>
            <if test="updateTime != null">update_time = sysdate(),</if>
            <if test="isDel != null and isDel != ''">is_del = #{isDel},</if>
            <if test="deleteReason != null">delete_reason = #{deleteReason},</if>
        </trim>
        where id = #{id}
    </update>

    <delete id="deleteCzrkChangeById" parameterType="Long">
        delete from czrk_change where id = #{id}
    </delete>

</mapper>