<?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.cool.store.mapper.PosAndOrderInfoMapper">

    <resultMap id="BaseResultMap" type="com.cool.store.entity.PosAndOrderInfoDO">
            <id property="id" column="id" jdbcType="BIGINT"/>
            <result property="shopId" column="shop_id" jdbcType="BIGINT"/>
            <result property="type" column="type" jdbcType="TINYINT"/>
            <result property="account" column="account" jdbcType="VARCHAR"/>
            <result property="password" column="password" jdbcType="VARCHAR"/>
            <result property="remark" column="remark" jdbcType="VARCHAR"/>
            <result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
            <result property="createUser" column="create_user" jdbcType="VARCHAR"/>
    </resultMap>

    <sql id="Base_Column_List">
        id,shop_id,type,
        account,password,remark,
        create_time,create_user
    </sql>
    <insert id="batchInsert">
        <foreach collection="list" separator=";" index="index" item="item">
            insert into xfsg_pos_and_order_info (shop_id,type,account,password,remark,create_time,create_user)
            values (#{item.shopId},#{item.type},#{item.account},#{item.password},#{item.remark},#{item.createTime},#{item.createUser})
        </foreach>
    </insert>
    <update id="batchUpdateYlsRemarkByShopCode">
        UPDATE xfsg_pos_and_order_info a LEFT JOIN xfsg_shop_info b on a.`shop_id` = b.id
        SET
        a.remark = #{remark}
        WHERE
        b.`shop_code` in(
        <foreach collection="list" item="item" separator=",">
            #{item}
        </foreach>
        ) AND a.type = 2
    </update>
</mapper>
