package com.ims.eval.controller;
import com.ims.eval.entity.OrganizationStructure;
import com.ims.eval.entity.dto.result.R;
import com.ims.eval.service.IOrganizationStructureService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import java.util.List;
/**
*
* 前端控制器
*
*
* @author wang
* @since 2023-03-01
*/
@RestController
@RequestMapping("//organization-structure")
public class OrganizationStructureController {
@Autowired
private HttpServletRequest request;
@Autowired
private IOrganizationStructureService organizationStructureService;
/**
* 添加
*
* @param evaluateRuleInfo
* @return
*/
//@ImsPreAuth("eval:dataDictionary:edit")
@PostMapping(value = "/save")
@ApiOperation(value = "新增(修改)", notes = "新增(修改)")
public R addAll(@RequestBody List evaluateRuleInfo) {
boolean b = organizationStructureService.saveBatch(evaluateRuleInfo);
if (b) {
return R.ok().data(b);
} else {
return R.error().data("保存失败!");
}
}
@GetMapping(value = "getTree")
public R getTree(
@RequestParam(value = "id", required = false) String id,
@RequestParam(value = "num", required = false) Integer num,
@RequestParam(value = "type", required = false) String type) {
List list = organizationStructureService.getTree(id,num,type);
return R.ok().data(list);
}
@GetMapping(value = "getList2")
public R getList2(
@RequestParam(value = "id", required = false) String id,
@RequestParam(value = "num", required = false) Integer num,
@RequestParam(value = "type", required = false) String type) {
List list = organizationStructureService.getList2(id,num,type);
return R.ok().data(list);
}
@GetMapping(value = "getList")
public R getList(
@RequestParam(value = "likeParentId", required = false) String id,
@RequestParam(value = "parentId", required = false) String num,
@RequestParam(value = "name", required = false) String name,
@RequestParam(value = "type", required = false) String type) {
List list = organizationStructureService.getList(id,num,name,type, request);
return R.ok().data(list);
}
}