Spring(16):新增功能:在超市订单系统中实现订单表的查询(采用MapperFactoryBean)

本文主要是介绍Spring(16):新增功能:在超市订单系统中实现订单表的查询(采用MapperFactoryBean),希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

2018/1/2

功能描述:

(1)实现按条件查询订单表Bill,查询条件如下:

1 商品名称 2 供应商  3  是否付款

(2)结果列显示如下:

订单编码、商品名称、供应商名称、账单金额、是否付款、创建时间

(3)使用resultMap做显示列表字段的自定义映射,

(4)采用MapperFactoryBean;

 

以下是解决思路和过程;

【0】文件框架和jar包:

图1

图2

 

【1】新功能肯定有新的实体类,在\com\smbms\entities包下,新建Bill.java:

(留意 providerName 属性,为什么会出现呢?在下面的传参步骤【6】讲到)

 

package com.smbms.entities;import java.util.Date;public class Bill {private Integer id;private String billCode;private String produceName;private String productDesc;private String productUnit;private Integer productCount;private Integer totalPrice ;private Integer isPayment ;private Integer providerId;private Integer createBy;//userIdprivate Date creationDate;private Integer modifyBy;//userIdprivate Date modifyDate;private String providerName;public String getProviderName() {return providerName;}public void setProviderName(String providerName) {this.providerName = providerName;}public Bill() {}public Bill(Integer id, String billCode, String produceName, String productDesc, String productUnit,Integer productCount, Integer totalPrice, Integer isPayment, Integer providerId, Integer createBy,Date creationDate, Integer modifyBy, Date modifyDate) {super();this.id = id;this.billCode = billCode;this.produceName = produceName;this.productDesc = productDesc;this.productUnit = productUnit;this.productCount = productCount;this.totalPrice = totalPrice;this.isPayment = isPayment;this.providerId = providerId;this.createBy = createBy;this.creationDate = creationDate;this.modifyBy = modifyBy;this.modifyDate = modifyDate;}public Integer getId() {return id;}public void setId(Integer id) {this.id = id;}public String getBillCode() {return billCode;}public void setBillCode(String billCode) {this.billCode = billCode;}public String getProductDesc() {return productDesc;}public void setProductDesc(String productDesc) {this.productDesc = productDesc;}public String getProductUnit() {return productUnit;}public void setProductUnit(String productUnit) {this.productUnit = productUnit;}public Integer getProductCount() {return productCount;}public void setProductCount(Integer productCount) {this.productCount = productCount;}public Integer getTotalPrice() {return totalPrice;}public void setTotalPrice(Integer totalPrice) {this.totalPrice = totalPrice;}public Integer getIsPayment() {return isPayment;}public void setIsPayment(Integer isPayment) {this.isPayment = isPayment;}public Integer getProviderId() {return providerId;}public void setProviderId(Integer providerId) {this.providerId = providerId;}public Integer getCreateBy() {return createBy;}public void setCreateBy(Integer createBy) {this.createBy = createBy;}public Date getCreationDate() {return creationDate;}public void setCreationDate(Date creationDate) {this.creationDate = creationDate;}public Integer getModifyBy() {return modifyBy;}public void setModifyBy(Integer modifyBy) {this.modifyBy = modifyBy;}public Date getModifyDate() {return modifyDate;}public void setModifyDate(Date modifyDate) {this.modifyDate = modifyDate;}@Overridepublic String toString() {return "Bill [id=" + id + ", billCode=" + billCode + ", produceName=" + produceName + ", productDesc="+ productDesc + ", productUnit=" + productUnit + ", productCount=" + productCount + ", totalPrice="+ totalPrice + ", isPayment=" + isPayment + ", providerId=" + providerId + ", createBy=" + createBy+ ", creationDate=" + creationDate + ", modifyBy=" + modifyBy + ", modifyDate=" + modifyDate + "]";}public String getProduceName() {return produceName;}public void setProduceName(String produceName) {this.produceName = produceName;}}

 

 

【2】在\com\smbms\dao 包,新建接口文件 BillMapper.java:

 

package com.smbms.dao;import java.util.List;
import java.util.Map;import com.smbms.entities.Bill;public interface BillMapper {public List<Bill> billShow();
//	public List<Bill> billShowByCondition(Map<String,String> billMap);//注释掉这行public List<Bill> billShowByCondition(Bill bill);
}

 

 

 

 

 

【3】在\com\smbms\dao 包,新建sql映射文件 BillMapper.xml:

(使用select 标签,以及resultMap标签)

 

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapperPUBLIC "-//mybatis.org//DTD Mapper 3.0//EN""http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.smbms.dao.BillMapper"><select id="billShow" resultType="com.smbms.entities.Bill">select * from smbms_bill</select><select id="billShowByCondition" resultMap="resultSet"parameterType="com.smbms.entities.Bill">select b.billCode,b.produceName,p.proName,b.totalPrice,b.isPayment,b.creationDate from smbms_bill b,smbms_provider pwhere b.produceName=#{produceName} and b.providerId=#{providerId}and b.isPayment=#{isPayment}and b.providerId=p.id</select><resultMap type="com.smbms.entities.Bill" id="resultSet"><result property="billCode" column="billCode"/><result property="produceName" column="produceName"/>  <result property="totalPrice" column="totalPrice"/>  <result property="isPayment" column="isPayment"/>  <result property="creationDate" column="creationDate"/>  </resultMap>
</mapper> 

 

 

 

【4】因为使用了MapperFactoryBean,故而不需要添加接口文件 BillMapper.java的实现类,只需要简单的在Spring配置文件添加几行配置,

(当然前提是 将数据源、sqlSessionfactory也配置好了):

配置文件 applicationContext-mybatis.xml,路径在src源文件下:

 

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xmlns:context="http://www.springframework.org/schema/context"xmlns:aop="http://www.springframework.org/schema/aop"xmlns:tx="http://www.springframework.org/schema/tx"xmlns:p="http://www.springframework.org/schema/p"xsi:schemaLocation="http://www.springframework.org/schema/beanshttp://www.springframework.org/schema/beans/spring-beans-4.2.xsdhttp://www.springframework.org/schema/aophttp://www.springframework.org/schema/aop/spring-aop-4.2.xsdhttp://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd"><!-- 数据源配置 --><bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource"><property name="driverClassName" value="com.mysql.jdbc.Driver"></property><property name="url"><value><![CDATA[jdbc:mysql://127.0.0.1:3306/test?useUnicode=true&characterEncoding=utf-8]]></value></property><property name="username" value="root"></property><property name="password" value=""></property>    </bean><!-- SqlSessionFactoryBean 配置 --><bean id="sqlSessionFactory"class="org.mybatis.spring.SqlSessionFactoryBean"><!-- 引用数据源组件 --><property name="dataSource" ref="dataSource"></property><!-- 引用Mybatis配置文件的配置 --><property name="configLocation" value="classpath:mybatis-config.xml"></property></bean><!-- 配置DAO-bill,使用 MapperFactoryBean 注册映射器实现 --><bean id="billMapper" class="org.mybatis.spring.mapper.MapperFactoryBean"><property name="mapperInterface" value="com.smbms.dao.BillMapper"></property><property name="sqlSessionFactory" ref="sqlSessionFactory"></property></bean>	</beans>

 

 

以上,DAO层的实现由配置文件的Bean标签实现了,从而可以被Service层组装使用。


【5】Service层接口文件、实现类以及配置信息:

在\com\smbms\service包 , 新建接口文件BillService.java:

 

package com.smbms.service;import java.util.List;
import java.util.Map;import com.smbms.entities.Bill;public interface BillService {public List<Bill> findBillsWithConditions();public List<Bill> findBillsWithConditionsByThressConditions(Bill bill);}

 

 

在\com\smbms\service包 , 新建接口实现类BillServiceImpl.java:

 

package com.smbms.service;import java.util.List;
import java.util.Map;import com.smbms.dao.BillMapper;
import com.smbms.entities.Bill;public class BillServiceImpl implements BillService {private BillMapper billMapper;@Overridepublic List<Bill> findBillsWithConditions() {return billMapper.billShow();}@Overridepublic List<Bill> findBillsWithConditionsByThressConditions(Bill bill) {return billMapper.billShowByCondition(bill);}public BillServiceImpl() {}public BillServiceImpl(BillMapper billMapper) {this.billMapper = billMapper;}}

 

 

配置文件 applicationContext-mybatis.xml添加以下信息,路径在src源文件下:

 

    <!-- 配置bill业务Bean ,构造器注入,一定要有带参构造函数--><bean id="billService" class="com.smbms.service.BillServiceImpl"><constructor-arg name="billMapper" ref="billMapper" ></constructor-arg></bean>

 

 

 

【6】编写单元测试BillServiceImplTest.java:

 

package com.smbms.service;import java.util.List;import org.junit.Test;
import org.springframework.context.support.ClassPathXmlApplicationContext;import com.smbms.entities.Bill;public class BillServiceImplTest {@Testpublic void test() {System.out.println("start..");System.out.println("----------------1----------------");@SuppressWarnings("resource")ClassPathXmlApplicationContext ctx = new ClassPathXmlApplicationContext("applicationContext-mybatis.xml");BillService billService = (BillService)ctx.getBean("billService");List<Bill> bills = billService.findBillsWithConditions();for(Bill b:bills){System.out.println(b.toString());}System.out.println("--------------2-----------");
//		HashMap<String, String> billMap = new HashMap<String,String>();
//		billMap.put("produceName", "apple");
//		billMap.put("providerId","1");
//		billMap.put("isPayment", "2");Bill bill = new Bill();bill.setProviderId(1);bill.setProduceName("apple");bill.setIsPayment(2);bills = billService.findBillsWithConditionsByThressConditions(bill);for(Bill b:bills){System.out.println(b.toString());}}}


这样,所有工作都完成了。

 

 

【7】输出结果:

 

DEBUG 01-02 20:54:44,099 JDBC Connection [jdbc:mysql://127.0.0.1:3306/test?useUnicode=true&characterEncoding=utf-8, UserName=root@localhost, MySQL Connector Java] will not be managed by Spring  (JakartaCommonsLoggingImpl.java:54) 
DEBUG 01-02 20:54:44,132 ==>  Preparing: select * from smbms_bill   (JakartaCommonsLoggingImpl.java:54) 
DEBUG 01-02 20:54:44,212 ==> Parameters:   (JakartaCommonsLoggingImpl.java:54) 
DEBUG 01-02 20:54:44,741 <==    Columns: id, billCode, produceName, produceDesc, produceUint, produceCount, totalPrice, isPayment, createBy, creationDate, modifyBy, modifyDate, providerId  (JakartaCommonsLoggingImpl.java:59) 
DEBUG 01-02 20:54:44,742 <==        Row: 1, 001, apple, fruit, individual, 100.00, 100.00, 2, 1, 2018-01-02 11:09:20.0, null, null, 1  (JakartaCommonsLoggingImpl.java:59) 
DEBUG 01-02 20:54:44,769 <==        Row: 2, 002, banana, fruit, individual, 200.00, 100.00, 2, 1, 2018-01-02 11:26:10.0, null, null, 1  (JakartaCommonsLoggingImpl.java:59) 
DEBUG 01-02 20:54:44,770 <==      Total: 2  (JakartaCommonsLoggingImpl.java:54) 
DEBUG 01-02 20:54:44,773 Closing non transactional SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@5c33f1a9]  (JakartaCommonsLoggingImpl.java:54) 
DEBUG 01-02 20:54:44,774 Returning JDBC Connection to DataSource  (DataSourceUtils.java:327) 
Bill [id=1, billCode=001, produceName=apple, productDesc=null, productUnit=null, productCount=null, totalPrice=100, isPayment=2, providerId=1, createBy=1, creationDate=Tue Jan 02 11:09:20 CST 2018, modifyBy=null, modifyDate=null]
Bill [id=2, billCode=002, produceName=banana, productDesc=null, productUnit=null, productCount=null, totalPrice=100, isPayment=2, providerId=1, createBy=1, creationDate=Tue Jan 02 11:26:10 CST 2018, modifyBy=null, modifyDate=null]
--------------2-----------
DEBUG 01-02 20:54:44,775 Creating a new SqlSession  (JakartaCommonsLoggingImpl.java:54) 
DEBUG 01-02 20:54:44,775 SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@37883b97] was not registered for synchronization because synchronization is not active  (JakartaCommonsLoggingImpl.java:54) 
DEBUG 01-02 20:54:44,776 Fetching JDBC Connection from DataSource  (DataSourceUtils.java:110) 
DEBUG 01-02 20:54:44,777 JDBC Connection [jdbc:mysql://127.0.0.1:3306/test?useUnicode=true&characterEncoding=utf-8, UserName=root@localhost, MySQL Connector Java] will not be managed by Spring  (JakartaCommonsLoggingImpl.java:54) 
DEBUG 01-02 20:54:44,777 ==>  Preparing: select b.billCode,b.produceName,p.proName,b.totalPrice,b.isPayment,b.creationDate from smbms_bill b,smbms_provider p where b.produceName=? and b.providerId=? and b.isPayment=? and b.providerId=p.id   (JakartaCommonsLoggingImpl.java:54) 
DEBUG 01-02 20:54:44,778 ==> Parameters: apple(String), 1(Integer), 2(Integer)  (JakartaCommonsLoggingImpl.java:54) 
DEBUG 01-02 20:54:44,870 <==    Columns: billCode, produceName, proName, totalPrice, isPayment, creationDate  (JakartaCommonsLoggingImpl.java:59) 
DEBUG 01-02 20:54:44,872 <==        Row: 001, apple, JingDong, 100.00, 2, 2018-01-02 11:09:20.0  (JakartaCommonsLoggingImpl.java:59) 
DEBUG 01-02 20:54:44,874 <==      Total: 1  (JakartaCommonsLoggingImpl.java:54) 
DEBUG 01-02 20:54:44,875 Closing non transactional SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@37883b97]  (JakartaCommonsLoggingImpl.java:54) 
DEBUG 01-02 20:54:44,875 Returning JDBC Connection to DataSource  (DataSourceUtils.java:327) 
Bill [id=null, billCode=001, produceName=apple, productDesc=null, productUnit=null, productCount=null, totalPrice=100, isPayment=2, providerId=null, createBy=null, creationDate=Tue Jan 02 11:09:20 CST 2018, modifyBy=null, modifyDate=null]
Row: 1, 001, apple, fruit, individual, 100.00, 100.00, 2, 1, 2018-01-02 11:09:20.0, null, null, 1  (JakartaCommonsLoggingImpl.java:59) 
DEBUG 01-02 20:54:44,769 <==        Row: 2, 002, banana, fruit, individual, 200.00, 100.00, 2, 1, 2018-01-02 11:26:10.0, null, null, 1  (JakartaCommonsLoggingImpl.java:59) 
DEBUG 01-02 20:54:44,770 <==      Total: 2  (JakartaCommonsLoggingImpl.java:54) 
DEBUG 01-02 20:54:44,773 Closing non transactional SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@5c33f1a9]  (JakartaCommonsLoggingImpl.java:54) 
DEBUG 01-02 20:54:44,774 Returning JDBC Connection to DataSource  (DataSourceUtils.java:327) 
Bill [id=1, billCode=001, produceName=apple, productDesc=null, productUnit=null, productCount=null, totalPrice=100, isPayment=2, providerId=1, createBy=1, creationDate=Tue Jan 02 11:09:20 CST 2018, modifyBy=null, modifyDate=null]
Bill [id=2, billCode=002, produceName=banana, productDesc=null, productUnit=null, productCount=null, totalPrice=100, isPayment=2, providerId=1, createBy=1, creationDate=Tue Jan 02 11:26:10 CST 2018, modifyBy=null, modifyDate=null]
--------------2-----------
DEBUG 01-02 20:54:44,775 Creating a new SqlSession  (JakartaCommonsLoggingImpl.java:54) 
DEBUG 01-02 20:54:44,775 SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@37883b97] was not registered for synchronization because synchronization is not active  (JakartaCommonsLoggingImpl.java:54) 
DEBUG 01-02 20:54:44,776 Fetching JDBC Connection from DataSource  (DataSourceUtils.java:110) 
DEBUG 01-02 20:54:44,777 JDBC Connection [jdbc:mysql://127.0.0.1:3306/test?useUnicode=true&characterEncoding=utf-8, UserName=root@localhost, MySQL Connector Java] will not be managed by Spring  (JakartaCommonsLoggingImpl.java:54) 
DEBUG 01-02 20:54:44,777 ==>  Preparing: select b.billCode,b.produceName,p.proName,b.totalPrice,b.isPayment,b.creationDate from smbms_bill b,smbms_provider p where b.produceName=? and b.providerId=? and b.isPayment=? and b.providerId=p.id   (JakartaCommonsLoggingImpl.java:54) 
DEBUG 01-02 20:54:44,778 ==> Parameters: apple(String), 1(Integer), 2(Integer)  (JakartaCommonsLoggingImpl.java:54) 
DEBUG 01-02 20:54:44,870 <==    Columns: billCode, produceName, proName, totalPrice, isPayment, creationDate  (JakartaCommonsLoggingImpl.java:59) 
DEBUG 01-02 20:54:44,872 <==        Row: 001, apple, JingDong, 100.00, 2, 2018-01-02 11:09:20.0  (JakartaCommonsLoggingImpl.java:59) 
DEBUG 01-02 20:54:44,874 <==      Total: 1  (JakartaCommonsLoggingImpl.java:54) 
DEBUG 01-02 20:54:44,875 Closing non transactional SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@37883b97]  (JakartaCommonsLoggingImpl.java:54) 
DEBUG 01-02 20:54:44,875 Returning JDBC Connection to DataSource  (DataSourceUtils.java:327) 
Bill [id=null, billCode=001, produceName=apple, productDesc=null, productUnit=null, productCount=null, totalPrice=100, isPayment=2, providerId=null, createBy=null, creationDate=Tue Jan 02 11:09:20 CST 2018, modifyBy=null, modifyDate=null]

 

 

 

 

 

