diff --git a/src/main/java/com/chaozhanggui/system/cashierservice/controller/CommonController.java b/src/main/java/com/chaozhanggui/system/cashierservice/controller/CommonController.java index 83211ee..ae9f246 100644 --- a/src/main/java/com/chaozhanggui/system/cashierservice/controller/CommonController.java +++ b/src/main/java/com/chaozhanggui/system/cashierservice/controller/CommonController.java @@ -2,6 +2,7 @@ package com.chaozhanggui.system.cashierservice.controller; import cn.hutool.core.util.StrUtil; import com.chaozhanggui.system.cashierservice.dao.TbPlatformDictMapper; +import com.chaozhanggui.system.cashierservice.dao.TbShopExtendMapper; import com.chaozhanggui.system.cashierservice.entity.TbPlatformDict; import com.chaozhanggui.system.cashierservice.entity.dto.WxMsgSubDTO; import com.chaozhanggui.system.cashierservice.entity.vo.DistrictVo; @@ -24,12 +25,14 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.scheduling.annotation.Async; +import org.springframework.util.CollectionUtils; import org.springframework.web.bind.annotation.*; import org.springframework.web.multipart.MultipartFile; import javax.annotation.Resource; import java.util.Collections; import java.util.List; +import java.util.Map; /** * 通用接口 @@ -50,6 +53,8 @@ public class CommonController { private TbPlatformDictMapper platformDictMapper; @Resource private FileService fileService; + @Resource + private TbShopExtendMapper extendMapper; private final LoginService loginService;; @@ -163,6 +168,12 @@ public class CommonController { return new Result(CodeEnum.SUCCESS, fileService.uploadFile(file)); } + @RequestMapping("common/shopExtend") + public Result getShopExtend(@RequestBody Map map) { + if (CollectionUtils.isEmpty(map) || !map.containsKey("shopId") || !map.containsKey("autokey")) return new Result(CodeEnum.SUCCESS); + return new Result(CodeEnum.SUCCESS, extendMapper.queryByShopIdAndAutoKey(Integer.valueOf(map.get("shopId").toString()),map.get("autokey"))); + } + // 检查手机号格式是否正确的方法 private boolean isValidPhoneNumber(String phone) { return phone.matches("^1[3-9]\\d{9}$"); diff --git a/src/main/java/com/chaozhanggui/system/cashierservice/dao/TbShopExtendMapper.java b/src/main/java/com/chaozhanggui/system/cashierservice/dao/TbShopExtendMapper.java new file mode 100644 index 0000000..0e80d49 --- /dev/null +++ b/src/main/java/com/chaozhanggui/system/cashierservice/dao/TbShopExtendMapper.java @@ -0,0 +1,33 @@ +package com.chaozhanggui.system.cashierservice.dao; + +import com.chaozhanggui.system.cashierservice.entity.TbShopExtend; + +import java.util.List; + +/** + * 店铺扩展信息(TbShopExtend)表数据库访问层 + * + * @author ww + * @since 2024-08-21 09:40:25 + */ +public interface TbShopExtendMapper { + + /** + * 通过ID查询单条数据 + * + * @param id 主键 + * @return 实例对象 + */ + TbShopExtend queryById(Integer id); + + TbShopExtend queryByShopIdAndAutoKey(Integer shopId,String autokey); + + /** + * 查询数据 + * + * @param tbShopExtend 查询条件 + * @return 对象列表 + */ + List queryAll(TbShopExtend tbShopExtend); +} + diff --git a/src/main/java/com/chaozhanggui/system/cashierservice/entity/TbShopExtend.java b/src/main/java/com/chaozhanggui/system/cashierservice/entity/TbShopExtend.java new file mode 100644 index 0000000..82867d6 --- /dev/null +++ b/src/main/java/com/chaozhanggui/system/cashierservice/entity/TbShopExtend.java @@ -0,0 +1,113 @@ +package com.chaozhanggui.system.cashierservice.entity; + +import java.util.Date; +import java.io.Serializable; + +/** + * 店铺扩展信息(TbShopExtend)实体类 + * + * @author ww + * @since 2024-08-21 09:40:26 + */ +public class TbShopExtend implements Serializable { + private static final long serialVersionUID = -25782280496188600L; + /** + * 自增id + */ + private Integer id; + /** + * 商户Id + */ + private Integer shopId; + /** + * img:图片;text:文本; + */ + private String type; + /** + * 描述 + */ + private String name; + /** + * 自定义key + */ + private String autokey; + /** + * 值 + */ + private String value; + /** + * 更新时间 + */ + private Date updateTime; + /** + * 创建时间 + */ + private Date createTime; + + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public Integer getShopId() { + return shopId; + } + + public void setShopId(Integer shopId) { + this.shopId = shopId; + } + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getAutokey() { + return autokey; + } + + public void setAutokey(String autokey) { + this.autokey = autokey; + } + + public String getValue() { + return value; + } + + public void setValue(String value) { + this.value = value; + } + + public Date getUpdateTime() { + return updateTime; + } + + public void setUpdateTime(Date updateTime) { + this.updateTime = updateTime; + } + + public Date getCreateTime() { + return createTime; + } + + public void setCreateTime(Date createTime) { + this.createTime = createTime; + } + +} + diff --git a/src/main/resources/mapper/TbShopExtendMapper.xml b/src/main/resources/mapper/TbShopExtendMapper.xml new file mode 100644 index 0000000..817bd30 --- /dev/null +++ b/src/main/resources/mapper/TbShopExtendMapper.xml @@ -0,0 +1,72 @@ + + + + + + + + + + + + + + + + + id + , shop_id, type, name, autoKey, value, update_time, create_time + + + + + + + + + + +