文章目录
Get 请求 @Param
前端代码
handleCS(){// debugger// let body ={// id:8,// nyApplyDangerdetectionId:8, // uploadStatic:2,// auditorSign:'改我了',// auditorDescribe:'我也改了'// }let companyid =1let body ={}getSelectDanger(companyid).then(response=>{
body = response;// this.open = true;// this.title = "修改隐患排查";});},
调用接口
// 接口测试调用exportfunctiongetSelectDanger(companyid){returnrequest({url:'/system/uniapp/getboolWriteBack',method:'get',params:{companyid: companyid}})}
后端代码controller接收
@ApiOperation("getboolWriteBack")@GetMapping("/getboolWriteBack")publicAjaxResultgetboolWriteBack(Integer companyid){Integer count = nyPostNumberService.routineWriteBack(companyid);boolean falg =false;if(count==null){
falg =true;}returnAjaxResult.success(falg);}
后端代码Mapper层
publicIntegerroutineWriteBack(@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>
Put请求 @RequestBody
前端代码
handleCS(){let body ={id:12,nyApplyDangerdetectionId:7898994,uploadStatic:2,auditorSign:'改我了',auditorDescribe:'我也改了'}getSelectDanger(body).then(response=>{});},
调用接口
exportfunctiongetSelectDanger(data){returnrequest({url:'/warningrisk/dangerdetection/UpdateuploadStatic',method:'put',data: data
})}
后端代码controller接收
@Log(title ="隐患排查", businessType =BusinessType.UPDATE)@PutMapping("/UpdateuploadStatic")publicAjaxResultUpdateuploadStatic(@RequestBodyNyDangerdetection nyDangerdetection){returntoAjax(nyDangerdetectionService.updateuploadStatic(nyDangerdetection));}
后端代码Mapper层
IntegerupdateuploadStatic(NyDangerdetection nydangerdetection);
后端代码Mapper.xml
<update id="updateuploadStatic" parameterType="NyDangerdetection">UPDATE ny_dangerdetection a
INNERJOIN ny_apply_dangerdetection b ON a.ny_apply_dangerdetection_id = b.id
<trim prefix="SET" suffixOverrides=","><if test="uploadStatic != 0">a.upload_static = #{uploadStatic},</if><if test="uploadStatic == 2">b.auditor_sign = #{auditorSign},</if><if test="uploadStatic == 3">b.auditor_describe = #{auditorDescribe}</if></trim>
where a.ny_apply_dangerdetection_id = #{nyApplyDangerdetectionId} and b.id = #{id}</update>
本文转载自: https://blog.csdn.net/xiaohua616/article/details/129704401
版权归原作者 夏小花花 所有, 如有侵权,请联系我们删除。
版权归原作者 夏小花花 所有, 如有侵权,请联系我们删除。