记得上下班打卡 | git大法好,push需谨慎
Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
liquidnet-bus-v1
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
董敬伟
liquidnet-bus-v1
Commits
5352a07d
Commit
5352a07d
authored
Dec 27, 2021
by
zhengfuxin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
banner 增删改查
parent
4eae69c5
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
104 additions
and
2 deletions
+104
-2
GoblinFrontBannerController.java
...ntroller/zhengzai/goblin/GoblinFrontBannerController.java
+36
-0
GoblinFrontBannerServiceImpl.java
...gzai/goblin/service/imp/GoblinFrontBannerServiceImpl.java
+68
-2
No files found.
liquidnet-bus-client/liquidnet-client-admin/liquidnet-client-admin-web/src/main/java/com/liquidnet/client/admin/web/controller/zhengzai/goblin/GoblinFrontBannerController.java
View file @
5352a07d
...
...
@@ -44,4 +44,40 @@ public class GoblinFrontBannerController extends BaseController {
}
}
@PostMapping
(
"update"
)
@ApiOperation
(
value
=
"修改banner"
)
@ResponseBody
public
AjaxResult
update
(
@RequestBody
GoblinFrontBanner
goblinFrontBanner
)
{
logger
.
info
(
"修改banner{}"
,
JSON
.
toJSONString
(
goblinFrontBanner
));
boolean
result
=
goblinFrontBannerService
.
update
(
goblinFrontBanner
);
if
(
result
)
{
return
success
(
"操作成功"
);
}
else
{
return
error
(
"操作失败"
);
}
}
@PostMapping
(
"delete"
)
@ApiOperation
(
value
=
"删除banner"
)
@ResponseBody
public
AjaxResult
delete
(
@RequestBody
GoblinFrontBanner
goblinFrontBanner
)
{
logger
.
info
(
"删除banner{}"
,
JSON
.
toJSONString
(
goblinFrontBanner
));
boolean
result
=
goblinFrontBannerService
.
delte
(
goblinFrontBanner
.
getMid
());
if
(
result
)
{
return
success
(
"操作成功"
);
}
else
{
return
error
(
"操作失败"
);
}
}
@PostMapping
(
"getOne"
)
@ApiOperation
(
value
=
"查看详情"
)
@ResponseBody
public
AjaxResult
getOne
(
@RequestBody
GoblinFrontBanner
goblinFrontBanner
)
{
logger
.
info
(
"修改banner{}"
,
JSON
.
toJSONString
(
goblinFrontBanner
));
GoblinFrontBanner
goblinFrontBanner1
=
goblinFrontBannerService
.
getOne
(
goblinFrontBanner
.
getMid
());
return
AjaxResult
.
success
(
goblinFrontBanner1
);
}
}
liquidnet-bus-client/liquidnet-client-admin/liquidnet-client-admin-zhengzai/src/main/java/com/liquidnet/client/admin/zhengzai/goblin/service/imp/GoblinFrontBannerServiceImpl.java
View file @
5352a07d
package
com
.
liquidnet
.
client
.
admin
.
zhengzai
.
goblin
.
service
.
imp
;
import
com.alibaba.fastjson.JSON
;
import
com.liquidnet.client.admin.zhengzai.goblin.service.IGoblinFrontBannerService
;
import
com.liquidnet.client.admin.zhengzai.kylin.utils.DataUtils
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
...
...
@@ -8,14 +9,22 @@ import com.liquidnet.common.cache.redis.util.RedisGoblinUtil;
import
com.liquidnet.common.cache.redis.util.RedisUtil
;
import
com.liquidnet.commons.lang.util.CollectionUtil
;
import
com.liquidnet.commons.lang.util.IDGenerator
;
import
com.liquidnet.commons.lang.util.JsonUtils
;
import
com.liquidnet.service.goblin.constant.GoblinRedisConst
;
import
com.liquidnet.service.goblin.entity.GoblinFrontBanner
;
import
com.liquidnet.service.goblin.mapper.GoblinFrontBannerMapper
;
import
com.liquidnet.service.kylin.dto.vo.mongo.KylinOrderTicketVo
;
import
com.mongodb.BasicDBObject
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.data.mongodb.core.MongoTemplate
;
import
org.springframework.data.mongodb.core.aggregation.VariableOperators
;
import
org.springframework.data.mongodb.core.query.Criteria
;
import
org.springframework.data.mongodb.core.query.Query
;
import
org.springframework.data.mongodb.core.query.Update
;
import
org.springframework.stereotype.Service
;
import
java.util.ArrayList
;
import
java.util.stream.Collectors
;
/**
* <p>
...
...
@@ -30,8 +39,6 @@ public class GoblinFrontBannerServiceImpl extends ServiceImpl<GoblinFrontBannerM
@Autowired
private
MongoTemplate
mongoTemplate
;
@Autowired
private
DataUtils
dataUtils
;
@Autowired
GoblinFrontBannerMapper
goblinFrontBannerMapper
;
@Autowired
private
RedisDataSourceUtil
redisDataSourceUtil
;
...
...
@@ -58,5 +65,64 @@ public class GoblinFrontBannerServiceImpl extends ServiceImpl<GoblinFrontBannerM
}
return
true
;
}
/***
* @author zhangfuxin
* @Description: 修改
* @date 2021/12/27 下午4:03
*/
public
boolean
update
(
GoblinFrontBanner
goblinFrontBanner
){
//数据库修改
goblinFrontBannerMapper
.
updateById
(
goblinFrontBanner
);
//mongodb修改
BasicDBObject
orderObject
=
new
BasicDBObject
(
"$set"
,
JSON
.
parse
(
JsonUtils
.
toJson
(
goblinFrontBanner
)));
mongoTemplate
.
getCollection
(
GoblinFrontBanner
.
class
.
getSimpleName
()).
updateOne
(
Query
.
query
(
Criteria
.
where
(
"bannerId"
).
is
(
goblinFrontBanner
.
getBannerId
())).
getQueryObject
(),
orderObject
);
//redis 修改
if
(
redisDataSourceUtil
.
getRedisGoblinUtil
().
hasKey
(
GoblinRedisConst
.
FRONT_BANNER
+
"0"
)){
ArrayList
<
GoblinFrontBanner
>
list
=
(
ArrayList
<
GoblinFrontBanner
>)
redisDataSourceUtil
.
getRedisGoblinUtil
().
get
(
GoblinRedisConst
.
FRONT_BANNER
+
0
);
list
=
(
ArrayList
<
GoblinFrontBanner
>)
list
.
stream
().
map
(
goblinFrontBanner1
->{
if
(
goblinFrontBanner1
.
getBannerId
().
equals
(
goblinFrontBanner
.
getBannerId
())){
return
goblinFrontBanner
;
}
return
goblinFrontBanner1
;
}).
collect
(
Collectors
.
toList
());
redisDataSourceUtil
.
getRedisGoblinUtil
().
set
(
GoblinRedisConst
.
FRONT_BANNER
+
"0"
,
list
);
}
return
true
;
}
/**
* @author zhangfuxin
* @Description:查看详情
* @date 2021/12/27 下午4:34
*/
public
GoblinFrontBanner
getOne
(
Long
id
){
return
goblinFrontBannerMapper
.
selectById
(
id
);
}
/**
* @author zhangfuxin
* @Description: 删除 banner
* @date 2021/12/27 下午4:36
*/
public
boolean
delte
(
Long
id
){
//数据库
goblinFrontBannerMapper
.
deleteById
(
id
);
//mongodb 删除
mongoTemplate
.
remove
(
Query
.
query
(
Criteria
.
where
(
"mid"
).
is
(
id
)),
GoblinFrontBanner
.
class
,
GoblinFrontBanner
.
class
.
getSimpleName
());
//redis 删除
if
(
redisDataSourceUtil
.
getRedisGoblinUtil
().
hasKey
(
GoblinRedisConst
.
FRONT_BANNER
+
"0"
)){
ArrayList
<
GoblinFrontBanner
>
list
=
(
ArrayList
<
GoblinFrontBanner
>)
redisDataSourceUtil
.
getRedisGoblinUtil
().
get
(
GoblinRedisConst
.
FRONT_BANNER
+
0
);
list
=
(
ArrayList
<
GoblinFrontBanner
>)
list
.
stream
().
map
(
goblinFrontBanner1
->{
if
(
goblinFrontBanner1
.
getMid
().
equals
(
id
)){
return
null
;
}
return
goblinFrontBanner1
;
}).
collect
(
Collectors
.
toList
());
redisDataSourceUtil
.
getRedisGoblinUtil
().
set
(
GoblinRedisConst
.
FRONT_BANNER
+
"0"
,
list
);
}
return
true
;
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
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 comment