实现案件列表展示
7
pom.xml
|
@ -80,6 +80,13 @@
|
|||
<version>1.1.23</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.github.yulichang</groupId>
|
||||
<artifactId>mybatis-plus-join-boot-starter</artifactId>
|
||||
<version>1.4.7.2</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
|
|
@ -1,103 +0,0 @@
|
|||
package com.JIAL.FMSystem.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.JIAL.FMSystem.common.BaseContext;
|
||||
import com.JIAL.FMSystem.common.R;
|
||||
import com.JIAL.FMSystem.entity.AddressBook;
|
||||
import com.JIAL.FMSystem.service.AddressBookService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 地址簿管理
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/addressBook")
|
||||
public class AddressBookController {
|
||||
|
||||
@Autowired
|
||||
private AddressBookService addressBookService;
|
||||
|
||||
/**
|
||||
* 新增
|
||||
*/
|
||||
@PostMapping
|
||||
public R<AddressBook> save(@RequestBody AddressBook addressBook) {
|
||||
addressBook.setUserId(BaseContext.getCurrentId());
|
||||
log.info("addressBook:{}", addressBook);
|
||||
addressBookService.save(addressBook);
|
||||
return R.success(addressBook);
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置默认地址
|
||||
*/
|
||||
@PutMapping("default")
|
||||
public R<AddressBook> setDefault(@RequestBody AddressBook addressBook) {
|
||||
log.info("addressBook:{}", addressBook);
|
||||
LambdaUpdateWrapper<AddressBook> wrapper = new LambdaUpdateWrapper<>();
|
||||
wrapper.eq(AddressBook::getUserId, BaseContext.getCurrentId());
|
||||
wrapper.set(AddressBook::getIsDefault, 0);
|
||||
//SQL:update address_book set is_default = 0 where user_id = ?
|
||||
addressBookService.update(wrapper);
|
||||
|
||||
addressBook.setIsDefault(1);
|
||||
//SQL:update address_book set is_default = 1 where id = ?
|
||||
addressBookService.updateById(addressBook);
|
||||
return R.success(addressBook);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据id查询地址
|
||||
*/
|
||||
@GetMapping("/{id}")
|
||||
public R get(@PathVariable Long id) {
|
||||
AddressBook addressBook = addressBookService.getById(id);
|
||||
if (addressBook != null) {
|
||||
return R.success(addressBook);
|
||||
} else {
|
||||
return R.error("没有找到该对象");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询默认地址
|
||||
*/
|
||||
@GetMapping("default")
|
||||
public R<AddressBook> getDefault() {
|
||||
LambdaQueryWrapper<AddressBook> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(AddressBook::getUserId, BaseContext.getCurrentId());
|
||||
queryWrapper.eq(AddressBook::getIsDefault, 1);
|
||||
|
||||
//SQL:select * from address_book where user_id = ? and is_default = 1
|
||||
AddressBook addressBook = addressBookService.getOne(queryWrapper);
|
||||
|
||||
if (null == addressBook) {
|
||||
return R.error("没有找到该对象");
|
||||
} else {
|
||||
return R.success(addressBook);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询指定用户的全部地址
|
||||
*/
|
||||
@GetMapping("/list")
|
||||
public R<List<AddressBook>> list(AddressBook addressBook) {
|
||||
addressBook.setUserId(BaseContext.getCurrentId());
|
||||
log.info("addressBook:{}", addressBook);
|
||||
|
||||
//条件构造器
|
||||
LambdaQueryWrapper<AddressBook> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(null != addressBook.getUserId(), AddressBook::getUserId, addressBook.getUserId());
|
||||
queryWrapper.orderByDesc(AddressBook::getUpdateTime);
|
||||
|
||||
//SQL:select * from address_book where user_id = ? order by update_time desc
|
||||
return R.success(addressBookService.list(queryWrapper));
|
||||
}
|
||||
}
|
|
@ -1,102 +0,0 @@
|
|||
package com.JIAL.FMSystem.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.JIAL.FMSystem.common.R;
|
||||
import com.JIAL.FMSystem.entity.Category;
|
||||
import com.JIAL.FMSystem.service.CategoryService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 分类管理
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/category")
|
||||
@Slf4j
|
||||
public class CategoryController {
|
||||
@Autowired
|
||||
private CategoryService categoryService;
|
||||
|
||||
/**
|
||||
* 新增分类
|
||||
* @param category
|
||||
* @return
|
||||
*/
|
||||
@PostMapping
|
||||
public R<String> save(@RequestBody Category category){
|
||||
log.info("category:{}",category);
|
||||
categoryService.save(category);
|
||||
return R.success("新增分类成功");
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
* @param page
|
||||
* @param pageSize
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/page")
|
||||
public R<Page> page(int page,int pageSize){
|
||||
//分页构造器
|
||||
Page<Category> pageInfo = new Page<>(page,pageSize);
|
||||
//条件构造器
|
||||
LambdaQueryWrapper<Category> queryWrapper = new LambdaQueryWrapper<>();
|
||||
//添加排序条件,根据sort进行排序
|
||||
queryWrapper.orderByAsc(Category::getSort);
|
||||
|
||||
//分页查询
|
||||
categoryService.page(pageInfo,queryWrapper);
|
||||
return R.success(pageInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据id删除分类
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@DeleteMapping
|
||||
public R<String> delete(Long id){
|
||||
log.info("删除分类,id为:{}",id);
|
||||
|
||||
//categoryService.removeById(id);
|
||||
categoryService.remove(id);
|
||||
|
||||
return R.success("分类信息删除成功");
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据id修改分类信息
|
||||
* @param category
|
||||
* @return
|
||||
*/
|
||||
@PutMapping
|
||||
public R<String> update(@RequestBody Category category){
|
||||
log.info("修改分类信息:{}",category);
|
||||
|
||||
categoryService.updateById(category);
|
||||
|
||||
return R.success("修改分类信息成功");
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据条件查询分类数据
|
||||
* @param category
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/list")
|
||||
public R<List<Category>> list(Category category){
|
||||
//条件构造器
|
||||
LambdaQueryWrapper<Category> queryWrapper = new LambdaQueryWrapper<>();
|
||||
//添加条件
|
||||
queryWrapper.eq(category.getType() != null,Category::getType,category.getType());
|
||||
//添加排序条件
|
||||
queryWrapper.orderByAsc(Category::getSort).orderByDesc(Category::getUpdateTime);
|
||||
|
||||
List<Category> list = categoryService.list(queryWrapper);
|
||||
return R.success(list);
|
||||
}
|
||||
}
|
|
@ -1,93 +0,0 @@
|
|||
package com.JIAL.FMSystem.controller;
|
||||
|
||||
import com.JIAL.FMSystem.common.R;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.servlet.ServletOutputStream;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* 文件上传和下载
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/common")
|
||||
@Slf4j
|
||||
public class CommonController {
|
||||
|
||||
@Value("${reggie.path}")
|
||||
private String basePath;
|
||||
|
||||
/**
|
||||
* 文件上传
|
||||
* @param file
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/upload")
|
||||
public R<String> upload(MultipartFile file){
|
||||
//file是一个临时文件,需要转存到指定位置,否则本次请求完成后临时文件会删除
|
||||
log.info(file.toString());
|
||||
|
||||
//原始文件名
|
||||
String originalFilename = file.getOriginalFilename();//abc.jpg
|
||||
String suffix = originalFilename.substring(originalFilename.lastIndexOf("."));
|
||||
|
||||
//使用UUID重新生成文件名,防止文件名称重复造成文件覆盖
|
||||
String fileName = UUID.randomUUID().toString() + suffix;//dfsdfdfd.jpg
|
||||
|
||||
//创建一个目录对象
|
||||
File dir = new File(basePath);
|
||||
//判断当前目录是否存在
|
||||
if(!dir.exists()){
|
||||
//目录不存在,需要创建
|
||||
dir.mkdirs();
|
||||
}
|
||||
|
||||
try {
|
||||
//将临时文件转存到指定位置
|
||||
file.transferTo(new File(basePath + fileName));
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return R.success(fileName);
|
||||
}
|
||||
|
||||
/**
|
||||
* 文件下载
|
||||
* @param name
|
||||
* @param response
|
||||
*/
|
||||
@GetMapping("/download")
|
||||
public void download(String name, HttpServletResponse response){
|
||||
|
||||
try {
|
||||
//输入流,通过输入流读取文件内容
|
||||
FileInputStream fileInputStream = new FileInputStream(new File(basePath + name));
|
||||
|
||||
//输出流,通过输出流将文件写回浏览器
|
||||
ServletOutputStream outputStream = response.getOutputStream();
|
||||
|
||||
response.setContentType("image/jpeg");
|
||||
|
||||
int len = 0;
|
||||
byte[] bytes = new byte[1024];
|
||||
while ((len = fileInputStream.read(bytes)) != -1){
|
||||
outputStream.write(bytes,0,len);
|
||||
outputStream.flush();
|
||||
}
|
||||
|
||||
//关闭资源
|
||||
outputStream.close();
|
||||
fileInputStream.close();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -1,189 +0,0 @@
|
|||
package com.JIAL.FMSystem.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.JIAL.FMSystem.common.R;
|
||||
import com.JIAL.FMSystem.dto.DishDto;
|
||||
import com.JIAL.FMSystem.entity.Category;
|
||||
import com.JIAL.FMSystem.entity.Dish;
|
||||
import com.JIAL.FMSystem.entity.DishFlavor;
|
||||
import com.JIAL.FMSystem.service.CategoryService;
|
||||
import com.JIAL.FMSystem.service.DishFlavorService;
|
||||
import com.JIAL.FMSystem.service.DishService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 菜品管理
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/dish")
|
||||
@Slf4j
|
||||
public class DishController {
|
||||
@Autowired
|
||||
private DishService dishService;
|
||||
|
||||
@Autowired
|
||||
private DishFlavorService dishFlavorService;
|
||||
|
||||
@Autowired
|
||||
private CategoryService categoryService;
|
||||
|
||||
/**
|
||||
* 新增菜品
|
||||
* @param dishDto
|
||||
* @return
|
||||
*/
|
||||
@PostMapping
|
||||
public R<String> save(@RequestBody DishDto dishDto){
|
||||
log.info(dishDto.toString());
|
||||
|
||||
dishService.saveWithFlavor(dishDto);
|
||||
|
||||
return R.success("新增菜品成功");
|
||||
}
|
||||
|
||||
/**
|
||||
* 菜品信息分页查询
|
||||
* @param page
|
||||
* @param pageSize
|
||||
* @param name
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/page")
|
||||
public R<Page> page(int page,int pageSize,String name){
|
||||
|
||||
//构造分页构造器对象
|
||||
Page<Dish> pageInfo = new Page<>(page,pageSize);
|
||||
Page<DishDto> dishDtoPage = new Page<>();
|
||||
|
||||
//条件构造器
|
||||
LambdaQueryWrapper<Dish> queryWrapper = new LambdaQueryWrapper<>();
|
||||
//添加过滤条件
|
||||
queryWrapper.like(name != null,Dish::getName,name);
|
||||
//添加排序条件
|
||||
queryWrapper.orderByDesc(Dish::getUpdateTime);
|
||||
|
||||
//执行分页查询
|
||||
dishService.page(pageInfo,queryWrapper);
|
||||
|
||||
//对象拷贝
|
||||
BeanUtils.copyProperties(pageInfo,dishDtoPage,"records");
|
||||
|
||||
List<Dish> records = pageInfo.getRecords();
|
||||
|
||||
List<DishDto> list = records.stream().map((item) -> {
|
||||
DishDto dishDto = new DishDto();
|
||||
|
||||
BeanUtils.copyProperties(item,dishDto);
|
||||
|
||||
Long categoryId = item.getCategoryId();//分类id
|
||||
//根据id查询分类对象
|
||||
Category category = categoryService.getById(categoryId);
|
||||
|
||||
if(category != null){
|
||||
String categoryName = category.getName();
|
||||
dishDto.setCategoryName(categoryName);
|
||||
}
|
||||
return dishDto;
|
||||
}).collect(Collectors.toList());
|
||||
|
||||
dishDtoPage.setRecords(list);
|
||||
|
||||
return R.success(dishDtoPage);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据id查询菜品信息和对应的口味信息
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/{id}")
|
||||
public R<DishDto> get(@PathVariable Long id){
|
||||
|
||||
DishDto dishDto = dishService.getByIdWithFlavor(id);
|
||||
|
||||
return R.success(dishDto);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改菜品
|
||||
* @param dishDto
|
||||
* @return
|
||||
*/
|
||||
@PutMapping
|
||||
public R<String> update(@RequestBody DishDto dishDto){
|
||||
log.info(dishDto.toString());
|
||||
|
||||
dishService.updateWithFlavor(dishDto);
|
||||
|
||||
return R.success("修改菜品成功");
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据条件查询对应的菜品数据
|
||||
* @param dish
|
||||
* @return
|
||||
*/
|
||||
/*@GetMapping("/list")
|
||||
public R<List<Dish>> list(Dish dish){
|
||||
//构造查询条件
|
||||
LambdaQueryWrapper<Dish> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(dish.getCategoryId() != null ,Dish::getCategoryId,dish.getCategoryId());
|
||||
//添加条件,查询状态为1(起售状态)的菜品
|
||||
queryWrapper.eq(Dish::getStatus,1);
|
||||
|
||||
//添加排序条件
|
||||
queryWrapper.orderByAsc(Dish::getSort).orderByDesc(Dish::getUpdateTime);
|
||||
|
||||
List<Dish> list = dishService.list(queryWrapper);
|
||||
|
||||
return R.success(list);
|
||||
}*/
|
||||
|
||||
@GetMapping("/list")
|
||||
public R<List<DishDto>> list(Dish dish){
|
||||
//构造查询条件
|
||||
LambdaQueryWrapper<Dish> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(dish.getCategoryId() != null ,Dish::getCategoryId,dish.getCategoryId());
|
||||
//添加条件,查询状态为1(起售状态)的菜品
|
||||
queryWrapper.eq(Dish::getStatus,1);
|
||||
|
||||
//添加排序条件
|
||||
queryWrapper.orderByAsc(Dish::getSort).orderByDesc(Dish::getUpdateTime);
|
||||
|
||||
List<Dish> list = dishService.list(queryWrapper);
|
||||
|
||||
List<DishDto> dishDtoList = list.stream().map((item) -> {
|
||||
DishDto dishDto = new DishDto();
|
||||
|
||||
BeanUtils.copyProperties(item,dishDto);
|
||||
|
||||
Long categoryId = item.getCategoryId();//分类id
|
||||
//根据id查询分类对象
|
||||
Category category = categoryService.getById(categoryId);
|
||||
|
||||
if(category != null){
|
||||
String categoryName = category.getName();
|
||||
dishDto.setCategoryName(categoryName);
|
||||
}
|
||||
|
||||
//当前菜品的id
|
||||
Long dishId = item.getId();
|
||||
LambdaQueryWrapper<DishFlavor> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.eq(DishFlavor::getDishId,dishId);
|
||||
//SQL:select * from dish_flavor where dish_id = ?
|
||||
List<DishFlavor> dishFlavorList = dishFlavorService.list(lambdaQueryWrapper);
|
||||
dishDto.setFlavors(dishFlavorList);
|
||||
return dishDto;
|
||||
}).collect(Collectors.toList());
|
||||
|
||||
return R.success(dishDtoList);
|
||||
}
|
||||
|
||||
}
|
|
@ -1,160 +0,0 @@
|
|||
package com.JIAL.FMSystem.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.JIAL.FMSystem.common.R;
|
||||
import com.JIAL.FMSystem.entity.Employee;
|
||||
import com.JIAL.FMSystem.service.EmployeeService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.util.DigestUtils;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/employee")
|
||||
public class EmployeeController {
|
||||
|
||||
@Autowired
|
||||
private EmployeeService employeeService;
|
||||
|
||||
/**
|
||||
* 员工登录
|
||||
* @param request
|
||||
* @param employee
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/login")
|
||||
public R<Employee> login(HttpServletRequest request,@RequestBody Employee employee){
|
||||
|
||||
//1、将页面提交的密码password进行md5加密处理
|
||||
String password = employee.getPassword();
|
||||
password = DigestUtils.md5DigestAsHex(password.getBytes());
|
||||
|
||||
//2、根据页面提交的用户名username查询数据库
|
||||
LambdaQueryWrapper<Employee> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(Employee::getUsername,employee.getUsername());
|
||||
Employee emp = employeeService.getOne(queryWrapper);
|
||||
|
||||
//3、如果没有查询到则返回登录失败结果
|
||||
if(emp == null){
|
||||
return R.error("登录失败");
|
||||
}
|
||||
|
||||
//4、密码比对,如果不一致则返回登录失败结果
|
||||
if(!emp.getPassword().equals(password)){
|
||||
return R.error("登录失败");
|
||||
}
|
||||
|
||||
//5、查看员工状态,如果为已禁用状态,则返回员工已禁用结果
|
||||
if(emp.getStatus() == 0){
|
||||
return R.error("账号已禁用");
|
||||
}
|
||||
|
||||
//6、登录成功,将员工id存入Session并返回登录成功结果
|
||||
request.getSession().setAttribute("employee",emp.getId());
|
||||
return R.success(emp);
|
||||
}
|
||||
|
||||
/**
|
||||
* 员工退出
|
||||
* @param request
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/logout")
|
||||
public R<String> logout(HttpServletRequest request){
|
||||
//清理Session中保存的当前登录员工的id
|
||||
request.getSession().removeAttribute("employee");
|
||||
return R.success("退出成功");
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增员工
|
||||
* @param employee
|
||||
* @return
|
||||
*/
|
||||
@PostMapping
|
||||
public R<String> save(HttpServletRequest request,@RequestBody Employee employee){
|
||||
log.info("新增员工,员工信息:{}",employee.toString());
|
||||
|
||||
//设置初始密码123456,需要进行md5加密处理
|
||||
employee.setPassword(DigestUtils.md5DigestAsHex(employee.getPassword().getBytes()));
|
||||
//employee.setCreateTime(LocalDateTime.now());
|
||||
//employee.setUpdateTime(LocalDateTime.now());
|
||||
|
||||
//获得当前登录用户的id
|
||||
//Long empId = (Long) request.getSession().getAttribute("employee");
|
||||
|
||||
//employee.setCreateUser(empId);
|
||||
//employee.setUpdateUser(empId);
|
||||
|
||||
employeeService.save(employee);
|
||||
|
||||
return R.success("新增账号成功");
|
||||
}
|
||||
|
||||
/**
|
||||
* 员工信息分页查询
|
||||
* @param page
|
||||
* @param pageSize
|
||||
* @param username
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/page")
|
||||
public R<Page> page(int page,int pageSize,String username){
|
||||
log.info("page = {},pageSize = {},username = {}" ,page,pageSize,username);
|
||||
|
||||
//构造分页构造器
|
||||
Page pageInfo = new Page(page,pageSize);
|
||||
|
||||
//构造条件构造器
|
||||
LambdaQueryWrapper<Employee> queryWrapper = new LambdaQueryWrapper();
|
||||
//添加过滤条件
|
||||
queryWrapper.like(StringUtils.isNotEmpty(username),Employee::getUsername,username);
|
||||
//添加排序条件
|
||||
queryWrapper.orderByDesc(Employee::getUpdateTime);
|
||||
|
||||
//执行查询
|
||||
employeeService.page(pageInfo,queryWrapper);
|
||||
|
||||
return R.success(pageInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据id修改员工信息
|
||||
* @param employee
|
||||
* @return
|
||||
*/
|
||||
@PutMapping
|
||||
public R<String> update(HttpServletRequest request,@RequestBody Employee employee){
|
||||
log.info(employee.toString());
|
||||
|
||||
long id = Thread.currentThread().getId();
|
||||
log.info("线程id为:{}",id);
|
||||
//Long empId = (Long)request.getSession().getAttribute("employee");
|
||||
//employee.setUpdateTime(LocalDateTime.now());
|
||||
//employee.setUpdateUser(empId);
|
||||
employee.setPassword(DigestUtils.md5DigestAsHex(employee.getPassword().getBytes()));
|
||||
employeeService.updateById(employee);
|
||||
|
||||
return R.success("员工信息修改成功");
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据id查询员工信息
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/{id}")
|
||||
public R<Employee> getById(@PathVariable Long id){
|
||||
log.info("根据id查询员工信息...");
|
||||
Employee employee = employeeService.getById(id);
|
||||
if(employee != null){
|
||||
return R.success(employee);
|
||||
}
|
||||
return R.error("没有查询到对应员工信息");
|
||||
}
|
||||
}
|
|
@ -0,0 +1,80 @@
|
|||
package com.JIAL.FMSystem.controller;
|
||||
|
||||
import com.JIAL.FMSystem.common.R;
|
||||
import com.JIAL.FMSystem.dto.HearCaseInMenuDto;
|
||||
import com.JIAL.FMSystem.entity.Defendant;
|
||||
import com.JIAL.FMSystem.entity.HearCase;
|
||||
import com.JIAL.FMSystem.entity.Plaintiff;
|
||||
import com.JIAL.FMSystem.entity.User;
|
||||
import com.JIAL.FMSystem.mapper.HearCaseMapper;
|
||||
import com.JIAL.FMSystem.service.DefendantService;
|
||||
import com.JIAL.FMSystem.service.HearCaseService;
|
||||
import com.JIAL.FMSystem.service.UserService;
|
||||
import com.JIAL.FMSystem.service.impl.HearCaseServiceImpl;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @ClassName HeraCaseController
|
||||
* @Description 审理案件控制类
|
||||
* @Author JIAL
|
||||
* @Date 2023/12/6 13:59
|
||||
* @Version 1.0
|
||||
*/
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/hearCase")
|
||||
@Slf4j
|
||||
public class HeraCaseController {
|
||||
@Autowired
|
||||
private HearCaseService hearCaseService;
|
||||
|
||||
@Resource
|
||||
private HearCaseMapper hearCaseMapper;
|
||||
|
||||
/**
|
||||
* @title page
|
||||
* @description 分页查询案件列表
|
||||
* @author JIAL
|
||||
* @param: page
|
||||
* @param: pageSize
|
||||
* @param: caseNum
|
||||
* @updateTime 2023/12/6 15:35
|
||||
* @return: com.JIAL.FMSystem.common.R<com.baomidou.mybatisplus.extension.plugins.pagination.Page>
|
||||
*/
|
||||
@GetMapping("page")
|
||||
public R<Page> page(int page, int pageSize, String caseNum) {
|
||||
log.info("page = {}, pageSize = {}, username = {}", page, pageSize, caseNum);
|
||||
|
||||
//分页构造器
|
||||
Page pageInfo = new Page(page, pageSize);
|
||||
//条件构造器
|
||||
MPJLambdaWrapper<HearCase> queryWrapper = new MPJLambdaWrapper<>();
|
||||
|
||||
queryWrapper.selectAll(HearCase.class)//查询案件所有属性
|
||||
.selectAs(Defendant::getUnitName, "defendant_name")
|
||||
.selectAs(Plaintiff::getUnitName, "plaintiff_name")
|
||||
.leftJoin(Defendant.class, Defendant::getId, HearCase::getDefendantId)
|
||||
.leftJoin(Plaintiff.class, Plaintiff::getId, HearCase::getPlaintiffId);
|
||||
|
||||
//IPage<HearCaseInMenuDto> iPage = hearCaseMapper.selectJoinPage(pageInfo, HearCaseInMenuDto.class, queryWrapper);
|
||||
//IPage<Map<String, Object>> pageInfoResult = hearCaseService.getBaseMapper().selectMapsPage(pageInfo, queryWrapper);
|
||||
//hearCaseService.page(pageInfo, queryWrapper);
|
||||
hearCaseMapper.selectJoinPage(pageInfo, HearCaseInMenuDto.class, queryWrapper);
|
||||
return R.success(pageInfo);
|
||||
}
|
||||
}
|
|
@ -1,35 +0,0 @@
|
|||
package com.JIAL.FMSystem.controller;
|
||||
|
||||
import com.JIAL.FMSystem.common.R;
|
||||
import com.JIAL.FMSystem.entity.Orders;
|
||||
import com.JIAL.FMSystem.service.OrderService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
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.RestController;
|
||||
|
||||
/**
|
||||
* 订单
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/order")
|
||||
public class OrderController {
|
||||
|
||||
@Autowired
|
||||
private OrderService orderService;
|
||||
|
||||
/**
|
||||
* 用户下单
|
||||
* @param orders
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/submit")
|
||||
public R<String> submit(@RequestBody Orders orders){
|
||||
log.info("订单数据:{}",orders);
|
||||
orderService.submit(orders);
|
||||
return R.success("下单成功");
|
||||
}
|
||||
}
|
|
@ -1,19 +0,0 @@
|
|||
package com.JIAL.FMSystem.controller;
|
||||
|
||||
import com.JIAL.FMSystem.service.OrderDetailService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
/**
|
||||
* 订单明细
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/orderDetail")
|
||||
public class OrderDetailController {
|
||||
|
||||
@Autowired
|
||||
private OrderDetailService orderDetailService;
|
||||
|
||||
}
|
|
@ -1,127 +0,0 @@
|
|||
package com.JIAL.FMSystem.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.JIAL.FMSystem.common.R;
|
||||
import com.JIAL.FMSystem.dto.SetmealDto;
|
||||
import com.JIAL.FMSystem.entity.Category;
|
||||
import com.JIAL.FMSystem.entity.Setmeal;
|
||||
import com.JIAL.FMSystem.service.CategoryService;
|
||||
import com.JIAL.FMSystem.service.SetmealDishService;
|
||||
import com.JIAL.FMSystem.service.SetmealService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 套餐管理
|
||||
*/
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/setmeal")
|
||||
@Slf4j
|
||||
public class SetmealController {
|
||||
|
||||
@Autowired
|
||||
private SetmealService setmealService;
|
||||
|
||||
@Autowired
|
||||
private CategoryService categoryService;
|
||||
|
||||
@Autowired
|
||||
private SetmealDishService setmealDishService;
|
||||
|
||||
/**
|
||||
* 新增套餐
|
||||
* @param setmealDto
|
||||
* @return
|
||||
*/
|
||||
@PostMapping
|
||||
public R<String> save(@RequestBody SetmealDto setmealDto){
|
||||
log.info("套餐信息:{}",setmealDto);
|
||||
|
||||
setmealService.saveWithDish(setmealDto);
|
||||
|
||||
return R.success("新增套餐成功");
|
||||
}
|
||||
|
||||
/**
|
||||
* 套餐分页查询
|
||||
* @param page
|
||||
* @param pageSize
|
||||
* @param name
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/page")
|
||||
public R<Page> page(int page,int pageSize,String name){
|
||||
//分页构造器对象
|
||||
Page<Setmeal> pageInfo = new Page<>(page,pageSize);
|
||||
Page<SetmealDto> dtoPage = new Page<>();
|
||||
|
||||
LambdaQueryWrapper<Setmeal> queryWrapper = new LambdaQueryWrapper<>();
|
||||
//添加查询条件,根据name进行like模糊查询
|
||||
queryWrapper.like(name != null,Setmeal::getName,name);
|
||||
//添加排序条件,根据更新时间降序排列
|
||||
queryWrapper.orderByDesc(Setmeal::getUpdateTime);
|
||||
|
||||
setmealService.page(pageInfo,queryWrapper);
|
||||
|
||||
//对象拷贝
|
||||
BeanUtils.copyProperties(pageInfo,dtoPage,"records");
|
||||
List<Setmeal> records = pageInfo.getRecords();
|
||||
|
||||
List<SetmealDto> list = records.stream().map((item) -> {
|
||||
SetmealDto setmealDto = new SetmealDto();
|
||||
//对象拷贝
|
||||
BeanUtils.copyProperties(item,setmealDto);
|
||||
//分类id
|
||||
Long categoryId = item.getCategoryId();
|
||||
//根据分类id查询分类对象
|
||||
Category category = categoryService.getById(categoryId);
|
||||
if(category != null){
|
||||
//分类名称
|
||||
String categoryName = category.getName();
|
||||
setmealDto.setCategoryName(categoryName);
|
||||
}
|
||||
return setmealDto;
|
||||
}).collect(Collectors.toList());
|
||||
|
||||
dtoPage.setRecords(list);
|
||||
return R.success(dtoPage);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除套餐
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
@DeleteMapping
|
||||
public R<String> delete(@RequestParam List<Long> ids){
|
||||
log.info("ids:{}",ids);
|
||||
|
||||
setmealService.removeWithDish(ids);
|
||||
|
||||
return R.success("套餐数据删除成功");
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据条件查询套餐数据
|
||||
* @param setmeal
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/list")
|
||||
public R<List<Setmeal>> list(Setmeal setmeal){
|
||||
LambdaQueryWrapper<Setmeal> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(setmeal.getCategoryId() != null,Setmeal::getCategoryId,setmeal.getCategoryId());
|
||||
queryWrapper.eq(setmeal.getStatus() != null,Setmeal::getStatus,setmeal.getStatus());
|
||||
queryWrapper.orderByDesc(Setmeal::getUpdateTime);
|
||||
|
||||
List<Setmeal> list = setmealService.list(queryWrapper);
|
||||
|
||||
return R.success(list);
|
||||
}
|
||||
}
|
|
@ -1,105 +0,0 @@
|
|||
package com.JIAL.FMSystem.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.JIAL.FMSystem.common.BaseContext;
|
||||
import com.JIAL.FMSystem.common.R;
|
||||
import com.JIAL.FMSystem.entity.ShoppingCart;
|
||||
import com.JIAL.FMSystem.service.ShoppingCartService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 购物车
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/shoppingCart")
|
||||
public class ShoppingCartController {
|
||||
|
||||
@Autowired
|
||||
private ShoppingCartService shoppingCartService;
|
||||
|
||||
/**
|
||||
* 添加购物车
|
||||
* @param shoppingCart
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/add")
|
||||
public R<ShoppingCart> add(@RequestBody ShoppingCart shoppingCart){
|
||||
log.info("购物车数据:{}",shoppingCart);
|
||||
|
||||
//设置用户id,指定当前是哪个用户的购物车数据
|
||||
Long currentId = BaseContext.getCurrentId();
|
||||
shoppingCart.setUserId(currentId);
|
||||
|
||||
Long dishId = shoppingCart.getDishId();
|
||||
|
||||
LambdaQueryWrapper<ShoppingCart> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(ShoppingCart::getUserId,currentId);
|
||||
|
||||
if(dishId != null){
|
||||
//添加到购物车的是菜品
|
||||
queryWrapper.eq(ShoppingCart::getDishId,dishId);
|
||||
|
||||
}else{
|
||||
//添加到购物车的是套餐
|
||||
queryWrapper.eq(ShoppingCart::getSetmealId,shoppingCart.getSetmealId());
|
||||
}
|
||||
|
||||
//查询当前菜品或者套餐是否在购物车中
|
||||
//SQL:select * from shopping_cart where user_id = ? and dish_id/setmeal_id = ?
|
||||
ShoppingCart cartServiceOne = shoppingCartService.getOne(queryWrapper);
|
||||
|
||||
if(cartServiceOne != null){
|
||||
//如果已经存在,就在原来数量基础上加一
|
||||
Integer number = cartServiceOne.getNumber();
|
||||
cartServiceOne.setNumber(number + 1);
|
||||
shoppingCartService.updateById(cartServiceOne);
|
||||
}else{
|
||||
//如果不存在,则添加到购物车,数量默认就是一
|
||||
shoppingCart.setNumber(1);
|
||||
shoppingCart.setCreateTime(LocalDateTime.now());
|
||||
shoppingCartService.save(shoppingCart);
|
||||
cartServiceOne = shoppingCart;
|
||||
}
|
||||
|
||||
return R.success(cartServiceOne);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查看购物车
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/list")
|
||||
public R<List<ShoppingCart>> list(){
|
||||
log.info("查看购物车...");
|
||||
|
||||
LambdaQueryWrapper<ShoppingCart> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(ShoppingCart::getUserId,BaseContext.getCurrentId());
|
||||
queryWrapper.orderByAsc(ShoppingCart::getCreateTime);
|
||||
|
||||
List<ShoppingCart> list = shoppingCartService.list(queryWrapper);
|
||||
|
||||
return R.success(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 清空购物车
|
||||
* @return
|
||||
*/
|
||||
@DeleteMapping("/clean")
|
||||
public R<String> clean(){
|
||||
//SQL:delete from shopping_cart where user_id = ?
|
||||
|
||||
LambdaQueryWrapper<ShoppingCart> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(ShoppingCart::getUserId,BaseContext.getCurrentId());
|
||||
|
||||
shoppingCartService.remove(queryWrapper);
|
||||
|
||||
return R.success("清空购物车成功");
|
||||
}
|
||||
}
|
|
@ -5,90 +5,164 @@ import com.JIAL.FMSystem.common.R;
|
|||
import com.JIAL.FMSystem.entity.User;
|
||||
import com.JIAL.FMSystem.service.UserService;
|
||||
import com.JIAL.FMSystem.utils.ValidateCodeUtils;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
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.RestController;
|
||||
import org.springframework.util.DigestUtils;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpSession;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.Map;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/user")
|
||||
@Slf4j
|
||||
/**
|
||||
* @title
|
||||
* @description
|
||||
* @author JIAL
|
||||
* @updateTime 2023/12/5 15:46
|
||||
*/
|
||||
public class UserController {
|
||||
|
||||
@Autowired
|
||||
private UserService userService;
|
||||
|
||||
/**
|
||||
* 发送手机短信验证码
|
||||
* @param user
|
||||
* @return
|
||||
* @title login
|
||||
* @description 员工登陆
|
||||
* @author JIAL
|
||||
* @param: request
|
||||
* @param: user
|
||||
* @updateTime 2023/12/6 8:06
|
||||
* @return: com.JIAL.FMSystem.common.R<com.JIAL.FMSystem.entity.User>
|
||||
*/
|
||||
@PostMapping("/sendMsg")
|
||||
public R<String> sendMsg(@RequestBody User user, HttpSession session){
|
||||
//获取手机号
|
||||
String phone = user.getPhone();
|
||||
@PostMapping("/login")
|
||||
public R<User> login(HttpServletRequest request, @RequestBody User user) {
|
||||
//将页面提交的密码进行md5加密
|
||||
String password = user.getPassword();
|
||||
password = DigestUtils.md5DigestAsHex(password.getBytes());
|
||||
|
||||
if(StringUtils.isNotEmpty(phone)){
|
||||
//生成随机的4位验证码
|
||||
String code = ValidateCodeUtils.generateValidateCode(4).toString();
|
||||
log.info("code={}",code);
|
||||
//根据页面提交的用户名username查询数据库
|
||||
LambdaQueryWrapper<User> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(User::getUsername, user.getUsername());
|
||||
User userResult = userService.getOne(queryWrapper);
|
||||
|
||||
//调用阿里云提供的短信服务API完成发送短信
|
||||
//SMSUtils.sendMessage("瑞吉外卖","",phone,code);
|
||||
|
||||
//需要将生成的验证码保存到Session
|
||||
session.setAttribute(phone,code);
|
||||
|
||||
return R.success("手机验证码短信发送成功");
|
||||
//查询为空就返回登陆失败
|
||||
if(userResult == null) {
|
||||
return R.error("登陆失败");
|
||||
}
|
||||
|
||||
return R.error("短信发送失败");
|
||||
if(!userResult.getPassword().equals(password)) {
|
||||
return R.error("登陆失败");
|
||||
}
|
||||
|
||||
if(userResult.getStatus() == 0) {
|
||||
return R.error("账号已禁用");
|
||||
}
|
||||
|
||||
request.getSession().setAttribute("user", userResult.getId());
|
||||
return R.success(userResult);
|
||||
}
|
||||
|
||||
@PostMapping("/logout")
|
||||
public R<String> logout(HttpServletRequest request) {
|
||||
//清理session中保存的当前登陆员工的id
|
||||
request.getSession().removeAttribute("user");
|
||||
return R.success("退出成功");
|
||||
}
|
||||
|
||||
/**
|
||||
* 移动端用户登录
|
||||
* @param map
|
||||
* @param session
|
||||
* @return
|
||||
* @title page
|
||||
* @description 分页查询员工账号
|
||||
* @author JIAL
|
||||
* @param: page
|
||||
* @param: pageSize
|
||||
* @param: username
|
||||
* @updateTime 2023/12/6 10:49
|
||||
* @return: com.JIAL.FMSystem.common.R<com.baomidou.mybatisplus.extension.plugins.pagination.Page>
|
||||
*/
|
||||
@PostMapping("/login")
|
||||
public R<User> login(@RequestBody Map map, HttpSession session){
|
||||
log.info(map.toString());
|
||||
@GetMapping("page")
|
||||
public R<Page> page(int page, int pageSize, String username) {
|
||||
log.info("page = {}, pageSize = {}, username = {}", page, pageSize, username);
|
||||
|
||||
//获取手机号
|
||||
String phone = map.get("phone").toString();
|
||||
//分页构造器
|
||||
Page pageInfo = new Page(page, pageSize);
|
||||
|
||||
//获取验证码
|
||||
String code = map.get("code").toString();
|
||||
//条件构造器
|
||||
LambdaQueryWrapper<User> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.like(StringUtils.isNotEmpty(username), User::getUsername, username);
|
||||
queryWrapper.orderByDesc(User::getUpdateTime);
|
||||
|
||||
//从Session中获取保存的验证码
|
||||
Object codeInSession = session.getAttribute(phone);
|
||||
userService.page(pageInfo, queryWrapper);
|
||||
|
||||
//进行验证码的比对(页面提交的验证码和Session中保存的验证码比对)
|
||||
if(codeInSession != null && codeInSession.equals(code)){
|
||||
//如果能够比对成功,说明登录成功
|
||||
|
||||
LambdaQueryWrapper<User> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(User::getPhone,phone);
|
||||
return R.success(pageInfo);
|
||||
}
|
||||
|
||||
User user = userService.getOne(queryWrapper);
|
||||
if(user == null){
|
||||
//判断当前手机号对应的用户是否为新用户,如果是新用户就自动完成注册
|
||||
user = new User();
|
||||
user.setPhone(phone);
|
||||
user.setStatus(1);
|
||||
userService.save(user);
|
||||
}
|
||||
session.setAttribute("user",user.getId());
|
||||
/**
|
||||
* @title getById
|
||||
* @description 根据id查询用户信息
|
||||
* @author JIAL
|
||||
* @param: id
|
||||
* @updateTime 2023/12/6 10:54
|
||||
* @return: com.JIAL.FMSystem.common.R<com.JIAL.FMSystem.entity.User>
|
||||
*/
|
||||
@GetMapping("/{id}")
|
||||
public R<User> getById(@PathVariable Long id) {
|
||||
log.info("根据id查询员工信息...");
|
||||
User user = userService.getById(id);
|
||||
if(user != null) {
|
||||
return R.success(user);
|
||||
}
|
||||
return R.error("登录失败");
|
||||
|
||||
return R.error("没有查询到对应员工信息");
|
||||
}
|
||||
|
||||
/**
|
||||
* @title save
|
||||
* @description 新建员工信息
|
||||
* @author JIAL
|
||||
* @param: request
|
||||
* @param: user
|
||||
* @updateTime 2023/12/6 12:45
|
||||
* @return: com.JIAL.FMSystem.common.R<java.lang.String>
|
||||
*/
|
||||
@PostMapping
|
||||
public R<String> save(HttpServletRequest request, @RequestBody User user) {
|
||||
log.info("新增员工信息:{}", user.toString());
|
||||
|
||||
//初始密码用md5加密
|
||||
user.setPassword(DigestUtils.md5DigestAsHex(user.getPassword().getBytes()));
|
||||
userService.save(user);
|
||||
|
||||
return R.success("新增账号成功");
|
||||
}
|
||||
|
||||
/**
|
||||
* @title update
|
||||
* @description 根据id修改员工信息
|
||||
* @author JIAL
|
||||
* @param: request
|
||||
* @param: user
|
||||
* @updateTime 2023/12/6 13:12
|
||||
* @return: com.JIAL.FMSystem.common.R<java.lang.String>
|
||||
*/
|
||||
@PutMapping
|
||||
public R<String> update(HttpServletRequest request, @RequestBody User user) {
|
||||
log.info(user.toString());
|
||||
|
||||
long id = Thread.currentThread().getId();
|
||||
log.info("线程id为:{}", id);
|
||||
|
||||
if(user.getPassword() != null) {
|
||||
user.setPassword(DigestUtils.md5DigestAsHex(user.getPassword().getBytes()));
|
||||
}
|
||||
userService.updateById(user);
|
||||
return R.success("员工信息修改成功");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,18 +0,0 @@
|
|||
package com.JIAL.FMSystem.dto;
|
||||
|
||||
import com.JIAL.FMSystem.entity.Dish;
|
||||
import com.JIAL.FMSystem.entity.DishFlavor;
|
||||
import lombok.Data;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class DishDto extends Dish {
|
||||
|
||||
//菜品对应的口味数据
|
||||
private List<DishFlavor> flavors = new ArrayList<>();
|
||||
|
||||
private String categoryName;
|
||||
|
||||
private Integer copies;
|
||||
}
|
|
@ -0,0 +1,71 @@
|
|||
package com.JIAL.FMSystem.dto;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.FieldFill;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* @ClassName HearCaseInMenu
|
||||
* @Description 自建在菜单中显示案件详情的类,用于分页
|
||||
* @Author JIAL
|
||||
* @Date 2023/12/6 22:58
|
||||
* @Version 1.0
|
||||
*/
|
||||
@Data
|
||||
public class HearCaseInMenuDto {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private Integer id;
|
||||
|
||||
private String caseNum; //案件号
|
||||
|
||||
private String caseReason; //案件来由
|
||||
|
||||
private Long defendantId; //被告id
|
||||
|
||||
private String plaintiffName; //原告单位名称
|
||||
|
||||
private String defendantName; //被告单位名称
|
||||
|
||||
private Long plaintiffId; //原告id
|
||||
|
||||
private Integer caseType; //案件类型
|
||||
|
||||
private LocalDateTime trialTime; //开庭时间
|
||||
|
||||
private String court; //法院名称
|
||||
|
||||
private Integer caseStatus; //案件状态
|
||||
|
||||
private String judgeName; //法官姓名
|
||||
|
||||
private String judgePhone; //法官电话
|
||||
|
||||
private String salesmanName; //业务员姓名
|
||||
|
||||
private String salesmanPhone; //业务员电话
|
||||
|
||||
@TableField(fill = FieldFill.INSERT) //插入时填充字段
|
||||
private LocalDateTime createTime;
|
||||
|
||||
@TableField(fill = FieldFill.INSERT_UPDATE) //插入和更新时填充字段
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
@TableField(fill = FieldFill.INSERT) //插入时填充字段
|
||||
private Long createUser;
|
||||
|
||||
@TableField(fill = FieldFill.INSERT_UPDATE) //插入和更新时填充字段
|
||||
private Long updateUser;
|
||||
|
||||
private String reservedField1; //备用字段1
|
||||
|
||||
private String reservedField2; //备用字段2
|
||||
|
||||
private String reservedField3; //备用字段3
|
||||
|
||||
private String reservedField4; //备用字段4
|
||||
|
||||
private String reservedField5; //备用字段5
|
||||
}
|
|
@ -1,14 +0,0 @@
|
|||
package com.JIAL.FMSystem.dto;
|
||||
|
||||
import com.JIAL.FMSystem.entity.Setmeal;
|
||||
import com.JIAL.FMSystem.entity.SetmealDish;
|
||||
import lombok.Data;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class SetmealDto extends Setmeal {
|
||||
|
||||
private List<SetmealDish> setmealDishes;
|
||||
|
||||
private String categoryName;
|
||||
}
|
|
@ -1,92 +0,0 @@
|
|||
package com.JIAL.FMSystem.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.FieldFill;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import lombok.Data;
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 地址簿
|
||||
*/
|
||||
@Data
|
||||
public class AddressBook implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private Long id;
|
||||
|
||||
|
||||
//用户id
|
||||
private Long userId;
|
||||
|
||||
|
||||
//收货人
|
||||
private String consignee;
|
||||
|
||||
|
||||
//手机号
|
||||
private String phone;
|
||||
|
||||
|
||||
//性别 0 女 1 男
|
||||
private String sex;
|
||||
|
||||
|
||||
//省级区划编号
|
||||
private String provinceCode;
|
||||
|
||||
|
||||
//省级名称
|
||||
private String provinceName;
|
||||
|
||||
|
||||
//市级区划编号
|
||||
private String cityCode;
|
||||
|
||||
|
||||
//市级名称
|
||||
private String cityName;
|
||||
|
||||
|
||||
//区级区划编号
|
||||
private String districtCode;
|
||||
|
||||
|
||||
//区级名称
|
||||
private String districtName;
|
||||
|
||||
|
||||
//详细地址
|
||||
private String detail;
|
||||
|
||||
|
||||
//标签
|
||||
private String label;
|
||||
|
||||
//是否默认 0 否 1是
|
||||
private Integer isDefault;
|
||||
|
||||
//创建时间
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
private LocalDateTime createTime;
|
||||
|
||||
|
||||
//更新时间
|
||||
@TableField(fill = FieldFill.INSERT_UPDATE)
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
|
||||
//创建人
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
private Long createUser;
|
||||
|
||||
|
||||
//修改人
|
||||
@TableField(fill = FieldFill.INSERT_UPDATE)
|
||||
private Long updateUser;
|
||||
|
||||
|
||||
//是否删除
|
||||
private Integer isDeleted;
|
||||
}
|
|
@ -0,0 +1,57 @@
|
|||
package com.JIAL.FMSystem.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.FieldFill;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* @ClassName agent
|
||||
* @Description 代理人实体类
|
||||
* @Author JIAL
|
||||
* @Date 2023/12/5 12:38
|
||||
* @Version 1.0
|
||||
*/
|
||||
|
||||
@Data
|
||||
public class Agent implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private Long id;
|
||||
|
||||
private Integer type; //代理人类型,1-律师,2-法律工作者,3-单位推荐,4-其他
|
||||
|
||||
private String name; //姓名
|
||||
|
||||
private Integer licenseType; //证件类型,1-居民身份证
|
||||
|
||||
private String licenseNum; //证件号
|
||||
|
||||
private String phoneNum; //电话号码
|
||||
|
||||
@TableField(fill = FieldFill.INSERT) //插入时填充字段
|
||||
private LocalDateTime createTime;
|
||||
|
||||
@TableField(fill = FieldFill.INSERT_UPDATE) //插入和更新时填充字段
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
@TableField(fill = FieldFill.INSERT) //插入时填充字段
|
||||
private Long createUser;
|
||||
|
||||
@TableField(fill = FieldFill.INSERT_UPDATE) //插入和更新时填充字段
|
||||
private Long updateUser;
|
||||
|
||||
private String reservedField1; //备用字段1
|
||||
|
||||
private String reservedField2; //备用字段2
|
||||
|
||||
private String reservedField3; //备用字段3
|
||||
|
||||
private String reservedField4; //备用字段4
|
||||
|
||||
private String reservedField5; //备用字段5
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,61 @@
|
|||
package com.JIAL.FMSystem.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.FieldFill;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* @ClassName Annex
|
||||
* @Description 附件表实体类
|
||||
* @Author JIAL
|
||||
* @Date 2023/12/5 13:20
|
||||
* @Version 1.0
|
||||
*/
|
||||
@Data
|
||||
public class Annex implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private Long id;
|
||||
|
||||
private Long caseId; //案件号
|
||||
|
||||
private String indictment; //起诉状附件
|
||||
|
||||
private String partyPorve; //当事人身份证明
|
||||
|
||||
private String proxyProve; //委托人委托手续和身份材料
|
||||
|
||||
private String evidence; //证据材料
|
||||
|
||||
private String deliverConfirm; //送达地址确认书
|
||||
|
||||
private String otherMaterials; //其他材料
|
||||
|
||||
@TableField(fill = FieldFill.INSERT) //插入时填充字段
|
||||
private LocalDateTime createTime;
|
||||
|
||||
@TableField(fill = FieldFill.INSERT_UPDATE) //插入和更新时填充字段
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
@TableField(fill = FieldFill.INSERT) //插入时填充字段
|
||||
private Long createUser;
|
||||
|
||||
@TableField(fill = FieldFill.INSERT_UPDATE) //插入和更新时填充字段
|
||||
private Long updateUser;
|
||||
|
||||
private String reservedField1; //备用字段1
|
||||
|
||||
private String reservedField2; //备用字段2
|
||||
|
||||
private String reservedField3; //备用字段3
|
||||
|
||||
private String reservedField4; //备用字段4
|
||||
|
||||
private String reservedField5; //备用字段5
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -1,52 +0,0 @@
|
|||
package com.JIAL.FMSystem.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.FieldFill;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 分类
|
||||
*/
|
||||
@Data
|
||||
public class Category implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private Long id;
|
||||
|
||||
|
||||
//类型 1 菜品分类 2 套餐分类
|
||||
private Integer type;
|
||||
|
||||
|
||||
//分类名称
|
||||
private String name;
|
||||
|
||||
|
||||
//顺序
|
||||
private Integer sort;
|
||||
|
||||
|
||||
//创建时间
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
private LocalDateTime createTime;
|
||||
|
||||
|
||||
//更新时间
|
||||
@TableField(fill = FieldFill.INSERT_UPDATE)
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
|
||||
//创建人
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
private Long createUser;
|
||||
|
||||
|
||||
//修改人
|
||||
@TableField(fill = FieldFill.INSERT_UPDATE)
|
||||
private Long updateUser;
|
||||
|
||||
}
|
|
@ -0,0 +1,50 @@
|
|||
package com.JIAL.FMSystem.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.FieldFill;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
/**
|
||||
* @ClassName Defendant
|
||||
* @Description 被告表实体类
|
||||
* @Author JIAL
|
||||
* @Date 2023/12/5 13:46
|
||||
* @Version 1.0
|
||||
*/
|
||||
@Data
|
||||
public class Defendant implements Serializable{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private Long id;
|
||||
|
||||
private Integer type; //当事人类型,1-法人
|
||||
|
||||
private String unitName; //单位名称
|
||||
|
||||
private String unitLocation; //单位所在地
|
||||
|
||||
@TableField(fill = FieldFill.INSERT) //插入时填充字段
|
||||
private LocalDateTime createTime;
|
||||
|
||||
@TableField(fill = FieldFill.INSERT_UPDATE) //插入和更新时填充字段
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
@TableField(fill = FieldFill.INSERT) //插入时填充字段
|
||||
private Long createUser;
|
||||
|
||||
@TableField(fill = FieldFill.INSERT_UPDATE) //插入和更新时填充字段
|
||||
private Long updateUser;
|
||||
|
||||
private String reservedField1; //备用字段1
|
||||
|
||||
private String reservedField2; //备用字段2
|
||||
|
||||
private String reservedField3; //备用字段3
|
||||
|
||||
private String reservedField4; //备用字段4
|
||||
|
||||
private String reservedField5; //备用字段5
|
||||
|
||||
}
|
|
@ -1,68 +0,0 @@
|
|||
package com.JIAL.FMSystem.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.FieldFill;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import lombok.Data;
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
菜品
|
||||
*/
|
||||
@Data
|
||||
public class Dish implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private Long id;
|
||||
|
||||
|
||||
//菜品名称
|
||||
private String name;
|
||||
|
||||
|
||||
//菜品分类id
|
||||
private Long categoryId;
|
||||
|
||||
|
||||
//菜品价格
|
||||
private BigDecimal price;
|
||||
|
||||
|
||||
//商品码
|
||||
private String code;
|
||||
|
||||
|
||||
//图片
|
||||
private String image;
|
||||
|
||||
|
||||
//描述信息
|
||||
private String description;
|
||||
|
||||
|
||||
//0 停售 1 起售
|
||||
private Integer status;
|
||||
|
||||
|
||||
//顺序
|
||||
private Integer sort;
|
||||
|
||||
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
private LocalDateTime createTime;
|
||||
|
||||
|
||||
@TableField(fill = FieldFill.INSERT_UPDATE)
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
private Long createUser;
|
||||
|
||||
|
||||
@TableField(fill = FieldFill.INSERT_UPDATE)
|
||||
private Long updateUser;
|
||||
|
||||
}
|
|
@ -1,51 +0,0 @@
|
|||
package com.JIAL.FMSystem.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.FieldFill;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import lombok.Data;
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
菜品口味
|
||||
*/
|
||||
@Data
|
||||
public class DishFlavor implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private Long id;
|
||||
|
||||
|
||||
//菜品id
|
||||
private Long dishId;
|
||||
|
||||
|
||||
//口味名称
|
||||
private String name;
|
||||
|
||||
|
||||
//口味数据list
|
||||
private String value;
|
||||
|
||||
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
private LocalDateTime createTime;
|
||||
|
||||
|
||||
@TableField(fill = FieldFill.INSERT_UPDATE)
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
private Long createUser;
|
||||
|
||||
|
||||
@TableField(fill = FieldFill.INSERT_UPDATE)
|
||||
private Long updateUser;
|
||||
|
||||
|
||||
//是否删除
|
||||
private Integer isDeleted;
|
||||
|
||||
}
|
|
@ -1,43 +0,0 @@
|
|||
package com.JIAL.FMSystem.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.FieldFill;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import lombok.Data;
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 员工实体
|
||||
*/
|
||||
@Data
|
||||
public class Employee implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private Long id;
|
||||
|
||||
private String username;
|
||||
|
||||
private String name;
|
||||
|
||||
private String password;
|
||||
|
||||
private String phone;
|
||||
|
||||
private String admin;
|
||||
|
||||
private Integer status;
|
||||
|
||||
@TableField(fill = FieldFill.INSERT) //插入时填充字段
|
||||
private LocalDateTime createTime;
|
||||
|
||||
@TableField(fill = FieldFill.INSERT_UPDATE) //插入和更新时填充字段
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
@TableField(fill = FieldFill.INSERT) //插入时填充字段
|
||||
private Long createUser;
|
||||
|
||||
@TableField(fill = FieldFill.INSERT_UPDATE) //插入和更新时填充字段
|
||||
private Long updateUser;
|
||||
|
||||
}
|
|
@ -0,0 +1,69 @@
|
|||
package com.JIAL.FMSystem.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.FieldFill;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* @ClassName HearCase
|
||||
* @Description 审理案件表实体类
|
||||
* @Author JIAL
|
||||
* @Date 2023/12/5 14:20
|
||||
* @Version 1.0
|
||||
*/
|
||||
@Data
|
||||
public class HearCase implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private Integer id;
|
||||
|
||||
private String caseNum; //案件号
|
||||
|
||||
private String caseReason; //案件来由
|
||||
|
||||
private Long defendantId; //被告id
|
||||
|
||||
private Long plaintiffId; //原告id
|
||||
|
||||
private Integer caseType; //案件类型
|
||||
|
||||
private LocalDateTime trialTime; //开庭时间
|
||||
|
||||
private String court; //法院名称
|
||||
|
||||
private Integer caseStatus; //案件状态
|
||||
|
||||
private String judgeName; //法官姓名
|
||||
|
||||
private String judgePhone; //法官电话
|
||||
|
||||
private String salesmanName; //业务员姓名
|
||||
|
||||
private String salesmanPhone; //业务员电话
|
||||
|
||||
@TableField(fill = FieldFill.INSERT) //插入时填充字段
|
||||
private LocalDateTime createTime;
|
||||
|
||||
@TableField(fill = FieldFill.INSERT_UPDATE) //插入和更新时填充字段
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
@TableField(fill = FieldFill.INSERT) //插入时填充字段
|
||||
private Long createUser;
|
||||
|
||||
@TableField(fill = FieldFill.INSERT_UPDATE) //插入和更新时填充字段
|
||||
private Long updateUser;
|
||||
|
||||
private String reservedField1; //备用字段1
|
||||
|
||||
private String reservedField2; //备用字段2
|
||||
|
||||
private String reservedField3; //备用字段3
|
||||
|
||||
private String reservedField4; //备用字段4
|
||||
|
||||
private String reservedField5; //备用字段5
|
||||
|
||||
}
|
|
@ -0,0 +1,65 @@
|
|||
package com.JIAL.FMSystem.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.FieldFill;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* @ClassName Money
|
||||
* @Description 案件金额表对应实体类
|
||||
* @Author JIAL
|
||||
* @Date 2023/12/5 14:28
|
||||
* @Version 1.0
|
||||
*/
|
||||
@Data
|
||||
public class Money implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private Long id;
|
||||
|
||||
private Long caseId; //案件ID
|
||||
|
||||
private Long litigationAmount; //起诉金
|
||||
|
||||
private Long preservationAmount; //保全金额
|
||||
|
||||
private Long judicialActionFee; //诉讼费
|
||||
|
||||
private Long refund; //退费
|
||||
|
||||
private Long preservationFee; //保全费
|
||||
|
||||
private Long executeFee; //执行费
|
||||
|
||||
private Long estimateFee; //评估费
|
||||
|
||||
private Long resultAmount; //结果金额
|
||||
|
||||
private String resultAmountRemarks; //结果金额备注
|
||||
|
||||
@TableField(fill = FieldFill.INSERT) //插入时填充字段
|
||||
private LocalDateTime createTime;
|
||||
|
||||
@TableField(fill = FieldFill.INSERT_UPDATE) //插入和更新时填充字段
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
@TableField(fill = FieldFill.INSERT) //插入时填充字段
|
||||
private Long createUser;
|
||||
|
||||
@TableField(fill = FieldFill.INSERT_UPDATE) //插入和更新时填充字段
|
||||
private Long updateUser;
|
||||
|
||||
private String reservedField1; //备用字段1
|
||||
|
||||
private String reservedField2; //备用字段2
|
||||
|
||||
private String reservedField3; //备用字段3
|
||||
|
||||
private String reservedField4; //备用字段4
|
||||
|
||||
private String reservedField5; //备用字段5
|
||||
|
||||
}
|
|
@ -1,44 +0,0 @@
|
|||
package com.JIAL.FMSystem.entity;
|
||||
|
||||
import lombok.Data;
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* 订单明细
|
||||
*/
|
||||
@Data
|
||||
public class OrderDetail implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private Long id;
|
||||
|
||||
//名称
|
||||
private String name;
|
||||
|
||||
//订单id
|
||||
private Long orderId;
|
||||
|
||||
|
||||
//菜品id
|
||||
private Long dishId;
|
||||
|
||||
|
||||
//套餐id
|
||||
private Long setmealId;
|
||||
|
||||
|
||||
//口味
|
||||
private String dishFlavor;
|
||||
|
||||
|
||||
//数量
|
||||
private Integer number;
|
||||
|
||||
//金额
|
||||
private BigDecimal amount;
|
||||
|
||||
//图片
|
||||
private String image;
|
||||
}
|
|
@ -1,61 +0,0 @@
|
|||
package com.JIAL.FMSystem.entity;
|
||||
|
||||
import lombok.Data;
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 订单
|
||||
*/
|
||||
@Data
|
||||
public class Orders implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private Long id;
|
||||
|
||||
//订单号
|
||||
private String number;
|
||||
|
||||
//订单状态 1待付款,2待派送,3已派送,4已完成,5已取消
|
||||
private Integer status;
|
||||
|
||||
|
||||
//下单用户id
|
||||
private Long userId;
|
||||
|
||||
//地址id
|
||||
private Long addressBookId;
|
||||
|
||||
|
||||
//下单时间
|
||||
private LocalDateTime orderTime;
|
||||
|
||||
|
||||
//结账时间
|
||||
private LocalDateTime checkoutTime;
|
||||
|
||||
|
||||
//支付方式 1微信,2支付宝
|
||||
private Integer payMethod;
|
||||
|
||||
|
||||
//实收金额
|
||||
private BigDecimal amount;
|
||||
|
||||
//备注
|
||||
private String remark;
|
||||
|
||||
//用户名
|
||||
private String userName;
|
||||
|
||||
//手机号
|
||||
private String phone;
|
||||
|
||||
//地址
|
||||
private String address;
|
||||
|
||||
//收货人
|
||||
private String consignee;
|
||||
}
|
|
@ -0,0 +1,57 @@
|
|||
package com.JIAL.FMSystem.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.FieldFill;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* @ClassName Plaintiff
|
||||
* @Description 原告表对应实体类
|
||||
* @Author JIAL
|
||||
* @Date 2023/12/5 14:45
|
||||
* @Version 1.0
|
||||
*/
|
||||
@Data
|
||||
public class Plaintiff implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private Long id;
|
||||
|
||||
private Integer type; //原告类型。1-法人
|
||||
|
||||
private String unitName; //单位名称
|
||||
|
||||
private Integer licenseType; //证照类型,1-统一社会信用代码证
|
||||
|
||||
private String licenseNum; //证件号码
|
||||
|
||||
private String unitLocation; //单位所在地
|
||||
|
||||
private String phoneNum; //联系电话
|
||||
|
||||
@TableField(fill = FieldFill.INSERT) //插入时填充字段
|
||||
private LocalDateTime createTime;
|
||||
|
||||
@TableField(fill = FieldFill.INSERT_UPDATE) //插入和更新时填充字段
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
@TableField(fill = FieldFill.INSERT) //插入时填充字段
|
||||
private Long createUser;
|
||||
|
||||
@TableField(fill = FieldFill.INSERT_UPDATE) //插入和更新时填充字段
|
||||
private Long updateUser;
|
||||
|
||||
private String reservedField1; //备用字段1
|
||||
|
||||
private String reservedField2; //备用字段2
|
||||
|
||||
private String reservedField3; //备用字段3
|
||||
|
||||
private String reservedField4; //备用字段4
|
||||
|
||||
private String reservedField5; //备用字段5
|
||||
|
||||
}
|
|
@ -1,64 +0,0 @@
|
|||
package com.JIAL.FMSystem.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.FieldFill;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import lombok.Data;
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 套餐
|
||||
*/
|
||||
@Data
|
||||
public class Setmeal implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private Long id;
|
||||
|
||||
|
||||
//分类id
|
||||
private Long categoryId;
|
||||
|
||||
|
||||
//套餐名称
|
||||
private String name;
|
||||
|
||||
|
||||
//套餐价格
|
||||
private BigDecimal price;
|
||||
|
||||
|
||||
//状态 0:停用 1:启用
|
||||
private Integer status;
|
||||
|
||||
|
||||
//编码
|
||||
private String code;
|
||||
|
||||
|
||||
//描述信息
|
||||
private String description;
|
||||
|
||||
|
||||
//图片
|
||||
private String image;
|
||||
|
||||
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
private LocalDateTime createTime;
|
||||
|
||||
|
||||
@TableField(fill = FieldFill.INSERT_UPDATE)
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
private Long createUser;
|
||||
|
||||
|
||||
@TableField(fill = FieldFill.INSERT_UPDATE)
|
||||
private Long updateUser;
|
||||
|
||||
}
|
|
@ -1,61 +0,0 @@
|
|||
package com.JIAL.FMSystem.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.FieldFill;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import lombok.Data;
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 套餐菜品关系
|
||||
*/
|
||||
@Data
|
||||
public class SetmealDish implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private Long id;
|
||||
|
||||
|
||||
//套餐id
|
||||
private Long setmealId;
|
||||
|
||||
|
||||
//菜品id
|
||||
private Long dishId;
|
||||
|
||||
|
||||
//菜品名称 (冗余字段)
|
||||
private String name;
|
||||
|
||||
//菜品原价
|
||||
private BigDecimal price;
|
||||
|
||||
//份数
|
||||
private Integer copies;
|
||||
|
||||
|
||||
//排序
|
||||
private Integer sort;
|
||||
|
||||
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
private LocalDateTime createTime;
|
||||
|
||||
|
||||
@TableField(fill = FieldFill.INSERT_UPDATE)
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
private Long createUser;
|
||||
|
||||
|
||||
@TableField(fill = FieldFill.INSERT_UPDATE)
|
||||
private Long updateUser;
|
||||
|
||||
|
||||
//是否删除
|
||||
private Integer isDeleted;
|
||||
}
|
|
@ -1,43 +0,0 @@
|
|||
package com.JIAL.FMSystem.entity;
|
||||
|
||||
import lombok.Data;
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 购物车
|
||||
*/
|
||||
@Data
|
||||
public class ShoppingCart implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private Long id;
|
||||
|
||||
//名称
|
||||
private String name;
|
||||
|
||||
//用户id
|
||||
private Long userId;
|
||||
|
||||
//菜品id
|
||||
private Long dishId;
|
||||
|
||||
//套餐id
|
||||
private Long setmealId;
|
||||
|
||||
//口味
|
||||
private String dishFlavor;
|
||||
|
||||
//数量
|
||||
private Integer number;
|
||||
|
||||
//金额
|
||||
private BigDecimal amount;
|
||||
|
||||
//图片
|
||||
private String image;
|
||||
|
||||
private LocalDateTime createTime;
|
||||
}
|
|
@ -1,40 +1,58 @@
|
|||
package com.JIAL.FMSystem.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.FieldFill;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 用户信息
|
||||
* @ClassName User
|
||||
* @Description 用户实体类
|
||||
* @Author JIAL
|
||||
* @Date 2023/12/5 12:38
|
||||
* @Version 1.0
|
||||
*/
|
||||
@Data
|
||||
public class User implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private Long id;
|
||||
|
||||
private String name; //姓名
|
||||
|
||||
//姓名
|
||||
private String name;
|
||||
private String username; //账号:工号
|
||||
|
||||
private String phone; //手机号
|
||||
|
||||
private Integer status; //状态 0:禁用,1:正常
|
||||
|
||||
private String password; //密码
|
||||
|
||||
private Integer admin; //管理员等级0-超级用户,1-管理员,2-用户
|
||||
|
||||
@TableField(fill = FieldFill.INSERT) //插入时填充字段
|
||||
private LocalDateTime createTime;
|
||||
|
||||
@TableField(fill = FieldFill.INSERT_UPDATE) //插入和更新时填充字段
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
@TableField(fill = FieldFill.INSERT) //插入时填充字段
|
||||
private Long createUser;
|
||||
|
||||
@TableField(fill = FieldFill.INSERT_UPDATE) //插入和更新时填充字段
|
||||
private Long updateUser;
|
||||
|
||||
private String reservedField1; //备用字段1
|
||||
|
||||
private String reservedField2; //备用字段2
|
||||
|
||||
private String reservedField3; //备用字段3
|
||||
|
||||
private String reservedField4; //备用字段4
|
||||
|
||||
private String reservedField5; //备用字段5
|
||||
|
||||
|
||||
//手机号
|
||||
private String phone;
|
||||
|
||||
|
||||
//性别 0 女 1 男
|
||||
private String sex;
|
||||
|
||||
|
||||
//身份证号
|
||||
private String idNumber;
|
||||
|
||||
|
||||
//头像
|
||||
private String avatar;
|
||||
|
||||
|
||||
//状态 0:禁用,1:正常
|
||||
private Integer status;
|
||||
}
|
||||
|
|
|
@ -33,8 +33,8 @@ public class LoginCheckFilter implements Filter{
|
|||
|
||||
//定义不需要处理的请求路径
|
||||
String[] urls = new String[]{
|
||||
"/employee/login",
|
||||
"/employee/logout",
|
||||
"/user/login",
|
||||
"/user/logout",
|
||||
"/backend/**",
|
||||
"/front/**",
|
||||
"/common/**",
|
||||
|
@ -53,10 +53,10 @@ public class LoginCheckFilter implements Filter{
|
|||
}
|
||||
|
||||
//4-1、判断登录状态,如果已登录,则直接放行
|
||||
if(request.getSession().getAttribute("employee") != null){
|
||||
log.info("用户已登录,用户id为:{}",request.getSession().getAttribute("employee"));
|
||||
if(request.getSession().getAttribute("user") != null){
|
||||
log.info("用户已登录,用户id为:{}",request.getSession().getAttribute("user"));
|
||||
|
||||
Long empId = (Long) request.getSession().getAttribute("employee");
|
||||
Long empId = (Long) request.getSession().getAttribute("user");
|
||||
BaseContext.setCurrentId(empId);
|
||||
|
||||
filterChain.doFilter(request,response);
|
||||
|
|
|
@ -1,10 +0,0 @@
|
|||
package com.JIAL.FMSystem.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.JIAL.FMSystem.entity.AddressBook;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface AddressBookMapper extends BaseMapper<AddressBook> {
|
||||
|
||||
}
|
|
@ -1,9 +0,0 @@
|
|||
package com.JIAL.FMSystem.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.JIAL.FMSystem.entity.Category;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface CategoryMapper extends BaseMapper<Category> {
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
package com.JIAL.FMSystem.mapper;
|
||||
|
||||
import com.JIAL.FMSystem.entity.Defendant;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* @ClassName Defendant
|
||||
* @Description TODO
|
||||
* @Author JIAL
|
||||
* @Date 2023/12/6 16:30
|
||||
* @Version 1.0
|
||||
*/
|
||||
@Mapper
|
||||
public interface DefendantMapper extends BaseMapper<Defendant> {
|
||||
}
|
|
@ -1,9 +0,0 @@
|
|||
package com.JIAL.FMSystem.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.JIAL.FMSystem.entity.DishFlavor;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface DishFlavorMapper extends BaseMapper<DishFlavor> {
|
||||
}
|
|
@ -1,9 +0,0 @@
|
|||
package com.JIAL.FMSystem.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.JIAL.FMSystem.entity.Dish;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface DishMapper extends BaseMapper<Dish> {
|
||||
}
|
|
@ -1,9 +0,0 @@
|
|||
package com.JIAL.FMSystem.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.JIAL.FMSystem.entity.Employee;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface EmployeeMapper extends BaseMapper<Employee>{
|
||||
}
|
|
@ -0,0 +1,18 @@
|
|||
package com.JIAL.FMSystem.mapper;
|
||||
|
||||
import com.JIAL.FMSystem.entity.HearCase;
|
||||
import com.JIAL.FMSystem.entity.User;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.github.yulichang.base.MPJBaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* @ClassName HearCaseMapper
|
||||
* @Description TODO
|
||||
* @Author JIAL
|
||||
* @Date 2023/12/6 14:01
|
||||
* @Version 1.0
|
||||
*/
|
||||
@Mapper
|
||||
public interface HearCaseMapper extends MPJBaseMapper<HearCase> {
|
||||
}
|
|
@ -1,10 +0,0 @@
|
|||
package com.JIAL.FMSystem.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.JIAL.FMSystem.entity.OrderDetail;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface OrderDetailMapper extends BaseMapper<OrderDetail> {
|
||||
|
||||
}
|
|
@ -1,10 +0,0 @@
|
|||
package com.JIAL.FMSystem.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.JIAL.FMSystem.entity.Orders;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface OrderMapper extends BaseMapper<Orders> {
|
||||
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
package com.JIAL.FMSystem.mapper;
|
||||
|
||||
import com.JIAL.FMSystem.entity.Plaintiff;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* @ClassName PlaintffMapper
|
||||
* @Description TODO
|
||||
* @Author JIAL
|
||||
* @Date 2023/12/6 16:32
|
||||
* @Version 1.0
|
||||
*/
|
||||
@Mapper
|
||||
public interface PlaintiffMapper extends BaseMapper<Plaintiff> {
|
||||
|
||||
}
|
|
@ -1,9 +0,0 @@
|
|||
package com.JIAL.FMSystem.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.JIAL.FMSystem.entity.SetmealDish;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface SetmealDishMapper extends BaseMapper<SetmealDish> {
|
||||
}
|
|
@ -1,9 +0,0 @@
|
|||
package com.JIAL.FMSystem.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.JIAL.FMSystem.entity.Setmeal;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface SetmealMapper extends BaseMapper<Setmeal> {
|
||||
}
|
|
@ -1,10 +0,0 @@
|
|||
package com.JIAL.FMSystem.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.JIAL.FMSystem.entity.ShoppingCart;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface ShoppingCartMapper extends BaseMapper<ShoppingCart> {
|
||||
|
||||
}
|
|
@ -4,6 +4,12 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
|||
import com.JIAL.FMSystem.entity.User;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* @title
|
||||
* @description
|
||||
* @author JIAL
|
||||
* @updateTime 2023/12/6 14:01
|
||||
*/
|
||||
@Mapper
|
||||
public interface UserMapper extends BaseMapper<User>{
|
||||
}
|
||||
|
|
|
@ -1,8 +0,0 @@
|
|||
package com.JIAL.FMSystem.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.JIAL.FMSystem.entity.AddressBook;
|
||||
|
||||
public interface AddressBookService extends IService<AddressBook> {
|
||||
|
||||
}
|
|
@ -1,10 +0,0 @@
|
|||
package com.JIAL.FMSystem.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.JIAL.FMSystem.entity.Category;
|
||||
|
||||
public interface CategoryService extends IService<Category> {
|
||||
|
||||
public void remove(Long id);
|
||||
|
||||
}
|
|
@ -0,0 +1,27 @@
|
|||
package com.JIAL.FMSystem.service;
|
||||
|
||||
import com.JIAL.FMSystem.entity.Defendant;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @ClassName DefendantService
|
||||
* @Description TODO
|
||||
* @Author JIAL
|
||||
* @Date 2023/12/6 16:39
|
||||
* @Version 1.0
|
||||
*/
|
||||
|
||||
public interface DefendantService extends IService<Defendant> {
|
||||
|
||||
/**
|
||||
* @title idAndNameUnitName
|
||||
* @description 返回被告的id和单位名称组成的Map
|
||||
* @author JIAL
|
||||
* @updateTime 2023/12/6 20:28
|
||||
* @return: java.util.List<java.util.Map<java.lang.String,java.lang.Object>>
|
||||
*/
|
||||
public List<Map<Long, Object>> idAndNameUnitName(List<Long> list);
|
||||
}
|
|
@ -1,7 +0,0 @@
|
|||
package com.JIAL.FMSystem.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.JIAL.FMSystem.entity.DishFlavor;
|
||||
|
||||
public interface DishFlavorService extends IService<DishFlavor> {
|
||||
}
|
|
@ -1,17 +0,0 @@
|
|||
package com.JIAL.FMSystem.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.JIAL.FMSystem.dto.DishDto;
|
||||
import com.JIAL.FMSystem.entity.Dish;
|
||||
|
||||
public interface DishService extends IService<Dish> {
|
||||
|
||||
//新增菜品,同时插入菜品对应的口味数据,需要操作两张表:dish、dish_flavor
|
||||
public void saveWithFlavor(DishDto dishDto);
|
||||
|
||||
//根据id查询菜品信息和对应的口味信息
|
||||
public DishDto getByIdWithFlavor(Long id);
|
||||
|
||||
//更新菜品信息,同时更新对应的口味信息
|
||||
public void updateWithFlavor(DishDto dishDto);
|
||||
}
|
|
@ -1,7 +0,0 @@
|
|||
package com.JIAL.FMSystem.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.JIAL.FMSystem.entity.Employee;
|
||||
|
||||
public interface EmployeeService extends IService<Employee> {
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
package com.JIAL.FMSystem.service;
|
||||
|
||||
import com.JIAL.FMSystem.entity.HearCase;
|
||||
import com.JIAL.FMSystem.entity.User;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.github.yulichang.base.MPJBaseService;
|
||||
|
||||
/**
|
||||
* @ClassName HearCaseService
|
||||
* @Description TODO
|
||||
* @Author JIAL
|
||||
* @Date 2023/12/6 14:03
|
||||
* @Version 1.0
|
||||
*/
|
||||
public interface HearCaseService extends MPJBaseService<HearCase> {
|
||||
}
|
|
@ -1,8 +0,0 @@
|
|||
package com.JIAL.FMSystem.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.JIAL.FMSystem.entity.OrderDetail;
|
||||
|
||||
public interface OrderDetailService extends IService<OrderDetail> {
|
||||
|
||||
}
|
|
@ -1,13 +0,0 @@
|
|||
package com.JIAL.FMSystem.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.JIAL.FMSystem.entity.Orders;
|
||||
|
||||
public interface OrderService extends IService<Orders> {
|
||||
|
||||
/**
|
||||
* 用户下单
|
||||
* @param orders
|
||||
*/
|
||||
public void submit(Orders orders);
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
package com.JIAL.FMSystem.service;
|
||||
|
||||
import com.JIAL.FMSystem.entity.Plaintiff;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
/**
|
||||
* @ClassName PlaintffService
|
||||
* @Description TODO
|
||||
* @Author JIAL
|
||||
* @Date 2023/12/6 16:47
|
||||
* @Version 1.0
|
||||
*/
|
||||
public interface PlaintiffService extends IService<Plaintiff> {
|
||||
}
|
|
@ -1,7 +0,0 @@
|
|||
package com.JIAL.FMSystem.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.JIAL.FMSystem.entity.SetmealDish;
|
||||
|
||||
public interface SetmealDishService extends IService<SetmealDish> {
|
||||
}
|
|
@ -1,21 +0,0 @@
|
|||
package com.JIAL.FMSystem.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.JIAL.FMSystem.dto.SetmealDto;
|
||||
import com.JIAL.FMSystem.entity.Setmeal;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface SetmealService extends IService<Setmeal> {
|
||||
/**
|
||||
* 新增套餐,同时需要保存套餐和菜品的关联关系
|
||||
* @param setmealDto
|
||||
*/
|
||||
public void saveWithDish(SetmealDto setmealDto);
|
||||
|
||||
/**
|
||||
* 删除套餐,同时需要删除套餐和菜品的关联数据
|
||||
* @param ids
|
||||
*/
|
||||
public void removeWithDish(List<Long> ids);
|
||||
}
|
|
@ -1,8 +0,0 @@
|
|||
package com.JIAL.FMSystem.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.JIAL.FMSystem.entity.ShoppingCart;
|
||||
|
||||
public interface ShoppingCartService extends IService<ShoppingCart> {
|
||||
|
||||
}
|
|
@ -1,12 +0,0 @@
|
|||
package com.JIAL.FMSystem.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.JIAL.FMSystem.entity.AddressBook;
|
||||
import com.JIAL.FMSystem.mapper.AddressBookMapper;
|
||||
import com.JIAL.FMSystem.service.AddressBookService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
public class AddressBookServiceImpl extends ServiceImpl<AddressBookMapper, AddressBook> implements AddressBookService {
|
||||
|
||||
}
|
|
@ -1,55 +0,0 @@
|
|||
package com.JIAL.FMSystem.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.JIAL.FMSystem.common.CustomException;
|
||||
import com.JIAL.FMSystem.entity.Category;
|
||||
import com.JIAL.FMSystem.entity.Dish;
|
||||
import com.JIAL.FMSystem.entity.Setmeal;
|
||||
import com.JIAL.FMSystem.mapper.CategoryMapper;
|
||||
import com.JIAL.FMSystem.service.CategoryService;
|
||||
import com.JIAL.FMSystem.service.DishService;
|
||||
import com.JIAL.FMSystem.service.SetmealService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
public class CategoryServiceImpl extends ServiceImpl<CategoryMapper,Category> implements CategoryService{
|
||||
|
||||
@Autowired
|
||||
private DishService dishService;
|
||||
|
||||
@Autowired
|
||||
private SetmealService setmealService;
|
||||
|
||||
/**
|
||||
* 根据id删除分类,删除之前需要进行判断
|
||||
* @param id
|
||||
*/
|
||||
@Override
|
||||
public void remove(Long id) {
|
||||
LambdaQueryWrapper<Dish> dishLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
//添加查询条件,根据分类id进行查询
|
||||
dishLambdaQueryWrapper.eq(Dish::getCategoryId,id);
|
||||
int count1 = dishService.count(dishLambdaQueryWrapper);
|
||||
|
||||
//查询当前分类是否关联了菜品,如果已经关联,抛出一个业务异常
|
||||
if(count1 > 0){
|
||||
//已经关联菜品,抛出一个业务异常
|
||||
throw new CustomException("当前分类下关联了菜品,不能删除");
|
||||
}
|
||||
|
||||
//查询当前分类是否关联了套餐,如果已经关联,抛出一个业务异常
|
||||
LambdaQueryWrapper<Setmeal> setmealLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
//添加查询条件,根据分类id进行查询
|
||||
setmealLambdaQueryWrapper.eq(Setmeal::getCategoryId,id);
|
||||
int count2 = setmealService.count();
|
||||
if(count2 > 0){
|
||||
//已经关联套餐,抛出一个业务异常
|
||||
throw new CustomException("当前分类下关联了套餐,不能删除");
|
||||
}
|
||||
|
||||
//正常删除分类
|
||||
super.removeById(id);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,45 @@
|
|||
package com.JIAL.FMSystem.service.impl;
|
||||
|
||||
import com.JIAL.FMSystem.entity.Defendant;
|
||||
import com.JIAL.FMSystem.entity.HearCase;
|
||||
import com.JIAL.FMSystem.mapper.DefendantMapper;
|
||||
import com.JIAL.FMSystem.mapper.HearCaseMapper;
|
||||
import com.JIAL.FMSystem.service.DefendantService;
|
||||
import com.JIAL.FMSystem.service.HearCaseService;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @ClassName DefendantServiceImpl
|
||||
* @Description TODO
|
||||
* @Author JIAL
|
||||
* @Date 2023/12/6 16:41
|
||||
* @Version 1.0
|
||||
*/
|
||||
@Service
|
||||
public class DefendantServiceImpl extends ServiceImpl<DefendantMapper, Defendant> implements DefendantService {
|
||||
|
||||
@Override
|
||||
public List<Map<Long, Object>> idAndNameUnitName(List<Long> list) {
|
||||
LambdaQueryWrapper<Defendant> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.in(Defendant::getId, list);
|
||||
|
||||
List<Defendant> resultList = this.list(queryWrapper);
|
||||
List<Map<Long, Object>> resultMapList = new ArrayList<>();
|
||||
|
||||
for(Defendant defendant : resultList) {
|
||||
Map<Long, Object> columnMap = new HashMap<>();
|
||||
columnMap.put(defendant.getId(), defendant.getUnitName());
|
||||
|
||||
resultMapList.add(columnMap);
|
||||
}
|
||||
|
||||
return resultMapList;
|
||||
}
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
package com.JIAL.FMSystem.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.JIAL.FMSystem.entity.DishFlavor;
|
||||
import com.JIAL.FMSystem.mapper.DishFlavorMapper;
|
||||
import com.JIAL.FMSystem.service.DishFlavorService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
public class DishFlavorServiceImpl extends ServiceImpl<DishFlavorMapper,DishFlavor> implements DishFlavorService {
|
||||
}
|
|
@ -1,93 +0,0 @@
|
|||
package com.JIAL.FMSystem.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.JIAL.FMSystem.dto.DishDto;
|
||||
import com.JIAL.FMSystem.entity.Dish;
|
||||
import com.JIAL.FMSystem.entity.DishFlavor;
|
||||
import com.JIAL.FMSystem.mapper.DishMapper;
|
||||
import com.JIAL.FMSystem.service.DishFlavorService;
|
||||
import com.JIAL.FMSystem.service.DishService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Service
|
||||
@Slf4j
|
||||
public class DishServiceImpl extends ServiceImpl<DishMapper,Dish> implements DishService {
|
||||
|
||||
@Autowired
|
||||
private DishFlavorService dishFlavorService;
|
||||
|
||||
/**
|
||||
* 新增菜品,同时保存对应的口味数据
|
||||
* @param dishDto
|
||||
*/
|
||||
@Transactional
|
||||
public void saveWithFlavor(DishDto dishDto) {
|
||||
//保存菜品的基本信息到菜品表dish
|
||||
this.save(dishDto);
|
||||
|
||||
Long dishId = dishDto.getId();//菜品id
|
||||
|
||||
//菜品口味
|
||||
List<DishFlavor> flavors = dishDto.getFlavors();
|
||||
flavors = flavors.stream().map((item) -> {
|
||||
item.setDishId(dishId);
|
||||
return item;
|
||||
}).collect(Collectors.toList());
|
||||
|
||||
//保存菜品口味数据到菜品口味表dish_flavor
|
||||
dishFlavorService.saveBatch(flavors);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据id查询菜品信息和对应的口味信息
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
public DishDto getByIdWithFlavor(Long id) {
|
||||
//查询菜品基本信息,从dish表查询
|
||||
Dish dish = this.getById(id);
|
||||
|
||||
DishDto dishDto = new DishDto();
|
||||
BeanUtils.copyProperties(dish,dishDto);
|
||||
|
||||
//查询当前菜品对应的口味信息,从dish_flavor表查询
|
||||
LambdaQueryWrapper<DishFlavor> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(DishFlavor::getDishId,dish.getId());
|
||||
List<DishFlavor> flavors = dishFlavorService.list(queryWrapper);
|
||||
dishDto.setFlavors(flavors);
|
||||
|
||||
return dishDto;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public void updateWithFlavor(DishDto dishDto) {
|
||||
//更新dish表基本信息
|
||||
this.updateById(dishDto);
|
||||
|
||||
//清理当前菜品对应口味数据---dish_flavor表的delete操作
|
||||
LambdaQueryWrapper<DishFlavor> queryWrapper = new LambdaQueryWrapper();
|
||||
queryWrapper.eq(DishFlavor::getDishId,dishDto.getId());
|
||||
|
||||
dishFlavorService.remove(queryWrapper);
|
||||
|
||||
//添加当前提交过来的口味数据---dish_flavor表的insert操作
|
||||
List<DishFlavor> flavors = dishDto.getFlavors();
|
||||
|
||||
flavors = flavors.stream().map((item) -> {
|
||||
item.setDishId(dishDto.getId());
|
||||
return item;
|
||||
}).collect(Collectors.toList());
|
||||
|
||||
dishFlavorService.saveBatch(flavors);
|
||||
}
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
package com.JIAL.FMSystem.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.JIAL.FMSystem.entity.Employee;
|
||||
import com.JIAL.FMSystem.mapper.EmployeeMapper;
|
||||
import com.JIAL.FMSystem.service.EmployeeService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
public class EmployeeServiceImpl extends ServiceImpl<EmployeeMapper,Employee> implements EmployeeService{
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
package com.JIAL.FMSystem.service.impl;
|
||||
|
||||
import com.JIAL.FMSystem.entity.HearCase;
|
||||
import com.JIAL.FMSystem.entity.User;
|
||||
import com.JIAL.FMSystem.mapper.HearCaseMapper;
|
||||
import com.JIAL.FMSystem.mapper.UserMapper;
|
||||
import com.JIAL.FMSystem.service.HearCaseService;
|
||||
import com.JIAL.FMSystem.service.UserService;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.github.yulichang.base.MPJBaseServiceImpl;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* @ClassName HearCaseServiceImpl
|
||||
* @Description TODO
|
||||
* @Author JIAL
|
||||
* @Date 2023/12/6 14:02
|
||||
* @Version 1.0
|
||||
*/
|
||||
@Service
|
||||
public class HearCaseServiceImpl extends MPJBaseServiceImpl<HearCaseMapper, HearCase> implements HearCaseService {
|
||||
}
|
|
@ -1,12 +0,0 @@
|
|||
package com.JIAL.FMSystem.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.JIAL.FMSystem.entity.OrderDetail;
|
||||
import com.JIAL.FMSystem.mapper.OrderDetailMapper;
|
||||
import com.JIAL.FMSystem.service.OrderDetailService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
public class OrderDetailServiceImpl extends ServiceImpl<OrderDetailMapper, OrderDetail> implements OrderDetailService {
|
||||
|
||||
}
|
|
@ -1,108 +0,0 @@
|
|||
package com.JIAL.FMSystem.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.JIAL.FMSystem.common.BaseContext;
|
||||
import com.JIAL.FMSystem.common.CustomException;
|
||||
import com.JIAL.FMSystem.entity.*;
|
||||
import com.JIAL.FMSystem.mapper.OrderMapper;
|
||||
import com.JIAL.FMSystem.service.*;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Service
|
||||
@Slf4j
|
||||
public class OrderServiceImpl extends ServiceImpl<OrderMapper, Orders> implements OrderService {
|
||||
|
||||
@Autowired
|
||||
private ShoppingCartService shoppingCartService;
|
||||
|
||||
@Autowired
|
||||
private UserService userService;
|
||||
|
||||
@Autowired
|
||||
private AddressBookService addressBookService;
|
||||
|
||||
@Autowired
|
||||
private OrderDetailService orderDetailService;
|
||||
|
||||
/**
|
||||
* 用户下单
|
||||
* @param orders
|
||||
*/
|
||||
@Transactional
|
||||
public void submit(Orders orders) {
|
||||
//获得当前用户id
|
||||
Long userId = BaseContext.getCurrentId();
|
||||
|
||||
//查询当前用户的购物车数据
|
||||
LambdaQueryWrapper<ShoppingCart> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(ShoppingCart::getUserId,userId);
|
||||
List<ShoppingCart> shoppingCarts = shoppingCartService.list(wrapper);
|
||||
|
||||
if(shoppingCarts == null || shoppingCarts.size() == 0){
|
||||
throw new CustomException("购物车为空,不能下单");
|
||||
}
|
||||
|
||||
//查询用户数据
|
||||
User user = userService.getById(userId);
|
||||
|
||||
//查询地址数据
|
||||
Long addressBookId = orders.getAddressBookId();
|
||||
AddressBook addressBook = addressBookService.getById(addressBookId);
|
||||
if(addressBook == null){
|
||||
throw new CustomException("用户地址信息有误,不能下单");
|
||||
}
|
||||
|
||||
long orderId = IdWorker.getId();//订单号
|
||||
|
||||
AtomicInteger amount = new AtomicInteger(0);
|
||||
|
||||
List<OrderDetail> orderDetails = shoppingCarts.stream().map((item) -> {
|
||||
OrderDetail orderDetail = new OrderDetail();
|
||||
orderDetail.setOrderId(orderId);
|
||||
orderDetail.setNumber(item.getNumber());
|
||||
orderDetail.setDishFlavor(item.getDishFlavor());
|
||||
orderDetail.setDishId(item.getDishId());
|
||||
orderDetail.setSetmealId(item.getSetmealId());
|
||||
orderDetail.setName(item.getName());
|
||||
orderDetail.setImage(item.getImage());
|
||||
orderDetail.setAmount(item.getAmount());
|
||||
amount.addAndGet(item.getAmount().multiply(new BigDecimal(item.getNumber())).intValue());
|
||||
return orderDetail;
|
||||
}).collect(Collectors.toList());
|
||||
|
||||
|
||||
orders.setId(orderId);
|
||||
orders.setOrderTime(LocalDateTime.now());
|
||||
orders.setCheckoutTime(LocalDateTime.now());
|
||||
orders.setStatus(2);
|
||||
orders.setAmount(new BigDecimal(amount.get()));//总金额
|
||||
orders.setUserId(userId);
|
||||
orders.setNumber(String.valueOf(orderId));
|
||||
orders.setUserName(user.getName());
|
||||
orders.setConsignee(addressBook.getConsignee());
|
||||
orders.setPhone(addressBook.getPhone());
|
||||
orders.setAddress((addressBook.getProvinceName() == null ? "" : addressBook.getProvinceName())
|
||||
+ (addressBook.getCityName() == null ? "" : addressBook.getCityName())
|
||||
+ (addressBook.getDistrictName() == null ? "" : addressBook.getDistrictName())
|
||||
+ (addressBook.getDetail() == null ? "" : addressBook.getDetail()));
|
||||
//向订单表插入数据,一条数据
|
||||
this.save(orders);
|
||||
|
||||
//向订单明细表插入数据,多条数据
|
||||
orderDetailService.saveBatch(orderDetails);
|
||||
|
||||
//清空购物车数据
|
||||
shoppingCartService.remove(wrapper);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,18 @@
|
|||
package com.JIAL.FMSystem.service.impl;
|
||||
|
||||
import com.JIAL.FMSystem.entity.Plaintiff;
|
||||
import com.JIAL.FMSystem.mapper.PlaintiffMapper;
|
||||
import com.JIAL.FMSystem.service.PlaintiffService;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* @ClassName PlaintiffServiceImpl
|
||||
* @Description TODO
|
||||
* @Author JIAL
|
||||
* @Date 2023/12/6 16:49
|
||||
* @Version 1.0
|
||||
*/
|
||||
@Service
|
||||
public class PlaintiffServiceImpl extends ServiceImpl<PlaintiffMapper, Plaintiff> implements PlaintiffService {
|
||||
}
|
|
@ -1,13 +0,0 @@
|
|||
package com.JIAL.FMSystem.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.JIAL.FMSystem.entity.SetmealDish;
|
||||
import com.JIAL.FMSystem.mapper.SetmealDishMapper;
|
||||
import com.JIAL.FMSystem.service.SetmealDishService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
@Slf4j
|
||||
public class SetmealDishServiceImpl extends ServiceImpl<SetmealDishMapper,SetmealDish> implements SetmealDishService {
|
||||
}
|
|
@ -1,73 +0,0 @@
|
|||
package com.JIAL.FMSystem.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.JIAL.FMSystem.common.CustomException;
|
||||
import com.JIAL.FMSystem.dto.SetmealDto;
|
||||
import com.JIAL.FMSystem.entity.Setmeal;
|
||||
import com.JIAL.FMSystem.entity.SetmealDish;
|
||||
import com.JIAL.FMSystem.mapper.SetmealMapper;
|
||||
import com.JIAL.FMSystem.service.SetmealDishService;
|
||||
import com.JIAL.FMSystem.service.SetmealService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Service
|
||||
@Slf4j
|
||||
public class SetmealServiceImpl extends ServiceImpl<SetmealMapper,Setmeal> implements SetmealService {
|
||||
|
||||
@Autowired
|
||||
private SetmealDishService setmealDishService;
|
||||
|
||||
/**
|
||||
* 新增套餐,同时需要保存套餐和菜品的关联关系
|
||||
* @param setmealDto
|
||||
*/
|
||||
@Transactional
|
||||
public void saveWithDish(SetmealDto setmealDto) {
|
||||
//保存套餐的基本信息,操作setmeal,执行insert操作
|
||||
this.save(setmealDto);
|
||||
|
||||
List<SetmealDish> setmealDishes = setmealDto.getSetmealDishes();
|
||||
setmealDishes.stream().map((item) -> {
|
||||
item.setSetmealId(setmealDto.getId());
|
||||
return item;
|
||||
}).collect(Collectors.toList());
|
||||
|
||||
//保存套餐和菜品的关联信息,操作setmeal_dish,执行insert操作
|
||||
setmealDishService.saveBatch(setmealDishes);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除套餐,同时需要删除套餐和菜品的关联数据
|
||||
* @param ids
|
||||
*/
|
||||
@Transactional
|
||||
public void removeWithDish(List<Long> ids) {
|
||||
//select count(*) from setmeal where id in (1,2,3) and status = 1
|
||||
//查询套餐状态,确定是否可用删除
|
||||
LambdaQueryWrapper<Setmeal> queryWrapper = new LambdaQueryWrapper();
|
||||
queryWrapper.in(Setmeal::getId,ids);
|
||||
queryWrapper.eq(Setmeal::getStatus,1);
|
||||
|
||||
int count = this.count(queryWrapper);
|
||||
if(count > 0){
|
||||
//如果不能删除,抛出一个业务异常
|
||||
throw new CustomException("套餐正在售卖中,不能删除");
|
||||
}
|
||||
|
||||
//如果可以删除,先删除套餐表中的数据---setmeal
|
||||
this.removeByIds(ids);
|
||||
|
||||
//delete from setmeal_dish where setmeal_id in (1,2,3)
|
||||
LambdaQueryWrapper<SetmealDish> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.in(SetmealDish::getSetmealId,ids);
|
||||
//删除关系表中的数据----setmeal_dish
|
||||
setmealDishService.remove(lambdaQueryWrapper);
|
||||
}
|
||||
}
|
|
@ -1,12 +0,0 @@
|
|||
package com.JIAL.FMSystem.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.JIAL.FMSystem.entity.ShoppingCart;
|
||||
import com.JIAL.FMSystem.mapper.ShoppingCartMapper;
|
||||
import com.JIAL.FMSystem.service.ShoppingCartService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
public class ShoppingCartServiceImpl extends ServiceImpl<ShoppingCartMapper, ShoppingCart> implements ShoppingCartService {
|
||||
|
||||
}
|
|
@ -3,11 +3,11 @@ server:
|
|||
spring:
|
||||
application:
|
||||
#应用的名称,可选
|
||||
name: reggie_take_out
|
||||
name: FWDev
|
||||
datasource:
|
||||
druid:
|
||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
url: jdbc:mysql://localhost:3306/reggie?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowPublicKeyRetrieval=true
|
||||
url: jdbc:mysql://localhost:3306/fwsystem?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowPublicKeyRetrieval=true
|
||||
username: root
|
||||
password: 123456
|
||||
mybatis-plus:
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
// 查询列表接口
|
||||
const getHearCasePage = (params) => {
|
||||
return $axios({
|
||||
url: '/hearCase/page',
|
||||
method: 'get',
|
||||
params
|
||||
})
|
||||
}
|
|
@ -1,6 +1,6 @@
|
|||
function loginApi(data) {
|
||||
return $axios({
|
||||
'url': '/employee/login',
|
||||
'url': '/user/login',
|
||||
'method': 'post',
|
||||
data
|
||||
})
|
||||
|
@ -8,7 +8,7 @@ function loginApi(data) {
|
|||
|
||||
function logoutApi(){
|
||||
return $axios({
|
||||
'url': '/employee/logout',
|
||||
'url': '/user/logout',
|
||||
'method': 'post',
|
||||
})
|
||||
}
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
function getMemberList (params) {
|
||||
return $axios({
|
||||
url: '/employee/page',
|
||||
url: '/user/page',
|
||||
method: 'get',
|
||||
params
|
||||
})
|
||||
}
|
||||
|
||||
// 修改---启用禁用接口
|
||||
function enableOrDisableEmployee (params) {
|
||||
function enableOrDisableUser (params) {
|
||||
return $axios({
|
||||
url: '/employee',
|
||||
url: '/user',
|
||||
method: 'put',
|
||||
data: { ...params }
|
||||
})
|
||||
|
@ -18,16 +18,16 @@ function enableOrDisableEmployee (params) {
|
|||
// 新增---添加员工
|
||||
function addEmployee (params) {
|
||||
return $axios({
|
||||
url: '/employee',
|
||||
url: '/user',
|
||||
method: 'post',
|
||||
data: { ...params }
|
||||
})
|
||||
}
|
||||
|
||||
// 修改---添加员工
|
||||
function editEmployee (params) {
|
||||
function editUser (params) {
|
||||
return $axios({
|
||||
url: '/employee',
|
||||
url: '/user',
|
||||
method: 'put',
|
||||
data: { ...params }
|
||||
})
|
||||
|
@ -36,7 +36,7 @@ function editEmployee (params) {
|
|||
// 修改页面反查详情接口
|
||||
function queryEmployeeById (id) {
|
||||
return $axios({
|
||||
url: `/employee/${id}`,
|
||||
url: `/user/${id}`,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
|
@ -158,7 +158,7 @@
|
|||
{
|
||||
id: '7',
|
||||
name: '案件列表',
|
||||
url: 'page/legal/list.html',
|
||||
url: 'page/hearCase/list.html',
|
||||
icon: 'icon-category'
|
||||
},
|
||||
/* {
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
<link rel="stylesheet" href="../../styles/page.css" />
|
||||
</head>
|
||||
<body>
|
||||
<div class="dashboard-container" id="food-app">
|
||||
<div class="dashboard-container" id="hearCase-app">
|
||||
<div class="container">
|
||||
<div class="tableBar">
|
||||
<el-input
|
||||
|
@ -63,30 +63,36 @@
|
|||
width="25"
|
||||
></el-table-column>
|
||||
<el-table-column
|
||||
prop="name"
|
||||
label="案号"
|
||||
prop="caseNum"
|
||||
label="案件号"
|
||||
></el-table-column>
|
||||
<el-table-column
|
||||
prop="name"
|
||||
label="申请人"
|
||||
prop="plaintiffName"
|
||||
label="原告"
|
||||
></el-table-column>
|
||||
<el-table-column
|
||||
prop="categoryName"
|
||||
label="申请时间"
|
||||
prop="defendantName"
|
||||
label="被告"
|
||||
></el-table-column>
|
||||
<el-table-column label="当前状态">
|
||||
<el-table-column
|
||||
prop="court"
|
||||
label="法院名称"
|
||||
></el-table-column>
|
||||
<el-table-column label="案件状态">
|
||||
<template slot-scope="scope">
|
||||
<span style="margin-right: 10px;">¥{{ scope.row.price/100 }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="受理法院">
|
||||
<template slot-scope="scope">
|
||||
<span style="margin-right: 10px;">{{ scope.row.status == '0' ? '停售' : '启售' }}</span>
|
||||
<span style="margin-right: 10px;">
|
||||
{{
|
||||
String(scope.row.caseStatus) === '1' ? '已开庭' :
|
||||
String(scope.row.caseStatus) === '2' ? '已执行' :
|
||||
String(scope.row.caseStatus) === '3' ? '已结案' :
|
||||
其他
|
||||
}}
|
||||
</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
prop="updateTime"
|
||||
label="最后操作时间"
|
||||
prop="trialTime"
|
||||
label="开庭时间"
|
||||
>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
|
@ -142,9 +148,10 @@
|
|||
<script src="../../plugins/axios/axios.min.js"></script>
|
||||
<script src="../../js/request.js"></script>
|
||||
<script src="../../api/food.js"></script>
|
||||
<script src="../../api/hearCase.js"></script>
|
||||
<script>
|
||||
new Vue({
|
||||
el: '#food-app',
|
||||
el: '#hearCase-app',
|
||||
data() {
|
||||
return {
|
||||
input: '',
|
||||
|
@ -169,7 +176,7 @@
|
|||
pageSize: this.pageSize,
|
||||
name: this.input ? this.input : undefined
|
||||
}
|
||||
await getDishPage(params).then(res => {
|
||||
await getHearCasePage(params).then(res => {
|
||||
if (String(res.code) === '1') {
|
||||
this.tableData = res.data.records || []
|
||||
this.counts = res.data.total
|
|
@ -108,7 +108,7 @@
|
|||
ruleForm : {
|
||||
'name': '',
|
||||
'phone': '',
|
||||
'admin': '是',
|
||||
'admin': '否',
|
||||
'password': '',
|
||||
username: ''
|
||||
}
|
||||
|
@ -188,7 +188,7 @@
|
|||
...this.ruleForm,
|
||||
admin: this.ruleForm.admin === '否' ? '0' : '1'
|
||||
}
|
||||
editEmployee(params).then(res => {
|
||||
editUser(params).then(res => {
|
||||
console.log(res.toString());
|
||||
if (res.code === 1) {
|
||||
var vm = this;
|
||||
|
|
|
@ -179,8 +179,8 @@
|
|||
'cancelButtonText': '取消',
|
||||
'type': 'warning'
|
||||
}).then(() => {
|
||||
enableOrDisableEmployee({ 'id': this.id, 'status': !this.status ? 1 : 0 }).then(res => {
|
||||
console.log('enableOrDisableEmployee',res)
|
||||
enableOrDisableUser({ 'id': this.id, 'status': !this.status ? 1 : 0 }).then(res => {
|
||||
console.log('enableOrDisableUser',res)
|
||||
if (String(res.code) === '1') {
|
||||
this.$message.success('账号状态更改成功!')
|
||||
this.handleQuery()
|
||||
|
|
|
@ -0,0 +1,67 @@
|
|||
//获取所有地址
|
||||
function addressListApi() {
|
||||
return $axios({
|
||||
'url': '/addressBook/list',
|
||||
'method': 'get',
|
||||
})
|
||||
}
|
||||
|
||||
//获取最新地址
|
||||
function addressLastUpdateApi() {
|
||||
return $axios({
|
||||
'url': '/addressBook/lastUpdate',
|
||||
'method': 'get',
|
||||
})
|
||||
}
|
||||
|
||||
//新增地址
|
||||
function addAddressApi(data){
|
||||
return $axios({
|
||||
'url': '/addressBook',
|
||||
'method': 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
//修改地址
|
||||
function updateAddressApi(data){
|
||||
return $axios({
|
||||
'url': '/addressBook',
|
||||
'method': 'put',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
//删除地址
|
||||
function deleteAddressApi(params) {
|
||||
return $axios({
|
||||
'url': '/addressBook',
|
||||
'method': 'delete',
|
||||
params
|
||||
})
|
||||
}
|
||||
|
||||
//查询单个地址
|
||||
function addressFindOneApi(id) {
|
||||
return $axios({
|
||||
'url': `/addressBook/${id}`,
|
||||
'method': 'get',
|
||||
})
|
||||
}
|
||||
|
||||
//设置默认地址
|
||||
function setDefaultAddressApi(data){
|
||||
return $axios({
|
||||
'url': '/addressBook/default',
|
||||
'method': 'put',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
//获取默认地址
|
||||
function getDefaultAddressApi() {
|
||||
return $axios({
|
||||
'url': `/addressBook/default`,
|
||||
'method': 'get',
|
||||
})
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
function loginApi(data) {
|
||||
return $axios({
|
||||
'url': '/user/login',
|
||||
'method': 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
function loginoutApi() {
|
||||
return $axios({
|
||||
'url': '/user/loginout',
|
||||
'method': 'post',
|
||||
})
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,70 @@
|
|||
//获取所有的菜品分类
|
||||
function categoryListApi() {
|
||||
return $axios({
|
||||
'url': '/category/list',
|
||||
'method': 'get',
|
||||
})
|
||||
}
|
||||
|
||||
//获取菜品分类对应的菜品
|
||||
function dishListApi(data) {
|
||||
return $axios({
|
||||
'url': '/dish/list',
|
||||
'method': 'get',
|
||||
params:{...data}
|
||||
})
|
||||
}
|
||||
|
||||
//获取菜品分类对应的套餐
|
||||
function setmealListApi(data) {
|
||||
return $axios({
|
||||
'url': '/setmeal/list',
|
||||
'method': 'get',
|
||||
params:{...data}
|
||||
})
|
||||
}
|
||||
|
||||
//获取购物车内商品的集合
|
||||
function cartListApi(data) {
|
||||
return $axios({
|
||||
'url': '/shoppingCart/list',
|
||||
'method': 'get',
|
||||
params:{...data}
|
||||
})
|
||||
}
|
||||
|
||||
//购物车中添加商品
|
||||
function addCartApi(data){
|
||||
return $axios({
|
||||
'url': '/shoppingCart/add',
|
||||
'method': 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
//购物车中修改商品
|
||||
function updateCartApi(data){
|
||||
return $axios({
|
||||
'url': '/shoppingCart/sub',
|
||||
'method': 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
//删除购物车的商品
|
||||
function clearCartApi() {
|
||||
return $axios({
|
||||
'url': '/shoppingCart/clean',
|
||||
'method': 'delete',
|
||||
})
|
||||
}
|
||||
|
||||
//获取套餐的全部菜品
|
||||
function setMealDishDetailsApi(id) {
|
||||
return $axios({
|
||||
'url': `/setmeal/dish/${id}`,
|
||||
'method': 'get',
|
||||
})
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
//提交订单
|
||||
function addOrderApi(data){
|
||||
return $axios({
|
||||
'url': '/order/submit',
|
||||
'method': 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
//查询所有订单
|
||||
function orderListApi() {
|
||||
return $axios({
|
||||
'url': '/order/list',
|
||||
'method': 'get',
|
||||
})
|
||||
}
|
||||
|
||||
//分页查询订单
|
||||
function orderPagingApi(data) {
|
||||
return $axios({
|
||||
'url': '/order/userPage',
|
||||
'method': 'get',
|
||||
params:{...data}
|
||||
})
|
||||
}
|
||||
|
||||
//再来一单
|
||||
function orderAgainApi(data) {
|
||||
return $axios({
|
||||
'url': '/order/again',
|
||||
'method': 'post',
|
||||
data
|
||||
})
|
||||
}
|
After Width: | Height: | Size: 1016 B |
After Width: | Height: | Size: 12 KiB |
After Width: | Height: | Size: 14 KiB |
After Width: | Height: | Size: 931 B |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 2.6 KiB |
After Width: | Height: | Size: 57 KiB |
After Width: | Height: | Size: 66 KiB |