ApiUserLevelMapper.xml 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  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.kmall.api.dao.ApiUserLevelMapper">
  4. <!-- 可根据自己的需求,是否要使用 -->
  5. <resultMap type="com.kmall.api.entity.UserLevelVo" id="userLevelMap">
  6. <result property="id" column="id"/>
  7. <result property="name" column="name"/>
  8. <result property="description" column="description"/>
  9. </resultMap>
  10. <select id="queryObject" resultType="com.kmall.api.entity.UserLevelVo">
  11. select * from mall_user_level where id = #{value}
  12. </select>
  13. <select id="queryList" resultType="com.kmall.api.entity.UserLevelVo">
  14. select * from mall_user_level
  15. <choose>
  16. <when test="sidx != null and sidx.trim() != ''">
  17. order by ${sidx} ${order}
  18. </when>
  19. <otherwise>
  20. order by id desc
  21. </otherwise>
  22. </choose>
  23. <if test="offset != null and limit != null">
  24. limit #{offset}, #{limit}
  25. </if>
  26. </select>
  27. <select id="queryTotal" resultType="int">
  28. select count(*) from mall_user_level
  29. </select>
  30. <insert id="save" parameterType="com.kmall.api.entity.UserLevelVo" useGeneratedKeys="true" keyProperty="id">
  31. insert into mall_user_level
  32. (
  33. `name`,
  34. `description`
  35. )
  36. values
  37. (
  38. #{name},
  39. #{description}
  40. )
  41. </insert>
  42. <update id="update" parameterType="com.kmall.api.entity.UserLevelVo">
  43. update mall_user_level
  44. <set>
  45. <if test="name != null">`name` = #{name}, </if>
  46. <if test="description != null">`description` = #{description}</if>
  47. </set>
  48. where id = #{id}
  49. </update>
  50. <delete id="delete">
  51. delete from mall_user_level where id = #{value}
  52. </delete>
  53. <delete id="deleteBatch">
  54. delete from mall_user_level where id in
  55. <foreach item="id" collection="array" open="(" separator="," close=")">
  56. #{id}
  57. </foreach>
  58. </delete>
  59. </mapper>