Нет описания

TLhzxEmployeeStandardMapper.xml 3.1KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  3. <mapper namespace="com.yt.zhylplat.moduleLhzx.employeestandard.mapper.TLhzxEmployeeStandardMapper">
  4. <!-- 通用查询映射结果 -->
  5. <resultMap id="BaseResultMap" type="com.yt.zhylplat.moduleLhzx.employeestandard.entity.TLhzxEmployeeStandard">
  6. <id column="id" property="id" />
  7. <result column="section_id" property="sectionId" />
  8. <result column="section_name" property="sectionName" />
  9. <result column="maintenance_company_id" property="maintenanceCompanyId" />
  10. <result column="maintenance_company_name" property="maintenanceCompanyName" />
  11. <result column="manage_count" property="manageCount" />
  12. <result column="worker_count" property="workerCount" />
  13. <result column="sum_count" property="sumCount" />
  14. <result column="remark" property="remark" />
  15. <result column="create_user_id" property="createUserId" />
  16. <result column="create_date" property="createDate" />
  17. <result column="update_user_id" property="updateUserId" />
  18. <result column="update_date" property="updateDate" />
  19. <result column="del_flg" property="delFlg" />
  20. </resultMap>
  21. <!-- 通用查询结果列 -->
  22. <sql id="Base_Column_List">
  23. 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
  24. </sql>
  25. <select id="realityemployee"
  26. resultType="com.yt.zhylplat.moduleLhzx.road.entity.TLhzxRoadSectionMaintenanceCompany">
  27. SELECT DISTINCT
  28. emp.section_id as sectionId,
  29. emp.section_name,
  30. emp.maintenance_company_id,
  31. emp.maintenance_company_name,
  32. maneger AS managerCount,
  33. worker AS workerCount
  34. FROM (
  35. SELECT
  36. es.section_id,
  37. s.section_name,
  38. maintenance_company_id,
  39. maintenance_company_name,
  40. sum(IF(emp_type=0, 1, 0)) AS maneger,
  41. sum(IF(emp_type!=0, 1, 0)) AS worker
  42. FROM T_Lhzx_Employee e
  43. left join T_Lhzx_Employee_Section es on e.id = es.employee_id
  44. left join T_Lhzx_Section s on es.section_id = s.id
  45. WHERE e.del_flg = 0
  46. GROUP BY
  47. es.section_id,
  48. s.section_name,
  49. maintenance_company_id,
  50. maintenance_company_name
  51. ) AS emp
  52. LEFT JOIN (
  53. SELECT DISTINCT section_id,
  54. maintenance_company_id
  55. FROM T_Lhzx_Road_Section_Maintenance_Company
  56. WHERE del_flg = 0
  57. ) AS rsmc ON emp.maintenance_company_id = rsmc.maintenance_company_id and rsmc.section_id = emp.section_id
  58. <where>
  59. <if test="standard.maintenanceCompanyId!=null">
  60. and rsmc.maintenance_company_id=#{standard.maintenanceCompanyId}
  61. </if>
  62. <if test="standard.sectionId!=null ">
  63. and emp.section_id= #{standard.sectionId}
  64. </if>
  65. </where>
  66. ORDER BY
  67. emp.maintenance_company_id,emp.section_id
  68. </select>
  69. </mapper>