【8】要点解释:

1、在上面的代码可以看到,我还试了一下Map作为传参,这个也是可以的。

2、但我最后选择使用Bill对象传参,这样的好处是在返回值时,直接对应了设定的对象,例如数据库的smbms_bill表并没有peoviderName这一字段,但是返回值利用resultMap,将另一个表的column 字段'providerName' 对应了Bill对象的peoviderName参数。方便最后的显示打印。

 

【9】工程说明.txt:

 

(1)这是Mybatis和Spring整合练习的工程;
(2)实际使用有3个包:dao、entities、service;
(3)Mybatis配置文件内容很简洁,Spring完成大部分配置管理;
(4)通过SQLSessionTemplate的实现类对数据库进行操作;
(5)配置DAO组件并进入SqlSessionTemplate实例;
(6)配置业务Bean并注入DAO实例 ;(7)完成的功能是:查询provider的列表,模糊查询供应商信息;
(8)与smbms05MybatisSpring的区别:去掉了实现类ProviderMapperImpl;仅仅保留ProviderMapper
接口和相关SQL映射文件,通过MapperFactoryBean注入给业务组件。(9)此外,也新增了一个User查询,照壶画瓢;
(10)smbms06是使用MapperFactoryBean注入映射器,而smbms07是更加方便的使用MapperScannerConfigurer注入映射器。(11)smbms08增加新功能,实现按条件查询订单表Bill;使用resultMap做显示列表字段的自定义映射,使用Map传参,采用MapperFactoryBean注册映射器实现。[bill 和 provider 表]

 

 

 

