org.nutz.dao.Cnd Java Examples

The following examples show how to use org.nutz.dao.Cnd. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SiteController.java    From NutzSite with Apache License 2.0 6 votes vote down vote up
/**
 * 查询站点列表
 */
@RequiresPermissions("cms:site:list")
@At
@Ok("json")
public Object list(@Param("pageNum")Integer pageNum,
				   @Param("pageSize")Integer pageSize,
				   @Param("name") String name,
				   @Param("beginTime") Date beginTime,
				   @Param("endTime") Date endTime,
				   @Param("orderByColumn") String orderByColumn,
				   @Param("isAsc") String isAsc,
				   HttpServletRequest req) {
	Cnd cnd = Cnd.NEW();
	if (!Strings.isBlank(name)){
		//cnd.and("name", "like", "%" + name +"%");
	}
	if(Lang.isNotEmpty(beginTime)){
		cnd.and("create_time",">=", beginTime);
	}
	if(Lang.isNotEmpty(endTime)){
		cnd.and("create_time","<=", endTime);
	}
	return siteService.tableList(pageNum,pageSize,cnd,orderByColumn,isAsc,null);
}
 
Example #2
Source File: DeptServiceImpl.java    From NutzSite with Apache License 2.0 6 votes vote down vote up
/**
 * 查询数据树
 * @param parentId
 * @param name
 * @return
 */
@Override
public List<Map<String, Object>> selectTree(String parentId, String name) {
    Cnd cnd = Cnd.NEW();
    if (Strings.isNotBlank(name)) {
        cnd.and("dept_name", "like", "%" + name + "%");
    }
    if (Strings.isNotBlank(parentId)) {
        cnd.and("parent_id", "=", parentId);
    }
    cnd.and("status", "=", false).and("del_flag", "=", false);
    List<Dept> deptList = this.query(cnd);
    List<Map<String, Object>> trees = new ArrayList<Map<String, Object>>();
    trees = getTrees(deptList);
    return trees;
}
 
Example #3
Source File: MenuServiceImpl.java    From NutzSite with Apache License 2.0 6 votes vote down vote up
@Override
public boolean checkMenuUnique(String id, String parentId, String menuName) {
    Cnd cnd =Cnd.NEW();
    if(Strings.isNotBlank(id)){
        cnd.and("id","!=",id);
    }
    if(Strings.isNotBlank(parentId)){
        cnd.and("parent_id","=",parentId);
    }
    if(Strings.isNotBlank(menuName)){
        cnd.and("menu_name", "=", menuName);
    }
    List<Menu> list = this.query(cnd);
    if (Lang.isEmpty(list)) {
        return true;
    }
    return false;
}
 
Example #4
Source File: MenuController.java    From DAFramework with MIT License 6 votes vote down vote up
@RequestMapping(value = "/list")
public ActionResultObj list(@RequestBody SearchQueryJS queryJs) {
	ActionResultObj result = new ActionResultObj();
	try {

		//处理查询条件
		Criteria cnd = Cnd.cri();
		cnd.where().andEquals("del_flag", Constans.POS_NEG.NEG);
		cnd.getOrderBy().asc("sort");

		List<EMenu> allMenus = menuDao.query(cnd);
		EMenu menu = menuDao.buildMenuTree(allMenus);

		//处理返回值
		WMap map = new WMap();
		map.put("data", menu.getItems());
		result.ok(map);
		result.okMsg("查询成功!");
	} catch (Exception e) {
		e.printStackTrace();
		LOG.error("查询失败,原因:" + e.getMessage());
		result.error(e);
	}
	return result;
}
 
