<?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.neusoft.smart.pos.user.persistent.mapper.UserLoginRecordMapper">
    <resultMap id="BaseResultMap" type="com.neusoft.smart.pos.user.persistent.domain.UserLoginRecordKey">
        <id column="id" jdbcType="INTEGER" property="id" />
        <result column="username" jdbcType="VARCHAR" property="username" />
        <result column="org_id" jdbcType="INTEGER" property="orgId" />
        <result column="shop_id" jdbcType="INTEGER" property="shopId" />
        <result column="serial_no" jdbcType="VARCHAR" property="serialNo" />
        <result column="status" jdbcType="VARCHAR" property="status" />
        <result column="created_at" jdbcType="TIMESTAMP" property="createdAt" />
        <result column="is_shift" jdbcType="CHAR" property="isShift" />
    </resultMap>
    <sql id="Example_Where_Clause">
        <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">
        <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">
        id, username, org_id, shop_id, serial_no, status, created_at, is_shift
    </sql>
    <select id="selectByExample" parameterType="com.neusoft.smart.pos.user.persistent.domain.UserLoginRecordExample" resultMap="BaseResultMap">
        select
        <if test="distinct">
            distinct
        </if>
        <include refid="Base_Column_List" />
        from user_login_record
        <if test="_parameter != null">
            <include refid="Example_Where_Clause" />
        </if>
        <if test="orderByClause != null">
            order by ${orderByClause}
        </if>
        <if test="offset != null and limit != null">
            limit ${offset}, ${limit}
        </if>
    </select>
    <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List" />
        from user_login_record
        where id = #{id,jdbcType=INTEGER}
    </select>
    <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
        delete from user_login_record
        where id = #{id,jdbcType=INTEGER}
    </delete>
    <delete id="deleteByExample" parameterType="com.neusoft.smart.pos.user.persistent.domain.UserLoginRecordExample">
        delete from user_login_record
        <if test="_parameter != null">
            <include refid="Example_Where_Clause" />
        </if>
    </delete>
    <insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.neusoft.smart.pos.user.persistent.domain.UserLoginRecordKey" useGeneratedKeys="true">
        insert into user_login_record (username, org_id, shop_id, serial_no, status, created_at, is_shift)
        values (#{username,jdbcType=VARCHAR}, #{orgId,jdbcType=INTEGER}, #{shopId,jdbcType=INTEGER},
        #{serialNo,jdbcType=VARCHAR}, #{status,jdbcType=VARCHAR}, #{createdAt,jdbcType=TIMESTAMP},
        #{isShift,jdbcType=CHAR}
        )
    </insert>
    <insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.neusoft.smart.pos.user.persistent.domain.UserLoginRecordKey" useGeneratedKeys="true">
        insert into user_login_record
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="username != null">
                username,
            </if>
            <if test="orgId != null">
                org_id,
            </if>
            <if test="shopId != null">
                shop_id,
            </if>
            <if test="serialNo != null">
                serial_no,
            </if>
            <if test="status != null">
                status,
            </if>
            <if test="createdAt != null">
                created_at,
            </if>
            <if test="isShift != null">
                is_shift,
            </if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="username != null">
                #{username,jdbcType=VARCHAR},
            </if>
            <if test="orgId != null">
                #{orgId,jdbcType=INTEGER},
            </if>
            <if test="shopId != null">
                #{shopId,jdbcType=INTEGER},
            </if>
            <if test="serialNo != null">
                #{serialNo,jdbcType=VARCHAR},
            </if>
            <if test="status != null">
                #{status,jdbcType=VARCHAR},
            </if>
            <if test="createdAt != null">
                #{createdAt,jdbcType=TIMESTAMP},
            </if>
            <if test="isShift != null">
                #{isShift,jdbcType=CHAR},
            </if>
        </trim>
    </insert>
    <select id="countByExample" parameterType="com.neusoft.smart.pos.user.persistent.domain.UserLoginRecordExample" resultType="java.lang.Integer">
        select count(*) from user_login_record
        <if test="_parameter != null">
            <include refid="Example_Where_Clause" />
        </if>
    </select>
</mapper>