From cb7814cbd65c9f854b0302decdc04791b6f4a313 Mon Sep 17 00:00:00 2001 From: chc <1501738723@qq.com> Date: Tue, 11 Oct 2022 17:13:12 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B9=B0=E5=AE=B6=E7=AB=AF=E4=B8=93=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/other/PageBuyerController.java | 48 +++++++++++++++++-- .../modules/page/service/PageDataService.java | 8 ++++ .../page/serviceimpl/PageDataServiceImpl.java | 5 ++ 3 files changed, 56 insertions(+), 5 deletions(-) diff --git a/buyer-api/src/main/java/cn/lili/controller/other/PageBuyerController.java b/buyer-api/src/main/java/cn/lili/controller/other/PageBuyerController.java index 01a4c3b4..2cd08f04 100644 --- a/buyer-api/src/main/java/cn/lili/controller/other/PageBuyerController.java +++ b/buyer-api/src/main/java/cn/lili/controller/other/PageBuyerController.java @@ -2,17 +2,17 @@ package cn.lili.controller.other; import cn.lili.common.enums.ResultUtil; import cn.lili.common.vo.ResultMessage; +import cn.lili.modules.page.entity.dos.PageData; import cn.lili.modules.page.entity.dto.PageDataDTO; import cn.lili.modules.page.entity.enums.PageEnum; import cn.lili.modules.page.entity.vos.PageDataVO; import cn.lili.modules.page.service.PageDataService; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiOperation; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestParam; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.bind.annotation.*; /** * 买家端,页面接口 @@ -43,8 +43,46 @@ public class PageBuyerController { @ApiOperation(value = "获取页面数据") @GetMapping public ResultMessage get(PageDataDTO pageDataDTO) { - PageDataVO pageDataVO=pageService.getPageData(pageDataDTO); return ResultUtil.data(pageDataVO); } + + @ApiOperation(value = "获取页面数据") + @ApiImplicitParam(name = "id", value = "id", required = true, dataType = "String", paramType = "path") + @GetMapping("/get/{id}") + public ResultMessage getPage(@PathVariable("id") String id) { + return ResultUtil.data(pageService.getSpecial(id)); + } + + @ApiOperation(value = "获取专题页面数据(根据消息内容得知)") + @GetMapping("/getSpecial") + public ResultMessage getSpecial(@RequestParam String body) { + String name = ""; + if (body.indexOf("』") >= 0 && body.indexOf("『") >= 0) { + name = body.substring(body.indexOf("『") + 1, body.lastIndexOf("』")); + } else if (body.indexOf("〉") >= 0 && body.indexOf("〈") >= 0) { + name = body.substring(body.indexOf("〈") + 1, body.lastIndexOf("〉")); + } else if (body.indexOf("」") >= 0 && body.indexOf("「") >= 0) { + name = body.substring(body.indexOf("「") + 1, body.lastIndexOf("」")); + } else if (body.indexOf("》") >= 0 && body.indexOf("《") >= 0) { + name = body.substring(body.indexOf("《") + 1, body.lastIndexOf("》")); + } else if (body.indexOf(")") >= 0 && body.indexOf("(") >= 0) { + name = body.substring(body.indexOf("(") + 1, body.lastIndexOf(")")); + } else if (body.indexOf("】") >= 0 && body.indexOf("【") >= 0) { + name = body.substring(body.indexOf("【") + 1, body.lastIndexOf("】")); + } else if (body.indexOf("}") >= 0 && body.indexOf("{") >= 0) { + name = body.substring(body.indexOf("{") + 1, body.lastIndexOf("}")); + } else if (body.indexOf("!") >= 0) { + name = body.substring(body.indexOf("!") + 1, body.lastIndexOf("!")); + } else if (body.indexOf("|") >= 0) { + name = body.substring(body.indexOf("|") + 1, body.lastIndexOf("|")); + } + + PageData pageData = pageService.getOne( + new LambdaQueryWrapper() + .eq(PageData::getPageType, PageEnum.SPECIAL.name()) + .eq(PageData::getName, name)); + return ResultUtil.data(pageData); + + } } diff --git a/framework/src/main/java/cn/lili/modules/page/service/PageDataService.java b/framework/src/main/java/cn/lili/modules/page/service/PageDataService.java index 09432b50..93107829 100644 --- a/framework/src/main/java/cn/lili/modules/page/service/PageDataService.java +++ b/framework/src/main/java/cn/lili/modules/page/service/PageDataService.java @@ -74,4 +74,12 @@ public interface PageDataService extends IService { * @return */ IPage getPageDataList(PageVO pageVO, PageDataDTO pageDataDTO); + + + /** + * 获取专题信息 + * @param id id + * @return + */ + PageData getSpecial(String id); } \ No newline at end of file diff --git a/framework/src/main/java/cn/lili/modules/page/serviceimpl/PageDataServiceImpl.java b/framework/src/main/java/cn/lili/modules/page/serviceimpl/PageDataServiceImpl.java index 49fc3999..8fc3aabd 100644 --- a/framework/src/main/java/cn/lili/modules/page/serviceimpl/PageDataServiceImpl.java +++ b/framework/src/main/java/cn/lili/modules/page/serviceimpl/PageDataServiceImpl.java @@ -200,4 +200,9 @@ public class PageDataServiceImpl extends ServiceImpl i return this.baseMapper.getPageDataList(PageUtil.initPage(pageVO), queryWrapper); } + + @Override + public PageData getSpecial(String id) { + return this.getById(id); + } } \ No newline at end of file