You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
33 lines
1.3 KiB
33 lines
1.3 KiB
5 months ago
|
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);
|
||
|
}
|
||
|
|
||
|
}
|