From 5a0ab9bfacd5fbb37aad814bd0d6c68908d5b540 Mon Sep 17 00:00:00 2001 From: RuoYi Date: Mon, 6 Aug 2018 09:00:12 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=AF=E6=8C=81=E5=A4=9A=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E6=BA=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 8 +- src/main/java/com/ruoyi/RuoYiApplication.java | 5 +- .../com/ruoyi/framework/aspectj/DsAspect.java | 60 +++++++ .../framework/aspectj/lang/annotation/Ds.java | 23 +++ .../aspectj/lang/constant/DataSourceName.java | 16 ++ .../ruoyi/framework/config/DruidConfig.java | 160 +++--------------- .../datasource/DataSourceContextHolder.java | 35 ++++ .../datasource/DynamicDataSource.java | 27 +++ .../shiro/service/PasswordService.java | 10 -- src/main/resources/application-druid.yml | 75 ++++---- .../ruoyi/common/utils/AddressUtilsTest.java | 40 ----- .../dept/service/DeptServiceImplTest.java | 124 -------------- 12 files changed, 234 insertions(+), 349 deletions(-) create mode 100644 src/main/java/com/ruoyi/framework/aspectj/DsAspect.java create mode 100644 src/main/java/com/ruoyi/framework/aspectj/lang/annotation/Ds.java create mode 100644 src/main/java/com/ruoyi/framework/aspectj/lang/constant/DataSourceName.java create mode 100644 src/main/java/com/ruoyi/framework/datasource/DataSourceContextHolder.java create mode 100644 src/main/java/com/ruoyi/framework/datasource/DynamicDataSource.java delete mode 100644 src/test/java/com/ruoyi/common/utils/AddressUtilsTest.java delete mode 100644 src/test/java/com/ruoyi/project/system/dept/service/DeptServiceImplTest.java diff --git a/pom.xml b/pom.xml index 0fe7d330..f8fe87a1 100644 --- a/pom.xml +++ b/pom.xml @@ -114,10 +114,10 @@ - com.alibaba - druid - ${druid.version} - + com.alibaba + druid-spring-boot-starter + ${druid.version} + diff --git a/src/main/java/com/ruoyi/RuoYiApplication.java b/src/main/java/com/ruoyi/RuoYiApplication.java index dd0f8b1c..90bf0314 100644 --- a/src/main/java/com/ruoyi/RuoYiApplication.java +++ b/src/main/java/com/ruoyi/RuoYiApplication.java @@ -3,15 +3,14 @@ package com.ruoyi; import org.mybatis.spring.annotation.MapperScan; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; -import org.springframework.transaction.annotation.EnableTransactionManagement; +import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration; /** * 启动程序 * * @author ruoyi */ -@SpringBootApplication -@EnableTransactionManagement +@SpringBootApplication(exclude = { DataSourceAutoConfiguration.class }) @MapperScan("com.ruoyi.project.*.*.mapper") public class RuoYiApplication { diff --git a/src/main/java/com/ruoyi/framework/aspectj/DsAspect.java b/src/main/java/com/ruoyi/framework/aspectj/DsAspect.java new file mode 100644 index 00000000..76c4e3cc --- /dev/null +++ b/src/main/java/com/ruoyi/framework/aspectj/DsAspect.java @@ -0,0 +1,60 @@ +package com.ruoyi.framework.aspectj; + +import java.lang.reflect.Method; +import org.aspectj.lang.ProceedingJoinPoint; +import org.aspectj.lang.annotation.Around; +import org.aspectj.lang.annotation.Aspect; +import org.aspectj.lang.annotation.Pointcut; +import org.aspectj.lang.reflect.MethodSignature; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.core.annotation.Order; +import org.springframework.stereotype.Component; +import com.ruoyi.common.utils.StringUtils; +import com.ruoyi.framework.aspectj.lang.annotation.Ds; +import com.ruoyi.framework.datasource.DataSourceContextHolder; + +/** + * 多数据源处理 + * + * @author ruoyi + */ +@Aspect +@Order(1) +@Component +public class DsAspect +{ + protected Logger logger = LoggerFactory.getLogger(getClass()); + + @Pointcut("@annotation(com.ruoyi.framework.aspectj.lang.annotation.Ds)") + public void dataSourcePointCut() + { + + } + + @Around("dataSourcePointCut()") + public Object around(ProceedingJoinPoint point) throws Throwable + { + MethodSignature signature = (MethodSignature) point.getSignature(); + + Method method = signature.getMethod(); + + if (method.isAnnotationPresent(Ds.class)) + { + Ds dataSource = method.getAnnotation(Ds.class); + if (StringUtils.isNotNull(dataSource) && StringUtils.isNotEmpty(dataSource.name())) + { + DataSourceContextHolder.setDB(dataSource.name()); + } + } + + try + { + return point.proceed(); + } + finally + { + DataSourceContextHolder.clearDB(); + } + } +} diff --git a/src/main/java/com/ruoyi/framework/aspectj/lang/annotation/Ds.java b/src/main/java/com/ruoyi/framework/aspectj/lang/annotation/Ds.java new file mode 100644 index 00000000..64f67472 --- /dev/null +++ b/src/main/java/com/ruoyi/framework/aspectj/lang/annotation/Ds.java @@ -0,0 +1,23 @@ +package com.ruoyi.framework.aspectj.lang.annotation; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +import com.ruoyi.framework.aspectj.lang.constant.DataSourceName; + +/** + * 自定义多数据源切换注解 + * + * @author ruoyi + */ +@Target(ElementType.METHOD) +@Retention(RetentionPolicy.RUNTIME) +public @interface Ds +{ + /** + * 切换数据源值 + */ + String name() default DataSourceName.MASTER; +} diff --git a/src/main/java/com/ruoyi/framework/aspectj/lang/constant/DataSourceName.java b/src/main/java/com/ruoyi/framework/aspectj/lang/constant/DataSourceName.java new file mode 100644 index 00000000..cffeb1e0 --- /dev/null +++ b/src/main/java/com/ruoyi/framework/aspectj/lang/constant/DataSourceName.java @@ -0,0 +1,16 @@ +package com.ruoyi.framework.aspectj.lang.constant; + +/** + * 多数据源别名 + * + * @author ruoyi + * + */ +public class DataSourceName +{ + /** 主库 */ + public static final String MASTER = "master"; + + /** 从库 */ + public static final String SLAVE = "slave"; +} diff --git a/src/main/java/com/ruoyi/framework/config/DruidConfig.java b/src/main/java/com/ruoyi/framework/config/DruidConfig.java index a5553487..86f2eab1 100644 --- a/src/main/java/com/ruoyi/framework/config/DruidConfig.java +++ b/src/main/java/com/ruoyi/framework/config/DruidConfig.java @@ -1,161 +1,47 @@ package com.ruoyi.framework.config; -import java.sql.SQLException; +import java.util.HashMap; +import java.util.Map; import javax.sql.DataSource; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.boot.web.servlet.FilterRegistrationBean; -import org.springframework.boot.web.servlet.ServletRegistrationBean; +import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; +import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Primary; -import com.alibaba.druid.pool.DruidDataSource; -import com.alibaba.druid.support.http.StatViewServlet; -import com.alibaba.druid.support.http.WebStatFilter; +import com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceBuilder; +import com.ruoyi.framework.aspectj.lang.constant.DataSourceName; +import com.ruoyi.framework.datasource.DynamicDataSource; /** - * Druid数据库信息配置加载 + * druid 配置多数据源 * * @author ruoyi */ @Configuration public class DruidConfig { - private static final Logger log = LoggerFactory.getLogger(DruidConfig.class); - - @Value("${spring.datasource.url}") - private String dbUrl; - - @Value("${spring.datasource.username}") - private String username; - - @Value("${spring.datasource.password}") - private String password; - - @Value("${spring.datasource.driverClassName}") - private String driverClassName; - - @Value("${spring.datasource.initialSize}") - private int initialSize; - - @Value("${spring.datasource.minIdle}") - private int minIdle; - - @Value("${spring.datasource.maxActive}") - private int maxActive; - - @Value("${spring.datasource.maxWait}") - private int maxWait; - - @Value("${spring.datasource.timeBetweenEvictionRunsMillis}") - private int timeBetweenEvictionRunsMillis; - - @Value("${spring.datasource.minEvictableIdleTimeMillis}") - private int minEvictableIdleTimeMillis; - - @Value("${spring.datasource.validationQuery}") - private String validationQuery; - - @Value("${spring.datasource.testWhileIdle}") - private boolean testWhileIdle; - - @Value("${spring.datasource.testOnBorrow}") - private boolean testOnBorrow; - - @Value("${spring.datasource.testOnReturn}") - private boolean testOnReturn; - - @Value("${spring.datasource.poolPreparedStatements}") - private boolean poolPreparedStatements; - - @Value("${spring.datasource.maxPoolPreparedStatementPerConnectionSize}") - private int maxPoolPreparedStatementPerConnectionSize; - - @Value("${spring.datasource.filters}") - private String filters; - - @Value("{spring.datasource.connectionProperties}") - private String connectionProperties; - - @Bean(initMethod = "init", destroyMethod = "close") /** 声明其为Bean实例 */ - @Primary /** 在同样的DataSource中,首先使用被标注的DataSource */ - public DataSource dataSource() + @Bean + @ConfigurationProperties("spring.datasource.druid.master") + public DataSource masterDataSource() { - DruidDataSource datasource = new DruidDataSource(); - - datasource.setUrl(this.dbUrl); - datasource.setUsername(username); - datasource.setPassword(password); - datasource.setDriverClassName(driverClassName); - - /** configuration */ - datasource.setInitialSize(initialSize); - datasource.setMinIdle(minIdle); - datasource.setMaxActive(maxActive); - datasource.setMaxWait(maxWait); - datasource.setTimeBetweenEvictionRunsMillis(timeBetweenEvictionRunsMillis); - datasource.setMinEvictableIdleTimeMillis(minEvictableIdleTimeMillis); - datasource.setValidationQuery(validationQuery); - datasource.setTestWhileIdle(testWhileIdle); - datasource.setTestOnBorrow(testOnBorrow); - datasource.setTestOnReturn(testOnReturn); - datasource.setPoolPreparedStatements(poolPreparedStatements); - datasource.setMaxPoolPreparedStatementPerConnectionSize(maxPoolPreparedStatementPerConnectionSize); - try - { - datasource.setFilters(filters); - } - catch (SQLException e) - { - log.error("druid configuration initialization filter", e); - } - datasource.setConnectionProperties(connectionProperties); - - return datasource; + return DruidDataSourceBuilder.create().build(); } - /** - * 注册一个StatViewServlet 相当于在web.xml中声明了一个servlet - */ - @SuppressWarnings({ "rawtypes", "unchecked" }) @Bean - public ServletRegistrationBean druidServlet() + @ConfigurationProperties("spring.datasource.druid.slave") + @ConditionalOnProperty(prefix = "spring.datasource.druid.slave", name = "open", havingValue = "true") + public DataSource slaveDataSource() { - ServletRegistrationBean reg = new ServletRegistrationBean(); - reg.setServlet(new StatViewServlet()); - reg.addUrlMappings("/monitor/druid/*"); - /** 白名单 */ - // reg.addInitParameter("allow", "10.211.61.45,127.0.0.1,123.207.20.136"); - /** IP黑名单(共同存在时,deny优先于allow) */ - // reg.addInitParameter("deny", "10.211.61.4"); - /** 是否能够重置数据 禁用HTML页面上的“Reset All”功能 */ - reg.addInitParameter("resetEnable", "false"); - return reg; + return DruidDataSourceBuilder.create().build(); } - /** - * 注册一个:filterRegistrationBean 相当于在web.xml中声明了一个Filter - */ - @SuppressWarnings({ "rawtypes", "unchecked" }) - @Bean - public FilterRegistrationBean filterRegistrationBean() + @Bean(name = "dynamicDataSource") + @Primary + public DynamicDataSource dataSource(DataSource masterDataSource, DataSource slaveDataSource) { - FilterRegistrationBean filterRegistrationBean = new FilterRegistrationBean(); - filterRegistrationBean.setFilter(new WebStatFilter()); - /** 添加过滤规则. */ - filterRegistrationBean.addUrlPatterns("/*"); - /** 监控选项滤器 */ - filterRegistrationBean.addInitParameter("DruidWebStatFilter", "/*"); - /** 添加不需要忽略的格式信息. */ - filterRegistrationBean.addInitParameter("exclusions", "*.js,*.gif,*.jpg,*.png,*.css,*.ico,/monitor/druid/*"); - /** 配置profileEnable能够监控单个url调用的sql列表 */ - filterRegistrationBean.addInitParameter("profileEnable", "true"); - /** 当前的cookie的用户 */ - filterRegistrationBean.addInitParameter("principalCookieName", "USER_COOKIE"); - /** 当前的session的用户 */ - filterRegistrationBean.addInitParameter("principalSessionName", "USER_SESSION"); - return filterRegistrationBean; + Map targetDataSources = new HashMap<>(); + targetDataSources.put(DataSourceName.MASTER, masterDataSource); + targetDataSources.put(DataSourceName.SLAVE, slaveDataSource); + return new DynamicDataSource(masterDataSource, targetDataSources); } } diff --git a/src/main/java/com/ruoyi/framework/datasource/DataSourceContextHolder.java b/src/main/java/com/ruoyi/framework/datasource/DataSourceContextHolder.java new file mode 100644 index 00000000..97a85a09 --- /dev/null +++ b/src/main/java/com/ruoyi/framework/datasource/DataSourceContextHolder.java @@ -0,0 +1,35 @@ +package com.ruoyi.framework.datasource; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * 当前线程数据源 + * + * @author ruoyi + */ +public class DataSourceContextHolder +{ + public static final Logger log = LoggerFactory.getLogger(DataSourceContextHolder.class); + + private static final ThreadLocal contextHolder = new ThreadLocal<>(); + + // 设置数据源名 + public static void setDB(String dbType) + { + log.info("切换到{}数据源", dbType); + contextHolder.set(dbType); + } + + // 获取数据源名 + public static String getDB() + { + return contextHolder.get(); + } + + public static void clearDB() + { + contextHolder.remove(); + } + +} diff --git a/src/main/java/com/ruoyi/framework/datasource/DynamicDataSource.java b/src/main/java/com/ruoyi/framework/datasource/DynamicDataSource.java new file mode 100644 index 00000000..04fd8c4b --- /dev/null +++ b/src/main/java/com/ruoyi/framework/datasource/DynamicDataSource.java @@ -0,0 +1,27 @@ +package com.ruoyi.framework.datasource; + +import java.util.Map; +import javax.sql.DataSource; +import org.springframework.jdbc.datasource.lookup.AbstractRoutingDataSource; + +/** + * 动态数据源 + * + * @author ruoyi + */ +public class DynamicDataSource extends AbstractRoutingDataSource +{ + public DynamicDataSource(DataSource defaultTargetDataSource, Map targetDataSources) + { + super.setDefaultTargetDataSource(defaultTargetDataSource); + super.setTargetDataSources(targetDataSources); + super.afterPropertiesSet(); + } + + @Override + protected Object determineCurrentLookupKey() + { + return DataSourceContextHolder.getDB(); + } + +} \ No newline at end of file diff --git a/src/main/java/com/ruoyi/framework/shiro/service/PasswordService.java b/src/main/java/com/ruoyi/framework/shiro/service/PasswordService.java index cb145f35..6fa639f9 100644 --- a/src/main/java/com/ruoyi/framework/shiro/service/PasswordService.java +++ b/src/main/java/com/ruoyi/framework/shiro/service/PasswordService.java @@ -87,15 +87,5 @@ public class PasswordService { //System.out.println(new PasswordService().encryptPassword("admin", "admin123", "111111")); //System.out.println(new PasswordService().encryptPassword("ry", "admin123", "222222")); - System.out.println(new PasswordService().encryptPassword("ly", "admin123", "123456")); - System.out.println(new PasswordService().encryptPassword("ce", "admin123", "123456")); - System.out.println(new PasswordService().encryptPassword("zs", "admin123", "123456")); - System.out.println(new PasswordService().encryptPassword("ls", "admin123", "123456")); - System.out.println(new PasswordService().encryptPassword("ww", "admin123", "123456")); - System.out.println(new PasswordService().encryptPassword("zl", "admin123", "123456")); - System.out.println(new PasswordService().encryptPassword("sq", "admin123", "123456")); - System.out.println(new PasswordService().encryptPassword("zb", "admin123", "123456")); - System.out.println(new PasswordService().encryptPassword("wj", "admin123", "123456")); - System.out.println(new PasswordService().encryptPassword("ys", "admin123", "123456")); } } diff --git a/src/main/resources/application-druid.yml b/src/main/resources/application-druid.yml index 1021d0e2..f5dda0f4 100644 --- a/src/main/resources/application-druid.yml +++ b/src/main/resources/application-druid.yml @@ -1,32 +1,45 @@ -#dubbo配置 +#数据源配置 spring: - datasource: - type: com.alibaba.druid.pool.DruidDataSource - driverClassName: com.mysql.jdbc.Driver - #url: jdbc:mysql://10.213.24.45:3306/ry?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true - url: jdbc:mysql://localhost:3306/ry?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true - username: root - password: password - # 初始化大小,最小,最大 - initialSize: 1 - minIdle: 3 - maxActive: 20 - # 配置获取连接等待超时的时间 - maxWait: 60000 - # 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒 - timeBetweenEvictionRunsMillis: 60000 - # 配置一个连接在池中最小生存的时间,单位是毫秒 - minEvictableIdleTimeMillis: 30000 - validationQuery: select 'x' - testWhileIdle: true - testOnBorrow: false - testOnReturn: false - # 打开PSCache,并且指定每个连接上PSCache的大小 - poolPreparedStatements: true - maxPoolPreparedStatementPerConnectionSize: 20 - # 配置监控统计拦截的filters,去掉后监控界面sql无法统计,'wall'用于防火墙 - filters: stat,wall,slf4j - # 通过connectProperties属性来打开mergeSql功能;慢SQL记录 - connectionProperties: druid.stat.mergeSql=true;druid.stat.slowSqlMillis=5000 - # 合并多个DruidDataSource的监控数据 - #useGlobalDataSourceStat: true \ No newline at end of file + datasource: + type: com.alibaba.druid.pool.DruidDataSource + driverClassName: com.mysql.jdbc.Driver + druid: + master: #主库 + url: jdbc:mysql://localhost:3306/ry?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true + username: root + password: password + #slave: #从库 + # open: true + # url: jdbc:mysql://localhost:3306/ry?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true + # username: root + # password: password + # 初始连接数 + initial-size: 10 + # 最大连接池数量 + max-active: 100 + # 最小连接池数量 + min-idle: 10 + # 配置获取连接等待超时的时间 + max-wait: 60000 + # 打开PSCache,并且指定每个连接上PSCache的大小 + pool-prepared-statements: true + max-pool-prepared-statement-per-connection-size: 20 + # 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒 + timeBetweenEvictionRunsMillis: 60000 + # 配置一个连接在池中最小生存的时间,单位是毫秒 + min-evictable-idle-time-millis: 300000 + validation-query: SELECT 1 FROM DUAL + test-while-idle: true + test-on-borrow: false + test-on-return: false + stat-view-servlet: + enabled: true + url-pattern: /monitor/druid/* + filter: + stat: + log-slow-sql: true + slow-sql-millis: 1000 + merge-sql: false + wall: + config: + multi-statement-allow: true \ No newline at end of file diff --git a/src/test/java/com/ruoyi/common/utils/AddressUtilsTest.java b/src/test/java/com/ruoyi/common/utils/AddressUtilsTest.java deleted file mode 100644 index 8d60587e..00000000 --- a/src/test/java/com/ruoyi/common/utils/AddressUtilsTest.java +++ /dev/null @@ -1,40 +0,0 @@ -package com.ruoyi.common.utils; - -import org.junit.After; -import org.junit.Before; -import org.junit.Test; - -/** - * AddressUtils Tester. - * - * @author Leonhardt - * @version 1.0 - * @since 07/22/2018 - */ - -public class AddressUtilsTest -{ - - @Before - public void before() throws Exception - { - } - - @After - public void after() throws Exception - { - } - - /** - * Method: getRealAddressByIP(String ip) - *

- */ - @Test - public void testGetRealAddressByIP() throws Exception - { - // TODO: Test goes here... - String ipAddress = AddressUtils.getRealAddressByIP("121.8.250.1"); - System.out.println(ipAddress); - } - -} diff --git a/src/test/java/com/ruoyi/project/system/dept/service/DeptServiceImplTest.java b/src/test/java/com/ruoyi/project/system/dept/service/DeptServiceImplTest.java deleted file mode 100644 index 9fbb283a..00000000 --- a/src/test/java/com/ruoyi/project/system/dept/service/DeptServiceImplTest.java +++ /dev/null @@ -1,124 +0,0 @@ -package com.ruoyi.project.system.dept.service; - -import org.junit.After; -import org.junit.Assert; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; -import java.util.List; -import java.util.Map; - -/** - * DeptServiceImpl Tester. - * - * @author Leonhardt - * @version 1.0 - * @since 07/22/2018 - */ -@RunWith(SpringJUnit4ClassRunner.class) -@SpringBootTest -public class DeptServiceImplTest -{ - @Autowired - private IDeptService deptService; - - @Before - public void before() throws Exception - { - } - - @After - public void after() throws Exception - { - } - - /** - * Method: selectDeptList(Dept dept) - */ - @Test - public void testSelectDeptList() throws Exception - { - // TODO: Test goes here... - } - - /** - * Method: selectDeptAll() - */ - @Test - public void testSelectDeptAll() throws Exception - { - // TODO: Test goes here... - Assert.assertEquals(deptService.selectDeptAll().size(), 10); - } - - /** - * Method: selectDeptTree() - */ - @Test - public void testSelectDeptTree() throws Exception - { - // TODO: Test goes here... - List> trees = deptService.selectDeptTree(); - trees.stream().forEach(tree -> System.out.println(tree)); - } - - /** - * Method: selectDeptCount(Long parentId) - */ - @Test - public void testSelectDeptCount() throws Exception - { - // TODO: Test goes here... - Assert.assertEquals(10, deptService.selectDeptCount(0L)); - } - - /** - * Method: checkDeptExistUser(Long deptId) - */ - @Test - public void testCheckDeptExistUser() throws Exception - { - // TODO: Test goes here... - } - - /** - * Method: deleteDeptById(Long deptId) - */ - @Test - public void testDeleteDeptById() throws Exception - { - // TODO: Test goes here... - } - - /** - * Method: saveDept(Dept dept) - */ - @Test - public void testSaveDept() throws Exception - { - // TODO: Test goes here... - } - - /** - * Method: selectDeptById(Long deptId) - */ - @Test - public void testSelectDeptById() throws Exception - { - // TODO: Test goes here... - Assert.assertNotNull("若依集团不存在", deptService.selectDeptById(100L)); - } - - /** - * Method: checkDeptNameUnique(Dept dept) - */ - @Test - public void testCheckDeptNameUnique() throws Exception - { - // TODO: Test goes here... - } - -}