StationPicMapper.xml 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  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.station.mapper.StationPicMapper">
  6. <resultMap type="StationPic" id="StationPicResult">
  7. <result property="id" column="id" />
  8. <result property="name" column="name" />
  9. <result property="url" column="url" />
  10. <result property="stationId" column="station_id" />
  11. <result property="stationName" column="station_name" />
  12. <result property="parentId" column="parent_id" />
  13. </resultMap>
  14. <sql id="selectStationPicVo">
  15. select id, name, url, station_id, station_name, parent_id from station_pic
  16. </sql>
  17. <select id="selectStationPicList" parameterType="StationPic" resultMap="StationPicResult">
  18. <include refid="selectStationPicVo"/>
  19. <where>
  20. <if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
  21. <if test="url != null and url != ''"> and url = #{url}</if>
  22. <if test="stationId != null "> and station_id = #{stationId}</if>
  23. <if test="stationName != null and stationName != ''"> and station_name like concat('%', #{stationName}, '%')</if>
  24. <if test="parentId != null "> and parent_id = #{parentId}</if>
  25. </where>
  26. </select>
  27. <select id="selectStationPicById" parameterType="Long" resultMap="StationPicResult">
  28. <include refid="selectStationPicVo"/>
  29. where id = #{id}
  30. </select>
  31. <insert id="insertStationPic" parameterType="StationPic" useGeneratedKeys="true" keyProperty="id">
  32. insert into station_pic
  33. <trim prefix="(" suffix=")" suffixOverrides=",">
  34. <if test="name != null">name,</if>
  35. <if test="url != null">url,</if>
  36. <if test="stationId != null">station_id,</if>
  37. <if test="stationName != null">station_name,</if>
  38. <if test="parentId != null">parent_id,</if>
  39. </trim>
  40. <trim prefix="values (" suffix=")" suffixOverrides=",">
  41. <if test="name != null">#{name},</if>
  42. <if test="url != null">#{url},</if>
  43. <if test="stationId != null">#{stationId},</if>
  44. <if test="stationName != null">#{stationName},</if>
  45. <if test="parentId != null">#{parentId},</if>
  46. </trim>
  47. </insert>
  48. <update id="updateStationPic" parameterType="StationPic">
  49. update station_pic
  50. <trim prefix="SET" suffixOverrides=",">
  51. <if test="name != null">name = #{name},</if>
  52. <if test="url != null">url = #{url},</if>
  53. <if test="stationId != null">station_id = #{stationId},</if>
  54. <if test="stationName != null">station_name = #{stationName},</if>
  55. <if test="parentId != null">parent_id = #{parentId},</if>
  56. </trim>
  57. where id = #{id}
  58. </update>
  59. <delete id="deleteStationPicById" parameterType="Long">
  60. delete from station_pic where id = #{id}
  61. </delete>
  62. <delete id="deleteStationPicByIds" parameterType="String">
  63. delete from station_pic where id in
  64. <foreach item="id" collection="array" open="(" separator="," close=")">
  65. #{id}
  66. </foreach>
  67. </delete>
  68. <delete id="deleteStationPay" parameterType="StationPic">
  69. delete from station_pic
  70. <where>
  71. <if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
  72. <if test="url != null and url != ''"> and url = #{url}</if>
  73. <if test="stationId != null "> and station_id = #{stationId}</if>
  74. <if test="stationName != null and stationName != ''"> and station_name like concat('%', #{stationName}, '%')</if>
  75. <if test="parentId != null "> and parent_id = #{parentId}</if>
  76. </where>
  77. </delete>
  78. </mapper>