Commit 957a756c by 涂亚平

准备周六在家加班......

1 parent 2e250cb4
package com.laowu.controller;
import com.laowu.dto.station.RequiresDTO;
import com.laowu.dto.station.ShareDTO;
import com.laowu.model.WorkstationAloneMappingDO;
import com.laowu.service.WorkstationAloneMappingService;
import com.laowu.util.ResponseData;
import com.laowu.util.ResponseVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* <p>
* 职位需求工作站映射表 前端控制器
* </p>
*
* @author Tuyp
* @since 2023-03-30
*/
@RestController
@Api(tags = "独立需求工作站映射表")
@RequestMapping("/workstationAloneMapping")
public class WorkstationAloneMappingController {
@Autowired
private WorkstationAloneMappingService workstationAloneMappingService;
@PostMapping("requires")
@ApiOperation("查看某个工作站的项目用工需求 stationId 工作站id pageSize pageNum itemStatus province city county positionId itemName ")
public ResponseVO requires(@RequestBody RequiresDTO requiresDTO){
return ResponseData.generateCreatedResponse(0,workstationAloneMappingService.requires(requiresDTO));
}
@PostMapping("deleteRequire")
@ApiOperation("删除需求 stationId aloneId 需求id")
public ResponseVO deleteRequire(@RequestBody WorkstationAloneMappingDO workstationAloneMappingDO){
return ResponseData.generateCreatedResponse(0,workstationAloneMappingService.deleteRequire(workstationAloneMappingDO));
}
@PostMapping("share")
@ApiOperation("分配工作站 stationIds requireIds ")
public ResponseVO share(@RequestBody ShareDTO shareDTO){
return ResponseData.generateCreatedResponse(0,workstationAloneMappingService.share(shareDTO));
}
@PostMapping("requireStations")
@ApiOperation("查看需求已经在哪些工作站 aloneId")
public ResponseVO requireStations(@RequestBody WorkstationAloneMappingDO workstationAloneMappingDO){
return ResponseData.generateCreatedResponse(0,workstationAloneMappingService.requireStations(workstationAloneMappingDO));
}
}
package com.laowu.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.laowu.model.WorkstationAloneMappingDO;
import com.laowu.vo.position.AloneRequirementsVO;
import com.laowu.vo.position.AloneWorkVO;
import org.springframework.stereotype.Repository;
import java.util.List;
/**
* <p>
* 职位需求工作站映射表 Mapper 接口
* </p>
*
* @author Tuyp
* @since 2023-03-30
*/
@Repository
public interface WorkstationAloneMappingMapper extends BaseMapper<WorkstationAloneMappingDO> {
/**
* 查看某个工作站下的需求
*/
IPage<AloneRequirementsVO> aloneRequirements(IPage ipage,String positionStatus,String positionName,Long positionId,String province,String city,String county,Long stationId);
/**
* 查看某个需求已经存在于哪几个工作站了
*/
List<Long> requiresStations(Long requireId);
/**
* 查看某个需求有哪几个工作站 VO
*/
List<AloneWorkVO> aloneWorkVO(Long aloneId);
}
package com.laowu.model;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.laowu.util.BaseModel;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* <p>
* 职位需求工作站映射表
* </p>
*
* @author Tuyp
* @since 2023-03-30
*/
@Data
@EqualsAndHashCode(callSuper = true)
@TableName("workstation_alone_mapping")
public class WorkstationAloneMappingDO extends BaseModel {
private static final long serialVersionUID = 1L;
@TableId(value = "id", type = IdType.AUTO)
private Long id;
/**
* 工作站id
*/
private Long stationId;
/**
* 独立用用工需求id
*/
private Long aloneId;
}
package com.laowu.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
import com.laowu.dto.station.RequiresDTO;
import com.laowu.dto.station.ShareDTO;
import com.laowu.model.WorkstationAloneMappingDO;
import com.laowu.vo.position.AloneRequirementsVO;
import com.laowu.vo.station.RequireStationsVO;
/**
* <p>
* 职位需求工作站映射表 服务类
* </p>
*
* @author Tuyp
* @since 2023-03-30
*/
public interface WorkstationAloneMappingService extends IService<WorkstationAloneMappingDO> {
IPage<AloneRequirementsVO> requires(RequiresDTO requiresDTO);
String deleteRequire(WorkstationAloneMappingDO workstationAloneMappingDO);
String share(ShareDTO shareDTO);
RequireStationsVO requireStations(WorkstationAloneMappingDO workstationAloneMappingDO);
}
......@@ -16,7 +16,9 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
/**
* <p>
......@@ -53,13 +55,23 @@ public class PositionRequireItemServiceImpl extends ServiceImpl<PositionRequireI
IPage<RequirementsVO> iPage = this.baseMapper.requirements(pager, requirementsDTO.getItemName(), requirementsDTO.getItemStatus(), requirementsDTO.getProvince(), requirementsDTO.getCity(), requirementsDTO.getCounty(), requirementsDTO.getPositionId());
List<RequirementsVO> records = iPage.getRecords();
for (RequirementsVO rv : records) {
Set<PositionDictDO> positionDictDOSet = new HashSet<>();
//预招人数
List<PositionCountsVO> positionItemInfoDOS = positionItemInfoMapper.positionCounts(rv.getId());
for (PositionCountsVO positionCountsVO : positionItemInfoDOS){
//职位分类
List<LibJobSortDO> libJobSortDOS = positionItemJobMappingMapper.positionSorts(positionCountsVO.getId());
positionCountsVO.setLibJobSortDOS(libJobSortDOS);
//职业范围
List<PositionDictDO> positionDictDOS = positionRequirePositionsMapper.positionDicts(positionCountsVO.getId());
for (PositionDictDO rcc : positionDictDOS) {
positionDictDOSet.add(rcc);
}
}
rv.setPositionDictDOSet(positionDictDOSet);
rv.setPositionItemInfoDOS(positionItemInfoDOS);
}
return iPage;
......
package com.laowu.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.laowu.dto.station.RequiresDTO;
import com.laowu.dto.station.ShareDTO;
import com.laowu.mapper.PositionAloneInfoMapper;
import com.laowu.mapper.WorkstationAloneMappingMapper;
import com.laowu.model.PositionAloneInfoDO;
import com.laowu.model.WorkstationAloneMappingDO;
import com.laowu.service.WorkstationAloneMappingService;
import com.laowu.util.ConstantUtils;
import com.laowu.vo.position.AloneRequirementsVO;
import com.laowu.vo.station.RequireStationsVO;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
/**
* <p>
* 职位需求工作站映射表 服务实现类
* </p>
*
* @author Tuyp
* @since 2023-03-30
*/
@Service
public class WorkstationAloneMappingServiceImpl extends ServiceImpl<WorkstationAloneMappingMapper, WorkstationAloneMappingDO> implements WorkstationAloneMappingService {
@Autowired
private PositionAloneInfoMapper positionAloneInfoMapper;
public IPage<AloneRequirementsVO> requires(RequiresDTO requiresDTO) {
Page pager = new Page(requiresDTO.getPageNum(), requiresDTO.getPageSize());
return this.baseMapper.aloneRequirements(pager, requiresDTO.getItemStatus(), requiresDTO.getItemName(), requiresDTO.getPositionId(), requiresDTO.getProvince(), requiresDTO.getCity(), requiresDTO.getCounty(), requiresDTO.getStationId());
}
public String deleteRequire(WorkstationAloneMappingDO workstationAloneMappingDO) {
this.baseMapper.delete(new QueryWrapper<WorkstationAloneMappingDO>()
.lambda()
.eq(WorkstationAloneMappingDO::getAloneId, workstationAloneMappingDO.getAloneId())
.eq(WorkstationAloneMappingDO::getStationId, workstationAloneMappingDO.getStationId()));
positionAloneInfoMapper.deleteById(workstationAloneMappingDO.getAloneId());
return ConstantUtils.DELETE_SUCCESS;
}
public String share(ShareDTO shareDTO) {
List<Long> requireIds = shareDTO.getRequireIds();
for (Long requireId : requireIds) {
List<Long> oldIds = this.baseMapper.requiresStations(requireId);
List<Long> newIds = shareDTO.getStationIds();
List<Long> newIds2 = new ArrayList<Long>();
for (Long id : newIds) {
newIds2.add(id);
}
newIds.removeAll(oldIds); //新增的人在newIds里面
if (newIds.size() > 0) {
for (Long id : newIds) {
PositionAloneInfoDO positionAloneInfoDO = positionAloneInfoMapper.selectById(requireId);
PositionAloneInfoDO positionAloneInfoDO1 = new PositionAloneInfoDO();
BeanUtils.copyProperties(positionAloneInfoDO,positionAloneInfoDO1);
positionAloneInfoDO1.setOriginId(positionAloneInfoDO.getId());
positionAloneInfoMapper.insert(positionAloneInfoDO1);
WorkstationAloneMappingDO workstationAloneMappingDO = new WorkstationAloneMappingDO();
workstationAloneMappingDO.setAloneId(positionAloneInfoDO1.getId());
workstationAloneMappingDO.setStationId(id);
this.baseMapper.insert(workstationAloneMappingDO);
}
}
oldIds.removeAll(newIds2);//删掉以前的
if (oldIds.size() > 0) {
for (Long id : oldIds) {
this.baseMapper.delete(new QueryWrapper<WorkstationAloneMappingDO>()
.lambda()
.eq(WorkstationAloneMappingDO::getAloneId, requireId)
.eq(WorkstationAloneMappingDO::getStationId, id));
}
}
}
return ConstantUtils.SUCCESS_UPDATE;
}
public RequireStationsVO requireStations(WorkstationAloneMappingDO workstationAloneMappingDO) {
RequireStationsVO requireStationsVO = new RequireStationsVO();
requireStationsVO.setIds(this.baseMapper.requiresStations(workstationAloneMappingDO.getAloneId()));
return requireStationsVO;
}
}
package com.laowu.vo.position;
import com.laowu.model.PositionDictDO;
import lombok.Data;
import java.util.List;
import java.util.Set;
@Data
public class RequirementsVO {
......@@ -36,4 +38,6 @@ public class RequirementsVO {
private String positionStatus;
private List<PositionCountsVO> positionItemInfoDOS;
private Set<PositionDictDO> positionDictDOSet;
}
<?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="com.laowu.mapper.WorkstationAloneMappingMapper">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="com.laowu.model.WorkstationAloneMappingDO">
<id column="id" property="id" />
<result column="create_date" property="createDate" />
<result column="update_date" property="updateDate" />
<result column="delete_date" property="deleteDate" />
<result column="station_id" property="stationId" />
<result column="alone_id" property="aloneId" />
</resultMap>
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
create_date,
update_date,
delete_date,
id, station_id, alone_id
</sql>
<select id="aloneRequirements" resultType="com.laowu.vo.position.AloneRequirementsVO">
SELECT
t.id,
company_id,
t2.company_name,
position_status,
require_counts,
position_name,
recruit_type,
t.province,
t.city,
t.county,
job_sort_id,
t3.job_name,
t4.position_type,
t.position_id,
job_id,
position_desc,
position_require,
start_salary,
end_salary,
t5.station_id,
t.address
FROM
position_alone_info t
LEFT JOIN company_dict t2 ON t.company_id = t2.id
LEFT JOIN lib_job_sort t3 ON t.job_sort_id = t3.id
LEFT JOIN position_dict t4 ON t.position_id = t4.id
left join workstation_alone_mapping t5 on t5.alone_id = t.id
WHERE
t.delete_date IS NULL
AND t2.delete_date IS NULL
and t3.delete_date IS NULL
and t4.delete_date IS NULL
and t5.delete_date IS NULL
<if test="positionStatus!= null and positionStatus!=''">
AND t.position_status = #{positionStatus}
</if>
<if test="positionName != null and positionName != ''">
AND t.position_name LIKE concat('%', #{positionName}, '%')
</if>
<if test="positionId != null and positionId != ''">
AND t.position_id = #{positionId}
</if>
<if test="province != null and province !=''">
AND t.province = #{province}
</if>
<if test="city != null and city != ''">
AND t.city = #{city}
</if>
<if test="county != null and county != ''">
AND t.county = #{county}
</if>
<if test="stationId != null and stationId != ''">
and t5.station_id = #{stationId}
</if>
<if test="stationId == null ">
and t.origin_id is null
</if>
</select>
<select id="requiresStations" parameterType="long" resultType="long">
SELECT
t.station_id
FROM
workstation_alone_mapping t
WHERE
t.delete_date IS NULL
AND t.alone_id = #{requireId}
</select>
<select id="aloneWorkVO" parameterType="long" resultType="com.laowu.vo.position.AloneWorkVO">
SELECT
t2.id,
t2.workstation_name,
t.create_date
FROM
workstation_alone_mapping t
LEFT JOIN workstation_dict t2 ON t.alone_id = t2.id
WHERE
t.delete_date IS NULL
AND t2.delete_date IS NULL
and t.alone_id = #{id}
</select>
</mapper>
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!