add graphics statistical
This commit is contained in:
parent
3acef17d49
commit
521cecc989
14
.idea/workspace.xml
generated
14
.idea/workspace.xml
generated
@ -2,14 +2,11 @@
|
||||
<project version="4">
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="e4baaf01-a2c2-445d-98a1-9f4c50c148cf" name="Default Changelist" comment="">
|
||||
<change afterPath="$PROJECT_DIR$/src/main/java/com/lz/modules/app/Dto/GraphicsDto.java" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/src/main/java/com/lz/modules/app/Dto/GraphicsStatisticalDto.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/java/com/lz/modules/app/controller/StaffController.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/lz/modules/app/controller/StaffController.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/java/com/lz/modules/app/dao/StaffDao.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/lz/modules/app/dao/StaffDao.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/java/com/lz/modules/app/service/StaffService.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/lz/modules/app/service/StaffService.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/java/com/lz/modules/app/service/impl/StaffServiceImpl.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/lz/modules/app/service/impl/StaffServiceImpl.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/java/com/lz/modules/sys/oauth2/OAuth2Filter.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/lz/modules/sys/oauth2/OAuth2Filter.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/resources/mapper/generator/StaffDao.xml" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/resources/mapper/generator/StaffDao.xml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/target/classes/com/lz/modules/app/controller/StaffController.class" beforeDir="false" afterPath="$PROJECT_DIR$/target/classes/com/lz/modules/app/controller/StaffController.class" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/target/classes/com/lz/modules/app/dao/StaffDao.class" beforeDir="false" afterPath="$PROJECT_DIR$/target/classes/com/lz/modules/app/dao/StaffDao.class" afterDir="false" />
|
||||
@ -163,7 +160,7 @@
|
||||
<workItem from="1588159936850" duration="1226000" />
|
||||
<workItem from="1588161274115" duration="1691000" />
|
||||
<workItem from="1588163384182" duration="74761000" />
|
||||
<workItem from="1588936950753" duration="82741000" />
|
||||
<workItem from="1588936950753" duration="88892000" />
|
||||
</task>
|
||||
<servers />
|
||||
</component>
|
||||
@ -218,7 +215,7 @@
|
||||
</line-breakpoint>
|
||||
<line-breakpoint enabled="true" type="java-line">
|
||||
<url>file://$PROJECT_DIR$/src/main/java/com/lz/modules/app/service/impl/StaffServiceImpl.java</url>
|
||||
<line>82</line>
|
||||
<line>83</line>
|
||||
<option name="timeStamp" value="62" />
|
||||
</line-breakpoint>
|
||||
<line-breakpoint enabled="true" type="java-line">
|
||||
@ -233,14 +230,9 @@
|
||||
</line-breakpoint>
|
||||
<line-breakpoint enabled="true" type="java-line">
|
||||
<url>file://$PROJECT_DIR$/src/main/java/com/lz/modules/app/controller/StaffController.java</url>
|
||||
<line>176</line>
|
||||
<line>191</line>
|
||||
<option name="timeStamp" value="75" />
|
||||
</line-breakpoint>
|
||||
<line-breakpoint enabled="true" type="java-line">
|
||||
<url>file://$PROJECT_DIR$/src/main/java/com/lz/modules/app/service/impl/StaffServiceImpl.java</url>
|
||||
<line>118</line>
|
||||
<option name="timeStamp" value="77" />
|
||||
</line-breakpoint>
|
||||
</breakpoints>
|
||||
</breakpoint-manager>
|
||||
</component>
|
||||
|
||||
@ -169,11 +169,26 @@ public class StaffController {
|
||||
data.put("departmentName", departmentName);
|
||||
|
||||
List<GraphicsStatisticalDto> genderRows = staffService.getGenderData(departmentId, beginDate, endDate);
|
||||
|
||||
GraphicsDto genderDistribution = new GraphicsDto();
|
||||
genderDistribution.setRows(genderRows);
|
||||
data.put("genderDistribution", genderDistribution);
|
||||
|
||||
List<GraphicsStatisticalDto> ageRows = staffService.getAgeData(departmentId, beginDate, endDate);
|
||||
GraphicsDto ageDistribution = new GraphicsDto();
|
||||
ageDistribution.setRows(ageRows);
|
||||
data.put("ageDistribution", ageDistribution);
|
||||
|
||||
List<GraphicsStatisticalDto> jobSeniorityRows = staffService.getJobSeniorityData(departmentId, beginDate, endDate);
|
||||
GraphicsDto jobSeniorityDistribution = new GraphicsDto();
|
||||
jobSeniorityDistribution.setRows(jobSeniorityRows);
|
||||
data.put("jobSeniorityDistribution", jobSeniorityDistribution);
|
||||
|
||||
List<GraphicsStatisticalDto> educationRows = staffService.getEducationData(departmentId, beginDate, endDate);
|
||||
GraphicsDto educationDistribution = new GraphicsDto();
|
||||
educationDistribution.setRows(educationRows);
|
||||
data.put("educationDistribution", educationDistribution);
|
||||
|
||||
|
||||
R ret = R.ok();
|
||||
ret.put("data", data);
|
||||
return ret;
|
||||
|
||||
@ -37,6 +37,12 @@ public interface StaffDao extends BaseMapper<StaffEntity> {
|
||||
|
||||
StaffStatisticalDto getStatisticalData(@Param("departmentId") String departmentId, @Param("beginDate") String beginDate, @Param("endDate") String endDate);
|
||||
|
||||
List<GraphicsStatisticalDto> getGenderData(String departmentId, String beginDate, String endDate);
|
||||
List<GraphicsStatisticalDto> getGenderData(@Param("departmentId") String departmentId, @Param("beginDate") String beginDate, @Param("endDate") String endDate);
|
||||
|
||||
List<GraphicsStatisticalDto> getAgeData(@Param("departmentId") String departmentId, @Param("beginDate") String beginDate, @Param("endDate") String endDate);
|
||||
|
||||
List<GraphicsStatisticalDto> getJobSeniorityData(@Param("departmentId") String departmentId, @Param("beginDate") String beginDate, @Param("endDate") String endDate);
|
||||
|
||||
List<GraphicsStatisticalDto> getEducationData(@Param("departmentId") String departmentId, @Param("beginDate") String beginDate, @Param("endDate") String endDate);
|
||||
|
||||
}
|
||||
|
||||
@ -40,5 +40,12 @@ public interface StaffService extends IService<StaffEntity> {
|
||||
List<GraphicsStatisticalDto> getGenderData(String departmentId, String beginDate, String endDate);
|
||||
|
||||
|
||||
List<GraphicsStatisticalDto> getAgeData(String departmentId, String beginDate, String endDate);
|
||||
|
||||
List<GraphicsStatisticalDto> getJobSeniorityData(String departmentId, String beginDate, String endDate);
|
||||
|
||||
List<GraphicsStatisticalDto> getEducationData(String departmentId, String beginDate, String endDate);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -19,6 +19,7 @@ import org.slf4j.LoggerFactory;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@ -111,12 +112,51 @@ public class StaffServiceImpl extends ServiceImpl<StaffDao, StaffEntity> impleme
|
||||
@Override
|
||||
public List<GraphicsStatisticalDto> getGenderData(String departmentId, String beginDate, String endDate) {
|
||||
List<GraphicsStatisticalDto> graphicsStatisticals = staffDao.getGenderData(departmentId, beginDate, endDate);
|
||||
int totalCount = 0;
|
||||
BigDecimal totalCount = BigDecimal.ZERO;
|
||||
for (GraphicsStatisticalDto graphicsStatisticalDto : graphicsStatisticals) {
|
||||
totalCount = totalCount + graphicsStatisticalDto.getNumber();
|
||||
totalCount = totalCount.add(new BigDecimal(graphicsStatisticalDto.getNumber()));
|
||||
}
|
||||
for (GraphicsStatisticalDto graphicsStatisticalDto : graphicsStatisticals) {
|
||||
graphicsStatisticalDto.setRate(NumberUtil.round(graphicsStatisticalDto.getNumber() / totalCount * 100, 2) + "%");
|
||||
graphicsStatisticalDto.setRate(new BigDecimal(graphicsStatisticalDto.getNumber() * 100).divide(totalCount, 2, BigDecimal.ROUND_HALF_UP) + "%");
|
||||
}
|
||||
return graphicsStatisticals;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<GraphicsStatisticalDto> getAgeData(String departmentId, String beginDate, String endDate) {
|
||||
List<GraphicsStatisticalDto> graphicsStatisticals = staffDao.getAgeData(departmentId, beginDate, endDate);
|
||||
BigDecimal totalCount = BigDecimal.ZERO;
|
||||
for (GraphicsStatisticalDto graphicsStatisticalDto : graphicsStatisticals) {
|
||||
totalCount = totalCount.add(new BigDecimal(graphicsStatisticalDto.getNumber()));
|
||||
}
|
||||
for (GraphicsStatisticalDto graphicsStatisticalDto : graphicsStatisticals) {
|
||||
graphicsStatisticalDto.setRate(new BigDecimal(graphicsStatisticalDto.getNumber() * 100).divide(totalCount, 2, BigDecimal.ROUND_HALF_UP) + "%");
|
||||
}
|
||||
return graphicsStatisticals;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<GraphicsStatisticalDto> getJobSeniorityData(String departmentId, String beginDate, String endDate) {
|
||||
List<GraphicsStatisticalDto> graphicsStatisticals = staffDao.getJobSeniorityData(departmentId, beginDate, endDate);
|
||||
BigDecimal totalCount = BigDecimal.ZERO;
|
||||
for (GraphicsStatisticalDto graphicsStatisticalDto : graphicsStatisticals) {
|
||||
totalCount = totalCount.add(new BigDecimal(graphicsStatisticalDto.getNumber()));
|
||||
}
|
||||
for (GraphicsStatisticalDto graphicsStatisticalDto : graphicsStatisticals) {
|
||||
graphicsStatisticalDto.setRate(new BigDecimal(graphicsStatisticalDto.getNumber() * 100).divide(totalCount, 2, BigDecimal.ROUND_HALF_UP) + "%");
|
||||
}
|
||||
return graphicsStatisticals;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<GraphicsStatisticalDto> getEducationData(String departmentId, String beginDate, String endDate) {
|
||||
List<GraphicsStatisticalDto> graphicsStatisticals = staffDao.getEducationData(departmentId, beginDate, endDate);
|
||||
BigDecimal totalCount = BigDecimal.ZERO;
|
||||
for (GraphicsStatisticalDto graphicsStatisticalDto : graphicsStatisticals) {
|
||||
totalCount = totalCount.add(new BigDecimal(graphicsStatisticalDto.getNumber()));
|
||||
}
|
||||
for (GraphicsStatisticalDto graphicsStatisticalDto : graphicsStatisticals) {
|
||||
graphicsStatisticalDto.setRate(new BigDecimal(graphicsStatisticalDto.getNumber() * 100).divide(totalCount, 2, BigDecimal.ROUND_HALF_UP) + "%");
|
||||
}
|
||||
return graphicsStatisticals;
|
||||
}
|
||||
|
||||
@ -110,7 +110,7 @@
|
||||
<if test="name != null and name != ''">
|
||||
and ls.name=#{name}
|
||||
</if>
|
||||
limit #{startIndex}, #{pageLimit}
|
||||
limit #{startIndex}, #{pageLimit}
|
||||
</select>
|
||||
|
||||
<select id="getStaffInfoCount" resultType="java.lang.Integer">
|
||||
@ -137,14 +137,17 @@
|
||||
ifnull(round(count(DISTINCT(td.leader_employee_id))/count(DISTINCT(ls.id))*100,2),0) managementRate,
|
||||
count(DISTINCT(ls.new_staff)) newStaffCount,
|
||||
count(DISTINCT(ls.leave_staff)) leaveStaffCount,
|
||||
ifnull(round(count(DISTINCT(ls.leave_staff))/(count(DISTINCT(ls.leave_staff))+count(DISTINCT(ls.id)))*100,2),0) leaveRate
|
||||
ifnull(round(count(DISTINCT(ls.leave_staff))/(count(DISTINCT(ls.leave_staff))+count(DISTINCT(ls.id)))*100,2),0)
|
||||
leaveRate
|
||||
from
|
||||
(select * from lz_staff ll
|
||||
left join
|
||||
(select staff_id as new_staff from lz_staff_occupation where date(entry_time) between #{beginDate} and #{endDate}) so1
|
||||
(select staff_id as new_staff from lz_staff_occupation where date(entry_time) between #{beginDate} and
|
||||
#{endDate}) so1
|
||||
on so1.new_staff=ll.id
|
||||
left join
|
||||
(select staff_id as leave_staff from lz_staff_occupation where date(resignation_time) between #{beginDate} and #{endDate}) so2
|
||||
(select staff_id as leave_staff from lz_staff_occupation where date(resignation_time) between #{beginDate} and
|
||||
#{endDate}) so2
|
||||
on so2.leave_staff=ll.id) ls,
|
||||
lz_departments_staff_relate dsr,lz_staff_occupation so,
|
||||
(select * from lz_departments
|
||||
@ -159,12 +162,78 @@
|
||||
|
||||
<select id="getGenderData" resultType="com.lz.modules.app.Dto.GraphicsStatisticalDto">
|
||||
select
|
||||
case gender when 1 then '男'
|
||||
when 2 then '女'
|
||||
else '未知'
|
||||
end category,
|
||||
count(gender) number
|
||||
from lz_staff group by gender
|
||||
case gender when 1 then '男'
|
||||
when 2 then '女'
|
||||
else '未知'
|
||||
end category,
|
||||
count(gender) number
|
||||
from lz_staff
|
||||
where id in (select so.staff_id from lz_staff_occupation so where date(so.resignation_time)>=#{endDate} or
|
||||
so.resignation_time is null)
|
||||
<if test="departmentId != null and departmentId != ''">
|
||||
and id in (select dsr.staff_id from lz_departments_staff_relate dsr,lz_departments ld where
|
||||
dsr.department_id=ld.department_id and find_in_set(ld.department_id, getChildList(#{departmentId})))
|
||||
</if>
|
||||
group by gender
|
||||
</select>
|
||||
|
||||
<select id="getAgeData" resultType="com.lz.modules.app.Dto.GraphicsStatisticalDto">
|
||||
select
|
||||
if(birthday=0,'未知',concat(birthday,'后')) category,
|
||||
count(birthday) number
|
||||
from (select id,ifnull(CONCAT(left(date_format(birthday,'%y'),1),'0'),0) birthday from lz_staff) ls
|
||||
where ls.id in (select so.staff_id from lz_staff_occupation so where date(so.resignation_time)>=#{endDate} or
|
||||
so.resignation_time is null)
|
||||
<if test="departmentId != null and departmentId != ''">
|
||||
and ls.id in (select dsr.staff_id from lz_departments_staff_relate dsr,lz_departments ld where
|
||||
dsr.department_id=ld.department_id and find_in_set(ld.department_id, getChildList(#{departmentId})))
|
||||
</if>
|
||||
group by ls.birthday
|
||||
</select>
|
||||
|
||||
<select id="getJobSeniorityData" resultType="com.lz.modules.app.Dto.GraphicsStatisticalDto">
|
||||
select
|
||||
ls.jobYear category,
|
||||
count(jobYear) number
|
||||
from (
|
||||
select staff_id,
|
||||
case
|
||||
when TIMESTAMPDIFF(YEAR,job_begin_time,DATE_FORMAT(NOW(), '%Y-%m-%d %H:%i:%S')) <![CDATA[ > ]]> 0 and
|
||||
TIMESTAMPDIFF(YEAR,job_begin_time,DATE_FORMAT(NOW(), '%Y-%m-%d %H:%i:%S'))<![CDATA[ <= ]]>3
|
||||
then '0-3年'
|
||||
when TIMESTAMPDIFF(YEAR,job_begin_time,DATE_FORMAT(NOW(), '%Y-%m-%d %H:%i:%S')) <![CDATA[ > ]]> 3 and
|
||||
TIMESTAMPDIFF(YEAR,job_begin_time,DATE_FORMAT(NOW(), '%Y-%m-%d %H:%i:%S'))<![CDATA[ <= ]]>5
|
||||
then '3-5年'
|
||||
when TIMESTAMPDIFF(YEAR,job_begin_time,DATE_FORMAT(NOW(), '%Y-%m-%d %H:%i:%S')) <![CDATA[ > ]]> 5 and
|
||||
TIMESTAMPDIFF(YEAR,job_begin_time,DATE_FORMAT(NOW(), '%Y-%m-%d %H:%i:%S'))<![CDATA[ <= ]]>10
|
||||
then '5-10年'
|
||||
when TIMESTAMPDIFF(YEAR,job_begin_time,DATE_FORMAT(NOW(), '%Y-%m-%d %H:%i:%S')) <![CDATA[ > ]]> 10
|
||||
then '10年以上' else '未知' end jobYear from lz_staff_occupation
|
||||
) ls
|
||||
where ls.staff_id in (select so.staff_id from lz_staff_occupation so where date(so.resignation_time)>=#{endDate}
|
||||
or so.resignation_time is null)
|
||||
<if test="departmentId != null and departmentId != ''">
|
||||
and ls.staff_id in (select dsr.staff_id from lz_departments_staff_relate dsr,lz_departments ld where
|
||||
dsr.department_id=ld.department_id and find_in_set(ld.department_id, getChildList(#{departmentId})))
|
||||
</if>
|
||||
group by ls.jobYear
|
||||
</select>
|
||||
|
||||
<select id="getEducationData" resultType="com.lz.modules.app.Dto.GraphicsStatisticalDto">
|
||||
select
|
||||
ls.education category,
|
||||
count(education) number
|
||||
from (
|
||||
select ss.id,ifnull(se.education,'未知') education from lz_staff ss left join lz_staff_education se on
|
||||
se.staff_id=ss.id
|
||||
) ls
|
||||
where ls.id in (select so.staff_id from lz_staff_occupation so where date(so.resignation_time)>=#{endDate} or
|
||||
so.resignation_time is null)
|
||||
<if test="departmentId != null and departmentId != ''">
|
||||
and ls.id in (select dsr.staff_id from lz_departments_staff_relate dsr,lz_departments ld where
|
||||
dsr.department_id=ld.department_id and find_in_set(ld.department_id, getChildList(#{departmentId})))
|
||||
</if>group by ls.education
|
||||
|
||||
</select>
|
||||
|
||||
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -110,7 +110,7 @@
|
||||
<if test="name != null and name != ''">
|
||||
and ls.name=#{name}
|
||||
</if>
|
||||
limit #{startIndex}, #{pageLimit}
|
||||
limit #{startIndex}, #{pageLimit}
|
||||
</select>
|
||||
|
||||
<select id="getStaffInfoCount" resultType="java.lang.Integer">
|
||||
@ -137,14 +137,17 @@
|
||||
ifnull(round(count(DISTINCT(td.leader_employee_id))/count(DISTINCT(ls.id))*100,2),0) managementRate,
|
||||
count(DISTINCT(ls.new_staff)) newStaffCount,
|
||||
count(DISTINCT(ls.leave_staff)) leaveStaffCount,
|
||||
ifnull(round(count(DISTINCT(ls.leave_staff))/(count(DISTINCT(ls.leave_staff))+count(DISTINCT(ls.id)))*100,2),0) leaveRate
|
||||
ifnull(round(count(DISTINCT(ls.leave_staff))/(count(DISTINCT(ls.leave_staff))+count(DISTINCT(ls.id)))*100,2),0)
|
||||
leaveRate
|
||||
from
|
||||
(select * from lz_staff ll
|
||||
left join
|
||||
(select staff_id as new_staff from lz_staff_occupation where date(entry_time) between #{beginDate} and #{endDate}) so1
|
||||
(select staff_id as new_staff from lz_staff_occupation where date(entry_time) between #{beginDate} and
|
||||
#{endDate}) so1
|
||||
on so1.new_staff=ll.id
|
||||
left join
|
||||
(select staff_id as leave_staff from lz_staff_occupation where date(resignation_time) between #{beginDate} and #{endDate}) so2
|
||||
(select staff_id as leave_staff from lz_staff_occupation where date(resignation_time) between #{beginDate} and
|
||||
#{endDate}) so2
|
||||
on so2.leave_staff=ll.id) ls,
|
||||
lz_departments_staff_relate dsr,lz_staff_occupation so,
|
||||
(select * from lz_departments
|
||||
@ -159,12 +162,78 @@
|
||||
|
||||
<select id="getGenderData" resultType="com.lz.modules.app.Dto.GraphicsStatisticalDto">
|
||||
select
|
||||
case gender when 1 then '男'
|
||||
when 2 then '女'
|
||||
else '未知'
|
||||
end category,
|
||||
count(gender) number
|
||||
from lz_staff group by gender
|
||||
case gender when 1 then '男'
|
||||
when 2 then '女'
|
||||
else '未知'
|
||||
end category,
|
||||
count(gender) number
|
||||
from lz_staff
|
||||
where id in (select so.staff_id from lz_staff_occupation so where date(so.resignation_time)>=#{endDate} or
|
||||
so.resignation_time is null)
|
||||
<if test="departmentId != null and departmentId != ''">
|
||||
and id in (select dsr.staff_id from lz_departments_staff_relate dsr,lz_departments ld where
|
||||
dsr.department_id=ld.department_id and find_in_set(ld.department_id, getChildList(#{departmentId})))
|
||||
</if>
|
||||
group by gender
|
||||
</select>
|
||||
|
||||
<select id="getAgeData" resultType="com.lz.modules.app.Dto.GraphicsStatisticalDto">
|
||||
select
|
||||
if(birthday=0,'未知',concat(birthday,'后')) category,
|
||||
count(birthday) number
|
||||
from (select id,ifnull(CONCAT(left(date_format(birthday,'%y'),1),'0'),0) birthday from lz_staff) ls
|
||||
where ls.id in (select so.staff_id from lz_staff_occupation so where date(so.resignation_time)>=#{endDate} or
|
||||
so.resignation_time is null)
|
||||
<if test="departmentId != null and departmentId != ''">
|
||||
and ls.id in (select dsr.staff_id from lz_departments_staff_relate dsr,lz_departments ld where
|
||||
dsr.department_id=ld.department_id and find_in_set(ld.department_id, getChildList(#{departmentId})))
|
||||
</if>
|
||||
group by ls.birthday
|
||||
</select>
|
||||
|
||||
<select id="getJobSeniorityData" resultType="com.lz.modules.app.Dto.GraphicsStatisticalDto">
|
||||
select
|
||||
ls.jobYear category,
|
||||
count(jobYear) number
|
||||
from (
|
||||
select staff_id,
|
||||
case
|
||||
when TIMESTAMPDIFF(YEAR,job_begin_time,DATE_FORMAT(NOW(), '%Y-%m-%d %H:%i:%S')) <![CDATA[ > ]]> 0 and
|
||||
TIMESTAMPDIFF(YEAR,job_begin_time,DATE_FORMAT(NOW(), '%Y-%m-%d %H:%i:%S'))<![CDATA[ <= ]]>3
|
||||
then '0-3年'
|
||||
when TIMESTAMPDIFF(YEAR,job_begin_time,DATE_FORMAT(NOW(), '%Y-%m-%d %H:%i:%S')) <![CDATA[ > ]]> 3 and
|
||||
TIMESTAMPDIFF(YEAR,job_begin_time,DATE_FORMAT(NOW(), '%Y-%m-%d %H:%i:%S'))<![CDATA[ <= ]]>5
|
||||
then '3-5年'
|
||||
when TIMESTAMPDIFF(YEAR,job_begin_time,DATE_FORMAT(NOW(), '%Y-%m-%d %H:%i:%S')) <![CDATA[ > ]]> 5 and
|
||||
TIMESTAMPDIFF(YEAR,job_begin_time,DATE_FORMAT(NOW(), '%Y-%m-%d %H:%i:%S'))<![CDATA[ <= ]]>10
|
||||
then '5-10年'
|
||||
when TIMESTAMPDIFF(YEAR,job_begin_time,DATE_FORMAT(NOW(), '%Y-%m-%d %H:%i:%S')) <![CDATA[ > ]]> 10
|
||||
then '10年以上' else '未知' end jobYear from lz_staff_occupation
|
||||
) ls
|
||||
where ls.staff_id in (select so.staff_id from lz_staff_occupation so where date(so.resignation_time)>=#{endDate}
|
||||
or so.resignation_time is null)
|
||||
<if test="departmentId != null and departmentId != ''">
|
||||
and ls.staff_id in (select dsr.staff_id from lz_departments_staff_relate dsr,lz_departments ld where
|
||||
dsr.department_id=ld.department_id and find_in_set(ld.department_id, getChildList(#{departmentId})))
|
||||
</if>
|
||||
group by ls.jobYear
|
||||
</select>
|
||||
|
||||
<select id="getEducationData" resultType="com.lz.modules.app.Dto.GraphicsStatisticalDto">
|
||||
select
|
||||
ls.education category,
|
||||
count(education) number
|
||||
from (
|
||||
select ss.id,ifnull(se.education,'未知') education from lz_staff ss left join lz_staff_education se on
|
||||
se.staff_id=ss.id
|
||||
) ls
|
||||
where ls.id in (select so.staff_id from lz_staff_occupation so where date(so.resignation_time)>=#{endDate} or
|
||||
so.resignation_time is null)
|
||||
<if test="departmentId != null and departmentId != ''">
|
||||
and ls.id in (select dsr.staff_id from lz_departments_staff_relate dsr,lz_departments ld where
|
||||
dsr.department_id=ld.department_id and find_in_set(ld.department_id, getChildList(#{departmentId})))
|
||||
</if>group by ls.education
|
||||
|
||||
</select>
|
||||
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user