实现订单申请、出库后是订单状态改变的功能:
点击完成后,前端向后端发送订单的id,然后controler接收并调用service.changeStatus
@OperationLogAnnotation(operaModule = "申请管理", operaDesc = "修改状态")
@ApiOperation("手动完成申请")
@RequestMapping(value = "/changeStatus", method = RequestMethod.POST)
@ResponseBody
public CommonResult changeStatus(@RequestBody JSONObject itemId) {
Long id= Long.valueOf(itemId.getString("itemId"));
long count= collectService.changeStatus(id);
if (count > 0) {
return CommonResult.success(count);
}
return CommonResult.failed();
}
再调用collectMapper中的方法
@Override
public int changeStatus(Long id) {
return collectMapper.changeStatus(id);
}
int changeStatus(@Param("id") Long id);
调用数据库,修改状态
<update id="changeStatus" parameterType="map">
update reagent_collect
set collect_status='3'
where id=#{id,jdbcType=BIGINT}