SysDataSourceMapper.xml 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  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.jeeplus.modules.tools.mapper.SysDataSourceMapper">
  4. <sql id="sysDataSourceColumns">
  5. a.id AS "id",
  6. a.name AS "name",
  7. a.enname AS "enname",
  8. a.db_username AS "dbUserName",
  9. a.db_password AS "dbPassword",
  10. a.db_url AS "dbUrl",
  11. a.db_driver AS "dbDriver"
  12. </sql>
  13. <sql id="sysDataSourceJoins">
  14. </sql>
  15. <select id="get" resultType="SysDataSource" >
  16. SELECT
  17. <include refid="sysDataSourceColumns"/>
  18. FROM sys_datasource a
  19. <include refid="sysDataSourceJoins"/>
  20. WHERE a.id = #{id}
  21. </select>
  22. <select id="getByEnname" resultType="SysDataSource" >
  23. SELECT
  24. <include refid="sysDataSourceColumns"/>
  25. FROM sys_datasource a
  26. <include refid="sysDataSourceJoins"/>
  27. WHERE a.enname = #{enname}
  28. </select>
  29. <select id="findList" resultType="SysDataSource" >
  30. SELECT
  31. <include refid="sysDataSourceColumns"/>
  32. FROM sys_datasource a
  33. <include refid="sysDataSourceJoins"/>
  34. <where>
  35. ${dataScope}
  36. <if test="name != null and name != ''">
  37. AND a.name = #{name}
  38. </if>
  39. </where>
  40. <choose>
  41. <when test="page !=null and page.orderBy != null and page.orderBy != ''">
  42. ORDER BY ${page.orderBy}
  43. </when>
  44. <otherwise>
  45. </otherwise>
  46. </choose>
  47. </select>
  48. <select id="findAllList" resultType="SysDataSource" >
  49. SELECT
  50. <include refid="sysDataSourceColumns"/>
  51. FROM sys_datasource a
  52. <include refid="sysDataSourceJoins"/>
  53. <where>
  54. ${dataScope}
  55. </where>
  56. <choose>
  57. <when test="page !=null and page.orderBy != null and page.orderBy != ''">
  58. ORDER BY ${page.orderBy}
  59. </when>
  60. <otherwise>
  61. </otherwise>
  62. </choose>
  63. </select>
  64. <insert id="insert">
  65. INSERT INTO sys_datasource(
  66. id,
  67. name,
  68. enname,
  69. db_username,
  70. db_password,
  71. db_url,
  72. db_driver
  73. ) VALUES (
  74. #{id},
  75. #{name},
  76. #{enname},
  77. #{dbUserName},
  78. #{dbPassword},
  79. #{dbUrl},
  80. #{dbDriver}
  81. )
  82. </insert>
  83. <update id="update">
  84. UPDATE sys_datasource SET
  85. name = #{name},
  86. enname = #{enname},
  87. db_username = #{dbUserName},
  88. db_password = #{dbPassword},
  89. db_url = #{dbUrl},
  90. db_driver = #{dbDriver}
  91. WHERE id = #{id}
  92. </update>
  93. <!--物理删除-->
  94. <update id="delete">
  95. DELETE FROM sys_datasource
  96. WHERE id = #{id}
  97. </update>
  98. <!--逻辑删除-->
  99. <update id="deleteByLogic">
  100. UPDATE sys_datasource SET
  101. del_flag = #{DEL_FLAG_DELETE}
  102. WHERE id = #{id}
  103. </update>
  104. <!-- 根据实体名称和字段名称和字段值获取唯一记录 -->
  105. <select id="findUniqueByProperty" resultType="SysDataSource" statementType="STATEMENT">
  106. select * FROM sys_datasource where ${propertyName} = '${value}'
  107. </select>
  108. </mapper>