我的记录
java
@RestController
@RequestMapping("/user")
public class UserController {
@Autowired
private UserService userService;
@GetMapping("/list")
public List<User> list(){return userService.list();}
//新增
@PostMapping("/save")
public boolean save(@RequestBoby User user){
return userService.save(user);}
//修改
@PostMapping("/mod")
public boolean mod(@RequestBoby User user){
return userService.updateById(user);}
//新增或修改
@PostMapping("/saveOrMod")
public boolean saveOrMod(@RequestBoby User user){
return userService.saveOrUpdate(user);}
//删除
@getMapping("/delete")
public boolean delete(Integer id){
return userService.removeById(id);}
//查询(模糊 匹配)
@PostMapping("/listP")
public list<User> listP(@RequestBoby User user){
LambdaQueryWrapper<User> lambdaQueryWrapper=new LambdaQueryWrapper();
lambdaQueryWrapper.like(User::getName,user.getName());
// lambdaQueryWrapper.eq(User::getName,user.getName())
return userService.list(ulambdaQueryWrapperser);}
}