<?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.org.persistent.mapper.UserShopMapper">
    <resultMap id="BaseResultMap" type="com.neusoft.smart.pos.org.persistent.domain.UserShopKey">
        <id column="usr" jdbcType="INTEGER" property="usr"/>
        <id column="shop" jdbcType="INTEGER" property="shop"/>
    </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">
    usr, shop
  </sql>
    <select id="selectByExample" parameterType="com.neusoft.smart.pos.org.persistent.domain.UserShopExample"
            resultMap="BaseResultMap">
        select
        <if test="distinct">
            distinct
        </if>
        <include refid="Base_Column_List"/>
        from `user_shop`
        <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>
    <delete id="deleteByPrimaryKey" parameterType="com.neusoft.smart.pos.org.persistent.domain.UserShopKey">
    delete from `user_shop`
    where usr = #{usr,jdbcType=INTEGER}
      and shop = #{shop,jdbcType=INTEGER}
  </delete>
    <delete id="deleteByExample" parameterType="com.neusoft.smart.pos.org.persistent.domain.UserShopExample">
        delete from `user_shop`
        <if test="_parameter != null">
            <include refid="Example_Where_Clause"/>
        </if>
    </delete>
    <insert id="insert" parameterType="com.neusoft.smart.pos.org.persistent.domain.UserShopKey">
    insert into `user_shop` (usr, shop)
    values (#{usr,jdbcType=INTEGER}, #{shop,jdbcType=INTEGER})
  </insert>
    <insert id="insertSelective" parameterType="com.neusoft.smart.pos.org.persistent.domain.UserShopKey">
        insert into `user_shop`
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="usr != null">
                usr,
            </if>
            <if test="shop != null">
                shop,
            </if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="usr != null">
                #{usr,jdbcType=INTEGER},
            </if>
            <if test="shop != null">
                #{shop,jdbcType=INTEGER},
            </if>
        </trim>
    </insert>
    <select id="countByExample" parameterType="com.neusoft.smart.pos.org.persistent.domain.UserShopExample"
            resultType="java.lang.Integer">
        select count(*) from `user_shop`
        <if test="_parameter != null">
            <include refid="Example_Where_Clause"/>
        </if>
    </select>
    <update id="updateByExampleSelective" parameterType="map">
        update `user_shop`
        <set>
            <if test="record.usr != null">
                usr = #{record.usr,jdbcType=INTEGER},
            </if>
            <if test="record.shop != null">
                shop = #{record.shop,jdbcType=INTEGER},
            </if>
        </set>
        <if test="_parameter != null">
            <include refid="Update_By_Example_Where_Clause"/>
        </if>
    </update>
    <update id="updateByExample" parameterType="map">
        update `user_shop`
        set usr = #{record.usr,jdbcType=INTEGER},
        shop = #{record.shop,jdbcType=INTEGER}
        <if test="_parameter != null">
            <include refid="Update_By_Example_Where_Clause"/>
        </if>
    </update>
</mapper>