TestPieClassMapper.xml 2.7 KB

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