Skip to content

Commit

Permalink
完善注释,升级fastjson版本
Browse files Browse the repository at this point in the history
  • Loading branch information
zhou-hao committed Feb 22, 2017
1 parent 8b1f928 commit 27383bb
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,9 @@
* 通用新增控制器<br>
* 使用:实现该接口,注解@RestController 以及@RequestMapping("/myController")
* 客户端调用: 通过POST请求,contentType为application/json 。参数为E泛型的json格式
* <code>
* curl -l -H "Content-type: application/json" -X POST -d '{"field1":"value1","field2":"value2"}'
* http://domain/contextPath/myController
* </code>
* <pre>
* curl -l -H "Content-type: application/json" -X POST -d '{"field1":"value1","field2":"value2"}' http://domain/contextPath/myController
* </pre>
*
* @author zhouhao
* @since 3.0
Expand Down
4 changes: 4 additions & 0 deletions hsweb-commons/hsweb-commons-dao/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -39,5 +39,9 @@
<groupId>org.hswebframework</groupId>
<artifactId>hsweb-easy-orm-rdb</artifactId>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
</dependency>
</dependencies>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@

package org.hswebframework.web.example.simple;

import com.alibaba.fastjson.JSON;
import org.hsweb.ezorm.rdb.executor.AbstractJdbcSqlExecutor;
import org.hsweb.ezorm.rdb.executor.SqlExecutor;
import org.hswebframework.web.authorization.Permission;
Expand All @@ -31,19 +30,15 @@
import org.hswebframework.web.service.authorization.PermissionService;
import org.hswebframework.web.service.authorization.RoleService;
import org.hswebframework.web.service.authorization.UserService;
import org.hswebframework.web.service.authorization.simple.access.SimpleScriptDataAccess;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.jdbc.datasource.DataSourceUtils;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.annotation.PostConstruct;
import javax.sql.DataSource;
import java.sql.Connection;
import java.sql.SQLException;
Expand All @@ -54,10 +49,8 @@
*
* @author zhouhao
*/
@EnableAutoConfiguration
@SpringBootApplication
@Configuration
@RequestMapping
public class SpringBootExample implements CommandLineRunner {

@Bean
Expand Down Expand Up @@ -111,11 +104,12 @@ public void run(String... strings) throws Exception {
//password 属性不能读取和修改
FieldAccessEntity fieldAccessEntity = new FieldAccessEntity();
fieldAccessEntity.setField("password");
fieldAccessEntity.setActions(ActionEntity.create(Permission.ACTION_QUERY,Permission.ACTION_UPDATE));
fieldAccessEntity.setActions(ActionEntity.create(Permission.ACTION_QUERY, Permission.ACTION_UPDATE));

PermissionEntity permission = entityFactory.newInstance(PermissionEntity.class);
permission.setName("测试");
permission.setId("test");
permission.setStatus((byte) 1);
permission.setActions(ActionEntity.create(Permission.ACTION_QUERY, Permission.ACTION_UPDATE));
permission.setDataAccess(Arrays.asList(accessEntity, updateAccessEntity));
permission.setFieldAccess(Arrays.asList(fieldAccessEntity));
Expand All @@ -142,6 +136,5 @@ public void run(String... strings) throws Exception {
userEntity.setPassword("admin");
userEntity.setRoles(Arrays.asList("admin"));
userService.insert(userEntity);

}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package org.hswebframework.web.entity.authorization;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.serializer.SerializerFeature;
import org.hswebframework.web.commons.entity.CloneableEntity;

import java.util.Arrays;
Expand Down Expand Up @@ -56,15 +54,6 @@ public ActionEntity clone() {
}
}

public static void main(String[] args) {
SimplePermissionEntity permissionEntity = new SimplePermissionEntity();
permissionEntity.setActions(ActionEntity.create("test"));
permissionEntity.setName("test");
SimplePermissionEntity clone = permissionEntity.clone();
permissionEntity.getActions().clear();
System.out.println(JSON.toJSONString(clone, SerializerFeature.PrettyFormat));
}

public static List<ActionEntity> create(String... actions) {
return Arrays.stream(actions).map(ActionEntity::new).collect(Collectors.toList());
}
Expand Down
24 changes: 22 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@
<javassist.version>3.20.0-GA</javassist.version>
<activiti.version>5.19.0.2</activiti.version>

<fastjson.version>1.2.6</fastjson.version>
<fastjson.version>1.2.24</fastjson.version>
<h2.version>1.4.191</h2.version>
<mysql.version>5.1.39</mysql.version>
<cglib.version>3.2.2</cglib.version>
Expand Down Expand Up @@ -196,11 +196,21 @@
<version>4.12</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
<version>${fastjson.version}</version>
</dependency>
<dependency>
<groupId>org.hswebframework</groupId>
<artifactId>hsweb-utils</artifactId>
<version>${hsweb.utils.version}</version>
<exclusions>
<exclusion>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
</exclusion>
</exclusions>
</dependency>

<dependency>
Expand All @@ -222,13 +232,23 @@
<groupId>org.springframework</groupId>
<artifactId>spring-expression</artifactId>
</exclusion>
<exclusion>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
</exclusion>
</exclusions>
</dependency>

<dependency>
<groupId>org.hswebframework</groupId>
<artifactId>hsweb-easy-orm</artifactId>
<version>${hsweb.ezorm.version}</version>
<exclusions>
<exclusion>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
</exclusion>
</exclusions>
<type>pom</type>
<scope>import</scope>
</dependency>
Expand Down

0 comments on commit 27383bb

Please sign in to comment.