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 ca73dcfd
authored
Sep 18, 2020
by
水库浪子
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
标签接口重构
1 parent
9ace5515
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
68 additions
and
40 deletions
linkwe-admin/src/main/java/com/linkwechat/web/controller/wecom/WeTagGroupController.java
linkwe-common/src/main/java/com/linkwechat/common/core/domain/BaseEntity.java
linkwe-wecom/src/main/java/com/linkwechat/wecom/mapper/WeTagMapper.java
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/impl/WeTagGroupServiceImpl.java
linkwe-wecom/src/main/resources/mapper/wecom/WeTagGroupMapper.xml
linkwe-wecom/src/main/resources/mapper/wecom/WeTagMapper.xml
linkwe-admin/src/main/java/com/linkwechat/web/controller/wecom/WeTagGroupController.java
View file @
ca73dcf
package
com
.
linkwechat
.
web
.
controller
.
wecom
;
import
java.util.List
;
import
com.linkwechat.common.annotation.Log
;
import
com.linkwechat.common.core.controller.BaseController
;
import
com.linkwechat.common.core.domain.AjaxResult
;
import
com.linkwechat.common.core.page.TableDataInfo
;
import
com.linkwechat.common.enums.BusinessType
;
import
com.linkwechat.common.utils.poi.ExcelUtil
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.GetMapping
;
...
...
@@ -39,36 +37,15 @@ public class WeTagGroupController extends BaseController
*/
@PreAuthorize
(
"@ss.hasPermi('wecom:group:list')"
)
@GetMapping
(
"/list"
)
public
AjaxResult
list
(
)
public
TableDataInfo
list
(
WeTagGroup
weTagGroup
)
{
return
AjaxResult
.
success
(
weTagGroupService
.
selectWeTagGroupList
(
new
WeTagGroup
()
)
startPage
();
return
getDataTable
(
weTagGroupService
.
selectWeTagGroupList
(
weTagGroup
)
);
}
/**
* 导出标签组列表
*/
@PreAuthorize
(
"@ss.hasPermi('wecom:group:export')"
)
@Log
(
title
=
"标签组"
,
businessType
=
BusinessType
.
EXPORT
)
@GetMapping
(
"/export"
)
public
AjaxResult
export
(
WeTagGroup
weTagGroup
)
{
List
<
WeTagGroup
>
list
=
weTagGroupService
.
selectWeTagGroupList
(
weTagGroup
);
ExcelUtil
<
WeTagGroup
>
util
=
new
ExcelUtil
<
WeTagGroup
>(
WeTagGroup
.
class
);
return
util
.
exportExcel
(
list
,
"group"
);
}
/**
* 获取标签组详细信息
*/
@PreAuthorize
(
"@ss.hasPermi('wecom:group:query')"
)
@GetMapping
(
value
=
"/{id}"
)
public
AjaxResult
getInfo
(
@PathVariable
(
"id"
)
Long
id
)
{
return
AjaxResult
.
success
(
weTagGroupService
.
selectWeTagGroupById
(
id
));
}
/**
* 新增标签组
...
...
linkwe-common/src/main/java/com/linkwechat/common/core/domain/BaseEntity.java
View file @
ca73dcf
...
...
@@ -26,7 +26,7 @@ public class BaseEntity implements Serializable
/** 创建时间 */
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
)
private
Date
createTime
;
private
Date
createTime
=
new
Date
()
;
/** 更新者 */
private
String
updateBy
;
...
...
linkwe-wecom/src/main/java/com/linkwechat/wecom/mapper/WeTagMapper.java
View file @
ca73dcf
...
...
@@ -2,7 +2,6 @@ package com.linkwechat.wecom.mapper;
import
java.util.List
;
import
com.linkwechat.wecom.domain.WeTag
;
import
org.apache.ibatis.annotations.Param
;
/**
* 企业微信标签Mapper接口
...
...
@@ -66,5 +65,13 @@ public interface WeTagMapper
* @param weTags
* @return
*/
public
int
batchInsetWeTag
(
@Param
(
"weTags"
)
List
<
WeTag
>
weTags
);
public
int
batchInsetWeTag
(
List
<
WeTag
>
weTags
);
/**
* 标签批量更新
* @param weTags
* @return
*/
public
int
batchUpdateWeTag
(
List
<
WeTag
>
weTags
);
}
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/impl/WeTagGroupServiceImpl.java
View file @
ca73dcf
...
...
@@ -83,9 +83,18 @@ public class WeTagGroupServiceImpl implements IWeTagGroupService
* @return 结果
*/
@Override
@Transactional
public
int
updateWeTagGroup
(
WeTagGroup
weTagGroup
)
{
return
weTagGroupMapper
.
updateWeTagGroup
(
weTagGroup
);
int
returnCode
=
weTagGroupMapper
.
updateWeTagGroup
(
weTagGroup
);
if
(
returnCode
>
0
){
List
<
WeTag
>
weTags
=
weTagGroup
.
getWeTags
();
if
(
CollectionUtil
.
isNotEmpty
(
weTags
)){
weTagMapper
.
batchUpdateWeTag
(
weTags
);
}
}
return
returnCode
;
}
/**
...
...
linkwe-wecom/src/main/resources/mapper/wecom/WeTagGroupMapper.xml
View file @
ca73dcf
...
...
@@ -8,6 +8,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result
property=
"id"
column=
"id"
/>
<result
property=
"gourpName"
column=
"gourp_name"
/>
<result
property=
"createTime"
column=
"create_time"
/>
<collection
property=
"weTags"
column=
"weTags.id"
ofType=
"com.linkwechat.wecom.domain.WeTag"
>
<id
property=
"id"
column=
"tagId"
/>
<result
property=
"groupId"
column=
"group_id"
/>
<result
property=
"name"
column=
"name"
/>
</collection>
</resultMap>
<sql
id=
"selectWeTagGroupVo"
>
...
...
@@ -15,10 +20,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</sql>
<select
id=
"selectWeTagGroupList"
parameterType=
"WeTagGroup"
resultMap=
"WeTagGroupResult"
>
<include
refid=
"selectWeTagGroupVo"
/>
<where>
<if
test=
"gourpName != null and gourpName != ''"
>
and gourp_name like concat('%', #{gourpName}, '%')
</if>
</where>
SELECT
wtg.*,
wt.id as tagId,
wt.group_id,
wt.name
FROM
we_tag_group wtg
INNER JOIN we_tag wt ON wtg.id = wt.group_id
where
wtg.status=0 and wt.status=0
<if
test=
"gourpName != null and gourpName != ''"
>
and gourp_name like concat('%', #{gourpName}, '%')
</if>
</select>
<select
id=
"selectWeTagGroupById"
parameterType=
"Long"
resultMap=
"WeTagGroupResult"
>
...
...
@@ -53,11 +65,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
delete from we_tag_group where id = #{id}
</delete>
<delete
id=
"deleteWeTagGroupByIds"
parameterType=
"String"
>
delete from we_tag_group where id in
<update
id=
"deleteWeTagGroupByIds"
parameterType=
"String"
>
update we_tag_group set status=1
where id in
<foreach
item=
"id"
collection=
"array"
open=
"("
separator=
","
close=
")"
>
#{id}
</foreach>
</delete>
</update>
</mapper>
\ No newline at end of file
linkwe-wecom/src/main/resources/mapper/wecom/WeTagMapper.xml
View file @
ca73dcf
...
...
@@ -67,11 +67,32 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<insert
id=
"batchInsetWeTag"
>
insert into
person
(id, group_id, name, create_time)
insert into
we_tag
(id, group_id, name, create_time)
values
<foreach
collection=
"
tags
"
item=
"tag"
index=
"index"
separator=
","
>
<foreach
collection=
"
list
"
item=
"tag"
index=
"index"
separator=
","
>
(#{tag.id},#{tag.groupId},#{tag.name},#{tag.createTime})
</foreach>
</insert>
<update
id=
"batchUpdateWeTag"
>
update we_tag set
name=
<foreach
collection=
"list"
item=
"tag"
index=
"index"
separator=
" "
open=
"case id"
close=
"end"
>
when #{tag.id} then #{tag.name}
</foreach>
,status=
<foreach
collection=
"list"
item=
"tag"
index=
"index"
separator=
" "
open=
"case id"
close=
"end"
>
when #{tag.id} then #{tag.status}
</foreach>
where id in
<foreach
collection=
"list"
item=
"tag"
index=
"index"
separator=
","
open=
"("
close=
")"
>
#{tag.id}
</foreach>
</update>
</mapper>
\ 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