基于小程序宿舍报修系统+ssm后端源码和论文

这篇具有很好参考价值的文章主要介绍了基于小程序宿舍报修系统+ssm后端源码和论文。希望对大家有所帮助。如果存在错误或未考虑完全的地方,请大家不吝赐教,您也可以点击"举报违法"按钮提交疑问。

互联网发展至今,无论是其理论还是技术都已经成熟,而且它广泛参与在社会中的方方面面。它让信息都可以通过网络传播,搭配信息管理工具可以很好地为人们提供服务。针对成果信息管理混乱,出错率高,信息安全性差,劳动强度大,费时费力等问题,采用基于微信小程序的宿舍报修系统可以有效管理,使信息管理能够更加科学和规范。

基于微信小程序的宿舍报修系统使用Java语言进行编码,使用Mysql创建数据表保存本系统产生的数据。系统可以提供信息显示和相应服务,总之,基于微信小程序的宿舍报修系统集中管理信息,有着保密性强,效率高,存储空间大,成本低等诸多优点。它可以降低信息管理成本,实现信息管理计算机化。

关键词:基于微信小程序的宿舍报修系统;Java语言;Mysql

基于小程序宿舍报修系统+ssm后端源码和论文,小程序,java

基于小程序宿舍报修系统+ssm后端源码和论文weixin183
Abstract

Since the development of the Internet, both its theory and technology have matured, and it has been widely involved in all aspects of society. It allows information to be disseminated through the Internet, and it can serve people well with information management tools. In view of the chaotic information management of CET-4, high error rate, poor information security, high labor intensity, and time-consuming and labor-consuming problems, the use of the web-based CET-4 online test system can effectively manage the information and make information management more scientific and standardized.

The web-based English Level 4 online examination system uses Java language for coding, and uses Mysql to create data tables to save the data generated by the system. The system can provide information display and corresponding services. Its administrator manages the test papers and the information of the question bank that composes the test papers, checks the scores of the student test papers, and manages classes and students. Students choose the test questions to answer the questions, and they can view the answer scores.

In short, the web-based English Level 4 online examination system centrally manages information and has many advantages such as strong confidentiality, high efficiency, large storage space, and low cost. It can reduce the cost of information management and realize the computerization of information management.

Key WordsWeb-based English Level 4 online examination system; Java language; Mysql

基于小程序宿舍报修系统+ssm后端源码和论文,小程序,java基于小程序宿舍报修系统+ssm后端源码和论文,小程序,java基于小程序宿舍报修系统+ssm后端源码和论文,小程序,java基于小程序宿舍报修系统+ssm后端源码和论文,小程序,java基于小程序宿舍报修系统+ssm后端源码和论文,小程序,java基于小程序宿舍报修系统+ssm后端源码和论文,小程序,java基于小程序宿舍报修系统+ssm后端源码和论文,小程序,java基于小程序宿舍报修系统+ssm后端源码和论文,小程序,java基于小程序宿舍报修系统+ssm后端源码和论文,小程序,java基于小程序宿舍报修系统+ssm后端源码和论文,小程序,java基于小程序宿舍报修系统+ssm后端源码和论文,小程序,java基于小程序宿舍报修系统+ssm后端源码和论文,小程序,java基于小程序宿舍报修系统+ssm后端源码和论文,小程序,java基于小程序宿舍报修系统+ssm后端源码和论文,小程序,java基于小程序宿舍报修系统+ssm后端源码和论文,小程序,java基于小程序宿舍报修系统+ssm后端源码和论文,小程序,java基于小程序宿舍报修系统+ssm后端源码和论文,小程序,java基于小程序宿舍报修系统+ssm后端源码和论文,小程序,java文章来源地址https://www.toymoban.com/news/detail-825830.html


package com.controller;

import java.io.File;
import java.math.BigDecimal;
import java.net.URL;
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.*;
import java.lang.reflect.InvocationTargetException;

import com.service.DictionaryService;
import org.apache.commons.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.*;
import com.entity.view.*;
import com.service.*;
import com.utils.PageUtils;
import com.utils.R;
import com.alibaba.fastjson.*;

/**
 * 维修人员
 * 后端接口
 * @author
 * @email
*/
@RestController
@Controller
@RequestMapping("/weixiuyuan")
public class WeixiuyuanController {
    private static final Logger logger = LoggerFactory.getLogger(WeixiuyuanController.class);

    @Autowired
    private WeixiuyuanService weixiuyuanService;


    @Autowired
    private TokenService tokenService;
    @Autowired
    private DictionaryService dictionaryService;

    //级联表service

    @Autowired
    private XueshengService xueshengService;


