bingbo
2023-11-24 ace7066780453a7a70dbaa3700de9a761f38ca87
hd/pipe/mobile/src/main/resources/mapping/PipeInfoMapper.xml
@@ -840,4 +840,86 @@
    <select id="countByRingNum" resultType="int">
        select count(pipe_id) from t_pipe_info where ring_num = #{ringNum}
    </select>
    <select id="compelteByRingNumAndPro" resultType="boolean">
        select (a.pipeBlock=b.proBlock) as result from
            (
                select GROUP_CONCAT(block_num order by sd.dict_value) as pipeBlock,tpi.pro_id
                from t_pipe_info tpi
                         left join sys_dict sd on sd.dict_id = tpi.block_num
                where tpi.ring_num = #{ringNum} and tpi.pro_id = #{proId} and tpi.check_result = 1
                group by tpi.ring_num,tpi.pro_id
            ) a
                left join
            (
                select GROUP_CONCAT(block_num order by sd1.dict_value) as proBlock,spb.pro_id
                from sys_pro_blok spb
                         left join sys_dict sd1 on sd1.dict_id = spb.block_num
                where spb.pro_id = #{proId}
                group by spb.pro_id
            ) b on a.pro_id = b.pro_id
    </select>
    <select id="queryByRingNumAndPro" resultType="com.thhy.mobile.modules.biz.cultivated.entity.PipeIntoListVo">
        select t.ring_num as ringNum,t.pipe_num as pipeNum,t.check_time as checkTime,sd.dict_name as blockNum,sp.pro_name as proName
        from t_pipe_info t
                 left join sys_dict sd on sd.dict_id = t.block_num
                 left join sys_project sp on sp.pro_id = t.pro_id
        where t.ring_num = #{ringNum} and t.pro_id = #{proId}
        order by t.pipe_num
    </select>
    <select id="queryWaterTimeByPipeNum" resultType="com.thhy.mobile.modules.biz.cultivated.entity.PipeCultivated">
        select pc.id,pc.ring_num as ringNum,pc.create_time as createTime,pc.out_time as outTime,pc.out_water as outWater
        from t_pipe_cultivated_pi pcp
                 left join t_pipe_cultivated pc on pcp.cultivated_id = pc.id
        where pipe_num = #{pipeNum}
    </select>
    <select id="queryRepoDate" resultType="com.thhy.mobile.modules.biz.repo.entity.RepoRecord">
        select rr.create_time as createTime,rr.record_id as recordId,rrp.out_repo as outRepo,rrp.out_repo_time as outRepoTime
        from t_repo_record_pipe rrp
                 left join t_repo_record rr on rrp.record_id = rr.record_id
        where rrp.pipe_num = #{pipeNum}
    </select>
    <update id="updatePipeDateByNum">
        update t_pipe_info
        <set>
            <if test="checkTime != null">
                check_time=#{checkTime},
            </if>
            <if test="inModTime != null">
                into_mod_time=#{inModTime},
            </if>
            <if test="outModTime != null">
                out_mod_time=#{outModTime},
            </if>
            <if test="pouringTime != null">
                pouring_time=#{pouringTime},
            </if>
            <if test="placingInTime != null">
                placing_in_time=#{placingInTime},
            </if>
            <if test="placingOutTime != null">
                placing_out_time=#{placingOutTime},
            </if>
            <if test="inRepoTime != null">
                in_repo_time = #{inRepoTime},
            </if>
        </set>
        where pipe_num=#{pipeNum}
    </update>
    <update id="updateInWaterTime">
        update t_pipe_cultivated set create_time = #{createTime} where id =#{id}
    </update>
    <update id="updateOutWaterTime">
        update t_pipe_cultivated set out_time = #{outTime} where id =#{id}
    </update>
    <update id="updateInRepoTime">
        update t_repo_record set create_time = #{createTime} where record_id =#{recordId}
    </update>
</mapper>