AskaAccountsMapper.xml 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  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. <select id="selectByRole" resultType="com.mofangchuxing.aska.dao.domain.AskaAccounts">
  33. select
  34. <include refid="Base_Column_List" />
  35. from aska_accounts
  36. where 1=1
  37. <if test="role != null and role != ''">
  38. and role = #{role}
  39. </if>
  40. </select>
  41. <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
  42. delete from aska_accounts
  43. where id = #{id,jdbcType=INTEGER}
  44. </delete>
  45. <insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.mofangchuxing.aska.dao.domain.AskaAccounts" useGeneratedKeys="true">
  46. insert into aska_accounts
  47. ( id,username,name
  48. ,phone,pass,role
  49. ,status)
  50. values (#{id,jdbcType=INTEGER},#{username,jdbcType=CHAR},#{name,jdbcType=CHAR}
  51. ,#{phone,jdbcType=CHAR},#{pass,jdbcType=CHAR},#{role,jdbcType=VARCHAR}
  52. ,#{status,jdbcType=CHAR})
  53. </insert>
  54. <insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.mofangchuxing.aska.dao.domain.AskaAccounts" useGeneratedKeys="true">
  55. insert into aska_accounts
  56. <trim prefix="(" suffix=")" suffixOverrides=",">
  57. <if test="id != null">id,</if>
  58. <if test="username != null">username,</if>
  59. <if test="name != null">name,</if>
  60. <if test="phone != null">phone,</if>
  61. <if test="pass != null">pass,</if>
  62. <if test="role != null">role,</if>
  63. <if test="status != null">status,</if>
  64. </trim>
  65. <trim prefix="values (" suffix=")" suffixOverrides=",">
  66. <if test="id != null">#{id,jdbcType=INTEGER},</if>
  67. <if test="username != null">#{username,jdbcType=CHAR},</if>
  68. <if test="name != null">#{name,jdbcType=CHAR},</if>
  69. <if test="phone != null">#{phone,jdbcType=CHAR},</if>
  70. <if test="pass != null">#{pass,jdbcType=CHAR},</if>
  71. <if test="role != null">#{role,jdbcType=VARCHAR},</if>
  72. <if test="status != null">#{status,jdbcType=CHAR},</if>
  73. </trim>
  74. </insert>
  75. <update id="updateByPrimaryKeySelective" parameterType="com.mofangchuxing.aska.dao.domain.AskaAccounts">
  76. update aska_accounts
  77. <set>
  78. <if test="username != null">
  79. username = #{username,jdbcType=CHAR},
  80. </if>
  81. <if test="name != null">
  82. name = #{name,jdbcType=CHAR},
  83. </if>
  84. <if test="phone != null">
  85. phone = #{phone,jdbcType=CHAR},
  86. </if>
  87. <if test="pass != null">
  88. pass = #{pass,jdbcType=CHAR},
  89. </if>
  90. <if test="role != null">
  91. role = #{role,jdbcType=VARCHAR},
  92. </if>
  93. <if test="status != null">
  94. status = #{status,jdbcType=CHAR},
  95. </if>
  96. </set>
  97. where id = #{id,jdbcType=INTEGER}
  98. </update>
  99. <update id="updateByPrimaryKey" parameterType="com.mofangchuxing.aska.dao.domain.AskaAccounts">
  100. update aska_accounts
  101. set
  102. username = #{username,jdbcType=CHAR},
  103. name = #{name,jdbcType=CHAR},
  104. phone = #{phone,jdbcType=CHAR},
  105. pass = #{pass,jdbcType=CHAR},
  106. role = #{role,jdbcType=VARCHAR},
  107. status = #{status,jdbcType=CHAR}
  108. where id = #{id,jdbcType=INTEGER}
  109. </update>
  110. </mapper>