EduVideoNewsMapper.xml 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166
  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.EduVideoNewsMapper">
  4. <sql id="eduVideoNewsColumns">
  5. a.id AS "id",
  6. a.type_id AS "typeId",
  7. a.cover AS "cover",
  8. a.title AS "title",
  9. a.url1 AS "url1",
  10. a.url2 AS "url2",
  11. a.url3 AS "url3",
  12. a.source AS "source",
  13. a.contents AS "contents",
  14. a.create_by AS "createBy.id",
  15. a.create_date AS "createDate",
  16. a.update_by AS "updateBy.id",
  17. a.update_date AS "updateDate",
  18. a.del_flag AS "delFlag",
  19. a.is_top AS "isTop",
  20. a.score AS "score",
  21. a.score_type AS "scoreType"
  22. </sql>
  23. <sql id="eduVideoNewsJoins">
  24. </sql>
  25. <resultMap type="EduVideoNews" id="EduVideoNewsResult" autoMapping="true">
  26. <result column="contents" property="contents" typeHandler="com.jeeplus.core.mapper.ConvertBlobTypeHandler"/>
  27. </resultMap>
  28. <select id="get" resultMap="EduVideoNewsResult" >
  29. SELECT
  30. <include refid="eduVideoNewsColumns"/>
  31. FROM edu_video_news a
  32. <include refid="eduVideoNewsJoins"/>
  33. WHERE a.id = #{id}
  34. </select>
  35. <select id="findList" resultMap="EduVideoNewsResult" >
  36. SELECT
  37. <include refid="eduVideoNewsColumns"/>
  38. FROM edu_video_news a
  39. <include refid="eduVideoNewsJoins"/>
  40. <where>
  41. a.del_flag = #{DEL_FLAG_NORMAL}
  42. ${dataScope}
  43. <if test="title != null and title != ''">
  44. AND a.title LIKE concat('%',#{title},'%')
  45. </if>
  46. <if test="typeId != null and typeId != ''">
  47. AND a.type_id = #{typeId}
  48. </if>
  49. </where>
  50. <choose>
  51. <when test="page !=null and page.orderBy != null and page.orderBy != ''">
  52. ORDER BY ${page.orderBy}
  53. </when>
  54. <when test="orderBy !=null and orderBy != ''">
  55. ORDER BY ${orderBy}
  56. </when>
  57. <otherwise>
  58. ORDER BY a.update_date DESC
  59. </otherwise>
  60. </choose>
  61. </select>
  62. <select id="findAllList" resultMap="EduVideoNewsResult" >
  63. SELECT
  64. <include refid="eduVideoNewsColumns"/>
  65. FROM edu_video_news a
  66. <include refid="eduVideoNewsJoins"/>
  67. <where>
  68. a.del_flag = #{DEL_FLAG_NORMAL}
  69. ${dataScope}
  70. </where>
  71. <choose>
  72. <when test="page !=null and page.orderBy != null and page.orderBy != ''">
  73. ORDER BY ${page.orderBy}
  74. </when>
  75. <otherwise>
  76. ORDER BY a.update_date DESC
  77. </otherwise>
  78. </choose>
  79. </select>
  80. <insert id="insert">
  81. INSERT INTO edu_video_news(
  82. id,
  83. type_id,
  84. cover,
  85. title,
  86. url1,
  87. url2,
  88. url3,
  89. source,
  90. contents,
  91. create_by,
  92. create_date,
  93. update_by,
  94. update_date,
  95. del_flag,
  96. is_top,
  97. score,
  98. score_type
  99. ) VALUES (
  100. #{id},
  101. #{typeId},
  102. #{cover},
  103. #{title},
  104. #{url1},
  105. #{url2},
  106. #{url3},
  107. #{source},
  108. #{contents},
  109. #{createBy.id},
  110. #{createDate},
  111. #{updateBy.id},
  112. #{updateDate},
  113. #{delFlag},
  114. #{isTop},
  115. #{score},
  116. #{scoreType}
  117. )
  118. </insert>
  119. <update id="update">
  120. UPDATE edu_video_news SET
  121. type_id = #{typeId},
  122. cover = #{cover},
  123. title = #{title},
  124. url1 = #{url1},
  125. url2 = #{url2},
  126. url3 = #{url3},
  127. source = #{source},
  128. contents = #{contents},
  129. update_by = #{updateBy.id},
  130. update_date = #{updateDate},
  131. is_top = #{isTop},
  132. score = #{score},
  133. score_type = #{scoreType}
  134. WHERE id = #{id}
  135. </update>
  136. <!--物理删除-->
  137. <update id="delete">
  138. DELETE FROM edu_video_news
  139. WHERE id = #{id}
  140. </update>
  141. <!--逻辑删除-->
  142. <update id="deleteByLogic">
  143. UPDATE edu_video_news SET
  144. del_flag = #{DEL_FLAG_DELETE}
  145. WHERE id = #{id}
  146. </update>
  147. <!-- 根据实体名称和字段名称和字段值获取唯一记录 -->
  148. <select id="findUniqueByProperty" resultType="EduVideoNews" statementType="STATEMENT">
  149. select * FROM edu_video_news where ${propertyName} = '${value}'
  150. </select>
  151. </mapper>