Newer
Older
casic-metering / casic-metering-dao / src / main / resources / mapper / MeterTrainPlanMapper.xml
wangpeng on 28 Nov 2022 2 KB 溯源供方接口
<?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.casic.missiles.mapper.MeterTrainPlanMapper">

    <resultMap id="TrainPlanDetailResultMap" type="com.casic.missiles.dto.meter.TrainPlanDetailResponse">
        <result column="plan_no" property="planNo"/>
        <result column="plan_name" property="planName"/>
        <result column="train_person" property="trainPerson"/>
        <result column="train_number" property="trainNumber"/>
        <result column="train_time" property="trainTime"/>
        <result column="train_hour" property="trainHour"/>
        <result column="dept_id" property="deptId"/>
        <result column="dept_name" property="deptName"/>
        <result column="effective_company" property="effectiveCompany"/>
        <result column="director" property="director"/>
        <result column="train_address" property="trainAddress"/>
        <result column="train_content" property="trainContent"/>
        <result column="train_remark" property="remark"/>

        <collection property="trainStaffList" javaType="list" ofType="com.casic.missiles.dto.meter.TrainStaffDTO">
            <result column="name" property="name"/>
            <result column="company" property="company"/>
            <result column="technology_job" property="technologyJob"/>
            <result column="remark" property="remark"/>
        </collection>
    </resultMap>

    <select id="selectTrainPlanById" resultMap="TrainPlanDetailResultMap">
        SELECT mtp.plan_no, mtp.plan_name, mtp.train_person, mtp.train_number, mtp.train_time, mtp.train_hour,
        mtp.dept_id, sd.SIMPLE_NAME AS dept_name, mtp.effective_company, mtp.director, mtp.train_address,
        mtp.train_content, mtp.remark AS train_remark, mts.name, mts.company, mts.technology_job, mts.remark
        FROM meter_train_plan mtp
        LEFT JOIN sys_dept sd ON mtp.dept_id = sd.id
        LEFT JOIN meter_train_staff mts ON mtp.id = mts.plan_id
        WHERE mtp.id = #{id} AND mtp.is_del = 0
    </select>

    <select id="selectMaxFileNo" resultType="long">
        SELECT IFNULL(max(RIGHT(plan_no, 12)), 0) from meter_train_plan
    </select>
</mapper>