Android studio前端向spring boot后端传递两个参数

今天需要从前端像后端传送活动id和用户id两个值,后端接收这两个参数并根据两个参数处理数据库中对应的值

常用的delete函数的参数只有一个,所以第一次用两个参数不知道格式怎么写,尝试了好几遍终于知道了:

    @ResponseBody
    @GetMapping("/line/{aId}/{uId}")
    public Result getUser(@PathVariable("aId") int aId, @PathVariable("uId") String uId){
        SignInForm signInForm =signInFormService.getByAIdAndUId(aId,uId);
        if(signInForm!=null){//存在
            result.setSuccess("查询成功!",gson.toJson(signInForm));
        }else{//不存在
            result.setSuccess("没有找到相关数据!",null);
        }
        return result;
    }

完整代码:

  • mapper层
    @Select("select * from signinform where aId = #{aId} and uId = #{uId}")
    SignInForm selectByAIdAndUId(int aId, String uId);
  • service接口
SignInForm getByAIdAndUId(int aId, String uId);
  • serviceImpl类
     public SignInForm getByAIdAndUId(int aId,String uId) {
        return this.getBaseMapper().selectByAIdAndUId(aId,uId);
    }
  • AS前端(
DatabaseUtil.selectLineById("sign","line",aId,uId);
  • 0
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值