parent
93cc176101
commit
ee29c4ffb6
@ -0,0 +1,32 @@
|
||||
package com.qsd.orange.controller;
|
||||
|
||||
import com.qsd.orange.service.CheckService;
|
||||
import com.qsd.orange.global.R;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.core.Authentication;
|
||||
import org.springframework.security.core.userdetails.User;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("check")
|
||||
public class CheckController {
|
||||
|
||||
@Autowired
|
||||
private CheckService checkService;
|
||||
|
||||
@PostMapping("add")
|
||||
public R add(
|
||||
String id,
|
||||
@RequestParam(value = "problem", required = false, defaultValue = "无") String problem,
|
||||
@RequestParam(value = "compensate", required = false, defaultValue = "0") Double compensate,
|
||||
@RequestParam(value = "description", required = false, defaultValue = "无") String description,
|
||||
Authentication authentication
|
||||
){
|
||||
User users = (User)authentication.getPrincipal();
|
||||
return R.choose(checkService.add(id, problem, compensate, description, users.getUsername()) > 0);
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in new issue