This commit is contained in:
zhuyy 2023-02-09 15:26:39 +08:00
parent 2aeccffe1b
commit ed9dee7a0d
7 changed files with 33 additions and 50 deletions

View File

@ -5,10 +5,8 @@ import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.ydool.common.base.BaseController;
import com.ydool.common.constant.UrlConstant;
import com.ydool.common.data.dto.AjaxResult;
import com.ydool.staff.entity.Mechanism;
import com.ydool.staff.entity.PartyOrganization;
import com.ydool.staff.request.MechanismRequest;
import com.ydool.staff.request.OrganizationRequest;
import com.ydool.staff.service.*;
import com.ydool.system.request.IdsRequest;
import io.swagger.annotations.Api;
@ -35,23 +33,8 @@ public class OrganizationController extends BaseController {
@Autowired
IAttachmentService attachmentService;
// @GetMapping("/selectOrganization")
// @ApiOperation(value = "企业名称列表")
// @ApiOperationSupport(order = 1)
// public AjaxResult selectOrganization() {
// return organizationService.selectOrganization();
// }
//
// @GetMapping("/selectOrganizationByName")
// @ApiOperation(value = "企业名称查企业信息")
// @ApiOperationSupport(order = 2)
// // @ApiImplicitParams({@ApiImplicitParam(name = "companyName", value = "企业名称", required = true)})
// public AjaxResult selectOrganizationByName(String companyName) {
// return organizationService.selectOrganizationByName(companyName);
// }
/**
* =======================内设机构登记===========================
* =======================内设机构登记=========================
* @return
*/
@ -74,7 +57,7 @@ public class OrganizationController extends BaseController {
@GetMapping("/selectOrganizationByMechanism")
@ApiOperation(value = "内设机构登记详情")
@ApiOperationSupport(order = 4)
@ApiImplicitParams({@ApiImplicitParam(name = "id", value = "内设机构Id")})
@ApiImplicitParams({@ApiImplicitParam(name = "id", value = "内设机构Id", required = true)})
public AjaxResult selectOrganizationByMechanism(String id) {
return organizationService.selectOrganizationByMechanism(id);
}
@ -87,7 +70,7 @@ public class OrganizationController extends BaseController {
}
/**
* =======================机构信息=========================
* ===========================机构信息============================
* @return
*/
@ -98,36 +81,16 @@ public class OrganizationController extends BaseController {
return mechanismService.saveOrganizationMechanism(mechanismRequest);
}
// @PostMapping("/deleteMechanism")
// @ApiOperation(value = "机构信息删除")
// @ApiOperationSupport(order = 7)
// public AjaxResult deleteMechanism(@RequestBody IdsRequest id) {
// return mechanismService.deleteMechanism(id);
// }
/**
* ========================党组织信息========================
* ==========================党组织信息===========================
* @return
*/
// @GetMapping("/selectPartyOrganizationList")
// @ApiOperation(value = "党组织信息列表")
// @ApiOperationSupport(order = 8)
// public AjaxResult selectPartyOrganizationList() {
// return partyOrganizationService.selectPartyOrganizationList(new Page<PartyOrganization>(getPageNum(), getPageSize()));
// }
@PostMapping("/savePartyOrganization")
@ApiOperation(value = "党组织信息新增")
@ApiOperationSupport(order = 9)
@ApiOperationSupport(order = 7)
public AjaxResult savePartyOrganization(@RequestBody @Validated PartyOrganization partyOrganization) {
return partyOrganizationService.savePartyOrganization(partyOrganization);
}
// @PostMapping("/deletePartyOrganization")
// @ApiOperation(value = "党组织信息删除")
// @ApiOperationSupport(order = 10)
// public AjaxResult deletePartyOrganization(@RequestBody IdsRequest id) {
// return partyOrganizationService.deletePartyOrganization(id);
// }
}

View File

@ -6,6 +6,9 @@ import lombok.Data;
@Data
public class DirectorsSupervisorsDto {
@ApiModelProperty(value = "企业名称")
private String companyName;
@ApiModelProperty(value = "姓名")
private String username;

View File

@ -17,6 +17,7 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.Arrays;
import java.util.List;
/**
@ -66,10 +67,11 @@ public class AttachmentServiceImpl extends BaseService<AttachmentMapper, Attachm
@Override
@Transactional(rollbackFor = Exception.class)
public AjaxResult deleteFile(IdsRequest id) {
if (CollectionUtil.isEmpty(Arrays.asList(id.getIds()))) {
List<String> asList = Arrays.asList(id.getIds());
if (CollectionUtil.isEmpty(asList)) {
return AjaxResult.fail().msg("Id不能为空");
} else {
int i = attachmentMapper.deleteBatchIds(Arrays.asList(id.getIds()));
int i = attachmentMapper.deleteBatchIds(asList);
return i > 0 ? AjaxResult.ok().msg("删除成功!") : AjaxResult.fail().msg("删除失败!");
}
}

View File

@ -1,5 +1,6 @@
package com.ydool.staff.service.impl;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.ydool.common.base.BaseService;
import com.ydool.common.data.dto.AjaxResult;
@ -44,6 +45,9 @@ public class CompanyNameServiceImpl extends BaseService<CompanyNameMapper, Compa
@Override
public AjaxResult selectCompanyNameById(String id) {
CompanyName companyName = companyNameMapper.selectById(id);
if (ObjectUtil.isNull(companyName)) {
return AjaxResult.fail().msg("未找到相关信息!");
}
List<Recruitment> recruitments = recruitmentMapper.selectList(new LambdaQueryWrapper<Recruitment>().eq(Recruitment::getCompanyId, companyName.getId()));
CompanyNameRequest companyNameRequest = new CompanyNameRequest();
companyNameRequest.setRecruitments(recruitments);

View File

@ -2,6 +2,7 @@ package com.ydool.staff.service.impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@ -20,6 +21,7 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.thymeleaf.util.StringUtils;
import javax.validation.constraints.NotEmpty;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
@ -43,6 +45,7 @@ public class DirectorsSupervisorsServiceImpl extends BaseService<DirectorsSuperv
@Override
public AjaxResult selectDirectorsSupervisorsList(Page<DirectorsSupervisors> page, DirectorsSupervisorsDto directorsSupervisorsDto) {
LambdaQueryWrapper<DirectorsSupervisors> directorsSupervisorsLambdaQueryWrapper = new LambdaQueryWrapper<>();
directorsSupervisorsLambdaQueryWrapper.exists(StrUtil.isNotBlank(directorsSupervisorsDto.getCompanyName()), "select t2.id from t_lc_company_name t2 where t_lc_directors_supervisors.organization_id = t2.id and t2.company_name like '%" + directorsSupervisorsDto.getCompanyName() + "%'");
directorsSupervisorsLambdaQueryWrapper.eq(StrUtil.isNotBlank(directorsSupervisorsDto.getUsername()), DirectorsSupervisors::getUsername, directorsSupervisorsDto.getUsername());
directorsSupervisorsLambdaQueryWrapper.eq(StrUtil.isNotBlank(directorsSupervisorsDto.getDirectorsType()), DirectorsSupervisors::getDirectorsType, directorsSupervisorsDto.getDirectorsType());
directorsSupervisorsLambdaQueryWrapper.eq(StrUtil.isNotBlank(directorsSupervisorsDto.getPersonnelType()), DirectorsSupervisors::getPersonnelType, directorsSupervisorsDto.getPersonnelType());
@ -60,7 +63,7 @@ public class DirectorsSupervisorsServiceImpl extends BaseService<DirectorsSuperv
for (AttachmentDto attachment : attachmentList) {
list.add(attachment.getPath());
}
directorsSupervisors.setCorrelationFile(StringUtils.join(list,","));
directorsSupervisors.setCorrelationFile(StringUtils.join(list, ","));
int i = directorsSupervisorsMapper.insert(directorsSupervisors);
if (i > 0) {
List<AttachmentDto> attachmentDtoList = directorsSupervisors.getAttachmentDtoList();
@ -85,10 +88,11 @@ public class DirectorsSupervisorsServiceImpl extends BaseService<DirectorsSuperv
@Override
@Transactional(rollbackFor = Exception.class)
public AjaxResult deleteDirectorsSupervisors(IdsRequest ids) {
if (CollectionUtil.isEmpty(Arrays.asList(ids.getIds()))) {
List<String> asList = Arrays.asList(ids.getIds());
if (CollectionUtil.isEmpty(asList)) {
return AjaxResult.fail().msg("Id不能为空");
} else {
int i = directorsSupervisorsMapper.deleteBatchIds(Arrays.asList(ids.getIds()));
int i = directorsSupervisorsMapper.deleteBatchIds(asList);
return i > 0 ? AjaxResult.ok().msg("删除成功!") : AjaxResult.fail().msg("删除失败!");
}
}
@ -96,6 +100,9 @@ public class DirectorsSupervisorsServiceImpl extends BaseService<DirectorsSuperv
@Override
public AjaxResult selectDirectorsSupervisorsById(String id) {
DirectorsSupervisors directorsSupervisors = directorsSupervisorsMapper.selectById(id);
if (ObjectUtil.isNull(directorsSupervisors)) {
return AjaxResult.fail().msg("未找到相关信息!");
}
List<Attachment> attachmentList = attachmentMapper.selectList(new LambdaQueryWrapper<Attachment>().eq(Attachment::getTargetId, directorsSupervisors.getId()).eq(Attachment::getTargetType, "directors"));
List<AttachmentDto> attachmentDtos = BeanUtil.copyToList(attachmentList, AttachmentDto.class);
directorsSupervisors.setAttachmentDtoList(attachmentDtos);

View File

@ -20,6 +20,7 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.thymeleaf.util.StringUtils;
import javax.validation.constraints.NotEmpty;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
@ -51,7 +52,7 @@ public class OrganizationServiceImpl extends BaseService<OrganizationMapper, Org
@Override
public AjaxResult selectOrganizationList(Page<Organization> page, String companyName) {
LambdaQueryWrapper<Organization> organizationLambdaQueryWrapper = new LambdaQueryWrapper<>();
organizationLambdaQueryWrapper.eq(StrUtil.isNotBlank(companyName), Organization::getCompanyName, companyName);
organizationLambdaQueryWrapper.exists(StrUtil.isNotBlank(companyName), "select t2.id from t_lc_company_name t2 where t_lc_organization.company_id = t2.id and t2.company_name like '%" + companyName + "%'");
Page<Organization> selectPage = organizationMapper.selectPage(page, organizationLambdaQueryWrapper);
for (Organization record : selectPage.getRecords()) {
record.setUpdatedName(userMapper.selectById(record.getUpdatedId()).getUserName());
@ -84,10 +85,11 @@ public class OrganizationServiceImpl extends BaseService<OrganizationMapper, Org
@Override
@Transactional(rollbackFor = Exception.class)
public AjaxResult deleteOrganization(IdsRequest id) {
if (CollectionUtil.isEmpty(Arrays.asList(id.getIds()))) {
List<String> asList = Arrays.asList(id.getIds());
if (CollectionUtil.isEmpty(asList)) {
return AjaxResult.fail().msg("Id不能为空");
} else {
int i = organizationMapper.deleteBatchIds(Arrays.asList(id.getIds()));
int i = organizationMapper.deleteBatchIds(asList);
return i > 0 ? AjaxResult.ok().msg("删除成功!") : AjaxResult.fail().msg("删除失败!");
}
}

View File

@ -12,7 +12,9 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.validation.constraints.NotEmpty;
import java.util.Arrays;
import java.util.List;
/**
* <p>