Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
江名洋
/
linkwe-scrm
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit dddc12c7
authored
Jan 05, 2021
by
18356073052
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
聊天工具侧边栏我的信息
1 parent
71ec1ca9
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
214 additions
and
0 deletions
linkwe-admin/src/main/java/com/linkwechat/web/controller/wecom/WeChatCollectionController.java
linkwe-wecom/src/main/java/com/linkwechat/wecom/domain/WeChatCollection.java
linkwe-wecom/src/main/java/com/linkwechat/wecom/mapper/WeChatCollectionMapper.java
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/IWeChatCollectionService.java
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/impl/WeChatCollectionServiceImpl.java
linkwe-wecom/src/main/resources/mapper/wecom/WeChatCollectionMapper.xml
linkwe-admin/src/main/java/com/linkwechat/web/controller/wecom/WeChatCollectionController.java
0 → 100644
View file @
dddc12c
package
com
.
linkwechat
.
web
.
controller
.
wecom
;
import
com.linkwechat.common.annotation.Log
;
import
com.linkwechat.common.core.controller.BaseController
;
import
com.linkwechat.common.core.domain.AjaxResult
;
import
com.linkwechat.common.enums.BusinessType
;
import
com.linkwechat.wecom.service.IWeChatCollectionService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.web.bind.annotation.PutMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.RestController
;
/**
* 聊天工具 侧边栏栏 素材收藏
*
* @author kwen
*/
@RequestMapping
(
value
=
"/wecom/chat/collection"
)
@RestController
public
class
WeChatCollectionController
extends
BaseController
{
@Autowired
private
IWeChatCollectionService
weChatCollectionService
;
/**
* 添加收藏
*/
@PreAuthorize
(
"@ss.hasPermi('chat:collection:add')"
)
@Log
(
title
=
"添加收藏"
,
businessType
=
BusinessType
.
INSERT
)
@PutMapping
public
AjaxResult
addCollection
(
@RequestParam
(
value
=
"materialId"
)
Long
materialId
,
@RequestParam
(
value
=
"userId"
)
Long
userId
)
{
return
toAjax
(
weChatCollectionService
.
addCollection
(
materialId
,
userId
));
}
/**
* 取消收藏
*/
@PreAuthorize
(
"@ss.hasPermi('chat:collection:delete')"
)
@Log
(
title
=
"取消收藏"
,
businessType
=
BusinessType
.
UPDATE
)
@PutMapping
public
AjaxResult
cancleCollection
(
@RequestParam
(
value
=
"materialId"
)
Long
materialId
,
@RequestParam
(
value
=
"userId"
)
Long
userId
)
{
return
toAjax
(
weChatCollectionService
.
cancleCollection
(
materialId
,
userId
));
}
}
linkwe-wecom/src/main/java/com/linkwechat/wecom/domain/WeChatCollection.java
0 → 100644
View file @
dddc12c
package
com
.
linkwechat
.
wecom
.
domain
;
import
com.linkwechat.common.core.domain.BaseEntity
;
import
lombok.Data
;
/**
* 聊天工具 侧边栏栏 素材收藏
*
* @author kwen
*/
@Data
public
class
WeChatCollection
extends
BaseEntity
{
/**
* id
*/
private
Long
collectionId
;
/**
* 素材id
*/
private
Long
materialId
;
/**
* 用户id
*/
private
Long
userId
;
}
linkwe-wecom/src/main/java/com/linkwechat/wecom/mapper/WeChatCollectionMapper.java
0 → 100644
View file @
dddc12c
package
com
.
linkwechat
.
wecom
.
mapper
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.linkwechat.wecom.domain.WeChatCollection
;
import
org.apache.ibatis.annotations.Param
;
/**
* 聊天工具 侧边栏栏 素材收藏
*
* @author kwen
*/
public
interface
WeChatCollectionMapper
extends
BaseMapper
<
WeChatCollection
>
{
/**
* 添加收藏
*
* @param chatCollection 收藏的素材信息
* @return 结果
*/
public
int
addCollection
(
WeChatCollection
chatCollection
);
/**
* 取消收藏
*
* @param materialId 素材id
* @param userId 用户id
* @return 结果
*/
public
int
dropCollection
(
@Param
(
"materialId"
)
Long
materialId
,
@Param
(
"userId"
)
Long
userId
);
/**
* 通过素材id和用户id查询当前素材的收藏条数
*
* @param materialId 素材id
* @param userId 用户id
* @return 当前素材收藏的条数
*/
public
int
countCollectionByMaterialIdAndUserId
(
@Param
(
"materialId"
)
Long
materialId
,
@Param
(
"userId"
)
Long
userId
);
}
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/IWeChatCollectionService.java
0 → 100644
View file @
dddc12c
package
com
.
linkwechat
.
wecom
.
service
;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
com.linkwechat.wecom.domain.WeChatCollection
;
/**
* 聊天工具 侧边栏栏 素材收藏
*
* @author kwen
*/
public
interface
IWeChatCollectionService
extends
IService
<
WeChatCollection
>
{
/**
* 添加收藏
*
* @param materialId 素材id
* @param userId 用户id
* @return 结果
*/
public
int
addCollection
(
Long
materialId
,
Long
userId
);
/**
* 取消收藏
*
* @param materialId 素材id
* @param userId 用户id
* @return 结果
*/
public
int
cancleCollection
(
Long
materialId
,
Long
userId
);
}
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/impl/WeChatCollectionServiceImpl.java
0 → 100644
View file @
dddc12c
package
com
.
linkwechat
.
wecom
.
service
.
impl
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.linkwechat.common.utils.SnowFlakeUtil
;
import
com.linkwechat.wecom.domain.WeChatCollection
;
import
com.linkwechat.wecom.mapper.WeChatCollectionMapper
;
import
com.linkwechat.wecom.service.IWeChatCollectionService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
/**
* 聊天工具 侧边栏栏 素材收藏
*
* @author kwen
*/
@Service
public
class
WeChatCollectionServiceImpl
extends
ServiceImpl
<
WeChatCollectionMapper
,
WeChatCollection
>
implements
IWeChatCollectionService
{
@Autowired
private
WeChatCollectionMapper
weChatCollectionMapper
;
@Override
public
int
addCollection
(
Long
materialId
,
Long
userId
)
{
WeChatCollection
chatCollection
=
new
WeChatCollection
();
chatCollection
.
setCollectionId
(
SnowFlakeUtil
.
nextId
());
chatCollection
.
setMaterialId
(
materialId
);
chatCollection
.
setUserId
(
userId
);
return
weChatCollectionMapper
.
addCollection
(
chatCollection
);
}
@Override
public
int
cancleCollection
(
Long
materialId
,
Long
userId
)
{
return
weChatCollectionMapper
.
dropCollection
(
materialId
,
userId
);
}
}
linkwe-wecom/src/main/resources/mapper/wecom/WeChatCollectionMapper.xml
0 → 100644
View file @
dddc12c
<?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>
</mapper>
\ No newline at end of file
\ No newline at end of file
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment