UserConfigMapper.xml 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  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.tuoren.forward.mapper.UserConfigMapper">
  4. <resultMap id="BaseResultMap" type="com.tuoren.forward.entity.UserConfig">
  5. <id column="id" jdbcType="VARCHAR" property="id"/>
  6. <result column="wifi" jdbcType="VARCHAR" property="wifi"/>
  7. <result column="address" jdbcType="VARCHAR" property="address"/>
  8. <result column="device_secret" jdbcType="VARCHAR" property="deviceSecret"/>
  9. <result column="createtime" jdbcType="TIMESTAMP" property="createtime"/>
  10. <result column="modifytime" jdbcType="TIMESTAMP" property="modifytime"/>
  11. </resultMap>
  12. <sql id="Base_Column_List">
  13. id, wifi, address,device_secret, createtime, modifytime
  14. </sql>
  15. <select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
  16. select
  17. <include refid="Base_Column_List"/>
  18. from user_config
  19. where id = #{id,jdbcType=VARCHAR}
  20. </select>
  21. <delete id="deleteByPrimaryKey" parameterType="java.lang.String">
  22. delete
  23. from user_config
  24. where id = #{id,jdbcType=VARCHAR}
  25. </delete>
  26. <insert id="insert" parameterType="com.tuoren.forward.entity.UserConfig">
  27. insert into user_config (id, wifi, address, device_secret, createtime, modifytime)
  28. values (#{id,jdbcType=VARCHAR},
  29. #{wifi,jdbcType=VARCHAR},
  30. #{address,jdbcType=VARCHAR},
  31. #{deviceSecret,jdbcType=VARCHAR},
  32. #{createtime,jdbcType=TIMESTAMP},
  33. #{modifytime,jdbcType=TIMESTAMP})
  34. </insert>
  35. <insert id="insertSelective" parameterType="com.tuoren.forward.entity.UserConfig">
  36. insert into user_config
  37. <trim prefix="(" suffix=")" suffixOverrides=",">
  38. <if test="id != null">
  39. id,
  40. </if>
  41. <if test="wifi != null">
  42. wifi,
  43. </if>
  44. <if test="address != null">
  45. address,
  46. </if>
  47. <if test="deviceSecret != null">
  48. device_secret,
  49. </if>
  50. <if test="createtime != null">
  51. createtime,
  52. </if>
  53. <if test="modifytime != null">
  54. modifytime,
  55. </if>
  56. </trim>
  57. <trim prefix="values (" suffix=")" suffixOverrides=",">
  58. <if test="id != null">
  59. #{id,jdbcType=VARCHAR},
  60. </if>
  61. <if test="wifi != null">
  62. #{wifi,jdbcType=VARCHAR},
  63. </if>
  64. <if test="address != null">
  65. #{address,jdbcType=VARCHAR},
  66. </if>
  67. <if test="deviceSecret != null">
  68. #{deviceSecret,jdbcType=VARCHAR},
  69. </if>
  70. <if test="createtime != null">
  71. #{createtime,jdbcType=TIMESTAMP},
  72. </if>
  73. <if test="modifytime != null">
  74. #{modifytime,jdbcType=TIMESTAMP},
  75. </if>
  76. </trim>
  77. </insert>
  78. <update id="updateByPrimaryKeySelective" parameterType="com.tuoren.forward.entity.UserConfig">
  79. update user_config
  80. <set>
  81. <if test="wifi != null">
  82. wifi = #{wifi,jdbcType=VARCHAR},
  83. </if>
  84. <if test="address != null">
  85. address = #{address,jdbcType=VARCHAR},
  86. </if>
  87. <if test="deviceSecret != null">
  88. device_secret = #{deviceSecret,jdbcType=VARCHAR},
  89. </if>
  90. <if test="createtime != null">
  91. createtime = #{createtime,jdbcType=TIMESTAMP},
  92. </if>
  93. <if test="modifytime != null">
  94. modifytime = #{modifytime,jdbcType=TIMESTAMP},
  95. </if>
  96. </set>
  97. where id = #{id,jdbcType=VARCHAR}
  98. </update>
  99. <update id="updateByPrimaryKey" parameterType="com.tuoren.forward.entity.UserConfig">
  100. update user_config
  101. set wifi = #{wifi,jdbcType=VARCHAR},
  102. address = #{address,jdbcType=VARCHAR},
  103. device_secret = #{deviceSecret,jdbcType=VARCHAR},
  104. createtime = #{createtime,jdbcType=TIMESTAMP},
  105. modifytime = #{modifytime,jdbcType=TIMESTAMP}
  106. where id = #{id,jdbcType=VARCHAR}
  107. </update>
  108. <select id="selectOneOr" resultMap="BaseResultMap">
  109. select
  110. <include refid="Base_Column_List"/>
  111. from user_config
  112. where wifi = #{wifi,jdbcType=VARCHAR} limit 1
  113. </select>
  114. </mapper>