Example #5
Source File: MenuController.java    From DAFramework with MIT License 6 votes vote down vote up
@RequestMapping(value = "/allMenu", method = RequestMethod.POST)
public ActionResultObj findAllmenu(@RequestBody SearchQueryJS queryJs) {
	ActionResultObj result = new ActionResultObj();
	try {
		WMap query = queryJs.getQuery();
		//处理查询条件
		Criteria cnd = Cnd.cri();
		cnd.where().andEquals("del_flag", Constans.POS_NEG.NEG);
		if (query.get("extId") != null && StringUtil.isNotBlank(query.get("extId").toString())) {
			cnd.where().andNotIn("id", query.get("extId").toString());
			cnd.where().andNotLike("parent_ids", "%," + query.get("extId").toString() + ",%");
		}
		cnd.getOrderBy().asc("sort");
		List<EMenu> allMenus = menuDao.query(cnd);
		EMenu menu = menuDao.buildMenuTree(allMenus);
		WMap map = new WMap();
		map.put("data", menu.getItems());
		result.setData(map);
		result.okMsg("查询成功!");
	} catch (Exception e) {
		e.printStackTrace();
		LOG.error("查询失败,原因:" + e.getMessage());
		result.error(e);
	}
	return result;
}
 
Example #6
Source File: RoleServiceImpl.java    From NutzSite with Apache License 2.0 6 votes vote down vote up
/**
 * 校验角色名称是否唯一
 * @param roleName
 * @return
 */
@Override
public boolean checkRoleNameUnique(String id, String roleName, String roleKey) {
    Cnd cnd =Cnd.NEW();
    if(Strings.isNotBlank(id)){
        cnd.and("id","!=",id);
    }
    if(Strings.isNotBlank(roleName)){
        cnd.and("role_name", "=", roleName);
    }
    if(Strings.isNotBlank(roleKey)){
        cnd.and("role_key", "=", roleKey);
    }
    List<Role> roleList = this.query(cnd);
    if (Lang.isEmpty(roleList)) {
        return true;
    }
    return false;
}
 
Example #7
Source File: AreaServiceImpl.java    From NutzSite with Apache License 2.0 6 votes vote down vote up
/**
	 * 查询数据树
	 * @param parentId
	 * @param name
	 * @return
	 */
	@Override
    public List<Map<String, Object>> selectTree(String parentId, String name) {
		Cnd cnd = Cnd.NEW();
		if (Strings.isNotBlank(name)) {
			//cnd.and("name", "like", "%" + name + "%");
		}
		if (Strings.isNotBlank(parentId)) {
			cnd.and("parent_id", "=", parentId);
		}
//		cnd.and("status", "=", false).and("del_flag", "=", false);
		List<Area> list = this.query(cnd);
		List<Map<String, Object>> trees = new ArrayList<Map<String, Object>>();
		trees = getTrees(list);
		return trees;
	}
 
Example #8
Source File: UserController.java    From NutzSite with Apache License 2.0 6 votes vote down vote up
/**
     * 修改用户
     */
    @At("/edit/?")
    @Ok("th://sys/user/edit.html")
    public void edit(String id, HttpServletRequest req) {
        User user = userService.fetch(id);
        userService.fetchLinks(user, "dept|roles");
        List<Role> roles = roleService.query(Cnd.where("status", "=", false).and("del_flag", "=", false));
        roles.forEach(role -> {
            if (user.getRoles() != null && user.getRoles().size() > 0) {
//				System.out.println(user.getRoles().contains(role));
                role.setFlag(user.getRoles().contains(role));
            }
        });
        req.setAttribute("user", user);
        req.setAttribute("roles", roles);
    }
 
Example #9
Source File: RoleServiceImpl.java    From NutzSite with Apache License 2.0 6 votes vote down vote up
/**
 * 更新角色
 *
 * @param data
 * @return
 */
