NodeMapper.xml 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  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.NodeMapper">
  4. <!-- 开启二级缓存 -->
  5. <cache type="org.mybatis.caches.ehcache.EhcacheCache">
  6. <property name="timeToIdleSeconds" value="1200"/>
  7. <property name="timeToLiveSeconds" value="1800"/>
  8. <property name="maxEntriesLocalHeap" value="1000"/>
  9. <property name="maxEntriesLocalDisk" value="10000000"/>
  10. <property name="memoryStoreEvictionPolicy" value="LRU"/>
  11. </cache>
  12. <select id="getByKeyword" resultType="cn.ubitech.ttc.entity.Node">
  13. SELECT
  14. n.*,
  15. CASE WHEN un.id IS NULL THEN 0 ELSE 1 END isusersnode,
  16. IFNULL(un.id, 0) lkid
  17. FROM node n
  18. LEFT JOIN sys_users_nodes un
  19. ON n.id = un.node
  20. AND un.userId = #{userid}
  21. AND un.IsEnabled = 1
  22. WHERE name LIKE #{keyword}
  23. AND issearch = 1
  24. </select>
  25. <select id="getAllNode" resultType="cn.ubitech.ttc.entity.Node">
  26. SELECT n.*, IFNULL(oi.orgtype,0) orgtype FROM node n LEFT JOIN organization_info oi on n.orgid = oi.id
  27. </select>
  28. <insert id="insertHasId" parameterType="cn.ubitech.ttc.entity.Node">
  29. insert into node ( id ,regionid ,orgid,ipaddress,name <include refid="getField" /> )
  30. values (#{id} ,#{regionid} ,#{orgid},#{ipaddress},#{name} <include refid="fieldValue" /> )
  31. </insert>
  32. <sql id="getField">
  33. <trim prefix="," suffixOverrides=",">
  34. <if test="messageport !=null">
  35. messageport,
  36. </if>
  37. <if test="domain !=null">
  38. domain,
  39. </if>
  40. <if test="province !=null">
  41. province,
  42. </if>
  43. <if test="district !=null">
  44. district,
  45. </if>
  46. <if test="city !=null">
  47. city,
  48. </if>
  49. <if test="street !=null">
  50. street,
  51. </if>
  52. <if test="remark !=null">
  53. remark,
  54. </if>
  55. <if test="version !=null">
  56. version,
  57. </if>
  58. <if test="logo !=null">
  59. logo,
  60. </if>
  61. <if test="issearch !=null">
  62. issearch
  63. </if>
  64. </trim>
  65. </sql>
  66. <sql id="fieldValue">
  67. <trim prefix="," suffixOverrides=",">
  68. <if test="messageport !=null">
  69. #{messageport},
  70. </if>
  71. <if test="domain !=null">
  72. #{domain},
  73. </if>
  74. <if test="province !=null">
  75. #{province},
  76. </if>
  77. <if test="district !=null">
  78. #{district},
  79. </if>
  80. <if test="city !=null">
  81. #{city},
  82. </if>
  83. <if test="street !=null">
  84. #{street},
  85. </if>
  86. <if test="remark !=null">
  87. #{remark},
  88. </if>
  89. <if test="version !=null">
  90. #{version},
  91. </if>
  92. <if test="logo !=null">
  93. #{logo},
  94. </if>
  95. <if test="issearch !=null">
  96. #{issearch}
  97. </if>
  98. </trim>
  99. </sql>
  100. </mapper>