This commit is contained in:
zhuyy 2023-02-07 16:55:36 +08:00
parent 5c1332690c
commit 7e72b8b392
4 changed files with 19 additions and 3 deletions

View File

@ -1,4 +1,5 @@
package com.ydool.staff.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.ydool.common.base.BaseEntity;
import io.swagger.annotations.ApiModel;
@ -39,4 +40,8 @@ public class Attachment extends BaseEntity{
@ApiModelProperty(value = "文件大小")
private String size;
@ApiModelProperty(value = "文件后缀")
@TableField(exist = false)
private String suffix;
}

View File

@ -108,7 +108,7 @@ public class PersonnelRequest {
@ApiModelProperty(value = "入职时间")
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
private Date hiredate;
private Date hireDate;
@ApiModelProperty(value = "退休返聘开始时间")

View File

@ -1,5 +1,7 @@
package com.ydool.staff.service.impl;
import cn.dev33.satoken.stp.StpUtil;
import cn.hutool.core.io.FileUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ydool.common.base.BaseService;
@ -7,6 +9,7 @@ import com.ydool.common.data.dto.AjaxResult;
import com.ydool.staff.entity.Attachment;
import com.ydool.staff.mapper.AttachmentMapper;
import com.ydool.staff.service.IAttachmentService;
import com.ydool.system.mapper.UserMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -25,6 +28,8 @@ public class AttachmentServiceImpl extends BaseService<AttachmentMapper, Attachm
@Autowired
AttachmentMapper attachmentMapper;
@Autowired
UserMapper userMapper;
@Override
public boolean savePersonnel(Attachment entity) {
@ -44,7 +49,13 @@ public class AttachmentServiceImpl extends BaseService<AttachmentMapper, Attachm
@Override
public AjaxResult fileList(Page<Attachment> page, String id) {
return AjaxResult.ok().data(attachmentMapper.selectPage(page, new LambdaQueryWrapper<Attachment>().eq(Attachment::getTargetId, id)));
Page<Attachment> attachmentPage = attachmentMapper.selectPage(page, new LambdaQueryWrapper<Attachment>().eq(Attachment::getTargetId, id).eq(Attachment::getCreatedId, StpUtil.getLoginIdAsString()));
for (Attachment record : attachmentPage.getRecords()) {
record.setSuffix(FileUtil.extName(record.getPath()).toUpperCase());
record.setCreatedId(userMapper.selectById(record.getCreatedId()).getUserName());
record.setUpdatedId(userMapper.selectById(record.getUpdatedId()).getUserName());
}
return AjaxResult.ok().data(attachmentPage);
}
}

View File

@ -107,7 +107,7 @@ sa-token:
# 在多人登录同一账号时是否共用一个token (为true时所有登录共用一个token, 为false时每次登录新建一个token)
is-share: true
# token风格
token-style: uuid
token-style: simple-uuid
# 是否输出操作日志
is-log: false
# token前缀