heheng
2025-09-12 3b109477ba6bd8dce0f61eb75248e603e584d8af
gkhy-system/src/main/resources/mapper/system/SysDeptMapper.xml
@@ -21,6 +21,10 @@
      <result property="updateBy"   column="update_by"   />
      <result property="updateTime" column="update_time" />
   </resultMap>
   <resultMap id="SysDeptDataResult" type="com.gkhy.system.domain.vo.DeptVo" extends="SysDeptResult">
      <result property="checkCount" column="check_count" />
   </resultMap>
   
   <sql id="selectDeptVo">
        select d.dept_id, d.parent_id, d.ancestors, d.dept_name, d.order_num, d.leader, d.phone, d.email, d.status, d.del_flag, d.create_by, d.create_time 
@@ -46,6 +50,21 @@
      ${params.dataScope}
      order by d.parent_id, d.order_num
    </select>
   <select id="selectDeptData" parameterType="Date" resultMap="SysDeptDataResult">
      select d.dept_id, d.parent_id, d.ancestors, d.dept_name, d.order_num, d.leader, d.phone,
            d.email, d.status, d.del_flag, d.create_by, d.create_time ,
            ( select count(*) from daily_safety_inspection where del_flag = 0 and research_group = dept_id and date_format(check_date,'%Y%m') = date_format(#{beginDate},'%Y%m')) check_count
      from sys_dept d
      where d.del_flag = '0'
      order by d.parent_id, d.order_num
   </select>
    
    <select id="selectDeptListByRoleId" resultType="Long">
      select d.dept_id
@@ -156,4 +175,4 @@
      update sys_dept set del_flag = '2' where dept_id = #{deptId}
   </delete>
</mapper>
</mapper>