更改为构造注入并完善方法注释
This commit is contained in:
@@ -4,12 +4,6 @@
|
||||
*/
|
||||
package com.jeesite.modules.app.db;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.jeesite.common.config.Global;
|
||||
import com.jeesite.common.tests.BaseInitDataTests;
|
||||
import com.jeesite.modules.app.entity.AppComment;
|
||||
@@ -17,6 +11,10 @@ import com.jeesite.modules.app.entity.AppUpgrade;
|
||||
import com.jeesite.modules.app.service.AppCommentService;
|
||||
import com.jeesite.modules.app.service.AppUpgradeService;
|
||||
import com.jeesite.modules.gen.utils.GenUtils;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 初始化APP表及数据
|
||||
@@ -27,6 +25,11 @@ import com.jeesite.modules.gen.utils.GenUtils;
|
||||
@ConditionalOnProperty(name="jeesite.initdata", havingValue="true", matchIfMissing=false)
|
||||
public class InitAppData extends BaseInitDataTests {
|
||||
|
||||
public InitAppData(AppUpgradeService appUpgradeService, AppCommentService appCommentService) {
|
||||
this.appUpgradeService = appUpgradeService;
|
||||
this.appCommentService = appCommentService;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean initData() throws Exception {
|
||||
if (GenUtils.isTableExists(Global.getTablePrefix() + "app_upgrade")) {
|
||||
@@ -41,8 +44,7 @@ public class InitAppData extends BaseInitDataTests {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Autowired
|
||||
private AppUpgradeService appUpgradeService;
|
||||
private final AppUpgradeService appUpgradeService;
|
||||
public void initAppUpgrade() throws Exception{
|
||||
// clearTable(AppUpgrade.class);
|
||||
initExcelData(AppUpgrade.class, params -> {
|
||||
@@ -57,8 +59,7 @@ public class InitAppData extends BaseInitDataTests {
|
||||
});
|
||||
}
|
||||
|
||||
@Autowired
|
||||
private AppCommentService appCommentService;
|
||||
private final AppCommentService appCommentService;
|
||||
public void initAppComment() throws Exception{
|
||||
// clearTable(AppComment.class);
|
||||
initExcelData(AppComment.class, params -> {
|
||||
|
||||
@@ -15,7 +15,6 @@ import com.jeesite.modules.cms.entity.Site;
|
||||
import com.jeesite.modules.cms.service.CategoryService;
|
||||
import com.jeesite.modules.cms.service.SiteService;
|
||||
import com.jeesite.modules.gen.utils.GenUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@@ -28,6 +27,14 @@ import org.springframework.stereotype.Component;
|
||||
@ConditionalOnProperty(name="jeesite.initdata", havingValue="true", matchIfMissing=false)
|
||||
public class InitCmsData extends BaseInitDataTests {
|
||||
|
||||
public InitCmsData(SiteService siteService, CategoryService categoryService,
|
||||
ArticleDao articleDao, ArticleDataDao articleDataDao) {
|
||||
this.siteService = siteService;
|
||||
this.categoryService = categoryService;
|
||||
this.articleDao = articleDao;
|
||||
this.articleDataDao = articleDataDao;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean initData() throws Exception {
|
||||
if (GenUtils.isTableExists(Global.getTablePrefix() + "cms_article")) {
|
||||
@@ -44,8 +51,7 @@ public class InitCmsData extends BaseInitDataTests {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Autowired
|
||||
private SiteService siteService;
|
||||
private final SiteService siteService;
|
||||
public void initSite() throws Exception{
|
||||
initExcelData(Site.class, params -> {
|
||||
String action = (String)params[0];
|
||||
@@ -59,8 +65,7 @@ public class InitCmsData extends BaseInitDataTests {
|
||||
});
|
||||
}
|
||||
|
||||
@Autowired
|
||||
private CategoryService categoryService;
|
||||
private final CategoryService categoryService;
|
||||
public void initCategory() throws Exception{
|
||||
initExcelData(Category.class, params -> {
|
||||
String action = (String)params[0];
|
||||
@@ -74,8 +79,7 @@ public class InitCmsData extends BaseInitDataTests {
|
||||
});
|
||||
}
|
||||
|
||||
@Autowired
|
||||
private ArticleDao articleDao;
|
||||
private final ArticleDao articleDao;
|
||||
public void initArticle() throws Exception{
|
||||
initExcelData(Article.class, params -> {
|
||||
String action = (String)params[0];
|
||||
@@ -89,8 +93,7 @@ public class InitCmsData extends BaseInitDataTests {
|
||||
});
|
||||
}
|
||||
|
||||
@Autowired
|
||||
private ArticleDataDao articleDataDao;
|
||||
private final ArticleDataDao articleDataDao;
|
||||
public void initArticleData() throws Exception{
|
||||
initExcelData(ArticleData.class, params -> {
|
||||
String action = (String)params[0];
|
||||
|
||||
@@ -5,8 +5,10 @@
|
||||
package com.jeesite.autoconfigure.sys;
|
||||
|
||||
import com.jeesite.common.mybatis.MyBatisFactoryBean;
|
||||
import com.jeesite.modules.msg.dao.MsgInnerRecordDao;
|
||||
import com.jeesite.modules.msg.service.MsgInnerService;
|
||||
import com.jeesite.modules.msg.service.support.MsgInnerServiceSupport;
|
||||
import com.jeesite.modules.sys.service.EmpUserService;
|
||||
import org.springframework.boot.autoconfigure.AutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
||||
@@ -25,8 +27,8 @@ public class MsgAutoConfiguration {
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
public MsgInnerService msgInnerService(){
|
||||
return new MsgInnerServiceSupport();
|
||||
public MsgInnerService msgInnerService(EmpUserService empUserService, MsgInnerRecordDao msgInnerRecordDao){
|
||||
return new MsgInnerServiceSupport(empUserService, msgInnerRecordDao);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -5,6 +5,10 @@
|
||||
package com.jeesite.autoconfigure.sys;
|
||||
|
||||
import com.jeesite.common.mybatis.MyBatisFactoryBean;
|
||||
import com.jeesite.modules.sys.dao.CompanyOfficeDao;
|
||||
import com.jeesite.modules.sys.dao.EmployeeOfficeDao;
|
||||
import com.jeesite.modules.sys.dao.EmployeePostDao;
|
||||
import com.jeesite.modules.sys.dao.PostRoleDao;
|
||||
import com.jeesite.modules.sys.service.*;
|
||||
import com.jeesite.modules.sys.service.support.*;
|
||||
import org.springframework.boot.autoconfigure.AutoConfiguration;
|
||||
@@ -31,20 +35,20 @@ public class SysAutoConfiguration {
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
public CompanyService companyService(){
|
||||
return new CompanyServiceSupport();
|
||||
public CompanyService companyService(CompanyOfficeDao companyOfficeDao, DataScopeService dataScopeService, EmpUserService empUserService){
|
||||
return new CompanyServiceSupport(companyOfficeDao, dataScopeService, empUserService);
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
public EmployeeService employeeService(){
|
||||
return new EmployeeServiceSupport();
|
||||
public EmployeeService employeeService(EmployeePostDao employeePostDao, EmployeeOfficeDao employeeOfficeDao){
|
||||
return new EmployeeServiceSupport(employeePostDao, employeeOfficeDao);
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
public EmpUserService empUserService(){
|
||||
return new EmpUserServiceSupport();
|
||||
public EmpUserService empUserService(UserService userService, EmployeeService employeeService, EmployeeOfficeDao employeeOfficeDao){
|
||||
return new EmpUserServiceSupport(userService, employeeService, employeeOfficeDao);
|
||||
}
|
||||
|
||||
@Bean
|
||||
@@ -55,14 +59,14 @@ public class SysAutoConfiguration {
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
public OfficeService officeService(){
|
||||
return new OfficeServiceSupport();
|
||||
public OfficeService officeService(DataScopeService dataScopeService, EmpUserService empUserService){
|
||||
return new OfficeServiceSupport(dataScopeService, empUserService);
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
public PostService postService(){
|
||||
return new PostServiceSupport();
|
||||
public PostService postService(PostRoleDao postRoleDao, EmpUserService empUserService){
|
||||
return new PostServiceSupport(postRoleDao, empUserService);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -23,7 +23,6 @@ import com.jeesite.modules.sys.entity.EmpUser;
|
||||
import com.jeesite.modules.sys.entity.User;
|
||||
import com.jeesite.modules.sys.service.EmpUserService;
|
||||
import io.netty.util.concurrent.DefaultThreadFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.Date;
|
||||
@@ -40,16 +39,19 @@ import java.util.concurrent.TimeUnit;
|
||||
*/
|
||||
public class MsgInnerServiceSupport extends CrudService<MsgInnerDao, MsgInner>
|
||||
implements MsgInnerService {
|
||||
|
||||
@Autowired
|
||||
private EmpUserService empUserService;
|
||||
@Autowired
|
||||
private MsgInnerRecordDao msgInnerRecordDao;
|
||||
|
||||
private static ExecutorService msgPushThreadPool = new ThreadPoolExecutor(5, 20,
|
||||
protected static final ExecutorService msgPushThreadPool = new ThreadPoolExecutor(5, 20,
|
||||
60L, TimeUnit.SECONDS, new LinkedBlockingQueue<>(),
|
||||
new DefaultThreadFactory("cms-update-expired-weight"));
|
||||
|
||||
|
||||
protected final EmpUserService empUserService;
|
||||
protected final MsgInnerRecordDao msgInnerRecordDao;
|
||||
|
||||
public MsgInnerServiceSupport(EmpUserService empUserService, MsgInnerRecordDao msgInnerRecordDao) {
|
||||
this.empUserService = empUserService;
|
||||
this.msgInnerRecordDao = msgInnerRecordDao;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取单条数据
|
||||
* @param msgInner 主键
|
||||
|
||||
@@ -15,11 +15,11 @@ import com.jeesite.modules.job.entity.JobEntity;
|
||||
import com.jeesite.modules.msg.task.impl.MsgLocalMergePushTask;
|
||||
import com.jeesite.modules.msg.task.impl.MsgLocalPushTask;
|
||||
import com.jeesite.modules.sys.dao.RoleMenuDao;
|
||||
import com.jeesite.modules.sys.entity.Module;
|
||||
import com.jeesite.modules.sys.entity.*;
|
||||
import com.jeesite.modules.sys.entity.Module;
|
||||
import com.jeesite.modules.sys.service.*;
|
||||
import org.quartz.CronTrigger;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.ObjectProvider;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@@ -31,7 +31,28 @@ import org.springframework.stereotype.Component;
|
||||
@Component
|
||||
@ConditionalOnProperty(name="jeesite.initdata", havingValue="true", matchIfMissing=false)
|
||||
public class InitCoreData extends BaseInitDataTests {
|
||||
|
||||
|
||||
public InitCoreData(ConfigService configService, ModuleService moduleService, DictTypeService dictTypeService,
|
||||
DictDataService dictDataService, RoleService roleService, MenuService menuService,
|
||||
RoleMenuDao roleMenuDao, UserService userService, OfficeService officeService,
|
||||
CompanyService companyService, PostService postService, EmpUserService empUserService,
|
||||
ObjectProvider<JobDao> jobDao, BizCategoryService bizCategoryService) {
|
||||
this.configService = configService;
|
||||
this.moduleService = moduleService;
|
||||
this.dictTypeService = dictTypeService;
|
||||
this.dictDataService = dictDataService;
|
||||
this.roleService = roleService;
|
||||
this.menuService = menuService;
|
||||
this.roleMenuDao = roleMenuDao;
|
||||
this.userService = userService;
|
||||
this.officeService = officeService;
|
||||
this.companyService = companyService;
|
||||
this.postService = postService;
|
||||
this.empUserService = empUserService;
|
||||
this.jobDao = jobDao.getIfAvailable();
|
||||
this.bizCategoryService = bizCategoryService;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean initData() throws Exception {
|
||||
if (GenUtils.isTableExists(Global.getTablePrefix() + "sys_module")) {
|
||||
@@ -56,8 +77,7 @@ public class InitCoreData extends BaseInitDataTests {
|
||||
return true;
|
||||
}
|
||||
|
||||
// @Autowired
|
||||
// private AreaService areaService;
|
||||
// private final AreaService areaService;
|
||||
/**
|
||||
* 区域、行政区划表
|
||||
*/
|
||||
@@ -85,8 +105,7 @@ public class InitCoreData extends BaseInitDataTests {
|
||||
// });
|
||||
}
|
||||
|
||||
@Autowired
|
||||
private ConfigService configService;
|
||||
private final ConfigService configService;
|
||||
/**
|
||||
* 参数配置表
|
||||
*/
|
||||
@@ -105,8 +124,7 @@ public class InitCoreData extends BaseInitDataTests {
|
||||
});
|
||||
}
|
||||
|
||||
@Autowired
|
||||
private ModuleService moduleService;
|
||||
private final ModuleService moduleService;
|
||||
/**
|
||||
* 系统模块表
|
||||
*/
|
||||
@@ -124,10 +142,8 @@ public class InitCoreData extends BaseInitDataTests {
|
||||
});
|
||||
}
|
||||
|
||||
@Autowired
|
||||
private DictTypeService dictTypeService;
|
||||
@Autowired
|
||||
private DictDataService dictDataService;
|
||||
private final DictTypeService dictTypeService;
|
||||
private final DictDataService dictDataService;
|
||||
/**
|
||||
* 系统字典、用户字典表
|
||||
*/
|
||||
@@ -158,8 +174,7 @@ public class InitCoreData extends BaseInitDataTests {
|
||||
});
|
||||
}
|
||||
|
||||
@Autowired
|
||||
private RoleService roleService;
|
||||
private final RoleService roleService;
|
||||
/**
|
||||
* 角色表
|
||||
*/
|
||||
@@ -179,10 +194,8 @@ public class InitCoreData extends BaseInitDataTests {
|
||||
});
|
||||
}
|
||||
|
||||
@Autowired
|
||||
private MenuService menuService;
|
||||
@Autowired
|
||||
private RoleMenuDao roleMenuDao;
|
||||
private final MenuService menuService;
|
||||
private final RoleMenuDao roleMenuDao;
|
||||
/**
|
||||
* 菜单表
|
||||
*/
|
||||
@@ -205,8 +218,7 @@ public class InitCoreData extends BaseInitDataTests {
|
||||
});
|
||||
}
|
||||
|
||||
@Autowired
|
||||
private UserService userService;
|
||||
private final UserService userService;
|
||||
/**
|
||||
* 用户表
|
||||
*/
|
||||
@@ -226,8 +238,7 @@ public class InitCoreData extends BaseInitDataTests {
|
||||
});
|
||||
}
|
||||
|
||||
@Autowired
|
||||
private OfficeService officeService;
|
||||
private final OfficeService officeService;
|
||||
/**
|
||||
* 组织机构、部门表
|
||||
*/
|
||||
@@ -245,8 +256,7 @@ public class InitCoreData extends BaseInitDataTests {
|
||||
});
|
||||
}
|
||||
|
||||
@Autowired
|
||||
private CompanyService companyService;
|
||||
private final CompanyService companyService;
|
||||
/**
|
||||
* 公司表
|
||||
*/
|
||||
@@ -265,8 +275,7 @@ public class InitCoreData extends BaseInitDataTests {
|
||||
});
|
||||
}
|
||||
|
||||
@Autowired
|
||||
private PostService postService;
|
||||
private final PostService postService;
|
||||
/**
|
||||
* 岗位表
|
||||
*/
|
||||
@@ -284,8 +293,7 @@ public class InitCoreData extends BaseInitDataTests {
|
||||
});
|
||||
}
|
||||
|
||||
@Autowired
|
||||
private EmpUserService empUserService;
|
||||
private final EmpUserService empUserService;
|
||||
/**
|
||||
* 员工、用户表
|
||||
*/
|
||||
@@ -322,8 +330,7 @@ public class InitCoreData extends BaseInitDataTests {
|
||||
});
|
||||
}
|
||||
|
||||
@Autowired(required = false)
|
||||
private JobDao jobDao; // 默认情况下job是关闭状态,需要注入jobDao
|
||||
private final JobDao jobDao; // 默认情况下job是关闭状态,需要注入jobDao
|
||||
/**
|
||||
* 初始化消息推送服务
|
||||
*/
|
||||
@@ -363,8 +370,7 @@ public class InitCoreData extends BaseInitDataTests {
|
||||
jobDao.insert(job);
|
||||
}
|
||||
|
||||
@Autowired
|
||||
private BizCategoryService bizCategoryService;
|
||||
private final BizCategoryService bizCategoryService;
|
||||
public void initBizCategory() throws Exception{
|
||||
// clearTable(BizCategory.class);
|
||||
initExcelData(BizCategory.class, params -> {
|
||||
|
||||
@@ -18,7 +18,6 @@ import com.jeesite.modules.sys.service.DataScopeService;
|
||||
import com.jeesite.modules.sys.service.EmpUserService;
|
||||
import com.jeesite.modules.sys.utils.EmpUtils;
|
||||
import com.jeesite.modules.sys.utils.UserUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
@@ -31,13 +30,17 @@ import java.util.List;
|
||||
public class CompanyServiceSupport extends TreeService<CompanyDao, Company>
|
||||
implements CompanyService{
|
||||
|
||||
@Autowired
|
||||
private CompanyOfficeDao companyOfficeDao;
|
||||
@Autowired
|
||||
private DataScopeService dataScopeService;
|
||||
@Autowired
|
||||
private EmpUserService empUserService;
|
||||
|
||||
protected final CompanyOfficeDao companyOfficeDao;
|
||||
protected final DataScopeService dataScopeService;
|
||||
protected final EmpUserService empUserService;
|
||||
|
||||
public CompanyServiceSupport(CompanyOfficeDao companyOfficeDao, DataScopeService dataScopeService,
|
||||
EmpUserService empUserService) {
|
||||
this.companyOfficeDao = companyOfficeDao;
|
||||
this.dataScopeService = dataScopeService;
|
||||
this.empUserService = empUserService;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取单条数据
|
||||
*/
|
||||
|
||||
@@ -24,7 +24,6 @@ import com.jeesite.modules.sys.service.EmployeeService;
|
||||
import com.jeesite.modules.sys.service.UserService;
|
||||
import com.jeesite.modules.sys.utils.EmpUtils;
|
||||
import com.jeesite.modules.sys.utils.UserUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
@@ -41,13 +40,16 @@ import java.util.List;
|
||||
public class EmpUserServiceSupport extends CrudService<EmpUserDao, EmpUser>
|
||||
implements EmpUserService{
|
||||
|
||||
@Autowired
|
||||
private UserService userService;
|
||||
@Autowired
|
||||
private EmployeeService employeeService;
|
||||
@Autowired
|
||||
private EmployeeOfficeDao employeeOfficeDao;
|
||||
|
||||
protected final UserService userService;
|
||||
protected final EmployeeService employeeService;
|
||||
protected final EmployeeOfficeDao employeeOfficeDao;
|
||||
|
||||
public EmpUserServiceSupport(UserService userService, EmployeeService employeeService, EmployeeOfficeDao employeeOfficeDao) {
|
||||
this.userService = userService;
|
||||
this.employeeService = employeeService;
|
||||
this.employeeOfficeDao = employeeOfficeDao;
|
||||
}
|
||||
|
||||
/**
|
||||
* 租户功能验证
|
||||
*/
|
||||
|
||||
@@ -15,7 +15,6 @@ import com.jeesite.modules.sys.entity.Employee;
|
||||
import com.jeesite.modules.sys.entity.EmployeeOffice;
|
||||
import com.jeesite.modules.sys.entity.EmployeePost;
|
||||
import com.jeesite.modules.sys.service.EmployeeService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
@@ -28,11 +27,14 @@ import java.util.List;
|
||||
public class EmployeeServiceSupport extends CrudService<EmployeeDao, Employee>
|
||||
implements EmployeeService{
|
||||
|
||||
@Autowired
|
||||
private EmployeePostDao employeePostDao;
|
||||
@Autowired
|
||||
private EmployeeOfficeDao employeeOfficeDao;
|
||||
|
||||
protected final EmployeePostDao employeePostDao;
|
||||
protected final EmployeeOfficeDao employeeOfficeDao;
|
||||
|
||||
public EmployeeServiceSupport(EmployeePostDao employeePostDao, EmployeeOfficeDao employeeOfficeDao) {
|
||||
this.employeePostDao = employeePostDao;
|
||||
this.employeeOfficeDao = employeeOfficeDao;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取单条数据
|
||||
*/
|
||||
|
||||
@@ -19,7 +19,6 @@ import com.jeesite.modules.sys.service.EmpUserService;
|
||||
import com.jeesite.modules.sys.service.OfficeService;
|
||||
import com.jeesite.modules.sys.utils.EmpUtils;
|
||||
import com.jeesite.modules.sys.utils.UserUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
@@ -35,11 +34,14 @@ import java.util.List;
|
||||
public class OfficeServiceSupport extends TreeService<OfficeDao, Office>
|
||||
implements OfficeService{
|
||||
|
||||
@Autowired
|
||||
private DataScopeService dataScopeService;
|
||||
@Autowired
|
||||
private EmpUserService empUserService;
|
||||
|
||||
protected final DataScopeService dataScopeService;
|
||||
protected final EmpUserService empUserService;
|
||||
|
||||
public OfficeServiceSupport(DataScopeService dataScopeService, EmpUserService empUserService) {
|
||||
this.dataScopeService = dataScopeService;
|
||||
this.empUserService = empUserService;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取单条数据
|
||||
*/
|
||||
|
||||
@@ -12,12 +12,13 @@ import com.jeesite.common.service.CrudService;
|
||||
import com.jeesite.common.utils.PageUtils;
|
||||
import com.jeesite.modules.sys.dao.PostDao;
|
||||
import com.jeesite.modules.sys.dao.PostRoleDao;
|
||||
import com.jeesite.modules.sys.entity.*;
|
||||
import com.jeesite.modules.sys.entity.EmpUser;
|
||||
import com.jeesite.modules.sys.entity.Post;
|
||||
import com.jeesite.modules.sys.entity.PostRole;
|
||||
import com.jeesite.modules.sys.service.EmpUserService;
|
||||
import com.jeesite.modules.sys.service.PostService;
|
||||
import com.jeesite.modules.sys.utils.CorpUtils;
|
||||
import com.jeesite.modules.sys.utils.UserUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
@@ -30,10 +31,13 @@ import java.util.List;
|
||||
public class PostServiceSupport extends CrudService<PostDao, Post>
|
||||
implements PostService{
|
||||
|
||||
@Autowired
|
||||
private PostRoleDao postRoleDao;
|
||||
@Autowired
|
||||
private EmpUserService empUserService;
|
||||
protected final PostRoleDao postRoleDao;
|
||||
protected final EmpUserService empUserService;
|
||||
|
||||
public PostServiceSupport(PostRoleDao postRoleDao, EmpUserService empUserService) {
|
||||
this.postRoleDao = postRoleDao;
|
||||
this.empUserService = empUserService;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询岗位
|
||||
|
||||
@@ -18,7 +18,6 @@ import com.jeesite.modules.sys.utils.UserUtils;
|
||||
import io.swagger.annotations.Api;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.apache.shiro.session.Session;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
|
||||
@@ -20,7 +20,6 @@ import com.jeesite.modules.sys.dao.*;
|
||||
import com.jeesite.modules.sys.entity.*;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.test.context.ActiveProfiles;
|
||||
|
||||
@@ -36,18 +35,22 @@ import java.util.List;
|
||||
@SpringBootTest(classes = ApplicationTest.class)
|
||||
public class DaoMapperTest extends BaseSpringContextTests {
|
||||
|
||||
@Autowired
|
||||
private PostDao postDao;
|
||||
@Autowired
|
||||
private UserDao userDao;
|
||||
@Autowired
|
||||
private AreaDao areaDao;
|
||||
@Autowired
|
||||
private CompanyDao companyDao;
|
||||
@Autowired
|
||||
private FileUploadDao fileUploadDao;
|
||||
@Autowired
|
||||
private EmpUserDao empUserDao;
|
||||
private final PostDao postDao;
|
||||
private final UserDao userDao;
|
||||
private final AreaDao areaDao;
|
||||
private final CompanyDao companyDao;
|
||||
private final FileUploadDao fileUploadDao;
|
||||
private final EmpUserDao empUserDao;
|
||||
|
||||
public DaoMapperTest(PostDao postDao, UserDao userDao, AreaDao areaDao, CompanyDao companyDao,
|
||||
FileUploadDao fileUploadDao, EmpUserDao empUserDao) {
|
||||
this.postDao = postDao;
|
||||
this.userDao = userDao;
|
||||
this.areaDao = areaDao;
|
||||
this.companyDao = companyDao;
|
||||
this.fileUploadDao = fileUploadDao;
|
||||
this.empUserDao = empUserDao;
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testTableAnnotation() throws Exception{
|
||||
|
||||
@@ -4,18 +4,16 @@
|
||||
*/
|
||||
package com.jeesite.test;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.test.annotation.Rollback;
|
||||
import org.springframework.test.context.ActiveProfiles;
|
||||
|
||||
import com.jeesite.common.config.Global;
|
||||
import com.jeesite.common.lang.StringUtils;
|
||||
import com.jeesite.common.tests.BaseSpringContextTests;
|
||||
import com.jeesite.modules.gen.entity.GenTable;
|
||||
import com.jeesite.modules.gen.entity.GenTableColumn;
|
||||
import com.jeesite.modules.gen.service.GenTableService;
|
||||
import org.junit.Test;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.test.annotation.Rollback;
|
||||
import org.springframework.test.context.ActiveProfiles;
|
||||
|
||||
/**
|
||||
* 代码生成工具(API)
|
||||
@@ -27,9 +25,12 @@ import com.jeesite.modules.gen.service.GenTableService;
|
||||
@Rollback(false)
|
||||
public class GenTableToolTest extends BaseSpringContextTests {
|
||||
|
||||
@Autowired
|
||||
private GenTableService genTableService;
|
||||
|
||||
private final GenTableService genTableService;
|
||||
|
||||
public GenTableToolTest(GenTableService genTableService) {
|
||||
this.genTableService = genTableService;
|
||||
}
|
||||
|
||||
@Test
|
||||
public void execute() throws Exception{
|
||||
GenTable genTable = new GenTable();
|
||||
|
||||
@@ -23,7 +23,6 @@ import com.jeesite.modules.sys.service.UserService;
|
||||
import com.jeesite.modules.sys.utils.UserUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.junit.Test;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.test.annotation.Rollback;
|
||||
import org.springframework.test.context.ActiveProfiles;
|
||||
@@ -41,11 +40,14 @@ import java.util.List;
|
||||
@Rollback(false)
|
||||
public class MsgPushTest extends BaseSpringContextTests {
|
||||
|
||||
@Autowired
|
||||
private UserService userService;
|
||||
@Autowired
|
||||
private MsgTemplateService msgTemplateService;
|
||||
|
||||
private final UserService userService;
|
||||
private final MsgTemplateService msgTemplateService;
|
||||
|
||||
public MsgPushTest(UserService userService, MsgTemplateService msgTemplateService) {
|
||||
this.userService = userService;
|
||||
this.msgTemplateService = msgTemplateService;
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSend(){
|
||||
User user = UserUtils.get("system");
|
||||
|
||||
@@ -4,18 +4,16 @@
|
||||
*/
|
||||
package com.jeesite.modules.test.db;
|
||||
|
||||
import com.jeesite.common.datasource.DataSourceHolder;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.jeesite.common.config.Global;
|
||||
import com.jeesite.common.datasource.DataSourceHolder;
|
||||
import com.jeesite.common.lang.StringUtils;
|
||||
import com.jeesite.common.tests.BaseInitDataTests;
|
||||
import com.jeesite.modules.gen.entity.GenTable;
|
||||
import com.jeesite.modules.gen.entity.GenTableColumn;
|
||||
import com.jeesite.modules.gen.service.GenTableService;
|
||||
import com.jeesite.modules.gen.utils.GenUtils;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* 初始化核心表数据
|
||||
@@ -26,6 +24,10 @@ import com.jeesite.modules.gen.utils.GenUtils;
|
||||
@ConditionalOnProperty(name="jeesite.initdata", havingValue="true", matchIfMissing=false)
|
||||
public class InitTestData extends BaseInitDataTests {
|
||||
|
||||
public InitTestData(GenTableService genTableService) {
|
||||
this.genTableService = genTableService;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean initData() throws Exception {
|
||||
if (GenUtils.isTableExists("test_data")) {
|
||||
@@ -36,8 +38,7 @@ public class InitTestData extends BaseInitDataTests {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Autowired
|
||||
private GenTableService genTableService;
|
||||
private final GenTableService genTableService;
|
||||
/**
|
||||
* 代码生成测试数据
|
||||
*/
|
||||
|
||||
@@ -14,7 +14,6 @@ import com.jeesite.modules.test.dao.TestDataChildDao;
|
||||
import com.jeesite.modules.test.dao.TestDataDao;
|
||||
import com.jeesite.modules.test.entity.TestData;
|
||||
import com.jeesite.modules.test.entity.TestDataChild;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
@@ -28,9 +27,12 @@ import java.util.List;
|
||||
@Service
|
||||
public class TestDataService extends CrudService<TestDataDao, TestData> {
|
||||
|
||||
@Autowired
|
||||
private TestDataChildDao testDataChildDao;
|
||||
|
||||
private final TestDataChildDao testDataChildDao;
|
||||
|
||||
public TestDataService(TestDataChildDao testDataChildDao) {
|
||||
this.testDataChildDao = testDataChildDao;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取单条数据
|
||||
* @param testData 主键
|
||||
|
||||
@@ -9,7 +9,6 @@ import com.jeesite.common.tests.BaseSpringContextTests;
|
||||
import com.jeesite.modules.test.dao.TestDataDao;
|
||||
import com.jeesite.modules.test.entity.TestData;
|
||||
import org.junit.Test;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.test.context.ActiveProfiles;
|
||||
|
||||
@@ -24,9 +23,12 @@ import java.util.List;
|
||||
@SpringBootTest(classes = ApplicationTest.class)
|
||||
public class InsertBatchTest extends BaseSpringContextTests {
|
||||
|
||||
@Autowired
|
||||
private TestDataDao testDataDao;
|
||||
|
||||
private final TestDataDao testDataDao;
|
||||
|
||||
public InsertBatchTest(TestDataDao testDataDao) {
|
||||
this.testDataDao = testDataDao;
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testData1() throws Exception{
|
||||
List<TestData> list = ListUtils.newArrayList();
|
||||
|
||||
@@ -11,7 +11,6 @@ import com.jeesite.modules.test.entity.TestData;
|
||||
import com.jeesite.modules.test.entity.TestDataChild;
|
||||
import com.jeesite.modules.test.service.TestDataService;
|
||||
import org.junit.Test;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.test.context.ActiveProfiles;
|
||||
|
||||
@@ -32,9 +31,12 @@ import java.util.concurrent.Executors;
|
||||
@SpringBootTest(classes = ApplicationTest.class)
|
||||
public class MultiDataSourceTest extends BaseSpringContextTests {
|
||||
|
||||
@Autowired
|
||||
private TestDataService testDataService;
|
||||
|
||||
private final TestDataService testDataService;
|
||||
|
||||
public MultiDataSourceTest(TestDataService testDataService) {
|
||||
this.testDataService = testDataService;
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testData() throws Exception{
|
||||
ExecutorService pool = Executors.newCachedThreadPool();
|
||||
|
||||
Reference in New Issue
Block a user