|
@@ -1,94 +0,0 @@
|
|
|
-package com.cyksj.web.controller.manage.mirrorshop;
|
|
|
|
|
-
|
|
|
|
|
-import com.cyksj.dto.Result;
|
|
|
|
|
-import com.cyksj.enums.GatewayResponse;
|
|
|
|
|
-import com.cyksj.model.entity.UserMirrorShopManageAdvertise;
|
|
|
|
|
-import com.cyksj.service.mange.RefreshCacheService;
|
|
|
|
|
-import com.cyksj.service.mirrorshop.UserMirrorShopAdvertiseService;
|
|
|
|
|
-import com.ejlchina.searcher.BeanSearcher;
|
|
|
|
|
-import com.ejlchina.searcher.SearchResult;
|
|
|
|
|
-import com.ejlchina.searcher.util.MapUtils;
|
|
|
|
|
-import lombok.RequiredArgsConstructor;
|
|
|
|
|
-import lombok.extern.slf4j.Slf4j;
|
|
|
|
|
-import org.springframework.web.bind.annotation.*;
|
|
|
|
|
-
|
|
|
|
|
-import javax.servlet.http.HttpServletRequest;
|
|
|
|
|
-import java.util.Optional;
|
|
|
|
|
-
|
|
|
|
|
-/**
|
|
|
|
|
- * 项目名: yhlxj2
|
|
|
|
|
- * 文件名: UserMirrorShopAdvertiseController
|
|
|
|
|
- * 创建者: JavaZou
|
|
|
|
|
- * 创建时间:2024/10/24 11:54
|
|
|
|
|
- */
|
|
|
|
|
-@Slf4j
|
|
|
|
|
-@RequiredArgsConstructor
|
|
|
|
|
-@RestController
|
|
|
|
|
-@RequestMapping("/manage/mirror/shop/advertise")
|
|
|
|
|
-public class UserMirrorShopAdvertiseController {
|
|
|
|
|
- private final UserMirrorShopAdvertiseService userMirrorShopAdvertiseService;
|
|
|
|
|
-
|
|
|
|
|
- private final BeanSearcher beanSearcher;
|
|
|
|
|
-
|
|
|
|
|
- private final HttpServletRequest request;
|
|
|
|
|
-
|
|
|
|
|
- private final RefreshCacheService refreshCacheService;
|
|
|
|
|
-
|
|
|
|
|
- /**
|
|
|
|
|
- * 店铺公告列表
|
|
|
|
|
- */
|
|
|
|
|
- @GetMapping("/get")
|
|
|
|
|
- public Result<SearchResult<UserMirrorShopManageAdvertise>> get() {
|
|
|
|
|
- SearchResult<UserMirrorShopManageAdvertise> search = beanSearcher.search(UserMirrorShopManageAdvertise.class, MapUtils.flatBuilder(request.getParameterMap())
|
|
|
|
|
- .field(UserMirrorShopManageAdvertise::getUserId, 0)
|
|
|
|
|
- .orderBy(UserMirrorShopManageAdvertise::getUpdateTime).desc()
|
|
|
|
|
- .build());
|
|
|
|
|
- return GatewayResponse.SUCCESS.newBuilder().toResult(search);
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
- /**
|
|
|
|
|
- * 新增店铺公告
|
|
|
|
|
- */
|
|
|
|
|
- @PostMapping("/post")
|
|
|
|
|
- public Result<String> post(@RequestBody UserMirrorShopManageAdvertise advertise) {
|
|
|
|
|
- userMirrorShopAdvertiseService.saveOrUpdate(advertise);
|
|
|
|
|
- return GatewayResponse.SUCCESS.newBuilder().toResult();
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
- /**
|
|
|
|
|
- * 编辑店铺公告
|
|
|
|
|
- */
|
|
|
|
|
- @PutMapping("/update")
|
|
|
|
|
- public Result<String> update(@RequestBody UserMirrorShopManageAdvertise advertise) {
|
|
|
|
|
- userMirrorShopAdvertiseService.saveOrUpdate(advertise);
|
|
|
|
|
- refreshCacheService.refreshUserMirrorShopAdvertiseCache(null);
|
|
|
|
|
- return GatewayResponse.SUCCESS.newBuilder().toResult();
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
- /**
|
|
|
|
|
- * 上下架店铺公告
|
|
|
|
|
- */
|
|
|
|
|
- @PutMapping("/update/status/{id}")
|
|
|
|
|
- public Result<String> updateStatusById(@PathVariable Long id) {
|
|
|
|
|
- Optional.ofNullable(userMirrorShopAdvertiseService.getById(id))
|
|
|
|
|
- .ifPresent(en -> {
|
|
|
|
|
- en.setStatus(!en.getStatus());
|
|
|
|
|
- refreshCacheService.refreshUserMirrorShopAdvertiseCache(null);
|
|
|
|
|
- userMirrorShopAdvertiseService.updateById(en);
|
|
|
|
|
- });
|
|
|
|
|
- return GatewayResponse.SUCCESS.newBuilder().toResult();
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- /**
|
|
|
|
|
- * 删除店铺公告
|
|
|
|
|
- */
|
|
|
|
|
- @PutMapping("/delete/{id}")
|
|
|
|
|
- public Result<String> deleteById(@PathVariable Long id) {
|
|
|
|
|
- userMirrorShopAdvertiseService.removeById(id);
|
|
|
|
|
- refreshCacheService.refreshUserMirrorShopAdvertiseCache(null);
|
|
|
|
|
- return GatewayResponse.SUCCESS.newBuilder().toResult();
|
|
|
|
|
- }
|
|
|
|
|
-}
|
|
|