|
|
@@ -1,21 +1,16 @@ |
|
|
|
package com.ffii.fpsms.modules.master.web |
|
|
|
|
|
|
|
import com.ffii.core.exception.NotFoundException |
|
|
|
import com.ffii.core.utils.JwtTokenUtil |
|
|
|
import com.ffii.fpsms.modules.master.entity.QcItem |
|
|
|
import com.ffii.fpsms.modules.master.entity.QcItemRepository |
|
|
|
import com.ffii.fpsms.modules.master.service.QcItemService |
|
|
|
import com.ffii.fpsms.modules.master.web.models.SaveQcItemRequest |
|
|
|
import com.ffii.fpsms.modules.master.web.models.SaveQcItemResponse |
|
|
|
import jakarta.validation.Valid |
|
|
|
import org.springframework.web.bind.annotation.GetMapping |
|
|
|
import org.springframework.web.bind.annotation.PostMapping |
|
|
|
import org.springframework.web.bind.annotation.RequestBody |
|
|
|
import org.springframework.web.bind.annotation.RequestMapping |
|
|
|
import org.springframework.web.bind.annotation.RestController |
|
|
|
import kotlin.reflect.KClass |
|
|
|
import kotlin.reflect.KProperty |
|
|
|
import kotlin.reflect.KParameter |
|
|
|
import kotlin.reflect.KTypeParameter |
|
|
|
import kotlin.reflect.typeOf |
|
|
|
import org.slf4j.Logger |
|
|
|
import org.slf4j.LoggerFactory |
|
|
|
import org.springframework.web.bind.annotation.* |
|
|
|
|
|
|
|
@RestController |
|
|
|
@RequestMapping("/qcItems") |
|
|
@@ -23,11 +18,25 @@ class QcItemController( |
|
|
|
private val qcItemService: QcItemService, |
|
|
|
private val qcItemRepository: QcItemRepository, |
|
|
|
) { |
|
|
|
|
|
|
|
var logger: Logger = LoggerFactory.getLogger(JwtTokenUtil::class.java) |
|
|
|
@GetMapping |
|
|
|
fun allQcItems(): List<QcItem> { |
|
|
|
return qcItemService.allQcItems() |
|
|
|
} |
|
|
|
|
|
|
|
@DeleteMapping("/{id}") |
|
|
|
// @ResponseStatus(HttpStatus.NO_CONTENT) |
|
|
|
fun deleteQcItem(@PathVariable id: Long): List<QcItem> { |
|
|
|
return qcItemService.markDeleted(id) |
|
|
|
} |
|
|
|
|
|
|
|
@GetMapping("/qcItemDetails/{id}") |
|
|
|
fun qcItemDetails(@PathVariable id: Long): QcItem { |
|
|
|
logger.info(qcItemService.findQcItemById(id)?.code) |
|
|
|
return qcItemService.findQcItemById(id) ?: throw NotFoundException() |
|
|
|
} |
|
|
|
|
|
|
|
@PostMapping("/save") |
|
|
|
fun saveQcItem(@Valid @RequestBody request: SaveQcItemRequest): SaveQcItemResponse { |
|
|
|
|
|
|
|