From 6bd7ea834f034e130831c4803024c8265fdc5cb4 Mon Sep 17 00:00:00 2001 From: ryoeiken <754264374@qq.com> Date: Mon, 4 Jan 2021 17:27:03 +0800 Subject: [PATCH] =?UTF-8?q?=E9=A3=9F=E5=93=81=E7=AE=A1=E7=90=86=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=E7=94=A8=E9=A4=90=E7=B1=BB=E5=9E=8B=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/FtFoodDaoController.java | 77 ++++++++----------- .../system/fantang/domain/FtFoodDao.java | 44 +++++++---- .../mapper/fantang/FtFoodDaoMapper.xml | 19 ++--- 3 files changed, 73 insertions(+), 67 deletions(-) diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/fantang/controller/FtFoodDaoController.java b/ruoyi-system/src/main/java/com/ruoyi/system/fantang/controller/FtFoodDaoController.java index 736246ea7..4a9a2199a 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/fantang/controller/FtFoodDaoController.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/fantang/controller/FtFoodDaoController.java @@ -1,41 +1,33 @@ package com.ruoyi.system.fantang.controller; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; - -import java.util.List; -import java.util.Arrays; - import com.baomidou.mybatisplus.core.toolkit.Wrappers; -import com.ruoyi.common.utils.StringUtils; -import lombok.RequiredArgsConstructor; -import org.springframework.security.access.prepost.PreAuthorize; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.PutMapping; -import org.springframework.web.bind.annotation.DeleteMapping; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; import com.ruoyi.common.annotation.Log; import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.core.page.TableDataInfo; import com.ruoyi.common.enums.BusinessType; +import com.ruoyi.common.utils.StringUtils; +import com.ruoyi.common.utils.poi.ExcelUtil; import com.ruoyi.system.fantang.domain.FtFoodDao; import com.ruoyi.system.fantang.service.IFtFoodDaoService; -import com.ruoyi.common.utils.poi.ExcelUtil; -import com.ruoyi.common.core.page.TableDataInfo; +import lombok.RequiredArgsConstructor; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import java.util.Arrays; +import java.util.List; /** * 食品管理Controller - * + * * @author ft * @date 2020-11-24 */ @RequiredArgsConstructor(onConstructor_ = @Autowired) @RestController -@RequestMapping("/fantang/food" ) +@RequestMapping("/fantang/food") public class FtFoodDaoController extends BaseController { private final IFtFoodDaoService iFtFoodDaoService; @@ -45,18 +37,17 @@ public class FtFoodDaoController extends BaseController { */ @PreAuthorize("@ss.hasPermi('fantang:food:list')") @GetMapping("/list") - public TableDataInfo list(FtFoodDao ftFoodDao) - { + public TableDataInfo list(FtFoodDao ftFoodDao) { startPage(); LambdaQueryWrapper lqw = Wrappers.lambdaQuery(ftFoodDao); - if (StringUtils.isNotBlank(ftFoodDao.getName())){ - lqw.like(FtFoodDao::getName ,ftFoodDao.getName()); + if (StringUtils.isNotBlank(ftFoodDao.getName())) { + lqw.like(FtFoodDao::getName, ftFoodDao.getName()); } - if (ftFoodDao.getPrice() != null){ - lqw.eq(FtFoodDao::getPrice ,ftFoodDao.getPrice()); + if (ftFoodDao.getPrice() != null) { + lqw.eq(FtFoodDao::getPrice, ftFoodDao.getPrice()); } - if (ftFoodDao.getType() != null){ - lqw.eq(FtFoodDao::getType ,ftFoodDao.getType()); + if (ftFoodDao.getType() != null) { + lqw.eq(FtFoodDao::getType, ftFoodDao.getType()); } List list = iFtFoodDaoService.list(lqw); return getDataTable(list); @@ -65,30 +56,30 @@ public class FtFoodDaoController extends BaseController { /** * 导出食品管理列表 */ - @PreAuthorize("@ss.hasPermi('fantang:food:export')" ) - @Log(title = "食品管理" , businessType = BusinessType.EXPORT) - @GetMapping("/export" ) + @PreAuthorize("@ss.hasPermi('fantang:food:export')") + @Log(title = "食品管理", businessType = BusinessType.EXPORT) + @GetMapping("/export") public AjaxResult export(FtFoodDao ftFoodDao) { LambdaQueryWrapper lqw = new LambdaQueryWrapper(ftFoodDao); List list = iFtFoodDaoService.list(lqw); - ExcelUtil util = new ExcelUtil(FtFoodDao. class); - return util.exportExcel(list, "food" ); + ExcelUtil util = new ExcelUtil(FtFoodDao.class); + return util.exportExcel(list, "food"); } /** * 获取食品管理详细信息 */ - @PreAuthorize("@ss.hasPermi('fantang:food:query')" ) - @GetMapping(value = "/{foodId}" ) - public AjaxResult getInfo(@PathVariable("foodId" ) Long foodId) { + @PreAuthorize("@ss.hasPermi('fantang:food:query')") + @GetMapping(value = "/{foodId}") + public AjaxResult getInfo(@PathVariable("foodId") Long foodId) { return AjaxResult.success(iFtFoodDaoService.getById(foodId)); } /** * 新增食品管理 */ - @PreAuthorize("@ss.hasPermi('fantang:food:add')" ) - @Log(title = "食品管理" , businessType = BusinessType.INSERT) + @PreAuthorize("@ss.hasPermi('fantang:food:add')") + @Log(title = "食品管理", businessType = BusinessType.INSERT) @PostMapping public AjaxResult add(@RequestBody FtFoodDao ftFoodDao) { return toAjax(iFtFoodDaoService.save(ftFoodDao) ? 1 : 0); @@ -97,8 +88,8 @@ public class FtFoodDaoController extends BaseController { /** * 修改食品管理 */ - @PreAuthorize("@ss.hasPermi('fantang:food:edit')" ) - @Log(title = "食品管理" , businessType = BusinessType.UPDATE) + @PreAuthorize("@ss.hasPermi('fantang:food:edit')") + @Log(title = "食品管理", businessType = BusinessType.UPDATE) @PutMapping public AjaxResult edit(@RequestBody FtFoodDao ftFoodDao) { return toAjax(iFtFoodDaoService.updateById(ftFoodDao) ? 1 : 0); @@ -107,9 +98,9 @@ public class FtFoodDaoController extends BaseController { /** * 删除食品管理 */ - @PreAuthorize("@ss.hasPermi('fantang:food:remove')" ) - @Log(title = "食品管理" , businessType = BusinessType.DELETE) - @DeleteMapping("/{foodIds}" ) + @PreAuthorize("@ss.hasPermi('fantang:food:remove')") + @Log(title = "食品管理", businessType = BusinessType.DELETE) + @DeleteMapping("/{foodIds}") public AjaxResult remove(@PathVariable Long[] foodIds) { return toAjax(iFtFoodDaoService.removeByIds(Arrays.asList(foodIds)) ? 1 : 0); } diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/fantang/domain/FtFoodDao.java b/ruoyi-system/src/main/java/com/ruoyi/system/fantang/domain/FtFoodDao.java index a50d90f31..4ad660f59 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/fantang/domain/FtFoodDao.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/fantang/domain/FtFoodDao.java @@ -1,23 +1,20 @@ package com.ruoyi.system.fantang.domain; -import com.fasterxml.jackson.annotation.JsonFormat; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.ruoyi.common.annotation.Excel; import lombok.Data; import lombok.EqualsAndHashCode; import lombok.NoArgsConstructor; import lombok.ToString; import lombok.experimental.Accessors; -import com.ruoyi.common.annotation.Excel; -import com.baomidou.mybatisplus.annotation.TableId; -import com.baomidou.mybatisplus.annotation.TableName; -import com.baomidou.mybatisplus.annotation.IdType; + import java.io.Serializable; -import java.util.Date; import java.math.BigDecimal; -import com.ruoyi.common.core.domain.BaseEntity; /** * 食品管理对象 ft_food - * + * * @author ft * @date 2020-11-24 */ @@ -29,28 +26,45 @@ import com.ruoyi.common.core.domain.BaseEntity; @TableName("ft_food") public class FtFoodDao implements Serializable { -private static final long serialVersionUID=1L; + private static final long serialVersionUID = 1L; - /** 食品id */ + /** + * 食品id + */ @TableId(value = "food_id") private Long foodId; - /** 名称 */ + /** + * 名称 + */ @Excel(name = "名称") private String name; - /** 图片 */ + /** + * 图片 + */ private String pictureUrl; - /** 售价 */ + /** + * 售价 + */ @Excel(name = "售价") private BigDecimal price; - /** 启用标志 */ + /** + * 启用标志 + */ private Long flag; - /** 食品分类 */ + /** + * 食品分类 + */ @Excel(name = "食品分类") private Long type; + + /** + * 用餐类型 + */ + private Integer dinnerType; } diff --git a/ruoyi-system/src/main/resources/mapper/fantang/FtFoodDaoMapper.xml b/ruoyi-system/src/main/resources/mapper/fantang/FtFoodDaoMapper.xml index 28da078e9..62e6c8fa4 100644 --- a/ruoyi-system/src/main/resources/mapper/fantang/FtFoodDaoMapper.xml +++ b/ruoyi-system/src/main/resources/mapper/fantang/FtFoodDaoMapper.xml @@ -1,16 +1,17 @@ + PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> - + - - - - - - + + + + + + +