Helius
2021-06-25 f80e1595c702e1251eaab8ec9fe112a53736df7f
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
<?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>