|
|
|
|
package com.bs.ct.controller;
|
|
|
|
|
|
|
|
|
|
import java.util.List;
|
|
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
|
|
|
|
|
|
|
import io.swagger.annotations.Api;
|
|
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
|
|
import org.springframework.security.access.prepost.PreAuthorize;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
|
|
|
import org.springframework.web.bind.annotation.PostMapping;
|
|
|
|
|
import org.springframework.web.bind.annotation.PutMapping;
|
|
|
|
|
import org.springframework.web.bind.annotation.DeleteMapping;
|
|
|
|
|
import org.springframework.web.bind.annotation.PathVariable;
|
|
|
|
|
import org.springframework.web.bind.annotation.RequestBody;
|
|
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
import com.bs.common.annotation.Log;
|
|
|
|
|
import com.bs.common.core.controller.BaseController;
|
|
|
|
|
import com.bs.common.core.domain.AjaxResult;
|
|
|
|
|
import com.bs.common.core.page.TableDataInfo;
|
|
|
|
|
import com.bs.common.enums.BusinessType;
|
|
|
|
|
import com.bs.common.utils.poi.ExcelUtil;
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
|
|
import cn.hutool.core.lang.Validator;
|
|
|
|
|
import com.bs.ct.domain.CtTaskBranch;
|
|
|
|
|
import com.bs.ct.service.ICtTaskBranchService;
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 任务机构信息Controller
|
|
|
|
|
*
|
|
|
|
|
* @author bs
|
|
|
|
|
* @date 2025-02-22
|
|
|
|
|
*/
|
|
|
|
|
@Api(tags = "任务机构信息")
|
|
|
|
|
@RestController
|
|
|
|
|
@RequestMapping("/task/branch")
|
|
|
|
|
public class CtTaskBranchController extends BaseController {
|
|
|
|
|
@Resource
|
|
|
|
|
private ICtTaskBranchService ctTaskBranchService;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 分页查询任务机构信息列表
|
|
|
|
|
*/
|
|
|
|
|
@ApiOperation("分页查询任务机构信息列表")
|
|
|
|
|
@GetMapping("/pageList")
|
|
|
|
|
public TableDataInfo pageList(CtTaskBranch ctTaskBranch) {
|
|
|
|
|
startPage();
|
|
|
|
|
LambdaQueryWrapper<CtTaskBranch> queryWrapper = new LambdaQueryWrapper();
|
|
|
|
|
condition(queryWrapper,ctTaskBranch);
|
|
|
|
|
List<CtTaskBranch> list = ctTaskBranchService.list(queryWrapper);
|
|
|
|
|
return getDataTable(list);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 查询任务机构信息列表
|
|
|
|
|
*/
|
|
|
|
|
@ApiOperation("查询任务机构信息列表")
|
|
|
|
|
@GetMapping("/list")
|
|
|
|
|
public AjaxResult list(CtTaskBranch ctTaskBranch) {
|
|
|
|
|
LambdaQueryWrapper<CtTaskBranch> queryWrapper = new LambdaQueryWrapper();
|
|
|
|
|
condition(queryWrapper,ctTaskBranch);
|
|
|
|
|
List<CtTaskBranch> list = ctTaskBranchService.list(queryWrapper);
|
|
|
|
|
return success(list);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 导出任务机构信息列表
|
|
|
|
|
*/
|
|
|
|
|
@ApiOperation("导出任务机构信息列表")
|
|
|
|
|
@Log(title = "任务机构信息导出", businessType = BusinessType.EXPORT)
|
|
|
|
|
@PostMapping("/export")
|
|
|
|
|
public void export(HttpServletResponse response, CtTaskBranch ctTaskBranch) {
|
|
|
|
|
LambdaQueryWrapper<CtTaskBranch> queryWrapper = new LambdaQueryWrapper();
|
|
|
|
|
condition(queryWrapper,ctTaskBranch);
|
|
|
|
|
List<CtTaskBranch> list = ctTaskBranchService.list(queryWrapper);
|
|
|
|
|
ExcelUtil<CtTaskBranch> util = new ExcelUtil<CtTaskBranch>(CtTaskBranch. class);
|
|
|
|
|
util.exportExcel(response, list, "任务机构信息数据");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 获取任务机构信息详细信息
|
|
|
|
|
*/
|
|
|
|
|
@ApiOperation("获取任务机构信息详细信息")
|
|
|
|
|
@GetMapping(value = "/{id}")
|
|
|
|
|
public AjaxResult getInfo(@PathVariable("id") Long id) {
|
|
|
|
|
return success(ctTaskBranchService.getById(id));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 新增任务机构信息
|
|
|
|
|
*/
|
|
|
|
|
@ApiOperation("新增任务机构信息")
|
|
|
|
|
@Log(title = "任务机构信息新增", businessType = BusinessType.INSERT)
|
|
|
|
|
@PostMapping
|
|
|
|
|
public AjaxResult add(@RequestBody CtTaskBranch ctTaskBranch) {
|
|
|
|
|
return toAjax(ctTaskBranchService.save(ctTaskBranch));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 修改任务机构信息
|
|
|
|
|
*/
|
|
|
|
|
@ApiOperation("修改任务机构信息")
|
|
|
|
|
@Log(title = "任务机构信息修改", businessType = BusinessType.UPDATE)
|
|
|
|
|
@PutMapping
|
|
|
|
|
public AjaxResult edit(@RequestBody CtTaskBranch ctTaskBranch) {
|
|
|
|
|
return toAjax(ctTaskBranchService.updateById(ctTaskBranch));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 删除任务机构信息
|
|
|
|
|
*/
|
|
|
|
|
@ApiOperation("删除任务机构信息")
|
|
|
|
|
@Log(title = "任务机构信息删除", businessType = BusinessType.DELETE)
|
|
|
|
|
@DeleteMapping("/{ids}")
|
|
|
|
|
public AjaxResult remove(@PathVariable List<Long> ids) {
|
|
|
|
|
return toAjax(ctTaskBranchService.removeBatchByIds(ids));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 条件设置
|
|
|
|
|
*/
|
|
|
|
|
private void condition (LambdaQueryWrapper<CtTaskBranch> queryWrapper,CtTaskBranch ctTaskBranch){
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//id
|
|
|
|
|
if(Validator.isNotEmpty(ctTaskBranch.getId())){
|
|
|
|
|
queryWrapper.eq(CtTaskBranch::getId,ctTaskBranch.getId());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//任务id
|
|
|
|
|
if(Validator.isNotEmpty(ctTaskBranch.getTaskId())){
|
|
|
|
|
queryWrapper.eq(CtTaskBranch::getTaskId,ctTaskBranch.getTaskId());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//类型人员、机构
|
|
|
|
|
if(Validator.isNotEmpty(ctTaskBranch.getType())){
|
|
|
|
|
queryWrapper.eq(CtTaskBranch::getType,ctTaskBranch.getType());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//机构代码
|
|
|
|
|
if(Validator.isNotEmpty(ctTaskBranch.getBranchCode())){
|
|
|
|
|
queryWrapper.eq(CtTaskBranch::getBranchCode,ctTaskBranch.getBranchCode());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//机构名称
|
|
|
|
|
if(Validator.isNotEmpty(ctTaskBranch.getBranchName())){
|
|
|
|
|
queryWrapper.eq(CtTaskBranch::getBranchName,ctTaskBranch.getBranchName());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//任务状态
|
|
|
|
|
if(Validator.isNotEmpty(ctTaskBranch.getTaskStatus())){
|
|
|
|
|
queryWrapper.eq(CtTaskBranch::getTaskStatus,ctTaskBranch.getTaskStatus());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//备注
|
|
|
|
|
if(Validator.isNotEmpty(ctTaskBranch.getRemarks())){
|
|
|
|
|
queryWrapper.eq(CtTaskBranch::getRemarks,ctTaskBranch.getRemarks());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//删除标志(0代表存在 2代表删除)
|
|
|
|
|
if(Validator.isNotEmpty(ctTaskBranch.getDelFlag())){
|
|
|
|
|
queryWrapper.eq(CtTaskBranch::getDelFlag,ctTaskBranch.getDelFlag());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//创建部门
|
|
|
|
|
if(Validator.isNotEmpty(ctTaskBranch.getCreateDept())){
|
|
|
|
|
queryWrapper.eq(CtTaskBranch::getCreateDept,ctTaskBranch.getCreateDept());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//创建人
|
|
|
|
|
if(Validator.isNotEmpty(ctTaskBranch.getCreateBy())){
|
|
|
|
|
queryWrapper.eq(CtTaskBranch::getCreateBy,ctTaskBranch.getCreateBy());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//创建时间
|
|
|
|
|
if(Validator.isNotEmpty(ctTaskBranch.getCreateTime())){
|
|
|
|
|
queryWrapper.eq(CtTaskBranch::getCreateTime,ctTaskBranch.getCreateTime());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//修改人
|
|
|
|
|
if(Validator.isNotEmpty(ctTaskBranch.getUpdateBy())){
|
|
|
|
|
queryWrapper.eq(CtTaskBranch::getUpdateBy,ctTaskBranch.getUpdateBy());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//修改时间
|
|
|
|
|
if(Validator.isNotEmpty(ctTaskBranch.getUpdateTime())){
|
|
|
|
|
queryWrapper.eq(CtTaskBranch::getUpdateTime,ctTaskBranch.getUpdateTime());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//租户ID
|
|
|
|
|
if(Validator.isNotEmpty(ctTaskBranch.getTenantId())){
|
|
|
|
|
queryWrapper.eq(CtTaskBranch::getTenantId,ctTaskBranch.getTenantId());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|