文章详情

短信预约-IT技能 免费直播动态提醒

请输入下面的图形验证码

提交验证

短信预约提醒成功

基于Java SSM的健康管理小程序的实现

2024-04-02 19:55

关注

一、系统的简介

开发语言:Java

框架:ssm

JDK版本:JDK1.8

服务器:tomcat7

数据库:mysql 5.7(一定要5.7版本)

数据库工具:Navicat11

开发软件:eclipse/myeclipse/idea

Maven包:Maven3.3.9

浏览器:谷歌浏览器

二、系统实现的主要功能

(1)用户管理。主要实现了健康管理小程序的用户管理功能。

(2)登录注册。小程序端可以登录注册。

(3)健康目标。完成健康目标的设定

(4)商城。在线购买健康相关的商品。

(5)个人信息查看。查看各种信息。

(6)后台管理。管理小程序端的各种信息。

三、系统的界面演示

 

 

 

 

 

 

 

 

四、核心代码展示


@RestController
@RequestMapping("/address")
public class AddressController {
    @Autowired
    private AddressService addressService;
    
    @RequestMapping("/page")
    public R page(@RequestParam Map<String, Object> params,AddressEntity address, 
  HttpServletRequest request){
     if(!request.getSession().getAttribute("role").toString().equals("管理员")) {
      address.setUserid((Long)request.getSession().getAttribute("userId"));
     }
 
        EntityWrapper<AddressEntity> ew = new EntityWrapper<AddressEntity>();
  PageUtils page = addressService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, address), params), params));
        return R.ok().put("data", page);
    }
    
    
    @RequestMapping("/list")
    public R list(@RequestParam Map<String, Object> params,AddressEntity address, HttpServletRequest request){
     if(!request.getSession().getAttribute("role").toString().equals("管理员")) {
      address.setUserid((Long)request.getSession().getAttribute("userId"));
     }
 
        EntityWrapper<AddressEntity> ew = new EntityWrapper<AddressEntity>();
  PageUtils page = addressService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, address), params), params));
        return R.ok().put("data", page);
    }
 
 
    @RequestMapping("/lists")
    public R list( AddressEntity address){
        EntityWrapper<AddressEntity> ew = new EntityWrapper<AddressEntity>();
       ew.allEq(MPUtil.allEQMapPre( address, "address")); 
        return R.ok().put("data", addressService.selectListView(ew));
    }
 
  
    @RequestMapping("/query")
    public R query(AddressEntity address){
        EntityWrapper< AddressEntity> ew = new EntityWrapper< AddressEntity>();
   ew.allEq(MPUtil.allEQMapPre( address, "address")); 
  AddressView addressView =  addressService.selectView(ew);
  return R.ok("查询地址成功").put("data", addressView);
    }
 
    
    @RequestMapping("/info/{id}")
    public R info(@PathVariable("id") Long id){
        AddressEntity address = addressService.selectById(id);
        return R.ok().put("data", address);
    }
 
    
    @RequestMapping("/detail/{id}")
    public R detail(@PathVariable("id") Long id){
        AddressEntity address = addressService.selectById(id);
        return R.ok().put("data", address);
    }
    
    
    @RequestMapping("/save")
    public R save(@RequestBody AddressEntity address, HttpServletRequest request){
     address.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue());
     //ValidatorUtils.validateEntity(address);
     address.setUserid((Long)request.getSession().getAttribute("userId"));
  Long userId = (Long)request.getSession().getAttribute("userId");
     if(address.getIsdefault().equals("是")) {
      addressService.updateForSet("isdefault='否'", new EntityWrapper<AddressEntity>().eq("userid", userId));
     }
     address.setUserid(userId);
 
        addressService.insert(address);
        return R.ok();
    }
    
    
    @RequestMapping("/add")
    public R add(@RequestBody AddressEntity address, HttpServletRequest request){
     address.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue());
     //ValidatorUtils.validateEntity(address);
     address.setUserid((Long)request.getSession().getAttribute("userId"));
  Long userId = (Long)request.getSession().getAttribute("userId");
     if(address.getIsdefault().equals("是")) {
      addressService.updateForSet("isdefault='否'", new EntityWrapper<AddressEntity>().eq("userid", userId));
     }
     address.setUserid(userId);
 
        addressService.insert(address);
        return R.ok();
    }
 
    
    @RequestMapping("/update")
    public R update(@RequestBody AddressEntity address, HttpServletRequest request){
        //ValidatorUtils.validateEntity(address);
        if(address.getIsdefault().equals("是")) {
      addressService.updateForSet("isdefault='否'", new EntityWrapper<AddressEntity>().eq("userid", request.getSession().getAttribute("userId")));
     }
        addressService.updateById(address);//全部更新
        return R.ok();
    }
    
    
    @RequestMapping("/default")
    public R defaultAddress(HttpServletRequest request){
     Wrapper<AddressEntity> wrapper = new EntityWrapper<AddressEntity>().eq("isdefault", "是").eq("userid", request.getSession().getAttribute("userId"));
        AddressEntity address = addressService.selectOne(wrapper);
        return R.ok().put("data", address);
    }
 
    
    @RequestMapping("/delete")
    public R delete(@RequestBody Long[] ids){
        addressService.deleteBatchIds(Arrays.asList(ids));
        return R.ok();
    }


