sf
jiangping
2025-04-30 dcdb0231034810232f2542f3865666ebf72daf11
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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
<?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.doumee.dao.business.GoodsMapper">
 
 
    <resultMap id="BaseResultMap" type="com.doumee.dao.business.model.Goods">
        <id property="id" column="id"/>
        <collection property="goodsParamList" ofType="com.doumee.dao.business.model.GoodsParam"
                    select="selectParamByGoodsId" column="{goodsId=id}"
        >
 
        </collection>
 
    </resultMap>
    <select id="selectParamByGoodsId"   resultType="com.doumee.dao.business.model.GoodsParam">
        SELECT  gp.GOODS_ID   FROM  cate_param_select cps  ,  goods_param gp
        where     gp.PRAMA_ID = cps.PARAM_ID     and gp.VAL = cps.`NAME`
          and gp.GOODS_ID =#{goodsId}
    </select>
 
    <select id="selectListByCollection1" parameterType="com.doumee.dao.business.model.Goods" resultType="com.doumee.dao.business.model.Goods">
        SELECT
        t.id,
        t.creator,
        t.create_date,
        t.editor,
        t.edit_date,
        t.isdeleted,
        t.remark,
        t.company_id,
        t.NAME,
        t.STATUS,
        t.sortnum,
        t.imgurl,
        t.category_id,
        t.brand_id,
        t.zd_price,
        t.price,
        t.content,
 
        t.attr_secod_ids,
        t.attr_first_names,
        t.attr_secod_names,
        t.pinyin,
        t.short_pinyin,
        t.goods_id,
        t.type,
        t.categoryName,
        t.brandName,
        t.attrFirst,
        t.attrSecond,
        t.categoryImgurl,
        t.attr_first_ids
        FROM
        `zhuboshoplist` t
        WHERE
        t.STATUS = 0
        <if test="companyId!=null and companyId!=''">
            AND t.company_id =#{companyId}
        </if>
        <if test="brandId!=null and brandId!=''">
            AND t.brand_id =#{brandId}
        </if>
        <if test="categoryId!=null and categoryId!=''">
            AND t.CATEGORY_ID =#{categoryId}
        </if>
        AND t.isdeleted = 0
        ORDER BY
        t.id DESC
    </select>
 
 
    <select id="selectListByCollection" parameterType="com.doumee.dao.business.model.Goods" resultType="com.doumee.dao.business.model.Goods">
        SELECT
        t.id,
        t.creator,
        t.create_date,
        t.editor,
        t.edit_date,
        t.isdeleted,
        t.remark,
        t.company_id,
        t.NAME,
        t.STATUS,
        t.sortnum,
        t.imgurl,
        t.category_id,
        t.brand_id,
        t.zd_price,
        t.price,
        t.content,
 
        t.attr_secod_ids,
        t.attr_first_names,
        t.attr_secod_names,
        t.pinyin,
        t.short_pinyin,
        t.goods_id,
        t.type,
        t1.NAME AS categoryName,
        t2.NAME AS brandName,
        t1.attr_first AS attrFirst,
        t1.attr_second AS attrSecond,
        t1.imgurl AS categoryImgurl,
        (
        SELECT IFNULL(GROUP_CONCAT(cps.id),"" )   FROM  cate_param_select cps  ,  goods_param gp
        where     gp.PRAMA_ID = cps.PARAM_ID     and gp.VAL = cps.`NAME`
        and gp.GOODS_ID =t.id
        ) as attr_first_ids
        FROM
        `goods` t
        LEFT JOIN `category` t1 ON ( t1.id = t.category_id )
        LEFT JOIN `brand` t2 ON ( t2.id = t.brand_id )
        WHERE
        t.STATUS = 0
        <if test="companyId!=null and companyId!=''">
            AND t.company_id =#{companyId}
        </if>
        <if test="brandId!=null and brandId!=''">
            AND t.brand_id =#{brandId}
        </if>
        <if test="categoryId!=null and categoryId!=''">
            AND t.CATEGORY_ID =#{categoryId}
        </if>
        AND t.isdeleted = 0
        ORDER BY
        t.id DESC
    </select>
 
 
</mapper>