AppVersionMapper.xml 4.6 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.juxiao.xchat.module.xbd.mapper.system.AppVersionMapper" >
  4. <resultMap id="BaseResultMap" type="com.juxiao.xchat.module.xbd.domain.system.AppVersion" >
  5. <id column="version_id" property="versionId" jdbcType="INTEGER" />
  6. <result column="os" property="os" jdbcType="VARCHAR" />
  7. <result column="version" property="version" jdbcType="VARCHAR" />
  8. <result column="platform" property="platform" jdbcType="VARCHAR" />
  9. <result column="status" property="status" jdbcType="TINYINT" />
  10. <result column="version_desc" property="versionDesc" jdbcType="VARCHAR" />
  11. <result column="publish_time" property="publishTime" jdbcType="TIMESTAMP" />
  12. <result column="create_time" property="createTime" jdbcType="TIMESTAMP" />
  13. <result column="appid" property="appid" jdbcType="VARCHAR" />
  14. <result column="download_url" property="downloadUrl" jdbcType="VARCHAR" />
  15. </resultMap>
  16. <sql id="Base_Column_List" >
  17. version_id, os, version, platform, status, version_desc, publish_time, create_time,appid,download_url
  18. </sql>
  19. <select id="getAppVersionList" resultMap="BaseResultMap">
  20. select
  21. <include refid="Base_Column_List" />
  22. from app_version
  23. where 1 = 1
  24. <if test="os != null and os != ''">
  25. and os = #{os}
  26. </if>
  27. <if test="version != null and version != ''">
  28. and version = #{version}
  29. </if>
  30. order by version desc
  31. </select>
  32. <insert id="insert" parameterType="com.juxiao.xchat.module.xbd.domain.system.AppVersion" useGeneratedKeys="true" keyProperty="version_id" >
  33. insert into app_version
  34. <trim prefix="(" suffix=")" suffixOverrides="," >
  35. <if test="os != null" >
  36. os,
  37. </if>
  38. <if test="version != null" >
  39. version,
  40. </if>
  41. <if test="platform != null" >
  42. platform,
  43. </if>
  44. <if test="status != null" >
  45. status,
  46. </if>
  47. <if test="versionDesc != null" >
  48. version_desc,
  49. </if>
  50. <if test="publishTime != null" >
  51. publish_time,
  52. </if>
  53. <if test="createTime != null" >
  54. create_time,
  55. </if>
  56. <if test="appid != null" >
  57. appid,
  58. </if>
  59. <if test="downloadUrl != null" >
  60. download_url,
  61. </if>
  62. </trim>
  63. <trim prefix="values (" suffix=")" suffixOverrides="," >
  64. <if test="os != null" >
  65. #{os,jdbcType=VARCHAR},
  66. </if>
  67. <if test="version != null" >
  68. #{version,jdbcType=VARCHAR},
  69. </if>
  70. <if test="platform != null" >
  71. #{platform,jdbcType=VARCHAR},
  72. </if>
  73. <if test="status != null" >
  74. #{status,jdbcType=TINYINT},
  75. </if>
  76. <if test="versionDesc != null" >
  77. #{versionDesc,jdbcType=VARCHAR},
  78. </if>
  79. <if test="publishTime != null" >
  80. #{publishTime,jdbcType=TIMESTAMP},
  81. </if>
  82. <if test="createTime != null" >
  83. #{createTime,jdbcType=TIMESTAMP},
  84. </if>
  85. <if test="appid != null" >
  86. #{appid,jdbcType=VARCHAR},
  87. </if>
  88. <if test="downloadUrl != null" >
  89. #{downloadUrl,jdbcType=VARCHAR},
  90. </if>
  91. </trim>
  92. </insert>
  93. <select id="getAppVersionByVersionId" resultMap="BaseResultMap">
  94. select
  95. <include refid="Base_Column_List" />
  96. from app_version
  97. where version_id = #{versionId,jdbcType=INTEGER}
  98. </select>
  99. <update id="updateByVersionId" parameterType="com.juxiao.xchat.module.xbd.domain.system.AppVersion" >
  100. update app_version
  101. set
  102. os = #{os,jdbcType=VARCHAR},
  103. version = #{version,jdbcType=VARCHAR},
  104. platform = #{platform,jdbcType=VARCHAR},
  105. status = #{status,jdbcType=TINYINT},
  106. version_desc = #{versionDesc,jdbcType=VARCHAR},
  107. publish_time = #{publishTime,jdbcType=TIMESTAMP},
  108. appid = #{appid,jdbcType=VARCHAR},
  109. download_url = #{downloadUrl,jdbcType=VARCHAR}
  110. where version_id =#{versionId,jdbcType=INTEGER}
  111. </update>
  112. <delete id="deleteByVersionId" parameterType="java.lang.Integer" >
  113. delete from app_version
  114. where version_id =#{versionId,jdbcType=INTEGER}
  115. </delete>
  116. </mapper>