123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111 |
- <?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="beilv.carinformation.mapper.CarInformationMapper">
- <resultMap type="CarInformation" id="CarInformationResult">
- <result property="id" column="id" />
- <result property="name" column="name" />
- <result property="type" column="type" />
- <result property="totalNumber" column="total_number" />
- <result property="price" column="price" />
- <result property="point" column="point" />
- <result property="expirationDate" column="expiration_date" />
- <result property="notes" column="notes" />
- <result property="state" column="state" />
- <result property="createBy" column="create_by" />
- <result property="createTime" column="create_time" />
- <result property="updateBy" column="update_by" />
- <result property="updateTime" column="update_time" />
- </resultMap>
- <sql id="selectCarInformationVo">
- select id, name, type, total_number, price, point, expiration_date, notes, state, create_by, create_time, update_by, update_time from card_information
- </sql>
- <select id="selectCarInformationList" parameterType="CarInformation" resultMap="CarInformationResult">
- <include refid="selectCarInformationVo"/>
- <where>
- <if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
- <if test="type != null and type != ''"> and type = #{type}</if>
- <if test="totalNumber != null "> and total_number = #{totalNumber}</if>
- <if test="price != null "> and price = #{price}</if>
- <if test="point != null "> and point = #{point}</if>
- <if test="expirationDate != null "> and expiration_date = #{expirationDate}</if>
- <if test="notes != null and notes != ''"> and notes = #{notes}</if>
- <if test="state != null and state != ''"> and state = #{state}</if>
- </where>
- order by create_time desc
- </select>
- <select id="selectCarInformationById" parameterType="Long" resultMap="CarInformationResult">
- <include refid="selectCarInformationVo"/>
- where id = #{id}
- </select>
- <insert id="insertCarInformation" parameterType="CarInformation">
- insert into card_information
- <trim prefix="(" suffix=")" suffixOverrides=",">
- <if test="id != null">id,</if>
- <if test="name != null">name,</if>
- <if test="type != null">type,</if>
- <if test="totalNumber != null">total_number,</if>
- <if test="price != null">price,</if>
- <if test="point != null">point,</if>
- <if test="expirationDate != null">expiration_date,</if>
- <if test="notes != null">notes,</if>
- <if test="state != null">state,</if>
- <if test="createBy != null">create_by,</if>
- <if test="createTime != null">create_time,</if>
- <if test="updateBy != null">update_by,</if>
- <if test="updateTime != null">update_time,</if>
- </trim>
- <trim prefix="values (" suffix=")" suffixOverrides=",">
- <if test="id != null">#{id},</if>
- <if test="name != null">#{name},</if>
- <if test="type != null">#{type},</if>
- <if test="totalNumber != null">#{totalNumber},</if>
- <if test="price != null">#{price},</if>
- <if test="point != null">#{point},</if>
- <if test="expirationDate != null">#{expirationDate},</if>
- <if test="notes != null">#{notes},</if>
- <if test="state != null">#{state},</if>
- <if test="createBy != null">#{createBy},</if>
- <if test="createTime != null">#{createTime},</if>
- <if test="updateBy != null">#{updateBy},</if>
- <if test="updateTime != null">#{updateTime},</if>
- </trim>
- </insert>
- <update id="updateCarInformation" parameterType="CarInformation">
- update card_information
- <trim prefix="SET" suffixOverrides=",">
- <if test="name != null">name = #{name},</if>
- <if test="type != null">type = #{type},</if>
- <if test="totalNumber != null">total_number = #{totalNumber},</if>
- <if test="price != null">price = #{price},</if>
- <if test="point != null">point = #{point},</if>
- <if test="expirationDate != null">expiration_date = #{expirationDate},</if>
- <if test="notes != null">notes = #{notes},</if>
- <if test="state != null">state = #{state},</if>
- <if test="createBy != null">create_by = #{createBy},</if>
- <if test="createTime != null">create_time = #{createTime},</if>
- <if test="updateBy != null">update_by = #{updateBy},</if>
- <if test="updateTime != null">update_time = #{updateTime},</if>
- </trim>
- where id = #{id}
- </update>
- <delete id="deleteCarInformationById" parameterType="Long">
- delete from card_information where id = #{id}
- </delete>
- <delete id="deleteCarInformationByIds" parameterType="String">
- delete from card_information where id in
- <foreach item="id" collection="array" open="(" separator="," close=")">
- #{id}
- </foreach>
- </delete>
- </mapper>
|