店铺扩展信息

This commit is contained in:
2024-08-21 10:07:48 +08:00
parent fbb69e60d9
commit 3ae13b0b7e
4 changed files with 229 additions and 0 deletions

View File

@@ -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<String, String> 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}$");

View File

@@ -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<TbShopExtend> queryAll(TbShopExtend tbShopExtend);
}

View File

@@ -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;
}
}

View File

@@ -0,0 +1,72 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.chaozhanggui.system.cashierservice.dao.TbShopExtendMapper">
<resultMap type="com.chaozhanggui.system.cashierservice.entity.TbShopExtend" id="TbShopExtendMap">
<result property="id" column="id" jdbcType="INTEGER"/>
<result property="shopId" column="shop_id" jdbcType="INTEGER"/>
<result property="type" column="type" jdbcType="VARCHAR"/>
<result property="name" column="name" jdbcType="VARCHAR"/>
<result property="autokey" column="autoKey" jdbcType="VARCHAR"/>
<result property="value" column="value" jdbcType="VARCHAR"/>
<result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
</resultMap>
<sql id="Base_Column_List">
id
, shop_id, type, name, autoKey, value, update_time, create_time </sql>
<!--查询单个-->
<select id="queryById" resultMap="TbShopExtendMap">
select
<include refid="Base_Column_List"/>
from tb_shop_extend
where id = #{id}
</select>
<select id="queryByShopIdAndAutoKey" resultMap="TbShopExtendMap">
select
<include refid="Base_Column_List"/>
from tb_shop_extend
where shop_id = #{shopId} and autoKey = #{autokey}
</select>
<!--查询指定行数据-->
<select id="queryAll" resultMap="TbShopExtendMap">
select
<include refid="Base_Column_List"/>
from tb_shop_extend
<where>
<if test="id != null">
and id = #{id}
</if>
<if test="shopId != null">
and shop_id = #{shopId}
</if>
<if test="type != null and type != ''">
and type = #{type}
</if>
<if test="name != null and name != ''">
and name = #{name}
</if>
<if test="autokey != null and autokey != ''">
and autoKey = #{autokey}
</if>
<if test="value != null and value != ''">
and value = #{value}
</if>
<if test="updateTime != null">
and update_time = #{updateTime}
</if>
<if test="createTime != null">
and create_time = #{createTime}
</if>
</where>
</select>
</mapper>