结对作业06

后端和数据库

<?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.cxk.baseframe.project.systemmanage.mapper.ABeijingsubwayMapper">

    <resultMap type="com.cxk.baseframe.config.common.entity.systemmanage.system.ABeijingsubway" id="ABeijingsubwayResult">
        <result property="id"    column="id"    />
        <result property="startStation"    column="start_station"    />
        <result property="endStation"    column="end_station"    />
        <result property="intermediateStations"    column="intermediate_stations"    />
        <result property="startStationLine"    column="start_station_line"    />
        <result property="endStationLine"    column="end_station_line"    />
        <result property="distNumber"    column="dist_number"    />
        <result property="price"    column="price"    />
    </resultMap>

    <sql id="selectABeijingsubwayVo">
        select id, start_station, end_station, intermediate_stations, start_station_line, end_station_line, dist_number, price from a_beijingsubway
    </sql>

    <select id="selectABeijingsubwayList" parameterType="com.cxk.baseframe.config.common.entity.systemmanage.system.ABeijingsubway" resultMap="ABeijingsubwayResult">
        <include refid="selectABeijingsubwayVo"/>
        <where>
            <if test="startStation != null  and startStation != ''"> and start_station like concat('%', #{startStation}, '%')</if>
            <if test="endStation != null  and endStation != ''"> and end_station like concat('%', #{endStation}, '%')</if>
        </where>
    </select>

    <select id="selectABeijingsubwayById" parameterType="Long" resultMap="ABeijingsubwayResult">
        <include refid="selectABeijingsubwayVo"/>
        where id = #{id}
    </select>

    <insert id="insertABeijingsubway" parameterType="com.cxk.baseframe.config.common.entity.systemmanage.system.ABeijingsubway" useGeneratedKeys="true" keyProperty="id">
        insert into a_beijingsubway
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="startStation != null and startStation != ''">start_station,</if>
            <if test="endStation != null and endStation != ''">end_station,</if>
            <if test="intermediateStations != null">intermediate_stations,</if>
            <if test="startStationLine != null">start_station_line,</if>
            <if test="endStationLine != null">end_station_line,</if>
            <if test="distNumber != null">dist_number,</if>
            <if test="price != null">price,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="startStation != null and startStation != ''">#{startStation},</if>
            <if test="endStation != null and endStation != ''">#{endStation},</if>
            <if test="intermediateStations != null">#{intermediateStations},</if>
            <if test="startStationLine != null">#{startStationLine},</if>
            <if test="endStationLine != null">#{endStationLine},</if>
            <if test="distNumber != null">#{distNumber},</if>
            <if test="price != null">#{price},</if>
         </trim>
    </insert>

    <update id="updateABeijingsubway" parameterType="com.cxk.baseframe.config.common.entity.systemmanage.system.ABeijingsubway">
        update a_beijingsubway
        <trim prefix="SET" suffixOverrides=",">
            <if test="startStation != null and startStation != ''">start_station = #{startStation},</if>
            <if test="endStation != null and endStation != ''">end_station = #{endStation},</if>
            <if test="intermediateStations != null">intermediate_stations = #{intermediateStations},</if>
            <if test="startStationLine != null">start_station_line = #{startStationLine},</if>
            <if test="endStationLine != null">end_station_line = #{endStationLine},</if>
            <if test="distNumber != null">dist_number = #{distNumber},</if>
            <if test="price != null">price = #{price},</if>
        </trim>
        where id = #{id}
    </update>

    <delete id="deleteABeijingsubwayById" parameterType="Long">
        delete from a_beijingsubway where id = #{id}
    </delete>

    <delete id="deleteABeijingsubwayByIds" parameterType="String">
        delete from a_beijingsubway where id in
        <foreach item="id" collection="array" open="(" separator="," close=")">
            #{id}
        </foreach>
    </delete>
</mapper>
<?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.cxk.baseframe.project.systemmanage.mapper.ALinesMapper">

    <resultMap type="com.cxk.baseframe.config.common.entity.systemmanage.system.ALines" id="ALinesResult">
        <result property="id"    column="id"    />
        <result property="lineNo"    column="line_no"    />
        <result property="stations"    column="stations"    />
    </resultMap>

    <sql id="selectALinesVo">
        select id, line_no, stations from a_lines
    </sql>

    <select id="selectALinesList" parameterType="com.cxk.baseframe.config.common.entity.systemmanage.system.ALines" resultMap="ALinesResult">
        <include refid="selectALinesVo"/>
        <where>
            <if test="lineNo != null  and lineNo != ''"> and line_no like concat('%', #{lineNo}, '%')</if>
        </where>
    </select>

    <select id="selectALinesById" parameterType="Long" resultMap="ALinesResult">
        <include refid="selectALinesVo"/>
        where id = #{id}
    </select>

    <insert id="insertALines" parameterType="com.cxk.baseframe.config.common.entity.systemmanage.system.ALines" useGeneratedKeys="true" keyProperty="id">
        insert into a_lines
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="lineNo != null and lineNo != ''">line_no,</if>
            <if test="stations != null">stations,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="lineNo != null and lineNo != ''">#{lineNo},</if>
            <if test="stations != null">#{stations},</if>
         </trim>
    </insert>

    <update id="updateALines" parameterType="com.cxk.baseframe.config.common.entity.systemmanage.system.ALines">
        update a_lines
        <trim prefix="SET" suffixOverrides=",">
            <if test="lineNo != null and lineNo != ''">line_no = #{lineNo},</if>
            <if test="stations != null">stations = #{stations},</if>
        </trim>
        where id = #{id}
    </update>

    <delete id="deleteALinesById" parameterType="Long">
        delete from a_lines where id = #{id}
    </delete>

    <delete id="deleteALinesByIds" parameterType="String">
        delete from a_lines where id in
        <foreach item="id" collection="array" open="(" separator="," close=")">
            #{id}
        </foreach>
    </delete>
</mapper>
<?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.cxk.baseframe.project.systemmanage.mapper.AStationsMapper">

    <resultMap type="com.cxk.baseframe.config.common.entity.systemmanage.system.AStations" id="AStationsResult">
        <result property="id"    column="id"    />
        <result property="lineno"    column="lineno"    />
        <result property="name"    column="name"    />
    </resultMap>

    <sql id="selectAStationsVo">
        select id, lineno, name from a_stations
    </sql>

    <select id="selectAStationsList" parameterType="com.cxk.baseframe.config.common.entity.systemmanage.system.AStations" resultMap="AStationsResult">
        <include refid="selectAStationsVo"/>
        <where>
            <if test="lineno != null  and lineno != ''"> and lineno like concat('%', #{lineno}, '%')</if>
            <if test="name != null  and name != ''"> and name like concat('%', #{name}, '%')</if>
        </where>
    </select>

    <select id="selectAStationsById" parameterType="Long" resultMap="AStationsResult">
        <include refid="selectAStationsVo"/>
        where id = #{id}
    </select>

    <insert id="insertAStations" parameterType="com.cxk.baseframe.config.common.entity.systemmanage.system.AStations" useGeneratedKeys="true" keyProperty="id">
        insert into a_stations
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="lineno != null">lineno,</if>
            <if test="name != null">name,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="lineno != null">#{lineno},</if>
            <if test="name != null">#{name},</if>
         </trim>
    </insert>

    <update id="updateAStations" parameterType="com.cxk.baseframe.config.common.entity.systemmanage.system.AStations">
        update a_stations
        <trim prefix="SET" suffixOverrides=",">
            <if test="lineno != null">lineno = #{lineno},</if>
            <if test="name != null">name = #{name},</if>
        </trim>
        where id = #{id}
    </update>

    <delete id="deleteAStationsById" parameterType="Long">
        delete from a_stations where id = #{id}
    </delete>

    <delete id="deleteAStationsByIds" parameterType="String">
        delete from a_stations where id in
        <foreach item="id" collection="array" open="(" separator="," close=")">
            #{id}
        </foreach>
    </delete>
</mapper>

 

posted @ 2024-04-14 16:24  艾鑫4646  阅读(5)  评论(0编辑  收藏  举报