@Override
public int update(Role data) {
    List<String> ids = new ArrayList<>();
    if (data != null && data.getMenuIds() != null) {
        if (Strings.isNotBlank(data.getMenuIds())) {
            ids = Arrays.asList(data.getMenuIds().split(","));
        }
        //清除已有关系
        Role tmpData = this.fetch(data.getId());
        this.fetchLinks(tmpData, "menus");
        dao().clearLinks(tmpData, "menus");
    }
    if (ids != null && ids.size() > 0) {
        Criteria cri = Cnd.cri();
        cri.where().andInStrList("id", ids);
        List<Menu> menuList = menuService.query(cri);
        data.setMenus(menuList);
    }
    int count = dao().update(data);
    dao().insertRelation(data, "menus");
    return count;
}
 
Example #10
Source File: RoleController.java    From NutzSite with Apache License 2.0 6 votes vote down vote up
@At
@Ok("json")
public Object list(@Param("pageNum")Integer pageNum,
                   @Param("pageSize")Integer pageSize,
                   @Param("roleName") String roleName,
                   @Param("roleKey") String roleKey,
                   @Param("orderByColumn") String orderByColumn,
                   @Param("isAsc") String isAsc,
                   HttpServletRequest req) {
    Cnd cnd = Cnd.NEW();
    if (!Strings.isBlank(roleName)){
        cnd.and("role_name", "like", "%" + roleName +"%");
    }
    if (!Strings.isBlank(roleKey)){
        cnd.and("role_key", "=", roleKey);
    }
    return roleService.tableList(pageNum,pageSize,cnd,orderByColumn,isAsc,null);
}
 
Example #11
Source File: WxUserController.java    From NutzSite with Apache License 2.0 6 votes vote down vote up
/**
 * 查询微信用户列表
 */
@RequiresPermissions("wx:wxUser:list")
@At
@Ok("json")
public Object list(@Param("pageNum")Integer pageNum,
				   @Param("pageSize")Integer pageSize,
				   @Param("name") String name,
				   @Param("beginTime") Date beginTime,
				   @Param("endTime") Date endTime,
				   @Param("orderByColumn") String orderByColumn,
				   @Param("isAsc") String isAsc,
				   HttpServletRequest req) {
	Cnd cnd = Cnd.NEW();
	if (!Strings.isBlank(name)){
		//cnd.and("name", "like", "%" + name +"%");
	}
	if(Lang.isNotEmpty(beginTime)){
		cnd.and("create_time",">=", beginTime);
	}
	if(Lang.isNotEmpty(endTime)){
		cnd.and("create_time","<=", endTime);
	}
	return wxUserService.tableList(pageNum,pageSize,cnd,orderByColumn,isAsc,null);
}
 
Example #12
Source File: WxUserController.java    From NutzSite with Apache License 2.0 6 votes vote down vote up
@At("/down")
@Ok("json")
@RequiresPermissions("wx:wxUser:sync")
@Slog(tag="微信会员", after="同步会员信息")
public Object down(HttpServletRequest req) {
	try {
		Config config =configService.fetch("token");
		if(Lang.isNotEmpty(config)){
			List<User_info_list>  userInfoLists = UserUtils.getUser(config.getConfigValue());
			if(Lang.isNotEmpty(userInfoLists)){
				userInfoLists.forEach( user->{
					int count =wxUserService.count(Cnd.NEW().and("openid","=",user.getOpenid()));
					if(count==0){
						wxUserService.insert(User_info_list.getUser(user));
					}
				});
			}
		}
		return Result.success("system.success");
	} catch (Exception e) {
		return Result.error("system.error");
	}
}
 
Example #13
Source File: MaterialController.java    From NutzSite with Apache License 2.0 6 votes vote down vote up
/**
 * 查询微信素材列表
 */