    /**
    * 后端列表
    */
    @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.isEmpty(role))
            return R.error(511,"权限为空");
        else if("学生".equals(role))
            params.put("xueshengId",request.getSession().getAttribute("userId"));
        else if("维修人员".equals(role))
            params.put("weixiuyuanId",request.getSession().getAttribute("userId"));
        params.put("weixiuyuanDeleteStart",1);params.put("weixiuyuanDeleteEnd",1);
        if(params.get("orderBy")==null || params.get("orderBy")==""){
            params.put("orderBy","id");
        }
        PageUtils page = weixiuyuanService.queryPage(params);

        //字典表数据转换
        List<WeixiuyuanView> list =(List<WeixiuyuanView>)page.getList();
        for(WeixiuyuanView c:list){
            //修改对应字典表字段
            dictionaryService.dictionaryConvert(c, request);
        }
        return R.ok().put("data", page);
    }

    /**
    * 后端详情
    */
    @RequestMapping("/info/{id}")
    public R info(@PathVariable("id") Long id, HttpServletRequest request){
        logger.debug("info方法:,,Controller:{},,id:{}",this.getClass().getName(),id);
        WeixiuyuanEntity weixiuyuan = weixiuyuanService.selectById(id);
        if(weixiuyuan !=null){
            //entity转view
            WeixiuyuanView view = new WeixiuyuanView();
            BeanUtils.copyProperties( weixiuyuan , view );//把实体数据重构到view中

            //修改对应字典表字段
            dictionaryService.dictionaryConvert(view, request);
            return R.ok().put("data", view);
        }else {
            return R.error(511,"查不到数据");
        }

    }

    /**
    * 后端保存
    */
    @RequestMapping("/save")
    public R save(@RequestBody WeixiuyuanEntity weixiuyuan, HttpServletRequest request){
        logger.debug("save方法:,,Controller:{},,weixiuyuan:{}",this.getClass().getName(),weixiuyuan.toString());

        String role = String.valueOf(request.getSession().getAttribute("role"));
        if(StringUtil.isEmpty(role))
            return R.error(511,"权限为空");

        Wrapper<WeixiuyuanEntity> queryWrapper = new EntityWrapper<WeixiuyuanEntity>()
            .eq("username", weixiuyuan.getUsername())
            .or()
            .eq("weixiuyuan_phone", weixiuyuan.getWeixiuyuanPhone())
            .andNew()
            .eq("weixiuyuan_delete", 1)
            ;

        logger.info("sql语句:"+queryWrapper.getSqlSegment());
        WeixiuyuanEntity weixiuyuanEntity = weixiuyuanService.selectOne(queryWrapper);
        if(weixiuyuanEntity==null){
            weixiuyuan.setWeixiuyuanDelete(1);
            weixiuyuan.setCreateTime(new Date());
            weixiuyuan.setPassword("123456");
            weixiuyuanService.insert(weixiuyuan);
            return R.ok();
        }else {
            return R.error(511,"账户或者联系方式已经被使用");
        }
    }

    /**
    * 后端修改
    */
    @RequestMapping("/update")
    public R update(@RequestBody WeixiuyuanEntity weixiuyuan, HttpServletRequest request){
        logger.debug("update方法:,,Controller:{},,weixiuyuan:{}",this.getClass().getName(),weixiuyuan.toString());

        String role = String.valueOf(request.getSession().getAttribute("role"));
//        if(StringUtil.isEmpty(role))
//            return R.error(511,"权限为空");
        //根据字段查询是否有相同数据
        Wrapper<WeixiuyuanEntity> queryWrapper = new EntityWrapper<WeixiuyuanEntity>()
            .notIn("id",weixiuyuan.getId())
            .andNew()
            .eq("username", weixiuyuan.getUsername())
            .or()
            .eq("weixiuyuan_phone", weixiuyuan.getWeixiuyuanPhone())
            .andNew()
            .eq("weixiuyuan_delete", 1)
            ;

        logger.info("sql语句:"+queryWrapper.getSqlSegment());
        WeixiuyuanEntity weixiuyuanEntity = weixiuyuanService.selectOne(queryWrapper);
        if("".equals(weixiuyuan.getWeixiuyuanPhoto()) || "null".equals(weixiuyuan.getWeixiuyuanPhoto())){
                weixiuyuan.setWeixiuyuanPhoto(null);
        }
        if(weixiuyuanEntity==null){
            //  String role = String.valueOf(request.getSession().getAttribute("role"));
            //  if("".equals(role)){
            //      weixiuyuan.set
            //  }
            weixiuyuanService.updateById(weixiuyuan);//根据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());
        ArrayList<WeixiuyuanEntity> list = new ArrayList<>();
        for(Integer id:ids){
            WeixiuyuanEntity weixiuyuanEntity = new WeixiuyuanEntity();
            weixiuyuanEntity.setId(id);
            weixiuyuanEntity.setWeixiuyuanDelete(2);
            list.add(weixiuyuanEntity);
        }
        if(list != null && list.size() >0){
            weixiuyuanService.updateBatchById(list);
        }
        return R.ok();
    }


    /**
     * 批量上传
     */
    @RequestMapping("/batchInsert")
    public R save( String fileName){
        logger.debug("batchInsert方法:,,Controller:{},,fileName:{}",this.getClass().getName(),fileName);
        try {
            List<WeixiuyuanEntity> weixiuyuanList = new ArrayList<>();//上传的东西
            Map<String, List<String>> seachFields= new HashMap<>();//要查询的字段
            Date date = new Date();
            int lastIndexOf = fileName.lastIndexOf(".");
            if(lastIndexOf == -1){
                return R.error(511,"该文件没有后缀");
            }else{
                String suffix = fileName.substring(lastIndexOf);
                if(!".xls".equals(suffix)){
                    return R.error(511,"只支持后缀为xls的excel文件");
                }else{
                    URL resource = this.getClass().getClassLoader().getResource("static/upload/" + fileName);//获取文件路径
                    File file = new File(resource.getFile());
                    if(!file.exists()){
                        return R.error(511,"找不到上传文件,请联系管理员");
                    }else{
                        List<List<String>> dataList = PoiUtil.poiImport(file.getPath());//读取xls文件
                        dataList.remove(0);//删除第一行,因为第一行是提示
                        for(List<String> data:dataList){
                            //循环
                            WeixiuyuanEntity weixiuyuanEntity = new WeixiuyuanEntity();
//                            weixiuyuanEntity.setUsername(data.get(0));                    //账号 要改的
//                            //weixiuyuanEntity.setPassword("123456");//密码
//                            weixiuyuanEntity.setWeixiuyuanName(data.get(0));                    //维修员姓名 要改的
//                            weixiuyuanEntity.setSexTypes(Integer.valueOf(data.get(0)));   //性别 要改的
//                            weixiuyuanEntity.setWeixiuyuanNianxian(data.get(0));                    //工作年限 要改的
//                            weixiuyuanEntity.setWeixiuyuanPhone(data.get(0));                    //联系方式 要改的
//                            weixiuyuanEntity.setWeixiuyuanPhoto("");//照片
//                            weixiuyuanEntity.setWeixiuyuanContent("");//照片
//                            weixiuyuanEntity.setWeixiuyuanDelete(1);//逻辑删除字段
//                            weixiuyuanEntity.setCreateTime(date);//时间
                            weixiuyuanList.add(weixiuyuanEntity);


                            //把要查询是否重复的字段放入map中
                                //账号
                                if(seachFields.containsKey("username")){
                                    List<String> username = seachFields.get("username");
                                    username.add(data.get(0));//要改的
                                }else{
                                    List<String> username = new ArrayList<>();
                                    username.add(data.get(0));//要改的
                                    seachFields.put("username",username);
                                }
                                //联系方式
                                if(seachFields.containsKey("weixiuyuanPhone")){
                                    List<String> weixiuyuanPhone = seachFields.get("weixiuyuanPhone");
                                    weixiuyuanPhone.add(data.get(0));//要改的
                                }else{
                                    List<String> weixiuyuanPhone = new ArrayList<>();
                                    weixiuyuanPhone.add(data.get(0));//要改的
                                    seachFields.put("weixiuyuanPhone",weixiuyuanPhone);
                                }
                        }

                        //查询是否重复
                         //账号
                        List<WeixiuyuanEntity> weixiuyuanEntities_username = weixiuyuanService.selectList(new EntityWrapper<WeixiuyuanEntity>().in("username", seachFields.get("username")).eq("weixiuyuan_delete", 1));
                        if(weixiuyuanEntities_username.size() >0 ){
                            ArrayList<String> repeatFields = new ArrayList<>();
                            for(WeixiuyuanEntity s:weixiuyuanEntities_username){
                                repeatFields.add(s.getUsername());
                            }
                            return R.error(511,"数据库的该表中的 [账号] 字段已经存在 存在数据为:"+repeatFields.toString());
                        }
                         //联系方式
                        List<WeixiuyuanEntity> weixiuyuanEntities_weixiuyuanPhone = weixiuyuanService.selectList(new EntityWrapper<WeixiuyuanEntity>().in("weixiuyuan_phone", seachFields.get("weixiuyuanPhone")).eq("weixiuyuan_delete", 1));
                        if(weixiuyuanEntities_weixiuyuanPhone.size() >0 ){
                            ArrayList<String> repeatFields = new ArrayList<>();
                            for(WeixiuyuanEntity s:weixiuyuanEntities_weixiuyuanPhone){
                                repeatFields.add(s.getWeixiuyuanPhone());
                            }
                            return R.error(511,"数据库的该表中的 [联系方式] 字段已经存在 存在数据为:"+repeatFields.toString());
                        }
                        weixiuyuanService.insertBatch(weixiuyuanList);
                        return R.ok();
                    }
                }
            }
        }catch (Exception e){
            return R.error(511,"批量插入数据异常,请联系管理员");
        }
    }


    /**
    * 登录
    */
    @IgnoreAuth
    @RequestMapping(value = "/login")
    public R login(String username, String password, String captcha, HttpServletRequest request) {
        WeixiuyuanEntity weixiuyuan = weixiuyuanService.selectOne(new EntityWrapper<WeixiuyuanEntity>().eq("username", username));
        if(weixiuyuan==null || !weixiuyuan.getPassword().equals(password))
            return R.error("账号或密码不正确");
        else if(weixiuyuan.getWeixiuyuanDelete() != 1)
            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(.getRoleTypes());
        String token = tokenService.generateToken(weixiuyuan.getId(),username, "weixiuyuan", "维修人员");
        R r = R.ok();
        r.put("token", token);
        r.put("role","维修人员");
        r.put("username",weixiuyuan.getWeixiuyuanName());
        r.put("tableName","weixiuyuan");
        r.put("userId",weixiuyuan.getId());
        return r;
    }

    /**
    * 注册
    */
    @IgnoreAuth
    @PostMapping(value = "/register")
    public R register(@RequestBody WeixiuyuanEntity weixiuyuan){
//    	ValidatorUtils.validateEntity(user);
        Wrapper<WeixiuyuanEntity> queryWrapper = new EntityWrapper<WeixiuyuanEntity>()
            .eq("username", weixiuyuan.getUsername())
            .or()
            .eq("weixiuyuan_phone", weixiuyuan.getWeixiuyuanPhone())
            .andNew()
            .eq("weixiuyuan_delete", 1)
            ;
        WeixiuyuanEntity weixiuyuanEntity = weixiuyuanService.selectOne(queryWrapper);
        if(weixiuyuanEntity != null)
            return R.error("账户或者联系方式已经被使用");
        weixiuyuan.setWeixiuyuanDelete(1);
        weixiuyuan.setCreateTime(new Date());
        weixiuyuanService.insert(weixiuyuan);
        return R.ok();
    }

    /**
     * 重置密码
     */
    @GetMapping(value = "/resetPassword")
    public R resetPassword(Integer  id){
        WeixiuyuanEntity weixiuyuan = new WeixiuyuanEntity();
        weixiuyuan.setPassword("123456");
        weixiuyuan.setId(id);
        weixiuyuanService.updateById(weixiuyuan);
        return R.ok();
    }


    /**
     * 忘记密码
     */
    @IgnoreAuth
    @RequestMapping(value = "/resetPass")
    public R resetPass(String username, HttpServletRequest request) {
        WeixiuyuanEntity weixiuyuan = weixiuyuanService.selectOne(new EntityWrapper<WeixiuyuanEntity>().eq("username", username));
        if(weixiuyuan!=null){
            weixiuyuan.setPassword("123456");
            boolean b = weixiuyuanService.updateById(weixiuyuan);
            if(!b){
               return R.error();
            }
        }else{
           return R.error("账号不存在");
        }
        return R.ok();
    }


    /**
    * 获取用户的session用户信息
    */
    @RequestMapping("/session")
    public R getCurrWeixiuyuan(HttpServletRequest request){
        Integer id = (Integer)request.getSession().getAttribute("userId");
        WeixiuyuanEntity weixiuyuan = weixiuyuanService.selectById(id);
        if(weixiuyuan !=null){
            //entity转view
            WeixiuyuanView view = new WeixiuyuanView();
            BeanUtils.copyProperties( weixiuyuan , view );//把实体数据重构到view中

            //修改对应字典表字段
            dictionaryService.dictionaryConvert(view, request);
            return R.ok().put("data", view);
        }else {
            return R.error(511,"查不到数据");
        }
    }


    /**
    * 退出
    */
    @GetMapping(value = "logout")
    public R logout(HttpServletRequest request) {
        request.getSession().invalidate();
        return R.ok("退出成功");
    }




    /**
    * 前端列表
    */
    @IgnoreAuth
    @RequestMapping("/list")
    public R list(@RequestParam Map<String, Object> params, HttpServletRequest request){
        logger.debug("list方法:,,Controller:{},,params:{}",this.getClass().getName(),JSONObject.toJSONString(params));

        // 没有指定排序字段就默认id倒序
        if(StringUtil.isEmpty(String.valueOf(params.get("orderBy")))){
            params.put("orderBy","id");
        }
        PageUtils page = weixiuyuanService.queryPage(params);

        //字典表数据转换
        List<WeixiuyuanView> list =(List<WeixiuyuanView>)page.getList();
        for(WeixiuyuanView c:list)
            dictionaryService.dictionaryConvert(c, request); //修改对应字典表字段
        return R.ok().put("data", page);
    }

    /**
    * 前端详情
    */
    @RequestMapping("/detail/{id}")
    public R detail(@PathVariable("id") Long id, HttpServletRequest request){
        logger.debug("detail方法:,,Controller:{},,id:{}",this.getClass().getName(),id);
        WeixiuyuanEntity weixiuyuan = weixiuyuanService.selectById(id);
            if(weixiuyuan !=null){


                //entity转view
                WeixiuyuanView view = new WeixiuyuanView();
                BeanUtils.copyProperties( weixiuyuan , view );//把实体数据重构到view中

                //修改对应字典表字段
                dictionaryService.dictionaryConvert(view, request);
                return R.ok().put("data", view);
            }else {
                return R.error(511,"查不到数据");
            }
    }


    /**
    * 前端保存
    */
    @RequestMapping("/add")
    public R add(@RequestBody WeixiuyuanEntity weixiuyuan, HttpServletRequest request){
        logger.debug("add方法:,,Controller:{},,weixiuyuan:{}",this.getClass().getName(),weixiuyuan.toString());
        Wrapper<WeixiuyuanEntity> queryWrapper = new EntityWrapper<WeixiuyuanEntity>()
            .eq("username", weixiuyuan.getUsername())
            .or()
            .eq("weixiuyuan_phone", weixiuyuan.getWeixiuyuanPhone())
            .andNew()
            .eq("weixiuyuan_delete", 1)
            ;
        logger.info("sql语句:"+queryWrapper.getSqlSegment());
        WeixiuyuanEntity weixiuyuanEntity = weixiuyuanService.selectOne(queryWrapper);
        if(weixiuyuanEntity==null){
            weixiuyuan.setWeixiuyuanDelete(1);
            weixiuyuan.setCreateTime(new Date());
        weixiuyuan.setPassword("123456");
        //  String role = String.valueOf(request.getSession().getAttribute("role"));
        //  if("".equals(role)){
        //      weixiuyuan.set
        //  }
        weixiuyuanService.insert(weixiuyuan);
            return R.ok();
        }else {
            return R.error(511,"账户或者联系方式已经被使用");
        }
    }


}

