【计算机毕业设计】高校食堂订餐系统

编程入门 行业动态 更新时间:2024-10-24 11:14:34

【计算机<a href=https://www.elefans.com/category/jswz/34/1770099.html style=毕业设计】高校食堂订餐系统"/>

【计算机毕业设计】高校食堂订餐系统

高校食堂订餐系统设计与实现
现代经济快节奏发展以及不断完善升级的信息化技术,让传统数据信息的管理升级为软件存储,归纳,集中处理数据信息的管理方式。本高校食堂订餐系统就是在这样的大环境下诞生,其可以帮助管理者在短时间内处理完毕庞大的数据信息,使用这种软件工具可以帮助管理人员提高事务处理效率,达到事半功倍的效果。此高校食堂订餐系统利用当下成熟完善的SSM框架,使用跨平台的可开发大型商业网站的Java语言,以及最受欢迎的RDBMS应用软件之一的Mysql数据库进行程序开发。实现了菜品基础数据的管理,菜品收藏,菜品评价,基础数据,公告信息的发布等功能。高校食堂订餐系统的开发根据操作人员需要设计的界面简洁美观,在功能模块布局上跟同类型网站保持一致,程序在实现基本要求功能时,也为数据信息面临的安全问题提供了一些实用的解决方案。可以说该程序在帮助管理者高效率地处理工作事务的同时,也实现了数据信息的整体化,规范化与自动化。
Java SSM高校食堂订餐系统,后端基于SSM框架进行开发,前端页面效果通过使用JSP进行编码实现,主要将实现学生跟管理员角色,实现了菜品管理、基础数据管理等功能。






