123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107 |
- <?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.fms.system.mapper.BrandMapper">
-
- <resultMap type="Brand" id="BrandResult">
- <result property="brandId" column="brand_id" />
- <result property="brandName" column="brand_name" />
- <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>
- <resultMap id="BrandAircraftTypeResult" type="Brand" extends="BrandResult">
- <collection property="aircraftTypeList" notNullColumn="sub_aircraft_type_id" javaType="java.util.List" resultMap="AircraftTypeResult" />
- </resultMap>
- <resultMap type="AircraftType" id="AircraftTypeResult">
- <result property="aircraftTypeId" column="sub_aircraft_type_id" />
- <result property="brandId" column="sub_brand_id" />
- <result property="aircraftTypeName" column="sub_aircraft_type_name" />
- <result property="createBy" column="sub_create_by" />
- <result property="createTime" column="sub_create_time" />
- <result property="updateBy" column="sub_update_by" />
- <result property="updateTime" column="sub_update_time" />
- </resultMap>
- <sql id="selectBrandVo">
- select brand_id, brand_name, create_by, create_time, update_by, update_time from brand_t
- </sql>
- <select id="selectBrandList" parameterType="Brand" resultMap="BrandResult">
- <include refid="selectBrandVo"/>
- <where>
- <if test="brandName != null and brandName != ''"> and brand_name like concat('%', #{brandName}, '%')</if>
- </where>
- </select>
-
- <select id="selectBrandByBrandId" parameterType="Long" resultMap="BrandAircraftTypeResult">
- select a.brand_id, a.brand_name, a.create_by, a.create_time, a.update_by, a.update_time,
- b.aircraft_type_id as sub_aircraft_type_id, b.brand_id as sub_brand_id, b.aircraft_type_name as sub_aircraft_type_name, b.create_by as sub_create_by, b.create_time as sub_create_time, b.update_by as sub_update_by, b.update_time as sub_update_time
- from brand_t a
- left join aircraft_type_t b on b.brand_id = a.brand_id
- where a.brand_id = #{brandId}
- </select>
-
- <insert id="insertBrand" parameterType="Brand" useGeneratedKeys="true" keyProperty="brandId">
- insert into brand_t
- <trim prefix="(" suffix=")" suffixOverrides=",">
- <if test="brandName != null">brand_name,</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="brandName != null">#{brandName},</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="updateBrand" parameterType="Brand">
- update brand_t
- <trim prefix="SET" suffixOverrides=",">
- <if test="brandName != null">brand_name = #{brandName},</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 brand_id = #{brandId}
- </update>
- <delete id="deleteBrandByBrandId" parameterType="Long">
- delete from brand_t where brand_id = #{brandId}
- </delete>
- <delete id="deleteBrandByBrandIds" parameterType="String">
- delete from brand_t where brand_id in
- <foreach item="brandId" collection="array" open="(" separator="," close=")">
- #{brandId}
- </foreach>
- </delete>
-
- <delete id="deleteAircraftTypeByBrandIds" parameterType="String">
- delete from aircraft_type_t where brand_id in
- <foreach item="brandId" collection="array" open="(" separator="," close=")">
- #{brandId}
- </foreach>
- </delete>
- <delete id="deleteAircraftTypeByBrandId" parameterType="Long">
- delete from aircraft_type_t where brand_id = #{brandId}
- </delete>
- <insert id="batchAircraftType">
- insert into aircraft_type_t( aircraft_type_id, brand_id, aircraft_type_name, create_by, create_time, update_by, update_time) values
- <foreach item="item" index="index" collection="list" separator=",">
- ( #{item.aircraftTypeId}, #{item.brandId}, #{item.aircraftTypeName}, #{item.createBy}, #{item.createTime}, #{item.updateBy}, #{item.updateTime})
- </foreach>
- </insert>
- </mapper>
|