package com.controller;

import java.io.File;
import java.math.BigDecimal;
import java.net.URL;
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.*;
import java.lang.reflect.InvocationTargetException;

import com.service.DictionaryService;
import org.apache.commons.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.*;
import com.entity.view.*;
import com.service.*;
import com.utils.PageUtils;
import com.utils.R;
import com.alibaba.fastjson.*;

/**
 * 故障上报评价
 * 后端接口
 * @author
 * @email
*/
@RestController
@Controller
@RequestMapping("/guzhangshangbaoCommentback")
public class GuzhangshangbaoCommentbackController {
    private static final Logger logger = LoggerFactory.getLogger(GuzhangshangbaoCommentbackController.class);

    @Autowired
    private GuzhangshangbaoCommentbackService guzhangshangbaoCommentbackService;


    @Autowired
    private TokenService tokenService;
    @Autowired
    private DictionaryService dictionaryService;

    //级联表service
    @Autowired
    private GuzhangshangbaoService guzhangshangbaoService;
    @Autowired
    private XueshengService xueshengService;

    @Autowired
    private WeixiuyuanService weixiuyuanService;


    /**
    * 后端列表
    */
    @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.isEmpty(role))
            return R.error(511,"权限为空");
        else if("学生".equals(role))
            params.put("xueshengId",request.getSession().getAttribute("userId"));
        else if("维修人员".equals(role))
            params.put("weixiuyuanId",request.getSession().getAttribute("userId"));
        if(params.get("orderBy")==null || params.get("orderBy")==""){
            params.put("orderBy","id");
        }
        PageUtils page = guzhangshangbaoCommentbackService.queryPage(params);

        //字典表数据转换
        List<GuzhangshangbaoCommentbackView> list =(List<GuzhangshangbaoCommentbackView>)page.getList();
        for(GuzhangshangbaoCommentbackView c:list){
            //修改对应字典表字段
            dictionaryService.dictionaryConvert(c, request);
        }
        return R.ok().put("data", page);
    }

    /**
    * 后端详情
    */
    @RequestMapping("/info/{id}")
    public R info(@PathVariable("id") Long id, HttpServletRequest request){
        logger.debug("info方法:,,Controller:{},,id:{}",this.getClass().getName(),id);
        GuzhangshangbaoCommentbackEntity guzhangshangbaoCommentback = guzhangshangbaoCommentbackService.selectById(id);
        if(guzhangshangbaoCommentback !=null){
            //entity转view
            GuzhangshangbaoCommentbackView view = new GuzhangshangbaoCommentbackView();
            BeanUtils.copyProperties( guzhangshangbaoCommentback , view );//把实体数据重构到view中

                //级联表
                GuzhangshangbaoEntity guzhangshangbao = guzhangshangbaoService.selectById(guzhangshangbaoCommentback.getGuzhangshangbaoId());
                if(guzhangshangbao != null){
                    BeanUtils.copyProperties( guzhangshangbao , view ,new String[]{ "id", "createTime", "insertTime", "updateTime", "xueshengId"});//把级联的数据添加到view中,并排除id和创建时间字段
                    view.setGuzhangshangbaoId(guzhangshangbao.getId());
                    view.setGuzhangshangbaoXueshengId(guzhangshangbao.getXueshengId());
                }
                //级联表
                XueshengEntity xuesheng = xueshengService.selectById(guzhangshangbaoCommentback.getXueshengId());
                if(xuesheng != null){
                    BeanUtils.copyProperties( xuesheng , view ,new String[]{ "id", "createTime", "insertTime", "updateTime"});//把级联的数据添加到view中,并排除id和创建时间字段
                    view.setXueshengId(xuesheng.getId());
                }
            //修改对应字典表字段
            dictionaryService.dictionaryConvert(view, request);
            return R.ok().put("data", view);
        }else {
            return R.error(511,"查不到数据");
        }

    }

    /**
    * 后端保存
    */
    @RequestMapping("/save")
    public R save(@RequestBody GuzhangshangbaoCommentbackEntity guzhangshangbaoCommentback, HttpServletRequest request){
        logger.debug("save方法:,,Controller:{},,guzhangshangbaoCommentback:{}",this.getClass().getName(),guzhangshangbaoCommentback.toString());

        String role = String.valueOf(request.getSession().getAttribute("role"));
        if(StringUtil.isEmpty(role))
            return R.error(511,"权限为空");
        else if("学生".equals(role))
            guzhangshangbaoCommentback.setXueshengId(Integer.valueOf(String.valueOf(request.getSession().getAttribute("userId"))));

        guzhangshangbaoCommentback.setInsertTime(new Date());
        guzhangshangbaoCommentback.setCreateTime(new Date());
        guzhangshangbaoCommentbackService.insert(guzhangshangbaoCommentback);
        return R.ok();
    }

    /**
    * 后端修改
    */
    @RequestMapping("/update")
    public R update(@RequestBody GuzhangshangbaoCommentbackEntity guzhangshangbaoCommentback, HttpServletRequest request){
        logger.debug("update方法:,,Controller:{},,guzhangshangbaoCommentback:{}",this.getClass().getName(),guzhangshangbaoCommentback.toString());

        String role = String.valueOf(request.getSession().getAttribute("role"));
//        if(StringUtil.isEmpty(role))
//            return R.error(511,"权限为空");
//        else if("学生".equals(role))
//            guzhangshangbaoCommentback.setXueshengId(Integer.valueOf(String.valueOf(request.getSession().getAttribute("userId"))));
        //根据字段查询是否有相同数据
        Wrapper<GuzhangshangbaoCommentbackEntity> queryWrapper = new EntityWrapper<GuzhangshangbaoCommentbackEntity>()
            .eq("id",0)
            ;

        logger.info("sql语句:"+queryWrapper.getSqlSegment());
        GuzhangshangbaoCommentbackEntity guzhangshangbaoCommentbackEntity = guzhangshangbaoCommentbackService.selectOne(queryWrapper);
        guzhangshangbaoCommentback.setUpdateTime(new Date());
        if(guzhangshangbaoCommentbackEntity==null){
            //  String role = String.valueOf(request.getSession().getAttribute("role"));
            //  if("".equals(role)){
            //      guzhangshangbaoCommentback.set
            //  }
            guzhangshangbaoCommentbackService.updateById(guzhangshangbaoCommentback);//根据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());
        guzhangshangbaoCommentbackService.deleteBatchIds(Arrays.asList(ids));
        return R.ok();
    }


    /**
     * 批量上传
     */
    @RequestMapping("/batchInsert")
    public R save( String fileName){
        logger.debug("batchInsert方法:,,Controller:{},,fileName:{}",this.getClass().getName(),fileName);
        try {
            List<GuzhangshangbaoCommentbackEntity> guzhangshangbaoCommentbackList = new ArrayList<>();//上传的东西
            Map<String, List<String>> seachFields= new HashMap<>();//要查询的字段
            Date date = new Date();
            int lastIndexOf = fileName.lastIndexOf(".");
            if(lastIndexOf == -1){
                return R.error(511,"该文件没有后缀");
            }else{
                String suffix = fileName.substring(lastIndexOf);
                if(!".xls".equals(suffix)){
                    return R.error(511,"只支持后缀为xls的excel文件");
                }else{
                    URL resource = this.getClass().getClassLoader().getResource("static/upload/" + fileName);//获取文件路径
                    File file = new File(resource.getFile());
                    if(!file.exists()){
                        return R.error(511,"找不到上传文件,请联系管理员");
                    }else{
                        List<List<String>> dataList = PoiUtil.poiImport(file.getPath());//读取xls文件
                        dataList.remove(0);//删除第一行,因为第一行是提示
                        for(List<String> data:dataList){
                            //循环
                            GuzhangshangbaoCommentbackEntity guzhangshangbaoCommentbackEntity = new GuzhangshangbaoCommentbackEntity();
//                            guzhangshangbaoCommentbackEntity.setGuzhangshangbaoId(Integer.valueOf(data.get(0)));   //故障上报 要改的
//                            guzhangshangbaoCommentbackEntity.setXueshengId(Integer.valueOf(data.get(0)));   //学生 要改的
//                            guzhangshangbaoCommentbackEntity.setGuzhangshangbaoCommentbackText(data.get(0));                    //评价内容 要改的
//                            guzhangshangbaoCommentbackEntity.setReplyText(data.get(0));                    //回复内容 要改的
//                            guzhangshangbaoCommentbackEntity.setInsertTime(date);//时间
//                            guzhangshangbaoCommentbackEntity.setUpdateTime(new Date(data.get(0)));          //回复时间 要改的
//                            guzhangshangbaoCommentbackEntity.setCreateTime(date);//时间
                            guzhangshangbaoCommentbackList.add(guzhangshangbaoCommentbackEntity);


                            //把要查询是否重复的字段放入map中
                        }

                        //查询是否重复
                        guzhangshangbaoCommentbackService.insertBatch(guzhangshangbaoCommentbackList);
                        return R.ok();
                    }
                }
            }
        }catch (Exception e){
            return R.error(511,"批量插入数据异常,请联系管理员");
        }
    }





    /**
    * 前端列表
    */
    @IgnoreAuth
    @RequestMapping("/list")
    public R list(@RequestParam Map<String, Object> params, HttpServletRequest request){
        logger.debug("list方法:,,Controller:{},,params:{}",this.getClass().getName(),JSONObject.toJSONString(params));

        // 没有指定排序字段就默认id倒序
        if(StringUtil.isEmpty(String.valueOf(params.get("orderBy")))){
            params.put("orderBy","id");
        }
        PageUtils page = guzhangshangbaoCommentbackService.queryPage(params);

        //字典表数据转换
        List<GuzhangshangbaoCommentbackView> list =(List<GuzhangshangbaoCommentbackView>)page.getList();
        for(GuzhangshangbaoCommentbackView c:list)
            dictionaryService.dictionaryConvert(c, request); //修改对应字典表字段
        return R.ok().put("data", page);
    }

    /**
    * 前端详情
    */
    @RequestMapping("/detail/{id}")
    public R detail(@PathVariable("id") Long id, HttpServletRequest request){
        logger.debug("detail方法:,,Controller:{},,id:{}",this.getClass().getName(),id);
        GuzhangshangbaoCommentbackEntity guzhangshangbaoCommentback = guzhangshangbaoCommentbackService.selectById(id);
            if(guzhangshangbaoCommentback !=null){


                //entity转view
                GuzhangshangbaoCommentbackView view = new GuzhangshangbaoCommentbackView();
                BeanUtils.copyProperties( guzhangshangbaoCommentback , view );//把实体数据重构到view中

                //级联表
                    GuzhangshangbaoEntity guzhangshangbao = guzhangshangbaoService.selectById(guzhangshangbaoCommentback.getGuzhangshangbaoId());
                if(guzhangshangbao != null){
                    BeanUtils.copyProperties( guzhangshangbao , view ,new String[]{ "id", "createDate"});//把级联的数据添加到view中,并排除id和创建时间字段
                    view.setGuzhangshangbaoId(guzhangshangbao.getId());
                }
                //级联表
                    XueshengEntity xuesheng = xueshengService.selectById(guzhangshangbaoCommentback.getXueshengId());
                if(xuesheng != null){
                    BeanUtils.copyProperties( xuesheng , view ,new String[]{ "id", "createDate"});//把级联的数据添加到view中,并排除id和创建时间字段
                    view.setXueshengId(xuesheng.getId());
                }
                //修改对应字典表字段
                dictionaryService.dictionaryConvert(view, request);
                return R.ok().put("data", view);
            }else {
                return R.error(511,"查不到数据");
            }
    }


    /**
    * 前端保存
    */
    @RequestMapping("/add")
    public R add(@RequestBody GuzhangshangbaoCommentbackEntity guzhangshangbaoCommentback, HttpServletRequest request){
        logger.debug("add方法:,,Controller:{},,guzhangshangbaoCommentback:{}",this.getClass().getName(),guzhangshangbaoCommentback.toString());
        guzhangshangbaoCommentback.setInsertTime(new Date());
        guzhangshangbaoCommentback.setCreateTime(new Date());
        guzhangshangbaoCommentbackService.insert(guzhangshangbaoCommentback);
        return R.ok();
        }


}