<project xmlns=".0.0" xmlns:xsi=""xsi:schemaLocation=".0.0 .xsd"><modelVersion>4.0.0</modelVersion><groupId>com.jlwl</groupId><artifactId>gaoxiaoshitangdingcanxitong</artifactId><packaging>war</packaging><version>1.0-SNAPSHOT</version><properties><project.build.sourceEncoding>UTF-8</project.build.sourceEncoding><spring.version>5.0.0.RELEASE</spring.version><junit.version>4.12</junit.version><druid.version>1.1.0</druid.version><fastjson.version>1.2.8</fastjson.version><mybaitsplus.version>2.3</mybaitsplus.version><mysql.version>5.1.38</mysql.version><log4j.version>1.2.17</log4j.version><slf4j.version>1.7.19</slf4j.version><aspectjweaver.version>1.8.8</aspectjweaver.version><fileupload.version>1.3.1</fileupload.version><jstl.version>1.2</jstl.version></properties><dependencies><!-- JUnit --><dependency><groupId>junit</groupId><artifactId>junit</artifactId><version>${junit.version}</version><scope>test</scope></dependency><!-- Spring --><dependency><groupId>org.springframework</groupId><artifactId>spring-core</artifactId><version>${spring.version}</version><type>jar</type><scope>compile</scope></dependency><dependency><groupId>org.springframework</groupId><artifactId>spring-context</artifactId><version>${spring.version}</version><type>jar</type><scope>compile</scope></dependency><dependency><groupId>org.springframework</groupId><artifactId>spring-context-support</artifactId><version>${spring.version}</version><type>jar</type><scope>compile</scope></dependency><dependency><groupId>org.springframework</groupId><artifactId>spring-tx</artifactId><version>${spring.version}</version><type>jar</type><scope>compile</scope></dependency><dependency><groupId>org.springframework</groupId><artifactId>spring-aop</artifactId><version>${spring.version}</version><type>jar</type><scope>compile</scope></dependency><dependency><groupId>org.springframework</groupId><artifactId>spring-beans</artifactId><version>${spring.version}</version><type>jar</type><scope>compile</scope></dependency><dependency><groupId>org.springframework</groupId><artifactId>spring-jdbc</artifactId><version>${spring.version}</version><type>jar</type><scope>compile</scope></dependency><!-- Spring MVC --><dependency><groupId>org.springframework</groupId><artifactId>spring-web</artifactId><version>${spring.version}</version><type>jar</type><scope>compile</scope></dependency><dependency><groupId>org.springframework</groupId><artifactId>spring-webmvc</artifactId><version>${spring.version}</version><type>jar</type><scope>compile</scope></dependency><!-- AOP --><dependency><groupId>org.aspectj</groupId><artifactId>aspectjweaver</artifactId><version>${aspectjweaver.version}</version></dependency><!-- FileUpload --><dependency><groupId>commons-fileupload</groupId><artifactId>commons-fileupload</artifactId><version>${fileupload.version}</version></dependency><dependency><groupId>javax.servlet</groupId><artifactId>jstl</artifactId><version>${jstl.version}</version></dependency><!-- Mybatis-Plus --><dependency><groupId>com.baomidou</groupId><artifactId>mybatis-plus</artifactId><version>${mybaitsplus.version}</version></dependency><!-- Mysql --><dependency><groupId>mysql</groupId><artifactId>mysql-connector-java</artifactId><version>${mysql.version}</version></dependency><!-- Druid --><dependency><groupId>com.alibaba</groupId><artifactId>druid</artifactId><version>${druid.version}</version></dependency><!-- FastJson --><dependency><groupId>com.alibaba</groupId><artifactId>fastjson</artifactId><version>${fastjson.version}</version></dependency><!-- Log --><dependency><groupId>log4j</groupId><artifactId>log4j</artifactId><version>${log4j.version}</version></dependency><dependency><groupId>org.slf4j</groupId><artifactId>slf4j-api</artifactId><version>${slf4j.version}</version></dependency><dependency><groupId>org.slf4j</groupId><artifactId>slf4j-log4j12</artifactId><version>${slf4j.version}</version></dependency><dependency><groupId>org.springframework</groupId><artifactId>spring-test</artifactId><version>${spring.version}</version></dependency><dependency><groupId>org.apachemons</groupId><artifactId>commons-lang3</artifactId><version>3.0</version></dependency><dependency><groupId>javax.validation</groupId><artifactId>validation-api</artifactId><version>2.0.1.Final</version></dependency><dependency><groupId>commons-io</groupId><artifactId>commons-io</artifactId><version>2.5</version></dependency><dependency><groupId>cn.hutool</groupId><artifactId>hutool-all</artifactId><version>4.0.12</version></dependency><!-- .apache.tomcat.embed/tomcat-embed-core --><dependency><groupId>org.apache.tomcat.embed</groupId><artifactId>tomcat-embed-core</artifactId><version>9.0.29</version></dependency><!--  --><dependency><groupId>commons-beanutils</groupId><artifactId>commons-beanutils</artifactId><version>1.8.0</version></dependency><!-- .fasterxml.jackson.core/jackson-annotations --><dependency><groupId>com.fasterxml.jackson.core</groupId><artifactId>jackson-annotations</artifactId><version>2.10.1</version></dependency><dependency><groupId>com.fasterxml.jackson.core</groupId><artifactId>jackson-databind</artifactId><version>2.10.1</version></dependency><dependency><groupId>org.codehaus.jackson</groupId><artifactId>jackson-mapper-asl</artifactId><version>1.9.13</version></dependency><!-- .servlet.jsp/jsp-api --><dependency><groupId>javax.servlet.jsp</groupId><artifactId>jsp-api</artifactId><version>2.1</version><scope>provided</scope></dependency><!-- 百度人工智能 --><dependency><groupId>com.baidu.aip</groupId><artifactId>java-sdk</artifactId><version>4.4.1</version></dependency><!-- .apache.tomcat.embed/tomcat-embed-jasper --><dependency><groupId>org.apache.tomcat.embed</groupId><artifactId>tomcat-embed-jasper</artifactId><version>9.0.27</version><scope>provided</scope></dependency><dependency><groupId>org.hibernate</groupId><artifactId>hibernate-validator</artifactId><version>5.2.4.Final</version></dependency><!-- 导入导出excel --><dependency><groupId>org.apache.poi</groupId><artifactId>poi-scratchpad</artifactId><version>3.11-beta2</version></dependency><dependency><groupId>org.apache.poi</groupId><artifactId>poi-ooxml</artifactId><version>3.11-beta2</version></dependency><dependency><groupId>org.apache.poi</groupId><artifactId>poi-ooxml-schemas</artifactId><version>3.11-beta2</version></dependency><dependency><groupId>org.apache.poi</groupId><artifactId>poi-excelant</artifactId><version>3.11-beta2</version></dependency></dependencies><build><!-- 项目访问名称 --><finalName>gaoxiaoshitangdingcanxitong</finalName><plugins><plugin><groupId>org.apache.maven.plugins</groupId><artifactId>maven-compiler-plugin</artifactId><configuration><source>1.7</source><target>1.7</target></configuration></plugin></plugins></build>
</project>
package com.controller;import java.text.SimpleDateFormat;
import com.alibaba.fastjson.JSONObject;
import java.util.*;
import org.springframework.beans.BeanUtils;
import javax.servlet.http.HttpServletRequest;
import org.springframework.web.context.ContextLoader;
import javax.servlet.ServletContext;
import com.service.TokenService;
import com.utils.StringUtil;
import java.lang.reflect.InvocationTargetException;import com.service.DictionaryService;
import org.apachemons.lang3.StringUtils;
import com.annotation.IgnoreAuth;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.mapper.Wrapper;import com.entity.CaipinLiuyanEntity;import com.service.CaipinLiuyanService;
import com.entity.view.CaipinLiuyanView;
import com.service.CaipinService;
import com.entity.CaipinEntity;
import com.service.YonghuService;
import com.entity.YonghuEntity;import com.utils.PageUtils;
import com.utils.R;/*** 菜品评价* 后端接口* @author* @email* @date 2021-04-15
*/
@RestController
@Controller
@RequestMapping("/caipinLiuyan")
public class CaipinLiuyanController {private static final Logger logger = LoggerFactory.getLogger(CaipinLiuyanController.class);@Autowiredprivate CaipinLiuyanService caipinLiuyanService;@Autowiredprivate TokenService tokenService;@Autowiredprivate DictionaryService dictionaryService;//级联表service@Autowiredprivate CaipinService caipinService;@Autowiredprivate YonghuService yonghuService;/*** 后端列表*/@RequestMapping("/page")public R page(@RequestParam Map<String, Object> params, HttpServletRequest request){logger.debug("page方法:,,Controller:{},,params:{}",this.getClass().getName(),JSONObject.toJSONString(params));String role = String.valueOf(request.getSession().getAttribute("role"));if(StringUtil.isNotEmpty(role) && "用户".equals(role)){params.put("yonghuId",request.getSession().getAttribute("userId"));}params.put("orderBy","id");PageUtils page = caipinLiuyanService.queryPage(params);//字典表数据转换List<CaipinLiuyanView> list =(List<CaipinLiuyanView>)page.getList();for(CaipinLiuyanView c:list){//修改对应字典表字段dictionaryService.dictionaryConvert(c);}return R.ok().put("data", page);}/*** 后端详情*/@RequestMapping("/info/{id}")public R info(@PathVariable("id") Long id){logger.debug("info方法:,,Controller:{},,id:{}",this.getClass().getName(),id);CaipinLiuyanEntity caipinLiuyan = caipinLiuyanService.selectById(id);if(caipinLiuyan !=null){//entity转viewCaipinLiuyanView view = new CaipinLiuyanView();BeanUtils.copyProperties( caipinLiuyan , view );//把实体数据重构到view中//级联表CaipinEntity caipin = caipinService.selectById(caipinLiuyan.getCaipinId());if(caipin != null){BeanUtils.copyProperties( caipin , view ,new String[]{ "id", "createDate"});//把级联的数据添加到view中,并排除id和创建时间字段view.setCaipinId(caipin.getId());}//级联表YonghuEntity yonghu = yonghuService.selectById(caipinLiuyan.getYonghuId());if(yonghu != null){BeanUtils.copyProperties( yonghu , view ,new String[]{ "id", "createDate"});//把级联的数据添加到view中,并排除id和创建时间字段view.setYonghuId(yonghu.getId());}//修改对应字典表字段dictionaryService.dictionaryConvert(view);return R.ok().put("data", view);}else {return R.error(511,"查不到数据");}}/*** 后端保存*/@RequestMapping("/save")public R save(@RequestBody CaipinLiuyanEntity caipinLiuyan, HttpServletRequest request){logger.debug("save方法:,,Controller:{},,caipinLiuyan:{}",this.getClass().getName(),caipinLiuyan.toString());caipinLiuyan.setInsertTime(new Date());caipinLiuyan.setCreateTime(new Date());caipinLiuyanService.insert(caipinLiuyan);return R.ok();}/*** 后端修改*/@RequestMapping("/update")public R update(@RequestBody CaipinLiuyanEntity caipinLiuyan, HttpServletRequest request){logger.debug("update方法:,,Controller:{},,caipinLiuyan:{}",this.getClass().getName(),caipinLiuyan.toString());caipinLiuyanService.updateById(caipinLiuyan);//根据id更新return R.ok();}/*** 删除*/@RequestMapping("/delete")public R delete(@RequestBody Integer[] ids){logger.debug("delete:,,Controller:{},,ids:{}",this.getClass().getName(),ids.toString());caipinLiuyanService.deleteBatchIds(Arrays.asList(ids));return R.ok();}/*** 前端列表*/@RequestMapping("/list")public R list(@RequestParam Map<String, Object> params, HttpServletRequest request){logger.debug("page方法:,,Controller:{},,params:{}",this.getClass().getName(),JSONObject.toJSONString(params));String role = String.valueOf(request.getSession().getAttribute("role"));if(StringUtil.isNotEmpty(role) && "用户".equals(role)){params.put("yonghuId",request.getSession().getAttribute("userId"));}// 没有指定排序字段就默认id倒序if(StringUtil.isEmpty(String.valueOf(params.get("orderBy")))){params.put("orderBy","id");}PageUtils page = caipinLiuyanService.queryPage(params);//字典表数据转换List<CaipinLiuyanView> list =(List<CaipinLiuyanView>)page.getList();for(CaipinLiuyanView c:list){//修改对应字典表字段dictionaryService.dictionaryConvert(c);}return R.ok().put("data", page);}/*** 前端详情*/@RequestMapping("/detail/{id}")public R detail(@PathVariable("id") Long id){logger.debug("detail方法:,,Controller:{},,id:{}",this.getClass().getName(),id);CaipinLiuyanEntity caipinLiuyan = caipinLiuyanService.selectById(id);if(caipinLiuyan !=null){//entity转viewCaipinLiuyanView view = new CaipinLiuyanView();BeanUtils.copyProperties( caipinLiuyan , view );//把实体数据重构到view中//级联表CaipinEntity caipin = caipinService.selectById(caipinLiuyan.getCaipinId());if(caipin != null){BeanUtils.copyProperties( caipin , view ,new String[]{ "id", "createDate"});//把级联的数据添加到view中,并排除id和创建时间字段view.setCaipinId(caipin.getId());}//级联表YonghuEntity yonghu = yonghuService.selectById(caipinLiuyan.getYonghuId());if(yonghu != null){BeanUtils.copyProperties( yonghu , view ,new String[]{ "id", "createDate"});//把级联的数据添加到view中,并排除id和创建时间字段view.setYonghuId(yonghu.getId());}//修改对应字典表字段dictionaryService.dictionaryConvert(view);return R.ok().put("data", view);}else {return R.error(511,"查不到数据");}}/*** 前端保存*/@RequestMapping("/add")public R add(@RequestBody CaipinLiuyanEntity caipinLiuyan, HttpServletRequest request){logger.debug("add方法:,,Controller:{},,caipinLiuyan:{}",this.getClass().getName(),caipinLiuyan.toString());caipinLiuyan.setInsertTime(new Date());caipinLiuyan.setCreateTime(new Date());caipinLiuyanService.insert(caipinLiuyan);return R.ok();}}

package com.controller;import java.util.Arrays;
import java.util.Map;import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;import com.annotation.IgnoreAuth;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.entity.ConfigEntity;
import com.service.ConfigService;
import com.utils.PageUtils;
import com.utils.R;
import com.utils.ValidatorUtils;/*** 登录相关*/
@RequestMapping("config")
@RestController
public class ConfigController{@Autowiredprivate ConfigService configService;/*** 列表*/@RequestMapping("/page")public R page(@RequestParam Map<String, Object> params,ConfigEntity config){EntityWrapper<ConfigEntity> ew = new EntityWrapper<ConfigEntity>();PageUtils page = configService.queryPage(params);return R.ok().put("data", page);}/*** 列表*/@IgnoreAuth@RequestMapping("/list")public R list(@RequestParam Map<String, Object> params,ConfigEntity config){EntityWrapper<ConfigEntity> ew = new EntityWrapper<ConfigEntity>();PageUtils page = configService.queryPage(params);return R.ok().put("data", page);}/*** 信息*/@RequestMapping("/info/{id}")public R info(@PathVariable("id") String id){ConfigEntity config = configService.selectById(id);return R.ok().put("data", config);}/*** 详情*/@IgnoreAuth@RequestMapping("/detail/{id}")public R detail(@PathVariable("id") String id){ConfigEntity config = configService.selectById(id);return R.ok().put("data", config);}/*** 根据name获取信息*/@RequestMapping("/info")public R infoByName(@RequestParam String name){ConfigEntity config = configService.selectOne(new EntityWrapper<ConfigEntity>().eq("name", "faceFile"));return R.ok().put("data", config);}/*** 保存*/@PostMapping("/save")public R save(@RequestBody ConfigEntity config){
//    	ValidatorUtils.validateEntity(config);configService.insert(config);return R.ok();}/*** 修改*/@RequestMapping("/update")public R update(@RequestBody ConfigEntity config){
//        ValidatorUtils.validateEntity(config);configService.updateById(config);//全部更新return R.ok();}/*** 删除*/@RequestMapping("/delete")public R delete(@RequestBody Long[] ids){configService.deleteBatchIds(Arrays.asList(ids));return R.ok();}
}
package com.controller;import java.text.SimpleDateFormat;
import com.alibaba.fastjson.JSONObject;
import java.util.*;
import org.springframework.beans.BeanUtils;
import javax.servlet.http.HttpServletRequest;
import org.springframework.web.context.ContextLoader;
import javax.servlet.ServletContext;
import com.service.TokenService;
import com.utils.StringUtil;
import java.lang.reflect.InvocationTargetException;import com.service.DictionaryService;
import org.apachemons.lang3.StringUtils;
import com.annotation.IgnoreAuth;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.mapper.Wrapper;import com.entity.YonghuEntity;import com.service.YonghuService;
import com.entity.view.YonghuView;import com.utils.PageUtils;
import com.utils.R;/*** 学生* 后端接口* @author* @email* @date 2021-04-15
*/
@RestController
@Controller
@RequestMapping("/yonghu")
public class YonghuController {private static final Logger logger = LoggerFactory.getLogger(YonghuController.class);@Autowiredprivate YonghuService yonghuService;@Autowiredprivate TokenService tokenService;@Autowiredprivate DictionaryService dictionaryService;//级联表service/*** 后端列表*/@RequestMapping("/page")public R page(@RequestParam Map<String, Object> params, HttpServletRequest request){logger.debug("page方法:,,Controller:{},,params:{}",this.getClass().getName(),JSONObject.toJSONString(params));params.put("orderBy","id");PageUtils page = yonghuService.queryPage(params);//字典表数据转换List<YonghuView> list =(List<YonghuView>)page.getList();for(YonghuView c:list){//修改对应字典表字段dictionaryService.dictionaryConvert(c);}return R.ok().put("data", page);}/*** 后端详情*/@RequestMapping("/info/{id}")public R info(@PathVariable("id") Long id){logger.debug("info方法:,,Controller:{},,id:{}",this.getClass().getName(),id);YonghuEntity yonghu = yonghuService.selectById(id);if(yonghu !=null){//entity转viewYonghuView view = new YonghuView();BeanUtils.copyProperties( yonghu , view );//把实体数据重构到view中//修改对应字典表字段dictionaryService.dictionaryConvert(view);return R.ok().put("data", view);}else {return R.error(511,"查不到数据");}}/*** 后端保存*/@RequestMapping("/save")public R save(@RequestBody YonghuEntity yonghu, HttpServletRequest request){logger.debug("save方法:,,Controller:{},,yonghu:{}",this.getClass().getName(),yonghu.toString());Wrapper<YonghuEntity> queryWrapper = new EntityWrapper<YonghuEntity>().eq("username", yonghu.getUsername()).or().eq("yonghu_number", yonghu.getYonghuPhone()).or().eq("yonghu_phone", yonghu.getYonghuPhone()).or().eq("yonghu_id_number", yonghu.getYonghuIdNumber());;logger.info("sql语句:"+queryWrapper.getSqlSegment());YonghuEntity yonghuEntity = yonghuService.selectOne(queryWrapper);if(yonghuEntity==null){yonghu.setCreateTime(new Date());yonghu.setPassword("123456");//  String role = String.valueOf(request.getSession().getAttribute("role"));//  if("".equals(role)){//      yonghu.set//  }yonghuService.insert(yonghu);return R.ok();}else {return R.error(511,"账户或者身份证号或者手机号或者学号已经被使用");}}/*** 后端修改*/@RequestMapping("/update")public R update(@RequestBody YonghuEntity yonghu, HttpServletRequest request){logger.debug("update方法:,,Controller:{},,yonghu:{}",this.getClass().getName(),yonghu.toString());//根据字段查询是否有相同数据Wrapper<YonghuEntity> queryWrapper = new EntityWrapper<YonghuEntity>().notIn("id",yonghu.getId()).andNew().eq("yonghu_number", yonghu.getYonghuPhone()).or().eq("username", yonghu.getUsername()).or().eq("yonghu_phone", yonghu.getYonghuPhone()).or().eq("yonghu_id_number", yonghu.getYonghuIdNumber());;logger.info("sql语句:"+queryWrapper.getSqlSegment());YonghuEntity yonghuEntity = yonghuService.selectOne(queryWrapper);if("".equals(yonghu.getYonghuPhoto()) || "null".equals(yonghu.getYonghuPhoto())){yonghu.setYonghuPhoto(null);}if(yonghuEntity==null){//  String role = String.valueOf(request.getSession().getAttribute("role"));//  if("".equals(role)){//      yonghu.set//  }yonghuService.updateById(yonghu);//根据id更新return R.ok();}else {return R.error(511,"账户或者身份证号或者手机号或者学号已经被使用");}}/*** 删除*/@RequestMapping("/delete")public R delete(@RequestBody Integer[] ids){logger.debug("delete:,,Controller:{},,ids:{}",this.getClass().getName(),ids.toString());yonghuService.deleteBatchIds(Arrays.asList(ids));return R.ok();}/*** 登录*/@IgnoreAuth@RequestMapping(value = "/login")public R login(String username, String password, String captcha, HttpServletRequest request) {YonghuEntity yonghu = yonghuService.selectOne(new EntityWrapper<YonghuEntity>().eq("username", username));if(yonghu==null || !yonghu.getPassword().equals(password)) {return R.error("账号或密码不正确");}//  // 获取监听器中的字典表// ServletContext servletContext = ContextLoader.getCurrentWebApplicationContext().getServletContext();// Map<String, Map<Integer, String>> dictionaryMap= (Map<String, Map<Integer, String>>) servletContext.getAttribute("dictionaryMap");// Map<Integer, String> role_types = dictionaryMap.get("role_types");// role_types.get(yonghu.getRoleTypes());String token = tokenService.generateToken(yonghu.getId(),username, "yonghu", "用户");R r = R.ok();r.put("token", token);r.put("role","用户");r.put("username",yonghu.getYonghuName());r.put("tableName","yonghu");r.put("userId",yonghu.getId());return r;}/*** 注册*/@IgnoreAuth@PostMapping(value = "/register")public R register(@RequestBody YonghuEntity yonghu){//    	ValidatorUtils.validateEntity(user);if(yonghuService.selectOne(new EntityWrapper<YonghuEntity>().eq("username", yonghu.getUsername()).orNew().eq("yonghu_phone",yonghu.getYonghuPhone()).orNew().eq("yonghu_id_number",yonghu.getYonghuIdNumber()).orNew().eq("yonghu_number",yonghu.getYonghuNumber())) !=null) {return R.error("账户或者身份证号或者手机号或者学号已经被使用");}yonghuService.insert(yonghu);return R.ok();}/*** 重置密码*/@GetMapping(value = "/resetPassword")public R resetPassword(Integer  id){YonghuEntity yonghu = new YonghuEntity();yonghu.setPassword("123456");yonghu.setId(id);yonghuService.updateById(yonghu);return R.ok();}/*** 获取用户的session用户信息*/@RequestMapping("/session")public R getCurrYonghu(HttpServletRequest request){Integer id = (Integer)request.getSession().getAttribute("userId");YonghuEntity yonghu = yonghuService.selectById(id);return R.ok().put("data", yonghu);}/*** 退出*/@GetMapping(value = "logout")public R logout(HttpServletRequest request) {request.getSession().invalidate();return R.ok("退出成功");}/*** 前端列表*/@RequestMapping("/list")public R list(@RequestParam Map<String, Object> params, HttpServletRequest request){logger.debug("page方法:,,Controller:{},,params:{}",this.getClass().getName(),JSONObject.toJSONString(params));String role = String.valueOf(request.getSession().getAttribute("role"));if(StringUtil.isNotEmpty(role) && "用户".equals(role)){params.put("yonghuId",request.getSession().getAttribute("userId"));}// 没有指定排序字段就默认id倒序if(StringUtil.isEmpty(String.valueOf(params.get("orderBy")))){params.put("orderBy","id");}PageUtils page = yonghuService.queryPage(params);//字典表数据转换List<YonghuView> list =(List<YonghuView>)page.getList();for(YonghuView c:list){//修改对应字典表字段dictionaryService.dictionaryConvert(c);}return R.ok().put("data", page);}/*** 前端详情*/@RequestMapping("/detail/{id}")public R detail(@PathVariable("id") Long id){logger.debug("detail方法:,,Controller:{},,id:{}",this.getClass().getName(),id);YonghuEntity yonghu = yonghuService.selectById(id);if(yonghu !=null){//entity转viewYonghuView view = new YonghuView();BeanUtils.copyProperties( yonghu , view );//把实体数据重构到view中//修改对应字典表字段dictionaryService.dictionaryConvert(view);return R.ok().put("data", view);}else {return R.error(511,"查不到数据");}}/*** 前端保存*/@RequestMapping("/add")public R add(@RequestBody YonghuEntity yonghu, HttpServletRequest request){logger.debug("add方法:,,Controller:{},,yonghu:{}",this.getClass().getName(),yonghu.toString());Wrapper<YonghuEntity> queryWrapper = new EntityWrapper<YonghuEntity>().eq("username", yonghu.getUsername()).or().eq("yonghu_number", yonghu.getYonghuNumber()).or().eq("yonghu_phone", yonghu.getYonghuPhone()).or().eq("yonghu_id_number", yonghu.getYonghuIdNumber());;logger.info("sql语句:"+queryWrapper.getSqlSegment());YonghuEntity yonghuEntity = yonghuService.selectOne(queryWrapper);if(yonghuEntity==null){yonghu.setCreateTime(new Date());yonghu.setPassword("123456");//  String role = String.valueOf(request.getSession().getAttribute("role"));//  if("".equals(role)){//      yonghu.set//  }yonghuService.insert(yonghu);return R.ok();}else {return R.error(511,"账户或者身份证号或者手机号已经被使用");}}}

更多推荐

【计算机毕业设计】高校食堂订餐系统

本文发布于:2024-02-16 19:57:14,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1691301.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:毕业设计   食堂   订餐   高校   计算机

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!