update 人员查询

This commit is contained in:
mash 2023-02-09 11:14:50 +08:00
parent 83f65acfb3
commit 2aeccffe1b
5 changed files with 41 additions and 32 deletions

View File

@ -7,6 +7,7 @@ import com.ydool.common.constant.UrlConstant;
import com.ydool.common.data.dto.AjaxResult;
import com.ydool.common.utils.UploadUtils;
import com.ydool.staff.dto.PersonnelDto;
import com.ydool.staff.dto.PersonnelUpdateDto;
import com.ydool.staff.entity.Attachment;
import com.ydool.staff.entity.SelectRequest;
import com.ydool.staff.request.ChangeRequest;
@ -43,7 +44,7 @@ public class PersonnelController extends BaseController {
IAttachmentService attachmentService;
@PostMapping( "personnelList")
@ApiOperation(value = "人员列表,传id查一条",response = PersonnelDto.class)
@ApiOperation(value = "人员列表",response = PersonnelDto.class)
@ApiImplicitParams({
@ApiImplicitParam(name = "orderBy", value = "排序顺序 降序desc升序asc"),
@ApiImplicitParam(name = "column", value = "排序字段 字段名"),
@ -53,6 +54,13 @@ public class PersonnelController extends BaseController {
return personnelService.personnelList(getPage(),request,orderBy,column);
}
@GetMapping("getById")
@ApiOperation(value = "查询一条",response = PersonnelUpdateDto.class)
@ApiImplicitParam(name = "id",value = "id" )
public AjaxResult getById(String id){
return personnelService.getById(id);
}
@PostMapping(value = "savePersonnel")
@ApiOperation(value = "新增人员申报",response = PersonnelRequest.class)
public AjaxResult savePersonnel(@Validated @RequestBody PersonnelRequest personnelRequest){

View File

@ -13,5 +13,5 @@ import java.util.List;
@Data
public class PersonnelDeleteRequest {
@ApiModelProperty(value = "id")
private List<String> ids;
private String[] ids;
}

View File

@ -25,6 +25,7 @@ public interface IPersonnelService {
*/
AjaxResult personnelList(Page page , SelectRequest request, String orderBy,String column);
AjaxResult getById(String id);
AjaxResult personnelByExchangeList();
/**

View File

@ -2,6 +2,7 @@ package com.ydool.staff.service.impl;
import cn.dev33.satoken.stp.StpUtil;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@ -29,6 +30,7 @@ import org.thymeleaf.util.StringUtils;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
@ -96,17 +98,14 @@ public class ExchangeServiceImpl extends BaseService<ExchangeMapper, Exchange> i
@Override
@Transactional(rollbackFor = Exception.class)
public AjaxResult deleteExchangeById(PersonnelDeleteRequest request) {
List<String> ids = request.getIds();
boolean flag = false;
if (1<ids.size()){
for (String id : ids) {
flag = removeById(id);
public AjaxResult deleteExchangeById(PersonnelDeleteRequest ids) {
List<String> asList = Arrays.asList(ids.getIds());
if (CollectionUtil.isEmpty(asList)) {
return AjaxResult.fail().msg("Id不能为空");
} else {
int i = personnelMapper.deleteBatchIds(asList);
return i > 0 ? AjaxResult.ok().msg("删除成功!") : AjaxResult.fail().msg("删除失败!");
}
return flag?AjaxResult.ok().msg("批量删除成功!"):AjaxResult.fail().msg("批量删除失败!");
}
flag = removeById(ids.get(0));
return flag?AjaxResult.ok().msg("删除成功!"):AjaxResult.fail().msg("删除失败!");
}
}

View File

@ -77,16 +77,6 @@ public class PersonnelServiceImpl extends BaseService<PersonnelMapper, Personnel
*/
@Override
public AjaxResult personnelList(Page page , SelectRequest request, String orderBy,String column) {
if (StrUtil.isNotBlank(request.getId())){
Personnel personnel = personnelMapper.selectById(request.getId());
PersonnelUpdateDto personnelUpdateDto = BeanUtil.copyProperties(personnel, PersonnelUpdateDto.class);
personnelUpdateDto.setCardFiles(nameAndPath(personnel.getCardFile(), personnel.getId()));
personnelUpdateDto.setEngageFiles(nameAndPath(personnel.getEngageFile(), personnel.getId()));
personnelUpdateDto.setEducationFiles(nameAndPath(personnel.getEducationFile(), personnel.getId()));
personnelUpdateDto.setJobTitleFiles(nameAndPath(personnel.getJobTitleFile(), personnel.getId()));
personnelUpdateDto.setAuditFiles(nameAndPath(personnel.getAuditFile(), personnel.getId()));
return AjaxResult.ok().data(personnelUpdateDto);
}
QueryWrapper wrapper = selectWrapper(request, orderBy, column);
Page personnelPage = page(page, wrapper);
@ -104,6 +94,20 @@ public class PersonnelServiceImpl extends BaseService<PersonnelMapper, Personnel
}
public AjaxResult getById(String id) {
if (StrUtil.isNotBlank(id)){
Personnel personnel = personnelMapper.selectById(id);
PersonnelUpdateDto personnelUpdateDto = BeanUtil.copyProperties(personnel, PersonnelUpdateDto.class);
personnelUpdateDto.setCardFiles(nameAndPath(personnel.getCardFile(), personnel.getId()));
personnelUpdateDto.setEngageFiles(nameAndPath(personnel.getEngageFile(), personnel.getId()));
personnelUpdateDto.setEducationFiles(nameAndPath(personnel.getEducationFile(), personnel.getId()));
personnelUpdateDto.setJobTitleFiles(nameAndPath(personnel.getJobTitleFile(), personnel.getId()));
personnelUpdateDto.setAuditFiles(nameAndPath(personnel.getAuditFile(), personnel.getId()));
return AjaxResult.ok().data(personnelUpdateDto);
}
return AjaxResult.fail().msg("查询失败!");
}
@Override
public AjaxResult personnelByExchangeList() {
@ -136,17 +140,14 @@ public class PersonnelServiceImpl extends BaseService<PersonnelMapper, Personnel
@Override
@Transactional(rollbackFor = Exception.class)
public AjaxResult deleteByIds(PersonnelDeleteRequest personnelDeleteRequest) {
List<String> ids = personnelDeleteRequest.getIds();
boolean flag = false;
if (1<ids.size()){
for (String id : ids) {
flag = removeById(id);
public AjaxResult deleteByIds(PersonnelDeleteRequest ids) {
List<String> asList = Arrays.asList(ids.getIds());
if (CollectionUtil.isEmpty(asList)) {
return AjaxResult.fail().msg("Id不能为空");
} else {
int i = personnelMapper.deleteBatchIds(asList);
return i > 0 ? AjaxResult.ok().msg("删除成功!") : AjaxResult.fail().msg("删除失败!");
}
return flag?AjaxResult.ok().msg("批量删除成功!"):AjaxResult.fail().msg("批量删除失败!");
}
flag = removeById(ids.get(0));
return flag?AjaxResult.ok().msg("删除成功!"):AjaxResult.fail().msg("删除失败!");
}
@Override