TestValidationMapper.xml 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  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.validation.mapper.TestValidationMapper">
  4. <sql id="testValidationColumns">
  5. a.id AS "id",
  6. a.num AS "num",
  7. a.num2 AS "num2",
  8. a.str AS "str",
  9. a.email AS "email",
  10. a.url AS "url",
  11. a.new_date AS "newDate",
  12. a.remarks AS "remarks",
  13. a.c1 AS "c1",
  14. a.c2 AS "c2",
  15. a.c3 AS "c3",
  16. a.c4 AS "c4",
  17. a.c5 AS "c5",
  18. a.c6 AS "c6",
  19. a.en AS "en",
  20. a.zn AS "zn",
  21. a.enzn AS "enzn"
  22. </sql>
  23. <sql id="testValidationJoins">
  24. </sql>
  25. <select id="get" resultType="TestValidation" >
  26. SELECT
  27. <include refid="testValidationColumns"/>
  28. FROM test_validation a
  29. <include refid="testValidationJoins"/>
  30. WHERE a.id = #{id}
  31. </select>
  32. <select id="findList" resultType="TestValidation" >
  33. SELECT
  34. <include refid="testValidationColumns"/>
  35. FROM test_validation a
  36. <include refid="testValidationJoins"/>
  37. <where>
  38. ${dataScope}
  39. <if test="num != null and num != ''">
  40. AND a.num = #{num}
  41. </if>
  42. <if test="num2 != null and num2 != ''">
  43. AND a.num2 = #{num2}
  44. </if>
  45. </where>
  46. <choose>
  47. <when test="page !=null and page.orderBy != null and page.orderBy != ''">
  48. ORDER BY ${page.orderBy}
  49. </when>
  50. <otherwise>
  51. </otherwise>
  52. </choose>
  53. </select>
  54. <select id="findAllList" resultType="TestValidation" >
  55. SELECT
  56. <include refid="testValidationColumns"/>
  57. FROM test_validation a
  58. <include refid="testValidationJoins"/>
  59. <where>
  60. ${dataScope}
  61. </where>
  62. <choose>
  63. <when test="page !=null and page.orderBy != null and page.orderBy != ''">
  64. ORDER BY ${page.orderBy}
  65. </when>
  66. <otherwise>
  67. </otherwise>
  68. </choose>
  69. </select>
  70. <insert id="insert">
  71. INSERT INTO test_validation(
  72. id,
  73. num,
  74. num2,
  75. str,
  76. email,
  77. url,
  78. new_date,
  79. remarks,
  80. c1,
  81. c2,
  82. c3,
  83. c4,
  84. c5,
  85. c6,
  86. en,
  87. zn,
  88. enzn
  89. ) VALUES (
  90. #{id},
  91. #{num},
  92. #{num2},
  93. #{str},
  94. #{email},
  95. #{url},
  96. #{newDate},
  97. #{remarks},
  98. #{c1},
  99. #{c2},
  100. #{c3},
  101. #{c4},
  102. #{c5},
  103. #{c6},
  104. #{en},
  105. #{zn},
  106. #{enzn}
  107. )
  108. </insert>
  109. <update id="update">
  110. UPDATE test_validation SET
  111. num = #{num},
  112. num2 = #{num2},
  113. str = #{str},
  114. email = #{email},
  115. url = #{url},
  116. new_date = #{newDate},
  117. remarks = #{remarks},
  118. c1 = #{c1},
  119. c2 = #{c2},
  120. c3 = #{c3},
  121. c4 = #{c4},
  122. c5 = #{c5},
  123. c6 = #{c6},
  124. en = #{en},
  125. zn = #{zn},
  126. enzn = #{enzn}
  127. WHERE id = #{id}
  128. </update>
  129. <!--物理删除-->
  130. <update id="delete">
  131. DELETE FROM test_validation
  132. WHERE id = #{id}
  133. </update>
  134. <!--逻辑删除-->
  135. <update id="deleteByLogic">
  136. UPDATE test_validation SET
  137. del_flag = #{DEL_FLAG_DELETE}
  138. WHERE id = #{id}
  139. </update>
  140. <!-- 根据实体名称和字段名称和字段值获取唯一记录 -->
  141. <select id="findUniqueByProperty" resultType="TestValidation" statementType="STATEMENT">
  142. select * FROM test_validation where ${propertyName} = '${value}'
  143. </select>
  144. </mapper>