secondev-chapanda/secondev-chabaidao-portal/src/main/resources/mapper/portal/LeaderCockpitMapper.xml

156 lines
7.0 KiB
XML

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.weaver.seconddev.portal.mapper.portal.LeaderCockpitMapper">
<select id="getOnJobNumber" resultType="com.weaver.seconddev.portal.entity.po.PortalPO">
select count(t.id) as value ,b.yglxmc as name from ${e10_common}.uf_jcl_employee_information t
inner join ${e10_common}.uf_jcl_yglx b on t.yglx = b.id
where t.delete_type = 0 and t.tenant_key = #{tenantKey}
<if test="departmentIdList != null and departmentIdList.size() > 0">
AND t.department IN
<foreach collection="departmentIdList" item="departmentId" open="(" close=")" separator=",">
#{departmentId}
</foreach>
</if>
<!--开始日期 <= 结束查询日期-->
AND t.hiredate &lt;= #{endDate}
<!--最后工作日期 > 开始查询日期 OR 最后工作日期为空-->
and (t.zhgzr ='' or t.zhgzr is null or t.zhgzr &gt; #{endDate})
group by b.yglxmc
</select>
<select id="getOnJobCount" resultType="java.lang.Integer">
select count(t.id) as value from ${e10_common}.uf_jcl_employee_information t
where t.delete_type = 0 and t.tenant_key = #{tenantKey}
<if test="departmentIdList != null and departmentIdList.size() > 0">
AND t.department IN
<foreach collection="departmentIdList" item="departmentId" open="(" close=")" separator=",">
#{departmentId}
</foreach>
</if>
<!--开始日期 <= 结束查询日期-->
AND t.hiredate &lt;= #{endDate}
<!--最后工作日期 > 开始查询日期 OR 最后工作日期为空-->
and (t.zhgzr ='' or t.zhgzr is null or t.zhgzr &gt; #{endDate})
</select>
<select id="getResignCount" resultType="java.lang.Integer">
select count(id) as value from ${param.e10_common}.uf_jcl_lzxxjl t
where t.delete_type = 0 and t.tenant_key = #{param.tenantKey}
and t.lzzt = 1
<if test="departmentIdList != null and departmentIdList.size() > 0">
AND t.lzqbm IN
<foreach collection="departmentIdList" item="departmentId" open="(" close=")" separator=",">
#{departmentId}
</foreach>
</if>
and t.zhgzr &gt;= #{startDate}
and t.zhgzr &lt;= #{endDate}
</select>
<select id="getKeyResignCount" resultType="java.lang.Integer">
select count(id) as value from ${param.e10_common}.uf_jcl_lzxxjl t
where t.delete_type = 0 and t.tenant_key = #{param.tenantKey}
and t.lzzt = 1
<if test="departmentIdList != null and departmentIdList.size() > 0">
AND t.lzqbm IN
<foreach collection="departmentIdList" item="departmentId" open="(" close=")" separator=",">
#{departmentId}
</foreach>
</if>
and t.sfgjrc = 1
and t.zhgzr &gt;= #{startDate}
and t.zhgzr &lt;= #{endDate}
</select>
<select id="getEmploymentCount" resultType="java.lang.Integer">
select count(id) as value from ${param.e10_common}.uf_jcl_rzgl t
where t.delete_type = 0 and t.tenant_key = #{param.tenantKey}
and t.rzzt = 1
<if test="departmentIdList != null and departmentIdList.size() > 0">
AND t.department IN
<foreach collection="departmentIdList" item="departmentId" open="(" close=")" separator=",">
#{departmentId}
</foreach>
</if>
and t.hiredate &gt;= #{startDate}
and t.hiredate &lt;= #{endDate}
</select>
<select id="getKeyEmploymentCount" resultType="java.lang.Integer">
select count(id) as value from ${param.e10_common}.uf_jcl_rzgl t
where t.delete_type = 0 and t.tenant_key = #{param.tenantKey}
and t.rzzt = 1
<if test="departmentIdList != null and departmentIdList.size() > 0">
AND t.department IN
<foreach collection="departmentIdList" item="departmentId" open="(" close=")" separator=",">
#{departmentId}
</foreach>
</if>
and t.sfgjrc = 1
and t.hiredate &gt;= #{startDate}
and t.hiredate &lt;= #{endDate}
</select>
<select id="getEmploymentListByPosition" resultType="com.weaver.seconddev.portal.entity.po.PortalPO">
select count(id) as name,position as value from ${param.e10_common}.uf_jcl_rzgl t
where t.delete_type = 0 and t.tenant_key = #{param.tenantKey}
and t.rzzt = 1
<if test="departmentIdList != null and departmentIdList.size() > 0">
AND t.department IN
<foreach collection="departmentIdList" item="departmentId" open="(" close=")" separator=",">
#{departmentId}
</foreach>
</if>
and t.hiredate &gt;= #{startDate}
and t.hiredate &lt;= #{endDate}
and position !='' and position is not null
group by position order by value
</select>
<select id="getPositionById" resultType="com.weaver.seconddev.portal.entity.po.Position">
select p.id as position_id, p.name as position_name,
d.id as department_id, d.name as department_name,
g.id as grade_id, g.name as grade_name
from ${param.eteams}.position p
left join ${param.eteams}.department d on p.department = d.id
left join ${param.eteams}.grade g on p.grade_id = g.id
where p.id = #{positionId} and p.delete_type = 0
and p.tenant_key = #{param.tenantKey} limit 1
</select>
<select id="getResignListByPosition" resultType="com.weaver.seconddev.portal.entity.po.PortalPO">
select count(id) as name,lzqgw as value from ${param.e10_common}.uf_jcl_lzxxjl t
where t.delete_type = 0 and t.tenant_key = #{param.tenantKey}
and t.lzzt = 1
<if test="departmentIdList != null and departmentIdList.size() > 0">
AND t.lzqbm IN
<foreach collection="departmentIdList" item="departmentId" open="(" close=")" separator=",">
#{departmentId}
</foreach>
</if>
and t.zhgzr &gt;= #{startDate}
and t.zhgzr &lt;= #{endDate}
and t.lzqgw !='' and t.lzqgw is not null
group by t.lzqgw order by value
</select>
<select id="getTopDepartmentIds" resultType="java.lang.Long">
select t.id
from ${param.eteams}.department t
inner join ${param.eteams}.department t1 on t.parent = t1.id
where t.type = 'department'
and t1.type = 'subcompany'
and t.delete_type = 0
and t.status = 1
and t.tenant_key = #{param.tenantKey}
and t1.delete_type = 0
and t1.status = 1
and t1.tenant_key = #{param.tenantKey}
</select>
<select id="getLaborCost" resultType="java.util.Map">
select t.yscb,t.sjcb from ${e10_common}.uf_rlcb t
where t.delete_type = 0 and t.tenant_key = #{tenantKey}
and t.ny = DATE_FORMAT(#{endDate}, '%Y-%m')
</select>
</mapper>