WeChatCollectionMapper.xml
1.6 KB
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
<?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.linkwechat.wecom.mapper.WeChatCollectionMapper">
<insert id="addCollection">
INSERT INTO
we_chat_collection(collection_id,material_id,user_id,create_by,create_time,update_by,update_time)
VALUES(#{collectionId},#{materialId},#{userId},#{createBy},#{createTime},#{updateBy},#{updateTime})
</insert>
<delete id="dropCollection">
DELETE FROM
we_chat_collection
<where>
material_id=#{materialId} AND user_id=#{userId}
</where>
</delete>
<select id="countCollectionByMaterialIdAndUserId" resultType="java.lang.Integer">
SELECT COUNT(1) FROM we_chat_collection
<where>
material_id=#{materialId} AND user_id=#{userId}
</where>
</select>
<select id="findCollections" resultType="com.linkwechat.wecom.domain.vo.WeChatSideVo">
SELECT
wcc.material_id,
wm.material_name,
wm.material_url,
wm.content,
wc.media_type,
wcc.create_time
FROM
we_chat_collection wcc
LEFT JOIN we_material wm ON wcc.material_id = wm.id
LEFT JOIN we_category wc ON wm.category_id = wc.id
<where>
wcc.user_id=#{userId}
<if test="keyword!=null and keyword!=''">
AND wm.material_name LIKE CONCAT('%',#{keyword},'%')
</if>
</where>
</select>
</mapper>