activitycontroller
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了activitycontroller相关的知识,希望对你有一定的参考价值。
package com.renesola.apollo.controller;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.renesola.apollo.auth.Session;
import com.renesola.apollo.model.ActivityCategory;
import com.renesola.apollo.model.base.DataModel;
import com.renesola.apollo.service.ActivityCategoryService;
import com.renesola.apollo.sql.Where;
import com.renesola.apollo.util.Requests;
@Controllerbr/>@RequestMapping("activity")
public class ActivityController {br/>@Autowired
private ActivityCategoryService activityCateoryService;
/**
* 跳转到活动分类页面
* @return
*/
@RequestMapping("activityList")
public String activityList(){
List<ActivityCategory> actLists=activityCateoryService.list(new Where().eq("dr",0).setOrderBy("createAt"));
Requests.attr("actLists",actLists);
return "activity/activityList";
}
/**
* 删除分类
* @return
*/
@RequestMapping("removeCateory")
@ResponseBody
public Object removeCateory() {
try {
// 权限ID
String actId = Requests.param("actId");
ActivityCategory act = activityCateoryService.require(actId);
activityCateoryService.require(actId);
act.setDr(1);
act.setDeleteAtNow(Session.getUserId());
activityCateoryService.save(act);
return DataModel.instance().setSuccess(true);
} catch(Exception e) {
e.printStackTrace();
return DataModel.instance().setSuccess(false);
}
}
/**
* 新增分类
* @return
*/
@RequestMapping("addCateory")
@ResponseBody
public Object addCateory() {
try {
// 权限内容
String cate_name_add = Requests.param("cate_name_add");
// 权限描述
String cate_desc_add = Requests.param("cate_desc_add");
// 权限名称重复check
List<ActivityCategory> bakActList = activityCateoryService.list(new Where().eq("dr", 0).eq("cate_name", cate_name_add.trim()));
if (bakActList != null && bakActList.size() > 0) {
return DataModel.instance().setSuccess(false).setMsg("该活动分类名称已被使用.");
}
ActivityCategory act = new ActivityCategory();
act.setCateName(cate_name_add.trim());
act.setCateDesc(cate_desc_add.trim());
act.setCreateAtNow(Session.getUserId());
activityCateoryService.save(act);
return DataModel.instance().setSuccess(true);
} catch(Exception e) {
e.printStackTrace();
return DataModel.instance().setSuccess(false);
}
}
/**
* 更新分类
* @return
*/
@RequestMapping("updateCateory")
@ResponseBody
public Object updatePermission() {
try {
// 权限ID
String actId = Requests.param("actId");
// 权限内容
String cate_name_edit = Requests.param("cate_name_edit");
// 权限描述
String cate_desc_edit = Requests.param("cate_desc_edit");
// 权限名称重复check
List<ActivityCategory> bakActList = activityCateoryService.list(new Where().eq("dr", 0).eq("cate_name", cate_name_edit.trim()));
if (bakActList == null) {
// do nothing.
} else if (bakActList.size() > 2) {
return DataModel.instance().setSuccess(false).setMsg("该活动分类名称已被使用.");
} else if (bakActList.size() == 1 && !actId.equals(bakActList.get(0).getId())) {
return DataModel.instance().setSuccess(false).setMsg("该活动分类名称已被使用.");
} else {
// do nothing.
}
ActivityCategory act = activityCateoryService.require(actId);
act.setCateName(cate_name_edit.trim());
act.setCateDesc(cate_desc_edit.trim());
act.setUpdateAtNow(Session.getUserId());
activityCateoryService.save(act);
return DataModel.instance().setSuccess(true);
} catch(Exception e) {
e.printStackTrace();
return DataModel.instance().setSuccess(false);
}
}
}
以上是关于activitycontroller的主要内容,如果未能解决你的问题,请参考以下文章
隐藏 UIActivityViewController 中的底行
隐藏 UIActivityViewController 中的底行