IntegralShopPicMapper.xml 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  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.yijia.integral.mapper.IntegralShopPicMapper">
  6. <resultMap type="IntegralShopPic" id="IntegralShopPicResult">
  7. <result property="id" column="id" />
  8. <result property="name" column="name" />
  9. <result property="url" column="url" />
  10. <result property="imgStatus" column="img_status" />
  11. <result property="stationId" column="station_id" />
  12. <result property="stationName" column="station_name" />
  13. <result property="parentId" column="parent_id" />
  14. </resultMap>
  15. <sql id="selectIntegralShopPicVo">
  16. select id, name, url, img_status, station_id, station_name, parent_id from integral_shop_pic
  17. </sql>
  18. <select id="selectIntegralShopPicList" parameterType="IntegralShopPic" resultMap="IntegralShopPicResult">
  19. <include refid="selectIntegralShopPicVo"/>
  20. <where>
  21. <if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
  22. <if test="url != null and url != ''"> and url = #{url}</if>
  23. <if test="imgStatus != null and imgStatus != ''"> and img_status = #{imgStatus}</if>
  24. <if test="stationId != null "> and station_id = #{stationId}</if>
  25. <if test="stationName != null and stationName != ''"> and station_name like concat('%', #{stationName}, '%')</if>
  26. <if test="parentId != null "> and parent_id = #{parentId}</if>
  27. <if test="stationIdList != null ">
  28. and station_id in
  29. <foreach item="item" index="index" collection="stationIdList"
  30. open="(" separator="," close=")">
  31. #{item}
  32. </foreach>
  33. </if>
  34. </where>
  35. order by id desc
  36. </select>
  37. <select id="selectIntegralShopPicById" parameterType="Long" resultMap="IntegralShopPicResult">
  38. <include refid="selectIntegralShopPicVo"/>
  39. where id = #{id}
  40. </select>
  41. <insert id="insertIntegralShopPic" parameterType="IntegralShopPic" useGeneratedKeys="true" keyProperty="id">
  42. insert into integral_shop_pic
  43. <trim prefix="(" suffix=")" suffixOverrides=",">
  44. <if test="name != null">name,</if>
  45. <if test="url != null">url,</if>
  46. <if test="imgStatus != null">img_status,</if>
  47. <if test="stationId != null">station_id,</if>
  48. <if test="stationName != null">station_name,</if>
  49. <if test="parentId != null">parent_id,</if>
  50. </trim>
  51. <trim prefix="values (" suffix=")" suffixOverrides=",">
  52. <if test="name != null">#{name},</if>
  53. <if test="url != null">#{url},</if>
  54. <if test="imgStatus != null">#{imgStatus},</if>
  55. <if test="stationId != null">#{stationId},</if>
  56. <if test="stationName != null">#{stationName},</if>
  57. <if test="parentId != null">#{parentId},</if>
  58. </trim>
  59. </insert>
  60. <update id="updateIntegralShopPic" parameterType="IntegralShopPic">
  61. update integral_shop_pic
  62. <trim prefix="SET" suffixOverrides=",">
  63. <if test="name != null">name = #{name},</if>
  64. <if test="url != null">url = #{url},</if>
  65. <if test="imgStatus != null">img_status = #{imgStatus},</if>
  66. <if test="stationId != null">station_id = #{stationId},</if>
  67. <if test="stationName != null">station_name = #{stationName},</if>
  68. <if test="parentId != null">parent_id = #{parentId},</if>
  69. </trim>
  70. where id = #{id}
  71. </update>
  72. <delete id="deleteIntegralShopPicById" parameterType="Long">
  73. delete from integral_shop_pic where id = #{id}
  74. </delete>
  75. <delete id="deleteIntegralShopPicByIds" parameterType="String">
  76. delete from integral_shop_pic where id in
  77. <foreach item="id" collection="array" open="(" separator="," close=")">
  78. #{id}
  79. </foreach>
  80. </delete>
  81. <delete id="deleteIntegralShopPic" parameterType="IntegralShopPic">
  82. delete from integral_shop_pic
  83. <where>
  84. <if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
  85. <if test="url != null and url != ''"> and url = #{url}</if>
  86. <if test="imgStatus != null and imgStatus != ''"> and img_status = #{imgStatus}</if>
  87. <if test="stationId != null "> and station_id = #{stationId}</if>
  88. <if test="stationName != null and stationName != ''"> and station_name like concat('%', #{stationName}, '%')</if>
  89. <if test="parentId != null "> and parent_id = #{parentId}</if>
  90. </where>
  91. </delete>
  92. </mapper>