| <?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.xzx.gc.system.mapper.PackageGoodsInfoMapper">  | 
|   <resultMap id="BaseResultMap" type="com.xzx.gc.entity.PackageGoodsInfo">  | 
|     <!--  | 
|       WARNING - @mbg.generated  | 
|     -->  | 
|     <id column="id" jdbcType="BIGINT" property="id" />  | 
|     <result column="title" jdbcType="VARCHAR" property="title" />  | 
|     <result column="item_type" jdbcType="VARCHAR" property="itemType" />  | 
|     <result column="price" jdbcType="VARCHAR" property="price" />  | 
|     <result column="second_price" jdbcType="VARCHAR" property="secondPrice" />  | 
|     <result column="create_time" jdbcType="VARCHAR" property="createTime" />  | 
|     <result column="create_user_id" jdbcType="VARCHAR" property="createUserId" />  | 
|     <result column="picture" jdbcType="VARCHAR" property="picture" />  | 
|     <result column="top_flag" jdbcType="SMALLINT" property="topFlag" />  | 
|     <result column="parent_id" jdbcType="BIGINT" property="parentId" />  | 
|     <result column="sort" jdbcType="INTEGER" property="sort" />  | 
|     <result column="put_storage_price" jdbcType="DECIMAL" property="putStoragePrice" />  | 
|     <result column="item_unit" jdbcType="VARCHAR" property="itemUnit" />  | 
|     <result column="partner_id" jdbcType="VARCHAR" property="partnerId" />  | 
|     <result column="city_id" jdbcType="INTEGER" property="cityId" />  | 
|     <result column="del_flag" jdbcType="INTEGER" property="delFlag" />  | 
|     <result column="package_id"  property="packageId" />  | 
|   </resultMap>  | 
|     <select id="queryTitleByPackageGoods" resultType="java.lang.Long">  | 
|        select id from xzx_package_goods_info where title=#{title} and package_id=#{packageId}  | 
|     </select>  | 
|   | 
|   <insert id="insertItemOperate1">  | 
|     INSERT INTO `xzx_package_goods_info`  | 
|     (`item_type`, `title`, `picture`, `price`, `put_storage_price`, `parent_id`, `sort`, `create_time`,  | 
|      `item_unit`,`second_price`, `partner_id`,`city_id`,`package_id`)  | 
|     VALUES  | 
|       (#{itemType}, #{title}, #{picture}, #{price}, #{putStoragePrice}, #{parentId}, #{sort}, #{createTime},  | 
|                     #{itemUnit}, #{secondPrice}, #{partnerId},#{cityId}, #{packageId})  | 
|   </insert>  | 
|   | 
|     <select id="querIteml1" resultType="com.xzx.gc.model.admin.ItemModel">  | 
|         select * from `xzx_package_goods_info` where del_flag=0  | 
|         <if test="itemType != null">  | 
|             AND item_type=#{itemType}  | 
|         </if>  | 
|         <if test="title != null">  | 
|             AND title=#{title}  | 
|         </if>  | 
|         <if test="delFlag != null">  | 
|             AND del_flag=#{delFlag}  | 
|         </if>  | 
|         <if test="topFlag != null">  | 
|             AND top_flag=#{topFlag}  | 
|         </if>  | 
|         <if test="parentId!=null and parentId != ''">  | 
|             AND parent_id=#{parentId}  | 
|         </if>  | 
|         <if test="parentId==null or parentId == ''">  | 
|             AND parent_id is NULL  | 
|         </if>  | 
|         <if test="id != null">  | 
|             AND id=#{id}  | 
|         </if>  | 
|         order by sort  | 
|     </select>  | 
|   | 
|   | 
|     <update id="updateItem1">  | 
|         UPDATE `xzx_package_goods_info` SET  | 
|         `title` = #{title}  | 
|         , `picture` = #{picture}  | 
|         , `price` = #{price}  | 
|         , `put_storage_price` = #{putStoragePrice}  | 
|         , `sort` = #{sort}  | 
|         <if test="cityId != null and cityId != ''">  | 
|             ,`city_id` = #{cityId}  | 
|         </if>  | 
|         <if test="packageId != null and packageId != ''">  | 
|             , `package_id` = #{packageId}  | 
|         </if>  | 
|         WHERE `id` = #{id}  | 
|     </update>  | 
|   | 
|     <delete id="delItem1">  | 
|         update `xzx_package_goods_info`  | 
|         set del_flag = 1  | 
|         where id = #{id}  | 
|     </delete>  | 
|   | 
|     <select id="queryOperateItemList1" parameterType="com.xzx.gc.model.admin.ItemModel"  | 
|             resultType="com.xzx.gc.model.admin.ItemModel">  | 
|         select a.id,a.title,a.sort,a.item_type,a.city_id,a.del_flag,  | 
|         (select b.partner_name from xzx_city_partner b where a.partner_id=b.id) as partnerName  | 
|         from xzx_package_goods_info a where  | 
|         a.parent_id is null and a.del_flag=0  | 
|         <if test="id!= null and id != ''">  | 
|             AND id=#{id}  | 
|         </if>  | 
|         <if test="partnerId!= null and partnerId != ''">  | 
|             AND a.partner_id=#{partnerId}  | 
|         </if>  | 
|         <if test="packageId != null and packageId != ''">  | 
|             AND a.package_id=#{packageId}  | 
|         </if>  | 
|     </select>  | 
|   | 
|     <select id="queryOperateItemChildren1" resultType="com.xzx.gc.model.admin.ItemModel">  | 
|         select a.id,a.title,a.sort,a.item_type,a.city_id from xzx_package_goods_info a where a.del_flag=0 and  | 
|         a.parent_id is not null  | 
|         <if test="id!= null and id != ''">  | 
|             AND parent_id=#{id}  | 
|         </if>  | 
|     </select>  | 
|   | 
| </mapper> |