diff --git a/doc/若依环境使用手册.docx b/doc/若依环境使用手册.docx deleted file mode 100644 index 9e4daef..0000000 Binary files a/doc/若依环境使用手册.docx and /dev/null differ diff --git a/sql/all.sql b/sql/all.sql index 8bc81d3..b4d9a9e 100644 --- a/sql/all.sql +++ b/sql/all.sql @@ -6,7 +6,6 @@ -- -------------------------------------------------------- /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; -/*!40101 SET NAMES utf8 */; /*!50503 SET NAMES utf8mb4 */; /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; @@ -81,6 +80,7 @@ CREATE TABLE IF NOT EXISTS `food_category` ( `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '食品分类编号', `title` varchar(200) DEFAULT NULL COMMENT '分类标题', `sort` int(3) DEFAULT '0' COMMENT '排序', + `cover` varchar(200) DEFAULT NULL COMMENT '分类图片', `create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', `update_time` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', `state` tinyint(2) DEFAULT '1' COMMENT '状态', diff --git a/waimai-admin-ui/src/views/admin/category/index.vue b/waimai-admin-ui/src/views/admin/category/index.vue index 18799ba..6df78bb 100644 --- a/waimai-admin-ui/src/views/admin/category/index.vue +++ b/waimai-admin-ui/src/views/admin/category/index.vue @@ -1,14 +1,32 @@ - + - - + + + + + + + + + + @@ -129,6 +167,7 @@ import { listCategory, getCategory, delCategory, addCategory, updateCategory } f export default { name: "Category", + dicts: ['data_state'], data() { return { // 遮罩层 @@ -154,6 +193,8 @@ export default { pageNum: 1, pageSize: 10, title: null, + sort: null, + state: null, }, // 表单参数 form: {}, @@ -162,7 +203,6 @@ export default { } }; }, - dicts:['data_state'], created() { this.getList(); }, @@ -187,6 +227,7 @@ export default { id: null, title: null, sort: null, + cover: null, createTime: null, updateTime: null, state: null, diff --git a/waimai-admin-ui/src/views/admin/food/index.vue b/waimai-admin-ui/src/views/admin/food/index.vue index da44172..8e9e987 100644 --- a/waimai-admin-ui/src/views/admin/food/index.vue +++ b/waimai-admin-ui/src/views/admin/food/index.vue @@ -16,8 +16,8 @@ - - + @@ -72,7 +72,8 @@ - + + diff --git a/waimai-admin/src/main/java/com/waimai/api/Category.java b/waimai-admin/src/main/java/com/waimai/api/Category.java new file mode 100644 index 0000000..219bf19 --- /dev/null +++ b/waimai-admin/src/main/java/com/waimai/api/Category.java @@ -0,0 +1,26 @@ +package com.waimai.api; + +import com.waimai.common.annotation.Anonymous; +import com.waimai.common.core.domain.R; +import com.waimai.web.admin.domain.FoodCategory; +import com.waimai.web.admin.service.IFoodCategoryService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import java.util.List; + +@RestController +@RequestMapping("/api/category") +@Anonymous +public class Category { + @Autowired + private IFoodCategoryService foodCategoryService; + + @RequestMapping + public R> selectAll() { + return R.ok( + foodCategoryService.selectFoodCategoryList(new FoodCategory()) + ); + } +} diff --git a/waimai-admin/src/main/java/com/waimai/api/FoodsApiController.java b/waimai-admin/src/main/java/com/waimai/api/FoodsApiController.java new file mode 100644 index 0000000..f3e2fef --- /dev/null +++ b/waimai-admin/src/main/java/com/waimai/api/FoodsApiController.java @@ -0,0 +1,40 @@ +package com.waimai.api; + +import com.waimai.common.annotation.Anonymous; +import com.waimai.common.core.controller.BaseController; +import com.waimai.common.core.domain.R; +import com.waimai.web.admin.domain.Food; +import com.waimai.web.admin.service.IFoodService; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; + +import javax.annotation.Resource; +import java.util.List; + +@RestController +@Anonymous +@RequestMapping("/api/food") +public class FoodsApiController { + + @Resource + private IFoodService foodService; + + /** + * 推荐食品 + * + * @return + */ + @RequestMapping("/recommend") + public R> recommend() { + return R.ok(foodService.selectFoodList(new Food())); + } + + @RequestMapping("/category/{cid}") + public R> selectByCategory(@PathVariable("cid") Long cid) { + Food food = new Food(); + food.setCid(cid); + return R.ok(foodService.selectFoodList(food)); + } +} diff --git a/waimai-admin/src/main/java/com/waimai/web/admin/domain/FoodCategory.java b/waimai-admin/src/main/java/com/waimai/web/admin/domain/FoodCategory.java index 4205e57..8ed7d85 100644 --- a/waimai-admin/src/main/java/com/waimai/web/admin/domain/FoodCategory.java +++ b/waimai-admin/src/main/java/com/waimai/web/admin/domain/FoodCategory.java @@ -9,23 +9,27 @@ import com.waimai.common.core.domain.BaseEntity; * 食品分类对象 food_category * * @author callmeyan - * @date 2023-03-24 + * @date 2023-03-31 */ public class FoodCategory extends BaseEntity { private static final long serialVersionUID = 1L; - /** 编号 */ + /** 食品分类编号 */ private Long id; - /** 分类名称 */ - @Excel(name = "分类名称") + /** 分类标题 */ + @Excel(name = "分类标题") private String title; /** 排序 */ @Excel(name = "排序") private Integer sort; + /** 分类图片 */ + @Excel(name = "分类图片") + private String cover; + /** 状态 */ @Excel(name = "状态") private Integer state; @@ -57,6 +61,15 @@ public class FoodCategory extends BaseEntity { return sort; } + public void setCover(String cover) + { + this.cover = cover; + } + + public String getCover() + { + return cover; + } public void setState(Integer state) { this.state = state; @@ -73,6 +86,7 @@ public class FoodCategory extends BaseEntity .append("id", getId()) .append("title", getTitle()) .append("sort", getSort()) + .append("cover", getCover()) .append("createTime", getCreateTime()) .append("updateTime", getUpdateTime()) .append("state", getState()) diff --git a/waimai-admin/src/main/resources/application-druid.yml b/waimai-admin/src/main/resources/application-druid.yml index b754a52..49d6831 100644 --- a/waimai-admin/src/main/resources/application-druid.yml +++ b/waimai-admin/src/main/resources/application-druid.yml @@ -6,9 +6,9 @@ spring: druid: # 主库数据源 master: - url: jdbc:mysql://localhost:3306/waimai_sys?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 + url: jdbc:mysql://localhost:3307/waimai_sys?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 username: root - password: root + password: 123456 # 从库数据源 slave: # 从数据源开关/默认关闭 diff --git a/waimai-admin/src/main/resources/application.yml b/waimai-admin/src/main/resources/application.yml index 8a34241..5179b65 100644 --- a/waimai-admin/src/main/resources/application.yml +++ b/waimai-admin/src/main/resources/application.yml @@ -97,7 +97,7 @@ token: # 令牌密钥 secret: abcdefghijklmnopqrstuvwxyz # 令牌有效期(默认30分钟) - expireTime: 30 + expireTime: 300 # MyBatis配置 mybatis: diff --git a/waimai-admin/src/main/resources/mapper/admin/FoodCategoryMapper.xml b/waimai-admin/src/main/resources/mapper/admin/FoodCategoryMapper.xml index d4a3d88..55bdbc6 100644 --- a/waimai-admin/src/main/resources/mapper/admin/FoodCategoryMapper.xml +++ b/waimai-admin/src/main/resources/mapper/admin/FoodCategoryMapper.xml @@ -8,6 +8,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + @@ -15,13 +16,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - select id, title, sort, create_time, update_time, state, remark from food_category + select id, title, sort, cover, create_time, update_time, state, remark from food_category @@ -35,6 +38,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" title, sort, + cover, create_time, update_time, state, @@ -43,6 +47,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #{title}, #{sort}, + #{cover}, #{createTime}, #{updateTime}, #{state}, @@ -55,6 +60,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" title = #{title}, sort = #{sort}, + cover = #{cover}, create_time = #{createTime}, update_time = #{updateTime}, state = #{state}, diff --git a/waimai-admin/src/main/resources/mapper/admin/FoodMapper.xml b/waimai-admin/src/main/resources/mapper/admin/FoodMapper.xml index cc22ed0..976543b 100644 --- a/waimai-admin/src/main/resources/mapper/admin/FoodMapper.xml +++ b/waimai-admin/src/main/resources/mapper/admin/FoodMapper.xml @@ -32,7 +32,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"