AskaAccountsMapper.xml 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE mapper
  3. PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  4. "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  5. <mapper namespace="com.mofangchuxing.aska.dao.mapper.AskaAccountsMapper">
  6. <resultMap id="BaseResultMap" type="com.mofangchuxing.aska.dao.domain.AskaAccounts">
  7. <id property="id" column="id" jdbcType="INTEGER"/>
  8. <result property="username" column="username" jdbcType="CHAR"/>
  9. <result property="name" column="name" jdbcType="CHAR"/>
  10. <result property="phone" column="phone" jdbcType="CHAR"/>
  11. <result property="pass" column="pass" jdbcType="CHAR"/>
  12. <result property="role" column="role" jdbcType="VARCHAR"/>
  13. <result property="status" column="status" jdbcType="CHAR"/>
  14. </resultMap>
  15. <sql id="Base_Column_List">
  16. id,username,name,
  17. phone,pass,role,
  18. status
  19. </sql>
  20. <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
  21. select
  22. <include refid="Base_Column_List" />
  23. from aska_accounts
  24. where id = #{id,jdbcType=INTEGER}
  25. </select>
  26. <select id="selectByUsername" resultMap="BaseResultMap">
  27. select
  28. <include refid="Base_Column_List" />
  29. from aska_accounts
  30. where username = #{username} limit 1
  31. </select>
  32. <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
  33. delete from aska_accounts
  34. where id = #{id,jdbcType=INTEGER}
  35. </delete>
  36. <insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.mofangchuxing.aska.dao.domain.AskaAccounts" useGeneratedKeys="true">
  37. insert into aska_accounts
  38. ( id,username,name
  39. ,phone,pass,role
  40. ,status)
  41. values (#{id,jdbcType=INTEGER},#{username,jdbcType=CHAR},#{name,jdbcType=CHAR}
  42. ,#{phone,jdbcType=CHAR},#{pass,jdbcType=CHAR},#{role,jdbcType=VARCHAR}
  43. ,#{status,jdbcType=CHAR})
  44. </insert>
  45. <insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.mofangchuxing.aska.dao.domain.AskaAccounts" useGeneratedKeys="true">
  46. insert into aska_accounts
  47. <trim prefix="(" suffix=")" suffixOverrides=",">
  48. <if test="id != null">id,</if>
  49. <if test="username != null">username,</if>
  50. <if test="name != null">name,</if>
  51. <if test="phone != null">phone,</if>
  52. <if test="pass != null">pass,</if>
  53. <if test="role != null">role,</if>
  54. <if test="status != null">status,</if>
  55. </trim>
  56. <trim prefix="values (" suffix=")" suffixOverrides=",">
  57. <if test="id != null">#{id,jdbcType=INTEGER},</if>
  58. <if test="username != null">#{username,jdbcType=CHAR},</if>
  59. <if test="name != null">#{name,jdbcType=CHAR},</if>
  60. <if test="phone != null">#{phone,jdbcType=CHAR},</if>
  61. <if test="pass != null">#{pass,jdbcType=CHAR},</if>
  62. <if test="role != null">#{role,jdbcType=VARCHAR},</if>
  63. <if test="status != null">#{status,jdbcType=CHAR},</if>
  64. </trim>
  65. </insert>
  66. <update id="updateByPrimaryKeySelective" parameterType="com.mofangchuxing.aska.dao.domain.AskaAccounts">
  67. update aska_accounts
  68. <set>
  69. <if test="username != null">
  70. username = #{username,jdbcType=CHAR},
  71. </if>
  72. <if test="name != null">
  73. name = #{name,jdbcType=CHAR},
  74. </if>
  75. <if test="phone != null">
  76. phone = #{phone,jdbcType=CHAR},
  77. </if>
  78. <if test="pass != null">
  79. pass = #{pass,jdbcType=CHAR},
  80. </if>
  81. <if test="role != null">
  82. role = #{role,jdbcType=VARCHAR},
  83. </if>
  84. <if test="status != null">
  85. status = #{status,jdbcType=CHAR},
  86. </if>
  87. </set>
  88. where id = #{id,jdbcType=INTEGER}
  89. </update>
  90. <update id="updateByPrimaryKey" parameterType="com.mofangchuxing.aska.dao.domain.AskaAccounts">
  91. update aska_accounts
  92. set
  93. username = #{username,jdbcType=CHAR},
  94. name = #{name,jdbcType=CHAR},
  95. phone = #{phone,jdbcType=CHAR},
  96. pass = #{pass,jdbcType=CHAR},
  97. role = #{role,jdbcType=VARCHAR},
  98. status = #{status,jdbcType=CHAR}
  99. where id = #{id,jdbcType=INTEGER}
  100. </update>
  101. </mapper>