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 96c97fa6
authored
Dec 09, 2021
by
danmo
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
分类接口添加校验,列表排序
1 parent
fa109883
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
8 additions
and
3 deletions
linkwe-admin/src/main/java/com/linkwechat/web/controller/wecom/WeCategoryController.java
linkwe-wecom/src/main/java/com/linkwechat/wecom/domain/WeCategory.java
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/impl/WeCategoryServiceImpl.java
linkwe-admin/src/main/java/com/linkwechat/web/controller/wecom/WeCategoryController.java
View file @
96c97fa
...
@@ -14,6 +14,7 @@ import io.swagger.annotations.Api;
...
@@ -14,6 +14,7 @@ import io.swagger.annotations.Api;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.*
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
...
@@ -59,7 +60,7 @@ public class WeCategoryController extends BaseController {
...
@@ -59,7 +60,7 @@ public class WeCategoryController extends BaseController {
@Log
(
title
=
"添加类目"
,
businessType
=
BusinessType
.
INSERT
)
@Log
(
title
=
"添加类目"
,
businessType
=
BusinessType
.
INSERT
)
@PostMapping
@PostMapping
@ApiOperation
(
"添加类目"
)
@ApiOperation
(
"添加类目"
)
public
AjaxResult
add
(
@RequestBody
WeCategory
category
)
{
public
AjaxResult
add
(
@
Validated
@
RequestBody
WeCategory
category
)
{
weCategoryService
.
insertWeCategory
(
category
);
weCategoryService
.
insertWeCategory
(
category
);
return
AjaxResult
.
success
();
return
AjaxResult
.
success
();
}
}
...
@@ -71,7 +72,7 @@ public class WeCategoryController extends BaseController {
...
@@ -71,7 +72,7 @@ public class WeCategoryController extends BaseController {
@Log
(
title
=
"更新目录"
,
businessType
=
BusinessType
.
UPDATE
)
@Log
(
title
=
"更新目录"
,
businessType
=
BusinessType
.
UPDATE
)
@PutMapping
@PutMapping
@ApiOperation
(
"更新目录"
)
@ApiOperation
(
"更新目录"
)
public
AjaxResult
edit
(
@RequestBody
WeCategory
category
)
{
public
AjaxResult
edit
(
@
Validated
@
RequestBody
WeCategory
category
)
{
weCategoryService
.
updateWeCategory
(
category
);
weCategoryService
.
updateWeCategory
(
category
);
return
AjaxResult
.
success
();
return
AjaxResult
.
success
();
}
}
...
...
linkwe-wecom/src/main/java/com/linkwechat/wecom/domain/WeCategory.java
View file @
96c97fa
...
@@ -11,6 +11,8 @@ import lombok.experimental.SuperBuilder;
...
@@ -11,6 +11,8 @@ import lombok.experimental.SuperBuilder;
import
lombok.Data
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
import
lombok.NoArgsConstructor
;
import
javax.validation.constraints.NotEmpty
;
@Data
@Data
@TableName
(
"we_category"
)
@TableName
(
"we_category"
)
@SuperBuilder
@SuperBuilder
...
@@ -31,6 +33,7 @@ public class WeCategory extends BaseEntity {
...
@@ -31,6 +33,7 @@ public class WeCategory extends BaseEntity {
@ApiModelProperty
(
"分类名称"
)
@ApiModelProperty
(
"分类名称"
)
@NotEmpty
(
message
=
"分类名称不能为空"
)
private
String
name
;
private
String
name
;
...
...
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/impl/WeCategoryServiceImpl.java
View file @
96c97fa
...
@@ -4,6 +4,7 @@ import cn.hutool.core.date.DateUtil;
...
@@ -4,6 +4,7 @@ import cn.hutool.core.date.DateUtil;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.linkwechat.common.constant.Constants
;
import
com.linkwechat.common.constant.Constants
;
import
com.linkwechat.common.core.domain.BaseEntity
;
import
com.linkwechat.common.core.domain.Tree
;
import
com.linkwechat.common.core.domain.Tree
;
import
com.linkwechat.common.exception.wecom.WeComException
;
import
com.linkwechat.common.exception.wecom.WeComException
;
import
com.linkwechat.common.utils.SnowFlakeUtil
;
import
com.linkwechat.common.utils.SnowFlakeUtil
;
...
@@ -62,7 +63,7 @@ public class WeCategoryServiceImpl extends ServiceImpl<WeCategoryMapper,WeCatego
...
@@ -62,7 +63,7 @@ public class WeCategoryServiceImpl extends ServiceImpl<WeCategoryMapper,WeCatego
public
List
<?
extends
Tree
<?>>
findWeCategoryByMediaType
(
String
mediaType
)
{
public
List
<?
extends
Tree
<?>>
findWeCategoryByMediaType
(
String
mediaType
)
{
List
<
WeCategory
>
weCategories
=
this
.
list
(
new
LambdaQueryWrapper
<
WeCategory
>()
List
<
WeCategory
>
weCategories
=
this
.
list
(
new
LambdaQueryWrapper
<
WeCategory
>()
.
eq
(
WeCategory:
:
getMediaType
,
mediaType
)
.
eq
(
WeCategory:
:
getMediaType
,
mediaType
)
.
eq
(
WeCategory:
:
getDelFlag
,
Constants
.
NORMAL_CODE
));
.
eq
(
WeCategory:
:
getDelFlag
,
Constants
.
NORMAL_CODE
)
.
orderByDesc
(
BaseEntity:
:
getCreateTime
)
);
List
<
WeCategoryVo
>
weCategoryVos
=
new
ArrayList
<>();
List
<
WeCategoryVo
>
weCategoryVos
=
new
ArrayList
<>();
weCategories
.
forEach
(
c
->
{
weCategories
.
forEach
(
c
->
{
WeCategoryVo
weCategoryVo
=
new
WeCategoryVo
();
WeCategoryVo
weCategoryVo
=
new
WeCategoryVo
();
...
...
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