diff --git a/LoginController.java b/LoginController.java new file mode 100644 index 0000000..0fdf8bd --- /dev/null +++ b/LoginController.java @@ -0,0 +1,66 @@ +package com.controller; + +import com.annotation.IgnoreAuth; +import com.entity.Users; +import com.service.UsersService; +import com.util.*; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.ResponseBody; +import org.springframework.web.bind.annotation.RestController; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpSession; +import java.util.HashMap; + +/** + * @ClassName LoginController + * @Description 用户登陆模块控制层 + */ +@RestController +public class LoginController { + + @Autowired + private UsersService usersService; + + //登陆验证 + @IgnoreAuth + @RequestMapping("/login") + @ResponseBody + public ApiResponse verify(HttpServletRequest request, String loginpw, String type, String loginname) { + String result = ""; + Users users = new Users(); + users.setLoginname(loginname); + users.setLoginpw(Md5Util.strToMd5(loginpw)); + if (null != type && !type.equals("")) { + users.setType(type); + } + users = usersService.findOneByEqualTo(users); + + if (null == users || null == users.getId() || users.getId() == 0) { + //返回登录失败 + result = "用户名或密码错误"; + return ApiResponse.failed(result); + } else { +// if (null == users.getShenhe() || (!users.getShenhe().toLowerCase().equals("yes") && !users.getShenhe().equals("是"))) { +// //未审核返回登录失败 +// result = "用户未通过审核,请及时联系管理员处理"; +// return ApiResponse.failed(result); +// } + //返回登录成功 + String token = CommonUtil.getRandomString(32); + System.out.println("生成token:" + token); + HttpSession session = request.getSession(); + session.setAttribute("usersType", users.getType()); + session.setAttribute("usersId", users.getId()); + session.setAttribute("users", users); + session.setAttribute("token", token); + //session有效时间,单位为秒,-1表示当前会话内一直有效 + session.setMaxInactiveInterval(-1); + HashMap loginSuccess=new HashMap<>(); + loginSuccess.put("token",token); + loginSuccess.put("usersId",users.getId().toString()); + return ApiResponse.success(loginSuccess); + } + } +} diff --git a/Md5Util.java b/Md5Util.java new file mode 100644 index 0000000..7422e89 --- /dev/null +++ b/Md5Util.java @@ -0,0 +1,18 @@ +package com.util; + +import cn.hutool.crypto.digest.DigestUtil; + +/** + * Md5加密 + */ +public class Md5Util { + /** + * @param text 明文 + * @return 密文 + */ + public static String strToMd5(String text) { + // 加密后的字符串 + text = DigestUtil.md5Hex(text); + return text; + } +} diff --git a/Shangpin.java b/Shangpin.java new file mode 100644 index 0000000..178dddd --- /dev/null +++ b/Shangpin.java @@ -0,0 +1,262 @@ +package com.entity; + + +/** + * @ClassName Shangpin + * @Description 零食模块实体层 + */ +public class Shangpin { + //id列 + private Integer id; + + + //名称 + private String mingcheng; + //编号 + private String bianhao; + //分类id + private Integer pinleiid; + //内容介绍 + private String neirong; + //图片 + private String image; + //原价 + private Integer yuanshijiage; + //现价 + private Integer jiage; + //单位 + private String danwei; + //是否特价 + private String shenhe; + //库存数量 + private Integer kucunshuliang; + //销售数量 + private Integer xiaoshoushuliang; + //父表:分类表pinlei + private Pinlei pinlei; + + + /** + * 获取 id列 + * + * @return id id列 + */ + public Integer getId() { + return this.id; + } + + /** + * 设置 id列 + * + * @param id id列 + */ + public void setId(Integer id) { + this.id = id; + } + + /** + * 获取 名称 + * + * @return mingcheng 名称 + */ + public String getMingcheng() { + return this.mingcheng; + } + + /** + * 设置 名称 + * + * @param mingcheng 名称 + */ + public void setMingcheng(String mingcheng) { + this.mingcheng = mingcheng; + } + /** + * 获取 编号 + * + * @return bianhao 编号 + */ + public String getBianhao() { + return this.bianhao; + } + + /** + * 设置 编号 + * + * @param bianhao 编号 + */ + public void setBianhao(String bianhao) { + this.bianhao = bianhao; + } + /** + * 获取 分类id + * + * @return pinleiid 分类id + */ + public Integer getPinleiid() { + return this.pinleiid; + } + + /** + * 设置 分类id + * + * @param pinleiid 分类id + */ + public void setPinleiid(Integer pinleiid) { + this.pinleiid = pinleiid; + } + /** + * 获取 内容介绍 + * + * @return neirong 内容介绍 + */ + public String getNeirong() { + return this.neirong; + } + + /** + * 设置 内容介绍 + * + * @param neirong 内容介绍 + */ + public void setNeirong(String neirong) { + this.neirong = neirong; + } + /** + * 获取 图片 + * + * @return image 图片 + */ + public String getImage() { + return this.image; + } + + /** + * 设置 图片 + * + * @param image 图片 + */ + public void setImage(String image) { + this.image = image; + } + /** + * 获取 原价 + * + * @return yuanshijiage 原价 + */ + public Integer getYuanshijiage() { + return this.yuanshijiage; + } + + /** + * 设置 原价 + * + * @param yuanshijiage 原价 + */ + public void setYuanshijiage(Integer yuanshijiage) { + this.yuanshijiage = yuanshijiage; + } + /** + * 获取 现价 + * + * @return jiage 现价 + */ + public Integer getJiage() { + return this.jiage; + } + + /** + * 设置 现价 + * + * @param jiage 现价 + */ + public void setJiage(Integer jiage) { + this.jiage = jiage; + } + /** + * 获取 单位 + * + * @return danwei 单位 + */ + public String getDanwei() { + return this.danwei; + } + + /** + * 设置 单位 + * + * @param danwei 单位 + */ + public void setDanwei(String danwei) { + this.danwei = danwei; + } + /** + * 获取 是否特价 + * + * @return shenhe 是否特价 + */ + public String getShenhe() { + return this.shenhe; + } + + /** + * 设置 是否特价 + * + * @param shenhe 是否特价 + */ + public void setShenhe(String shenhe) { + this.shenhe = shenhe; + } + /** + * 获取 库存数量 + * + * @return kucunshuliang 库存数量 + */ + public Integer getKucunshuliang() { + return this.kucunshuliang; + } + + /** + * 设置 库存数量 + * + * @param kucunshuliang 库存数量 + */ + public void setKucunshuliang(Integer kucunshuliang) { + this.kucunshuliang = kucunshuliang; + } + /** + * 获取 销售数量 + * + * @return xiaoshoushuliang 销售数量 + */ + public Integer getXiaoshoushuliang() { + return this.xiaoshoushuliang; + } + + /** + * 设置 销售数量 + * + * @param xiaoshoushuliang 销售数量 + */ + public void setXiaoshoushuliang(Integer xiaoshoushuliang) { + this.xiaoshoushuliang = xiaoshoushuliang; + } + /** + * 获取 父表:分类表pinlei + * + * @return pinlei 父表:分类表pinlei + */ + public Pinlei getPinlei() { + return this.pinlei; + } + + /** + * 设置 父表:分类表pinlei + * + * @param pinlei 父表:分类表pinlei + */ + public void setPinlei(Pinlei pinlei) { + this.pinlei = pinlei; + } + +} diff --git a/ShangpinController.java b/ShangpinController.java new file mode 100644 index 0000000..3983c4d --- /dev/null +++ b/ShangpinController.java @@ -0,0 +1,178 @@ +package com.controller; + +import com.annotation.IgnoreAuth; +import com.entity.*; +import com.service.*; +import com.util.*; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletRequest; +import java.util.ArrayList; +import java.util.List; + +/** + * @ClassName ShangpinController + * @Description 零食模块控制层 + */ +@RequestMapping("shangpin") +@RestController +public class ShangpinController { + + @Autowired + private ShangpinService shangpinService; + + //前台-根据条件获取零食列表分页数据接口 + @IgnoreAuth + @RequestMapping("/manaqian") + public ApiResponse manaQian(Shangpin req, @RequestParam(defaultValue = "1", value = "pageNo") int pageNo, @RequestParam(defaultValue = "10", value = "pageSize") int pageSize, @RequestParam(defaultValue = "id", value = "sortProperty") String sortProperty) { + PageData shangpinList = getPageList(req, pageNo, pageSize, sortProperty); + return ApiResponse.success(shangpinList); + } + + //前台-根据条件获取我的零食列表分页数据接口 + @RequestMapping("/manamyqian") + public ApiResponse manaMyQian(Shangpin req, @RequestParam(defaultValue = "1", value = "pageNo") int pageNo, @RequestParam(defaultValue = "10", value = "pageSize") int pageSize, @RequestParam(defaultValue = "id", value = "sortProperty") String sortProperty) { + PageData shangpinList = getPageList(req, pageNo, pageSize, sortProperty); + return ApiResponse.success(shangpinList); + } + + //前台-根据条件获取零食图片列表分页数据接口 + @IgnoreAuth + @RequestMapping("/manaqiantp") + public ApiResponse manaQianTp(Shangpin req, @RequestParam(defaultValue = "1", value = "pageNo") int pageNo, @RequestParam(defaultValue = "10", value = "pageSize") int pageSize, @RequestParam(defaultValue = "id", value = "sortProperty") String sortProperty) { + PageData shangpinList = getPageList(req, pageNo, pageSize, sortProperty); + return ApiResponse.success(shangpinList); + } + + //前台-零食详情 + @IgnoreAuth + @RequestMapping("/detail/{id}") + public ApiResponse detail(@PathVariable("id") Integer id) { + Shangpin info = shangpinService.findById(id); + + return ApiResponse.success(info); + } + + //前台-零食添加接口 + @PostMapping("/add") + public ApiResponse add(@RequestBody Shangpin req) { + int result = shangpinService.saveOrUpdate(req); + return ApiResponse.success(result); + } + + //后台-根据条件获取零食管理列表分页数据接口 + @RequestMapping("/mana") + public ApiResponse mana(Shangpin req, @RequestParam(defaultValue = "1", value = "pageNo") int pageNo, @RequestParam(defaultValue = "10", value = "pageSize") int pageSize, @RequestParam(defaultValue = "id", value = "sortProperty") String sortProperty) { + PageData shangpinList = getPageList(req, pageNo, pageSize, sortProperty); + return ApiResponse.success(shangpinList); + } + + //后台-根据条件获取零食管理我的列表分页数据接口 + @RequestMapping("/manamy") + public ApiResponse manaMy(Shangpin req, @RequestParam(defaultValue = "1", value = "pageNo") int pageNo, @RequestParam(defaultValue = "10", value = "pageSize") int pageSize, @RequestParam(defaultValue = "id", value = "sortProperty") String sortProperty) { + PageData shangpinList = getPageList(req, pageNo, pageSize, sortProperty); + return ApiResponse.success(shangpinList); + } + + //后台-根据条件获取零食查看列表分页数据接口 + @RequestMapping("/chakan") + public ApiResponse chakan(Shangpin req, @RequestParam(defaultValue = "1", value = "pageNo") int pageNo, @RequestParam(defaultValue = "10", value = "pageSize") int pageSize, @RequestParam(defaultValue = "id", value = "sortProperty") String sortProperty) { + PageData shangpinList = getPageList(req, pageNo, pageSize, sortProperty); + return ApiResponse.success(shangpinList); + } + + //后台-根据条件获取零食查看我的列表分页数据接口 + @RequestMapping("/chakanmy") + public ApiResponse chakanMy(Shangpin req, @RequestParam(defaultValue = "1", value = "pageNo") int pageNo, @RequestParam(defaultValue = "10", value = "pageSize") int pageSize, @RequestParam(defaultValue = "id", value = "sortProperty") String sortProperty) { + PageData shangpinList = getPageList(req, pageNo, pageSize, sortProperty); + return ApiResponse.success(shangpinList); + } + + //后台-零食详情 + @RequestMapping("/info/{id}") + public ApiResponse info(@PathVariable("id") Integer id) { + Shangpin info = shangpinService.findById(id); + return ApiResponse.success(info); + } + + //后台-零食添加接口 + @PostMapping("/save") + public ApiResponse save(@RequestBody Shangpin req) { + int result = shangpinService.saveOrUpdate(req); + return ApiResponse.success(result); + } + + //零食删除(含批量删除)接口 + @RequestMapping("/delete") + public ApiResponse delete(@RequestBody Integer[] ids) { + int result = 0; + for (Integer id : ids) { + result = shangpinService.deleteById(id); + } + return ApiResponse.success(result); + } + + //零食修改接口 + @PostMapping("/set") + public ApiResponse set(@RequestBody Shangpin req) { + int result = shangpinService.saveOrUpdate(req); + return ApiResponse.success(result); + } + + //获取所有零食数据接口 + @IgnoreAuth + @RequestMapping("/all") + public ApiResponse shangpinAll() { + List shangpinList = shangpinService.findAll(); + return ApiResponse.success(shangpinList); + } + + //根据条件(字符类型模糊匹配查询)获取零食数据接口 + @IgnoreAuth + @RequestMapping("/search") + public ApiResponse shangpinSearch(Shangpin req) { + List shangpinList = shangpinService.find(req); + return ApiResponse.success(shangpinList); + } + + //根据条件(字符类型完全匹配查询)获取零食数据接口 + @IgnoreAuth + @RequestMapping("/searchByEqualTo") + public ApiResponse shangpinSearchByEqualTo(Shangpin req) { + List shangpinList = shangpinService.findByEqualTo(req); + return ApiResponse.success(shangpinList); + } + + + + //按条件查询零食分页数据方法(模糊匹配查询) + private PageData getPageList(Shangpin req, int pageNo, int pageSize, String sortProperty) { + PageWrap pageWrap = getPageWrap(req, pageNo, pageSize, sortProperty); + PageData shangpinList = shangpinService.findPage(pageWrap); + return shangpinList; + } + + //按条件查询零食分页数据方法(完全匹配查询) + private PageData getPageListByEqualTo(Shangpin req, int pageNo, int pageSize, String sortProperty) { + PageWrap pageWrap = getPageWrap(req, pageNo, pageSize, sortProperty); + PageData shangpinList = shangpinService.findPageByEqualTo(pageWrap); + return shangpinList; + } + + //获取零食查询数据搜索条件 + private PageWrap getPageWrap(Shangpin req, int pageNo, int pageSize, String sortProperty) { + PageWrap pageWrap = new PageWrap<>(); + pageWrap.setModel(req); + pageWrap.setPageNum(pageNo); + pageWrap.setPageSize(pageSize); + PageWrap.SortData sortData = new PageWrap.SortData(); + sortData.setDirection("DESC"); + sortData.setProperty(sortProperty); + List sorts = new ArrayList<>(); + sorts.add(sortData); + pageWrap.setSorts(sorts); + return pageWrap; + } + +} diff --git a/ShangpinMapper.java b/ShangpinMapper.java new file mode 100644 index 0000000..d7ebdfb --- /dev/null +++ b/ShangpinMapper.java @@ -0,0 +1,47 @@ +package com.dao; + +import com.entity.Shangpin; +import com.entity.ShangpinExample; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * @ClassName ShangpinMapper + * @Description 零食模块数据持久层 + */ +public interface ShangpinMapper { + + //根据条件获取零食表shangpin的数据数量 + int countByExample(ShangpinExample example); + + //根据条件删除零食表shangpin的数据 + int deleteByExample(ShangpinExample example); + + //根据主键ID列删除零食表shangpin的数据 + int deleteByPrimaryKey(Integer id); + + //插入零食表shangpin的实体数据(包含null值) + int insert(Shangpin record); + + //插入零食表shangpin的实体数据(不包含null值) + int insertSelective(Shangpin record); + + //根据条件获取零食表shangpin的数据列表 + List selectByExample(ShangpinExample example); + + //根据主键ID列获取零食表shangpin的数据实体 + Shangpin selectByPrimaryKey(Integer id); + + //根据条件更新零食表shangpin的实体数据(不包含null值) + int updateByExampleSelective(@Param("record") Shangpin record, @Param("example") ShangpinExample example); + + //根据条件更新零食表shangpin的实体数据(包含null值) + int updateByExample(@Param("record") Shangpin record, @Param("example") ShangpinExample example); + + //根据主键ID列更新零食表shangpin的实体数据(不包含null值) + int updateByPrimaryKeySelective(Shangpin record); + + //根据主键ID列更新零食表shangpin的实体数据(包含null值) + int updateByPrimaryKey(Shangpin record); +} diff --git a/ShangpinService.java b/ShangpinService.java new file mode 100644 index 0000000..16e7ce9 --- /dev/null +++ b/ShangpinService.java @@ -0,0 +1,44 @@ +package com.service; + +import com.entity.Shangpin; +import com.util.PageData; +import com.util.PageWrap; + +import java.util.List; + +/** + * @ClassName ShangpinService + * @Description 零食模块业务层 + */ +public interface ShangpinService { + + //保存或更新零食表数据 + Integer saveOrUpdate(Shangpin instance); + + //查询所有零食表数据 + List findAll(); + + //根据条件(字符类型模糊)查询零食表数据 + List find(Shangpin instance); + + //根据条件(字符类型完全匹配)查询零食表数据 + List findByEqualTo(Shangpin instance); + + //根据条件(字符类型模糊)查询查询第一条零食表数据 + Shangpin findOne(Shangpin instance); + + //根据条件(字符类型完全匹配)查询查询第一条零食表数据 + Shangpin findOneByEqualTo(Shangpin instance); + + //根据id列查询零食表数据 + Shangpin findById(Integer id); + + //根据id列删除零食表数据 + int deleteById(Integer id); + + //根据条件(字符类型模糊)分页查询零食表数据 + PageData findPage(PageWrap pageWrap); + + //根据条件(字符类型完全匹配)分页查询零食表数据 + PageData findPageByEqualTo(PageWrap pageWrap); +} diff --git a/Users.java b/Users.java new file mode 100644 index 0000000..8171f04 --- /dev/null +++ b/Users.java @@ -0,0 +1,224 @@ +package com.entity; + + +/** + * @ClassName Users + * @Description 用户模块实体层 + */ +public class Users { + //id列 + private Integer id; + + + //用户名称 + private String loginname; + //密码 + private String loginpw; + //类型 + private String type; + //类型名称 + private String typename; + //姓名 + private String xingming; + //性别 + private String xingbie; + //年龄 + private String nianling; + //地址 + private String address; + //电话 + private String dianhua; + //审核 + private String shenhe; + + + /** + * 获取 id列 + * + * @return id id列 + */ + public Integer getId() { + return this.id; + } + + /** + * 设置 id列 + * + * @param id id列 + */ + public void setId(Integer id) { + this.id = id; + } + + /** + * 获取 用户名称 + * + * @return loginname 用户名称 + */ + public String getLoginname() { + return this.loginname; + } + + /** + * 设置 用户名称 + * + * @param loginname 用户名称 + */ + public void setLoginname(String loginname) { + this.loginname = loginname; + } + /** + * 获取 密码 + * + * @return loginpw 密码 + */ + public String getLoginpw() { + return this.loginpw; + } + + /** + * 设置 密码 + * + * @param loginpw 密码 + */ + public void setLoginpw(String loginpw) { + this.loginpw = loginpw; + } + /** + * 获取 类型 + * + * @return type 类型 + */ + public String getType() { + return this.type; + } + + /** + * 设置 类型 + * + * @param type 类型 + */ + public void setType(String type) { + this.type = type; + } + /** + * 获取 类型名称 + * + * @return typename 类型名称 + */ + public String getTypename() { + return this.typename; + } + + /** + * 设置 类型名称 + * + * @param typename 类型名称 + */ + public void setTypename(String typename) { + this.typename = typename; + } + /** + * 获取 姓名 + * + * @return xingming 姓名 + */ + public String getXingming() { + return this.xingming; + } + + /** + * 设置 姓名 + * + * @param xingming 姓名 + */ + public void setXingming(String xingming) { + this.xingming = xingming; + } + /** + * 获取 性别 + * + * @return xingbie 性别 + */ + public String getXingbie() { + return this.xingbie; + } + + /** + * 设置 性别 + * + * @param xingbie 性别 + */ + public void setXingbie(String xingbie) { + this.xingbie = xingbie; + } + /** + * 获取 年龄 + * + * @return nianling 年龄 + */ + public String getNianling() { + return this.nianling; + } + + /** + * 设置 年龄 + * + * @param nianling 年龄 + */ + public void setNianling(String nianling) { + this.nianling = nianling; + } + /** + * 获取 地址 + * + * @return address 地址 + */ + public String getAddress() { + return this.address; + } + + /** + * 设置 地址 + * + * @param address 地址 + */ + public void setAddress(String address) { + this.address = address; + } + /** + * 获取 电话 + * + * @return dianhua 电话 + */ + public String getDianhua() { + return this.dianhua; + } + + /** + * 设置 电话 + * + * @param dianhua 电话 + */ + public void setDianhua(String dianhua) { + this.dianhua = dianhua; + } + /** + * 获取 审核 + * + * @return shenhe 审核 + */ + public String getShenhe() { + return this.shenhe; + } + + /** + * 设置 审核 + * + * @param shenhe 审核 + */ + public void setShenhe(String shenhe) { + this.shenhe = shenhe; + } + +} diff --git a/UsersController.java b/UsersController.java new file mode 100644 index 0000000..1873d7e --- /dev/null +++ b/UsersController.java @@ -0,0 +1,247 @@ +package com.controller; + +import com.annotation.IgnoreAuth; +import com.entity.*; +import com.service.*; +import com.util.*; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletRequest; +import java.util.ArrayList; +import java.util.List; + +/** + * @ClassName UsersController + * @Description 用户模块控制层 + */ +@RequestMapping("users") +@RestController +public class UsersController { + + @Autowired + private UsersService usersService; + + //前台-根据条件获取用户列表分页数据接口 + @IgnoreAuth + @RequestMapping("/manaqian") + public ApiResponse manaQian(Users req, @RequestParam(defaultValue = "1", value = "pageNo") int pageNo, @RequestParam(defaultValue = "10", value = "pageSize") int pageSize, @RequestParam(defaultValue = "id", value = "sortProperty") String sortProperty) { + PageData usersList = getPageList(req, pageNo, pageSize, sortProperty); + return ApiResponse.success(usersList); + } + + //前台-根据条件获取我的用户列表分页数据接口 + @RequestMapping("/manamyqian") + public ApiResponse manaMyQian(Users req, @RequestParam(defaultValue = "1", value = "pageNo") int pageNo, @RequestParam(defaultValue = "10", value = "pageSize") int pageSize, @RequestParam(defaultValue = "id", value = "sortProperty") String sortProperty) { + PageData usersList = getPageList(req, pageNo, pageSize, sortProperty); + return ApiResponse.success(usersList); + } + + //前台-根据条件获取用户图片列表分页数据接口 + @IgnoreAuth + @RequestMapping("/manaqiantp") + public ApiResponse manaQianTp(Users req, @RequestParam(defaultValue = "1", value = "pageNo") int pageNo, @RequestParam(defaultValue = "10", value = "pageSize") int pageSize, @RequestParam(defaultValue = "id", value = "sortProperty") String sortProperty) { + PageData usersList = getPageList(req, pageNo, pageSize, sortProperty); + return ApiResponse.success(usersList); + } + + //前台-用户详情 + @IgnoreAuth + @RequestMapping("/detail/{id}") + public ApiResponse detail(@PathVariable("id") Integer id) { + Users info = usersService.findById(id); + return ApiResponse.success(info); + } + + //前台-用户添加接口 + @IgnoreAuth + @PostMapping("/add") + public ApiResponse add(@RequestBody Users req) { + if (null == req.getLoginname() || req.getLoginname().equals("")) { + return ApiResponse.failed("用户名loginname不能为空!"); + } + //判断用户名loginname是否已存在 + Users instance = new Users(); + instance.setLoginname(req.getLoginname()); + instance = usersService.findOneByEqualTo(instance); + if (null != instance && (null == req.getId() || req.getId() == 0) || (null != instance && !instance.getId().equals(req.getId()))) { + return ApiResponse.failed("用户名" + req.getLoginname() + "已存在"); + } + if (null != req.getLoginpw() && !req.getLoginpw().equals("")) { + req.setLoginpw(Md5Util.strToMd5(req.getLoginpw())); + } else { + req.setLoginpw(null); + } + int result = usersService.saveOrUpdate(req); + + return ApiResponse.success(result); + } + + //后台-根据条件获取用户管理列表分页数据接口 + @RequestMapping("/mana") + public ApiResponse mana(Users req, @RequestParam(defaultValue = "1", value = "pageNo") int pageNo, @RequestParam(defaultValue = "10", value = "pageSize") int pageSize, @RequestParam(defaultValue = "id", value = "sortProperty") String sortProperty) { + PageData usersList = getPageList(req, pageNo, pageSize, sortProperty); + return ApiResponse.success(usersList); + } + + //后台-根据条件获取用户管理我的列表分页数据接口 + @RequestMapping("/manamy") + public ApiResponse manaMy(Users req, @RequestParam(defaultValue = "1", value = "pageNo") int pageNo, @RequestParam(defaultValue = "10", value = "pageSize") int pageSize, @RequestParam(defaultValue = "id", value = "sortProperty") String sortProperty) { + PageData usersList = getPageList(req, pageNo, pageSize, sortProperty); + return ApiResponse.success(usersList); + } + + //后台-根据条件获取用户查看列表分页数据接口 + @RequestMapping("/chakan") + public ApiResponse chakan(Users req, @RequestParam(defaultValue = "1", value = "pageNo") int pageNo, @RequestParam(defaultValue = "10", value = "pageSize") int pageSize, @RequestParam(defaultValue = "id", value = "sortProperty") String sortProperty) { + PageData usersList = getPageList(req, pageNo, pageSize, sortProperty); + return ApiResponse.success(usersList); + } + + //后台-根据条件获取用户查看我的列表分页数据接口 + @RequestMapping("/chakanmy") + public ApiResponse chakanMy(Users req, @RequestParam(defaultValue = "1", value = "pageNo") int pageNo, @RequestParam(defaultValue = "10", value = "pageSize") int pageSize, @RequestParam(defaultValue = "id", value = "sortProperty") String sortProperty) { + PageData usersList = getPageList(req, pageNo, pageSize, sortProperty); + return ApiResponse.success(usersList); + } + + //后台-用户详情 + @RequestMapping("/info/{id}") + public ApiResponse info(@PathVariable("id") Integer id) { + Users info = usersService.findById(id); + return ApiResponse.success(info); + } + + //后台-用户添加接口 + @IgnoreAuth + @PostMapping("/save") + public ApiResponse save(@RequestBody Users req) { + if (null == req.getLoginname() || req.getLoginname().equals("")) { + return ApiResponse.failed("用户名loginname不能为空!"); + } + //判断用户名是否已存在 + Users instance = new Users(); + instance.setLoginname(req.getLoginname()); + instance = usersService.findOneByEqualTo(instance); + if (null != instance && (null == req.getId() || req.getId() == 0) || (null != instance && !instance.getId().equals(req.getId()))) { + return ApiResponse.failed("用户名" + req.getLoginname() + "已存在"); + } + if (null != req.getLoginpw() && !req.getLoginpw().equals("")) { + req.setLoginpw(Md5Util.strToMd5(req.getLoginpw())); + } else { + req.setLoginpw(null); + } + int result = usersService.saveOrUpdate(req); + + return ApiResponse.success(result); + } + + //用户删除(含批量删除)接口 + @RequestMapping("/delete") + public ApiResponse delete(@RequestBody Integer[] ids) { + int result = 0; + for (Integer id : ids) { + result = usersService.deleteById(id); + } + return ApiResponse.success(result); + } + + //用户修改接口 + @PostMapping("/set") + public ApiResponse set(@RequestBody Users req) { +// if (null == req.getLoginname() || req.getLoginname().equals("")) { +// return ApiResponse.failed("用户名loginname不能为空!"); +// } + //判断用户名是否已存在 +// Users instance = new Users(); +// instance.setLoginname(req.getLoginname()); +// instance = usersService.findOneByEqualTo(instance); +// if (null != instance && (null == req.getId() || req.getId() == 0) || (null != instance && !instance.getId().equals(req.getId()))) { +// return ApiResponse.failed("用户名" + req.getLoginname() + "已存在"); +// } +// if (null != req.getLoginpw() && !req.getLoginpw().equals("")) { +// req.setLoginpw(Md5Util.strToMd5(req.getLoginpw())); +// } else { +// req.setLoginpw(null); +// } + int result = usersService.saveOrUpdate(req); + + return ApiResponse.success(result); + } + + //获取当前登陆用户的个人信息 + @RequestMapping("/session") + public ApiResponse getCurrUser(HttpServletRequest request) { + Integer id = (Integer) request.getSession().getAttribute("usersId"); + Users info = usersService.findById(id); + return ApiResponse.success(info); + } + + //用户重置密码接口 + @IgnoreAuth + @RequestMapping("/resetPw") + public ApiResponse usersResetPw(@RequestBody Users req) { + Users info = usersService.findOneByEqualTo(req); + if (null == info || info.getId() == 0) { + return ApiResponse.failed("请确认您的用户名、姓名和电话是否正确!"); + } + info.setLoginpw(Md5Util.strToMd5("000000")); + usersService.saveOrUpdate(info); + return ApiResponse.success("您的密码已被重置为000000,如需修改,请登陆个人中心操作!"); + } + + //获取所有用户数据接口 + @IgnoreAuth + @RequestMapping("/all") + public ApiResponse usersAll() { + List usersList = usersService.findAll(); + return ApiResponse.success(usersList); + } + + //根据条件(字符类型模糊匹配查询)获取用户数据接口 + @IgnoreAuth + @RequestMapping("/search") + public ApiResponse usersSearch(Users req) { + List usersList = usersService.find(req); + return ApiResponse.success(usersList); + } + + //根据条件(字符类型完全匹配查询)获取用户数据接口 + @IgnoreAuth + @RequestMapping("/searchByEqualTo") + public ApiResponse usersSearchByEqualTo(Users req) { + List usersList = usersService.findByEqualTo(req); + return ApiResponse.success(usersList); + } + + + //按条件查询用户分页数据方法(模糊匹配查询) + private PageData getPageList(Users req, int pageNo, int pageSize, String sortProperty) { + PageWrap pageWrap = getPageWrap(req, pageNo, pageSize, sortProperty); + PageData usersList = usersService.findPage(pageWrap); + return usersList; + } + + //按条件查询用户分页数据方法(完全匹配查询) + private PageData getPageListByEqualTo(Users req, int pageNo, int pageSize, String sortProperty) { + PageWrap pageWrap = getPageWrap(req, pageNo, pageSize, sortProperty); + PageData usersList = usersService.findPageByEqualTo(pageWrap); + return usersList; + } + + //获取用户查询数据搜索条件 + private PageWrap getPageWrap(Users req, int pageNo, int pageSize, String sortProperty) { + PageWrap pageWrap = new PageWrap<>(); + pageWrap.setModel(req); + pageWrap.setPageNum(pageNo); + pageWrap.setPageSize(pageSize); + PageWrap.SortData sortData = new PageWrap.SortData(); + sortData.setDirection("DESC"); + sortData.setProperty(sortProperty); + List sorts = new ArrayList<>(); + sorts.add(sortData); + pageWrap.setSorts(sorts); + return pageWrap; + } + +} diff --git a/UsersMapper.java b/UsersMapper.java new file mode 100644 index 0000000..63b2f9e --- /dev/null +++ b/UsersMapper.java @@ -0,0 +1,47 @@ +package com.dao; + +import com.entity.Users; +import com.entity.UsersExample; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * @ClassName UsersMapper + * @Description 用户模块数据持久层 + */ +public interface UsersMapper { + + //根据条件获取用户表users的数据数量 + int countByExample(UsersExample example); + + //根据条件删除用户表users的数据 + int deleteByExample(UsersExample example); + + //根据主键ID列删除用户表users的数据 + int deleteByPrimaryKey(Integer id); + + //插入用户表users的实体数据(包含null值) + int insert(Users record); + + //插入用户表users的实体数据(不包含null值) + int insertSelective(Users record); + + //根据条件获取用户表users的数据列表 + List selectByExample(UsersExample example); + + //根据主键ID列获取用户表users的数据实体 + Users selectByPrimaryKey(Integer id); + + //根据条件更新用户表users的实体数据(不包含null值) + int updateByExampleSelective(@Param("record") Users record, @Param("example") UsersExample example); + + //根据条件更新用户表users的实体数据(包含null值) + int updateByExample(@Param("record") Users record, @Param("example") UsersExample example); + + //根据主键ID列更新用户表users的实体数据(不包含null值) + int updateByPrimaryKeySelective(Users record); + + //根据主键ID列更新用户表users的实体数据(包含null值) + int updateByPrimaryKey(Users record); +} diff --git a/UsersService.java b/UsersService.java new file mode 100644 index 0000000..25bfcf9 --- /dev/null +++ b/UsersService.java @@ -0,0 +1,44 @@ +package com.service; + +import com.entity.Users; +import com.util.PageData; +import com.util.PageWrap; + +import java.util.List; + +/** + * @ClassName UsersService + * @Description 用户模块业务层 + */ +public interface UsersService { + + //保存或更新用户表数据 + Integer saveOrUpdate(Users instance); + + //查询所有用户表数据 + List findAll(); + + //根据条件(字符类型模糊)查询用户表数据 + List find(Users instance); + + //根据条件(字符类型完全匹配)查询用户表数据 + List findByEqualTo(Users instance); + + //根据条件(字符类型模糊)查询查询第一条用户表数据 + Users findOne(Users instance); + + //根据条件(字符类型完全匹配)查询查询第一条用户表数据 + Users findOneByEqualTo(Users instance); + + //根据id列查询用户表数据 + Users findById(Integer id); + + //根据id列删除用户表数据 + int deleteById(Integer id); + + //根据条件(字符类型模糊)分页查询用户表数据 + PageData findPage(PageWrap pageWrap); + + //根据条件(字符类型完全匹配)分页查询用户表数据 + PageData findPageByEqualTo(PageWrap pageWrap); +} diff --git a/shopping.sql b/shopping.sql new file mode 100644 index 0000000..01950b8 --- /dev/null +++ b/shopping.sql @@ -0,0 +1,409 @@ +/* +Navicat MySQL Data Transfer + +Source Server : localhost +Source Server Version : 50621 +Source Host : localhost:3306 +Source Database : shopping + +Target Server Type : MYSQL +Target Server Version : 50621 +File Encoding : 65001 + +Date: 2024-11-14 14:52:41 +*/ + +SET FOREIGN_KEY_CHECKS=0; + +-- ---------------------------- +-- Table structure for dingdan +-- ---------------------------- +DROP TABLE IF EXISTS `dingdan`; +CREATE TABLE `dingdan` ( + `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '订单', + `bianhao` varchar(50) DEFAULT NULL COMMENT '编号', + `jine` int(11) DEFAULT NULL COMMENT '订单金额', + `zhifushenhe` varchar(50) DEFAULT NULL COMMENT '是否支付', + `fahuoshenhe` varchar(50) DEFAULT NULL COMMENT '是否发货', + `shouhuoshenhe` varchar(50) DEFAULT NULL COMMENT '是否收货', + `zhifufangshiid` int(11) DEFAULT NULL COMMENT '支付方式', + `xingming` varchar(50) DEFAULT NULL COMMENT '姓名', + `dianhua` varchar(50) DEFAULT NULL COMMENT '电话', + `dizhi` varchar(50) DEFAULT NULL COMMENT '送货地址', + `shijian` varchar(50) DEFAULT NULL COMMENT '时间', + `wuliu` varchar(5000) DEFAULT NULL COMMENT '物流信息', + `beizhu` varchar(50) DEFAULT NULL COMMENT '备注', + `usersid` int(11) DEFAULT NULL COMMENT '用户id', + PRIMARY KEY (`id`) +) ENGINE=MyISAM AUTO_INCREMENT=47 DEFAULT CHARSET=utf8; + +-- ---------------------------- +-- Records of dingdan +-- ---------------------------- +INSERT INTO `dingdan` VALUES ('24', '15813885589189', '16', 'yes', 'yes', 'yes', '3', '刘三', '13777777777', '北京中关村', '2024-06-01 16:36:36', null, '无', '2'); +INSERT INTO `dingdan` VALUES ('20', '15813414477261', '32', 'yes', 'yes', 'yes', '3', '刘三', '13777777777', '北京中关村', '2024-06-01 16:36:36', null, '无', '2'); +INSERT INTO `dingdan` VALUES ('21', '15813415026171', '31', 'yes', 'yes', 'yes', '3', '刘三', '13777777777', '北京中关村', '2024-06-01 16:36:36', null, '无', '2'); +INSERT INTO `dingdan` VALUES ('22', '15813448135662', '141', 'yes', 'yes', 'yes', '3', '刘三', '13777777777', '北京中关村', '2024-06-01 16:36:36', null, '无', '2'); +INSERT INTO `dingdan` VALUES ('23', '15813847699886', '32', 'yes', 'yes', 'yes', '3', '刘三', '13777777777', '北京中关村', '2024-06-01 16:36:36', 'w', '无', '2'); +INSERT INTO `dingdan` VALUES ('25', '15813898770985', '32', 'yes', 'yes', 'yes', '3', '刘三', '13777777777', '北京中关村', '2024-06-01 16:36:36', null, '无', '2'); +INSERT INTO `dingdan` VALUES ('26', '15813899736093', '48', 'yes', 'yes', 'yes', '3', '刘三', '13777777777', '北京中关村', '2024-06-01 16:36:36', null, '无', '2'); +INSERT INTO `dingdan` VALUES ('27', '15813900729928', '32', 'yes', 'yes', 'yes', '3', '刘三', '13777777777', '北京中关村', '2024-06-01 16:36:36', null, '无', '2'); +INSERT INTO `dingdan` VALUES ('28', '15813913070045', '156', 'yes', 'yes', 'yes', '3', '刘三', '13777777777', '北京中关村', '2024-06-01 16:36:36', null, '无', '5'); +INSERT INTO `dingdan` VALUES ('29', '15813914223411', '63', 'yes', 'yes', 'yes', '3', '刘三', '13777777777', '北京中关村', '2024-06-01 16:36:36', null, '无', '5'); +INSERT INTO `dingdan` VALUES ('30', '15826254302785', '64', 'yes', 'yes', 'yes', '3', '刘三', '13777777777', '北京中关村', '2024-06-01 16:36:36', null, '无', '2'); +INSERT INTO `dingdan` VALUES ('31', '20200308090451', '326', 'yes', 'yes', 'yes', '1', '刘三', '13777777777', '北京中关村', '2024-06-01 16:36:36', null, '无', '2'); +INSERT INTO `dingdan` VALUES ('32', '20200308092656', '296', 'yes', 'yes', 'yes', '1', '刘三', '13777777777', '北京中关村', '2024-06-01 16:36:36', null, '无', '2'); +INSERT INTO `dingdan` VALUES ('33', '20200309120928', '496', 'yes', 'yes', 'yes', '1', '刘三', '13777777777', '北京中关村', '2024-06-01 16:36:36', null, '无', '2'); +INSERT INTO `dingdan` VALUES ('34', '20200309122706', '40', 'yes', 'yes', 'yes', '1', '刘三', '13777777777', '北京中关村', '2024-06-01 16:36:36', null, '无', '2'); +INSERT INTO `dingdan` VALUES ('35', '20200309123033', '20', 'yes', 'yes', 'yes', '1', '刘三', '13777777777', '北京中关村', '2024-06-01 16:36:36', null, '无', '2'); +INSERT INTO `dingdan` VALUES ('36', '20200309044107', '334', 'yes', 'yes', 'yes', '1', '刘三', '13777777777', '北京中关村', '2024-06-01 16:36:36', null, '无', '5'); +INSERT INTO `dingdan` VALUES ('37', '20200314040145', '72', 'yes', 'yes', 'yes', '1', '刘三', '13777777777', '北京中关村', '2024-06-01 16:36:36', null, '无', '2'); +INSERT INTO `dingdan` VALUES ('38', '20200314044956', '20', 'yes', 'yes', 'yes', '1', '刘三', '13777777777', '北京中关村', '2024-06-01 16:36:36', null, '无', '5'); +INSERT INTO `dingdan` VALUES ('39', '20200314050638', '40', 'yes', 'yes', 'yes', '1', '刘三', '13777777777', '北京中关村', '2024-06-01 16:36:36', null, '无', '5'); +INSERT INTO `dingdan` VALUES ('40', '20200419113059', '60', 'yes', 'yes', 'yes', '1', '刘三', '13777777777', '北京中关村', '2024-06-01 16:36:36', null, '无', '2'); +INSERT INTO `dingdan` VALUES ('41', '20201201045859', '90', 'yes', 'yes', 'yes', '1', '刘三', '13777777777', '北京中关村', '2024-06-01 16:36:36', null, '无', '5'); +INSERT INTO `dingdan` VALUES ('42', '20201201054926', '60', 'yes', 'yes', 'yes', '1', '刘三', '13777777777', '北京中关村', '2024-06-01 16:36:36', null, '无', '5'); +INSERT INTO `dingdan` VALUES ('43', '1691239355758', '80', 'no', 'yes', 'no', '1', '123', '13777777777', '123', '2024-06-01 20:42:35', '', '15232', '2'); +INSERT INTO `dingdan` VALUES ('44', '1691239376932', '160', 'no', 'yes', 'no', '2', '123', '13777777777', '132', '2024-06-01 20:42:56', '', '123', '2'); +INSERT INTO `dingdan` VALUES ('45', '1721193957205', '160', 'no', 'no', 'no', '1', '123', '15005073069', '福建省长乐市', '2024-07-17 13:25:57', '', '123', '16'); +INSERT INTO `dingdan` VALUES ('46', '1721194079137', '5040', 'no', 'yes', 'no', '2', '123', '15005073069', '福建省长乐市', '2024-07-17 13:27:59', '', '123', '16'); + +-- ---------------------------- +-- Table structure for dingdanxiang +-- ---------------------------- +DROP TABLE IF EXISTS `dingdanxiang`; +CREATE TABLE `dingdanxiang` ( + `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '订单项', + `dingdanid` int(11) DEFAULT NULL COMMENT '订单id', + `shangpinid` int(11) DEFAULT NULL COMMENT '商品id', + `goumaishuliang` int(11) DEFAULT NULL COMMENT '商品数量', + `usersid` int(11) DEFAULT NULL COMMENT '用户id', + PRIMARY KEY (`id`) +) ENGINE=MyISAM AUTO_INCREMENT=81 DEFAULT CHARSET=utf8; + +-- ---------------------------- +-- Records of dingdanxiang +-- ---------------------------- +INSERT INTO `dingdanxiang` VALUES ('59', '29', '7', '1', '5'); +INSERT INTO `dingdanxiang` VALUES ('60', '29', '8', '3', '5'); +INSERT INTO `dingdanxiang` VALUES ('53', '24', '8', '1', '2'); +INSERT INTO `dingdanxiang` VALUES ('47', '20', '8', '2', '2'); +INSERT INTO `dingdanxiang` VALUES ('48', '21', '8', '1', '2'); +INSERT INTO `dingdanxiang` VALUES ('49', '21', '7', '1', '2'); +INSERT INTO `dingdanxiang` VALUES ('50', '22', '8', '6', '2'); +INSERT INTO `dingdanxiang` VALUES ('51', '22', '7', '3', '2'); +INSERT INTO `dingdanxiang` VALUES ('52', '23', '8', '2', '2'); +INSERT INTO `dingdanxiang` VALUES ('54', '25', '8', '2', '2'); +INSERT INTO `dingdanxiang` VALUES ('55', '26', '8', '3', '2'); +INSERT INTO `dingdanxiang` VALUES ('56', '27', '8', '2', '2'); +INSERT INTO `dingdanxiang` VALUES ('57', '28', '8', '6', '5'); +INSERT INTO `dingdanxiang` VALUES ('58', '28', '7', '4', '5'); +INSERT INTO `dingdanxiang` VALUES ('61', '30', '8', '4', '2'); +INSERT INTO `dingdanxiang` VALUES ('66', '36', '5', '2', '5'); +INSERT INTO `dingdanxiang` VALUES ('65', '35', '5', '1', '2'); +INSERT INTO `dingdanxiang` VALUES ('67', '36', '6', '3', '5'); +INSERT INTO `dingdanxiang` VALUES ('68', '37', '5', '3', '2'); +INSERT INTO `dingdanxiang` VALUES ('69', '37', '6', '2', '2'); +INSERT INTO `dingdanxiang` VALUES ('70', '38', '5', '1', '5'); +INSERT INTO `dingdanxiang` VALUES ('71', '39', '5', '2', '5'); +INSERT INTO `dingdanxiang` VALUES ('72', '40', '5', '2', '2'); +INSERT INTO `dingdanxiang` VALUES ('73', '41', '8', '2', '5'); +INSERT INTO `dingdanxiang` VALUES ('74', '41', '5', '1', '5'); +INSERT INTO `dingdanxiang` VALUES ('75', '42', '5', '1', '5'); +INSERT INTO `dingdanxiang` VALUES ('76', '42', '8', '1', '5'); +INSERT INTO `dingdanxiang` VALUES ('77', '43', '11', '1', '2'); +INSERT INTO `dingdanxiang` VALUES ('78', '44', '8', '2', '2'); +INSERT INTO `dingdanxiang` VALUES ('79', '45', '11', '2', '16'); +INSERT INTO `dingdanxiang` VALUES ('80', '46', '8', '63', '16'); + +-- ---------------------------- +-- Table structure for dx +-- ---------------------------- +DROP TABLE IF EXISTS `dx`; +CREATE TABLE `dx` ( + `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '信息介绍', + `leibie` varchar(50) CHARACTER SET utf8 DEFAULT NULL COMMENT '类别', + `content` varchar(5000) CHARACTER SET utf8 DEFAULT NULL COMMENT '内容', + `addtime` varchar(50) CHARACTER SET utf8 DEFAULT NULL COMMENT '时间', + PRIMARY KEY (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=latin1; + +-- ---------------------------- +-- Records of dx +-- ---------------------------- +INSERT INTO `dx` VALUES ('1', '系统简介', '内容介绍', '2024-06-01 16:36:36'); +INSERT INTO `dx` VALUES ('2', '关于我们', '内容介绍', '2024-06-01 16:36:36'); +INSERT INTO `dx` VALUES ('3', '系统公告', '内容介绍', '2024-06-01 16:36:36'); +INSERT INTO `dx` VALUES ('4', '网站历史', '内容介绍', '2024-06-01 16:36:36'); + +-- ---------------------------- +-- Table structure for gouwuche +-- ---------------------------- +DROP TABLE IF EXISTS `gouwuche`; +CREATE TABLE `gouwuche` ( + `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '购物车', + `shangpinid` int(11) DEFAULT NULL COMMENT '商品id', + `goumaishuliang` int(11) DEFAULT NULL COMMENT '商品数量', + `usersid` int(11) DEFAULT NULL COMMENT '用户id', + PRIMARY KEY (`id`) +) ENGINE=MyISAM AUTO_INCREMENT=45 DEFAULT CHARSET=utf8; + +-- ---------------------------- +-- Records of gouwuche +-- ---------------------------- +INSERT INTO `gouwuche` VALUES ('44', '12', '100', '16'); +INSERT INTO `gouwuche` VALUES ('2', '5', '3', '5'); +INSERT INTO `gouwuche` VALUES ('40', '12', '2', '5'); +INSERT INTO `gouwuche` VALUES ('41', '11', '1', '5'); + +-- ---------------------------- +-- Table structure for lianjie +-- ---------------------------- +DROP TABLE IF EXISTS `lianjie`; +CREATE TABLE `lianjie` ( + `id` int(11) DEFAULT NULL, + `name` varchar(255) DEFAULT NULL, + `url` varchar(255) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +-- ---------------------------- +-- Records of lianjie +-- ---------------------------- +INSERT INTO `lianjie` VALUES ('2', '中华姓氏网', 'http://www.10000xing.cn/x010/wjx.html'); + +-- ---------------------------- +-- Table structure for liuyan +-- ---------------------------- +DROP TABLE IF EXISTS `liuyan`; +CREATE TABLE `liuyan` ( + `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '留言反馈', + `biaoti` varchar(55) DEFAULT NULL COMMENT '标题', + `neirong` varchar(4000) DEFAULT NULL COMMENT '内容', + `addshijian` varchar(55) DEFAULT NULL COMMENT '留言添加时间', + `usersid` int(11) DEFAULT NULL COMMENT '用户id', + `huifu` varchar(4000) DEFAULT NULL COMMENT '回复', + PRIMARY KEY (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=21 DEFAULT CHARSET=utf8; + +-- ---------------------------- +-- Records of liuyan +-- ---------------------------- +INSERT INTO `liuyan` VALUES ('1', '留言信息', '内容介绍', '2024-06-01 16:36:36', '2', '222'); +INSERT INTO `liuyan` VALUES ('2', '留言信息', '内容介绍', '2024-06-01 16:36:36', '2', 'h'); +INSERT INTO `liuyan` VALUES ('3', '留言信息', '内容介绍', '2024-06-01 16:36:36', '2', 'hh'); +INSERT INTO `liuyan` VALUES ('4', '留言信息', '内容介绍', '2024-06-01 16:36:36', '2', ''); +INSERT INTO `liuyan` VALUES ('5', '留言信息', '内容介绍', '2024-06-01 16:36:36', '2', ''); +INSERT INTO `liuyan` VALUES ('6', '留言信息', '内容介绍', '2024-06-01 16:36:36', '6', ''); +INSERT INTO `liuyan` VALUES ('7', '留言信息', '内容介绍', '2024-06-01 16:36:36', '5', ''); +INSERT INTO `liuyan` VALUES ('8', '留言信息', '内容介绍', '2024-06-01 16:36:36', '5', ''); +INSERT INTO `liuyan` VALUES ('9', '留言信息', '内容介绍', '2024-06-01 16:36:36', '5', '22'); +INSERT INTO `liuyan` VALUES ('10', '留言信息', '内容介绍', '2024-06-01 16:36:36', '2', ' '); +INSERT INTO `liuyan` VALUES ('11', '留言信息', '内容介绍', '2024-06-01 16:36:36', '5', null); +INSERT INTO `liuyan` VALUES ('13', '留言信息', '内容介绍', '2024-06-01 16:36:36', '5', null); +INSERT INTO `liuyan` VALUES ('14', '留言信息', '内容介绍', '2024-06-01 16:36:36', '2', null); +INSERT INTO `liuyan` VALUES ('15', '留言信息', '内容介绍', '2024-06-01 16:36:36', '2', 'ghj'); +INSERT INTO `liuyan` VALUES ('19', '留言信息', '内容介绍', '2024-06-01 16:36:36', '2', null); +INSERT INTO `liuyan` VALUES ('20', '留言信息', '内容介绍', '2024-06-01 16:36:36', '2', null); + +-- ---------------------------- +-- Table structure for lunbo +-- ---------------------------- +DROP TABLE IF EXISTS `lunbo`; +CREATE TABLE `lunbo` ( + `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '轮播图', + `biaoti` varchar(50) DEFAULT NULL COMMENT '标题', + `image` varchar(255) DEFAULT NULL COMMENT '图片', + PRIMARY KEY (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=16 DEFAULT CHARSET=utf8; + +-- ---------------------------- +-- Records of lunbo +-- ---------------------------- +INSERT INTO `lunbo` VALUES ('13', 'ssd', 'upload/1617950350723.jpg'); +INSERT INTO `lunbo` VALUES ('14', 'ssdsdf', 'upload/1617950372970.jpg'); +INSERT INTO `lunbo` VALUES ('15', 'dfds', 'upload/1617950424839.jpg'); + +-- ---------------------------- +-- Table structure for pingjia +-- ---------------------------- +DROP TABLE IF EXISTS `pingjia`; +CREATE TABLE `pingjia` ( + `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '评论', + `biaoti` varchar(500) DEFAULT NULL COMMENT '评语', + `fenshu` varchar(50) DEFAULT NULL COMMENT '分数(范围1-5)', + `shijian` varchar(50) DEFAULT NULL COMMENT '时间', + `shangpinid` int(11) DEFAULT NULL COMMENT '零食id', + `usersid` int(255) DEFAULT NULL COMMENT '用户id', + PRIMARY KEY (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=19 DEFAULT CHARSET=utf8; + +-- ---------------------------- +-- Records of pingjia +-- ---------------------------- +INSERT INTO `pingjia` VALUES ('1', '顶顶顶顶顶弟弟顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶ss', '5', '2024-06-01 16:36:36', '6', '5'); +INSERT INTO `pingjia` VALUES ('2', '对方答复', '5', '2024-06-01 16:36:36', '5', '5'); +INSERT INTO `pingjia` VALUES ('3', '大幅度', '5', '2024-06-01 16:36:36', '8', '5'); +INSERT INTO `pingjia` VALUES ('4', '大幅度ss', '5', '2024-06-01 16:36:36', '6', '2'); +INSERT INTO `pingjia` VALUES ('5', '大幅度', '5', '2024-06-01 16:36:36', '5', '2'); +INSERT INTO `pingjia` VALUES ('6', '订单', '5', '2024-06-01 16:36:36', '6', '2'); +INSERT INTO `pingjia` VALUES ('8', '发的', '5', '2024-06-01 16:36:36', '5', '2'); +INSERT INTO `pingjia` VALUES ('9', '想吃粽子', '5', '2024-06-01 16:36:36', '6', '2'); +INSERT INTO `pingjia` VALUES ('10', '好看s', '5', '2024-06-01 16:36:36', '5', '5'); +INSERT INTO `pingjia` VALUES ('12', '好好', '5', '2024-06-01 16:36:36', '6', '5'); +INSERT INTO `pingjia` VALUES ('13', '

啊啊好

', '5', '2024-06-01 16:36:36', '5', '2'); +INSERT INTO `pingjia` VALUES ('14', '

好好

', '5', '2024-06-01 16:36:36', '6', '5'); +INSERT INTO `pingjia` VALUES ('15', '好好好', '5', '2024-06-01 16:36:36', '5', '5'); +INSERT INTO `pingjia` VALUES ('16', '三四十', '5', '2024-06-01 16:36:36', '6', '5'); +INSERT INTO `pingjia` VALUES ('17', '啊啊试试ss', '5', '2024-06-01 16:36:36', '5', '2'); +INSERT INTO `pingjia` VALUES ('18', 'test', '5', '2024-06-01 16:36:36', '6', '2'); + +-- ---------------------------- +-- Table structure for pinlei +-- ---------------------------- +DROP TABLE IF EXISTS `pinlei`; +CREATE TABLE `pinlei` ( + `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '分类', + `mingcheng` varchar(255) DEFAULT NULL COMMENT '名称', + PRIMARY KEY (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8; + +-- ---------------------------- +-- Records of pinlei +-- ---------------------------- +INSERT INTO `pinlei` VALUES ('1', '糕点'); +INSERT INTO `pinlei` VALUES ('2', '糖类'); +INSERT INTO `pinlei` VALUES ('3', '巧克力类'); +INSERT INTO `pinlei` VALUES ('4', '肉类'); + +-- ---------------------------- +-- Table structure for shangpin +-- ---------------------------- +DROP TABLE IF EXISTS `shangpin`; +CREATE TABLE `shangpin` ( + `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '零食', + `mingcheng` varchar(200) DEFAULT NULL COMMENT '名称', + `bianhao` varchar(50) DEFAULT NULL COMMENT '编号', + `pinleiid` int(11) DEFAULT NULL COMMENT '分类id', + `neirong` varchar(3000) DEFAULT NULL COMMENT '内容介绍', + `image` varchar(255) DEFAULT NULL COMMENT '图片', + `yuanshijiage` int(11) DEFAULT NULL COMMENT '原价', + `jiage` int(11) DEFAULT NULL COMMENT '现价', + `danwei` varchar(50) DEFAULT NULL COMMENT '单位', + `shenhe` varchar(50) DEFAULT NULL COMMENT '是否特价', + `kucunshuliang` int(11) DEFAULT '0' COMMENT '库存数量', + `xiaoshoushuliang` int(11) DEFAULT '0' COMMENT '销售数量', + PRIMARY KEY (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=13 DEFAULT CHARSET=utf8; + +-- ---------------------------- +-- Records of shangpin +-- ---------------------------- +INSERT INTO `shangpin` VALUES ('5', '嫩豆腐', 'A001', '2', '内容介绍', 'upload/1617951392528.png', '80', '80', 'KG', 'yes', '92', '6'); +INSERT INTO `shangpin` VALUES ('6', '肉松面包', 'A002', '2', '内容介绍', 'upload/1617951406159.png', '80', '80', 'KG', 'yes', '93', '0'); +INSERT INTO `shangpin` VALUES ('7', '香香锅巴', 'A003', '2', '内容介绍', 'upload/1617951429878.png', '80', '80', 'KG', 'yes', '91', '5'); +INSERT INTO `shangpin` VALUES ('8', '饼干', '1004', '2', '内容介绍', 'upload/1617951670596.png', '80', '80', 'KG', 'yes', '0', '86'); +INSERT INTO `shangpin` VALUES ('9', '嫩豆腐', 'A001', '2', '内容介绍', 'upload/1617951392528.png', '80', '80', 'KG', 'yes', '92', '6'); +INSERT INTO `shangpin` VALUES ('10', '肉松面包', 'A002', '2', '内容介绍', 'upload/1617951406159.png', '80', '80', 'KG', 'yes', '93', '0'); +INSERT INTO `shangpin` VALUES ('11', '香香锅巴', 'A003', '2', '内容介绍', 'upload/1617951429878.png', '80', '80', 'KG', 'yes', '88', '8'); +INSERT INTO `shangpin` VALUES ('12', '饼干', '1004', '2', '内容介绍', 'upload/1617951670596.png', '80', '80', 'KG', 'yes', '65', '21'); + +-- ---------------------------- +-- Table structure for shenqing +-- ---------------------------- +DROP TABLE IF EXISTS `shenqing`; +CREATE TABLE `shenqing` ( + `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '售后申请', + `xingming` varchar(50) DEFAULT NULL COMMENT '姓名', + `dianhua` varchar(50) DEFAULT NULL COMMENT '电话', + `neirong` varchar(500) DEFAULT NULL COMMENT '说明', + `shijian` varchar(50) DEFAULT NULL COMMENT '时间', + `beizhu` varchar(50) DEFAULT NULL COMMENT '备注', + `shenhe` varchar(50) DEFAULT NULL COMMENT '是否审核', + `usersid` int(11) DEFAULT NULL COMMENT '用户id', + PRIMARY KEY (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=10 DEFAULT CHARSET=utf8; + +-- ---------------------------- +-- Records of shenqing +-- ---------------------------- +INSERT INTO `shenqing` VALUES ('8', '刘三', '13777777777', '内容介绍', '2024-06-01 16:36:36', '无', 'yes', '5'); +INSERT INTO `shenqing` VALUES ('9', '刘三', '13777777777', '内容介绍', '2024-06-01 16:36:36', '无', 'yes', '5'); + +-- ---------------------------- +-- Table structure for shoucang +-- ---------------------------- +DROP TABLE IF EXISTS `shoucang`; +CREATE TABLE `shoucang` ( + `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '收藏', + `shijian` varchar(50) DEFAULT NULL COMMENT '时间', + `shangpinid` int(11) DEFAULT NULL COMMENT '零食id', + `usersid` int(11) DEFAULT NULL COMMENT '用户id', + PRIMARY KEY (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=31 DEFAULT CHARSET=utf8; + +-- ---------------------------- +-- Records of shoucang +-- ---------------------------- +INSERT INTO `shoucang` VALUES ('18', '2024-06-01 16:36:36', '5', '2'); +INSERT INTO `shoucang` VALUES ('19', '2024-06-01 16:36:36', '6', '5'); +INSERT INTO `shoucang` VALUES ('21', '2024-06-01 16:36:36', '5', '5'); +INSERT INTO `shoucang` VALUES ('22', '2024-06-01 16:36:36', '6', '2'); +INSERT INTO `shoucang` VALUES ('23', '2024-06-01 16:36:36', '5', '2'); +INSERT INTO `shoucang` VALUES ('24', '2024-06-01 16:36:36', '6', '5'); +INSERT INTO `shoucang` VALUES ('25', '2024-06-01 16:36:36', '5', '2'); +INSERT INTO `shoucang` VALUES ('26', '2024-06-01 16:36:36', '6', '2'); +INSERT INTO `shoucang` VALUES ('27', '2024-06-01 16:36:36', '5', '5'); +INSERT INTO `shoucang` VALUES ('28', '2024-06-01 16:36:36', '6', '2'); +INSERT INTO `shoucang` VALUES ('29', '2024-06-01 16:36:36', '5', '2'); +INSERT INTO `shoucang` VALUES ('30', '2024-06-01 16:36:36', '6', '5'); + +-- ---------------------------- +-- Table structure for users +-- ---------------------------- +DROP TABLE IF EXISTS `users`; +CREATE TABLE `users` ( + `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '用户', + `loginname` varchar(50) DEFAULT NULL COMMENT '用户名称', + `loginpw` varchar(50) DEFAULT NULL COMMENT '密码', + `type` varchar(50) DEFAULT NULL COMMENT '类型', + `typename` varchar(50) DEFAULT NULL COMMENT '类型名称', + `xingming` varchar(50) DEFAULT NULL COMMENT '姓名', + `xingbie` varchar(50) DEFAULT NULL COMMENT '性别', + `nianling` varchar(50) DEFAULT NULL COMMENT '年龄', + `address` varchar(50) DEFAULT NULL COMMENT '地址', + `dianhua` varchar(255) DEFAULT NULL COMMENT '电话', + `shenhe` varchar(50) DEFAULT NULL COMMENT '审核', + PRIMARY KEY (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=17 DEFAULT CHARSET=utf8; + +-- ---------------------------- +-- Records of users +-- ---------------------------- +INSERT INTO `users` VALUES ('1', 'laoshi', '670b14728ad9902aecba32e22fa4f6bd', '2', '用户', '刘三', '男', '24', '北京路', '13777777777', 'yes'); +INSERT INTO `users` VALUES ('2', 'a', '0cc175b9c0f1b6a831c399e269772661', '0', '管理', '刘三', '男', '24', '北京路', '13777777777', 'yes'); +INSERT INTO `users` VALUES ('5', 'liusan', '670b14728ad9902aecba32e22fa4f6bd', '2', '用户', '刘三', '男', '24', '上海路', '13850127079', 'yes'); +INSERT INTO `users` VALUES ('6', 'hsg', '94b40c6db280230b4211b06fa04c7be1', '0', '管理', '刘三', '男', '24', '26441186', '13777777777', 'yes'); +INSERT INTO `users` VALUES ('7', 'zzz', '670b14728ad9902aecba32e22fa4f6bd', '2', '用户', '刘三', '男', '24', 'zzz', '13777777777', 'yes'); +INSERT INTO `users` VALUES ('8', 'ggg', '670b14728ad9902aecba32e22fa4f6bd', '2', '用户', '刘三', '男', '24', 'ggg', '13777777777', 'yes'); +INSERT INTO `users` VALUES ('12', '55', '670b14728ad9902aecba32e22fa4f6bd', '2', '用户', '刘三', '男', '24', '55', '13777777777', 'yes'); +INSERT INTO `users` VALUES ('13', '5566', '670b14728ad9902aecba32e22fa4f6bd', '2', '用户', '刘三', '男', '24', '55', '13777777777', 'yes'); +INSERT INTO `users` VALUES ('14', 'ztest', '670b14728ad9902aecba32e22fa4f6bd', '2', '用户', '刘三', '男', '24', '22', '13777777777', 'yes'); +INSERT INTO `users` VALUES ('15', 'lsf', '123456', '2', '用户', '张杰', '男', '21', '22', '15060578522', 'yes'); +INSERT INTO `users` VALUES ('16', 'lsf4', '202cb962ac59075b964b07152d234b70', '2', '用户', 'lishengfeng', '男', '21', '福建省长乐市金峰', '15007066931', 'no'); + +-- ---------------------------- +-- Table structure for zhifufangshi +-- ---------------------------- +DROP TABLE IF EXISTS `zhifufangshi`; +CREATE TABLE `zhifufangshi` ( + `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '支付方式', + `mingcheng` varchar(255) DEFAULT NULL COMMENT '支付方式', + PRIMARY KEY (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8; + +-- ---------------------------- +-- Records of zhifufangshi +-- ---------------------------- +INSERT INTO `zhifufangshi` VALUES ('1', '支付宝支付'); +INSERT INTO `zhifufangshi` VALUES ('2', '微信支付'); +INSERT INTO `zhifufangshi` VALUES ('3', '网银支付');