123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687 |
- <?xml version="1.0" encoding="UTF-8" ?>
- <!DOCTYPE mapper
- PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
- "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
- <mapper namespace="com.yijia.station.mapper.StationPicMapper">
-
- <resultMap type="StationPic" id="StationPicResult">
- <result property="id" column="id" />
- <result property="name" column="name" />
- <result property="url" column="url" />
- <result property="stationId" column="station_id" />
- <result property="stationName" column="station_name" />
- <result property="parentId" column="parent_id" />
- </resultMap>
- <sql id="selectStationPicVo">
- select id, name, url, station_id, station_name, parent_id from station_pic
- </sql>
- <select id="selectStationPicList" parameterType="StationPic" resultMap="StationPicResult">
- <include refid="selectStationPicVo"/>
- <where>
- <if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
- <if test="url != null and url != ''"> and url = #{url}</if>
- <if test="stationId != null "> and station_id = #{stationId}</if>
- <if test="stationName != null and stationName != ''"> and station_name like concat('%', #{stationName}, '%')</if>
- <if test="parentId != null "> and parent_id = #{parentId}</if>
- </where>
- </select>
-
- <select id="selectStationPicById" parameterType="Long" resultMap="StationPicResult">
- <include refid="selectStationPicVo"/>
- where id = #{id}
- </select>
-
- <insert id="insertStationPic" parameterType="StationPic" useGeneratedKeys="true" keyProperty="id">
- insert into station_pic
- <trim prefix="(" suffix=")" suffixOverrides=",">
- <if test="name != null">name,</if>
- <if test="url != null">url,</if>
- <if test="stationId != null">station_id,</if>
- <if test="stationName != null">station_name,</if>
- <if test="parentId != null">parent_id,</if>
- </trim>
- <trim prefix="values (" suffix=")" suffixOverrides=",">
- <if test="name != null">#{name},</if>
- <if test="url != null">#{url},</if>
- <if test="stationId != null">#{stationId},</if>
- <if test="stationName != null">#{stationName},</if>
- <if test="parentId != null">#{parentId},</if>
- </trim>
- </insert>
- <update id="updateStationPic" parameterType="StationPic">
- update station_pic
- <trim prefix="SET" suffixOverrides=",">
- <if test="name != null">name = #{name},</if>
- <if test="url != null">url = #{url},</if>
- <if test="stationId != null">station_id = #{stationId},</if>
- <if test="stationName != null">station_name = #{stationName},</if>
- <if test="parentId != null">parent_id = #{parentId},</if>
- </trim>
- where id = #{id}
- </update>
- <delete id="deleteStationPicById" parameterType="Long">
- delete from station_pic where id = #{id}
- </delete>
- <delete id="deleteStationPicByIds" parameterType="String">
- delete from station_pic where id in
- <foreach item="id" collection="array" open="(" separator="," close=")">
- #{id}
- </foreach>
- </delete>
- <delete id="deleteStationPay" parameterType="StationPic">
- delete from station_pic
- <where>
- <if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
- <if test="url != null and url != ''"> and url = #{url}</if>
- <if test="stationId != null "> and station_id = #{stationId}</if>
- <if test="stationName != null and stationName != ''"> and station_name like concat('%', #{stationName}, '%')</if>
- <if test="parentId != null "> and parent_id = #{parentId}</if>
- </where>
- </delete>
- </mapper>
|