TProcessesDrillingMapper.xml 3.02 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="cn.wise.sc.acquisition.business.mapper.TProcessesDrillingMapper">


    <!-- 表和实体字段对照关系, 类似RestultMap -->
    <sql id="TProcessesDrillingColumns">
        a.Uid,
        a.StopeName,
        a.StepName,
        a.BlastAreaName,
        a.HoleID,
        a.DrillingDate,
        a.Manager,
        a.Supervisor,
        a.TechDepart,
        a.Tabulator,
        a.EquipmentID,
        a.Driver,
        a.StartTime,
        a.EndTime,
        a.WorkTime,
        a.HoleBlastVolume,
        a.Depth,
        a.RowSpace,
        a.HoleSpace,
        a.Azimuth,
        a.Inclination,
        a.Aperture,
        a.x,
        a.y,
        a.z,

        a.Operator,
        a.Accepter,
        a.Bz,
        a.Tag
	</sql>

    <sql id="TProcessesDiggingHoleColumns">
        b.Depth AS DesignDepth,
        b.RowSpace AS DesignRowSpace,
        b.HoleSpace AS  DesignHoleSpace,
        b.Azimuth AS DesignAzimuth,
        b.Inclination AS DesignInclination,
        b.Aperture AS DesignAperture,
        b.StepHeight,
	</sql>


    <sql id="TProcessesBlastColumns">
        c.BlastDate,
	</sql>

    <sql id="TProcessesBlastdesignVolumeColumns">
        d.BlastVolume,
        d.DesignDate,
	</sql>

    <sql id="TProcessesDrillingJoins">
        left join T_Processes_BlastDesign_Hole b on a.HoleID = b.BlastHoleID
        left join T_Processes_Blast c on a.HoleID = c.HoleID
        left join T_Processes_BlastDesign_Volume d on a.StopeName=d.StopeName and a.StepName=d.StepName and a.BlastAreaName=d.BlastAreaName
    </sql>

    <!-- 获取所有getPage列表 -->
    <select id="getPage" resultType="cn.wise.sc.acquisition.business.model.vo.TProcessesDrillingVo">
        SELECT
        a.Uid,
        a.HoleID,
        a.Depth,
        a.RowSpace,
        a.HoleSpace,
        a.HoleBlastVolume,
        b.Depth AS DesignDepth,
        b.RowSpace AS DesignRowSpace,
        b.HoleSpace AS  DesignHoleSpace,
        b.StepHeight
        FROM T_Processes_Drilling a
        <include refid="TProcessesDrillingJoins"/>
        <where>
            ${ew.sqlSegment}
        </where>
    </select>


    <!-- 获取所有getPage列表 -->
    <select id="getByQuery" resultType="cn.wise.sc.acquisition.business.model.vo.TProcessesDrillingVo">
        SELECT
        <include refid="TProcessesDiggingHoleColumns"/>
        <include refid="TProcessesBlastColumns"/>
        <include refid="TProcessesBlastdesignVolumeColumns"/>
        <include refid="TProcessesDrillingColumns"/>
        FROM T_Processes_Drilling a
        <include refid="TProcessesDrillingJoins"/>
        <where>
            ${ew.sqlSegment}
        </where>
    </select>

    <!-- 根据条件求和某字段 -->
    <select id="getSumByCondition" resultType="Double">
        SELECT
        sum(${condition})
        FROM T_Processes_Drilling a
        <where>
            ${ew.sqlSegment}
        </where>
    </select>


</mapper>