Commit 5838e4e5 by zwb

修改标准岗位库查询

parent ae935183
package com.bkty.system.domain.entity;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.dromara.common.mybatis.core.domain.BaseEntity;
@Data
@DS("app")
@EqualsAndHashCode(callSuper = true)
@TableName("sys_job_directory")
public class JobInfo extends BaseEntity {
@TableId(value = "id", type = IdType.ASSIGN_ID)
private Long id;
/**
* 行业类型
*/
private String industryType;
/**
* 行业配图
*/
private String industryImg;
/**
* 职位类型
*/
private String positionType;
/**
* 岗位名称
*/
private String jobTitle;
/**
* 岗位描述
*/
private String description;
/**
* 岗位图片
*/
private String jobImg;
}
\ No newline at end of file
package com.bkty.system.init;
import com.bkty.system.domain.entity.JobInfo;
import com.bkty.system.domain.entity.PositionData;
import com.bkty.system.mapper.JobInfoMapper;
import com.bkty.system.mapper.PositionDataMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
......@@ -23,17 +25,22 @@ public class PositionDataService {
@Autowired
private PositionDataMapper positionDataMapper;
@Autowired
private JobInfoMapper jobInfoMapper;
/**
* 查询数据并封装为三级结构
*/
public List<Level1Group> getPositions() {
// 从数据库查询数据
List<PositionData> positionList = positionDataMapper.selectPositionNameList();
// List<JobInfo> positionList = jobInfoMapper.selectPositionNameList();
// 使用Map来组织三级结构
Map<String, Level1Group> level1Map = new LinkedHashMap<>();
for (PositionData position : positionList) {
// for (JobInfo position : positionList) {
String level1Name = position.getIndustryType();
String level2Name = position.getPositionType();
String level3Name = position.getJobTitle();
......
package com.bkty.system.mapper;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.bkty.system.domain.entity.JobInfo;
import com.bkty.system.domain.entity.PositionData;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import java.util.List;
@DS("app")
@Mapper
public interface JobInfoMapper extends BaseMapper<JobInfo> {
@Select("""
SELECT industry_type, position_type, job_title
FROM sys_job_directory
WHERE industry_type IS NOT NULL
AND position_type IS NOT NULL
AND job_title IS NOT NULL
ORDER BY industry_type, position_type, job_title
""")
List<JobInfo> selectPositionNameList();
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment