SbPositionMapper.xml 3.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  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.platform.dao.mapper.sb.SbPositionMapper">
  4. <sql id="Base_Column_List">
  5. id, no, name, type, sort, code, user_id, del_flag, parent_id, opc_flag, opc_img, light_flag, light_img, remark, created_user_id, update_user_id,
  6. created_time, update_time
  7. </sql>
  8. <sql id="Join_Column">
  9. position.id, position.no, position.name, position.code, position.opc_flag, position.light_flag, position.light_img, position.opc_img, position.user_id, position.type, position.sort, position.del_flag, position.parent_id,
  10. position.remark, position.created_user_id, position.update_user_id,
  11. position.created_time, position.update_time,position.position_x,position.position_y,
  12. p.name as parentName, user.real_name as userName
  13. </sql>
  14. <select id="selectVOList" parameterType="com.platform.dao.dto.sb.SbPositionDTO"
  15. resultType="com.platform.dao.vo.sb.SbPositionVO">
  16. select
  17. <include refid="Join_Column"/>
  18. from t_sb_position position
  19. left join t_sb_position p on position.parent_id = p.id
  20. left join t_sys_user user on position.user_id = user.user_id
  21. where 1=1
  22. <if test="keyword != null and keyword != ''">
  23. and ( position.name like concat('%',#{keyword},'%') or
  24. position.no like concat('%',#{keyword},'%'))
  25. </if>
  26. <if test="parentId != null and parentId != ''">
  27. and position.parent_id = #{parentId}
  28. </if>
  29. <if test="parentCode != null and parentCode != ''">
  30. and position.code like concat(#{parentCode},'%')
  31. </if>
  32. <if test="opcFlag != null">
  33. and position.opc_flag = #{opcFlag}
  34. </if>
  35. <if test="lightFlag != null">
  36. and position.light_flag = #{lightFlag}
  37. </if>
  38. <if test="type != null">
  39. and position.type = #{type}
  40. </if>
  41. <if test="userName != null and userName != ''">
  42. and ( user.real_name like concat('%',#{userName},'%') or
  43. user.username like concat('%',#{userName},'%'))
  44. </if>
  45. </select>
  46. <select id="getById" parameterType="java.lang.Object"
  47. resultType="com.platform.dao.vo.sb.SbPositionVO">
  48. select
  49. <include refid="Join_Column"/>
  50. from t_sb_position position
  51. left join t_sb_position p on position.parent_id = p.id
  52. left join t_sys_user user on position.user_id = user.user_id
  53. where position.id = #{id}
  54. </select>
  55. <select id="selectNameById" parameterType="java.lang.Object" resultType="java.lang.String">
  56. select name
  57. from t_sb_position
  58. where id = #{value}
  59. </select>
  60. <select id="selectLongYanList" parameterType="com.platform.dao.dto.sb.SbPositionDTO"
  61. resultType="com.platform.dao.vo.sb.SbPositionVO">
  62. select * from t_sb_position
  63. <where>
  64. <choose>
  65. <when test="parentId != null and parentId != ''">
  66. and parent_id = #{parentId}
  67. </when>
  68. <otherwise>
  69. and (parent_id is null or parent_id = '')
  70. </otherwise>
  71. </choose>
  72. </where>
  73. order by sort asc
  74. </select>
  75. <select id="countNum" parameterType="java.lang.Object" resultType="java.lang.Integer">
  76. select count(1)
  77. from t_sb_position
  78. where parent_id = #{value}
  79. </select>
  80. </mapper>