heheng
4 days ago f038e7d0338375025baa96986c5f1990abd990b9
gkhy-system/src/main/resources/mapper/system/SysDeptMapper.xml
@@ -60,7 +60,11 @@
   <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 ,d.safety,
            ( 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
<!--            ( 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-->
   (      select COUNT(*) from daily_safety_inspection_dept aa
      INNER JOIN daily_safety_inspection bb on aa.daily_safety_inspection_id = bb.id and bb.del_flag = 0  and bb.scratchpad = 2 and date_format(bb.check_date,'%Y%m') = date_format(#{beginDate},'%Y%m')
      where aa.dept_id = d.dept_id) check_count
      from sys_dept d
      where d.del_flag = '0'
      order by d.parent_id, d.order_num
@@ -87,6 +91,18 @@
      from sys_dept d
      where d.dept_id = #{deptId}
   </select>
   <select id="selectDeptByIds" parameterType="java.util.ArrayList" resultMap="SysDeptResult">
      select d.dept_id, d.parent_id, d.ancestors, d.dept_name, d.order_num, d.leader, d.phone, d.email, d.status, d.safety,
      (select dept_name from sys_dept where dept_id = d.parent_id) parent_name
      from sys_dept d
      where d.dept_id in
      <foreach collection="array" item="deptId" open="(" separator="," close=")">
         #{deptId}
      </foreach>
      and d.del_flag = '0'
   </select>
    
    <select id="checkDeptExistUser" parameterType="Long" resultType="int">
      select count(1) from sys_user where dept_id = #{deptId} and del_flag = '0'