GroupDao.xml 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE mapper
  3. PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  4. "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  5. <mapper namespace="platform.modules.sys.dao.GroupDao">
  6. <select id="findByGroupName" resultType="platform.modules.sys.entity.Group">
  7. select * from sys_group where name=#{name}
  8. <if test="id!=null and id!=''">
  9. and id!=#{id}
  10. </if>
  11. <if test="user_type!=null ">
  12. and user_type = #{user_type}
  13. </if>
  14. <if test="department_id!=null and department_id!=''">
  15. and (
  16. street_id = #{department_id}
  17. or build_id = #{department_id}
  18. or company_id = #{department_id}
  19. )
  20. </if>
  21. </select>
  22. <select id="findByGroupNameOnly" resultType="platform.modules.sys.entity.Group">
  23. select * from sys_group where name=#{name}
  24. </select>
  25. <select id="findUserIdById" resultType="Integer">
  26. select user_id from sys_user_group where group_id=#{id}
  27. </select>
  28. <select id="getHighestApproveLevel" resultType="Integer">
  29. select
  30. min(approve_level)
  31. from sys_user_group ug
  32. LEFT JOIN sys_group g on g.id = ug.group_id
  33. left JOIN z_user u on u.id = ug.user_id
  34. where g.id = #{id}
  35. </select>
  36. </mapper>