完善字符串类型的体验
This commit is contained in:
@@ -288,6 +288,19 @@ fun Application.Traceability(config: AppConfig) {
|
||||
}
|
||||
call.respond(BaseResponse(message = "批次已发布", data = data))
|
||||
}
|
||||
post("/{id}/scan-count/reset") {
|
||||
val id = parseUuidOrNull(call.parameters["id"])
|
||||
if (id == null) {
|
||||
call.respond(HttpStatusCode.BadRequest, BaseResponse(status = false, message = "批次ID无效", data = null))
|
||||
return@post
|
||||
}
|
||||
val data = TraceabilityDao.resetBatchScanCount(id)
|
||||
if (data == null) {
|
||||
call.respond(HttpStatusCode.NotFound, BaseResponse(status = false, message = "批次不存在", data = null))
|
||||
return@post
|
||||
}
|
||||
call.respond(BaseResponse(message = "扫码次数已重置", data = data))
|
||||
}
|
||||
}
|
||||
|
||||
route("/feedback") {
|
||||
|
||||
@@ -764,6 +764,16 @@ object TraceabilityDao {
|
||||
getBatch(batchId)
|
||||
}
|
||||
|
||||
fun resetBatchScanCount(batchId: UUID): TraceBatchDetailResponse? = transaction {
|
||||
val now = timestampLiteral(nowInstant())
|
||||
val updated = TraceabilityBatchesTable.update({ TraceabilityBatchesTable.id eq batchId }) {
|
||||
it[scanCount] = 0
|
||||
it[updatedAt] = now
|
||||
}
|
||||
if (updated == 0) return@transaction null
|
||||
getBatch(batchId)
|
||||
}
|
||||
|
||||
fun getPublicDetailByCode(
|
||||
batchCode: String,
|
||||
increaseScan: Boolean = false,
|
||||
|
||||
Reference in New Issue
Block a user