@RequiresPermissions("wx:material:list")
@At
@Ok("json")
public Object list(@Param("pageNum")Integer pageNum,
				   @Param("pageSize")Integer pageSize,
				   @Param("name") String name,
				   @Param("beginTime") Date beginTime,
				   @Param("endTime") Date endTime,
				   @Param("orderByColumn") String orderByColumn,
				   @Param("isAsc") String isAsc,
				   HttpServletRequest req) {
	Cnd cnd = Cnd.NEW();
	if (!Strings.isBlank(name)){
		//cnd.and("name", "like", "%" + name +"%");
	}
	if(Lang.isNotEmpty(beginTime)){
		cnd.and("create_time",">=", beginTime);
	}
	if(Lang.isNotEmpty(endTime)){
		cnd.and("create_time","<=", endTime);
	}
	return materialService.tableList(pageNum,pageSize,cnd,orderByColumn,isAsc,null);
}
 
Example #14
Source File: WxMenuController.java    From NutzSite with Apache License 2.0 6 votes vote down vote up
/**
 * 查询微信菜单列表
 */
@At
@Ok("json")
@RequiresPermissions("wx:menu:list")
public Object list(@Param("name") String name,
				   @Param("beginTime") Date beginTime,
				   @Param("endTime") Date endTime,
				   HttpServletRequest req) {
	Cnd cnd = Cnd.NEW();
	if (!Strings.isBlank(name)){
		//cnd.and("name", "like", "%" + name +"%");
	}
	if(Lang.isNotEmpty(beginTime)){
		cnd.and("create_time",">=", beginTime);
	}
	if(Lang.isNotEmpty(endTime)){
		cnd.and("create_time","<=", endTime);
	}
	return wxMenuService.query(cnd);
}
 
Example #15
Source File: WxMenuServiceImpl.java    From NutzSite with Apache License 2.0 6 votes vote down vote up
/**
 * 查询数据树
 * @param parentId
 * @param name
 * @return
 */
@Override
public List<Map<String, Object>> selectTree(String parentId, String name) {
	Cnd cnd = Cnd.NEW();
	if (Strings.isNotBlank(name)) {
		//cnd.and("name", "like", "%" + name + "%");
	}
	if (Strings.isNotBlank(parentId)) {
		cnd.and("parent_id", "=", parentId);
	}
	//cnd.and("status", "=", false).and("del_flag", "=", false);
	List<WxMenu> list = this.query(cnd);
	List<Map<String, Object>> trees = new ArrayList<Map<String, Object>>();
	trees = getTrees(list);
	return trees;
}
 
Example #16
Source File: PetController.java    From NutzSite with Apache License 2.0 6 votes vote down vote up
/**
 * 查询宠物列表
 */
@RequiresPermissions("test:pet:list")
@At
@Ok("json")
public Object list(@Param("pageNum")int pageNum,
				   @Param("pageSize")int pageSize,
				   @Param("name") String name,
				   @Param("beginTime") Date beginTime,
				   @Param("endTime") Date endTime,
				   @Param("orderByColumn") String orderByColumn,
				   @Param("isAsc") String isAsc,
				   HttpServletRequest req) {
	Cnd cnd = Cnd.NEW();
	if (!Strings.isBlank(name)){
		//cnd.and("name", "like", "%" + name +"%");
	}
	if(Lang.isNotEmpty(beginTime)){
		cnd.and("create_time",">=", beginTime);
	}
	if(Lang.isNotEmpty(endTime)){
		cnd.and("create_time","<=", endTime);
	}
	return petService.tableList(pageNum,pageSize,cnd,orderByColumn,isAsc,"master");
}
 
Example #17
Source File: CategoryController.java    From NutzSite with Apache License 2.0 6 votes vote down vote up
/**
 * 查询栏目列表
 */
@At
@Ok("json")
@RequiresPermissions("cms:category:list")
public Object list(@Param("name") String name,
				   @Param("beginTime") Date beginTime,
				   @Param("endTime") Date endTime,
				   HttpServletRequest req) {
	Cnd cnd = Cnd.NEW();
	if (!Strings.isBlank(name)){
		//cnd.and("name", "like", "%" + name +"%");
	}
	if(Lang.isNotEmpty(beginTime)){
		cnd.and("create_time",">=", beginTime);
	}
	if(Lang.isNotEmpty(endTime)){
		cnd.and("create_time","<=", endTime);
	}
	cnd.asc("sort");
	return categoryService.query(cnd);
}
 
