食品管理添加用餐类型字段
This commit is contained in:
parent
4bec2d207f
commit
6bd7ea834f
@ -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<FtFoodDao> 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<FtFoodDao> 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<FtFoodDao> lqw = new LambdaQueryWrapper<FtFoodDao>(ftFoodDao);
|
||||
List<FtFoodDao> list = iFtFoodDaoService.list(lqw);
|
||||
ExcelUtil<FtFoodDao> util = new ExcelUtil<FtFoodDao>(FtFoodDao. class);
|
||||
return util.exportExcel(list, "food" );
|
||||
ExcelUtil<FtFoodDao> util = new ExcelUtil<FtFoodDao>(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);
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -1,16 +1,17 @@
|
||||
<?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">
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.ruoyi.system.fantang.mapper.FtFoodDaoMapper">
|
||||
|
||||
|
||||
<resultMap type="FtFoodDao" id="FtFoodDaoResult">
|
||||
<result property="foodId" column="food_id" />
|
||||
<result property="name" column="name" />
|
||||
<result property="pictureUrl" column="picture_url" />
|
||||
<result property="price" column="price" />
|
||||
<result property="flag" column="flag" />
|
||||
<result property="type" column="type" />
|
||||
<result property="foodId" column="food_id"/>
|
||||
<result property="name" column="name"/>
|
||||
<result property="pictureUrl" column="picture_url"/>
|
||||
<result property="price" column="price"/>
|
||||
<result property="flag" column="flag"/>
|
||||
<result property="type" column="type"/>
|
||||
<result property="dinnerType" column="dinner_type"/>
|
||||
</resultMap>
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user