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

时间:2022-11-17 22:01:04

小程序开发说明


开发语言: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<String, Object> params,DianliangxinxiEntity dianliangxinxi, 

​HttpServletRequest request){


​String tableName = request.getSession().getAttribute("tableName").toString();

​if(tableName.equals("xuesheng")) {

​dianliangxinxi.setXuehao((String)request.getSession().getAttribute("username"));

​}

        EntityWrapper<DianliangxinxiEntity> ew = new EntityWrapper<DianliangxinxiEntity>();

​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<String, Object> params,DianliangxinxiEntity dianliangxinxi, 

​HttpServletRequest request){


​String tableName = request.getSession().getAttribute("tableName").toString();

​if(tableName.equals("xuesheng")) {

​dianliangxinxi.setXuehao((String)request.getSession().getAttribute("username"));

​}

        EntityWrapper<DianliangxinxiEntity> ew = new EntityWrapper<DianliangxinxiEntity>();

​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<DianliangxinxiEntity> ew = new EntityWrapper<DianliangxinxiEntity>();

 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();

    }


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

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

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

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