BdglFileInfoMapper.xml 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  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.supervision.regulations.mapper.BdglFileInfoMapper">
  6. <resultMap type="BdglFileInfo" id="BdglFileInfoResult">
  7. <result property="id" column="id" />
  8. <result property="fileName" column="file_name" />
  9. <result property="readVolume" column="read_volume" />
  10. <result property="theNumberPages" column="the_number_pages" />
  11. <result property="createUser" column="create_user" />
  12. <result property="createUserid" column="create_userid" />
  13. <result property="createTime" column="create_time" />
  14. <result property="directoryId" column="directory_id" />
  15. <result property="directoryName" column="directory_name" />
  16. <result property="parentDirId" column="parent_dir_id" />
  17. <result property="parentDirName" column="parent_dir_name" />
  18. <result property="fileSize" column="file_size" />
  19. </resultMap>
  20. <sql id="selectBdglFileInfoVo">
  21. select id, file_name, read_volume, the_number_pages, create_user, create_userid, create_time, directory_id, directory_name, parent_dir_id, parent_dir_name, file_size from bdgl_file_info
  22. </sql>
  23. <select id="selectBdglFileInfoList" parameterType="BdglFileInfo" resultMap="BdglFileInfoResult">
  24. <include refid="selectBdglFileInfoVo"/>
  25. <where>
  26. <if test="fileName != null and fileName != ''"> and file_name like concat('%', #{fileName}, '%')</if>
  27. <if test="readVolume != null "> and read_volume = #{readVolume}</if>
  28. <if test="theNumberPages != null "> and the_number_pages = #{theNumberPages}</if>
  29. <if test="createUser != null and createUser != ''"> and create_user = #{createUser}</if>
  30. <if test="createUserid != null "> and create_userid = #{createUserid}</if>
  31. <if test="directoryId != null "> and directory_id = #{directoryId}</if>
  32. <if test="directoryName != null and directoryName != ''"> and directory_name like concat('%', #{directoryName}, '%')</if>
  33. <if test="parentDirId != null "> and parent_dir_id = #{parentDirId}</if>
  34. <if test="parentDirName != null and parentDirName != ''"> and parent_dir_name like concat('%', #{parentDirName}, '%')</if>
  35. <if test="fileSize != null "> and file_size = #{fileSize}</if>
  36. </where>
  37. ORDER BY id DESC
  38. </select>
  39. <select id="selectParentIdfile" parameterType="BdglFileInfo" resultMap="BdglFileInfoResult">
  40. SELECT m.id as pid,l.id,l.directory_id,l.file_name,l.parent_dir_id,l.parent_dir_name,m.parent_id,l.the_number_pages,l.create_user,l.read_volume,l.create_time from bdgl_rule_directory m,bdgl_file_info l
  41. <where>
  42. l.directory_id=m.id
  43. and m.parent_id = #{parentid}
  44. </where>
  45. ORDER BY
  46. l.id DESC
  47. </select>
  48. <select id="selectBdglFileInfoById" parameterType="Long" resultMap="BdglFileInfoResult">
  49. <include refid="selectBdglFileInfoVo"/>
  50. where id = #{id}
  51. </select>
  52. <select id="selectResdNumber" resultType="java.util.Map">
  53. SELECT
  54. read_number readnumber1,
  55. document_category documentCategory,
  56. directory_id
  57. FROM
  58. bdgl_file_resd
  59. WHERE
  60. MONTH = #{s}
  61. ORDER BY
  62. read_number DESC
  63. </select>
  64. <insert id="insertBdglFileInfo" parameterType="BdglFileInfo">
  65. insert into bdgl_file_info
  66. <trim prefix="(" suffix=")" suffixOverrides=",">
  67. <if test="id != null">id,</if>
  68. <if test="fileName != null">file_name,</if>
  69. <if test="readVolume != null">read_volume,</if>
  70. <if test="theNumberPages != null">the_number_pages,</if>
  71. <if test="createUser != null">create_user,</if>
  72. <if test="createUserid != null">create_userid,</if>
  73. <if test="createTime != null">create_time,</if>
  74. <if test="directoryId != null">directory_id,</if>
  75. <if test="directoryName != null">directory_name,</if>
  76. <if test="parentDirId != null">parent_dir_id,</if>
  77. <if test="parentDirName != null">parent_dir_name,</if>
  78. <if test="fileSize != null">file_size,</if>
  79. </trim>
  80. <trim prefix="values (" suffix=")" suffixOverrides=",">
  81. <if test="id != null">#{id},</if>
  82. <if test="fileName != null">#{fileName},</if>
  83. <if test="readVolume != null">#{readVolume},</if>
  84. <if test="theNumberPages != null">#{theNumberPages},</if>
  85. <if test="createUser != null">#{createUser},</if>
  86. <if test="createUserid != null">#{createUserid},</if>
  87. <if test="createTime != null">#{createTime},</if>
  88. <if test="directoryId != null">#{directoryId},</if>
  89. <if test="directoryName != null">#{directoryName},</if>
  90. <if test="parentDirId != null">#{parentDirId},</if>
  91. <if test="parentDirName != null">#{parentDirName},</if>
  92. <if test="fileSize != null">#{fileSize},</if>
  93. </trim>
  94. </insert>
  95. <update id="updateBdglFileInfo" parameterType="BdglFileInfo">
  96. update bdgl_file_info
  97. <trim prefix="SET" suffixOverrides=",">
  98. <if test="fileName != null">file_name = #{fileName},</if>
  99. <if test="readVolume != null">read_volume = #{readVolume},</if>
  100. <if test="theNumberPages != null">the_number_pages = #{theNumberPages},</if>
  101. <if test="createUser != null">create_user = #{createUser},</if>
  102. <if test="createUserid != null">create_userid = #{createUserid},</if>
  103. <if test="createTime != null">create_time = #{createTime},</if>
  104. <if test="directoryId != null">directory_id = #{directoryId},</if>
  105. <if test="directoryName != null">directory_name = #{directoryName},</if>
  106. <if test="parentDirId != null">parent_dir_id = #{parentDirId},</if>
  107. <if test="parentDirName != null">parent_dir_name = #{parentDirName},</if>
  108. <if test="fileSize != null">file_size = #{fileSize},</if>
  109. </trim>
  110. where id = #{id}
  111. </update>
  112. <delete id="deleteBdglFileInfoById" parameterType="Long">
  113. delete from bdgl_file_info where id = #{id}
  114. </delete>
  115. <delete id="deleteBdglFileInfoByIds" parameterType="String">
  116. delete from bdgl_file_info where id in
  117. <foreach item="id" collection="array" open="(" separator="," close=")">
  118. #{id}
  119. </foreach>
  120. </delete>
  121. </mapper>