EduColumnMapper.xml 3.0 KB

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