Skip to content

Commit 98a3eae

Browse files
committed
优化entityFactory
1 parent 27c0283 commit 98a3eae

File tree

7 files changed

+12
-24
lines changed
  • hsweb-commons/hsweb-commons-entity/src/main/java/org/hswebframework/web/commons/entity/factory
  • hsweb-examples/hsweb-examples-simple/src/main
  • hsweb-system/hsweb-system-authorization
    • hsweb-system-authorization-controller/src/main/java/org/hswebframework/web/controller/authorization
    • hsweb-system-authorization-service/hsweb-system-authorization-service-api/src/main/java/org/hswebframework/web/service/authorization
    • hsweb-system-authorization-starter/src/test/java/org/hswebframework/web/starter/authorization
  • hsweb-tests/src/main/java/org/hswebframework/web/tests

7 files changed

+12
-24
lines changed

hsweb-commons/hsweb-commons-entity/src/main/java/org/hswebframework/web/commons/entity/factory/MapperEntityFactory.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,9 @@
3535
public class MapperEntityFactory implements EntityFactory {
3636
private Map<Class, Mapper> realTypeMapper = new HashMap<>();
3737

38+
public MapperEntityFactory() {
39+
}
40+
3841
public <T extends Entity> MapperEntityFactory(Map<Class<T>, Mapper> realTypeMapper) {
3942
this.realTypeMapper.putAll(realTypeMapper);
4043
}

hsweb-examples/hsweb-examples-simple/src/main/java/org/hswebframework/web/example/simple/SpringBootExample.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@
3535
import org.springframework.boot.SpringApplication;
3636
import org.springframework.boot.autoconfigure.SpringBootApplication;
3737
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
38-
import org.springframework.boot.context.TypeExcludeFilter;
3938
import org.springframework.context.annotation.*;
4039
import org.springframework.jdbc.datasource.DataSourceUtils;
4140

hsweb-examples/hsweb-examples-simple/src/main/resources/application.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,10 @@ spring:
1111
hsweb:
1212
app:
1313
name: hsweb示例
14-
version: 3.0.0
14+
version: 3.0.0
15+
entity:
16+
mappings:
17+
- source-base-package: org.hswebframework.web.entity.authorization
18+
target-base-package: org.hswebframework.web.entity.authorization
19+
mapping:
20+
UserEntity: SimpleUserEntity

hsweb-system/hsweb-system-authorization/hsweb-system-authorization-controller/src/main/java/org/hswebframework/web/controller/authorization/AuthorizationController.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@
4141
import javax.servlet.http.HttpServletResponse;
4242
import javax.servlet.http.HttpSession;
4343
import java.io.IOException;
44-
import java.util.Date;
4544
import java.util.List;
4645

4746
import static org.hswebframework.web.controller.message.ResponseMessage.ok;

hsweb-system/hsweb-system-authorization/hsweb-system-authorization-service/hsweb-system-authorization-service-api/src/main/java/org/hswebframework/web/service/authorization/UserService.java

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,19 @@
11
package org.hswebframework.web.service.authorization;
22

3-
import org.hswebframework.web.authorization.Authorization;
3+
import org.hswebframework.web.authorization.AuthorizationInitializeService;
44
import org.hswebframework.web.entity.authorization.UserEntity;
55
import org.hswebframework.web.service.CreateEntityService;
66
import org.hswebframework.web.service.InsertService;
77
import org.hswebframework.web.service.QueryByEntityService;
88
import org.hswebframework.web.service.QueryService;
99

10-
import java.util.Date;
11-
1210
/**
1311
* TODO 完成注释
1412
*
1513
* @author zhouhao
1614
*/
1715
public interface UserService extends
16+
AuthorizationInitializeService,
1817
CreateEntityService<UserEntity>,
1918
QueryByEntityService<UserEntity>,
2019
QueryService<UserEntity, String>,
@@ -33,8 +32,4 @@ public interface UserService extends
3332
void updateLoginInfo(String userId, String ip, Long loginTime);
3433

3534
void updatePassword(String userId, String oldPassword, String newPassword);
36-
37-
Authorization initUserAuthorization(String userId);
38-
39-
Authorization initAdminAuthorization(String userId);
4035
}

hsweb-system/hsweb-system-authorization/hsweb-system-authorization-starter/src/test/java/org/hswebframework/web/starter/authorization/UserTests.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@
3232
import org.springframework.context.annotation.Configuration;
3333

3434
import java.sql.SQLException;
35-
import java.util.Date;
3635

3736
/**
3837
* TODO 完成注释

hsweb-tests/src/main/java/org/hswebframework/web/tests/SimpleWebApplicationTests.java

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -122,19 +122,6 @@ protected TestProcess testPut(String api) throws Exception {
122122
@WebAppConfiguration
123123
public static class Config {
124124

125-
@Bean(name = "validator")
126-
@ConditionalOnMissingBean(Validator.class)
127-
public Validator validator() {
128-
ValidatorFactory factory = Validation.buildDefaultValidatorFactory();
129-
Validator validator = factory.getValidator();
130-
return validator;
131-
}
132-
133-
@Bean
134-
public EntityFactory beanFactory() {
135-
return new MapperEntityFactory();
136-
}
137-
138125
@Bean
139126
public SqlExecutor sqlExecutor(DataSource dataSource) throws SQLException {
140127
Connection connection = dataSource.getConnection();

0 commit comments

Comments
 (0)