食品管理添加用餐类型字段
This commit is contained in:
parent
4bec2d207f
commit
6bd7ea834f
@ -1,41 +1,33 @@
|
|||||||
package com.ruoyi.system.fantang.controller;
|
package com.ruoyi.system.fantang.controller;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
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.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.annotation.Log;
|
||||||
import com.ruoyi.common.core.controller.BaseController;
|
import com.ruoyi.common.core.controller.BaseController;
|
||||||
import com.ruoyi.common.core.domain.AjaxResult;
|
import com.ruoyi.common.core.domain.AjaxResult;
|
||||||
|
import com.ruoyi.common.core.page.TableDataInfo;
|
||||||
import com.ruoyi.common.enums.BusinessType;
|
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.domain.FtFoodDao;
|
||||||
import com.ruoyi.system.fantang.service.IFtFoodDaoService;
|
import com.ruoyi.system.fantang.service.IFtFoodDaoService;
|
||||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
import lombok.RequiredArgsConstructor;
|
||||||
import com.ruoyi.common.core.page.TableDataInfo;
|
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
|
* 食品管理Controller
|
||||||
*
|
*
|
||||||
* @author ft
|
* @author ft
|
||||||
* @date 2020-11-24
|
* @date 2020-11-24
|
||||||
*/
|
*/
|
||||||
@RequiredArgsConstructor(onConstructor_ = @Autowired)
|
@RequiredArgsConstructor(onConstructor_ = @Autowired)
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/fantang/food" )
|
@RequestMapping("/fantang/food")
|
||||||
public class FtFoodDaoController extends BaseController {
|
public class FtFoodDaoController extends BaseController {
|
||||||
|
|
||||||
private final IFtFoodDaoService iFtFoodDaoService;
|
private final IFtFoodDaoService iFtFoodDaoService;
|
||||||
@ -45,18 +37,17 @@ public class FtFoodDaoController extends BaseController {
|
|||||||
*/
|
*/
|
||||||
@PreAuthorize("@ss.hasPermi('fantang:food:list')")
|
@PreAuthorize("@ss.hasPermi('fantang:food:list')")
|
||||||
@GetMapping("/list")
|
@GetMapping("/list")
|
||||||
public TableDataInfo list(FtFoodDao ftFoodDao)
|
public TableDataInfo list(FtFoodDao ftFoodDao) {
|
||||||
{
|
|
||||||
startPage();
|
startPage();
|
||||||
LambdaQueryWrapper<FtFoodDao> lqw = Wrappers.lambdaQuery(ftFoodDao);
|
LambdaQueryWrapper<FtFoodDao> lqw = Wrappers.lambdaQuery(ftFoodDao);
|
||||||
if (StringUtils.isNotBlank(ftFoodDao.getName())){
|
if (StringUtils.isNotBlank(ftFoodDao.getName())) {
|
||||||
lqw.like(FtFoodDao::getName ,ftFoodDao.getName());
|
lqw.like(FtFoodDao::getName, ftFoodDao.getName());
|
||||||
}
|
}
|
||||||
if (ftFoodDao.getPrice() != null){
|
if (ftFoodDao.getPrice() != null) {
|
||||||
lqw.eq(FtFoodDao::getPrice ,ftFoodDao.getPrice());
|
lqw.eq(FtFoodDao::getPrice, ftFoodDao.getPrice());
|
||||||
}
|
}
|
||||||
if (ftFoodDao.getType() != null){
|
if (ftFoodDao.getType() != null) {
|
||||||
lqw.eq(FtFoodDao::getType ,ftFoodDao.getType());
|
lqw.eq(FtFoodDao::getType, ftFoodDao.getType());
|
||||||
}
|
}
|
||||||
List<FtFoodDao> list = iFtFoodDaoService.list(lqw);
|
List<FtFoodDao> list = iFtFoodDaoService.list(lqw);
|
||||||
return getDataTable(list);
|
return getDataTable(list);
|
||||||
@ -65,30 +56,30 @@ public class FtFoodDaoController extends BaseController {
|
|||||||
/**
|
/**
|
||||||
* 导出食品管理列表
|
* 导出食品管理列表
|
||||||
*/
|
*/
|
||||||
@PreAuthorize("@ss.hasPermi('fantang:food:export')" )
|
@PreAuthorize("@ss.hasPermi('fantang:food:export')")
|
||||||
@Log(title = "食品管理" , businessType = BusinessType.EXPORT)
|
@Log(title = "食品管理", businessType = BusinessType.EXPORT)
|
||||||
@GetMapping("/export" )
|
@GetMapping("/export")
|
||||||
public AjaxResult export(FtFoodDao ftFoodDao) {
|
public AjaxResult export(FtFoodDao ftFoodDao) {
|
||||||
LambdaQueryWrapper<FtFoodDao> lqw = new LambdaQueryWrapper<FtFoodDao>(ftFoodDao);
|
LambdaQueryWrapper<FtFoodDao> lqw = new LambdaQueryWrapper<FtFoodDao>(ftFoodDao);
|
||||||
List<FtFoodDao> list = iFtFoodDaoService.list(lqw);
|
List<FtFoodDao> list = iFtFoodDaoService.list(lqw);
|
||||||
ExcelUtil<FtFoodDao> util = new ExcelUtil<FtFoodDao>(FtFoodDao. class);
|
ExcelUtil<FtFoodDao> util = new ExcelUtil<FtFoodDao>(FtFoodDao.class);
|
||||||
return util.exportExcel(list, "food" );
|
return util.exportExcel(list, "food");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取食品管理详细信息
|
* 获取食品管理详细信息
|
||||||
*/
|
*/
|
||||||
@PreAuthorize("@ss.hasPermi('fantang:food:query')" )
|
@PreAuthorize("@ss.hasPermi('fantang:food:query')")
|
||||||
@GetMapping(value = "/{foodId}" )
|
@GetMapping(value = "/{foodId}")
|
||||||
public AjaxResult getInfo(@PathVariable("foodId" ) Long foodId) {
|
public AjaxResult getInfo(@PathVariable("foodId") Long foodId) {
|
||||||
return AjaxResult.success(iFtFoodDaoService.getById(foodId));
|
return AjaxResult.success(iFtFoodDaoService.getById(foodId));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增食品管理
|
* 新增食品管理
|
||||||
*/
|
*/
|
||||||
@PreAuthorize("@ss.hasPermi('fantang:food:add')" )
|
@PreAuthorize("@ss.hasPermi('fantang:food:add')")
|
||||||
@Log(title = "食品管理" , businessType = BusinessType.INSERT)
|
@Log(title = "食品管理", businessType = BusinessType.INSERT)
|
||||||
@PostMapping
|
@PostMapping
|
||||||
public AjaxResult add(@RequestBody FtFoodDao ftFoodDao) {
|
public AjaxResult add(@RequestBody FtFoodDao ftFoodDao) {
|
||||||
return toAjax(iFtFoodDaoService.save(ftFoodDao) ? 1 : 0);
|
return toAjax(iFtFoodDaoService.save(ftFoodDao) ? 1 : 0);
|
||||||
@ -97,8 +88,8 @@ public class FtFoodDaoController extends BaseController {
|
|||||||
/**
|
/**
|
||||||
* 修改食品管理
|
* 修改食品管理
|
||||||
*/
|
*/
|
||||||
@PreAuthorize("@ss.hasPermi('fantang:food:edit')" )
|
@PreAuthorize("@ss.hasPermi('fantang:food:edit')")
|
||||||
@Log(title = "食品管理" , businessType = BusinessType.UPDATE)
|
@Log(title = "食品管理", businessType = BusinessType.UPDATE)
|
||||||
@PutMapping
|
@PutMapping
|
||||||
public AjaxResult edit(@RequestBody FtFoodDao ftFoodDao) {
|
public AjaxResult edit(@RequestBody FtFoodDao ftFoodDao) {
|
||||||
return toAjax(iFtFoodDaoService.updateById(ftFoodDao) ? 1 : 0);
|
return toAjax(iFtFoodDaoService.updateById(ftFoodDao) ? 1 : 0);
|
||||||
@ -107,9 +98,9 @@ public class FtFoodDaoController extends BaseController {
|
|||||||
/**
|
/**
|
||||||
* 删除食品管理
|
* 删除食品管理
|
||||||
*/
|
*/
|
||||||
@PreAuthorize("@ss.hasPermi('fantang:food:remove')" )
|
@PreAuthorize("@ss.hasPermi('fantang:food:remove')")
|
||||||
@Log(title = "食品管理" , businessType = BusinessType.DELETE)
|
@Log(title = "食品管理", businessType = BusinessType.DELETE)
|
||||||
@DeleteMapping("/{foodIds}" )
|
@DeleteMapping("/{foodIds}")
|
||||||
public AjaxResult remove(@PathVariable Long[] foodIds) {
|
public AjaxResult remove(@PathVariable Long[] foodIds) {
|
||||||
return toAjax(iFtFoodDaoService.removeByIds(Arrays.asList(foodIds)) ? 1 : 0);
|
return toAjax(iFtFoodDaoService.removeByIds(Arrays.asList(foodIds)) ? 1 : 0);
|
||||||
}
|
}
|
||||||
|
@ -1,23 +1,20 @@
|
|||||||
package com.ruoyi.system.fantang.domain;
|
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.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
import lombok.ToString;
|
import lombok.ToString;
|
||||||
import lombok.experimental.Accessors;
|
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.io.Serializable;
|
||||||
import java.util.Date;
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import com.ruoyi.common.core.domain.BaseEntity;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 食品管理对象 ft_food
|
* 食品管理对象 ft_food
|
||||||
*
|
*
|
||||||
* @author ft
|
* @author ft
|
||||||
* @date 2020-11-24
|
* @date 2020-11-24
|
||||||
*/
|
*/
|
||||||
@ -29,28 +26,45 @@ import com.ruoyi.common.core.domain.BaseEntity;
|
|||||||
@TableName("ft_food")
|
@TableName("ft_food")
|
||||||
public class FtFoodDao implements Serializable {
|
public class FtFoodDao implements Serializable {
|
||||||
|
|
||||||
private static final long serialVersionUID=1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
|
||||||
/** 食品id */
|
/**
|
||||||
|
* 食品id
|
||||||
|
*/
|
||||||
@TableId(value = "food_id")
|
@TableId(value = "food_id")
|
||||||
private Long foodId;
|
private Long foodId;
|
||||||
|
|
||||||
/** 名称 */
|
/**
|
||||||
|
* 名称
|
||||||
|
*/
|
||||||
@Excel(name = "名称")
|
@Excel(name = "名称")
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
/** 图片 */
|
/**
|
||||||
|
* 图片
|
||||||
|
*/
|
||||||
private String pictureUrl;
|
private String pictureUrl;
|
||||||
|
|
||||||
/** 售价 */
|
/**
|
||||||
|
* 售价
|
||||||
|
*/
|
||||||
@Excel(name = "售价")
|
@Excel(name = "售价")
|
||||||
private BigDecimal price;
|
private BigDecimal price;
|
||||||
|
|
||||||
/** 启用标志 */
|
/**
|
||||||
|
* 启用标志
|
||||||
|
*/
|
||||||
private Long flag;
|
private Long flag;
|
||||||
|
|
||||||
/** 食品分类 */
|
/**
|
||||||
|
* 食品分类
|
||||||
|
*/
|
||||||
@Excel(name = "食品分类")
|
@Excel(name = "食品分类")
|
||||||
private Long type;
|
private Long type;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用餐类型
|
||||||
|
*/
|
||||||
|
private Integer dinnerType;
|
||||||
}
|
}
|
||||||
|
@ -1,16 +1,17 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8" ?>
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
<!DOCTYPE mapper
|
<!DOCTYPE mapper
|
||||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
<mapper namespace="com.ruoyi.system.fantang.mapper.FtFoodDaoMapper">
|
<mapper namespace="com.ruoyi.system.fantang.mapper.FtFoodDaoMapper">
|
||||||
|
|
||||||
<resultMap type="FtFoodDao" id="FtFoodDaoResult">
|
<resultMap type="FtFoodDao" id="FtFoodDaoResult">
|
||||||
<result property="foodId" column="food_id" />
|
<result property="foodId" column="food_id"/>
|
||||||
<result property="name" column="name" />
|
<result property="name" column="name"/>
|
||||||
<result property="pictureUrl" column="picture_url" />
|
<result property="pictureUrl" column="picture_url"/>
|
||||||
<result property="price" column="price" />
|
<result property="price" column="price"/>
|
||||||
<result property="flag" column="flag" />
|
<result property="flag" column="flag"/>
|
||||||
<result property="type" column="type" />
|
<result property="type" column="type"/>
|
||||||
|
<result property="dinnerType" column="dinner_type"/>
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user