Commit 673d84b5 authored by daijunxiong's avatar daijunxiong

汇总关联 职位关联

parent 51f6da09
...@@ -27,7 +27,6 @@ public class AttendanceVacationBalanceEntity extends AttendanceVacationBalanceVo ...@@ -27,7 +27,6 @@ public class AttendanceVacationBalanceEntity extends AttendanceVacationBalanceVo
/** /**
* 部门id * 部门id
*/ */
@Excel(name = "部门id")
private Long deptId; private Long deptId;
/** /**
* 部门名称 * 部门名称
......
...@@ -51,4 +51,6 @@ public interface DeptService extends ICRUDService<DeptEntity,Long>{ ...@@ -51,4 +51,6 @@ public interface DeptService extends ICRUDService<DeptEntity,Long>{
} }
\ No newline at end of file
...@@ -2,7 +2,9 @@ package com.mortals.xhx.module.job.dao; ...@@ -2,7 +2,9 @@ package com.mortals.xhx.module.job.dao;
import com.mortals.framework.dao.ICRUDDao; import com.mortals.framework.dao.ICRUDDao;
import com.mortals.xhx.module.job.model.JobEntity; import com.mortals.xhx.module.job.model.JobEntity;
import java.util.List; import java.util.List;
/** /**
* 职位信息Dao * 职位信息Dao
* 职位信息 DAO接口 * 职位信息 DAO接口
...@@ -13,5 +15,7 @@ import java.util.List; ...@@ -13,5 +15,7 @@ import java.util.List;
public interface JobDao extends ICRUDDao<JobEntity,Long>{ public interface JobDao extends ICRUDDao<JobEntity,Long>{
List<JobEntity> queryGroupName();
List<JobEntity> queryPositionName();
} }
package com.mortals.xhx.module.job.dao.ibatis; package com.mortals.xhx.module.job.dao.ibatis;
import org.springframework.stereotype.Repository; import com.mortals.framework.dao.ibatis.BaseCRUDDaoMybatis;
import com.mortals.xhx.module.job.dao.JobDao; import com.mortals.xhx.module.job.dao.JobDao;
import com.mortals.xhx.module.job.model.JobEntity; import com.mortals.xhx.module.job.model.JobEntity;
import java.util.Date; import org.springframework.stereotype.Repository;
import com.mortals.framework.dao.ibatis.BaseCRUDDaoMybatis;
import java.util.List; import java.util.List;
/** /**
* 职位信息DaoImpl DAO接口 * 职位信息DaoImpl DAO接口
* *
...@@ -17,5 +18,13 @@ import java.util.List; ...@@ -17,5 +18,13 @@ import java.util.List;
public class JobDaoImpl extends BaseCRUDDaoMybatis<JobEntity,Long> implements JobDao { public class JobDaoImpl extends BaseCRUDDaoMybatis<JobEntity,Long> implements JobDao {
@Override
public List<JobEntity> queryGroupName() {
return getSqlSession().selectList(getSqlId("queryGroupName"));
}
@Override
public List<JobEntity> queryPositionName() {
return getSqlSession().selectList(getSqlId("queryPositionName"));
}
} }
package com.mortals.xhx.module.job.model; package com.mortals.xhx.module.job.model;
import java.util.List;
import java.util.ArrayList;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonInclude;
import com.mortals.framework.annotation.Excel;
import com.mortals.framework.model.BaseEntityLong;
import com.mortals.xhx.module.job.model.vo.JobVo; import com.mortals.xhx.module.job.model.vo.JobVo;
/** /**
* 职位信息实体对象 * 职位信息实体对象
...@@ -164,7 +159,7 @@ public class JobEntity extends JobVo { ...@@ -164,7 +159,7 @@ public class JobEntity extends JobVo {
public void initAttrValue(){ public void initAttrValue(){
this.groupId = null; this.groupId = 0L;
this.groupName = ""; this.groupName = "";
......
...@@ -2,6 +2,7 @@ package com.mortals.xhx.module.job.model.vo; ...@@ -2,6 +2,7 @@ package com.mortals.xhx.module.job.model.vo;
import com.mortals.framework.model.BaseEntityLong; import com.mortals.framework.model.BaseEntityLong;
import com.mortals.xhx.module.job.model.JobEntity; import com.mortals.xhx.module.job.model.JobEntity;
import com.mortals.xhx.module.staff.model.StaffEntity;
import lombok.Data; import lombok.Data;
import java.util.ArrayList; import java.util.ArrayList;
...@@ -19,4 +20,6 @@ public class JobVo extends BaseEntityLong { ...@@ -19,4 +20,6 @@ public class JobVo extends BaseEntityLong {
* 子站点业务 * 子站点业务
*/ */
private List<JobEntity> children = new ArrayList<>(); private List<JobEntity> children = new ArrayList<>();
private List<StaffEntity> staffEntities ;
} }
\ No newline at end of file
package com.mortals.xhx.module.job.service; package com.mortals.xhx.module.job.service;
import com.mortals.framework.service.ICRUDService; import com.mortals.framework.service.ICRUDService;
import com.mortals.xhx.module.job.model.JobEntity; import com.mortals.xhx.module.job.model.JobEntity;
import com.mortals.xhx.module.job.model.JobQuery;
import java.util.List;
/** /**
* JobService * JobService
* *
...@@ -10,5 +15,6 @@ import com.mortals.xhx.module.job.model.JobEntity; ...@@ -10,5 +15,6 @@ import com.mortals.xhx.module.job.model.JobEntity;
* @date 2023-04-07 * @date 2023-04-07
*/ */
public interface JobService extends ICRUDService<JobEntity,Long>{ public interface JobService extends ICRUDService<JobEntity,Long>{
List<JobEntity> queryGroupName(JobQuery jobQuery);
List<JobEntity> queryPositionName(JobQuery jobQuery);
} }
\ No newline at end of file
...@@ -25,6 +25,7 @@ public class JobServiceImpl extends AbstractCRUDServiceImpl<JobDao, JobEntity, L ...@@ -25,6 +25,7 @@ public class JobServiceImpl extends AbstractCRUDServiceImpl<JobDao, JobEntity, L
protected void findAfter(JobEntity entity, Context context, List<JobEntity> list) throws AppException { protected void findAfter(JobEntity entity, Context context, List<JobEntity> list) throws AppException {
list.stream().peek(item -> { list.stream().peek(item -> {
List<JobEntity> childs = this.find(new JobQuery().groupId(item.getId())); List<JobEntity> childs = this.find(new JobQuery().groupId(item.getId()));
System.out.println("111"+childs);
if (!ObjectUtils.isEmpty(childs)) { if (!ObjectUtils.isEmpty(childs)) {
item.setChildren(childs); item.setChildren(childs);
} else { } else {
...@@ -32,4 +33,14 @@ public class JobServiceImpl extends AbstractCRUDServiceImpl<JobDao, JobEntity, L ...@@ -32,4 +33,14 @@ public class JobServiceImpl extends AbstractCRUDServiceImpl<JobDao, JobEntity, L
} }
}).count(); }).count();
} }
@Override
public List<JobEntity> queryGroupName(JobQuery jobQuery) {
return dao.queryGroupName();
}
@Override
public List<JobEntity> queryPositionName(JobQuery jobQuery) {
return dao.queryPositionName();
}
} }
\ No newline at end of file
package com.mortals.xhx.module.job.web; package com.mortals.xhx.module.job.web;
import com.mortals.framework.exception.AppException; import com.mortals.framework.exception.AppException;
import com.mortals.framework.model.Context; import com.mortals.framework.model.Context;
import com.mortals.framework.web.BaseCRUDJsonBodyMappingController; import com.mortals.framework.web.BaseCRUDJsonBodyMappingController;
import com.mortals.xhx.base.system.param.service.ParamService; import com.mortals.xhx.base.system.param.service.ParamService;
import com.mortals.xhx.common.code.JobTypeEnum; import com.mortals.xhx.common.code.JobTypeEnum;
import com.mortals.xhx.module.job.model.JobEntity; import com.mortals.xhx.module.job.model.JobEntity;
import com.mortals.xhx.module.job.model.JobQuery;
import com.mortals.xhx.module.job.service.JobService; import com.mortals.xhx.module.job.service.JobService;
import com.mortals.xhx.module.staff.model.StaffEntity;
import com.mortals.xhx.module.staff.service.impl.StaffServiceImpl;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.stream.Collectors;
/** /**
* 职位信息 * 职位信息
...@@ -26,6 +30,9 @@ public class JobController extends BaseCRUDJsonBodyMappingController<JobService, ...@@ -26,6 +30,9 @@ public class JobController extends BaseCRUDJsonBodyMappingController<JobService,
@Autowired @Autowired
private ParamService paramService; private ParamService paramService;
@Autowired
private StaffServiceImpl staffService;
public JobController() { public JobController() {
super.setModuleDesc("职位信息"); super.setModuleDesc("职位信息");
...@@ -34,13 +41,21 @@ public class JobController extends BaseCRUDJsonBodyMappingController<JobService, ...@@ -34,13 +41,21 @@ public class JobController extends BaseCRUDJsonBodyMappingController<JobService,
@Override @Override
protected void init(Map<String, Object> model, Context context) { protected void init(Map<String, Object> model, Context context) {
this.addDict(model, "type", JobTypeEnum.getEnumMap()); this.addDict(model, "type", JobTypeEnum.getEnumMap());
this.addDict(model, "group",service.queryGroupName(new JobQuery()).stream().collect(Collectors.toMap(x->x.getId().toString(), y->y.getGroupName(),(o, n)->n)));
super.init(model, context); super.init(model, context);
} }
@Override @Override
protected void doListBefore(JobEntity query, Map<String, Object> model, Context context) throws AppException { protected void doListBefore(JobEntity query, Map<String, Object> model, Context context) {
query.setSize(-1); query.setSize(-1);
query.setType(1);
super.doListBefore(query, model, context); super.doListBefore(query, model, context);
} }
@Override
protected int infoAfter(Long id, Map<String, Object> model, JobEntity entity, Context context) throws AppException {
List<StaffEntity> staffEntity = staffService.queryJob(id);
entity.setStaffEntities(staffEntity);
return super.infoAfter(id, model, entity, context);
}
} }
...@@ -57,4 +57,9 @@ public interface StaffDao extends ICRUDDao<StaffEntity,Long>{ ...@@ -57,4 +57,9 @@ public interface StaffDao extends ICRUDDao<StaffEntity,Long>{
* 查询部门信息 * 查询部门信息
* */ * */
StaffEntity queryHik(String remarkId); StaffEntity queryHik(String remarkId);
/**
* 查询拥有职位的员工
* */
List<StaffEntity> queryJob(Long positionId);
} }
...@@ -59,5 +59,10 @@ public class StaffDaoImpl extends BaseCRUDDaoMybatis<StaffEntity,Long> implement ...@@ -59,5 +59,10 @@ public class StaffDaoImpl extends BaseCRUDDaoMybatis<StaffEntity,Long> implement
return this.getSqlSession().selectOne(this.getSqlId("queryHik"),remarkId); return this.getSqlSession().selectOne(this.getSqlId("queryHik"),remarkId);
} }
@Override
public List<StaffEntity> queryJob(Long positionId){
return getSqlSession().selectList(this.getSqlId("queryJob"),positionId);
}
} }
...@@ -22,7 +22,7 @@ public class StaffEntity extends StaffVo { ...@@ -22,7 +22,7 @@ public class StaffEntity extends StaffVo {
/** /**
* 性别(1.男,2.女) * 性别(1.男,2.女)
*/ */
@Excel(name = "性别") @Excel(name = "性别",readConverterExp = "1=男,2=女")
private Integer gender; private Integer gender;
/** /**
* 出生日期 * 出生日期
...@@ -73,10 +73,12 @@ public class StaffEntity extends StaffVo { ...@@ -73,10 +73,12 @@ public class StaffEntity extends StaffVo {
/** /**
* 员工类型(1.全职,2.兼职,3.实习) * 员工类型(1.全职,2.兼职,3.实习)
*/ */
@Excel(name = "员工类型",readConverterExp = "1=全职,2=兼职,3=实习")
private Integer staffType; private Integer staffType;
/** /**
* 员工状态(1.正式,2.试用,3.离职) * 员工状态(1.正式,2.试用,3.离职)
*/ */
@Excel(name = "员工状态",readConverterExp = "1=正式,2=试用,3=离职")
private Integer status; private Integer status;
/** /**
* 入职登记表 * 入职登记表
......
package com.mortals.xhx.module.staff.service; package com.mortals.xhx.module.staff.service;
import com.mortals.framework.service.ICRUDCacheService; import com.mortals.framework.service.ICRUDCacheService;
import com.mortals.xhx.module.staff.model.StaffEntity; import com.mortals.xhx.module.staff.model.StaffEntity;
import com.mortals.xhx.module.staff.model.vo.StaffInfoVo; import com.mortals.xhx.module.staff.model.vo.StaffInfoVo;
import java.util.List;
/** /**
* StaffService * StaffService
* *
...@@ -13,10 +16,10 @@ import com.mortals.xhx.module.staff.model.vo.StaffInfoVo; ...@@ -13,10 +16,10 @@ import com.mortals.xhx.module.staff.model.vo.StaffInfoVo;
*/ */
public interface StaffService extends ICRUDCacheService<StaffEntity,Long> { public interface StaffService extends ICRUDCacheService<StaffEntity,Long> {
//查询所有数据
StaffInfoVo queryAll(); StaffInfoVo queryAll();
//统计所有在职员工
int queryAllPerson(); int queryAllPerson();
//查询员工数据
List<StaffEntity> queryJob(Long positionId);
} }
\ No newline at end of file
...@@ -10,6 +10,8 @@ import com.mortals.xhx.module.staff.service.StaffService; ...@@ -10,6 +10,8 @@ import com.mortals.xhx.module.staff.service.StaffService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.List;
/** /**
* StaffService * StaffService
* 员工基本信息 service实现 * 员工基本信息 service实现
...@@ -60,6 +62,10 @@ public class StaffServiceImpl extends AbstractCRUDCacheServiceImpl<StaffDao, Sta ...@@ -60,6 +62,10 @@ public class StaffServiceImpl extends AbstractCRUDCacheServiceImpl<StaffDao, Sta
return staffDao.queryInWork(); return staffDao.queryInWork();
} }
@Override
public List<StaffEntity> queryJob(Long positionId) {
return dao.queryJob(positionId);
}
} }
\ No newline at end of file
...@@ -52,17 +52,13 @@ public class StaffController extends BaseCRUDJsonBodyMappingController<StaffServ ...@@ -52,17 +52,13 @@ public class StaffController extends BaseCRUDJsonBodyMappingController<StaffServ
this.addDict(model, "politicalstatus", paramService.getParamBySecondOrganize("Staff","politicalstatus")); this.addDict(model, "politicalstatus", paramService.getParamBySecondOrganize("Staff","politicalstatus"));
this.addDict(model, "staffType", paramService.getParamBySecondOrganize("Staff","staffType")); this.addDict(model, "staffType", paramService.getParamBySecondOrganize("Staff","staffType"));
this.addDict(model, "status", paramService.getParamBySecondOrganize("Staff","status")); this.addDict(model, "status", paramService.getParamBySecondOrganize("Staff","status"));
this.addDict(model, "positionId", jobService.find(new JobQuery()).stream().collect(Collectors.toMap(x->x.getId().toString(),y->y.getJobName(),(o,n)->n))); this.addDict(model, "positionId", jobService.queryPositionName(new JobQuery()).stream().collect(Collectors.toMap(x->x.getId().toString(),y->y.getJobName(),(o,n)->n)));
List<DeptEntity> list = deptService.find(new DeptQuery()); List<DeptEntity> list = deptService.find(new DeptQuery());
List<DeptTreeSelect> treeSelects = deptService.buildDeptTreeSelect(list); List<DeptTreeSelect> treeSelects = deptService.buildDeptTreeSelect(list);
this.addDict(model,"deptPerson",treeSelects); this.addDict(model,"deptPerson",treeSelects);
super.init(model, context); super.init(model, context);
} }
@Override
protected void doListBefore(StaffEntity query, Map<String, Object> model, Context context) throws AppException {
super.doListBefore(query, model, context);
}
@Override @Override
protected int doListAfter(StaffEntity query, Map<String, Object> model, Context context) throws AppException { protected int doListAfter(StaffEntity query, Map<String, Object> model, Context context) throws AppException {
......
...@@ -2563,6 +2563,6 @@ ...@@ -2563,6 +2563,6 @@
</if> </if>
</sql> </sql>
<select id="queryEntity" resultType="com.mortals.xhx.module.attendance.model.AttendanceStatEntity"> <select id="queryEntity" resultType="com.mortals.xhx.module.attendance.model.AttendanceStatEntity">
select * from mortals_xhx_attendance_vacation_balance where staffId = #{staffId} select * from mortals_xhx_attendance_stat where staffId = #{staffId}
</select> </select>
</mapper> </mapper>
\ No newline at end of file
...@@ -672,4 +672,10 @@ ...@@ -672,4 +672,10 @@
</trim> </trim>
</if> </if>
</sql> </sql>
<select id="queryGroupName" resultType="com.mortals.xhx.module.job.model.JobEntity">
select id,groupName from mortals_xhx_job where type = 1
</select>
<select id="queryPositionName" resultType="com.mortals.xhx.module.job.model.JobEntity">
select id,jobName from mortals_xhx_job where type = 2
</select>
</mapper> </mapper>
\ No newline at end of file
...@@ -1420,4 +1420,7 @@ ...@@ -1420,4 +1420,7 @@
<select id="queryHik" resultType="com.mortals.xhx.module.staff.model.StaffEntity"> <select id="queryHik" resultType="com.mortals.xhx.module.staff.model.StaffEntity">
select * from mortals_xhx_staff where remarkId = #{remarkId} select * from mortals_xhx_staff where remarkId = #{remarkId}
</select> </select>
<select id="queryJob" resultType="com.mortals.xhx.module.staff.model.StaffEntity">
select * from mortals_xhx_staff where positionId = #{positionId}
</select>
</mapper> </mapper>
\ No newline at end of file
...@@ -18,7 +18,6 @@ POST {{baseUrl}}/staff/list ...@@ -18,7 +18,6 @@ POST {{baseUrl}}/staff/list
Content-Type: application/json Content-Type: application/json
{ {
"phoneNumber": "%133%",
"page":1, "page":1,
"size":10 "size":10
} }
......
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 to comment