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.
spring/wll/SelectionJoinerController.java

77 lines
2.4 KiB

package com.yanzhen.controller;
import com.github.pagehelper.PageInfo;
import com.yanzhen.entity.SelectionJoiner;
import com.yanzhen.service.SelectionJoinerService;
import com.yanzhen.utils.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.Map;
//SelectionJoiner管理的控制器
@RestController
@RequestMapping("/selectionJoiner")
public class SelectionJoinerController {
//注入实例
//注入SelectionJoiner管理的服务类
@Autowired
private SelectionJoinerService selectionJoinerService;
//创建新的实例
@PostMapping("create")
public Result create(@RequestBody SelectionJoiner selectionJoiner){
//从SelectionJoiner服务类引用create方法
int flag = selectionJoinerService.create(selectionJoiner);
//判断是否创建成功
if(flag>0){
//成功
return Result.ok();
}else{
//失败
return Result.fail();
}
}
//删除SelectionJoiner的信息
@GetMapping("delete")
public Result delete(String ids){
//在SelectionJoiner的服务类中引用delete方法
int flag = selectionJoinerService.delete(ids);
//判断是否删除成功
if(flag>0){
//成功
return Result.ok();
}else{
//失败
return Result.fail();
}
}
//更新SelectionJoiner信息
@PostMapping("update")
public Result update(@RequestBody SelectionJoiner selectionJoiner){
//在SelectionJoiner服务类中引用update方法
int flag = selectionJoinerService.update(selectionJoiner);
//判断是否更新成功
if(flag>0){
//成功
return Result.ok();
}else{
//失败
return Result.fail();
}
}
//获取SelectionJoiner详细信息
@GetMapping("detail")
public SelectionJoiner detail(Integer id){
//返回结果
return selectionJoinerService.detail(id);
}
//查询SelectionJoiner信息
@PostMapping("query")
public Map<String,Object> query(@RequestBody SelectionJoiner selectionJoiner){
//创建分页对象
PageInfo<SelectionJoiner> pageInfo = selectionJoinerService.query(selectionJoiner);
//返回结果
return Result.ok(pageInfo);
}
}