DocDirMapper.xml 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  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="com.doc.biz.mapper.DocDirMapper">
  6. <resultMap type="DocDir" id="DocDirResult">
  7. <result property="dirId" column="DIR_ID"/>
  8. <result property="spaceId" column="SPACE_ID"/>
  9. <result property="dirType" column="DIR_TYPE"/>
  10. <result property="dirRole" column="DIR_ROLE"/>
  11. <result property="dirName" column="DIR_NAME"/>
  12. <result property="parentId" column="PARENT_ID"/>
  13. <result property="dirPath" column="DIR_PATH"/>
  14. <result property="isEncrypt" column="IS_ENCRYPT"/>
  15. <result property="encryptLevel" column="ENCRYPT_LEVEL"/>
  16. <result property="createBy" column="CREATE_BY"/>
  17. <result property="createTime" column="CREATE_TIME"/>
  18. <result property="updateBy" column="UPDATE_BY"/>
  19. <result property="updateTime" column="UPDATE_TIME"/>
  20. <result property="remark" column="REMARK"/>
  21. </resultMap>
  22. <sql id="selectDocDirVo">
  23. select DIR_ID,
  24. SPACE_ID,
  25. DIR_TYPE,
  26. DIR_ROLE,
  27. DIR_NAME,
  28. PARENT_ID,
  29. DIR_PATH,
  30. IS_ENCRYPT,
  31. ENCRYPT_LEVEL,
  32. CREATE_BY,
  33. CREATE_TIME,
  34. UPDATE_BY,
  35. UPDATE_TIME,
  36. REMARK
  37. from v_doc_dir
  38. </sql>
  39. <select id="selectDocDirList" parameterType="DocDir" resultMap="DocDirResult">
  40. <include refid="selectDocDirVo"/>
  41. <where>
  42. <if test="dirType != null and dirType != ''">and DIR_TYPE = #{dirType}</if>
  43. <if test="dirRole != null and dirRole != ''">and DIR_ROLE = #{dirRole}</if>
  44. <if test="spaceId != null and spaceId != ''">and SPACE_ID = #{spaceId}</if>
  45. <if test="dirName != null and dirName != ''">and DIR_NAME like concat('%', #{dirName}, '%')</if>
  46. <if test="parentId != null ">and PARENT_ID = #{parentId}</if>
  47. </where>
  48. </select>
  49. <select id="selectDocDirByDirId" parameterType="Long" resultMap="DocDirResult">
  50. <include refid="selectDocDirVo"/>
  51. where DIR_ID = #{dirId}
  52. </select>
  53. <select id="selectDirByUser" resultType="com.doc.biz.domain.DocDir">
  54. <include refid="selectDocDirVo"/>
  55. WHERE space_id IN
  56. <foreach collection="spaceIds" open="(" separator="," close=")" item="spaceId">
  57. #{spaceId}
  58. </foreach>
  59. AND (
  60. dir_type = '1' OR (
  61. dir_type = '2' AND dir_id IN
  62. (
  63. SELECT dir_id FROM doc_dir_user WHERE user_id = #{userId}
  64. )
  65. )
  66. )
  67. </select>
  68. <insert id="insertDocDir" parameterType="DocDir" useGeneratedKeys="true" keyProperty="dirId">
  69. insert into doc_dir
  70. <trim prefix="(" suffix=")" suffixOverrides=",">
  71. <if test="spaceId != null">SPACE_ID,</if>
  72. <if test="dirType != null">DIR_TYPE,</if>
  73. <if test="dirRole != null">DIR_ROLE,</if>
  74. <if test="dirName != null">DIR_NAME,</if>
  75. <if test="parentId != null">PARENT_ID,</if>
  76. <if test="dirPath != null">DIR_PATH,</if>
  77. <if test="isEncrypt != null">IS_ENCRYPT,</if>
  78. <if test="encryptLevel != null">ENCRYPT_LEVEL,</if>
  79. <if test="createBy != null">CREATE_BY,</if>
  80. <if test="createTime != null">CREATE_TIME,</if>
  81. <if test="updateBy != null">UPDATE_BY,</if>
  82. <if test="updateTime != null">UPDATE_TIME,</if>
  83. <if test="remark != null">REMARK,</if>
  84. </trim>
  85. <trim prefix="values (" suffix=")" suffixOverrides=",">
  86. <if test="spaceId != null">#{spaceId},</if>
  87. <if test="dirType != null">#{dirType},</if>
  88. <if test="dirRole != null">#{dirRole},</if>
  89. <if test="dirName != null">#{dirName},</if>
  90. <if test="parentId != null">#{parentId},</if>
  91. <if test="dirPath != null">#{dirPath},</if>
  92. <if test="isEncrypt != null">#{isEncrypt},</if>
  93. <if test="encryptLevel != null">#{encryptLevel},</if>
  94. <if test="createBy != null">#{createBy},</if>
  95. <if test="createTime != null">#{createTime},</if>
  96. <if test="updateBy != null">#{updateBy},</if>
  97. <if test="updateTime != null">#{updateTime},</if>
  98. <if test="remark != null">#{remark},</if>
  99. </trim>
  100. </insert>
  101. <update id="updateDocDir" parameterType="DocDir">
  102. update doc_dir
  103. <trim prefix="SET" suffixOverrides=",">
  104. <if test="spaceId != null">SPACE_ID = #{spaceId},</if>
  105. <if test="dirType != null">DIR_TYPE = #{dirType},</if>
  106. <if test="dirRole != null">DIR_ROLE = #{dirRole},</if>
  107. <if test="dirName != null">DIR_NAME = #{dirName},</if>
  108. <if test="parentId != null">PARENT_ID = #{parentId},</if>
  109. <if test="dirPath != null">DIR_PATH = #{dirPath},</if>
  110. <if test="isEncrypt != null">IS_ENCRYPT = #{isEncrypt},</if>
  111. <if test="encryptLevel != null">ENCRYPT_LEVEL = #{encryptLevel},</if>
  112. <if test="createBy != null">CREATE_BY = #{createBy},</if>
  113. <if test="createTime != null">CREATE_TIME = #{createTime},</if>
  114. <if test="updateBy != null">UPDATE_BY = #{updateBy},</if>
  115. <if test="updateTime != null">UPDATE_TIME = #{updateTime},</if>
  116. <if test="remark != null">REMARK = #{remark},</if>
  117. </trim>
  118. where DIR_ID = #{dirId}
  119. </update>
  120. <delete id="deleteDocDirByDirId" parameterType="Long">
  121. delete
  122. from doc_dir
  123. where DIR_ID = #{dirId}
  124. </delete>
  125. <delete id="deleteDocDirByDirIds" parameterType="String">
  126. delete from doc_dir where DIR_ID in
  127. <foreach item="dirId" collection="array" open="(" separator="," close=")">
  128. #{dirId}
  129. </foreach>
  130. </delete>
  131. </mapper>