运维模块补充
This commit is contained in:
@ -1,4 +1,4 @@
|
||||
package org.dromara.ops;
|
||||
package org.dromara;
|
||||
|
||||
|
||||
import org.apache.dubbo.config.spring.context.annotation.EnableDubbo;
|
||||
@ -1,4 +1,4 @@
|
||||
package org.dromara.ops.personnel.controller;
|
||||
package org.dromara.personnel.controller;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@ -17,9 +17,9 @@ import org.dromara.common.core.validate.AddGroup;
|
||||
import org.dromara.common.core.validate.EditGroup;
|
||||
import org.dromara.common.log.enums.BusinessType;
|
||||
import org.dromara.common.excel.utils.ExcelUtil;
|
||||
import org.dromara.ops.personnel.domain.vo.OpsUserVo;
|
||||
import org.dromara.ops.personnel.domain.bo.OpsUserBo;
|
||||
import org.dromara.ops.personnel.service.IOpsUserService;
|
||||
import org.dromara.personnel.domain.vo.OpsUserVo;
|
||||
import org.dromara.personnel.domain.bo.OpsUserBo;
|
||||
import org.dromara.personnel.service.IOpsUserService;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
@ -0,0 +1,106 @@
|
||||
package org.dromara.personnel.controller;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import jakarta.validation.constraints.*;
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.dromara.common.idempotent.annotation.RepeatSubmit;
|
||||
import org.dromara.common.log.annotation.Log;
|
||||
import org.dromara.common.web.core.BaseController;
|
||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||
import org.dromara.common.core.domain.R;
|
||||
import org.dromara.common.core.validate.AddGroup;
|
||||
import org.dromara.common.core.validate.EditGroup;
|
||||
import org.dromara.common.log.enums.BusinessType;
|
||||
import org.dromara.common.excel.utils.ExcelUtil;
|
||||
import org.dromara.personnel.domain.vo.OpsUserFilesVo;
|
||||
import org.dromara.personnel.domain.bo.OpsUserFilesBo;
|
||||
import org.dromara.personnel.service.IOpsUserFilesService;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 运维人员文件
|
||||
* 前端访问路由地址为:/personnel/userFiles
|
||||
*
|
||||
* @author LionLi
|
||||
* @date 2025-09-17
|
||||
*/
|
||||
@Validated
|
||||
@RequiredArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping("/userFiles")
|
||||
public class OpsUserFilesController extends BaseController {
|
||||
|
||||
private final IOpsUserFilesService opsUserFilesService;
|
||||
|
||||
/**
|
||||
* 查询运维人员文件列表
|
||||
*/
|
||||
@SaCheckPermission("personnel:userFiles:list")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo<OpsUserFilesVo> list(OpsUserFilesBo bo, PageQuery pageQuery) {
|
||||
return opsUserFilesService.queryPageList(bo, pageQuery);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出运维人员文件列表
|
||||
*/
|
||||
@SaCheckPermission("personnel:userFiles:export")
|
||||
@Log(title = "运维人员文件", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(OpsUserFilesBo bo, HttpServletResponse response) {
|
||||
List<OpsUserFilesVo> list = opsUserFilesService.queryList(bo);
|
||||
ExcelUtil.exportExcel(list, "运维人员文件", OpsUserFilesVo.class, response);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取运维人员文件详细信息
|
||||
*
|
||||
* @param opsUserId 主键
|
||||
*/
|
||||
@SaCheckPermission("personnel:userFiles:query")
|
||||
@GetMapping("/{opsUserId}")
|
||||
public R<OpsUserFilesVo> getInfo(@NotNull(message = "主键不能为空")
|
||||
@PathVariable("opsUserId") Long opsUserId) {
|
||||
return R.ok(opsUserFilesService.queryById(opsUserId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增运维人员文件
|
||||
*/
|
||||
@SaCheckPermission("personnel:userFiles:add")
|
||||
@Log(title = "运维人员文件", businessType = BusinessType.INSERT)
|
||||
@RepeatSubmit()
|
||||
@PostMapping()
|
||||
public R<Void> add(@Validated(AddGroup.class) @RequestBody OpsUserFilesBo bo) {
|
||||
return toAjax(opsUserFilesService.insertByBo(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改运维人员文件
|
||||
*/
|
||||
@SaCheckPermission("personnel:userFiles:edit")
|
||||
@Log(title = "运维人员文件", businessType = BusinessType.UPDATE)
|
||||
@RepeatSubmit()
|
||||
@PutMapping()
|
||||
public R<Void> edit(@Validated(EditGroup.class) @RequestBody OpsUserFilesBo bo) {
|
||||
return toAjax(opsUserFilesService.updateByBo(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除运维人员文件
|
||||
*
|
||||
* @param opsUserIds 主键串
|
||||
*/
|
||||
@SaCheckPermission("personnel:userFiles:remove")
|
||||
@Log(title = "运维人员文件", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{opsUserIds}")
|
||||
public R<Void> remove(@NotEmpty(message = "主键不能为空")
|
||||
@PathVariable("opsUserIds") Long[] opsUserIds) {
|
||||
return toAjax(opsUserFilesService.deleteWithValidByIds(List.of(opsUserIds), true));
|
||||
}
|
||||
}
|
||||
@ -1,4 +1,4 @@
|
||||
package org.dromara.ops.personnel.domain;
|
||||
package org.dromara.personnel.domain;
|
||||
|
||||
import org.dromara.common.mybatis.core.domain.BaseEntity;
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
@ -48,10 +48,6 @@ public class OpsUser extends BaseEntity {
|
||||
*/
|
||||
private Long projectId;
|
||||
|
||||
/**
|
||||
* 分包公司id
|
||||
*/
|
||||
private Long contractorId;
|
||||
|
||||
/**
|
||||
* 班组id
|
||||
@ -0,0 +1,46 @@
|
||||
package org.dromara.personnel.domain;
|
||||
|
||||
import org.dromara.common.mybatis.core.domain.BaseEntity;
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.io.Serial;
|
||||
|
||||
/**
|
||||
* 运维人员文件对象 ops_user_files
|
||||
*
|
||||
* @author LionLi
|
||||
* @date 2025-09-17
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@TableName("ops_user_files")
|
||||
public class OpsUserFiles extends BaseEntity {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 运维人员id
|
||||
*/
|
||||
@TableId(value = "ops_user_id")
|
||||
private Long opsUserId;
|
||||
|
||||
/**
|
||||
* 文件id
|
||||
*/
|
||||
private Long fileId;
|
||||
|
||||
/**
|
||||
* 文件名称
|
||||
*/
|
||||
private String fileName;
|
||||
|
||||
/**
|
||||
* 文件类型(1、特种作业证图片)
|
||||
*/
|
||||
private String fileType;
|
||||
|
||||
|
||||
}
|
||||
@ -1,6 +1,6 @@
|
||||
package org.dromara.ops.personnel.domain.bo;
|
||||
package org.dromara.personnel.domain.bo;
|
||||
|
||||
import org.dromara.ops.personnel.domain.OpsUser;
|
||||
import org.dromara.personnel.domain.OpsUser;
|
||||
import org.dromara.common.mybatis.core.domain.BaseEntity;
|
||||
import org.dromara.common.core.validate.AddGroup;
|
||||
import org.dromara.common.core.validate.EditGroup;
|
||||
@ -35,7 +35,7 @@ public class OpsUserBo extends BaseEntity {
|
||||
/**
|
||||
* 系统用户id
|
||||
*/
|
||||
@NotNull(message = "系统用户id不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
@NotNull(message = "系统用户id不能为空", groups = { EditGroup.class })
|
||||
private Long sysUserId;
|
||||
|
||||
/**
|
||||
@ -50,22 +50,18 @@ public class OpsUserBo extends BaseEntity {
|
||||
@NotNull(message = "项目id不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private Long projectId;
|
||||
|
||||
/**
|
||||
* 分包公司id
|
||||
*/
|
||||
@NotNull(message = "分包公司id不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private Long contractorId;
|
||||
|
||||
|
||||
/**
|
||||
* 班组id
|
||||
*/
|
||||
@NotNull(message = "班组id不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
// @NotNull(message = "班组id不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private Long teamId;
|
||||
|
||||
/**
|
||||
* 班组名称
|
||||
*/
|
||||
@NotBlank(message = "班组名称不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
// @NotBlank(message = "班组名称不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private String teamName;
|
||||
|
||||
/**
|
||||
@ -0,0 +1,47 @@
|
||||
package org.dromara.personnel.domain.bo;
|
||||
|
||||
import org.dromara.personnel.domain.OpsUserFiles;
|
||||
import org.dromara.common.mybatis.core.domain.BaseEntity;
|
||||
import org.dromara.common.core.validate.AddGroup;
|
||||
import org.dromara.common.core.validate.EditGroup;
|
||||
import io.github.linpeilie.annotations.AutoMapper;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import jakarta.validation.constraints.*;
|
||||
|
||||
/**
|
||||
* 运维人员文件业务对象 ops_user_files
|
||||
*
|
||||
* @author LionLi
|
||||
* @date 2025-09-17
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@AutoMapper(target = OpsUserFiles.class, reverseConvertGenerate = false)
|
||||
public class OpsUserFilesBo extends BaseEntity {
|
||||
|
||||
/**
|
||||
* 运维人员id
|
||||
*/
|
||||
private Long opsUserId;
|
||||
|
||||
/**
|
||||
* 文件id
|
||||
*/
|
||||
@NotNull(message = "文件id不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private Long fileId;
|
||||
|
||||
/**
|
||||
* 文件名称
|
||||
*/
|
||||
@NotBlank(message = "文件名称不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private String fileName;
|
||||
|
||||
/**
|
||||
* 文件类型(1、特种作业证图片)
|
||||
*/
|
||||
@NotBlank(message = "文件类型(1、特种作业证图片)不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private String fileType;
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,57 @@
|
||||
package org.dromara.personnel.domain.vo;
|
||||
|
||||
import org.dromara.personnel.domain.OpsUserFiles;
|
||||
import cn.idev.excel.annotation.ExcelIgnoreUnannotated;
|
||||
import cn.idev.excel.annotation.ExcelProperty;
|
||||
import org.dromara.common.excel.annotation.ExcelDictFormat;
|
||||
import org.dromara.common.excel.convert.ExcelDictConvert;
|
||||
import io.github.linpeilie.annotations.AutoMapper;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 运维人员文件视图对象 ops_user_files
|
||||
*
|
||||
* @author LionLi
|
||||
* @date 2025-09-17
|
||||
*/
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
@AutoMapper(target = OpsUserFiles.class)
|
||||
public class OpsUserFilesVo implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 运维人员id
|
||||
*/
|
||||
@ExcelProperty(value = "运维人员id")
|
||||
private Long opsUserId;
|
||||
|
||||
/**
|
||||
* 文件id
|
||||
*/
|
||||
@ExcelProperty(value = "文件id")
|
||||
private Long fileId;
|
||||
|
||||
/**
|
||||
* 文件名称
|
||||
*/
|
||||
@ExcelProperty(value = "文件名称")
|
||||
private String fileName;
|
||||
|
||||
/**
|
||||
* 文件类型(1、特种作业证图片)
|
||||
*/
|
||||
@ExcelProperty(value = "文件类型", converter = ExcelDictConvert.class)
|
||||
@ExcelDictFormat(readConverterExp = "1=、特种作业证图片")
|
||||
private String fileType;
|
||||
|
||||
|
||||
}
|
||||
@ -1,4 +1,4 @@
|
||||
package org.dromara.ops.personnel.domain.vo;
|
||||
package org.dromara.personnel.domain.vo;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@ -8,7 +8,7 @@ import org.dromara.common.excel.annotation.ExcelDictFormat;
|
||||
import org.dromara.common.excel.convert.ExcelDictConvert;
|
||||
import io.github.linpeilie.annotations.AutoMapper;
|
||||
import lombok.Data;
|
||||
import org.dromara.ops.personnel.domain.OpsUser;
|
||||
import org.dromara.personnel.domain.OpsUser;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
@ -58,11 +58,7 @@ public class OpsUserVo implements Serializable {
|
||||
@ExcelProperty(value = "项目id")
|
||||
private Long projectId;
|
||||
|
||||
/**
|
||||
* 分包公司id
|
||||
*/
|
||||
@ExcelProperty(value = "分包公司id")
|
||||
private Long contractorId;
|
||||
|
||||
|
||||
/**
|
||||
* 班组id
|
||||
@ -0,0 +1,15 @@
|
||||
package org.dromara.personnel.mapper;
|
||||
|
||||
import org.dromara.personnel.domain.OpsUserFiles;
|
||||
import org.dromara.personnel.domain.vo.OpsUserFilesVo;
|
||||
import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
|
||||
|
||||
/**
|
||||
* 运维人员文件Mapper接口
|
||||
*
|
||||
* @author LionLi
|
||||
* @date 2025-09-17
|
||||
*/
|
||||
public interface OpsUserFilesMapper extends BaseMapperPlus<OpsUserFiles, OpsUserFilesVo> {
|
||||
|
||||
}
|
||||
@ -1,7 +1,7 @@
|
||||
package org.dromara.ops.personnel.mapper;
|
||||
package org.dromara.personnel.mapper;
|
||||
|
||||
import org.dromara.ops.personnel.domain.OpsUser;
|
||||
import org.dromara.ops.personnel.domain.vo.OpsUserVo;
|
||||
import org.dromara.personnel.domain.OpsUser;
|
||||
import org.dromara.personnel.domain.vo.OpsUserVo;
|
||||
import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
|
||||
|
||||
/**
|
||||
@ -0,0 +1,69 @@
|
||||
package org.dromara.personnel.service;
|
||||
|
||||
import org.dromara.personnel.domain.OpsUserFiles;
|
||||
import org.dromara.personnel.domain.vo.OpsUserFilesVo;
|
||||
import org.dromara.personnel.domain.bo.OpsUserFilesBo;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 运维人员文件Service接口
|
||||
*
|
||||
* @author LionLi
|
||||
* @date 2025-09-17
|
||||
*/
|
||||
public interface IOpsUserFilesService {
|
||||
|
||||
/**
|
||||
* 查询运维人员文件
|
||||
*
|
||||
* @param opsUserId 主键
|
||||
* @return 运维人员文件
|
||||
*/
|
||||
OpsUserFilesVo queryById(Long opsUserId);
|
||||
|
||||
/**
|
||||
* 分页查询运维人员文件列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @param pageQuery 分页参数
|
||||
* @return 运维人员文件分页列表
|
||||
*/
|
||||
TableDataInfo<OpsUserFilesVo> queryPageList(OpsUserFilesBo bo, PageQuery pageQuery);
|
||||
|
||||
/**
|
||||
* 查询符合条件的运维人员文件列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @return 运维人员文件列表
|
||||
*/
|
||||
List<OpsUserFilesVo> queryList(OpsUserFilesBo bo);
|
||||
|
||||
/**
|
||||
* 新增运维人员文件
|
||||
*
|
||||
* @param bo 运维人员文件
|
||||
* @return 是否新增成功
|
||||
*/
|
||||
Boolean insertByBo(OpsUserFilesBo bo);
|
||||
|
||||
/**
|
||||
* 修改运维人员文件
|
||||
*
|
||||
* @param bo 运维人员文件
|
||||
* @return 是否修改成功
|
||||
*/
|
||||
Boolean updateByBo(OpsUserFilesBo bo);
|
||||
|
||||
/**
|
||||
* 校验并批量删除运维人员文件信息
|
||||
*
|
||||
* @param ids 待删除的主键集合
|
||||
* @param isValid 是否进行有效性校验
|
||||
* @return 是否删除成功
|
||||
*/
|
||||
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
|
||||
}
|
||||
@ -1,7 +1,7 @@
|
||||
package org.dromara.ops.personnel.service;
|
||||
package org.dromara.personnel.service;
|
||||
|
||||
import org.dromara.ops.personnel.domain.vo.OpsUserVo;
|
||||
import org.dromara.ops.personnel.domain.bo.OpsUserBo;
|
||||
import org.dromara.personnel.domain.vo.OpsUserVo;
|
||||
import org.dromara.personnel.domain.bo.OpsUserBo;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||
|
||||
@ -0,0 +1,134 @@
|
||||
package org.dromara.personnel.service.impl;
|
||||
|
||||
import org.dromara.common.core.utils.MapstructUtils;
|
||||
import org.dromara.common.core.utils.StringUtils;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.dromara.personnel.domain.bo.OpsUserFilesBo;
|
||||
import org.dromara.personnel.domain.vo.OpsUserFilesVo;
|
||||
import org.dromara.personnel.domain.OpsUserFiles;
|
||||
import org.dromara.personnel.mapper.OpsUserFilesMapper;
|
||||
import org.dromara.personnel.service.IOpsUserFilesService;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Collection;
|
||||
|
||||
/**
|
||||
* 运维人员文件Service业务层处理
|
||||
*
|
||||
* @author LionLi
|
||||
* @date 2025-09-17
|
||||
*/
|
||||
@Slf4j
|
||||
@RequiredArgsConstructor
|
||||
@Service
|
||||
public class OpsUserFilesServiceImpl implements IOpsUserFilesService {
|
||||
|
||||
private final OpsUserFilesMapper baseMapper;
|
||||
|
||||
/**
|
||||
* 查询运维人员文件
|
||||
*
|
||||
* @param opsUserId 主键
|
||||
* @return 运维人员文件
|
||||
*/
|
||||
@Override
|
||||
public OpsUserFilesVo queryById(Long opsUserId){
|
||||
return baseMapper.selectVoById(opsUserId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询运维人员文件列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @param pageQuery 分页参数
|
||||
* @return 运维人员文件分页列表
|
||||
*/
|
||||
@Override
|
||||
public TableDataInfo<OpsUserFilesVo> queryPageList(OpsUserFilesBo bo, PageQuery pageQuery) {
|
||||
LambdaQueryWrapper<OpsUserFiles> lqw = buildQueryWrapper(bo);
|
||||
Page<OpsUserFilesVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
||||
return TableDataInfo.build(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询符合条件的运维人员文件列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @return 运维人员文件列表
|
||||
*/
|
||||
@Override
|
||||
public List<OpsUserFilesVo> queryList(OpsUserFilesBo bo) {
|
||||
LambdaQueryWrapper<OpsUserFiles> lqw = buildQueryWrapper(bo);
|
||||
return baseMapper.selectVoList(lqw);
|
||||
}
|
||||
|
||||
private LambdaQueryWrapper<OpsUserFiles> buildQueryWrapper(OpsUserFilesBo bo) {
|
||||
Map<String, Object> params = bo.getParams();
|
||||
LambdaQueryWrapper<OpsUserFiles> lqw = Wrappers.lambdaQuery();
|
||||
lqw.orderByAsc(OpsUserFiles::getOpsUserId);
|
||||
lqw.eq(bo.getFileId() != null, OpsUserFiles::getFileId, bo.getFileId());
|
||||
lqw.like(StringUtils.isNotBlank(bo.getFileName()), OpsUserFiles::getFileName, bo.getFileName());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getFileType()), OpsUserFiles::getFileType, bo.getFileType());
|
||||
return lqw;
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增运维人员文件
|
||||
*
|
||||
* @param bo 运维人员文件
|
||||
* @return 是否新增成功
|
||||
*/
|
||||
@Override
|
||||
public Boolean insertByBo(OpsUserFilesBo bo) {
|
||||
OpsUserFiles add = MapstructUtils.convert(bo, OpsUserFiles.class);
|
||||
validEntityBeforeSave(add);
|
||||
boolean flag = baseMapper.insert(add) > 0;
|
||||
if (flag) {
|
||||
bo.setOpsUserId(add.getOpsUserId());
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改运维人员文件
|
||||
*
|
||||
* @param bo 运维人员文件
|
||||
* @return 是否修改成功
|
||||
*/
|
||||
@Override
|
||||
public Boolean updateByBo(OpsUserFilesBo bo) {
|
||||
OpsUserFiles update = MapstructUtils.convert(bo, OpsUserFiles.class);
|
||||
validEntityBeforeSave(update);
|
||||
return baseMapper.updateById(update) > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存前的数据校验
|
||||
*/
|
||||
private void validEntityBeforeSave(OpsUserFiles entity){
|
||||
//TODO 做一些数据校验,如唯一约束
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验并批量删除运维人员文件信息
|
||||
*
|
||||
* @param ids 待删除的主键集合
|
||||
* @param isValid 是否进行有效性校验
|
||||
* @return 是否删除成功
|
||||
*/
|
||||
@Override
|
||||
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
|
||||
if(isValid){
|
||||
//TODO 做一些业务上的校验,判断是否需要校验
|
||||
}
|
||||
return baseMapper.deleteByIds(ids) > 0;
|
||||
}
|
||||
}
|
||||
@ -1,5 +1,8 @@
|
||||
package org.dromara.ops.personnel.service.impl;
|
||||
package org.dromara.personnel.service.impl;
|
||||
|
||||
import jakarta.annotation.Resource;
|
||||
import org.dromara.common.core.constant.HttpStatus;
|
||||
import org.dromara.common.core.exception.ServiceException;
|
||||
import org.dromara.common.core.utils.MapstructUtils;
|
||||
import org.dromara.common.core.utils.StringUtils;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
@ -9,12 +12,17 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.dromara.common.satoken.utils.LoginHelper;
|
||||
import org.dromara.system.api.RemoteProjectService;
|
||||
import org.dromara.system.api.RemoteUserService;
|
||||
import org.dromara.system.api.domain.vo.RemoteUserVo;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.dromara.ops.personnel.domain.bo.OpsUserBo;
|
||||
import org.dromara.ops.personnel.domain.vo.OpsUserVo;
|
||||
import org.dromara.ops.personnel.domain.OpsUser;
|
||||
import org.dromara.ops.personnel.mapper.OpsUserMapper;
|
||||
import org.dromara.ops.personnel.service.IOpsUserService;
|
||||
import org.dromara.personnel.domain.bo.OpsUserBo;
|
||||
import org.dromara.personnel.domain.vo.OpsUserVo;
|
||||
import org.dromara.personnel.domain.OpsUser;
|
||||
import org.dromara.personnel.mapper.OpsUserMapper;
|
||||
import org.dromara.personnel.service.IOpsUserService;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@ -33,6 +41,10 @@ public class OpsUserServiceImpl implements IOpsUserService {
|
||||
|
||||
private final OpsUserMapper baseMapper;
|
||||
|
||||
private final RemoteProjectService remoteProjectService;
|
||||
@Autowired
|
||||
private RemoteUserService remoteUserService;
|
||||
|
||||
/**
|
||||
* 查询运维人员
|
||||
*
|
||||
@ -78,7 +90,6 @@ public class OpsUserServiceImpl implements IOpsUserService {
|
||||
lqw.eq(bo.getSysUserId() != null, OpsUser::getSysUserId, bo.getSysUserId());
|
||||
lqw.like(StringUtils.isNotBlank(bo.getUserName()), OpsUser::getUserName, bo.getUserName());
|
||||
lqw.eq(bo.getProjectId() != null, OpsUser::getProjectId, bo.getProjectId());
|
||||
lqw.eq(bo.getContractorId() != null, OpsUser::getContractorId, bo.getContractorId());
|
||||
lqw.eq(bo.getTeamId() != null, OpsUser::getTeamId, bo.getTeamId());
|
||||
lqw.like(StringUtils.isNotBlank(bo.getTeamName()), OpsUser::getTeamName, bo.getTeamName());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getStatus()), OpsUser::getStatus, bo.getStatus());
|
||||
@ -120,6 +131,13 @@ public class OpsUserServiceImpl implements IOpsUserService {
|
||||
public Boolean insertByBo(OpsUserBo bo) {
|
||||
OpsUser add = MapstructUtils.convert(bo, OpsUser.class);
|
||||
validEntityBeforeSave(add);
|
||||
Long userId = LoginHelper.getUserId();
|
||||
remoteProjectService.validAuth(bo.getProjectId(), userId);
|
||||
String phone = add.getPhone();
|
||||
RemoteUserVo userVo = remoteUserService.selectUserByPhonenumber(phone);
|
||||
if (userVo == null) {
|
||||
throw new ServiceException("当前用户未在系统注册", HttpStatus.BAD_REQUEST);
|
||||
}
|
||||
boolean flag = baseMapper.insert(add) > 0;
|
||||
if (flag) {
|
||||
bo.setId(add.getId());
|
||||
@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="org.dromara.personnel.mapper.OpsUserFilesMapper">
|
||||
|
||||
</mapper>
|
||||
@ -2,6 +2,6 @@
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="org.dromara.ops.personnel.mapper.OpsUserMapper">
|
||||
<mapper namespace="org.dromara.personnel.mapper.OpsUserMapper">
|
||||
|
||||
</mapper>
|
||||
|
||||
Reference in New Issue
Block a user