From 5922665e3260093488190590a08d2e112b9f8290 Mon Sep 17 00:00:00 2001 From: wangw <1594593906@qq.com> Date: Wed, 18 Sep 2024 10:07:43 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BA=97=E9=93=BA=E6=89=A9=E5=B1=95=E4=BF=A1?= =?UTF-8?q?=E6=81=AF=20=E9=80=9A=E8=BF=87=E7=B1=BB=E5=9E=8B=E6=9F=A5?= =?UTF-8?q?=E8=AF=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../shop/TbShopExtendController.java | 6 ++++ .../cashier/mybatis/entity/TbShopExtend.java | 15 ++++++++++ .../mybatis/service/TbShopExtendService.java | 2 ++ .../service/impl/TbShopExtendServiceImpl.java | 28 +++++++++++++++++++ 4 files changed, 51 insertions(+) diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/controller/shop/TbShopExtendController.java b/eladmin-system/src/main/java/cn/ysk/cashier/controller/shop/TbShopExtendController.java index 529e9b40..a0617ddb 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/controller/shop/TbShopExtendController.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/controller/shop/TbShopExtendController.java @@ -36,6 +36,12 @@ public class TbShopExtendController { return new ResponseEntity<>(tbShopExtendService.queryAll(criteria), HttpStatus.OK); } + @PostMapping("byType") + @ApiOperation("通过类型查询详情") + public TbShopExtend selectOneByType(@RequestBody TbShopExtend tbShopExtend) { + return tbShopExtendService.selectOneByType(tbShopExtend); + } + @GetMapping("{id}") @ApiOperation("通过Id查询详情") public TbShopExtend selectOne(@PathVariable Serializable id) { diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/entity/TbShopExtend.java b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/entity/TbShopExtend.java index b133e369..365b94f5 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/entity/TbShopExtend.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/entity/TbShopExtend.java @@ -2,6 +2,7 @@ package cn.ysk.cashier.mybatis.entity; import java.util.Date; +import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.extension.activerecord.Model; import org.apache.commons.lang3.StringUtils; @@ -20,6 +21,8 @@ public class TbShopExtend extends Model { private Integer shopId; //img:图片;text:文本; private String name; + @TableField(exist = false) + private String title; private String type; //自定义key private String autokey; @@ -105,6 +108,14 @@ public class TbShopExtend extends Model { this.detail = detail; } + public String getTitle() { + return title; + } + + public void setTitle(String title) { + this.title = title; + } + /** * index_bg:店铺首页背景图 * my_bg: 我的页面背景图 @@ -119,21 +130,25 @@ public class TbShopExtend extends Model { this.name = "店铺首页背景图"; this.detail="建议尺寸: 375*600 "; this.value = "https://czg-qr-order.oss-cn-beijing.aliyuncs.com/indexs/shuangbackground.png"; + this.title = "首页"; break; case "my_bg": this.name = "我的页面背景图"; this.detail="建议尺寸: 375*200"; this.value = "https://czg-qr-order.oss-cn-beijing.aliyuncs.com/my/myTopBack.png"; + this.title = "个人中心"; break; case "member_bg": this.name = "会员卡页面背景图"; this.detail="建议尺寸: 315*152"; this.value = "https://czg-qr-order.oss-cn-beijing.aliyuncs.com/menber/member_bg.png"; + this.title = "会员卡"; break; case "shopinfo_bg": this.name = "商品列表顶部背景图"; this.detail="建议尺寸: 375*120"; this.value = "https://czg-qr-order.oss-cn-beijing.aliyuncs.com/shopDetails/topBanner.png"; + this.title = "商品列表"; break; } } diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/TbShopExtendService.java b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/TbShopExtendService.java index 1eba9acb..cbf9c4ea 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/TbShopExtendService.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/TbShopExtendService.java @@ -18,5 +18,7 @@ public interface TbShopExtendService extends IService { void saveInfo(TbShopExtend tbShopExtend); + TbShopExtend selectOneByType(TbShopExtend tbShopExtend); + } diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/TbShopExtendServiceImpl.java b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/TbShopExtendServiceImpl.java index e68301dd..12ba7d1f 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/TbShopExtendServiceImpl.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/TbShopExtendServiceImpl.java @@ -56,6 +56,34 @@ public class TbShopExtendServiceImpl extends ServiceImpl wrapper = new QueryWrapper<>(); + wrapper.eq("shop_id", tbShopExtend.getShopId()); + wrapper.like("autokey",tbShopExtend.getAutokey()); + TbShopExtend shopExtend = tbShopExtendmapper.selectOne(wrapper); + if (shopExtend == null) { + shopExtend = new TbShopExtend(); + shopExtend.initAutoKey(tbShopExtend.getAutokey(),tbShopExtend.getShopId()); + }else { + switch (tbShopExtend.getAutokey()) { + case "index_bg": + shopExtend.setTitle("首页"); + break; + case "my_bg": + shopExtend.setTitle("个人中心"); + break; + case "member_bg": + shopExtend.setTitle("会员卡"); + break; + case "shopinfo_bg": + shopExtend.setTitle("商品列表"); + break; + } + } + return shopExtend; + } + public Page checkAndInitialize(Page ipage, Integer shopId) { List newRecords = new ArrayList<>(); List requiredAutokeys = Arrays.asList("index_bg", "my_bg", "member_bg", "shopinfo_bg");