99 lines
3.3 KiB
Java
99 lines
3.3 KiB
Java
//package com.gunshi.project.xyt.controller;
|
|
//
|
|
//import com.baomidou.mybatisplus.core.toolkit.IdWorker;
|
|
//import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper;
|
|
//import com.gunshi.core.result.R;
|
|
//import com.gunshi.project.xyt.entity.vo.SysDepartTree;
|
|
//import com.gunshi.project.xyt.model.SysDepart;
|
|
//import com.gunshi.project.xyt.service.SysDepartService;
|
|
//import com.gunshi.project.xyt.validate.markers.Insert;
|
|
//import com.gunshi.project.xyt.validate.markers.Update;
|
|
//import io.swagger.v3.oas.annotations.Operation;
|
|
//import io.swagger.v3.oas.annotations.media.Schema;
|
|
//import io.swagger.v3.oas.annotations.tags.Tag;
|
|
//import org.apache.commons.collections4.CollectionUtils;
|
|
//import org.springframework.beans.factory.annotation.Autowired;
|
|
//import org.springframework.validation.annotation.Validated;
|
|
//import org.springframework.web.bind.annotation.*;
|
|
//
|
|
//import java.io.Serializable;
|
|
//import java.util.List;
|
|
//import java.util.Objects;
|
|
//
|
|
///**
|
|
// * Description:
|
|
// * Created by XuSan on 2024/9/23.
|
|
// *
|
|
// * @author XuSan
|
|
// * @version 1.0
|
|
// */
|
|
//@Tag(name = "组织机构表")
|
|
//@RestController
|
|
//@RequestMapping(value="/SysDepart")
|
|
//public class SysDepartController {
|
|
//
|
|
// @Autowired
|
|
// private SysDepartService service;
|
|
//
|
|
// @Operation(summary = "新增")
|
|
// @PostMapping("/insert")
|
|
// public R<SysDepart> insert(@Validated(Insert.class) @RequestBody SysDepart dto) {
|
|
//
|
|
// LambdaQueryChainWrapper<SysDepart> query = service.lambdaQuery()
|
|
// .eq(SysDepart::getName, dto.getName());
|
|
// if (Objects.nonNull(dto.getPid())){
|
|
// query.eq(SysDepart::getPid, dto.getPid());
|
|
// }
|
|
// if (query.count() > 0){
|
|
// throw new IllegalArgumentException("部门名称重复");
|
|
// }
|
|
//
|
|
//
|
|
// dto.setId(IdWorker.getId());
|
|
// boolean result = service.save(dto);
|
|
// return R.ok(result ? dto : null);
|
|
// }
|
|
//
|
|
// @Operation(summary = "修改")
|
|
// @PostMapping("/update")
|
|
// public R<SysDepart> update(@Validated(Update.class) @RequestBody SysDepart dto) {
|
|
//
|
|
// LambdaQueryChainWrapper<SysDepart> query = service.lambdaQuery()
|
|
// .ne(SysDepart::getId, dto.getId())
|
|
// .eq(SysDepart::getName, dto.getName());
|
|
// if (Objects.nonNull(dto.getPid())){
|
|
// query.eq(SysDepart::getPid, dto.getPid());
|
|
// }
|
|
// if (query.count() > 0){
|
|
// throw new IllegalArgumentException("部门名称重复");
|
|
// }
|
|
//
|
|
// boolean result = service.updateById(dto);
|
|
// return R.ok(result ? dto : null);
|
|
// }
|
|
//
|
|
// @Operation(summary = "删除")
|
|
// @GetMapping("/del/{id}")
|
|
// public R<Boolean> del(@Schema(name = "id") @PathVariable("id") Serializable id) {
|
|
// return R.ok(service.removeById(id));
|
|
// }
|
|
//
|
|
// @Operation(summary = "列表")
|
|
// @PostMapping("/list")
|
|
// public R<List<SysDepart>> list() {
|
|
// return R.ok(service.lambdaQuery().list());
|
|
// }
|
|
//
|
|
// @Operation(summary = "树")
|
|
// @PostMapping("/tree")
|
|
// public R<List<SysDepart>> tree() {
|
|
// List<SysDepart> list = service.list();
|
|
// if (CollectionUtils.isEmpty(list)){
|
|
// return R.ok(list);
|
|
// }
|
|
//
|
|
// return R.ok(SysDepartTree.buildTree(list));
|
|
// }
|
|
//
|
|
//}
|