此外,可以使用采用MapperScannerConfigurer映射器改进,可以参考下一篇博文:《Spring(17):新增功能:在超市订单系统中实现订单表的查询(采用MapperScannerConfigurer)》

 

欢迎扫二维码关注公众号,获取技术干货

 

这篇关于Spring(16):新增功能:在超市订单系统中实现订单表的查询(采用MapperFactoryBean)的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/569190

相关文章

JVM 的类初始化机制

前言 当你在 Java 程序中new对象时,有没有考虑过 JVM 是如何把静态的字节码(byte code)转化为运行时对象的呢,这个问题看似简单,但清楚的同学相信也不会太多,这篇文章首先介绍 JVM 类初始化的机制,然后给出几个易出错的实例来分析,帮助大家更好理解这个知识点。 JVM 将字节码转化为运行时对象分为三个阶段,分别是:loading 、Linking、initialization

Spring Security 基于表达式的权限控制

前言 spring security 3.0已经可以使用spring el表达式来控制授权,允许在表达式中使用复杂的布尔逻辑来控制访问的权限。 常见的表达式 Spring Security可用表达式对象的基类是SecurityExpressionRoot。 表达式描述hasRole([role])用户拥有制定的角色时返回true (Spring security默认会带有ROLE_前缀),去

浅析Spring Security认证过程

