ResourcelibraryMapper.xml 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  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="cn.ubitech.ttc.dao.ResourcelibraryMapper">
  4. <!-- 开启二级缓存 -->
  5. <cache type="org.mybatis.caches.ehcache.EhcacheCache">
  6. <property name="timeToIdleSeconds" value="3600"/>
  7. <property name="timeToLiveSeconds" value="3600"/>
  8. <property name="maxEntriesLocalHeap" value="1000"/>
  9. <property name="maxEntriesLocalDisk" value="10000000"/>
  10. <property name="memoryStoreEvictionPolicy" value="LRU"/>
  11. </cache>
  12. <select id="getResourceLibrary" resultType="cn.ubitech.ttc.entity.Resourcelibrary">
  13. select r.* from resourcelibrary r
  14. </select>
  15. <select id="getMyCollectResourceLibrary" resultType="cn.ubitech.ttc.entity.Resourcelibrary">
  16. SELECT r.*
  17. FROM click_record cr, resourcelibrary r
  18. WHERE
  19. cr.moduleid = #{moduleid} AND cr.clicktype = #{clicktype} AND r.id = cr.targetid AND cr.userid = #{userid}
  20. AND r.restype = #{restype} AND r.title like #{keyword} order by cr.createtime desc
  21. </select>
  22. <select id="getMyCollectResourceLibraryCount" resultType="java.lang.Integer">
  23. select count(*)
  24. from (SELECT r.*
  25. FROM click_record cr, resourcelibrary r
  26. WHERE
  27. cr.moduleid = #{moduleid} AND cr.clicktype = #{clicktype} AND r.id = cr.targetid AND
  28. cr.userid = #{userid}
  29. AND r.restype = #{restype} AND r.title like #{keyword}) a
  30. </select>
  31. <select id="getResourceLibraryByConnId" resultType="cn.ubitech.ttc.entity.Resourcelibrary">
  32. select l.*
  33. from resourcelibrary l inner join res_dt_lk r
  34. on l.id = r.resid
  35. where r.resid != 0
  36. <if test="resConnId != null and resConnId != '' and resConnId != 'null' ">
  37. and r.connid = ${resConnId}
  38. </if>
  39. </select>
  40. <select id="getDistinctRestype" resultType="java.lang.Integer">
  41. select distinct restype from resourcelibrary
  42. </select>
  43. <select id="getResourceByTitle" resultType="cn.ubitech.ttc.entity.Resourcelibrary">
  44. select * from resourcelibrary
  45. where title = #{title}
  46. and oid = #{oid}
  47. </select>
  48. <select id="getHaveIntellectureNum" resultType="java.lang.Integer">
  49. select count(*)
  50. from resourcelibrary
  51. where comefrom = #{node}
  52. and restype = 6
  53. and (patentcount > 0
  54. or patentforutilitycount > 0
  55. or patentfordesigncount > 0
  56. or patentforsoftwarecount > 0)
  57. </select>
  58. <select id="getHaveDemandOrgList" resultType="java.lang.Long">
  59. select DISTINCT oid
  60. from resourcelibrary
  61. where restype = #{restype}
  62. and comefrom = #{node}
  63. and oid != 0
  64. </select>
  65. <select id="getOrgList" resultType="java.lang.Long">
  66. select DISTINCT oid
  67. from resourcelibrary
  68. where comefrom = #{node}
  69. and oid != 0
  70. </select>
  71. </mapper>