|
|
@@ -2,44 +2,47 @@ package com.ffii.tsms.modules.data.web |
|
|
|
|
|
|
|
import com.ffii.core.response.RecordsRes |
|
|
|
import com.ffii.core.utils.CriteriaArgsBuilder |
|
|
|
import com.ffii.tsms.modules.common.SecurityUtils |
|
|
|
import com.ffii.tsms.modules.data.entity.Skill |
|
|
|
import com.ffii.tsms.modules.data.service.SkillService |
|
|
|
import com.ffii.tsms.modules.data.web.models.NewSkillRequest |
|
|
|
import jakarta.servlet.http.HttpServletRequest |
|
|
|
import jakarta.validation.Valid |
|
|
|
import org.springframework.http.HttpStatus |
|
|
|
import org.springframework.security.access.prepost.PreAuthorize |
|
|
|
import org.springframework.web.bind.ServletRequestBindingException |
|
|
|
import org.springframework.web.bind.annotation.* |
|
|
|
|
|
|
|
|
|
|
|
@RestController |
|
|
|
@RequestMapping("/skill") |
|
|
|
class SkillController(private val skillService: SkillService) { |
|
|
|
open class SkillController(private val skillService: SkillService) { |
|
|
|
|
|
|
|
@PostMapping("/save") |
|
|
|
fun saveSkill(@Valid @RequestBody newSkill: NewSkillRequest): Skill { |
|
|
|
@PreAuthorize("hasAuthority('MAINTAIN_MASTERDATA')") |
|
|
|
open fun saveSkill(@Valid @RequestBody newSkill: NewSkillRequest): Skill { |
|
|
|
return skillService.saveOrUpdate(newSkill) |
|
|
|
} |
|
|
|
@GetMapping("/{id}") |
|
|
|
fun list(@Valid @PathVariable id: Long): List<Map<String, Any>> { |
|
|
|
open fun list(@Valid @PathVariable id: Long): List<Map<String, Any>> { |
|
|
|
val args: MutableMap<String, Any> = HashMap() |
|
|
|
args["id"] = id |
|
|
|
return skillService.list(args); |
|
|
|
} |
|
|
|
@DeleteMapping("/delete/{id}") |
|
|
|
@ResponseStatus(HttpStatus.NO_CONTENT) |
|
|
|
fun delete(@PathVariable id: Long?) { |
|
|
|
open fun delete(@PathVariable id: Long?) { |
|
|
|
skillService.markDelete(id) |
|
|
|
} |
|
|
|
|
|
|
|
@GetMapping |
|
|
|
fun list(): List<Map<String, Any>> { |
|
|
|
open fun list(): List<Map<String, Any>> { |
|
|
|
val args: MutableMap<String, Any> = HashMap() |
|
|
|
return skillService.list(args); |
|
|
|
} |
|
|
|
@GetMapping("/combo") |
|
|
|
@Throws(ServletRequestBindingException::class) |
|
|
|
fun combo(request: HttpServletRequest?): RecordsRes<Map<String, Any>> { |
|
|
|
open fun combo(request: HttpServletRequest?): RecordsRes<Map<String, Any>> { |
|
|
|
println(request) |
|
|
|
return RecordsRes<Map<String, Any>>( |
|
|
|
skillService.combo( |
|
|
|