类图 为了方便理解Spring Security认证流程,特意画了如下的类图,包含相关的核心认证类 概述 核心验证器 AuthenticationManager 该对象提供了认证方法的入口,接收一个Authentiaton对象作为参数; public interface AuthenticationManager {Authentication authenticate(Authenti

Spring Security--Architecture Overview

1 核心组件 这一节主要介绍一些在Spring Security中常见且核心的Java类,它们之间的依赖,构建起了整个框架。想要理解整个架构,最起码得对这些类眼熟。 1.1 SecurityContextHolder SecurityContextHolder用于存储安全上下文(security context)的信息。当前操作的用户是谁,该用户是否已经被认证,他拥有哪些角色权限…这些都被保

Spring Security基于数据库验证流程详解

Spring Security 校验流程图 相关解释说明(认真看哦) AbstractAuthenticationProcessingFilter 抽象类 /*** 调用 #requiresAuthentication(HttpServletRequest, HttpServletResponse) 决定是否需要进行验证操作。* 如果需要验证,则会调用 #attemptAuthentica

Spring Security 从入门到进阶系列教程

Spring Security 入门系列 《保护 Web 应用的安全》 《Spring-Security-入门(一):登录与退出》 《Spring-Security-入门(二):基于数据库验证》 《Spring-Security-入门(三):密码加密》 《Spring-Security-入门(四):自定义-Filter》 《Spring-Security-入门(五):在 Sprin

Java架构师知识体认识

源码分析 常用设计模式 Proxy代理模式Factory工厂模式Singleton单例模式Delegate委派模式Strategy策略模式Prototype原型模式Template模板模式 Spring5 beans 接口实例化代理Bean操作 Context Ioc容器设计原理及高级特性Aop设计原理Factorybean与Beanfactory Transaction 声明式事物

不懂推荐算法也能设计推荐系统

本文以商业化应用推荐为例,告诉我们不懂推荐算法的产品,也能从产品侧出发, 设计出一款不错的推荐系统。 相信很多新手产品,看到算法二字,多是懵圈的。 什么排序算法、最短路径等都是相对传统的算法(注:传统是指科班出身的产品都会接触过)。但对于推荐算法,多数产品对着网上搜到的资源,都会无从下手。特别当某些推荐算法 和 “AI”扯上关系后,更是加大了理解的难度。 但,不了解推荐算法,就无法做推荐系

基于人工智能的图像分类系统

目录 引言项目背景环境准备 硬件要求软件安装与配置系统设计 系统架构关键技术代码示例 数据预处理模型训练模型预测应用场景结论 1. 引言 图像分类是计算机视觉中的一个重要任务,目标是自动识别图像中的对象类别。通过卷积神经网络(CNN)等深度学习技术,我们可以构建高效的图像分类系统,广泛应用于自动驾驶、医疗影像诊断、监控分析等领域。本文将介绍如何构建一个基于人工智能的图像分类系统,包括环境

水位雨量在线监测系统概述及应用介绍

在当今社会,随着科技的飞速发展,各种智能监测系统已成为保障公共安全、促进资源管理和环境保护的重要工具。其中,水位雨量在线监测系统作为自然灾害预警、水资源管理及水利工程运行的关键技术,其重要性不言而喻。 一、水位雨量在线监测系统的基本原理 水位雨量在线监测系统主要由数据采集单元、数据传输网络、数据处理中心及用户终端四大部分构成,形成了一个完整的闭环系统。 数据采集单元:这是系统的“眼睛”,