@RequestMapping("config")
@RestController
public class ConfigController{
 
 @Autowired
 private 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);
    }
    
    
    @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();
    }
}

@RestController
@RequestMapping("/orders")
public class OrdersController {
    @Autowired
    private OrdersService ordersService;
 
    
    @RequestMapping("/page")
    public R page(@RequestParam Map<String, Object> params,OrdersEntity orders, 
  HttpServletRequest request){
     if(!request.getSession().getAttribute("role").toString().equals("管理员")) {
      orders.setUserid((Long)request.getSession().getAttribute("userId"));
     }
 
        EntityWrapper<OrdersEntity> ew = new EntityWrapper<OrdersEntity>();
  PageUtils page = ordersService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, orders), params), params));
        return R.ok().put("data", page);
    }
    
    
    @RequestMapping("/list")
    public R list(@RequestParam Map<String, Object> params,OrdersEntity orders, HttpServletRequest request){
        EntityWrapper<OrdersEntity> ew = new EntityWrapper<OrdersEntity>();
  PageUtils page = ordersService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, orders), params), params));
        return R.ok().put("data", page);
    }
 
 
    @RequestMapping("/lists")
    public R list( OrdersEntity orders){
        EntityWrapper<OrdersEntity> ew = new EntityWrapper<OrdersEntity>();
       ew.allEq(MPUtil.allEQMapPre( orders, "orders")); 
        return R.ok().put("data", ordersService.selectListView(ew));
    }
 
  
    @RequestMapping("/query")
    public R query(OrdersEntity orders){
        EntityWrapper< OrdersEntity> ew = new EntityWrapper< OrdersEntity>();
   ew.allEq(MPUtil.allEQMapPre( orders, "orders")); 
  OrdersView ordersView =  ordersService.selectView(ew);
  return R.ok("查询订单成功").put("data", ordersView);
    }
 
    
    @RequestMapping("/info/{id}")
    public R info(@PathVariable("id") Long id){
        OrdersEntity orders = ordersService.selectById(id);
        return R.ok().put("data", orders);
    }
 
    
    @RequestMapping("/detail/{id}")
    public R detail(@PathVariable("id") Long id){
        OrdersEntity orders = ordersService.selectById(id);
        return R.ok().put("data", orders);
    }
   
    
    @RequestMapping("/save")
    public R save(@RequestBody OrdersEntity orders, HttpServletRequest request){
     orders.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue());
     //ValidatorUtils.validateEntity(orders);
     orders.setUserid((Long)request.getSession().getAttribute("userId"));
 
        ordersService.insert(orders);
        return R.ok();
    }
    

以上就是基于Java SSM的健康管理小程序的实现的详细内容,更多关于Java 的资料请关注编程网其它相关文章!

阅读原文内容投诉

免责声明:

① 本站未注明“稿件来源”的信息均来自网络整理。其文字、图片和音视频稿件的所属权归原作者所有。本站收集整理出于非商业性的教育和科研之目的,并不意味着本站赞同其观点或证实其内容的真实性。仅作为临时的测试数据,供内部测试之用。本站并未授权任何人以任何方式主动获取本站任何信息。

② 本站未注明“稿件来源”的临时测试数据将在测试完成后最终做删除处理。有问题或投稿请发送至: 邮箱/279061341@qq.com QQ/279061341

软考中级精品资料免费领

  • 历年真题答案解析
  • 备考技巧名师总结
  • 高频考点精准押题
  • 2024年上半年信息系统项目管理师第二批次真题及答案解析(完整版)

    难度     813人已做
    查看
  • 【考后总结】2024年5月26日信息系统项目管理师第2批次考情分析

    难度     354人已做
    查看
  • 【考后总结】2024年5月25日信息系统项目管理师第1批次考情分析

    难度     318人已做
    查看
  • 2024年上半年软考高项第一、二批次真题考点汇总(完整版)

    难度     435人已做
    查看
  • 2024年上半年系统架构设计师考试综合知识真题

    难度     224人已做
    查看

相关文章

发现更多好内容

猜你喜欢

AI推送时光机
位置:首页-资讯-后端开发
咦!没有更多了?去看看其它编程学习网 内容吧
首页课程
资料下载
问答资讯