| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273 |
- <?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.yt.zhylplat.moduleLhzx.employeestandard.mapper.TLhzxEmployeeStandardMapper">
- <!-- 通用查询映射结果 -->
- <resultMap id="BaseResultMap" type="com.yt.zhylplat.moduleLhzx.employeestandard.entity.TLhzxEmployeeStandard">
- <id column="id" property="id" />
- <result column="section_id" property="sectionId" />
- <result column="section_name" property="sectionName" />
- <result column="maintenance_company_id" property="maintenanceCompanyId" />
- <result column="maintenance_company_name" property="maintenanceCompanyName" />
- <result column="manage_count" property="manageCount" />
- <result column="worker_count" property="workerCount" />
- <result column="sum_count" property="sumCount" />
- <result column="remark" property="remark" />
- <result column="create_user_id" property="createUserId" />
- <result column="create_date" property="createDate" />
- <result column="update_user_id" property="updateUserId" />
- <result column="update_date" property="updateDate" />
- <result column="del_flg" property="delFlg" />
- </resultMap>
- <!-- 通用查询结果列 -->
- <sql id="Base_Column_List">
- id, section_id, section_name, maintenance_company_id, maintenance_company_name, manage_count, worker_count, sum_count, remark, create_user_id, create_date, update_user_id, update_date, del_flg
- </sql>
- <select id="realityemployee"
- resultType="com.yt.zhylplat.moduleLhzx.road.entity.TLhzxRoadSectionMaintenanceCompany">
- SELECT DISTINCT
- emp.section_id as sectionId,
- emp.section_name,
- emp.maintenance_company_id,
- emp.maintenance_company_name,
- maneger AS managerCount,
- worker AS workerCount
- FROM (
- SELECT
- es.section_id,
- s.section_name,
- maintenance_company_id,
- maintenance_company_name,
- sum(IF(emp_type=0, 1, 0)) AS maneger,
- sum(IF(emp_type!=0, 1, 0)) AS worker
- FROM T_Lhzx_Employee e
- left join T_Lhzx_Employee_Section es on e.id = es.employee_id
- left join T_Lhzx_Section s on es.section_id = s.id
- WHERE e.del_flg = 0
- GROUP BY
- es.section_id,
- s.section_name,
- maintenance_company_id,
- maintenance_company_name
- ) AS emp
- LEFT JOIN (
- SELECT DISTINCT section_id,
- maintenance_company_id
- FROM T_Lhzx_Road_Section_Maintenance_Company
- WHERE del_flg = 0
- ) AS rsmc ON emp.maintenance_company_id = rsmc.maintenance_company_id and rsmc.section_id = emp.section_id
- <where>
- <if test="standard.maintenanceCompanyId!=null">
- and rsmc.maintenance_company_id=#{standard.maintenanceCompanyId}
- </if>
- <if test="standard.sectionId!=null ">
- and emp.section_id= #{standard.sectionId}
- </if>
- </where>
- ORDER BY
- emp.maintenance_company_id,emp.section_id
- </select>
- </mapper>
|