小程序开发说明

开发语言: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-03-04 15:23:14
 */
@RestController
@RequestMapping("/zixishiyuyue")
public class ZixishiyuyueController {
    @Autowired
    private ZixishiyuyueService zixishiyuyueService;

    


    /**
     * 后端列表
     */
    @RequestMapping("/page")
    public R page(@RequestParam Map<String, Object> params,ZixishiyuyueEntity zixishiyuyue, 
        HttpServletRequest request){

        String tableName = request.getSession().getAttribute("tableName").toString();
        if(tableName.equals("yonghu")) {
            zixishiyuyue.setYonghuzhanghao((String)request.getSession().getAttribute("username"));
        }
        EntityWrapper<ZixishiyuyueEntity> ew = new EntityWrapper<ZixishiyuyueEntity>();
        PageUtils page = zixishiyuyueService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, zixishiyuyue), params), params));
        return R.ok().put("data", page);
    }
    
    /**
     * 前端列表
     */
    @RequestMapping("/list")
    public R list(@RequestParam Map<String, Object> params,ZixishiyuyueEntity zixishiyuyue, 
        HttpServletRequest request){

        String tableName = request.getSession().getAttribute("tableName").toString();
        if(tableName.equals("yonghu")) {
            zixishiyuyue.setYonghuzhanghao((String)request.getSession().getAttribute("username"));
        }
        EntityWrapper<ZixishiyuyueEntity> ew = new EntityWrapper<ZixishiyuyueEntity>();
        PageUtils page = zixishiyuyueService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, zixishiyuyue), params), params));
        return R.ok().put("data", page);
    }

    /**
     * 列表
     */
    @RequestMapping("/lists")
    public R list( ZixishiyuyueEntity zixishiyuyue){
           EntityWrapper<ZixishiyuyueEntity> ew = new EntityWrapper<ZixishiyuyueEntity>();
          ew.allEq(MPUtil.allEQMapPre( zixishiyuyue, "zixishiyuyue")); 
        return R.ok().put("data", zixishiyuyueService.selectListView(ew));
    }

     /**
     * 查询
     */
    @RequestMapping("/query")
    public R query(ZixishiyuyueEntity zixishiyuyue){
        EntityWrapper< ZixishiyuyueEntity> ew = new EntityWrapper< ZixishiyuyueEntity>();
         ew.allEq(MPUtil.allEQMapPre( zixishiyuyue, "zixishiyuyue")); 
        ZixishiyuyueView zixishiyuyueView =  zixishiyuyueService.selectView(ew);
        return R.ok("查询自习室预约成功").put("data", zixishiyuyueView);
    }
    
    /**
     * 后端详情
     */
    @RequestMapping("/info/{id}")
    public R info(@PathVariable("id") Long id){
        ZixishiyuyueEntity zixishiyuyue = zixishiyuyueService.selectById(id);
        return R.ok().put("data", zixishiyuyue);
    }

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

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

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

        zixishiyuyueService.insert(zixishiyuyue);
        return R.ok();
    }

 

 

 

 

Logo

北京人形旗下天工造物具身智能开源社区,聚焦具身天工与慧思开物两大平台

更多推荐