Example #18
Source File: CategoryServiceImpl.java    From NutzSite with Apache License 2.0 6 votes vote down vote up
/**
 * 查询数据树
 * @param parentId
 * @param name
 * @return
 */
@Override
   public List<Map<String, Object>> selectTree(String parentId, String name) {
	Cnd cnd = Cnd.NEW();
	if (Strings.isNotBlank(name)) {
		//cnd.and("name", "like", "%" + name + "%");
	}
	if (Strings.isNotBlank(parentId)) {
		cnd.and("parent_id", "=", parentId);
	}
	//cnd.and("status", "=", false).and("del_flag", "=", false);
	cnd.asc("sort");
	List<Category> list = this.query(cnd);
	List<Map<String, Object>> trees = new ArrayList<Map<String, Object>>();
	trees = getTrees(list);
	return trees;
}
 
Example #19
Source File: FrontController.java    From NutzSite with Apache License 2.0 6 votes vote down vote up
/**
 * 栏目导航
 * @param id
 * @param req
 */
@At("/category/?")
@Ok("th:/cms/front/category.html")
public void category(String id, HttpServletRequest req) {
    List<String> ids = new ArrayList<>();

    List<Category> list = categoryService.query(Cnd.where("parent_id", "=", id).asc("sort"));
    ids.add(id);
    list.stream().forEach(cate->{
        ids.add(cate.getId());
    });
    List<Article> articleList = articleService.query(Cnd.where("category_id", "in", ids));
    req.setAttribute("id", id);
    req.setAttribute("list", list);
    req.setAttribute("nav_categories",categoryService.getCateById("1"));
    req.setAttribute("articleList", articleList);
}
 
Example #20
Source File: FrontController.java    From NutzSite with Apache License 2.0 6 votes vote down vote up
/**
 * 内容展示
 * @param id
 * @param req
 */
@At
@Ok("th:/cms/front/content.html")
public void articleById(@Param("id") String id, HttpServletRequest req) {
    Article article = articleService.fetch(id);
    article.setHits(article.getHits() + 1);
    if (article != null) {
        articleService.fetchLinks(article, "category|createUser");
        List<Category> list = categoryService.query(Cnd.where("id", "=", article.getCategoryId()).asc("sort"));
        req.setAttribute("id", article.getCategoryId());
        req.setAttribute("article", article);
        req.setAttribute("list", list);
    }
    req.setAttribute("nav_categories",categoryService.getCateById("1"));
    articleService.updateIgnoreNull(article);
}
 
Example #21
Source File: MasterController.java    From NutzSite with Apache License 2.0 6 votes vote down vote up
/**
 * 查询主人列表
 */
@RequiresPermissions("test:master:list")
@At
@Ok("json")
public Object list(@Param("pageNum")int pageNum,
				   @Param("pageSize")int pageSize,
				   @Param("name") String name,
				   @Param("beginTime") Date beginTime,
				   @Param("endTime") Date endTime,
				   @Param("orderByColumn") String orderByColumn,
				   @Param("isAsc") String isAsc,
				   HttpServletRequest req) {
	Cnd cnd = Cnd.NEW();
	if (!Strings.isBlank(name)){
		//cnd.and("name", "like", "%" + name +"%");
	}
	if(Lang.isNotEmpty(beginTime)){
		cnd.and("create_time",">=", beginTime);
	}
	if(Lang.isNotEmpty(endTime)){
		cnd.and("create_time","<=", endTime);
	}
	return masterService.tableList(pageNum,pageSize,cnd,orderByColumn,isAsc,null);
}
 
Example #22
Source File: OperLogController.java    From NutzSite with Apache License 2.0 6 votes vote down vote up
/**
 * 查询操作日志记录列表
 */