到了这里,关于基于小程序宿舍报修系统+ssm后端源码和论文的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处: 如若内容造成侵权/违法违规/事实不符,请点击违法举报进行投诉反馈,一经查实,立即删除!

领支付宝红包 赞助服务器费用

相关文章

  • 高校宿舍报修管理系统的设计与实现(论文+源码)_kaic

    摘  要 随着科技的发展,信息化的管理手段早以在人们生活的各个方面取代了传统的管理手段,以先进管理理念为基础的现代化信息管理系统已经成为了许多机构的必备工具。在如今大学的校园里,有着许许多多的信息化管理系统,如图书管理系统、教务管理系统等等。但除

    2024年02月15日
    浏览(29)
  • 基于SpringBoot+Vue+uniapp微信小程序的宿舍报修系统的详细设计和实现(源码+lw+部署文档+讲解等)

    💗博主介绍:✌全网粉丝10W+,CSDN特邀作者、博客专家、CSDN新星计划导师、全栈领域优质创作者,博客之星、掘金/华为云/阿里云/InfoQ等平台优质作者、专注于Java、小程序技术领域和毕业项目实战✌💗 👇🏻 精彩专栏 推荐订阅👇🏻 2023-2024年最值得选的微信小程序毕业设计

    2024年04月22日
    浏览(32)
  • 微信小程序软件缺陷管理系统+ssm后端源码和论文

    基于微信小程序软件缺陷管理系统 摘要 随着信息技术在管理上越来越深入而广泛的应用,管理信息系统的实施在技术上已逐步成熟。本文介绍了基于微信小程序软件缺陷管理系统的开发全过程。通过分析基于微信小程序软件缺陷管理系统管理的不足,创建了一个计算机管理

    2024年01月22日
    浏览(33)
  • 基于微信小程序的高校宿舍管理系统设计与实现(亮点:选择宿舍、宿舍评分、宿舍报修)

    💗博主介绍:✌全网粉丝10W+,CSDN特邀作者、博客专家、CSDN新星计划导师、全栈领域优质创作者,博客之星、掘金/华为云/阿里云/InfoQ等平台优质作者、专注于Java、小程序技术领域和毕业项目实战✌💗 👇🏻 精彩专栏 推荐订阅👇🏻 2023-2024年最值得选的微信小程序毕业设计

    2024年04月25日
    浏览(37)
  • 基于微信小程序的停车场管理平台+ssm后端源码和论文

    由于APP软件在开发以及运营上面所需成本较高,而用户手机需要安装各种APP软件,因此占用用户过多的手机存储空间,导致用户手机运行缓慢,体验度比较差,进而导致用户会卸载非必要的APP,倒逼管理者必须改变运营策略。随着微信小程序的出现,解决了用户非独立APP不可

    2024年01月20日
    浏览(35)
  • 基于微信小程序的电子竞技信息交流平台+ssm后端源码和论文

    摘  要 随着科技的进步,微信小程序慢慢进入了生活当中,由于轻便快捷,方便使用,基于微信这个大平台,使得小程序飞速发展,趋于成熟,因此,针对电子竞技信息交流方面,特开发了本基于微信小程序的电子竞技信息交流平台。 本基于微信小程序的电子竞技信息交流

    2024年02月05日
    浏览(27)
  • 基于SSM的宿舍管理系统【附源码文档】

    基于SSM的宿舍管理系统【附源码文档】 开发语言:Java 数据库:MySQL 技术:Spring+SpringMVC+MyBatis 工具:IDEA/Ecilpse、Navicat、Maven 【主要功能】 角色:管理员、宿舍管理员、学生 管理员:院系信息、班级信息、宿舍楼信息、宿舍信息、学生信息、修信息、来访人员信息、宿舍评分

    2024年02月09日
    浏览(28)
  • 基于SpringBoot+Vue+uniapp微信小程序的宿舍报修系统的详细设计和实现

    💗 博主介绍 :✌全网粉丝10W+,CSDN特邀作者、博客专家、CSDN新星计划导师、全栈领域优质创作者,博客之星、掘金/华为云/阿里云/InfoQ等平台优质作者、专注于Java、小程序技术领域和毕业项目实战✌💗 👇🏻 精彩专栏 推荐订阅 👇🏻 2023-2024年最值得选的微信小程序毕业设

    2024年04月22日
    浏览(32)
  • ssm基于Java Web的学生宿舍管理系统设计与实现论文

    现代经济快节奏发展以及不断完善升级的信息化技术,让传统数据信息的管理升级为软件存储,归纳,集中处理数据信息的管理方式。本学生宿舍管理系统就是在这样的大环境下诞生,其可以帮助管理者在短时间内处理完毕庞大的数据信息,使用这种软件工具可以帮助管理人

    2024年02月20日
    浏览(40)
  • (附源码)基于SSM框架的校园宿舍管理系统 毕业设计241738

    SSM校园宿舍管理系统的设计与实现 摘 要 科技进步的飞速发展引起人们日常生活的巨大变化,电子信息技术的飞速发展使得电子信息技术的各个领域的应用水平得到普及和应用。信息时代的到来已成为不可阻挡的时尚潮流,人类发展的历史正进入一个新时代。在现实运用中,

    2024年02月02日
    浏览(32)

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

博客赞助

微信扫一扫打赏

请作者喝杯咖啡吧~博客赞助

支付宝扫一扫领取红包,优惠每天领

二维码1

领取红包

二维码2

领红包