Skip to content

Commit

Permalink
全面升级spring4+hibernate validator5 及部分依赖版本升级(不建议正式环境使用,先测试试试是否稳定)
Browse files Browse the repository at this point in the history
  • Loading branch information
zhangkaitao committed Dec 15, 2013
1 parent 47b80e1 commit d1958a8
Show file tree
Hide file tree
Showing 81 changed files with 303 additions and 707 deletions.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ public abstract class BaseTreeableService<M extends BaseEntity<ID> & Treeable<ID

private RepositoryHelper repositoryHelper;


protected BaseTreeableService() {
Class<M> entityClass = ReflectUtils.findParameterizedType(getClass(), 0);
repositoryHelper = new RepositoryHelper(entityClass);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
import com.sishuok.es.common.web.bind.annotation.PageableDefaults;
import com.sishuok.es.common.web.controller.BaseCRUDController;
import com.sishuok.es.common.web.validate.AjaxResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.ui.Model;
import org.springframework.util.Assert;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
Expand All @@ -30,40 +30,28 @@
public abstract class BaseMovableController<M extends BaseEntity & Movable, ID extends Serializable>
extends BaseCRUDController<M, ID> {

private BaseMovableService movableService;


@Override
public void afterPropertiesSet() {
super.afterPropertiesSet();

Assert.isTrue(
BaseMovableService.class.isAssignableFrom(baseService.getClass()),
"baseService must be BaseMovableService subclass");

this.movableService = (BaseMovableService<M, ID>) this.baseService;

protected BaseMovableService<M, ID> getMovableService() {
return (BaseMovableService<M, ID>) baseService;
}

@RequestMapping(method = RequestMethod.GET)
@PageableDefaults(value = 10, sort = "weight=desc")
@Override
public String list(Searchable searchable, Model model) {

return super.list(searchable, model);
}

@RequestMapping(value = "{fromId}/{toId}/up")
@ResponseBody
public AjaxResponse up(@PathVariable("fromId") Long fromId, @PathVariable("toId") Long toId) {
public AjaxResponse up(@PathVariable("fromId") ID fromId, @PathVariable("toId") ID toId) {

if (this.permissionList != null) {
this.permissionList.assertHasEditPermission();
}

AjaxResponse ajaxResponse = new AjaxResponse("移动位置成功");
try {
movableService.up(fromId, toId);
getMovableService().up(fromId, toId);
} catch (IllegalStateException e) {
ajaxResponse.setSuccess(Boolean.FALSE);
ajaxResponse.setMessage(MessageUtils.message("move.not.enough"));
Expand All @@ -73,7 +61,7 @@ public AjaxResponse up(@PathVariable("fromId") Long fromId, @PathVariable("toId"

@RequestMapping(value = "{fromId}/{toId}/down")
@ResponseBody
public AjaxResponse down(@PathVariable("fromId") Long fromId, @PathVariable("toId") Long toId) {
public AjaxResponse down(@PathVariable("fromId") ID fromId, @PathVariable("toId") ID toId) {


if (this.permissionList != null) {
Expand All @@ -82,7 +70,7 @@ public AjaxResponse down(@PathVariable("fromId") Long fromId, @PathVariable("toI

AjaxResponse ajaxResponse = new AjaxResponse("移动位置成功");
try {
movableService.down(fromId, toId);
getMovableService().down(fromId, toId);
} catch (IllegalStateException e) {
ajaxResponse.setSuccess(Boolean.FALSE);
ajaxResponse.setMessage(MessageUtils.message("move.not.enough"));
Expand All @@ -100,7 +88,7 @@ public AjaxResponse reweight() {

AjaxResponse ajaxResponse = new AjaxResponse("优化权重成功!");
try {
movableService.reweight();
getMovableService().reweight();
} catch (IllegalStateException e) {
ajaxResponse.setSuccess(Boolean.FALSE);
ajaxResponse.setMessage("优化权重失败了!");
Expand Down
Loading

0 comments on commit d1958a8

Please sign in to comment.