TestContinentMapper.xml 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  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.test.grid.mapper.TestContinentMapper">
  4. <sql id="testContinentColumns">
  5. a.id AS "id",
  6. a.name AS "name",
  7. a.create_by AS "createBy.id",
  8. a.create_date AS "createDate",
  9. a.update_by AS "updateBy.id",
  10. a.update_date AS "updateDate",
  11. a.remarks AS "remarks",
  12. a.del_flag AS "delFlag"
  13. </sql>
  14. <sql id="testContinentJoins">
  15. </sql>
  16. <select id="get" resultType="TestContinent" >
  17. SELECT
  18. <include refid="testContinentColumns"/>
  19. FROM test_continent a
  20. <include refid="testContinentJoins"/>
  21. WHERE a.id = #{id}
  22. </select>
  23. <select id="findList" resultType="TestContinent" >
  24. SELECT
  25. <include refid="testContinentColumns"/>
  26. FROM test_continent a
  27. <include refid="testContinentJoins"/>
  28. <where>
  29. a.del_flag = #{DEL_FLAG_NORMAL}
  30. ${dataScope}
  31. <if test="name != null and name != ''">
  32. AND a.name LIKE
  33. <if test="dbName == 'oracle'">'%'||#{name}||'%'</if>
  34. <if test="dbName == 'mssql'">'%'+#{name}+'%'</if>
  35. <if test="dbName == 'mysql'">concat('%',#{name},'%')</if>
  36. </if>
  37. </where>
  38. <choose>
  39. <when test="page !=null and page.orderBy != null and page.orderBy != ''">
  40. ORDER BY ${page.orderBy}
  41. </when>
  42. <otherwise>
  43. ORDER BY a.update_date DESC
  44. </otherwise>
  45. </choose>
  46. </select>
  47. <select id="findAllList" resultType="TestContinent" >
  48. SELECT
  49. <include refid="testContinentColumns"/>
  50. FROM test_continent a
  51. <include refid="testContinentJoins"/>
  52. <where>
  53. a.del_flag = #{DEL_FLAG_NORMAL}
  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. ORDER BY a.update_date DESC
  62. </otherwise>
  63. </choose>
  64. </select>
  65. <insert id="insert">
  66. INSERT INTO test_continent(
  67. id,
  68. name,
  69. create_by,
  70. create_date,
  71. update_by,
  72. update_date,
  73. remarks,
  74. del_flag
  75. ) VALUES (
  76. #{id},
  77. #{name},
  78. #{createBy.id},
  79. #{createDate},
  80. #{updateBy.id},
  81. #{updateDate},
  82. #{remarks},
  83. #{delFlag}
  84. )
  85. </insert>
  86. <update id="update">
  87. UPDATE test_continent SET
  88. name = #{name},
  89. update_by = #{updateBy.id},
  90. update_date = #{updateDate},
  91. remarks = #{remarks}
  92. WHERE id = #{id}
  93. </update>
  94. <!--物理删除-->
  95. <update id="delete">
  96. DELETE FROM test_continent
  97. WHERE id = #{id}
  98. </update>
  99. <!--逻辑删除-->
  100. <update id="deleteByLogic">
  101. UPDATE test_continent SET
  102. del_flag = #{DEL_FLAG_DELETE}
  103. WHERE id = #{id}
  104. </update>
  105. <!-- 根据实体名称和字段名称和字段值获取唯一记录 -->
  106. <select id="findUniqueByProperty" resultType="TestContinent" statementType="STATEMENT">
  107. select * FROM test_continent where ${propertyName} = '${value}'
  108. </select>
  109. </mapper>