MyBatisPlus统计数据
Posted 可小辉
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了MyBatisPlus统计数据相关的知识,希望对你有一定的参考价值。
<select id="supplysDetail" resultType="com.dcz.labor.vo.SupplysDetailsVO">
SELECT
T1.`name`,
T1.phone,
T1.is_delete,
COUNT( T2.user_id ) AS total_emps,
SUM(IF ( T2.staff_statu = 1 AND T3.job_type = 0, 1, 0 )) AS full_job_inemps,
SUM(IF ( T2.staff_statu = 0 AND T3.job_type = 0,1,0)) AS full_job_leaveemps,
SUM(IF ( T2.staff_statu = 1 AND T3.job_type = 3, 1, 0 )) AS temp_job_inemps,
SUM(IF ( T2.staff_statu = 0 AND T3.job_type = 3,1,0)) AS temp_job_leaveemps,
CASE
WHEN T2.id IS NOT NULL THEN '在职员工'
WHEN T2.id IS NULL THEN '委外供应商'
END supply_type
FROM
company_supply T1
LEFT JOIN company_roster T2 ON T2.source_id = T1.id
LEFT JOIN job T3 ON T3.id = T2.job_id
$ew.customSqlSegment
</select>
@Mapper
public interface CompanySupplyMapper extends BaseMapper<CompanySupplyEntity>
Page<SupplysDetailsVO> supplysDetail(Page<SupplysDetailsVO> page, @Param(Constants.WRAPPER) Wrapper wrapper);
以上是关于MyBatisPlus统计数据的主要内容,如果未能解决你的问题,请参考以下文章
MybatisPlus的代码生成器 使用详解(整合springboot)
MybatisPlus的代码生成器 使用详解(整合springboot)