DocShareMapper.xml 6.1 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.jjt.doc.mapper.DocShareMapper">
  6. <resultMap type="DocShare" id="DocShareResult">
  7. <result property="docId" column="DOC_ID"/>
  8. <result property="docYear" column="DOC_YEAR"/>
  9. <result property="isSecret" column="IS_SECRET"/>
  10. <result property="onlyOneTime" column="ONLY_ONE_TIME"/>
  11. <result property="createBy" column="CREATE_BY"/>
  12. <result property="createTime" column="CREATE_TIME"/>
  13. <result property="updateBy" column="UPDATE_BY"/>
  14. <result property="updateTime" column="UPDATE_TIME"/>
  15. <result property="remark" column="REMARK"/>
  16. <result property="isDel" column="IS_DEL"/>
  17. </resultMap>
  18. <sql id="selectDocShareVo">
  19. select DOC_ID,
  20. DOC_YEAR,
  21. IS_SECRET,
  22. ONLY_ONE_TIME,
  23. CREATE_BY,
  24. CREATE_TIME,
  25. UPDATE_BY,
  26. UPDATE_TIME,
  27. REMARK,
  28. IS_DEL
  29. from doc_share
  30. </sql>
  31. <select id="selectDocShareList" parameterType="DocShare" resultMap="DocShareResult">
  32. <include refid="selectDocShareVo"/>
  33. <where>
  34. <if test="docId != null ">and DOC_ID = #{docId}</if>
  35. <if test="docYear != null ">and DOC_YEAR = #{docYear}</if>
  36. <if test="isSecret != null and isSecret != ''">and IS_SECRET = #{isSecret}</if>
  37. <if test="onlyOneTime != null and onlyOneTime != ''">and ONLY_ONE_TIME = #{onlyOneTime}</if>
  38. <if test="createBy != null and createBy != ''">and CREATE_BY = #{createBy}</if>
  39. <if test="createTime != null ">and CREATE_TIME = #{createTime}</if>
  40. <if test="updateBy != null and updateBy != ''">and UPDATE_BY = #{updateBy}</if>
  41. <if test="updateTime != null ">and UPDATE_TIME = #{updateTime}</if>
  42. <if test="remark != null and remark != ''">and REMARK = #{remark}</if>
  43. <if test="isDel != null and isDel != ''">and IS_DEL = #{isDel}</if>
  44. </where>
  45. </select>
  46. <select id="selectDocShareByDocId" parameterType="Long" resultMap="DocShareResult">
  47. <include refid="selectDocShareVo"/>
  48. where DOC_ID = #{docId}
  49. </select>
  50. <select id="selectDocShareSend" resultType="com.jjt.doc.domain.DocShare">
  51. select a.*, b.doc_name, b.doc_type, b.doc_path
  52. from doc_share a,
  53. doc_info b
  54. where a.doc_id = b.doc_id
  55. and a.CREATE_BY = #{uid}
  56. order by a.update_time desc
  57. </select>
  58. <select id="selectDocShareReceive" parameterType="DocShare" resultType="com.jjt.doc.domain.DocShare">
  59. select a.*, b.doc_name, b.doc_type, b.doc_path, b.create_by user
  60. from (select t.*
  61. from doc_share t,
  62. doc_share_accepter t1
  63. where t.doc_id = t1.doc_id
  64. and t1.user_id = #{searchValue}) a,
  65. doc_info b
  66. <where>
  67. a.doc_id = b.doc_id
  68. <if test="docName != null and docName != ''">and DOC_NAME like concat('%', #{docName}, '%')</if>
  69. <if test="docType != null and docType != ''">and DOC_TYPE = #{docType}</if>
  70. <if test="createBy != null ">and CREATE_BY = #{createBy}</if>
  71. <if test="params.tagId!=null and params.tagId!=''">and b.doc_id in(select doc_id from DOC_TAG_RELA where
  72. tag_id=#{params.tagId})
  73. </if>
  74. </where>
  75. order by a.update_time desc
  76. </select>
  77. <insert id="insertDocShare" parameterType="DocShare">
  78. insert into doc_share
  79. <trim prefix="(" suffix=")" suffixOverrides=",">
  80. <if test="docId != null">DOC_ID,</if>
  81. <if test="docYear != null">DOC_YEAR,</if>
  82. <if test="isSecret != null">IS_SECRET,</if>
  83. <if test="onlyOneTime != null">ONLY_ONE_TIME,</if>
  84. <if test="createBy != null">CREATE_BY,</if>
  85. <if test="createTime != null">CREATE_TIME,</if>
  86. <if test="updateBy != null">UPDATE_BY,</if>
  87. <if test="updateTime != null">UPDATE_TIME,</if>
  88. <if test="remark != null">REMARK,</if>
  89. <if test="isDel != null">IS_DEL,</if>
  90. </trim>
  91. <trim prefix="values (" suffix=")" suffixOverrides=",">
  92. <if test="docId != null">#{docId},</if>
  93. <if test="docYear != null">#{docYear},</if>
  94. <if test="isSecret != null">#{isSecret},</if>
  95. <if test="onlyOneTime != null">#{onlyOneTime},</if>
  96. <if test="createBy != null">#{createBy},</if>
  97. <if test="createTime != null">#{createTime},</if>
  98. <if test="updateBy != null">#{updateBy},</if>
  99. <if test="updateTime != null">#{updateTime},</if>
  100. <if test="remark != null">#{remark},</if>
  101. <if test="isDel != null">#{isDel},</if>
  102. </trim>
  103. </insert>
  104. <update id="updateDocShare" parameterType="DocShare">
  105. update doc_share
  106. <trim prefix="SET" suffixOverrides=",">
  107. <if test="docYear != null">DOC_YEAR = #{docYear},</if>
  108. <if test="isSecret != null">IS_SECRET = #{isSecret},</if>
  109. <if test="onlyOneTime != null">ONLY_ONE_TIME = #{onlyOneTime},</if>
  110. <if test="createBy != null">CREATE_BY = #{createBy},</if>
  111. <if test="createTime != null">CREATE_TIME = #{createTime},</if>
  112. <if test="updateBy != null">UPDATE_BY = #{updateBy},</if>
  113. <if test="updateTime != null">UPDATE_TIME = #{updateTime},</if>
  114. <if test="remark != null">REMARK = #{remark},</if>
  115. <if test="isDel != null">IS_DEL = #{isDel},</if>
  116. </trim>
  117. where DOC_ID = #{docId}
  118. </update>
  119. <delete id="deleteDocShareByDocId" parameterType="Long">
  120. delete
  121. from doc_share
  122. where DOC_ID = #{docId}
  123. </delete>
  124. <delete id="deleteDocShareByDocIds" parameterType="String">
  125. delete from doc_share where DOC_ID in
  126. <foreach item="docId" collection="array" open="(" separator="," close=")">
  127. #{docId}
  128. </foreach>
  129. </delete>
  130. </mapper>