forked from fdzcxy212206220/restaurant
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
112 lines
2.9 KiB
112 lines
2.9 KiB
|
|
package com.controller;
|
|
|
|
|
|
import java.util.Arrays;
|
|
import java.util.Map;
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.web.bind.annotation.PathVariable;
|
|
import org.springframework.web.bind.annotation.PostMapping;
|
|
import org.springframework.web.bind.annotation.RequestBody;
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
import org.springframework.web.bind.annotation.RequestParam;
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
import com.annotation.IgnoreAuth;
|
|
import com.baomidou.mybatisplus.mapper.EntityWrapper;
|
|
import com.entity.ConfigEntity;
|
|
import com.service.ConfigService;
|
|
import com.utils.PageUtils;
|
|
import com.utils.R;
|
|
import com.utils.ValidatorUtils;
|
|
|
|
/**
|
|
* 登录相关
|
|
*/
|
|
@RequestMapping("config")
|
|
@RestController
|
|
public class ConfigController{
|
|
|
|
@Autowired
|
|
private ConfigService configService;
|
|
|
|
/**
|
|
* 列表
|
|
*/
|
|
@RequestMapping("/page")
|
|
public R page(@RequestParam Map<String, Object> params,ConfigEntity config){
|
|
EntityWrapper<ConfigEntity> ew = new EntityWrapper<ConfigEntity>();
|
|
PageUtils page = configService.queryPage(params);
|
|
return R.ok().put("data", page);
|
|
}
|
|
|
|
/**
|
|
* 列表
|
|
*/
|
|
@IgnoreAuth
|
|
@RequestMapping("/list")
|
|
public R list(@RequestParam Map<String, Object> params,ConfigEntity config){
|
|
EntityWrapper<ConfigEntity> ew = new EntityWrapper<ConfigEntity>();
|
|
PageUtils page = configService.queryPage(params);
|
|
return R.ok().put("data", page);
|
|
}
|
|
|
|
/**
|
|
* 信息
|
|
*/
|
|
@RequestMapping("/info/{id}")
|
|
public R info(@PathVariable("id") String id){
|
|
ConfigEntity config = configService.selectById(id);
|
|
return R.ok().put("data", config);
|
|
}
|
|
|
|
/**
|
|
* 详情
|
|
*/
|
|
@IgnoreAuth
|
|
@RequestMapping("/detail/{id}")
|
|
public R detail(@PathVariable("id") String id){
|
|
ConfigEntity config = configService.selectById(id);
|
|
return R.ok().put("data", config);
|
|
}
|
|
|
|
/**
|
|
* 根据name获取信息
|
|
*/
|
|
@RequestMapping("/info")
|
|
public R infoByName(@RequestParam String name){
|
|
ConfigEntity config = configService.selectOne(new EntityWrapper<ConfigEntity>().eq("name", "faceFile"));
|
|
return R.ok().put("data", config);
|
|
}
|
|
|
|
/**
|
|
* 保存
|
|
*/
|
|
@PostMapping("/save")
|
|
public R save(@RequestBody ConfigEntity config){
|
|
// ValidatorUtils.validateEntity(config);
|
|
configService.insert(config);
|
|
return R.ok();
|
|
}
|
|
|
|
/**
|
|
* 修改
|
|
*/
|
|
@RequestMapping("/update")
|
|
public R update(@RequestBody ConfigEntity config){
|
|
// ValidatorUtils.validateEntity(config);
|
|
configService.updateById(config);//全部更新
|
|
return R.ok();
|
|
}
|
|
|
|
/**
|
|
* 删除
|
|
*/
|
|
@RequestMapping("/delete")
|
|
public R delete(@RequestBody Long[] ids){
|
|
configService.deleteBatchIds(Arrays.asList(ids));
|
|
return R.ok();
|
|
}
|
|
}
|