vue 前端参值后端接收的几种方式-Get 请求 @Param

时间:2024-04-19 08:48:34

前端代码

 handleCS(){
      // debugger
      // let body ={
      //   id:8,
      //   nyApplyDangerdetectionId:8,  
      //   uploadStatic:2,
      //   auditorSign:'改我了',
      //   auditorDescribe:'我也改了'
      // }
      let companyid = 1
      let body = {} 
      getSelectDanger(companyid).then(response => {
        body = response;
        // this.open = true;
        // this.title = "修改隐患排查";
      });
    },

调用接口

// 接口测试调用
export function getSelectDanger(companyid) {
  return request({
    url: '/system/uniapp/getboolWriteBack',
    method: 'get',
    params: {companyid : companyid}
  })
}

后端代码controller接收

@ApiOperation("getboolWriteBack")
@GetMapping("/getboolWriteBack")
public AjaxResult getboolWriteBack(Integer companyid){
    Integer count = nyPostNumberService.routineWriteBack(companyid);
    boolean falg = false;
    if(count==null){
        falg = true;
    }
    return AjaxResult.success(falg);
}

后端代码Mapper层

public Integer routineWriteBack(@Param("companyid")  Integer companyid);

后端代码Mapper.xml

<select id="routineWriteBack" resultType="java.lang.Integer">
       select onduty_people from ny_post_number where companyid = #{companyid} and date(create_time) = date(now())
    </select>