地质所 沉降监测网建设项目
suerwei
2024-05-28 bc9f9097d1da4d431fdfe670d77521fd705baf53
javaweb-plus/javaweb-cms/src/main/resources/mapper/geo/TubLogMapper.xml
@@ -18,6 +18,8 @@
        <result property="unit"    column="unit"    />
        <result property="createDate"    column="create_date"    />
        <result property="remark"    column="remark"    />
        <result property="outboundNumber"    column="outbound_number"    />
        <result property="inboundNumber"    column="inbound_number"    />
    </resultMap>
    <sql id="selectTubLogVo">
@@ -45,7 +47,38 @@
        <include refid="selectTubLogVo"/>
        where id = #{id}
    </select>
    <select id="selectMaxTubLogId" resultType="java.lang.Integer">
        SELECT MAX(id) FROM js_tub_log where project_id = #{projectId}
    </select>
    <select id="countTubLogDate2" resultMap="TubLogResult">
        SELECT
            a.tub_name,
            b.inbound_number,
            a.outbound_number,
            a.unit
        FROM
            ( SELECT tub_name, SUM( number ) AS outbound_number, unit FROM js_tub_log WHERE outbound_date IS NOT NULL GROUP BY tub_name ) a
            LEFT JOIN ( SELECT tub_name, SUM( number ) AS inbound_number, unit FROM js_tub_log WHERE inbound_date IS NOT NULL GROUP BY tub_name ) b ON a.tub_name = b.tub_name
    </select>
    <select id="countTubLogDate" resultMap="TubLogResult">
       SELECT
            a.project_id,
            a.tub_name,
            b.inbound_number,
            a.outbound_number,
            a.unit
        FROM
            ( SELECT project_id, tub_name, SUM( number ) AS outbound_number, unit FROM js_tub_log WHERE outbound_date IS NOT NULL GROUP BY tub_name ) a
            LEFT JOIN ( SELECT project_id, tub_name, SUM( number ) AS inbound_number, unit FROM js_tub_log WHERE inbound_date IS NOT NULL GROUP BY tub_name ) b ON a.tub_name = b.tub_name
            AND a.project_id = b.project_id
        <where>
            <if test="projectId != null and projectId != ''"> and a.project_id = #{projectId}</if>
        </where>
    </select>
    <insert id="insertTubLog" parameterType="TubLog" useGeneratedKeys="true" keyProperty="id">
        insert into js_tub_log
        <trim prefix="(" suffix=")" suffixOverrides=",">