店铺扩展信息 通过类型查询

This commit is contained in:
wangw 2024-09-18 10:07:43 +08:00
parent d0cec6c5ed
commit 5922665e32
4 changed files with 51 additions and 0 deletions

View File

@ -36,6 +36,12 @@ public class TbShopExtendController {
return new ResponseEntity<>(tbShopExtendService.queryAll(criteria), HttpStatus.OK); return new ResponseEntity<>(tbShopExtendService.queryAll(criteria), HttpStatus.OK);
} }
@PostMapping("byType")
@ApiOperation("通过类型查询详情")
public TbShopExtend selectOneByType(@RequestBody TbShopExtend tbShopExtend) {
return tbShopExtendService.selectOneByType(tbShopExtend);
}
@GetMapping("{id}") @GetMapping("{id}")
@ApiOperation("通过Id查询详情") @ApiOperation("通过Id查询详情")
public TbShopExtend selectOne(@PathVariable Serializable id) { public TbShopExtend selectOne(@PathVariable Serializable id) {

View File

@ -2,6 +2,7 @@ package cn.ysk.cashier.mybatis.entity;
import java.util.Date; import java.util.Date;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.extension.activerecord.Model; import com.baomidou.mybatisplus.extension.activerecord.Model;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
@ -20,6 +21,8 @@ public class TbShopExtend extends Model<TbShopExtend> {
private Integer shopId; private Integer shopId;
//img:图片text:文本 //img:图片text:文本
private String name; private String name;
@TableField(exist = false)
private String title;
private String type; private String type;
//自定义key //自定义key
private String autokey; private String autokey;
@ -105,6 +108,14 @@ public class TbShopExtend extends Model<TbShopExtend> {
this.detail = detail; this.detail = detail;
} }
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
/** /**
* index_bg店铺首页背景图 * index_bg店铺首页背景图
* my_bg 我的页面背景图 * my_bg 我的页面背景图
@ -119,21 +130,25 @@ public class TbShopExtend extends Model<TbShopExtend> {
this.name = "店铺首页背景图"; this.name = "店铺首页背景图";
this.detail="建议尺寸: 375*600 "; this.detail="建议尺寸: 375*600 ";
this.value = "https://czg-qr-order.oss-cn-beijing.aliyuncs.com/indexs/shuangbackground.png"; this.value = "https://czg-qr-order.oss-cn-beijing.aliyuncs.com/indexs/shuangbackground.png";
this.title = "首页";
break; break;
case "my_bg": case "my_bg":
this.name = "我的页面背景图"; this.name = "我的页面背景图";
this.detail="建议尺寸: 375*200"; this.detail="建议尺寸: 375*200";
this.value = "https://czg-qr-order.oss-cn-beijing.aliyuncs.com/my/myTopBack.png"; this.value = "https://czg-qr-order.oss-cn-beijing.aliyuncs.com/my/myTopBack.png";
this.title = "个人中心";
break; break;
case "member_bg": case "member_bg":
this.name = "会员卡页面背景图"; this.name = "会员卡页面背景图";
this.detail="建议尺寸: 315*152"; this.detail="建议尺寸: 315*152";
this.value = "https://czg-qr-order.oss-cn-beijing.aliyuncs.com/menber/member_bg.png"; this.value = "https://czg-qr-order.oss-cn-beijing.aliyuncs.com/menber/member_bg.png";
this.title = "会员卡";
break; break;
case "shopinfo_bg": case "shopinfo_bg":
this.name = "商品列表顶部背景图"; this.name = "商品列表顶部背景图";
this.detail="建议尺寸: 375*120"; this.detail="建议尺寸: 375*120";
this.value = "https://czg-qr-order.oss-cn-beijing.aliyuncs.com/shopDetails/topBanner.png"; this.value = "https://czg-qr-order.oss-cn-beijing.aliyuncs.com/shopDetails/topBanner.png";
this.title = "商品列表";
break; break;
} }
} }

View File

@ -18,5 +18,7 @@ public interface TbShopExtendService extends IService<TbShopExtend> {
void saveInfo(TbShopExtend tbShopExtend); void saveInfo(TbShopExtend tbShopExtend);
TbShopExtend selectOneByType(TbShopExtend tbShopExtend);
} }

View File

@ -56,6 +56,34 @@ public class TbShopExtendServiceImpl extends ServiceImpl<TbShopExtendMapper, TbS
tbShopExtendmapper.insert(tbShopExtend); tbShopExtendmapper.insert(tbShopExtend);
} }
@Override
public TbShopExtend selectOneByType(TbShopExtend tbShopExtend) {
QueryWrapper<TbShopExtend> 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<TbShopExtend> checkAndInitialize(Page<TbShopExtend> ipage, Integer shopId) { public Page<TbShopExtend> checkAndInitialize(Page<TbShopExtend> ipage, Integer shopId) {
List<TbShopExtend> newRecords = new ArrayList<>(); List<TbShopExtend> newRecords = new ArrayList<>();
List<String> requiredAutokeys = Arrays.asList("index_bg", "my_bg", "member_bg", "shopinfo_bg"); List<String> requiredAutokeys = Arrays.asList("index_bg", "my_bg", "member_bg", "shopinfo_bg");