@RequiresPermissions("monitor:operLog:list")
@At
@Ok("json")
public Object list(@Param("pageNum")Integer pageNum,
				   @Param("pageSize")Integer pageSize,
				   @Param("title") String name,
				   @Param("operName") String uid,
				   @Param("orderByColumn") String orderByColumn,
				   @Param("isAsc") String isAsc,
				   HttpServletRequest req) {
	Cnd cnd = Cnd.NEW();
	if (!Strings.isBlank(name)){
		cnd.and("tg", "like", "%" + name +"%");
	}
	if (!Strings.isBlank(uid)){
		cnd.and("u_name", "=", uid);
	}
	return operLogService.tableList(pageNum,pageSize,cnd,orderByColumn,isAsc);
}
 
Example #23
Source File: UserOnlineController.java    From NutzSite with Apache License 2.0 6 votes vote down vote up
/**
 * 查询在线用户记录列表
 */
@RequiresPermissions("monitor:online:list")
@At
@Ok("json")
public Object list(@Param("pageNum")Integer pageNum,
				   @Param("pageSize")Integer pageSize,
				   @Param("name") String ipaddr,
				   @Param("loginName") String loginName,
				   @Param("orderByColumn") String orderByColumn,
				   @Param("isAsc") String isAsc,
				   HttpServletRequest req) {
	Cnd cnd = Cnd.NEW();
	if (!Strings.isBlank(ipaddr)){
		cnd.and("ipaddr", "=", ipaddr);
	}
	if (!Strings.isBlank(loginName)){
		cnd.and("login_name", "=", loginName);
	}
	return userOnlineService.tableList(pageNum,pageSize,cnd,orderByColumn,isAsc,null);
}
 
Example #24
Source File: LogininforController.java    From NutzSite with Apache License 2.0 6 votes vote down vote up
/**
 * 查询系统访问记录列表
 */
@RequiresPermissions("monitor:logininfor:list")
@At
@Ok("json")
public Object list(@Param("pageNum")Integer pageNum,
				   @Param("pageSize")Integer pageSize,
				   @Param("name") String name,
				   @Param("orderByColumn") String orderByColumn,
				   @Param("isAsc") String isAsc,
				   HttpServletRequest req) {
	Cnd cnd = Cnd.NEW();
	if (!Strings.isBlank(name)){
		//cnd.and("name", "like", "%" + name +"%");
	}
	return logininforService.tableList(pageNum,pageSize,cnd,orderByColumn,isAsc,null);
}
 
Example #25
Source File: MainLauncher.java    From NutzSite with Apache License 2.0 6 votes vote down vote up
/**
 * 初始化 定时任务
 * @param ioc
 */
private void initSysTask(Ioc ioc) {
    QuartzManager quartzManager = ioc.get(QuartzManager.class);
    quartzManager.clear();
    List<Task> taskList = taskService.query( Cnd.where("status", "=", true));
    for (Task sysTask : taskList) {
        try {
            QuartzJob qj = new QuartzJob();
            qj.setJobName(sysTask.getId());
            qj.setJobGroup(sysTask.getId());
            qj.setClassName(sysTask.getJobClass());
            qj.setCron(sysTask.getCron());
            qj.setComment(sysTask.getNote());
            qj.setDataMap(sysTask.getData());
            quartzManager.add(qj);
        } catch (Exception e) {
            log.error(e.getMessage());
        }
    }
}
 
