AutoGenRobotMapper.xml 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  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.users.AutoGenRobotMapper" >
  4. <resultMap id="BaseResultMap" type="com.juxiao.xchat.module.xbd.domain.users.AutoGenRobot" >
  5. <id column="nick" property="nick" jdbcType="VARCHAR" />
  6. <result column="avatar" property="avatar" jdbcType="VARCHAR" />
  7. <result column="gender" property="gender" jdbcType="TINYINT" />
  8. <result column="is_used" property="isUsed" jdbcType="TINYINT" />
  9. </resultMap>
  10. <sql id="Base_Column_List" >
  11. nick, avatar, gender, is_used
  12. </sql>
  13. <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.String" >
  14. select
  15. <include refid="Base_Column_List" />
  16. from auto_gen_robot
  17. where nick = #{nick,jdbcType=VARCHAR}
  18. </select>
  19. <delete id="deleteByPrimaryKey" parameterType="java.lang.String" >
  20. delete from auto_gen_robot
  21. where nick = #{nick,jdbcType=VARCHAR}
  22. </delete>
  23. <insert id="insert" parameterType="com.juxiao.xchat.module.xbd.domain.users.AutoGenRobot" >
  24. insert into auto_gen_robot (nick, avatar, gender,
  25. is_used)
  26. values (#{nick,jdbcType=VARCHAR}, #{avatar,jdbcType=VARCHAR}, #{gender,jdbcType=TINYINT},
  27. #{isUsed,jdbcType=TINYINT})
  28. </insert>
  29. <insert id="insertSelective" parameterType="com.juxiao.xchat.module.xbd.domain.users.AutoGenRobot" >
  30. insert into auto_gen_robot
  31. <trim prefix="(" suffix=")" suffixOverrides="," >
  32. <if test="nick != null" >
  33. nick,
  34. </if>
  35. <if test="avatar != null" >
  36. avatar,
  37. </if>
  38. <if test="gender != null" >
  39. gender,
  40. </if>
  41. <if test="isUsed != null" >
  42. is_used,
  43. </if>
  44. </trim>
  45. <trim prefix="values (" suffix=")" suffixOverrides="," >
  46. <if test="nick != null" >
  47. #{nick,jdbcType=VARCHAR},
  48. </if>
  49. <if test="avatar != null" >
  50. #{avatar,jdbcType=VARCHAR},
  51. </if>
  52. <if test="gender != null" >
  53. #{gender,jdbcType=TINYINT},
  54. </if>
  55. <if test="isUsed != null" >
  56. #{isUsed,jdbcType=TINYINT},
  57. </if>
  58. </trim>
  59. </insert>
  60. <update id="updateByPrimaryKeySelective" parameterType="com.juxiao.xchat.module.xbd.domain.users.AutoGenRobot" >
  61. update auto_gen_robot
  62. <set >
  63. <if test="avatar != null" >
  64. avatar = #{avatar,jdbcType=VARCHAR},
  65. </if>
  66. <if test="gender != null" >
  67. gender = #{gender,jdbcType=TINYINT},
  68. </if>
  69. <if test="isUsed != null" >
  70. is_used = #{isUsed,jdbcType=TINYINT},
  71. </if>
  72. </set>
  73. where nick = #{nick,jdbcType=VARCHAR}
  74. </update>
  75. <update id="updateByPrimaryKey" parameterType="com.juxiao.xchat.module.xbd.domain.users.AutoGenRobot" >
  76. update auto_gen_robot
  77. set avatar = #{avatar,jdbcType=VARCHAR},
  78. gender = #{gender,jdbcType=TINYINT},
  79. is_used = #{isUsed,jdbcType=TINYINT}
  80. where nick = #{nick,jdbcType=VARCHAR}
  81. </update>
  82. <select id="selectRobotByList" resultMap="BaseResultMap">
  83. select
  84. <include refid="Base_Column_List" />
  85. from auto_gen_robot
  86. order by is_used desc
  87. </select>
  88. <select id="selectRobotByIsUse" resultMap="BaseResultMap">
  89. select
  90. <include refid="Base_Column_List" />
  91. from auto_gen_robot
  92. where is_used = #{isUse}
  93. </select>
  94. </mapper>