| <?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.matrix.system.hive.dao.SysInstoreDetailDao"> | 
|        | 
|     <resultMap type="SysInstoreDetail" id="SysInstoreDetailMap"> | 
|             <id property="id" column="ID" /> | 
|             <result property="instoreId" column="INSTORE_ID" /> | 
|             <result property="skuId" column="SKU_ID" /> | 
|             <result property="amount" column="AMOUNT" /> | 
|             <result property="price" column="PRICE" /> | 
|             <result property="priceTotal" column="PRICE_TOTAL" /> | 
|             <result property="remark" column="REMARK" />     | 
|             <result property="ywstatus" column="YWSTATUS" /> | 
|               <result property="unit" column="UNIT" /> | 
|               <result property="batch" column="batch" /> | 
|   | 
|             <!-- 扩展字段 --> | 
|             <association property="goods" column="{id=SKU_ID}" select="com.matrix.system.hive.dao.ShoppingGoodsDao.selectById" /> | 
|     </resultMap> | 
|      | 
|     <!--  插入方法   --> | 
|     <insert id="insert" parameterType="SysInstoreDetail" | 
|         useGeneratedKeys="true" keyProperty="id"> | 
|         INSERT INTO sys_instore_detail ( | 
|             ID, | 
|             INSTORE_ID, | 
|             SKU_ID, | 
|             AMOUNT, | 
|             PRICE, | 
|             PRICE_TOTAL, | 
|             REMARK, | 
|             UNIT, | 
|             YWSTATUS, | 
|             batch | 
|         ) | 
|     VALUES ( | 
|             #{id}, | 
|             #{instoreId}, | 
|             #{skuId}, | 
|             #{amount}, | 
|             #{price}, | 
|             #{priceTotal}, | 
|             #{remark}, | 
|             #{unit}, | 
|             #{ywstatus}, | 
|             #{batch} | 
|     ) | 
|     </insert> | 
|      | 
|     <!--  批量插入   --> | 
|     <insert id="batchInsert" parameterType="java.util.List"> | 
|         INSERT INTO sys_instore_detail ( | 
|                 ID, | 
|             INSTORE_ID, | 
|             SKU_ID, | 
|             AMOUNT, | 
|             PRICE, | 
|             PRICE_TOTAL, | 
|             REMARK, | 
|             UNIT, | 
|             YWSTATUS, | 
|         batch | 
|         ) | 
|     VALUES  | 
|     <foreach collection="list" item="item" index="index" separator=",">( | 
|             #{item.id}, | 
|             #{item.instoreId}, | 
|             #{item.skuId}, | 
|             #{item.amount}, | 
|             #{item.price}, | 
|             #{item.priceTotal}, | 
|             #{item.remark}, | 
|             #{item.unit}, | 
|             #{item.ywstatus}, | 
|             #{item.batch} | 
|     )</foreach> | 
|     </insert> | 
|      | 
|      | 
|     <!--  根据id更新 部分更新   --> | 
|     <update id="update" > | 
|         UPDATE sys_instore_detail | 
|         <set> | 
|                 <if test="instoreId != null and instoreId !='' "> | 
|                     INSTORE_ID = #{instoreId}, | 
|                 </if>         | 
|                 <if test="skuId != null and skuId !='' "> | 
|                     SKU_ID = #{skuId}, | 
|                 </if>         | 
|                 <if test="amount != null and amount !='' "> | 
|                     AMOUNT = #{amount}, | 
|                 </if>         | 
|                 <if test="price != null and price !='' "> | 
|                     PRICE = #{price}, | 
|                 </if>         | 
|                 <if test="priceTotal != null and priceTotal !='' "> | 
|                     PRICE_TOTAL = #{priceTotal}, | 
|                 </if> | 
|                 <if test="unit != null and unit !='' "> | 
|                     UNIT = #{unit}, | 
|                 </if> | 
|                 <if test="ywstatus != null and ywstatus !='' "> | 
|                     YWSTATUS = #{ywstatus}, | 
|                 </if> | 
|                 <if test="batch != null and batch !='' "> | 
|                     batch = #{batch}, | 
|                 </if> | 
|         </set> | 
|         WHERE ID=#{id}  | 
|     </update> | 
|      | 
|      | 
|      | 
|     <!-- 批量删除 --> | 
|     <delete id="deleteByIds" parameterType="java.util.List"> | 
|         delete from sys_instore_detail where  ID in | 
|         <foreach collection="list" index="index" item="item" open="(" | 
|             separator="," close=")"> | 
|             #{item} | 
|         </foreach> | 
|     </delete> | 
|          | 
|     <!-- 根据id删除--> | 
|     <delete id="deleteById" > | 
|         DELETE FROM sys_instore_detail | 
|         where  ID=#{id}  | 
|     </delete> | 
|      | 
|     <!-- 批量删除  注意 这里的参数是要删除的对象的集合--> | 
|     <delete id="deleteByInstoreId" > | 
|         delete from sys_instore_detail where  INSTORE_ID=#{id}         | 
|     </delete> | 
|      | 
|       | 
|     <!-- 分页查询 --> | 
|     <select id="selectInPage" resultMap="SysInstoreDetailMap"> | 
|         select  | 
|             ID, | 
|             INSTORE_ID, | 
|             SKU_ID, | 
|             AMOUNT, | 
|             PRICE, | 
|             PRICE_TOTAL, | 
|             REMARK, | 
|             UNIT, | 
|             YWSTATUS, | 
|             batch | 
|         from sys_instore_detail | 
|         where 1=1 | 
|             <if test="record!=null"> | 
|                 <if test="record.id != null and record.id !='' "> | 
|                     and ID = #{record.id} | 
|                 </if> | 
|                 <if test="record.instoreId != null and record.instoreId !='' "> | 
|                     and INSTORE_ID = #{record.instoreId} | 
|                 </if> | 
|                 <if test="record.goodsId != null and record.goodsId !='' "> | 
|                     and SKU_ID = #{record.goodsId} | 
|                 </if> | 
|                 <if test="record.amount != null and record.amount !='' "> | 
|                     and AMOUNT = #{record.amount} | 
|                 </if> | 
|                 <if test="record.price != null and record.price !='' "> | 
|                     and PRICE = #{record.price} | 
|                 </if> | 
|                 <if test="record.priceTotal != null and record.priceTotal !='' "> | 
|                     and PRICE_TOTAL = #{record.priceTotal} | 
|                 </if> | 
|                 <if test="record.ywstatus != null and record.ywstatus !='' "> | 
|                     and YWSTATUS = #{record.ywstatus} | 
|                 </if> | 
|             </if> | 
|         <if test="pageVo !=null"><!-- 判断pageVo对象是否为空 --> | 
|             <if test="pageVo.sort !=null  and pageVo.order !=null"> | 
|                 order by | 
|                 ${pageVo.sort} ${pageVo.order} | 
|             </if> | 
|             <if test="pageVo.offset >=0  and pageVo.limit >0"> | 
|                 limit | 
|                 #{pageVo.offset},#{pageVo.limit} | 
|             </if> | 
|         </if> | 
|     </select> | 
|      | 
|     <!-- 查询总条数 --> | 
|     <select id="selectTotalRecord"    resultType="java.lang.Integer"> | 
|         select  | 
|             count(*) | 
|         from  | 
|             sys_instore_detail | 
|         where  | 
|             1=1 | 
|         <if test="record!=null"> | 
|             <if test="record.id != null and record.id !='' "> | 
|                 and ID = #{record.id} | 
|             </if> | 
|             <if test="record.instoreId != null and record.instoreId !='' "> | 
|                 and INSTORE_ID = #{record.instoreId} | 
|             </if> | 
|             <if test="record.goodsId != null and record.goodsId !='' "> | 
|                 and SKU_ID = #{record.goodsId} | 
|             </if> | 
|             <if test="record.amount != null and record.amount !='' "> | 
|                 and AMOUNT = #{record.amount} | 
|             </if> | 
|             <if test="record.price != null and record.price !='' "> | 
|                 and PRICE = #{record.price} | 
|             </if> | 
|             <if test="record.priceTotal != null and record.priceTotal !='' "> | 
|                 and PRICE_TOTAL = #{record.priceTotal} | 
|             </if> | 
|             <if test="record.ywstatus != null and record.ywstatus !='' "> | 
|                 and YWSTATUS = #{record.ywstatus} | 
|             </if> | 
|         </if> | 
|     </select> | 
|   | 
|     <!-- 根据id查询--> | 
|     <select id="selectById" resultMap="SysInstoreDetailMap"> | 
|         select  | 
|             ID, | 
|             INSTORE_ID, | 
|             SKU_ID, | 
|             AMOUNT, | 
|             PRICE, | 
|             PRICE_TOTAL, | 
|             REMARK, | 
|             UNIT, | 
|             YWSTATUS, | 
|             batch | 
|         from sys_instore_detail | 
|         where  ID=#{id}  | 
|     </select>     | 
|      | 
|      | 
|     <!-- 根据对象查询--> | 
|     <select id="selectByModel" resultMap="SysInstoreDetailMap"> | 
|         select  | 
|             ID, | 
|             INSTORE_ID, | 
|             SKU_ID, | 
|             AMOUNT, | 
|             PRICE, | 
|             PRICE_TOTAL, | 
|             REMARK, | 
|             UNIT, | 
|             YWSTATUS, | 
|         batch | 
|         from sys_instore_detail | 
|         where 1=1 | 
|          | 
|             <if test="id != null and id !='' "> | 
|                 and ID = #{id} | 
|             </if> | 
|             <if test="instoreId != null and instoreId !='' "> | 
|                 and INSTORE_ID = #{instoreId} | 
|             </if> | 
|             <if test="skuId != null and skuId !='' "> | 
|                 and SKU_ID = #{skuId} | 
|             </if> | 
|             <if test="amount != null and amount !='' "> | 
|                 and AMOUNT = #{amount} | 
|             </if> | 
|             <if test="price != null and price !='' "> | 
|                 and PRICE = #{price} | 
|             </if> | 
|             <if test="priceTotal != null and priceTotal !='' "> | 
|                 and PRICE_TOTAL = #{priceTotal} | 
|             </if> | 
|             <if test="ywstatus != null and ywstatus !='' "> | 
|                 and YWSTATUS = #{ywstatus} | 
|             </if> | 
|     </select> | 
|   | 
|   | 
|     <select id="selectByOrderId" resultMap="SysInstoreDetailMap"> | 
|         select  * from sys_instore_detail where  INSTORE_ID=#{instoreId} | 
|     </select> | 
|   | 
|   | 
| </mapper> |