本文整理汇总了Java中org.nutz.dao.Cnd.cri方法的典型用法代码示例。如果您正苦于以下问题:Java Cnd.cri方法的具体用法?Java Cnd.cri怎么用?Java Cnd.cri使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.nutz.dao.Cnd
的用法示例。
在下文中一共展示了Cnd.cri方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: allArea
import org.nutz.dao.Cnd; //导入方法依赖的package包/类
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);
}
示例2: getAllRoleList
import org.nutz.dao.Cnd; //导入方法依赖的package包/类
@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;
}
示例3: list
import org.nutz.dao.Cnd; //导入方法依赖的package包/类
@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;
}
示例4: findAllmenu
import org.nutz.dao.Cnd; //导入方法依赖的package包/类
@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;
}
示例5: getAreaByParentId
import org.nutz.dao.Cnd; //导入方法依赖的package包/类
/**
* 根据一个parentId,得到其下级的地区
* @param parentId
* @return
*/
public List<EArea> getAreaByParentId(Long parentId){
//处理查询条件
Criteria cnd = Cnd.cri();
cnd.where().andEquals("del_flag", Constans.POS_NEG.NEG);
cnd.where().andEquals("parent_id", parentId);
cnd.getOrderBy().asc("sort");
List<EArea> areas = query(cnd);
return areas;
}
示例6: getDictListByType
import org.nutz.dao.Cnd; //导入方法依赖的package包/类
/**
* 获取具体类型数据字典列表
* @param type
* @return
*/
public List<EDict> getDictListByType(String type){
SimpleCriteria simpleCr=Cnd.cri();
simpleCr.where().and("type", "=", type);
simpleCr.asc("sort");
return query(simpleCr);
}
示例7: delete
import org.nutz.dao.Cnd; //导入方法依赖的package包/类
public boolean delete(long id) {
EArea area = areaDao.fetch(id);
if(area ==null){
return false;
}
Criteria cnd = Cnd.cri();
cnd.where().andEquals("id", area.getId());
cnd.where().orLike("parent_ids", "%,"+area.getId()+",%");
Chain chain = Chain.make("del_flag", Constans.POS_NEG.POS);
return areaDao.update(chain, cnd)>0 ? true : false;
}
示例8: delete
import org.nutz.dao.Cnd; //导入方法依赖的package包/类
public boolean delete(long id) {
EOrg org = orgDao.fetch(id);
if(org ==null){
return false;
}
Criteria cnd = Cnd.cri();
cnd.where().andEquals("id", org.getId());
cnd.where().orLike("parent_ids", "%,"+org.getId()+",%");
Chain chain = Chain.make("del_flag", Constans.POS_NEG.POS);
return orgDao.update(chain, cnd)>0 ? true : false;
}
示例9: delete
import org.nutz.dao.Cnd; //导入方法依赖的package包/类
public boolean delete(long id) {
EMenu menu = menuDao.fetch(id);
if (menu == null) { return false; }
Criteria cnd = Cnd.cri();
cnd.where().andEquals("id", menu.getId());
cnd.where().orLike("parent_ids", "%," + menu.getId() + ",%");
Chain chain = Chain.make("del_flag", Constans.POS_NEG.POS);
return menuDao.update(chain, cnd) > 0 ? true : false;
}
示例10: getUserRoles
import org.nutz.dao.Cnd; //导入方法依赖的package包/类
/**
* 根据用户ID,获取用户对应的角色列表
* @param userId
* @return
* @throws Exception
*/
public List<ERole> getUserRoles(Long userId) throws Exception {
List<ERole> userRoles = null;
if (userId != null) {
Criteria cnd = Cnd.cri();
cnd.where().and("id", "in", "select roleid from sys_user_role where userid=" + userId + "");
userRoles = roleDao.query(cnd);
}
return userRoles;
}
示例11: getOrgsByListByType
import org.nutz.dao.Cnd; //导入方法依赖的package包/类
@RequestMapping(value = "/getOrgs/{type}")
public ActionResultObj getOrgsByListByType(@PathVariable String type) {
ActionResultObj result = new ActionResultObj();
try {
if (StringUtil.isNotBlank(type)) {
// 处理查询条件
Criteria cnd = Cnd.cri();
if(!type.equals("all")){
cnd.where().andEquals("type", type);
}
cnd.getOrderBy().desc("id");
// 分页查询
List<EOrg> orgList = orgDao.query(cnd);
// 处理返回值
WMap map = new WMap();
map.put("data", orgList);
result.ok(map);
result.okMsg("查询成功!");
} else {
result.errorMsg("删除失败,链接不存在!");
}
} catch (Exception e) {
e.printStackTrace();
LOG.error("查询失败,原因:" + e.getMessage());
result.error(e);
}
return result;
}
示例12: list
import org.nutz.dao.Cnd; //导入方法依赖的package包/类
@RequestMapping(value="list")
public ActionResultObj list(@RequestBody SearchQueryJS queryJs){
ActionResultObj result = new ActionResultObj();
try{
Pager pager = queryJs.toPager();
WMap query = queryJs.getQuery();
//处理查询条件
Criteria cnd = Cnd.cri();
if(query.get("type") != null && StringUtil.isNotBlank(query.get("type").toString())){
cnd.where().andEquals("type", query.get("type").toString());
}
cnd.getGroupBy().groupBy("type");
cnd.getOrderBy().desc("sort");
//分页查询
List<EDict> projectList = dictDao.query(cnd, pager);
//处理返回值
WMap map = new WMap();
if(queryJs.getQuery() != null){
map.putAll(queryJs.getQuery());
}
map.put("data", projectList);
map.put("page", queryJs.toWPage(pager));
result.ok(map);
result.okMsg("查询成功!");
}catch(Exception e){
e.printStackTrace();
LOG.error("查询失败,原因:"+e.getMessage());
result.error(e);
}
return result;
}
示例13: list
import org.nutz.dao.Cnd; //导入方法依赖的package包/类
@RequestMapping(value = "/list")
public ActionResultObj list(@RequestBody SearchQueryJS queryJs) {
ActionResultObj result = new ActionResultObj();
try {
Pager pager = queryJs.toPager();
WMap query = queryJs.getQuery();
//处理查询条件
Criteria cnd = Cnd.cri();
cnd.where().andEquals("del_flag", Constans.POS_NEG.NEG);
if (query.get("name") != null && StringUtil.isNotBlank(query.get("name").toString())) {
cnd.where().andLike("name", query.get("name").toString()).orLike("full_name", query.get("name").toString());
}
cnd.getOrderBy().asc("sort");
//分页查询
List<EArea> areaList = areaDao.query(cnd, pager);
pager.setRecordCount(areaDao.count(cnd));
//处理返回值
WMap map = new WMap();
if (queryJs.getQuery() != null) {
map.putAll(queryJs.getQuery());
}
map.put("data", areaList);
map.put("page", queryJs.toWPage(pager));
result.ok(map);
result.okMsg("查询成功!");
} catch (Exception e) {
e.printStackTrace();
LOG.error("查询失败,原因:" + e.getMessage());
result.error(e);
}
return result;
}
示例14: list
import org.nutz.dao.Cnd; //导入方法依赖的package包/类
@RequestMapping(value="/list")
public ActionResultObj list(@RequestBody SearchQueryJS queryJs){
ActionResultObj result = new ActionResultObj();
try{
Pager pager = queryJs.toPager();
WMap query = queryJs.getQuery();
//处理查询条件
Criteria cnd = Cnd.cri();
if(query.get("type") != null && StringUtil.isNotBlank(query.get("type").toString())){
cnd.where().andEquals("type", query.get("type").toString());
}
cnd.getGroupBy().groupBy("type");
cnd.getOrderBy().desc("sort");
//分页查询
List<EFile> projectList = fileDao.query(cnd, pager);
//处理返回值
WMap map = new WMap();
if(queryJs.getQuery() != null){
map.putAll(queryJs.getQuery());
}
map.put("data", projectList);
map.put("page", queryJs.toWPage(pager));
result.ok(map);
result.okMsg("查询成功!");
}catch(Exception e){
e.printStackTrace();
LOG.error("查询失败,原因:"+e.getMessage());
result.error(e);
}
return result;
}
示例15: list
import org.nutz.dao.Cnd; //导入方法依赖的package包/类
@RequestMapping(value = "/list")
public ActionResultObj list(@RequestBody SearchQueryJS queryJs) {
ActionResultObj result = new ActionResultObj();
try {
Pager pager = queryJs.toPager();
WMap query = queryJs.getQuery();
// 处理查询条件
Criteria cnd = Cnd.cri();
cnd.where().andEquals("del_flag", Constans.POS_NEG.NEG);
if (query.get("queryArea") != null && StringUtil.isNotBlank(query.get("queryArea").toString())) {
cnd.where().andEquals("area_id", query.get("queryArea").toString());
}
if (query.get("queryType") != null && StringUtil.isNotBlank(query.get("queryType").toString())) {
cnd.where().andEquals("type", query.get("queryType").toString());
}
if (query.get("queryName") != null && StringUtil.isNotBlank(query.get("queryName").toString())) {
cnd.where().andLike("name", "%" + query.get("queryName").toString() + "%");
}
cnd.getOrderBy().asc("id");
// 分页查询
List<EOrg> orgList = orgDao.query(cnd, pager);
pager.setRecordCount(orgDao.count(cnd));
for (EOrg eOrg : orgList) {
EArea area = areaDao.fetch(eOrg.getAreaId());
if (area != null) {
eOrg.setArea(area);
}
}
// 处理返回值
WMap map = new WMap();
if (queryJs.getQuery() != null) {
map.putAll(queryJs.getQuery());
}
map.put("data", orgList);
map.put("page", queryJs.toWPage(pager));
result.ok(map);
result.okMsg("查询成功!");
} catch (Exception e) {
e.printStackTrace();
LOG.error("查询失败,原因:" + e.getMessage());
result.error(e);
}
return result;
}