<?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.sckw.example.dao.KwsDeptDao">
    <resultMap id="BaseResultMap" type="com.sckw.example.model.KwsDept">
        <id column="kws_user_id" jdbcType="BIGINT" property="id" />
        <result column="system_type" jdbcType="INTEGER" property="systemType" />
        <result column="account" jdbcType="VARCHAR" property="account" />
        <result column="password" jdbcType="VARCHAR" property="password" />
        <result column="name" jdbcType="VARCHAR" property="name" />
        <result column="phone" jdbcType="VARCHAR" property="phone" />
        <result column="photo" jdbcType="VARCHAR" property="photo" />
        <result column="email" jdbcType="VARCHAR" property="email" />
        <result column="client_id" jdbcType="VARCHAR" property="clientId" />
        <result column="is_main" jdbcType="INTEGER" property="isMain" />
        <result column="remark" jdbcType="VARCHAR" property="remark" />
        <result column="status" jdbcType="INTEGER" property="status" />
        <result column="create_by" jdbcType="BIGINT" property="createBy" />
        <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
        <result column="update_by" jdbcType="BIGINT" property="updateBy" />
        <result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
        <result column="del_flag" jdbcType="INTEGER" property="delFlag" />
    </resultMap>
    <sql id="Base_Column_List">
         id as kws_user_id,  system_type as kws_user_system_type,  account as kws_user_account,
     `password` as `kws_user_password`,  `name` as `kws_user_name`,  phone as kws_user_phone,
     photo as kws_user_photo,  email as kws_user_email,  client_id as kws_user_client_id,
     is_main as kws_user_is_main,  remark as kws_user_remark,  `status` as `kws_user_status`,
     create_by as kws_user_create_by,  create_time as kws_user_create_time,
     update_by as kws_user_update_by,  update_time as kws_user_update_time,
     del_flag as kws_user_del_flag
    </sql>
    <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List" />
        from kws_user
        where  id = #{id,jdbcType=BIGINT}
    </select>
    <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
        delete from kws_user
        where id = #{id,jdbcType=BIGINT}
    </delete>
    <insert id="insert" parameterType="com.sckw.example.dao.KwsDeptDao">
        insert into sckw_system.kws_user (id, system_type, account,
                              `password`, `name`, phone,
                              photo, email, client_id,
                              is_main, remark, `status`,
                              create_by, create_time, update_by,
                              update_time, del_flag)
        values (#{id,jdbcType=BIGINT}, #{systemType,jdbcType=INTEGER}, #{account,jdbcType=VARCHAR},
                #{password,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, #{phone,jdbcType=VARCHAR},
                #{photo,jdbcType=VARCHAR}, #{email,jdbcType=VARCHAR}, #{clientId,jdbcType=VARCHAR},
                #{isMain,jdbcType=INTEGER}, #{remark,jdbcType=VARCHAR}, #{status,jdbcType=INTEGER},
                #{createBy,jdbcType=BIGINT}, #{createTime,jdbcType=TIMESTAMP}, #{updateBy,jdbcType=BIGINT},
                #{updateTime,jdbcType=TIMESTAMP}, #{delFlag,jdbcType=INTEGER})
    </insert>
    <insert id="insertSelective" parameterType="com.sckw.example.dao.KwsDeptDao">
        insert into kws_user
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">
                id,
            </if>
            <if test="systemType != null">
                system_type,
            </if>
            <if test="account != null">
                account,
            </if>
            <if test="password != null">
                `password`,
            </if>
            <if test="name != null">
                `name`,
            </if>
            <if test="phone != null">
                phone,
            </if>
            <if test="photo != null">
                photo,
            </if>
            <if test="email != null">
                email,
            </if>
            <if test="clientId != null">
                client_id,
            </if>
            <if test="isMain != null">
                is_main,
            </if>
            <if test="remark != null">
                remark,
            </if>
            <if test="status != null">
                `status`,
            </if>
            <if test="createBy != null">
                create_by,
            </if>
            <if test="createTime != null">
                create_time,
            </if>
            <if test="updateBy != null">
                update_by,
            </if>
            <if test="updateTime != null">
                update_time,
            </if>
            <if test="delFlag != null">
                del_flag,
            </if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="id != null">
                #{id,jdbcType=BIGINT},
            </if>
            <if test="systemType != null">
                #{systemType,jdbcType=INTEGER},
            </if>
            <if test="account != null">
                #{account,jdbcType=VARCHAR},
            </if>
            <if test="password != null">
                #{password,jdbcType=VARCHAR},
            </if>
            <if test="name != null">
                #{name,jdbcType=VARCHAR},
            </if>
            <if test="phone != null">
                #{phone,jdbcType=VARCHAR},
            </if>
            <if test="photo != null">
                #{photo,jdbcType=VARCHAR},
            </if>
            <if test="email != null">
                #{email,jdbcType=VARCHAR},
            </if>
            <if test="clientId != null">
                #{clientId,jdbcType=VARCHAR},
            </if>
            <if test="isMain != null">
                #{isMain,jdbcType=INTEGER},
            </if>
            <if test="remark != null">
                #{remark,jdbcType=VARCHAR},
            </if>
            <if test="status != null">
                #{status,jdbcType=INTEGER},
            </if>
            <if test="createBy != null">
                #{createBy,jdbcType=BIGINT},
            </if>
            <if test="createTime != null">
                #{createTime,jdbcType=TIMESTAMP},
            </if>
            <if test="updateBy != null">
                #{updateBy,jdbcType=BIGINT},
            </if>
            <if test="updateTime != null">
                #{updateTime,jdbcType=TIMESTAMP},
            </if>
            <if test="delFlag != null">
                #{delFlag,jdbcType=INTEGER},
            </if>
        </trim>
    </insert>
    <update id="updateByPrimaryKeySelective" parameterType="com.sckw.example.dao.KwsDeptDao">
        update kws_user
        <set>
            <if test="systemType != null">
                system_type = #{systemType,jdbcType=INTEGER},
            </if>
            <if test="account != null">
                account = #{account,jdbcType=VARCHAR},
            </if>
            <if test="password != null">
                `password` = #{password,jdbcType=VARCHAR},
            </if>
            <if test="name != null">
                `name` = #{name,jdbcType=VARCHAR},
            </if>
            <if test="phone != null">
                phone = #{phone,jdbcType=VARCHAR},
            </if>
            <if test="photo != null">
                photo = #{photo,jdbcType=VARCHAR},
            </if>
            <if test="email != null">
                email = #{email,jdbcType=VARCHAR},
            </if>
            <if test="clientId != null">
                client_id = #{clientId,jdbcType=VARCHAR},
            </if>
            <if test="isMain != null">
                is_main = #{isMain,jdbcType=INTEGER},
            </if>
            <if test="remark != null">
                remark = #{remark,jdbcType=VARCHAR},
            </if>
            <if test="status != null">
                `status` = #{status,jdbcType=INTEGER},
            </if>
            <if test="createBy != null">
                create_by = #{createBy,jdbcType=BIGINT},
            </if>
            <if test="createTime != null">
                create_time = #{createTime,jdbcType=TIMESTAMP},
            </if>
            <if test="updateBy != null">
                update_by = #{updateBy,jdbcType=BIGINT},
            </if>
            <if test="updateTime != null">
                update_time = #{updateTime,jdbcType=TIMESTAMP},
            </if>
            <if test="delFlag != null">
                del_flag = #{delFlag,jdbcType=INTEGER},
            </if>
        </set>
        where id = #{id,jdbcType=BIGINT}
    </update>
    <update id="updateByPrimaryKey" parameterType="com.sckw.example.dao.KwsDeptDao">
        update kws_user
        set system_type = #{systemType,jdbcType=INTEGER},
            account = #{account,jdbcType=VARCHAR},
            `password` = #{password,jdbcType=VARCHAR},
            `name` = #{name,jdbcType=VARCHAR},
            phone = #{phone,jdbcType=VARCHAR},
            photo = #{photo,jdbcType=VARCHAR},
            email = #{email,jdbcType=VARCHAR},
            client_id = #{clientId,jdbcType=VARCHAR},
            is_main = #{isMain,jdbcType=INTEGER},
            remark = #{remark,jdbcType=VARCHAR},
            `status` = #{status,jdbcType=INTEGER},
            create_by = #{createBy,jdbcType=BIGINT},
            create_time = #{createTime,jdbcType=TIMESTAMP},
            update_by = #{updateBy,jdbcType=BIGINT},
            update_time = #{updateTime,jdbcType=TIMESTAMP},
            del_flag = #{delFlag,jdbcType=INTEGER}
        where id = #{id,jdbcType=BIGINT}
    </update>
</mapper>