TProcessesDrillingMapper.xml 3.7 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.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.BlastDate,
        a.Operator,
        a.Accepter,
        a.Bz,
        a.Tag
	</sql>

    <sql id="TProcessesBlastDesignHoleColumns">
        b.StopeName,
        b.StepName,
        b.BlastAreaName,
        b.BlastHoleID AS HoleId,
        b.DrillingDate,

        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="TProcessesBlastdesignVolumeColumns">
        d.BlastVolume,
        d.DesignDate,
	</sql>

    <sql id="TProcessesBlastDesignHoleJoins">
        left join T_Processes_BlastDesign_Hole b on a.Uid = b.Uid
    </sql>

    <sql id="TProcessesBlastDesignVolumeJoins">
        left join T_Processes_BlastDesign_Volume d on b.StopeName=d.StopeName and b.StepName=d.StepName and b.BlastAreaName=d.BlastAreaName
    </sql>

    <update id="updateByDrillingDate">
        UPDATE a
        set
        <if test="params.BlastDate != null">
            a.BlastDate= #{params.BlastDate}
        </if>
        from T_Processes_Drilling a
        INNER JOIN T_Processes_BlastDesign_Hole b
        on a.Uid=b.Uid
        <where>
           b.DrillingDate=#{params.DrillingDate}
        </where>

    </update>


    <select id="getUidList" resultType="java.lang.String">
        select tpd.Uid from T_Processes_Drilling tpd where tpd.BlastDate=#{blastDate}
    </select>













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


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

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


</mapper>