feat(project): 添加项目文件管理功能
- 新增项目文件实体类 ProjectFile - 实现项目文件相关接口和控制器 - 在项目和需求实体类中添加文件列表属性 - 更新项目和需求服务类,支持文件上传和管理- 新增文件删除功能dev_1.2.1
parent
3cf0ba7d05
commit
70954e2e95
|
@ -103,6 +103,13 @@ public class ProjectController extends BaseController {
|
|||
return success(teamService.personnelChanges(team));
|
||||
}
|
||||
|
||||
|
||||
|
||||
@GetMapping("/team/list")
|
||||
public AjaxResult teamList(ProjectTeam team) {
|
||||
return success(teamService.list(team));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除项目
|
||||
*/
|
||||
|
|
|
@ -0,0 +1,42 @@
|
|||
package tech.unissense.pms.web.controller.business.project;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import tech.unissense.pms.business.project.domain.Project;
|
||||
import tech.unissense.pms.business.project.dto.ProjectQueryDto;
|
||||
import tech.unissense.pms.business.project.service.IProjectService;
|
||||
import tech.unissense.pms.business.projectFile.service.IProjectFileService;
|
||||
import tech.unissense.pms.business.projectteam.domain.ProjectTeam;
|
||||
import tech.unissense.pms.business.projectteam.service.IProjectTeamService;
|
||||
import tech.unissense.pms.common.annotation.Log;
|
||||
import tech.unissense.pms.common.core.controller.BaseController;
|
||||
import tech.unissense.pms.common.core.domain.AjaxResult;
|
||||
import tech.unissense.pms.common.core.page.TableDataInfo;
|
||||
import tech.unissense.pms.common.enums.BusinessType;
|
||||
import tech.unissense.pms.common.utils.uuid.IdUtils;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 部门信息
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/business/project/file")
|
||||
public class ProjectFileController extends BaseController {
|
||||
@Autowired
|
||||
private IProjectFileService service;
|
||||
|
||||
/**
|
||||
* 删除文件
|
||||
*/
|
||||
// @PreAuthorize("@ss.hasPermi('system:dept:remove')")
|
||||
@Log(title = "删除文件", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{id}")
|
||||
public AjaxResult remove(@PathVariable Integer id) {
|
||||
return toAjax(service.deleteById(id));
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -1,6 +1,7 @@
|
|||
package tech.unissense.pms.business.demand.domain;
|
||||
|
||||
import lombok.Data;
|
||||
import tech.unissense.pms.business.projectFile.domain.ProjectFile;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
@ -60,6 +61,9 @@ public class ProjectDemand implements Serializable {
|
|||
private String responsiblePersonName;
|
||||
private List<String> demandStatusList;
|
||||
private Date queryDate;
|
||||
|
||||
|
||||
private List<ProjectFile> fileList;
|
||||
/**
|
||||
* 需求状态
|
||||
*/
|
||||
|
|
|
@ -1,13 +1,17 @@
|
|||
package tech.unissense.pms.business.demand.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.date.DateUnit;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import tech.unissense.pms.business.demand.domain.ProjectDemand;
|
||||
import tech.unissense.pms.business.demand.mapper.ProjectDemandMapper;
|
||||
import tech.unissense.pms.business.demand.service.IProjectDemandService;
|
||||
import org.springframework.stereotype.Service;
|
||||
import tech.unissense.pms.business.project.domain.Project;
|
||||
import tech.unissense.pms.business.project.mapper.ProjectMapper;
|
||||
import tech.unissense.pms.business.projectFile.domain.ProjectFile;
|
||||
import tech.unissense.pms.business.projectFile.service.IProjectFileService;
|
||||
import tech.unissense.pms.common.exception.ServiceException;
|
||||
import tech.unissense.pms.common.utils.DateUtils;
|
||||
|
||||
|
@ -16,6 +20,7 @@ import java.math.BigDecimal;
|
|||
import java.math.RoundingMode;
|
||||
import java.time.LocalDate;
|
||||
import java.time.ZoneId;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
|
@ -32,6 +37,8 @@ public class ProjectDemandServiceImpl implements IProjectDemandService {
|
|||
@Resource
|
||||
private ProjectMapper projectMapper;
|
||||
|
||||
@Autowired
|
||||
private IProjectFileService projectFileService;
|
||||
/**
|
||||
* 查询列表数据
|
||||
*
|
||||
|
@ -46,7 +53,10 @@ public class ProjectDemandServiceImpl implements IProjectDemandService {
|
|||
|
||||
@Override
|
||||
public ProjectDemand queryById(Integer id) {
|
||||
return projectDemandMapper.queryById(id);
|
||||
ProjectDemand projectDemand = projectDemandMapper.queryById(id);
|
||||
List<ProjectFile> projectFiles = projectFileService.listByIdAndType(Collections.singletonList(id), ProjectFile.FileTypeEnum.DEMAND.getValue());
|
||||
projectDemand.setFileList(projectFiles);
|
||||
return projectDemand;
|
||||
}
|
||||
|
||||
|
||||
|
@ -66,6 +76,17 @@ public class ProjectDemandServiceImpl implements IProjectDemandService {
|
|||
}
|
||||
}
|
||||
int insert = projectDemandMapper.insert(projectDemand);
|
||||
List<ProjectFile> fileList = projectDemand.getFileList();
|
||||
if (CollUtil.isNotEmpty(fileList)){
|
||||
for (ProjectFile projectFile : fileList) {
|
||||
projectFile.setFileType(ProjectFile.FileTypeEnum.DEMAND.getValue());
|
||||
projectFile.setDemandId(projectDemand.getId());
|
||||
projectFile.setProjectId(projectFile.getProjectId());
|
||||
}
|
||||
projectFileService.saveBatch(fileList);
|
||||
}
|
||||
|
||||
|
||||
return projectDemand;
|
||||
}
|
||||
|
||||
|
@ -101,6 +122,15 @@ public class ProjectDemandServiceImpl implements IProjectDemandService {
|
|||
throw new ServiceException("结束时间不能早于当前时间");
|
||||
}
|
||||
|
||||
List<ProjectFile> fileList = projectDemand.getFileList();
|
||||
if (CollUtil.isNotEmpty(fileList)){
|
||||
for (ProjectFile projectFile : fileList) {
|
||||
projectFile.setFileType(ProjectFile.FileTypeEnum.DEMAND.getValue());
|
||||
projectFile.setDemandId(projectDemand.getId());
|
||||
projectFile.setProjectId(projectFile.getProjectId());
|
||||
}
|
||||
projectFileService.saveBatch(fileList);
|
||||
}
|
||||
return projectDemandMapper.update(projectDemand);
|
||||
}
|
||||
|
||||
|
|
|
@ -2,9 +2,11 @@ package tech.unissense.pms.business.project.domain;
|
|||
|
||||
import lombok.Data;
|
||||
import tech.unissense.pms.business.demand.domain.ProjectDemand;
|
||||
import tech.unissense.pms.business.projectFile.domain.ProjectFile;
|
||||
import tech.unissense.pms.common.core.domain.BaseEntity;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* (Project)实体类
|
||||
|
@ -80,6 +82,9 @@ public class Project extends BaseEntity {
|
|||
private Integer teamNum;
|
||||
|
||||
private Long queryUserId;
|
||||
|
||||
|
||||
private List<ProjectFile> fileList;
|
||||
/**
|
||||
* 需求状态
|
||||
*/
|
||||
|
|
|
@ -11,6 +11,8 @@ import tech.unissense.pms.business.project.mapper.ProjectMapper;
|
|||
import tech.unissense.pms.business.project.service.IProjectService;
|
||||
import tech.unissense.pms.business.project.vo.ProjectExecutionVo;
|
||||
import tech.unissense.pms.business.project.vo.ProjectWorkInfoVo;
|
||||
import tech.unissense.pms.business.projectFile.domain.ProjectFile;
|
||||
import tech.unissense.pms.business.projectFile.service.IProjectFileService;
|
||||
import tech.unissense.pms.business.projectteam.domain.ProjectTeam;
|
||||
import tech.unissense.pms.business.projectteam.service.IProjectTeamService;
|
||||
import tech.unissense.pms.business.projectteam.vo.TeamStaticsVo;
|
||||
|
@ -56,6 +58,8 @@ public class ProjectServiceImpl implements IProjectService {
|
|||
private static final ConcurrentHashMap<String, AtomicInteger> DAILY_SEQUENCE_MAP = new ConcurrentHashMap<>();
|
||||
@Autowired
|
||||
private RedisCache redisCache;
|
||||
@Autowired
|
||||
private IProjectFileService projectFileService;
|
||||
|
||||
/**
|
||||
* 通过ID查询单条数据
|
||||
|
@ -65,7 +69,10 @@ public class ProjectServiceImpl implements IProjectService {
|
|||
*/
|
||||
@Override
|
||||
public Project queryById(Integer projectId) {
|
||||
return this.projectMapper.queryById(projectId);
|
||||
Project project = this.projectMapper.queryById(projectId);
|
||||
List<ProjectFile> projectFiles = projectFileService.listByIdAndType(Collections.singletonList(projectId), ProjectFile.FileTypeEnum.PROJECT.getValue());
|
||||
project.setFileList(projectFiles);
|
||||
return project;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -178,10 +185,13 @@ public class ProjectServiceImpl implements IProjectService {
|
|||
}
|
||||
// 新增项目
|
||||
this.projectMapper.insert(project);
|
||||
// project.getProjectTeamList().forEach(item ->
|
||||
// item.setProjectId(project.getProjectId()));
|
||||
// // 新增项目人员
|
||||
// teamService.insertBatch(project.getProjectTeamList());
|
||||
for (ProjectFile projectFile : project.getFileList()) {
|
||||
projectFile.setProjectId(project.getProjectId());
|
||||
projectFile.setFileType(ProjectFile.FileTypeEnum.PROJECT.getValue());
|
||||
}
|
||||
// 新增不需要修改
|
||||
projectFileService.saveBatch(project.getFileList());
|
||||
|
||||
return project;
|
||||
}
|
||||
|
||||
|
@ -198,6 +208,12 @@ public class ProjectServiceImpl implements IProjectService {
|
|||
throw new ServiceException(errorMsg);
|
||||
}
|
||||
this.projectMapper.update(project);
|
||||
// 项目文件不允许修改
|
||||
for (ProjectFile projectFile : project.getFileList()) {
|
||||
projectFile.setProjectId(project.getProjectId());
|
||||
projectFile.setFileType(ProjectFile.FileTypeEnum.PROJECT.getValue());
|
||||
}
|
||||
projectFileService.saveBatch(project.getFileList());
|
||||
return this.queryById(project.getProjectId());
|
||||
}
|
||||
|
||||
|
@ -267,19 +283,19 @@ public class ProjectServiceImpl implements IProjectService {
|
|||
WorkLogger workLogger = new WorkLogger();
|
||||
workLogger.setProjectIdList(projectIdList);
|
||||
List<WorkLogger> allWorkLoggerList = workLoggerService.list(workLogger);
|
||||
Map<Integer, BigDecimal> workTimeAllMap = allWorkLoggerList.stream().filter(item-> StrUtil.isNotEmpty(item.getWorkTime())).collect(Collectors.groupingBy(WorkLogger::getProjectId, Collectors.reducing(BigDecimal.ZERO
|
||||
Map<Integer, BigDecimal> workTimeAllMap = allWorkLoggerList.stream().filter(item -> StrUtil.isNotEmpty(item.getWorkTime())).collect(Collectors.groupingBy(WorkLogger::getProjectId, Collectors.reducing(BigDecimal.ZERO
|
||||
, item -> new BigDecimal(item.getWorkTime()), BigDecimal::add)));
|
||||
// BeanUtils.copyBeanProp(workLogger,queryDto);
|
||||
|
||||
List<WorkLogger> workLoggerList = allWorkLoggerList.stream()
|
||||
List<WorkLogger> workLoggerList = allWorkLoggerList.stream()
|
||||
.filter(item -> {
|
||||
Date date = item.getLoggerDate();
|
||||
Integer userId = item.getUserId();
|
||||
boolean flag=(date != null && !date.before(queryDto.getStartDate()) && !date.after(queryDto.getEndDate()));
|
||||
if (queryDto.getUserId() != null){
|
||||
flag=flag&&queryDto.getUserId().equals(userId);
|
||||
boolean flag = (date != null && !date.before(queryDto.getStartDate()) && !date.after(queryDto.getEndDate()));
|
||||
if (queryDto.getUserId() != null) {
|
||||
flag = flag && queryDto.getUserId().equals(userId);
|
||||
}
|
||||
return flag;
|
||||
return flag;
|
||||
})
|
||||
.collect(Collectors.toList());
|
||||
|
||||
|
@ -340,8 +356,8 @@ public class ProjectServiceImpl implements IProjectService {
|
|||
WorkLogger::getUserId,
|
||||
logger -> logger,
|
||||
(existing,
|
||||
replacement) -> existing.getCreateTime()
|
||||
.after(replacement.getCreateTime()) ? existing : replacement),
|
||||
replacement) -> existing.getCreateTime()
|
||||
.after(replacement.getCreateTime()) ? existing : replacement),
|
||||
map -> new ArrayList<>(map.values()))));
|
||||
|
||||
LocalDate startDate = projectQueryDto.getStartDate().toInstant().atZone(ZoneId.systemDefault()).toLocalDate();
|
||||
|
|
|
@ -0,0 +1,103 @@
|
|||
package tech.unissense.pms.business.projectFile.domain;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.Getter;
|
||||
|
||||
|
||||
/**
|
||||
* (ProjectFile)实体类
|
||||
*
|
||||
* @author ch
|
||||
* @since 2025-04-21 17:40:56
|
||||
*/
|
||||
@Data
|
||||
|
||||
public class ProjectFile {
|
||||
|
||||
|
||||
private Integer id;
|
||||
/**
|
||||
* 项目id
|
||||
*/
|
||||
|
||||
private Integer projectId;
|
||||
/**
|
||||
* 需求id
|
||||
*/
|
||||
|
||||
private Integer demandId;
|
||||
/**
|
||||
* 日志id
|
||||
*/
|
||||
|
||||
private Integer loggerId;
|
||||
/**
|
||||
* 附件类型 ( 0:项目附件 1:需求附件 2:日志附件)
|
||||
*/
|
||||
|
||||
private String fileType;
|
||||
/**
|
||||
* 文件路径
|
||||
*/
|
||||
|
||||
private String fileUrl;
|
||||
/**
|
||||
* 文件名
|
||||
*/
|
||||
|
||||
private String fileNewName;
|
||||
/**
|
||||
* 上传文件名
|
||||
*/
|
||||
|
||||
private String fileName;
|
||||
/**
|
||||
* 创建者
|
||||
*/
|
||||
|
||||
private Integer createBy;
|
||||
/**
|
||||
* 更新者
|
||||
*/
|
||||
|
||||
private Integer updateBy;
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
|
||||
private Date updateTime;
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
|
||||
private Date createTime;
|
||||
|
||||
@Getter
|
||||
public enum FileTypeEnum {
|
||||
PROJECT("0", "项目附件"),
|
||||
DEMAND("1", "需求附件"),
|
||||
LOGGER("2", "日志附件");
|
||||
private final String value;
|
||||
private final String remark;
|
||||
|
||||
FileTypeEnum(String value, String remark) {
|
||||
this.value = value;
|
||||
this.remark = remark;
|
||||
}
|
||||
|
||||
public static String getRemark(String value) {
|
||||
for (FileTypeEnum fileTypeEnum : FileTypeEnum.values()) {
|
||||
if (fileTypeEnum.value.equals(value)) {
|
||||
return fileTypeEnum.remark;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,55 @@
|
|||
package tech.unissense.pms.business.projectFile.mapper;
|
||||
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import tech.unissense.pms.business.projectFile.domain.ProjectFile;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author ch
|
||||
* @Desc (ProjectFile)表数据库访问层
|
||||
* @Date 2025-04-21 17:40:56
|
||||
*/
|
||||
public interface ProjectFileMapper {
|
||||
|
||||
/**
|
||||
* 通过实体作为筛选条件查询
|
||||
*
|
||||
* @param projectFile 实例对象
|
||||
* @return 对象列表
|
||||
*/
|
||||
List<ProjectFile> queryAll(ProjectFile projectFile);
|
||||
|
||||
/**
|
||||
* 根据ID查详情
|
||||
*/
|
||||
ProjectFile queryById(Integer id);
|
||||
|
||||
|
||||
/**
|
||||
* 新增数据
|
||||
*/
|
||||
int insert(ProjectFile projectFile);
|
||||
|
||||
|
||||
/**
|
||||
* 修改数据
|
||||
*/
|
||||
int update(ProjectFile projectFile);
|
||||
|
||||
/**
|
||||
* 通过主键删除数据
|
||||
*/
|
||||
int deleteById(Integer id);
|
||||
|
||||
/**
|
||||
* 通过id批量删除
|
||||
*/
|
||||
int batchRemove(Integer[] ids);
|
||||
|
||||
void insertBatch(List<ProjectFile> addFileList);
|
||||
|
||||
void updateBatch(List<ProjectFile> updateFileList);
|
||||
|
||||
List<ProjectFile> listByIdAndType(@Param("relationIdList") List<Integer> id, @Param("type") String type);
|
||||
}
|
|
@ -0,0 +1,53 @@
|
|||
package tech.unissense.pms.business.projectFile.service;
|
||||
|
||||
import tech.unissense.pms.business.projectFile.domain.ProjectFile;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author ch
|
||||
* @Desc (ProjectFile)表服务接口
|
||||
* @Date 2025-04-21 17:40:56
|
||||
*/
|
||||
public interface IProjectFileService {
|
||||
|
||||
/**
|
||||
* 通过实体作为筛选条件查询
|
||||
*/
|
||||
List<ProjectFile> queryAll(ProjectFile projectFile);
|
||||
|
||||
|
||||
/**
|
||||
* 根据ID查详情
|
||||
*/
|
||||
ProjectFile queryById(Integer id);
|
||||
|
||||
/**
|
||||
* 新增数据
|
||||
*/
|
||||
int insert(ProjectFile projectFile);
|
||||
|
||||
/**
|
||||
* 修改数据
|
||||
*/
|
||||
int update(ProjectFile projectFile);
|
||||
|
||||
/**
|
||||
* 通过主键删除数据
|
||||
*/
|
||||
int deleteById(Integer id);
|
||||
|
||||
/**
|
||||
* 通过id批量删除
|
||||
*/
|
||||
int batchRemove(Integer[] ids);
|
||||
|
||||
void insertBatch(List<ProjectFile> addFileList);
|
||||
|
||||
void saveBatch(List<ProjectFile> updateFileList);
|
||||
|
||||
List<ProjectFile> listByIdAndType(List<Integer> projectId, String value);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,116 @@
|
|||
package tech.unissense.pms.business.projectFile.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import tech.unissense.pms.business.projectFile.domain.ProjectFile;
|
||||
import tech.unissense.pms.business.projectFile.mapper.ProjectFileMapper;
|
||||
import tech.unissense.pms.business.projectFile.service.IProjectFileService;
|
||||
import org.springframework.stereotype.Service;
|
||||
import tech.unissense.pms.common.utils.file.FileUtils;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author ch
|
||||
* @Desc (ProjectFile)表服务实现类
|
||||
* @Date 2025-04-21 17:40:56
|
||||
*/
|
||||
|
||||
@Slf4j
|
||||
@Service
|
||||
public class ProjectFileServiceImpl implements IProjectFileService {
|
||||
|
||||
@Resource
|
||||
private ProjectFileMapper projectFileMapper;
|
||||
|
||||
|
||||
/**
|
||||
* 查询列表数据
|
||||
*
|
||||
* @param projectFile 实例对象
|
||||
* @return 对象列表
|
||||
*/
|
||||
@Override
|
||||
public List<ProjectFile> queryAll(ProjectFile projectFile) {
|
||||
List<ProjectFile> dataList = projectFileMapper.queryAll(projectFile);
|
||||
return dataList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ProjectFile queryById(Integer id) {
|
||||
return projectFileMapper.queryById(id);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int insert(ProjectFile projectFile) {
|
||||
return projectFileMapper.insert(projectFile);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int update(ProjectFile projectFile) {
|
||||
return projectFileMapper.update(projectFile);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int deleteById(Integer id) {
|
||||
ProjectFile projectFile = projectFileMapper.queryById(id);
|
||||
try {
|
||||
FileUtils.deleteFile(projectFile.getFileUrl());
|
||||
} catch (Exception e) {
|
||||
log.error("删除文件失败,失败详情:{}", e.getStackTrace());
|
||||
}
|
||||
return projectFileMapper.deleteById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id批量删除
|
||||
*/
|
||||
@Override
|
||||
public int batchRemove(Integer[] ids) {
|
||||
return projectFileMapper.batchRemove(ids);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void insertBatch(List<ProjectFile> addFileList) {
|
||||
projectFileMapper.insertBatch(addFileList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 附件目前只有删除和新增 没有修改
|
||||
*
|
||||
* @param fileList
|
||||
*/
|
||||
@Override
|
||||
public void saveBatch(List<ProjectFile> fileList) {
|
||||
List<ProjectFile> addFileList = new ArrayList<>();
|
||||
|
||||
for (ProjectFile projectFile : fileList) {
|
||||
//新增
|
||||
if (projectFile.getId() == null) {
|
||||
addFileList.add(projectFile);
|
||||
}
|
||||
}
|
||||
if (CollUtil.isNotEmpty(addFileList)) {
|
||||
projectFileMapper.insertBatch(addFileList);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ProjectFile> listByIdAndType(List<Integer> id, String type) {
|
||||
if (CollUtil.isEmpty(id)) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
return projectFileMapper.listByIdAndType(id, type);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -6,6 +6,7 @@ import java.util.List;
|
|||
|
||||
|
||||
import lombok.Data;
|
||||
import tech.unissense.pms.business.projectFile.domain.ProjectFile;
|
||||
import tech.unissense.pms.common.core.domain.BaseEntity;
|
||||
|
||||
/**
|
||||
|
@ -61,5 +62,7 @@ public class WorkLogger extends BaseEntity {
|
|||
private String title;
|
||||
private String versionNumber;
|
||||
|
||||
private List<ProjectFile> fileList;
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -6,6 +6,8 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|||
import org.springframework.stereotype.Service;
|
||||
import tech.unissense.pms.business.project.domain.Project;
|
||||
import tech.unissense.pms.business.project.service.IProjectService;
|
||||
import tech.unissense.pms.business.projectFile.domain.ProjectFile;
|
||||
import tech.unissense.pms.business.projectFile.service.IProjectFileService;
|
||||
import tech.unissense.pms.business.work.logger.domain.WorkLogger;
|
||||
import tech.unissense.pms.business.work.logger.mapper.WorkLoggerMapper;
|
||||
import tech.unissense.pms.business.work.logger.service.IWorkLoggerService;
|
||||
|
@ -40,6 +42,9 @@ public class WorkLoggerServiceImpl implements IWorkLoggerService {
|
|||
|
||||
@Autowired
|
||||
private ISysConfigService configService;
|
||||
@Autowired
|
||||
private IProjectFileService fileService;
|
||||
|
||||
/**
|
||||
* 通过ID查询单条数据
|
||||
*
|
||||
|
@ -48,13 +53,16 @@ public class WorkLoggerServiceImpl implements IWorkLoggerService {
|
|||
*/
|
||||
@Override
|
||||
public WorkLogger queryById(Integer id) {
|
||||
return this.workLoggerMapper.queryById(id);
|
||||
WorkLogger workLogger = this.workLoggerMapper.queryById(id);
|
||||
List<ProjectFile> projectFiles = fileService.listByIdAndType(Collections.singletonList(id), ProjectFile.FileTypeEnum.LOGGER.getValue());
|
||||
workLogger.setFileList(projectFiles);
|
||||
return workLogger;
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
*
|
||||
* @param workLogger 筛选条件
|
||||
* @param workLogger 筛选条件
|
||||
* @param pageRequest 分页对象
|
||||
* @return 查询结果
|
||||
*/
|
||||
|
@ -74,6 +82,16 @@ public class WorkLoggerServiceImpl implements IWorkLoggerService {
|
|||
public WorkLogger insert(WorkLogger workLogger) {
|
||||
verifyMaxWorkTime(workLogger);
|
||||
this.workLoggerMapper.insert(workLogger);
|
||||
List<ProjectFile> fileList = workLogger.getFileList();
|
||||
if (CollUtil.isNotEmpty(fileList)) {
|
||||
for (ProjectFile projectFile : fileList) {
|
||||
projectFile.setFileType(ProjectFile.FileTypeEnum.LOGGER.getValue());
|
||||
projectFile.setLoggerId(workLogger.getLoggerId());
|
||||
projectFile.setProjectId(workLogger.getProjectId());
|
||||
projectFile.setDemandId(workLogger.getDemandId());
|
||||
}
|
||||
fileService.saveBatch(fileList);
|
||||
}
|
||||
return workLogger;
|
||||
}
|
||||
|
||||
|
@ -82,7 +100,7 @@ public class WorkLoggerServiceImpl implements IWorkLoggerService {
|
|||
WorkLogger queryParam = new WorkLogger();
|
||||
queryParam.setLoggerDate(workLogger.getLoggerDate());
|
||||
String remaining = this.getRemaining(queryParam);
|
||||
if (new BigDecimal(remaining).compareTo(new BigDecimal(workLogger.getWorkTime()))<0){
|
||||
if (new BigDecimal(remaining).compareTo(new BigDecimal(workLogger.getWorkTime())) < 0) {
|
||||
throw new RuntimeException("超出最大可填写工时");
|
||||
}
|
||||
}
|
||||
|
@ -96,6 +114,16 @@ public class WorkLoggerServiceImpl implements IWorkLoggerService {
|
|||
@Override
|
||||
public WorkLogger update(WorkLogger workLogger) {
|
||||
this.workLoggerMapper.update(workLogger);
|
||||
List<ProjectFile> fileList = workLogger.getFileList();
|
||||
if (CollUtil.isNotEmpty(fileList)) {
|
||||
for (ProjectFile projectFile : fileList) {
|
||||
projectFile.setFileType(ProjectFile.FileTypeEnum.LOGGER.getValue());
|
||||
projectFile.setLoggerId(workLogger.getLoggerId());
|
||||
projectFile.setProjectId(workLogger.getProjectId());
|
||||
projectFile.setDemandId(workLogger.getDemandId());
|
||||
}
|
||||
fileService.saveBatch(fileList);
|
||||
}
|
||||
return this.queryById(workLogger.getLoggerId());
|
||||
}
|
||||
|
||||
|
@ -113,6 +141,14 @@ public class WorkLoggerServiceImpl implements IWorkLoggerService {
|
|||
@Override
|
||||
public List<WorkLogger> getInfo(WorkLogger workLogger) {
|
||||
List<WorkLogger> list = this.workLoggerMapper.list(workLogger);
|
||||
List<Integer> idList = list.stream().map(WorkLogger::getLoggerId).collect(Collectors.toList());
|
||||
List<ProjectFile> projectFiles = fileService.listByIdAndType(idList, ProjectFile.FileTypeEnum.LOGGER.getValue());
|
||||
Map<Integer, List<ProjectFile>> listMap = projectFiles.stream().collect(Collectors.groupingBy(ProjectFile::getLoggerId, Collectors.toList()));
|
||||
if (CollUtil.isNotEmpty(listMap)) {
|
||||
for (WorkLogger logger : list) {
|
||||
logger.setFileList(listMap.getOrDefault(logger.getLoggerId(), Collections.emptyList()));
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
|
@ -121,10 +157,10 @@ public class WorkLoggerServiceImpl implements IWorkLoggerService {
|
|||
List<WorkLogger> calendar = workLoggerMapper.calendar(workLogger);
|
||||
Map<String, WorkLogger> calendarMap = calendar.stream().collect(Collectors.toMap(
|
||||
item -> DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD, item.getLoggerDate()), Function.identity(), (v1, v2) -> v1));
|
||||
|
||||
|
||||
LocalDate startDate = workLogger.getStartDate().toInstant().atZone(ZoneId.systemDefault()).toLocalDate();
|
||||
LocalDate endDate = workLogger.getEndDate().toInstant().atZone(ZoneId.systemDefault()).toLocalDate();
|
||||
|
||||
|
||||
List<CalendarVo> result = new ArrayList<>();
|
||||
for (LocalDate localDate = startDate; !localDate.isAfter(endDate); localDate = localDate.plusDays(1)) {
|
||||
CalendarVo calendarVo = new CalendarVo();
|
||||
|
@ -135,7 +171,7 @@ public class WorkLoggerServiceImpl implements IWorkLoggerService {
|
|||
calendarVo.setWorkTime(temp != null ? temp.getWorkTime() : "0");
|
||||
result.add(calendarVo);
|
||||
}
|
||||
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -202,7 +238,7 @@ public class WorkLoggerServiceImpl implements IWorkLoggerService {
|
|||
Map<String, BigDecimal> personWorkHourMap = workLoggers.stream()
|
||||
.collect(Collectors.toMap(
|
||||
WorkLogger::getCreateBy,
|
||||
item->new BigDecimal(item.getWorkTime()),
|
||||
item -> new BigDecimal(item.getWorkTime()),
|
||||
BigDecimal::add
|
||||
));
|
||||
|
||||
|
@ -221,7 +257,7 @@ public class WorkLoggerServiceImpl implements IWorkLoggerService {
|
|||
Long userId = SecurityUtils.getLoginUser().getUserId();
|
||||
// 设置用户ID和当天的零点时间
|
||||
workLogger.setUserId(userId.intValue());
|
||||
if (workLogger.getLoggerDate()==null) {
|
||||
if (workLogger.getLoggerDate() == null) {
|
||||
workLogger.setLoggerDate(DateUtils.getNowDate());
|
||||
}
|
||||
workLogger.setLoggerDate(DateUtils.toDate(workLogger.getLoggerDate().toInstant().atZone(ZoneId.systemDefault()).toLocalDate()));
|
||||
|
@ -231,7 +267,7 @@ public class WorkLoggerServiceImpl implements IWorkLoggerService {
|
|||
|
||||
// 计算workTime之和
|
||||
BigDecimal totalWorkTime = list.stream()
|
||||
.map(item->new BigDecimal(item.getWorkTime())) // 假设WorkLogger有getWorkTime方法返回BigDecimal
|
||||
.map(item -> new BigDecimal(item.getWorkTime())) // 假设WorkLogger有getWorkTime方法返回BigDecimal
|
||||
.reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||
String configByKey = configService.selectConfigByKey("pms.work.dayTime");
|
||||
// String dictLabel = DictUtils.getDictLabel("work_logger", "day_work_time");
|
||||
|
@ -251,7 +287,7 @@ public class WorkLoggerServiceImpl implements IWorkLoggerService {
|
|||
return items.stream()
|
||||
// 对每个项目项创建一个StaticsHourVo对象
|
||||
.map(item -> createStaticsHourVo(nameExtractor.apply(item), workDayMap.getOrDefault(idExtractor.apply(item), BigDecimal.ZERO)
|
||||
,idExtractor.apply(item)))
|
||||
, idExtractor.apply(item)))
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
|
@ -259,12 +295,12 @@ public class WorkLoggerServiceImpl implements IWorkLoggerService {
|
|||
private List<StaticsHourVo> generateStaticsHourVoList(Map<String, BigDecimal> workDayMap) {
|
||||
return workDayMap.entrySet().stream()
|
||||
// 对每个用户创建一个StaticsHourVo对象
|
||||
.map(entry -> createStaticsHourVo(entry.getKey(), entry.getValue(),null))
|
||||
.map(entry -> createStaticsHourVo(entry.getKey(), entry.getValue(), null))
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
// 创建StaticsHourVo对象,计算工时并格式化为字符串
|
||||
private StaticsHourVo createStaticsHourVo(String name, BigDecimal workTime,Integer projectId) {
|
||||
private StaticsHourVo createStaticsHourVo(String name, BigDecimal workTime, Integer projectId) {
|
||||
StaticsHourVo vo = new StaticsHourVo();
|
||||
vo.setProjectId(projectId);
|
||||
vo.setName(name);
|
||||
|
|
|
@ -0,0 +1,296 @@
|
|||
<?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="tech.unissense.pms.business.projectFile.mapper.ProjectFileMapper">
|
||||
|
||||
<resultMap type="tech.unissense.pms.business.projectFile.domain.ProjectFile" id="ProjectFileMap">
|
||||
<result property="id" column="id"/>
|
||||
<result property="projectId" column="project_id"/>
|
||||
<result property="demandId" column="demand_id"/>
|
||||
<result property="loggerId" column="logger_id"/>
|
||||
<result property="fileType" column="file_type"/>
|
||||
<result property="fileUrl" column="file_url"/>
|
||||
<result property="fileNewName" column="file_new_name"/>
|
||||
<result property="fileName" column="file_name"/>
|
||||
<result property="createBy" column="create_by"/>
|
||||
<result property="updateBy" column="update_by"/>
|
||||
<result property="updateTime" column="update_time"/>
|
||||
<result property="createTime" column="create_time"/>
|
||||
</resultMap>
|
||||
|
||||
<!-- 基本字段 -->
|
||||
<sql id="Base_Column_List">
|
||||
id, project_id, demand_id, logger_id, file_type, file_url, file_new_name, file_name, create_by, update_by, update_time, create_time
|
||||
</sql>
|
||||
|
||||
<!--通过实体作为筛选条件查询-->
|
||||
<select id="queryAll" resultMap="ProjectFileMap">
|
||||
select
|
||||
<include refid="Base_Column_List"/>
|
||||
from pms_project_file
|
||||
<where>
|
||||
<if test="id != null">
|
||||
and id = #{id}
|
||||
</if>
|
||||
<if test="projectId != null">
|
||||
and project_id = #{projectId}
|
||||
</if>
|
||||
<if test="demandId != null">
|
||||
and demand_id = #{demandId}
|
||||
</if>
|
||||
<if test="loggerId != null">
|
||||
and logger_id = #{loggerId}
|
||||
</if>
|
||||
<if test="fileType != null and fileType != ''">
|
||||
and file_type = #{fileType}
|
||||
</if>
|
||||
<if test="fileUrl != null and fileUrl != ''">
|
||||
and file_url = #{fileUrl}
|
||||
</if>
|
||||
<if test="fileNewName != null and fileNewName != ''">
|
||||
and file_new_name = #{fileNewName}
|
||||
</if>
|
||||
<if test="fileName != null and fileName != ''">
|
||||
and file_name = #{fileName}
|
||||
</if>
|
||||
<if test="createBy != null">
|
||||
and create_by = #{createBy}
|
||||
</if>
|
||||
<if test="updateBy != null">
|
||||
and update_by = #{updateBy}
|
||||
</if>
|
||||
<if test="updateTime != null">
|
||||
and update_time = #{updateTime}
|
||||
</if>
|
||||
<if test="createTime != null">
|
||||
and create_time = #{createTime}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
|
||||
<!--根据ID查详情-->
|
||||
<select id="queryById" parameterType="Integer" resultMap="ProjectFileMap">
|
||||
SELECT id,
|
||||
project_id,
|
||||
demand_id,
|
||||
logger_id,
|
||||
file_type,
|
||||
file_url,
|
||||
file_new_name,
|
||||
file_name,
|
||||
create_by,
|
||||
update_by,
|
||||
update_time,
|
||||
create_time
|
||||
FROM pms_project_file
|
||||
WHERE id = #{id}
|
||||
LIMIT 1
|
||||
</select>
|
||||
<select id="listByIdAndType" resultType="tech.unissense.pms.business.projectFile.domain.ProjectFile">
|
||||
select
|
||||
<include refid="Base_Column_List"/>
|
||||
from pms_project_file
|
||||
where file_type=#{type}
|
||||
<choose>
|
||||
<when test="type == '0'.toString()">
|
||||
and project_id in
|
||||
<foreach collection="relationIdList" item="relationId" separator="," open="(" close=")">
|
||||
#{relationId}
|
||||
</foreach>
|
||||
|
||||
</when>
|
||||
<when test="type == '1'.toString()">
|
||||
and demand_id in
|
||||
<foreach collection="relationIdList" item="relationId" separator="," open="(" close=")">
|
||||
#{relationId}
|
||||
</foreach>
|
||||
</when>
|
||||
<when test="type == '2'.toString()">
|
||||
and logger_id in
|
||||
<foreach collection="relationIdList" item="relationId" separator="," open="(" close=")">
|
||||
#{relationId}
|
||||
</foreach>
|
||||
</when>
|
||||
</choose>
|
||||
</select>
|
||||
|
||||
|
||||
<!--新增所有列-->
|
||||
<insert id="insert" keyProperty="id" useGeneratedKeys="true">
|
||||
INSERT INTO pms_project_file
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="projectId != null">
|
||||
project_id,
|
||||
</if>
|
||||
<if test="demandId != null">
|
||||
demand_id,
|
||||
</if>
|
||||
<if test="loggerId != null">
|
||||
logger_id,
|
||||
</if>
|
||||
<if test="fileType != null and fileType != ''">
|
||||
file_type,
|
||||
</if>
|
||||
<if test="fileUrl != null and fileUrl != ''">
|
||||
file_url,
|
||||
</if>
|
||||
<if test="fileNewName != null and fileNewName != ''">
|
||||
file_new_name,
|
||||
</if>
|
||||
<if test="fileName != null and fileName != ''">
|
||||
file_name,
|
||||
</if>
|
||||
<if test="createBy != null">
|
||||
create_by,
|
||||
</if>
|
||||
<if test="updateBy != null">
|
||||
update_by,
|
||||
</if>
|
||||
<if test="updateTime != null">
|
||||
update_time,
|
||||
</if>
|
||||
<if test="createTime != null">
|
||||
create_time,
|
||||
</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="projectId != null">
|
||||
#{projectId},
|
||||
</if>
|
||||
<if test="demandId != null">
|
||||
#{demandId},
|
||||
</if>
|
||||
<if test="loggerId != null">
|
||||
#{loggerId},
|
||||
</if>
|
||||
<if test="fileType != null and fileType != ''">
|
||||
#{fileType},
|
||||
</if>
|
||||
<if test="fileUrl != null and fileUrl != ''">
|
||||
#{fileUrl},
|
||||
</if>
|
||||
<if test="fileNewName != null and fileNewName != ''">
|
||||
#{fileNewName},
|
||||
</if>
|
||||
<if test="fileName != null and fileName != ''">
|
||||
#{fileName},
|
||||
</if>
|
||||
<if test="createBy != null">
|
||||
#{createBy},
|
||||
</if>
|
||||
<if test="updateBy != null">
|
||||
#{updateBy},
|
||||
</if>
|
||||
<if test="updateTime != null">
|
||||
#{updateTime},
|
||||
</if>
|
||||
<if test="createTime != null">
|
||||
#{createTime},
|
||||
</if>
|
||||
</trim>
|
||||
</insert>
|
||||
<insert id="insertBatch">
|
||||
INSERT INTO pms_project_file( project_id, demand_id, logger_id, file_type, file_url, file_new_name, file_name, create_by, create_time)
|
||||
values
|
||||
<foreach collection="list" item="item" index="index" separator=",">
|
||||
(#{item.projectId},#{item.demandId},#{item.loggerId},#{item.fileType},#{item.fileUrl},#{item.fileNewName},#{item.fileName},#{item.createBy},#{item.createTime})
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<!--通过主键修改数据-->
|
||||
<update id="update">
|
||||
UPDATE pms_project_file
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="projectId != null">
|
||||
project_id = #{projectId},
|
||||
</if>
|
||||
<if test="demandId != null">
|
||||
demand_id = #{demandId},
|
||||
</if>
|
||||
<if test="loggerId != null">
|
||||
logger_id = #{loggerId},
|
||||
</if>
|
||||
<if test="fileType != null and fileType != ''">
|
||||
file_type = #{fileType},
|
||||
</if>
|
||||
<if test="fileUrl != null and fileUrl != ''">
|
||||
file_url = #{fileUrl},
|
||||
</if>
|
||||
<if test="fileNewName != null and fileNewName != ''">
|
||||
file_new_name = #{fileNewName},
|
||||
</if>
|
||||
<if test="fileName != null and fileName != ''">
|
||||
file_name = #{fileName},
|
||||
</if>
|
||||
<if test="createBy != null">
|
||||
create_by = #{createBy},
|
||||
</if>
|
||||
<if test="updateBy != null">
|
||||
update_by = #{updateBy},
|
||||
</if>
|
||||
<if test="updateTime != null">
|
||||
update_time = #{updateTime},
|
||||
</if>
|
||||
<if test="createTime != null">
|
||||
create_time = #{createTime},
|
||||
</if>
|
||||
</trim>
|
||||
WHERE id = #{id}
|
||||
</update>
|
||||
<update id="updateBatch">
|
||||
<foreach collection="list" item="item" index="index" separator=";">
|
||||
UPDATE pms_project_file
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="item.projectId != null">
|
||||
project_id = #{item.projectId},
|
||||
</if>
|
||||
<if test="item.demandId != null">
|
||||
demand_id = #{item.demandId},
|
||||
</if>
|
||||
<if test="item.loggerId != null">
|
||||
logger_id = #{item.loggerId},
|
||||
</if>
|
||||
<if test="item.fileType != null and item.fileType != ''">
|
||||
file_type = #{item.fileType},
|
||||
</if>
|
||||
<if test="item.fileUrl != null and item.fileUrl != ''">
|
||||
file_url = #{item.fileUrl},
|
||||
</if>
|
||||
<if test="item.fileNewName != null and item.fileNewName != ''">
|
||||
file_new_name = #{item.fileNewName},
|
||||
</if>
|
||||
<if test="item.fileName != null and item.fileName != ''">
|
||||
file_name = #{item.fileName},
|
||||
</if>
|
||||
|
||||
<if test="item.updateBy != null">
|
||||
update_by = #{item.updateBy},
|
||||
</if>
|
||||
<if test="item.updateTime != null">
|
||||
update_time = #{item.updateTime},
|
||||
</if>
|
||||
|
||||
</trim>
|
||||
WHERE id = #{item.id}
|
||||
</foreach>
|
||||
</update>
|
||||
|
||||
<!--通过主键删除-->
|
||||
<delete id="deleteById">
|
||||
DELETE
|
||||
FROM pms_project_file
|
||||
WHERE id = #{id}
|
||||
</delete>
|
||||
|
||||
<!--通过id批量删除-->
|
||||
<delete id="batchRemove">
|
||||
delete from pms_project_file where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
</mapper>
|
||||
|
||||
|
||||
|
|
@ -312,6 +312,9 @@
|
|||
<if test="createTime != null">
|
||||
create_time = #{createTime},
|
||||
</if>
|
||||
<if test="demandId != null">
|
||||
demand_id = #{demandId},
|
||||
</if>
|
||||
</set>
|
||||
where logger_id = #{loggerId}
|
||||
</update>
|
||||
|
|
|
@ -14,7 +14,7 @@ import tech.unissense.pms.common.xss.Xss;
|
|||
|
||||
/**
|
||||
* 用户对象 sys_user
|
||||
*
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
public class SysUser extends BaseEntity
|
||||
|
@ -89,6 +89,15 @@ public class SysUser extends BaseEntity
|
|||
|
||||
/** 角色ID */
|
||||
private Long roleId;
|
||||
private List<Integer> userIdList;
|
||||
|
||||
public List<Integer> getUserIdList() {
|
||||
return userIdList;
|
||||
}
|
||||
|
||||
public void setUserIdList(List<Integer> userIdList) {
|
||||
this.userIdList = userIdList;
|
||||
}
|
||||
|
||||
public SysUser()
|
||||
{
|
||||
|
|
|
@ -58,33 +58,45 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
</sql>
|
||||
|
||||
<select id="selectUserList" parameterType="SysUser" resultMap="SysUserResult">
|
||||
select u.user_id, u.dept_id, u.nick_name, u.user_name, u.email, u.avatar, u.phonenumber, u.sex, u.status, u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark, d.dept_name, d.leader from sys_user u
|
||||
left join sys_dept d on u.dept_id = d.dept_id
|
||||
where u.del_flag = '0'
|
||||
<if test="userId != null and userId != 0">
|
||||
AND u.user_id = #{userId}
|
||||
</if>
|
||||
<if test="userName != null and userName != ''">
|
||||
AND u.user_name like concat('%', #{userName}, '%')
|
||||
</if>
|
||||
<if test="status != null and status != ''">
|
||||
AND u.status = #{status}
|
||||
</if>
|
||||
<if test="phonenumber != null and phonenumber != ''">
|
||||
AND u.phonenumber like concat('%', #{phonenumber}, '%')
|
||||
</if>
|
||||
<if test="params.beginTime != null and params.beginTime != ''"><!-- 开始时间检索 -->
|
||||
AND date_format(u.create_time,'%Y%m%d') >= date_format(#{params.beginTime},'%Y%m%d')
|
||||
</if>
|
||||
<if test="params.endTime != null and params.endTime != ''"><!-- 结束时间检索 -->
|
||||
AND date_format(u.create_time,'%Y%m%d') <= date_format(#{params.endTime},'%Y%m%d')
|
||||
</if>
|
||||
<if test="deptId != null and deptId != 0">
|
||||
AND (u.dept_id = #{deptId} OR u.dept_id IN ( SELECT t.dept_id FROM sys_dept t WHERE find_in_set(#{deptId}, ancestors) ))
|
||||
</if>
|
||||
<!-- 数据范围过滤 -->
|
||||
${params.dataScope}
|
||||
</select>
|
||||
select u.user_id, u.dept_id, u.nick_name, u.user_name, u.email, u.avatar, u.phonenumber, u.sex, u.status,
|
||||
u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark, d.dept_name, d.leader from sys_user
|
||||
u
|
||||
left join sys_dept d on u.dept_id = d.dept_id
|
||||
where u.del_flag = '0'
|
||||
<if test="userId != null and userId != 0">
|
||||
AND u.user_id = #{userId}
|
||||
</if>
|
||||
<if test="userIdList != null and userIdList.size>0">
|
||||
AND u.user_id in
|
||||
<foreach collection="userIdList" item="userId" open="(" separator="," close=")">
|
||||
#{userId}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="userName != null and userName != ''">
|
||||
AND u.user_name like concat('%', #{userName}, '%')
|
||||
</if>
|
||||
<if test="nickName != null and nickName != ''">
|
||||
AND u.nick_name like concat('%', #{nickName}, '%')
|
||||
</if>
|
||||
<if test="status != null and status != ''">
|
||||
AND u.status = #{status}
|
||||
</if>
|
||||
<if test="phonenumber != null and phonenumber != ''">
|
||||
AND u.phonenumber like concat('%', #{phonenumber}, '%')
|
||||
</if>
|
||||
<if test="params.beginTime != null and params.beginTime != ''"><!-- 开始时间检索 -->
|
||||
AND date_format(u.create_time,'%Y%m%d') >= date_format(#{params.beginTime},'%Y%m%d')
|
||||
</if>
|
||||
<if test="params.endTime != null and params.endTime != ''"><!-- 结束时间检索 -->
|
||||
AND date_format(u.create_time,'%Y%m%d') <= date_format(#{params.endTime},'%Y%m%d')
|
||||
</if>
|
||||
<if test="deptId != null and deptId != 0">
|
||||
AND (u.dept_id = #{deptId} OR u.dept_id IN ( SELECT t.dept_id FROM sys_dept t WHERE find_in_set(#{deptId},
|
||||
ancestors) ))
|
||||
</if>
|
||||
<!-- 数据范围过滤 -->
|
||||
${params.dataScope}
|
||||
</select>
|
||||
|
||||
<select id="selectAllocatedList" parameterType="SysUser" resultMap="SysUserResult">
|
||||
select distinct u.user_id, u.dept_id, u.user_name, u.nick_name, u.email, u.phonenumber, u.status, u.create_time
|
||||
|
|
Loading…
Reference in New Issue