Example #26
Source File: SimpleAuthorizingRealm.java    From NutzSite with Apache License 2.0 6 votes vote down vote up
@Override
	protected AuthenticationInfo doGetAuthenticationInfo(AuthenticationToken token) throws AuthenticationException {
		UsernamePasswordToken upToken = (UsernamePasswordToken) token;
		if (Lang.isEmpty(upToken) || Strings.isEmpty(upToken.getUsername())) {
			throw Lang.makeThrow(AuthenticationException.class, "Account name is empty");
		}
		User user = userService.fetch(Cnd.where("login_name","=",upToken.getUsername()));
		if (Lang.isEmpty(user)) {
			throw Lang.makeThrow(UnknownAccountException.class, "Account [ %s ] not found", upToken.getUsername());
		}
		if (user.isStatus()) {
			throw Lang.makeThrow(LockedAccountException.class, "Account [ %s ] is locked.", upToken.getUsername());
		}
		SimpleAuthenticationInfo info = new SimpleAuthenticationInfo(user,
				user.getPassword().toCharArray(), ByteSource.Util.bytes(user.getSalt()), getName());
		info.setCredentialsSalt(ByteSource.Util.bytes(user.getSalt()));
//        info.
		return info;
	}
 
Example #27
Source File: AreaDao.java    From DAFramework with MIT License 6 votes vote down vote up
public EArea allArea(WMap query) {
	//处理查询条件
	Criteria cnd = Cnd.cri();
	cnd.where().andEquals("del_flag", Constans.POS_NEG.NEG);
	if (query.get("extId") != null && StringUtil.isNotBlank(query.get("extId").toString())) {
		cnd.where().andNotIn("id", query.get("extId").toString());
		cnd.where().andNotLike("parent_ids", "%," + query.get("extId").toString() + ",%");
	}
	cnd.getOrderBy().asc("sort");
	List<EArea> allAreas = query(cnd);
	List<ITreeNode<EArea>> allNodes = new ArrayList<>();
	EArea root = new EArea();
	root.setId(0L);
	allNodes.add(root);
	if (allAreas != null && !allAreas.isEmpty()) {
		allNodes.addAll(allAreas);
	}
	return (EArea) root.buildTree(allNodes);
}
 
Example #28
Source File: RoleDao.java    From DAFramework with MIT License 6 votes vote down vote up
public ERole save(ERole role) {
	Long newId = role.getId();
	if (newId != null) {
		ERole tmp = fetch(newId);
		if (tmp != null) {
			_update(role);
			return role;
		}
		//FIXME 插入是不会使用设置过的id,始终自动生成:(
		role = _insert(role);
		update(Chain.make("id", newId), Cnd.where("id", "=", role.getId()));
		role.setId(newId);
		return role;
	}
	return _insert(role);
}
 
Example #29
Source File: UserController.java    From DAFramework with MIT License 6 votes vote down vote up
@RequestMapping(value = "/roleList")
public ActionResultObj getAllRoleList() {
	ActionResultObj result = new ActionResultObj();
	try {
		Criteria cnd = Cnd.cri();
		//			cnd.where().andNotEquals("name", "Admin");
		List<ERole> roles = roleDao.query(cnd);
		WMap map = new WMap();
		map.put("data", roles);
		result.ok(map);
		result.okMsg("查询角色列表成功!");
	} catch (Exception e) {
		LOG.error("获取角色列表失败:" + e.getMessage());
		result.error(e);
	}
	return result;
}
 
Example #30
Source File: DictController.java    From DAFramework with MIT License 6 votes vote down vote up
@RequestMapping(value="type/{type}")
public ActionResultObj findByType(@PathVariable String type){
	ActionResultObj result = new ActionResultObj();
	try{
		if(StringUtil.isNotBlank(type)){
				List<EDict> dictList = dictDao.query(Cnd.where("type", "=", type).and("del_flag", "=", Constans.POS_NEG.NEG).orderBy("sort", "asc"));
				//处理返回值
				WMap map = new WMap();
				map.put("type", type);
				map.put("data", dictList);
				result.ok(map);
				result.okMsg("查询成功!");
		}else{
			result.errorMsg("查询失败,字典类型不存在!");
		}
	}catch(Exception e){
		e.printStackTrace();
		LOG.error("查询失败,原因:"+e.getMessage());
		result.error(e);
	}
	return result;
}