根据车辆二维码的车辆编号判断车辆二维码是否存在

This commit is contained in:
小朱 2025-05-20 16:40:57 +08:00
parent e26f49cb22
commit f3c0376dfc

View File

@ -4,6 +4,7 @@ import com.cdzy.common.model.JsonResult;
import com.cdzy.ebikeoperate.model.dto.request.ReqEbikeBikeQrcodeBatchDto;
import com.cdzy.ebikeoperate.model.dto.request.ReqEbikeBikeQrcodeDto;
import com.mybatisflex.core.paginate.Page;
import com.mybatisflex.core.query.QueryWrapper;
import org.springframework.web.bind.annotation.*;
import org.springframework.beans.factory.annotation.Autowired;
import com.cdzy.ebikeoperate.model.pojo.EbikeBikeQrcode;
@ -104,5 +105,22 @@ public class EbikeBikeQrcodeController {
Page<EbikeBikeQrcode> pageRecords = ebikeBikeQrcodeService.getPageRecords(reqEbikeBikeQrcodeDto);
return JsonResult.success(pageRecords);
}
/**
* 根据车辆二维码的车辆编号判断车辆二维码是否存在
*
* @param bikeCode 车辆二维码
* @return JsonResult 包含查询结果的响应
*/
@GetMapping("/checkBikeCodeExistence")
public JsonResult<?> checkBikeCodeExistence(@RequestParam(name = "bikeCode") String bikeCode) {
try {
QueryWrapper queryWrapper = new QueryWrapper();
queryWrapper.eq("bike_code", bikeCode);
long count = ebikeBikeQrcodeService.count(queryWrapper);
return JsonResult.success(count);
} catch (Exception e) {
// 记录异常信息
return JsonResult.failed("查询失败,请稍后再试");
}
}
}