VideoMapper.xml 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  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.dtb.portal.mapper.VideoMapper">
  4. <select id="page" resultType="com.dtb.portal.entity.Video">
  5. select *
  6. from users where 1=1
  7. <if test="keyWord!=null and keyWord!=''">
  8. and title like CONCAT('%',#{keyWord,jdbcType=VARCHAR},'%')
  9. OR subtitle like CONCAT('%',#{keyWord,jdbcType=VARCHAR},'%')
  10. OR content like CONCAT('%',#{keyWord,jdbcType=VARCHAR},'%')
  11. </if>
  12. order by create_time desc
  13. </select>
  14. <select id="selectOne" resultType="com.dtb.portal.entity.Video">
  15. select *
  16. from t_video_user
  17. where id = #{id,jdbcType=VARCHAR}
  18. </select>
  19. <update id="updateEnable">
  20. update t_video_user
  21. <set>
  22. <if test="title!=null and title!=''">
  23. title=#{title,jdbcType=VARCHAR},
  24. </if>
  25. <if test="subtitle!=null and subtitle!=''">
  26. subtitle=#{subtitle,jdbcType=VARCHAR},
  27. </if>
  28. <if test="num!=null and num!=''">
  29. num=#{num,jdbcType=VARCHAR},
  30. </if>
  31. <if test="video_path!=null and video_path!=''">
  32. video_path=#{video_path,jdbcType=VARCHAR},
  33. </if>
  34. <if test="video_img!=null and video_img!=''">
  35. video_img=#{video_img,jdbcType=VARCHAR},
  36. </if>
  37. <if test="content!=null and content!=''">
  38. content=#{content,jdbcType=VARCHAR},
  39. </if>
  40. <if test="updateTime!=null">
  41. update_time =#{updateTime,jdbcType=TIMESTAMP},
  42. </if>
  43. </set>
  44. where id=#{id,jdbcType=VARCHAR}
  45. </update>
  46. <insert id="save" useGeneratedKeys="true" keyProperty="id">
  47. insert into t_video_user (title, subtitle, num, video_path, video_img, password, content, create_time, update_time)
  48. values (
  49. #{title,jdbcType=VARCHAR},
  50. #{subtitle,jdbcType=VARCHAR},
  51. #{num,jdbcType=VARCHAR},
  52. #{video_path,jdbcType=VARCHAR},
  53. #{nickname,jdbcType=VARCHAR},
  54. #{video_img,jdbcType=VARCHAR},
  55. #{content,jdbcType=VARCHAR},
  56. #{createTime,jdbcType=TIMESTAMP},
  57. #{updateTime,jdbcType=TIMESTAMP})
  58. </insert>
  59. <delete id="delete">
  60. delete
  61. from t_video_user
  62. where id = #{id,jdbcType=VARCHAR}
  63. </delete>
  64. </mapper>