master
Joe 2 years ago
parent 709ffd40d5
commit 3ecd592507

Binary file not shown.

@ -41,6 +41,16 @@ public class EmployeeController {
employeeService.exportEmployee(jsonObject, response); employeeService.exportEmployee(jsonObject, response);
} }
@GetMapping("/exportEmployeeDetail")
@ApiOperation(value = "导出", notes = "导出")
public void exportEmployeeDetail(HttpServletResponse response, @RequestParam String employeeVal) {
JSONObject jsonObject = new JSONObject();
if(StringUtils.isNotEmpty(employeeVal)) {
jsonObject = JSONObject.parseObject(employeeVal);
}
employeeService.exportEmployeeDetail(jsonObject, response);
}
/** /**
* *
* @param jsonObject * @param jsonObject
@ -65,6 +75,18 @@ public class EmployeeController {
return ajaxResult; return ajaxResult;
} }
/**
*
* @param jsonObject
* @return
*/
@PostMapping("/getPostListByDept")
@ApiOperation(value = "通过部门获取岗位", notes = "通过部门获取岗位")
public AjaxResult getPostListByDept(@RequestBody JSONObject jsonObject) {
AjaxResult ajaxResult = employeeService.getPostListByDept(jsonObject);
return ajaxResult;
}
/** /**
* *
* @param multipartFile * @param multipartFile

@ -8,5 +8,8 @@ import org.apache.ibatis.annotations.Param;
import java.util.List; import java.util.List;
public interface EmployeeMapper extends CommonMapper<Employee> { public interface EmployeeMapper extends CommonMapper<Employee> {
List<DataAnalysisVO> dataStatistics(@Param(value = "type") Integer type, @Param(value = "postName") String postName); List<DataAnalysisVO> dataStatistics(@Param(value = "type") Integer type, @Param(value = "postName") String postName, @Param(value = "postNames") List<String> postNames);
List<String> getPostListByDept(@Param(value = "departments") List<String> departments);
} }

@ -38,7 +38,7 @@ public class EducationResume {
* *
* @mbggenerated Wed May 03 18:26:57 CST 2023 * @mbggenerated Wed May 03 18:26:57 CST 2023
*/ */
@Excel(name = "就业学历", orderNum = "2") @Excel(name = "就业学历", orderNum = "5")
private String education; private String education;
/** /**
@ -47,7 +47,7 @@ public class EducationResume {
* *
* @mbggenerated Wed May 03 18:26:57 CST 2023 * @mbggenerated Wed May 03 18:26:57 CST 2023
*/ */
@Excel(name = "最高学历学校", orderNum = "6") @Excel(name = "最高学历学校", orderNum = "3")
private String school; private String school;
/** /**
@ -56,7 +56,7 @@ public class EducationResume {
* *
* @mbggenerated Wed May 03 18:26:57 CST 2023 * @mbggenerated Wed May 03 18:26:57 CST 2023
*/ */
@Excel(name = "专业", orderNum = "7") @Excel(name = "专业", orderNum = "4")
private String speciality; private String speciality;
/** /**
@ -83,7 +83,7 @@ public class EducationResume {
* *
* @mbggenerated Tue Jun 13 23:39:23 CST 2023 * @mbggenerated Tue Jun 13 23:39:23 CST 2023
*/ */
@Excel(name = "最高学历", orderNum = "3") @Excel(name = "最高学历", orderNum = "2")
private String highestEducation; private String highestEducation;
/** /**
@ -92,7 +92,7 @@ public class EducationResume {
* *
* @mbggenerated Tue Jun 13 23:39:23 CST 2023 * @mbggenerated Tue Jun 13 23:39:23 CST 2023
*/ */
@Excel(name = "本科学历学校", orderNum = "4") @Excel(name = "本科学历学校", orderNum = "7")
private String undergraduateSchools; private String undergraduateSchools;
/** /**
@ -101,7 +101,7 @@ public class EducationResume {
* *
* @mbggenerated Tue Jun 13 23:39:23 CST 2023 * @mbggenerated Tue Jun 13 23:39:23 CST 2023
*/ */
@Excel(name = "本科学历专业", orderNum = "5") @Excel(name = "本科学历专业", orderNum = "6")
private String undergraduateMajor; private String undergraduateMajor;
/** /**

@ -176,15 +176,7 @@ public class Employee {
* @mbggenerated Tue Jun 13 23:39:23 CST 2023 * @mbggenerated Tue Jun 13 23:39:23 CST 2023
*/ */
@Excel(name = "年龄", orderNum = "11") @Excel(name = "年龄", orderNum = "11")
private String age; private Integer age;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database column employee.age_id
*
* @mbggenerated Tue Jun 13 23:39:23 CST 2023
*/
private Long ageId;
/** /**
* This field was generated by MyBatis Generator. * This field was generated by MyBatis Generator.
@ -826,7 +818,7 @@ public class Employee {
* *
* @mbggenerated Tue Jun 13 23:39:23 CST 2023 * @mbggenerated Tue Jun 13 23:39:23 CST 2023
*/ */
public String getAge() { public Integer getAge() {
return age; return age;
} }
@ -838,34 +830,10 @@ public class Employee {
* *
* @mbggenerated Tue Jun 13 23:39:23 CST 2023 * @mbggenerated Tue Jun 13 23:39:23 CST 2023
*/ */
public void setAge(String age) { public void setAge(Integer age) {
this.age = age; this.age = age;
} }
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column employee.age_id
*
* @return the value of employee.age_id
*
* @mbggenerated Tue Jun 13 23:39:23 CST 2023
*/
public Long getAgeId() {
return ageId;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column employee.age_id
*
* @param ageId the value for employee.age_id
*
* @mbggenerated Tue Jun 13 23:39:23 CST 2023
*/
public void setAgeId(Long ageId) {
this.ageId = ageId;
}
/** /**
* This method was generated by MyBatis Generator. * This method was generated by MyBatis Generator.
* This method returns the value of the database column employee.sex * This method returns the value of the database column employee.sex

@ -17,6 +17,8 @@ public interface EmployeeService {
void exportEmployee(JSONObject jsonObject, HttpServletResponse response); void exportEmployee(JSONObject jsonObject, HttpServletResponse response);
void exportEmployeeDetail(JSONObject jsonObject, HttpServletResponse response);
AjaxResult saveEmployee(JSONObject jsonObject); AjaxResult saveEmployee(JSONObject jsonObject);
@ -30,4 +32,6 @@ public interface EmployeeService {
AjaxResult delEmployee(Long id); AjaxResult delEmployee(Long id);
AjaxResult dataStatistics(JSONObject jsonObject); AjaxResult dataStatistics(JSONObject jsonObject);
AjaxResult getPostListByDept(JSONObject jsonObject);
} }

@ -4,8 +4,11 @@ import cn.afterturn.easypoi.excel.ExcelExportUtil;
import cn.afterturn.easypoi.excel.ExcelImportUtil; import cn.afterturn.easypoi.excel.ExcelImportUtil;
import cn.afterturn.easypoi.excel.entity.ExportParams; import cn.afterturn.easypoi.excel.entity.ExportParams;
import cn.afterturn.easypoi.excel.entity.ImportParams; import cn.afterturn.easypoi.excel.entity.ImportParams;
import cn.afterturn.easypoi.excel.entity.enmus.ExcelType;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.jingcheng.cms.constants.Constants; import com.jingcheng.cms.constants.Constants;
import com.jingcheng.cms.mapper.*; import com.jingcheng.cms.mapper.*;
import com.jingcheng.cms.model.*; import com.jingcheng.cms.model.*;
@ -30,6 +33,7 @@ import java.io.File;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.Map;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@Service @Service
@ -42,6 +46,12 @@ public class EmployeeServiceImpl implements EmployeeService {
@Resource @Resource
private EmployeeMapper employeeMapper; private EmployeeMapper employeeMapper;
@Resource @Resource
private EducationResumeMapper educationResumeMapper;
@Resource
private FamilyMembersMapper familyMembersMapper;
@Resource
private WorkExperienceMapper workExperienceMapper;
@Resource
private HonorMapper honorMapper; private HonorMapper honorMapper;
@Override @Override
@ -71,8 +81,8 @@ public class EmployeeServiceImpl implements EmployeeService {
List<Integer> sexes = sexesJson != null ? sexesJson.toJavaList(Integer.class) : new ArrayList<>(); List<Integer> sexes = sexesJson != null ? sexesJson.toJavaList(Integer.class) : new ArrayList<>();
JSONArray departmentIdsJson = jsonObject.getJSONArray("departmentIds"); JSONArray departmentIdsJson = jsonObject.getJSONArray("departmentIds");
List<Long> departmentIds = departmentIdsJson != null ? departmentIdsJson.toJavaList(Long.class) : new ArrayList<>(); List<Long> departmentIds = departmentIdsJson != null ? departmentIdsJson.toJavaList(Long.class) : new ArrayList<>();
JSONArray ageIdsJson = jsonObject.getJSONArray("ageIds"); JSONArray agesJson = jsonObject.getJSONArray("ages");
List<Long> ageIds = ageIdsJson != null ? ageIdsJson.toJavaList(Long.class) : new ArrayList<>(); List<Long> ages = agesJson != null ? agesJson.toJavaList(Long.class) : new ArrayList<>();
List<String> honorEmployees = new ArrayList<>(); List<String> honorEmployees = new ArrayList<>();
if ((null != honorLevels && honorLevels.size() > 0) || StringUtils.isNotEmpty(honorDescription)) { if ((null != honorLevels && honorLevels.size() > 0) || StringUtils.isNotEmpty(honorDescription)) {
Example example1 = new Example(Honor.class); Example example1 = new Example(Honor.class);
@ -95,7 +105,7 @@ public class EmployeeServiceImpl implements EmployeeService {
if (StringUtils.isNotEmpty(employee.getMobile())) criteria.andLike("mobile", "%"+employee.getMobile()+"%"); if (StringUtils.isNotEmpty(employee.getMobile())) criteria.andLike("mobile", "%"+employee.getMobile()+"%");
if (null != sexes && sexes.size() > 0) criteria.andIn("sex", sexes); if (null != sexes && sexes.size() > 0) criteria.andIn("sex", sexes);
if (null != departmentIds && departmentIds.size() > 0) criteria.andIn("departmentId", departmentIds); if (null != departmentIds && departmentIds.size() > 0) criteria.andIn("departmentId", departmentIds);
if (null != ageIds && ageIds.size() > 0) criteria.andIn("ageId", ageIds); if (null != ages && ages.size() == 2) criteria.andBetween("age", ages.get(0), ages.get(1));
if (null != ptqIds && ptqIds.size() > 0) criteria.andIn("ptqId", ptqIds); if (null != ptqIds && ptqIds.size() > 0) criteria.andIn("ptqId", ptqIds);
if (null != unitIds && unitIds.size() > 0) criteria.andIn("unitId", unitIds); if (null != unitIds && unitIds.size() > 0) criteria.andIn("unitId", unitIds);
if (null != postIds && postIds.size() > 0) criteria.andIn("postId", postIds); if (null != postIds && postIds.size() > 0) criteria.andIn("postId", postIds);
@ -134,8 +144,8 @@ public class EmployeeServiceImpl implements EmployeeService {
List<Integer> sexes = sexesJson != null ? sexesJson.toJavaList(Integer.class) : new ArrayList<>(); List<Integer> sexes = sexesJson != null ? sexesJson.toJavaList(Integer.class) : new ArrayList<>();
JSONArray departmentIdsJson = jsonObject.getJSONArray("departmentIds"); JSONArray departmentIdsJson = jsonObject.getJSONArray("departmentIds");
List<Long> departmentIds = departmentIdsJson != null ? departmentIdsJson.toJavaList(Long.class) : new ArrayList<>(); List<Long> departmentIds = departmentIdsJson != null ? departmentIdsJson.toJavaList(Long.class) : new ArrayList<>();
JSONArray ageIdsJson = jsonObject.getJSONArray("ageIds"); JSONArray agesJson = jsonObject.getJSONArray("ages");
List<Long> ageIds = ageIdsJson != null ? ageIdsJson.toJavaList(Long.class) : new ArrayList<>(); List<Long> ages = agesJson != null ? agesJson.toJavaList(Long.class) : new ArrayList<>();
List<String> honorEmployees = new ArrayList<>(); List<String> honorEmployees = new ArrayList<>();
if ((null != honorLevels && honorLevels.size() > 0) || StringUtils.isNotEmpty(honorDescription)) { if ((null != honorLevels && honorLevels.size() > 0) || StringUtils.isNotEmpty(honorDescription)) {
Example example1 = new Example(Honor.class); Example example1 = new Example(Honor.class);
@ -157,7 +167,7 @@ public class EmployeeServiceImpl implements EmployeeService {
if (null != ptqIds && ptqIds.size() > 0) criteria.andIn("ptqId", ptqIds); if (null != ptqIds && ptqIds.size() > 0) criteria.andIn("ptqId", ptqIds);
if (null != sexes && sexes.size() > 0) criteria.andIn("sex", sexes); if (null != sexes && sexes.size() > 0) criteria.andIn("sex", sexes);
if (null != departmentIds && departmentIds.size() > 0) criteria.andIn("departmentId", departmentIds); if (null != departmentIds && departmentIds.size() > 0) criteria.andIn("departmentId", departmentIds);
if (null != ageIds && ageIds.size() > 0) criteria.andIn("ageId", ageIds); if (null != ages && ages.size() == 2) criteria.andBetween("age", ages.get(0), ages.get(1));
if (null != unitIds && unitIds.size() > 0) criteria.andIn("unitId", unitIds); if (null != unitIds && unitIds.size() > 0) criteria.andIn("unitId", unitIds);
if (null != postIds && postIds.size() > 0) criteria.andIn("postId", postIds); if (null != postIds && postIds.size() > 0) criteria.andIn("postId", postIds);
if (null != groupsIds && groupsIds.size() > 0) criteria.andIn("groupsId", groupsIds); if (null != groupsIds && groupsIds.size() > 0) criteria.andIn("groupsId", groupsIds);
@ -170,6 +180,64 @@ public class EmployeeServiceImpl implements EmployeeService {
ExcelUtils.export(workbook, response, "员工导出"); ExcelUtils.export(workbook, response, "员工导出");
} }
@Override
public void exportEmployeeDetail(JSONObject jsonObject, HttpServletResponse response) {
List<Map<String, Object>> exportParamList = Lists.newArrayList();
String employeeNo = jsonObject.getString("employeeNo");
// 员工基本信息
Map<String, Object> sheetMap1 = Maps.newHashMap();
Employee employee = new Employee();
employee.setState(Constants.ENABLE);
employee.setEmployeeNo(employeeNo);
List<Employee> employeeList = employeeMapper.select(employee);
sheetMap1.put("title", new ExportParams("员工基本信息", "员工基本信息"));
sheetMap1.put("entity", Employee.class);
sheetMap1.put("data", employeeList);
exportParamList.add(sheetMap1);
// 员工教育履历
Map<String, Object> sheetMap2 = Maps.newHashMap();
EducationResume educationResume = new EducationResume();
educationResume.setState(Constants.ENABLE);
educationResume.setEmployeeNo(employeeNo);
List<EducationResume> educationResumes = educationResumeMapper.select(educationResume);
sheetMap2.put("title", new ExportParams("员工教育履历", "员工教育履历"));
sheetMap2.put("entity", EducationResume.class);
sheetMap2.put("data", educationResumes);
exportParamList.add(sheetMap2);
// 员工家庭成员
Map<String, Object> sheetMap3 = Maps.newHashMap();
FamilyMembers familyMembers = new FamilyMembers();
familyMembers.setState(Constants.ENABLE);
familyMembers.setEmployeeNo(employeeNo);
List<FamilyMembers> familyMembersList = familyMembersMapper.select(familyMembers);
sheetMap3.put("title", new ExportParams("员工家庭成员", "员工家庭成员"));
sheetMap3.put("entity", FamilyMembers.class);
sheetMap3.put("data", familyMembersList);
exportParamList.add(sheetMap3);
// 员工工作经历
Map<String, Object> sheetMap4 = Maps.newHashMap();
WorkExperience workExperience = new WorkExperience();
workExperience.setState(Constants.ENABLE);
workExperience.setEmployeeNo(employeeNo);
List<WorkExperience> workExperienceList = workExperienceMapper.select(workExperience);
sheetMap4.put("title", new ExportParams("员工工作经历", "员工工作经历"));
sheetMap4.put("entity", WorkExperience.class);
sheetMap4.put("data", workExperienceList);
exportParamList.add(sheetMap4);
// 员工奖惩
Map<String, Object> sheetMap5 = Maps.newHashMap();
Honor honor = new Honor();
honor.setState(Constants.ENABLE);
honor.setEmployeeNo(employeeNo);
List<Honor> honorList = honorMapper.select(honor);
sheetMap5.put("title", new ExportParams("员工奖惩", "员工奖惩"));
sheetMap5.put("entity", Honor.class);
sheetMap5.put("data", honorList);
exportParamList.add(sheetMap5);
Workbook workbook = ExcelExportUtil.exportExcel(exportParamList, ExcelType.HSSF);
ExcelUtils.export(workbook, response, "员工明细导出");
}
@Override @Override
public AjaxResult saveEmployee(JSONObject jsonObject) { public AjaxResult saveEmployee(JSONObject jsonObject) {
AjaxResult ajaxResult = new AjaxResult(); AjaxResult ajaxResult = new AjaxResult();
@ -247,14 +315,6 @@ public class EmployeeServiceImpl implements EmployeeService {
employee.setHighestEducationId(infoSettingValuesFilter.get(0).getId()); employee.setHighestEducationId(infoSettingValuesFilter.get(0).getId());
} }
} }
//年龄
if (StringUtils.isNotEmpty(employee.getAge())) {
List<InfoSettingValue> infoSettingValues = infoSettingValueService.getAllInfoSettingValueBySettingName("年龄");
List<InfoSettingValue> infoSettingValuesFilter = infoSettingValues.stream().filter(item -> item.getSettingValue().equals(employee.getAge())).collect(Collectors.toList());
if (infoSettingValuesFilter.size() > 0) {
employee.setAgeId(infoSettingValuesFilter.get(0).getId());
}
}
//部门 //部门
if (StringUtils.isNotEmpty(employee.getDepartment())) { if (StringUtils.isNotEmpty(employee.getDepartment())) {
List<InfoSettingValue> infoSettingValues = infoSettingValueService.getAllInfoSettingValueBySettingName("部门"); List<InfoSettingValue> infoSettingValues = infoSettingValueService.getAllInfoSettingValueBySettingName("部门");
@ -323,48 +383,49 @@ public class EmployeeServiceImpl implements EmployeeService {
Integer isAge = jsonObject.getInteger("isAge"); Integer isAge = jsonObject.getInteger("isAge");
Integer isSex = jsonObject.getInteger("isSex"); Integer isSex = jsonObject.getInteger("isSex");
List<DataStatisticsVO> dataStatisticsVOS = new ArrayList<>(); List<DataStatisticsVO> dataStatisticsVOS = new ArrayList<>();
List<String> postNameList = new ArrayList<>(); List<String> departmentList = new ArrayList<>();
if (postNames != null && postNames.size() > 0) { if (departments != null && departments.size() > 0) {
postNameList = postNames; departmentList = departments;
} else { } else {
List<InfoSettingValue> infoSettingValues = infoSettingValueService.getAllInfoSettingValueBySettingName("岗位"); List<InfoSettingValue> infoSettingValues = infoSettingValueService.getAllInfoSettingValueBySettingName("部门");
postNameList = infoSettingValues.stream().map(item -> item.getSettingValue()).collect(Collectors.toList()); departmentList = infoSettingValues.stream().map(item -> item.getSettingValue()).collect(Collectors.toList());
} }
for (String s : postNameList) { for (String s : departmentList) {
DataStatisticsVO dataStatisticsVO = new DataStatisticsVO(); DataStatisticsVO dataStatisticsVO = new DataStatisticsVO();
dataStatisticsVO.setPostName(s); dataStatisticsVO.setPostName(s);
if (null != isEdu && isEdu == 1) { if (null != isEdu && isEdu == 1) {
List<DataAnalysisVO> dataAnalysisVOS = employeeMapper.dataStatistics(1, s); List<DataAnalysisVO> dataAnalysisVOS = employeeMapper.dataStatistics(1, s, postNames);
dataStatisticsVO.setEducationList(dataAnalysisVOS); dataStatisticsVO.setEducationList(dataAnalysisVOS);
} }
if (null != isPtq && isPtq == 1) { if (null != isPtq && isPtq == 1) {
List<DataAnalysisVO> dataAnalysisVOS = employeeMapper.dataStatistics(2, s); List<DataAnalysisVO> dataAnalysisVOS = employeeMapper.dataStatistics(2, s, postNames);
dataStatisticsVO.setPtqList(dataAnalysisVOS); dataStatisticsVO.setPtqList(dataAnalysisVOS);
} }
if (null != isSkill && isSkill == 1) { if (null != isSkill && isSkill == 1) {
List<DataAnalysisVO> dataAnalysisVOS = employeeMapper.dataStatistics(3, s); List<DataAnalysisVO> dataAnalysisVOS = employeeMapper.dataStatistics(3, s, postNames);
dataStatisticsVO.setSkillLevelList(dataAnalysisVOS); dataStatisticsVO.setSkillLevelList(dataAnalysisVOS);
} }
if (null != isSex && isSex == 1) { if (null != isSex && isSex == 1) {
List<DataAnalysisVO> dataAnalysisVOS = employeeMapper.dataStatistics(4, s); List<DataAnalysisVO> dataAnalysisVOS = employeeMapper.dataStatistics(4, s, postNames);
dataStatisticsVO.setSexList(dataAnalysisVOS); dataStatisticsVO.setSexList(dataAnalysisVOS);
} }
if (null != isAge && isAge == 1) { if (null != isAge && isAge == 1) {
List<DataAnalysisVO> dataAnalysisVOS = employeeMapper.dataStatistics(5, s); List<DataAnalysisVO> dataAnalysisVOS = employeeMapper.dataStatistics(5, s, postNames);
dataStatisticsVO.setAgeList(dataAnalysisVOS); dataStatisticsVO.setAgeList(dataAnalysisVOS);
} }
if (null != isDepartment && isDepartment == 1) { if (null != isDepartment && isDepartment == 1) {
List<DataAnalysisVO> dataAnalysisVOS = employeeMapper.dataStatistics(6, s); Employee employee = new Employee();
if (departments != null && departments.size()>0) { employee.setState(Constants.ENABLE);
List<DataAnalysisVO> dataAnalysisVOS1 = new ArrayList<>(); Integer all = employeeMapper.selectCount(employee);
for (DataAnalysisVO dataAnalysisVO : dataAnalysisVOS) { List<DataAnalysisVO> dataAnalysisVOS = employeeMapper.dataStatistics(6, s, postNames);
if (departments.contains(dataAnalysisVO.getAnalysisName())) { List<DataAnalysisVO> dataAnalysisVOS1 = new ArrayList<>();
dataAnalysisVOS1.add(dataAnalysisVO); for (DataAnalysisVO dataAnalysisVO : dataAnalysisVOS) {
} dataAnalysisVO.setAnalysisCount(dataAnalysisVO.getPostCount());
} dataAnalysisVO.setPostCount(all.longValue());
dataAnalysisVOS = dataAnalysisVOS1; dataAnalysisVOS1.add(dataAnalysisVO);
} }
dataAnalysisVOS = dataAnalysisVOS1;
dataStatisticsVO.setDepartmentList(dataAnalysisVOS); dataStatisticsVO.setDepartmentList(dataAnalysisVOS);
} }
dataStatisticsVOS.add(dataStatisticsVO); dataStatisticsVOS.add(dataStatisticsVO);
@ -374,4 +435,14 @@ public class EmployeeServiceImpl implements EmployeeService {
return ajaxResult; return ajaxResult;
} }
@Override
public AjaxResult getPostListByDept(JSONObject jsonObject) {
AjaxResult ajaxResult = new AjaxResult();
JSONArray departmentsJson = jsonObject.getJSONArray("departments");
List<String> departments = departmentsJson != null ? departmentsJson.toJavaList(String.class) : new ArrayList<>();
List<String> postList = employeeMapper.getPostListByDept(departments);
ajaxResult.setData(postList);
return ajaxResult;
}
} }

@ -4,7 +4,7 @@
<select id="dataStatistics" resultType="com.jingcheng.cms.vo.DataAnalysisVO"> <select id="dataStatistics" resultType="com.jingcheng.cms.vo.DataAnalysisVO">
SELECT SELECT
t1.post as postName, t1.department as postName,
t2.postCount, t2.postCount,
<if test="type == 1"> <if test="type == 1">
t1.highest_education as analysisName, t1.highest_education as analysisName,
@ -32,13 +32,19 @@
</if> </if>
FROM FROM
employee t1 employee t1
JOIN (SELECT post, COUNT(post) as postCount FROM employee GROUP BY post) t2 ON t1.post = t2.post JOIN (SELECT department, COUNT(department) as postCount FROM employee GROUP BY department) t2 ON t1.department = t2.department
where 1=1 where 1=1
<if test="postName != null"> <if test="postName != null">
and t1.post = #{postName} and t1.department = #{postName}
</if>
<if test="postNames != null and postNames.size() > 0">
and t1.post in
<foreach collection="postNames" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
</if> </if>
GROUP BY GROUP BY
t1.post, t1.department,
<if test="type == 1"> <if test="type == 1">
t1.highest_education t1.highest_education
</if> </if>
@ -59,4 +65,19 @@
</if> </if>
</select> </select>
<select id="getPostListByDept" resultType="java.lang.String">
SELECT DISTINCT
post
FROM
employee
WHERE 1=1
<if test="departments != null and departments.size() > 0">
and department in
<foreach collection="departments" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
</select>
</mapper> </mapper>
Loading…
Cancel
Save