ProductImageMapper.xml 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  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.how2java.tmall.mapper.ProductImageMapper">
  4. <resultMap id="BaseResultMap" type="com.how2java.tmall.pojo.ProductImage">
  5. <id column="id" jdbcType="INTEGER" property="id" />
  6. <result column="pid" jdbcType="INTEGER" property="pid" />
  7. <result column="type" jdbcType="VARCHAR" property="type" />
  8. </resultMap>
  9. <sql id="Example_Where_Clause">
  10. <where>
  11. <foreach collection="oredCriteria" item="criteria" separator="or">
  12. <if test="criteria.valid">
  13. <trim prefix="(" prefixOverrides="and" suffix=")">
  14. <foreach collection="criteria.criteria" item="criterion">
  15. <choose>
  16. <when test="criterion.noValue">
  17. and ${criterion.condition}
  18. </when>
  19. <when test="criterion.singleValue">
  20. and ${criterion.condition} #{criterion.value}
  21. </when>
  22. <when test="criterion.betweenValue">
  23. and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
  24. </when>
  25. <when test="criterion.listValue">
  26. and ${criterion.condition}
  27. <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
  28. #{listItem}
  29. </foreach>
  30. </when>
  31. </choose>
  32. </foreach>
  33. </trim>
  34. </if>
  35. </foreach>
  36. </where>
  37. </sql>
  38. <sql id="Base_Column_List">
  39. id, pid, type
  40. </sql>
  41. <select id="selectByExample" parameterType="com.how2java.tmall.pojo.ProductImageExample" resultMap="BaseResultMap">
  42. select
  43. <if test="distinct">
  44. distinct
  45. </if>
  46. 'false' as QUERYID,
  47. <include refid="Base_Column_List" />
  48. from productimage
  49. <if test="_parameter != null">
  50. <include refid="Example_Where_Clause" />
  51. </if>
  52. <if test="orderByClause != null">
  53. order by ${orderByClause}
  54. </if>
  55. </select>
  56. <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
  57. select
  58. <include refid="Base_Column_List" />
  59. from productimage
  60. where id = #{id,jdbcType=INTEGER}
  61. </select>
  62. <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
  63. delete from productimage
  64. where id = #{id,jdbcType=INTEGER}
  65. </delete>
  66. <insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.how2java.tmall.pojo.ProductImage" useGeneratedKeys="true">
  67. insert into productimage (pid, type)
  68. values (#{pid,jdbcType=INTEGER}, #{type,jdbcType=VARCHAR})
  69. </insert>
  70. <insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.how2java.tmall.pojo.ProductImage" useGeneratedKeys="true">
  71. insert into productimage
  72. <trim prefix="(" suffix=")" suffixOverrides=",">
  73. <if test="pid != null">
  74. pid,
  75. </if>
  76. <if test="type != null">
  77. type,
  78. </if>
  79. </trim>
  80. <trim prefix="values (" suffix=")" suffixOverrides=",">
  81. <if test="pid != null">
  82. #{pid,jdbcType=INTEGER},
  83. </if>
  84. <if test="type != null">
  85. #{type,jdbcType=VARCHAR},
  86. </if>
  87. </trim>
  88. </insert>
  89. <update id="updateByPrimaryKeySelective" parameterType="com.how2java.tmall.pojo.ProductImage">
  90. update productimage
  91. <set>
  92. <if test="pid != null">
  93. pid = #{pid,jdbcType=INTEGER},
  94. </if>
  95. <if test="type != null">
  96. type = #{type,jdbcType=VARCHAR},
  97. </if>
  98. </set>
  99. where id = #{id,jdbcType=INTEGER}
  100. </update>
  101. <update id="updateByPrimaryKey" parameterType="com.how2java.tmall.pojo.ProductImage">
  102. update productimage
  103. set pid = #{pid,jdbcType=INTEGER},
  104. type = #{type,jdbcType=VARCHAR}
  105. where id = #{id,jdbcType=INTEGER}
  106. </update>
  107. </mapper>