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");