FileManageMapper.xml 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  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.simuwang.base.mapper.daq.FileManageMapper">
  4. <resultMap id="BaseResultMap" type="com.simuwang.base.pojo.dos.FileManageDO">
  5. <id column="id" property="id"/>
  6. <result column="file_id" property="fileId"/>
  7. <result column="file_path" property="filePath"/>
  8. <result column="file_name" property="fileName"/>
  9. <result column="fund_id" property="fundId"/>
  10. <result column="fund_name" property="fundName"/>
  11. <result column="register_number" property="registerNumber"/>
  12. <result column="company_id" property="companyId"/>
  13. <result column="company_name" property="companyName"/>
  14. <result column="file_date" property="fileDate"/>
  15. <result column="file_type" property="fileType"/>
  16. <result column="source_type" property="sourceType"/>
  17. <result column="isvalid" property="isvalid"/>
  18. <result column="creatorid" property="creatorId"/>
  19. <result column="createtime" property="createTime"/>
  20. <result column="updaterid" property="updaterId"/>
  21. <result column="updatetime" property="updateTime"/>
  22. </resultMap>
  23. <insert id="saveFileManage" parameterType="com.simuwang.base.pojo.dos.FileManageDO">
  24. insert into file_manage(source_type,file_id,file_path,file_name,fund_id,fund_name,register_number,file_date,file_type,isvalid,creatorid,updaterid,createtime,updatetime)
  25. values (#{sourceType},#{fileId},#{filePath},#{fileName},#{fundId},#{fundName},#{registerNumber},#{fileDate},#{fileType},#{isvalid},#{creatorId},#{updaterId},#{createTime},#{updateTime})
  26. </insert>
  27. <update id="updateFileManage" parameterType="com.simuwang.base.pojo.dos.FileManageDO">
  28. update file_manage set
  29. file_path=#{filePath},file_name=#{fileName},fund_id=#{fundId},fund_name=#{fundName},register_number=#{registerNumber},file_type=#{fileType},updatetime=#{updateTime},source_type=#{sourceType}
  30. where isvalid=1 and file_id=#{fileId}
  31. </update>
  32. <update id="changeFileSourceType">
  33. update file_manage set file_type=#{fileType},updaterid=#{userId},updatetime=now() where isvalid =1 and file_id in
  34. <foreach collection="idList" index="index" item="id" separator="," open="(" close=")">
  35. #{id}
  36. </foreach>
  37. </update>
  38. <select id="getFileInfoByFileId" resultMap="BaseResultMap"
  39. parameterType="java.lang.Long">
  40. select id,file_id,file_path,file_name,fund_id,fund_name,register_number,file_date,file_type,source_type,isvalid,creatorid,updaterid,createtime,updatetime
  41. from file_manage where isvalid=1 and file_id=#{fileId}
  42. </select>
  43. <select id="searchFileManage" resultMap="BaseResultMap"
  44. parameterType="com.simuwang.base.pojo.dto.query.FileManagePageQuery">
  45. select f.id,f.file_id,f.file_path,f.file_name,f.fund_id,f.fund_name,f.register_number,f.file_date,f.file_type,f.source_type,
  46. f.isvalid,f.creatorid,f.updaterid,f.createtime,f.updatetime,c.company_id,c.company_name
  47. from file_manage f
  48. left join pvn_fund_info fi on fi.fund_id = f.fund_id and fi.isvalid=1
  49. left join pvn_company_info c on fi.trust_id=c.company_id and c.isvalid=1
  50. where f.isvalid=1
  51. <if test="fundId != null and fundId != ''">
  52. and f.fund_id like concat('%',#{fundId},'%')
  53. </if>
  54. <if test="fundName != null and fundName != ''">
  55. and (f.fund_name like concat('%',#{fundName},'%') or f.register_number like concat('%',#{fundName},'%'))
  56. </if>
  57. <if test="companyName != null and companyName != ''">
  58. and (c.company_name like concat('%',#{companyName},'%') or c.register_number like concat('%',#{companyName},'%'))
  59. </if>
  60. <if test="fileType != null and fileType != ''">
  61. and f.file_type=#{fileType}
  62. </if>
  63. <if test="fileName != null and fileName != ''">
  64. and f.file_name=#{fileName}
  65. </if>
  66. <if test="startDate != null and startDate != ''">
  67. and f.file_date <![CDATA[ >= ]]> #{startDate}
  68. </if>
  69. <if test="endDate != null and endDate != ''">
  70. and f.file_date <![CDATA[ <= ]]> #{endDate}
  71. </if>
  72. order by f.file_date desc
  73. limit #{offset},#{pageSize}
  74. </select>
  75. <select id="countFileManage" resultType="java.lang.Long"
  76. parameterType="com.simuwang.base.pojo.dto.query.FileManagePageQuery">
  77. select count(f.id)
  78. from file_manage f
  79. left join pvn_fund_info fi on fi.fund_id = f.fund_id and fi.isvalid=1
  80. left join pvn_company_info c on fi.trust_id=c.company_id and c.isvalid=1
  81. where f.isvalid=1
  82. <if test="fundId != null and fundId != ''">
  83. and f.fund_id like concat('%',#{fundId},'%')
  84. </if>
  85. <if test="fundName != null and fundName != ''">
  86. and (f.fund_name like concat('%',#{fundName},'%') or f.register_number like concat('%',#{fundName},'%'))
  87. </if>
  88. <if test="companyName != null and companyName != ''">
  89. and (c.company_name like concat('%',#{companyName},'%') or c.register_number like concat('%',#{companyName},'%'))
  90. </if>
  91. <if test="fileType != null and fileType != ''">
  92. and f.file_type=#{fileType}
  93. </if>
  94. <if test="fileName != null and fileName != ''">
  95. and f.file_name=#{fileName}
  96. </if>
  97. <if test="startDate != null and startDate != ''">
  98. and f.file_date <![CDATA[ >= ]]> #{startDate}
  99. </if>
  100. <if test="endDate != null and endDate != ''">
  101. and f.file_date <![CDATA[ <= ]]> #{endDate}
  102. </if>
  103. </select>
  104. </mapper>