• 基于微信小程序的学生购电系统设计与实现-计算机毕业设计源码+LW文档


    小程序开发说明

    开发语言:Java
    框架:ssm
    JDK版本:JDK1.8
    服务器:tomcat7
    数据库:mysql 5.7(一定要5.7版本)
    数据库工具:Navicat11
    开发软件:eclipse/myeclipse/idea
    Maven包:Maven3.3.9
    浏览器:谷歌浏览器

    小程序框架:uniapp
    小程序开发软件:HBuilder X
    小程序运行软件:微信开发者

    关键逻辑代码:

    /**
     * 电量信息
     * 后端接口
     * @author 
     * @email 
     * @date 2022-05-09 12:09:29
     */
    @RestController
    @RequestMapping("/dianliangxinxi")
    public class DianliangxinxiController {
        @Autowired
        private DianliangxinxiService dianliangxinxiService;



        


        /**
         * 后端列表
         */
        @RequestMapping("/page")
        public R page(@RequestParam Map params,DianliangxinxiEntity dianliangxinxi, 
    HttpServletRequest request){

    String tableName = request.getSession().getAttribute("tableName").toString();
    if(tableName.equals("xuesheng")) {
    dianliangxinxi.setXuehao((String)request.getSession().getAttribute("username"));
    }
            EntityWrapper ew = new EntityWrapper();
    PageUtils page = dianliangxinxiService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, dianliangxinxi), params), params));
            return R.ok().put("data", page);
        }
        
        /**
         * 前端列表
         */
        @RequestMapping("/list")
        public R list(@RequestParam Map params,DianliangxinxiEntity dianliangxinxi, 
    HttpServletRequest request){

    String tableName = request.getSession().getAttribute("tableName").toString();
    if(tableName.equals("xuesheng")) {
    dianliangxinxi.setXuehao((String)request.getSession().getAttribute("username"));
    }
            EntityWrapper ew = new EntityWrapper();
    PageUtils page = dianliangxinxiService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, dianliangxinxi), params), params));
            return R.ok().put("data", page);
        }

    /**
         * 列表
         */
        @RequestMapping("/lists")
        public R list( DianliangxinxiEntity dianliangxinxi){
            EntityWrapper ew = new EntityWrapper();
          ew.allEq(MPUtil.allEQMapPre( dianliangxinxi, "dianliangxinxi")); 
            return R.ok().put("data", dianliangxinxiService.selectListView(ew));
        }

    /**
         * 查询
         */
        @RequestMapping("/query")
        public R query(DianliangxinxiEntity dianliangxinxi){
            EntityWrapper< DianliangxinxiEntity> ew = new EntityWrapper< DianliangxinxiEntity>();
      ew.allEq(MPUtil.allEQMapPre( dianliangxinxi, "dianliangxinxi")); 
    DianliangxinxiView dianliangxinxiView =  dianliangxinxiService.selectView(ew);
    return R.ok("查询电量信息成功").put("data", dianliangxinxiView);
        }

        /**
         * 后端详情
         */
        @RequestMapping("/info/{id}")
        public R info(@PathVariable("id") Long id){
            DianliangxinxiEntity dianliangxinxi = dianliangxinxiService.selectById(id);
            return R.ok().put("data", dianliangxinxi);
        }

        /**
         * 前端详情
         */
        @RequestMapping("/detail/{id}")
        public R detail(@PathVariable("id") Long id){
            DianliangxinxiEntity dianliangxinxi = dianliangxinxiService.selectById(id);
            return R.ok().put("data", dianliangxinxi);
        }
        



        /**
         * 后端保存
         */
        @RequestMapping("/save")
        public R save(@RequestBody DianliangxinxiEntity dianliangxinxi, HttpServletRequest request){
        dianliangxinxi.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue());
        //ValidatorUtils.validateEntity(dianliangxinxi);

            dianliangxinxiService.insert(dianliangxinxi);
            return R.ok();
        }
        
        /**
         * 前端保存
         */
        @RequestMapping("/add")
        public R add(@RequestBody DianliangxinxiEntity dianliangxinxi, HttpServletRequest request){
        dianliangxinxi.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue());
        //ValidatorUtils.validateEntity(dianliangxinxi);
        dianliangxinxi.setUserid((Long)request.getSession().getAttribute("userId"));

            dianliangxinxiService.insert(dianliangxinxi);
            return R.ok();
        }

        /**
         * 修改
         */
        @RequestMapping("/update")
        @Transactional
        public R update(@RequestBody DianliangxinxiEntity dianliangxinxi, HttpServletRequest request){
            //ValidatorUtils.validateEntity(dianliangxinxi);
            dianliangxinxiService.updateById(dianliangxinxi);//全部更新
            return R.ok();
        }
        

        /**
         * 删除
         */
        @RequestMapping("/delete")
        public R delete(@RequestBody Long[] ids){
            dianliangxinxiService.deleteBatchIds(Arrays.asList(ids));
            return R.ok();
        }
        

     

     

     

     

     

  • 相关阅读:
    使用Velodyne传感器生成的点云进行快速且稳健的聚类处理:一个C++实践指南
    人工智能轨道交通行业周刊-第9期(2022.8.8-8.14)
    一个react前端项目中的配置文件作用解析
    从维基百科通过关键字爬取指定文本内容
    【无标题】
    为什么要用Hive?
    利用QRCode.js生成动态二维码页面
    由两个独立的高增益运算放大器组成的运放芯片D258,可应用于音频信号处理系统上
    分布式架构演进过程
    解决ueditor表格拖拽没反应的问题
  • 原文地址:https://blog.csdn.net/qq_375279829/article/details/127912675