chengf
2025-12-11 f29e6f31e4f2d533124fc68346b7cc072f427c9b
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
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
<?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="commentServiceDaoImpl">
    
 
 
 
    <!-- 评论信息 保存 add by wuxw 2018-07-12 -->
    <insert id="saveCommentInstance" parameterType="Map">
        insert into c_comment(comment_id,user_id,b_id,comment_type_cd,out_id,month,status_cd)
        values(#{commentId},#{userId},#{bId},#{commentTypeCd},#{outId},#{month},'0')
    </insert>
 
    <!-- 评论信息 保存 add by wuxw 2018-07-12 -->
    <insert id="saveSubCommentInstance" parameterType="Map">
        insert into c_sub_comment(sub_comment_id,comment_id,parent_sub_comment_id,b_id,sub_comment_type_cd,comment_context,month,status_cd)
        values(#{subCommentId},#{commentId},#{parentSubCommentId},#{bId},#{subCommentTypeCd},#{commentContext},#{month},'0')
    </insert>
 
    <!-- 保存购买记录属性 add by wuxw 2018-07-08 -->
    <insert id="saveSubCommentAttrInstance" parameterType="Map">
        insert into c_sub_comment_attr(sub_comment_id,b_id,attr_id,spec_cd,value,month,status_cd)
        values(#{subCommentId},#{bId},#{attrId},#{specCd},#{value},#{month},'0')
    </insert>
 
 
 
 
    <!-- 查询商品目录 instance add by wuxw 2018-07-08 -->
    <select id="getComment" parameterType="Map" resultType="Map">
        select c.comment_id,c.user_id,c.b_id,c.comment_type_cd,c.out_id,c.month,c.status_cd
        from c_comment c
        where 1=1
        <if test="statusCd != null and statusCd != ''">
            and c.status_cd = #{statusCd}
        </if>
        <if test="bId != null and bId !=''">
            and c.b_id = #{bId}
        </if>
        <if test="commentId != null and commentId !=''">
            and c.comment_id = #{commentId}
        </if>
    </select>
 
    <!-- 查询商品目录 instance add by wuxw 2018-07-08 -->
    <select id="getSubComment" parameterType="Map" resultType="Map">
        select sc.sub_comment_id,sc.comment_id,sc.parent_sub_comment_id,sc.b_id,sc.sub_comment_type_cd,sc.comment_context,sc.month,sc.status_cd
        from c_sub_comment sc
        where 1=1
        <if test="statusCd != null and statusCd != ''">
            and sc.status_cd = #{statusCd}
        </if>
        <if test="bId != null and bId !=''">
            and sc.b_id = #{bId}
        </if>
        <if test="subCommentId != null and subCommentId !=''">
            and sc.sub_comment_id = #{subCommentId}
        </if>
        <if test="commentId != null and commentId != ''">
            and sc.comment_id = #{commentId}
        </if>
    </select>
 
    <!-- 查询购买记录属性信息 add by wuxw 2018-07-03 -->
    <select id="getSubCommentAttrs" parameterType="Map" resultType="Map">
        select sca.b_id,sca.attr_id,sca.sub_comment_id,sca.spec_cd,sca.value,sca.status_cd
        from c_sub_comment_attr sca
        where
        1=1
        <if test="statusCd != null and statusCd != ''">
            and sca.status_cd = #{statusCd}
        </if>
        <if test="bId != null and bId !=''">
            and sca.b_id = #{bId}
        </if>
        <if test="subCommentId != null and subCommentId !=''">
            and sca.sub_comment_id = #{subCommentId}
        </if>
        <if test="attrId != null and attrId != ''">
            and sca.attr_id = #{attrId}
        </if>
    </select>
 
    <!-- 修改 评论信息 add by wuxw 2018-07-08 -->
    <update id="updateCommentInstance" parameterType="Map">
        update c_comment c set c.status_cd = #{statusCd}
        <if test="newBId != null and newBId != ''">
            ,c.b_id = #{newBId}
        </if>
        where 1=1
        <if test="bId != null and bId !=''">
            and c.b_id = #{bId}
        </if>
        <if test="commentId != null and commentId !=''">
            and c.comment_id = #{commentId}
        </if>
    </update>
 
    <update id="updateSubCommentInstance" parameterType="Map">
        update c_sub_comment sc set sc.status_cd = #{statusCd}
        <if test="newBId != null and newBId != ''">
            ,sc.b_id = #{newBId}
        </if>
        where 1=1
        <if test="bId != null and bId !=''">
            and sc.b_id = #{bId}
        </if>
        <if test="subCommentId != null and subCommentId !=''">
            and sc.sub_comment_id = #{subCommentId}
        </if>
        <if test="commentId != null and commentId !=''">
            and sc.comment_id = #{commentId}
        </if>
    </update>
 
    <!-- 修改评价属性信息 add by wuxw 2018-07-03 -->
    <update id="updateSubCommentAttrInstance" parameterType="Map">
        update c_sub_comment_attr bca set bca.status_cd = #{statusCd}
        <if test="newBId != null and newBId != ''">
            ,bca.b_id = #{newBId}
        </if>
        <if test="value != null and value != ''">
            ,bca.value = #{value}
        </if>
        where 1=1
        <if test="bId != null and bId !=''">
            and bca.b_id = #{bId}
        </if>
        <if test="subCommentId != null and subCommentId !=''">
            and bca.sub_comment_id = #{subCommentId}
        </if>
        <if test="specCd != null and specCd !=''">
            and bca.spec_cd = #{specCd}
        </if>
        <if test="attrId != null and attrId !=''">
            and bca.attr_id = #{attrId}
        </if>
    </update>
 
 
    <insert id="saveSubCommentPhotoInstance" parameterType="Map">
        insert into c_sub_comment_photo(comment_photo_id,b_id,sub_comment_id,comment_photo_type_cd,photo,month,status_cd)
        values(#{commentPhotoId},#{bId},#{subCommentId},#{commentPhotoTypeCd},#{photo},#{month},'0')
    </insert>
 
    <select id="getSubCommentPhotos" parameterType="Map" resultType="Map">
        select scp.comment_photo_id,scp.b_id,scp.sub_comment_id,scp.comment_photo_type_cd,scp.photo,scp.month,scp.status_cd
        from c_sub_comment_photo scp
        where 1=1
        <if test="statusCd != null and statusCd != ''">
            and scp.status_cd = #{statusCd}
        </if>
        <if test="bId != null and bId !=''">
            and scp.b_id = #{bId}
        </if>
        <if test="commentPhotoId != null and commentPhotoId !=''">
            and scp.comment_photo_id = #{commentPhotoId}
        </if>
    </select>
 
    <update id="updateSubCommentPhotoInstance" parameterType="Map">
        update c_sub_comment_photo scp set scp.status_cd = #{statusCd}
        <if test="newBId != null and newBId != ''">
            ,scp.b_id = #{newBId}
        </if>
        where 1=1
        <if test="bId != null and bId !=''">
            and scp.b_id = #{bId}
        </if>
        <if test="commentPhotoId != null and commentPhotoId !=''">
            and scp.comment_photo_id = #{commentPhotoId}
        </if>
    </update>
 
    <insert id="saveCommentScoreInstance" parameterType="Map">
        insert into c_comment_score(comment_score_id,b_id,comment_id,score_type_cd,value,month,status_cd)
        values(#{commentScoreId},#{bId},#{commentId},#{scoreTypeCd},#{value},#{month},'0')
    </insert>
 
    <select id="getCommentScores" parameterType="Map" resultType="Map">
        select cs.comment_score_id,cs.b_id,cs.comment_id,cs.score_type_cd,cs.value,cs.month,cs.status_cd
        from c_comment_score cs
        where 1=1
        <if test="statusCd != null and statusCd != ''">
            and cs.status_cd = #{statusCd}
        </if>
        <if test="bId != null and bId !=''">
            and cs.b_id = #{bId}
        </if>
        <if test="commentScoreId != null and commentScoreId !=''">
            and cs.comment_score_id = #{commentScoreId}
        </if>
        <if test="commentId != null and commentId !=''">
            and cs.comment_id = #{commentId}
        </if>
    </select>
 
    <update id="updateCommentScoreInstance" parameterType="Map">
        update c_comment_score cs set cs.status_cd = #{statusCd}
        <if test="newBId != null and newBId != ''">
            ,cs.b_id = #{newBId}
        </if>
        where 1=1
        <if test="bId != null and bId !=''">
            and cs.b_id = #{bId}
        </if>
        <if test="commentScoreId != null and commentScoreId !=''">
            and cs.comment_score_id = #{commentScoreId}
        </if>
        <if test="commentId != null and commentId !=''">
            and cs.comment_id = #{commentId}
        </if>
    </update>
</mapper>