DepositShelfCodeMapper.xml 1.51 KB
<?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.yoho.order.dal.DepositShelfCodeMapper">
    <resultMap id="BaseResultMap" type="com.yoho.order.model.DepositShelfCode">
      <result column="id" property="id" jdbcType="INTEGER" />
      <result column="shelf_code" property="shelfCode" jdbcType="VARCHAR" />
      <result column="status" property="status" jdbcType="INTEGER" />
    </resultMap>

    <sql id="Base_Column_List">
        id, shelf_code, status
    </sql>
    
    <select id="selectShelfCodesByShelfCodes" resultType="java.lang.String">
        select shelf_code
        from deposit_shelf_code where 1=1
        <if test="shelfCodeList != null and shelfCodeList.size()>0">  
         and shelf_code in  
            <foreach collection="shelfCodeList" item="shelfCode" open="(" close=")" separator=",">
             #{shelfCode}
            </foreach>
        </if>
    </select>

    <select id="selectByShelfCode" resultMap="BaseResultMap">
        select <include refid="Base_Column_List" />
        from deposit_shelf_code where shelf_code=#{shelfCode} and status=0
    </select>
    
    <insert id="batchInsert" parameterType="java.util.List">
       insert into deposit_shelf_code(shelf_code, status) values
       <foreach collection="list" item="item" index="index" separator=",">
         (#{item.shelfCode,jdbcType=VARCHAR},#{item.status,jdbcType=INTEGER})
       </foreach>
    </insert>
</mapper>