Java Code Examples for io.jboot.db.model.Columns#eq()
The following examples show how to use
io.jboot.db.model.Columns#eq() .
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: PermissionServiceProvider.java From jpress with GNU Lesser General Public License v3.0 | 6 votes |
@Override public int sync(List<Permission> permissions) { if (permissions == null || permissions.isEmpty()) { return 0; } int syncCounter = 0; for (Permission permission : permissions) { Columns columns = Columns.create("node", permission.getNode()); columns.eq("action_key", permission.getActionKey()); Permission dbPermission = DAO.findFirstByColumns(columns); if (dbPermission == null) { permission.save(); syncCounter++; } } return syncCounter; }
Example 2
Source File: _FinanceController.java From jpress with GNU Lesser General Public License v3.0 | 6 votes |
@AdminMenu(text = "支付记录", groupId = JPressConsts.SYSTEM_MENU_ORDER, order = 3) public void paylist() { Columns columns = Columns.create(); columns.likeAppendPercent("trx_no", getPara("ns")); columns.likeAppendPercent("product_title", getPara("pt")); columns.eq("status", getPara("status")); Page<PaymentRecord> page = paymentService.paginate(getPagePara(), 20, columns); setAttr("page", page); long successCount = paymentService.findCountByColumns(Columns.create("status", PaymentRecord.STATUS_PAY_SUCCESS)); long prepayCount = paymentService.findCountByColumns(Columns.create("status", PaymentRecord.STATUS_PAY_PRE)); long failCount = paymentService.findCountByColumns(Columns.create("status", PaymentRecord.STATUS_PAY_FAILURE)); setAttr("successCount", successCount); setAttr("prepayCount", prepayCount); setAttr("failCount", failCount); setAttr("totalCount", successCount + prepayCount + failCount); render("finance/paylist.html"); }
Example 3
Source File: ArticleServiceProvider.java From jpress with GNU Lesser General Public License v3.0 | 6 votes |
@Override @Cacheable(name = "articles") public List<Article> findRelevantListByArticleId(long articleId, String status, Integer count) { List<ArticleCategory> tags = categoryService.findListByArticleId(articleId, ArticleCategory.TYPE_TAG); if (tags == null || tags.isEmpty()) { return null; } List<Long> tagIds = tags.stream().map(category -> category.getId()).collect(Collectors.toList()); Columns columns = Columns.create(); columns.in("m.category_id", tagIds.toArray()); columns.ne("article.id", articleId); columns.eq("article.status", status); List<Article> articles = DAO.leftJoin("article_category_mapping").as("m") .on("article.id = m.`article_id`") .findListByColumns(columns, count); return joinUserInfo(articles); }
Example 4
Source File: ProductServiceProvider.java From jpress with GNU Lesser General Public License v3.0 | 6 votes |
@Override @Cacheable(name = "products", liveSeconds = 60 * 60) public List<Product> findRelevantListByProductId(Long productId, int status, Integer count) { List<ProductCategory> tags = categoryService.findListByProductId(productId, ProductCategory.TYPE_TAG); if (tags == null || tags.isEmpty()) { return null; } List<Long> tagIds = tags.stream().map(category -> category.getId()).collect(Collectors.toList()); Columns columns = Columns.create(); columns.in("m.category_id", tagIds.toArray()); columns.ne("product.id", productId); columns.eq("product.status", status); List<Product> list = DAO.leftJoin("product_category_mapping").as("m") .on("product.id = m.`product_id`") .findListByColumns(columns,count); return joinUserInfo(list); }
Example 5
Source File: ResServiceImpl.java From jboot-admin with Apache License 2.0 | 5 votes |
@Override public Page<Res> findPage(Res sysRes, int pageNumber, int pageSize) { Columns columns = Columns.create(); columns.eq("pid", sysRes.getPid() == null ? 0L : sysRes.getPid()); if (StrKit.notBlank(sysRes.getName())) { columns.like("name", "%"+sysRes.getName()+"%"); } if (StrKit.notBlank(sysRes.getUrl())) { columns.like("url", "%"+sysRes.getUrl()+"%"); } return DAO.paginateByColumns(pageNumber, pageSize, columns.getList(), "seq asc"); }
Example 6
Source File: ResServiceImpl.java From jboot-admin with Apache License 2.0 | 5 votes |
@Override public List<ZTree> findTreeOnUse() { Columns columns = Columns.create(); columns.eq("status", ResStatus.USED); List<Res> list = DAO.findListByColumns(columns, "pid desc, seq asc"); List<ZTree> zList = new ArrayList<ZTree>(); for (Res res : list) { ZTree ztree = new ZTree(res.getId(), res.getName(), res.getPid()); zList.add(ztree); } return zList; }
Example 7
Source File: DataServiceImpl.java From jboot-admin with Apache License 2.0 | 5 votes |
@Cacheable(name = CacheKey.CACHE_KEYVALUE) @Override public Map<String, String> getMapByType(String type) { Columns columns = Columns.create(); columns.eq("type", type); List<Data> dataList = DAO.findListByColumns(columns); Map<String, String> map = new LinkedHashMap<String, String>(); for (Data data : dataList) { map.put(data.getCodeDesc(), data.getCode()); } return map; }
Example 8
Source File: DataServiceImpl.java From jboot-admin with Apache License 2.0 | 5 votes |
@Cacheable(name = CacheKey.CACHE_KEYVALUE) @Override public List<Data> getListByType(String type) { Columns columns = Columns.create(); columns.eq("type", type); return DAO.findListByColumns(columns); }
Example 9
Source File: MessageListDirective.java From jpress with GNU Lesser General Public License v3.0 | 5 votes |
@Override public void onRender(Env env, Scope scope, Writer writer) { Columns columns = new Columns(); columns.eq("show", true); List<JpressAddonMessage> jpressAddonMessageList = service.findListByColumns(columns); scope.setLocal("messageList", jpressAddonMessageList); renderBody(env, scope, writer); }
Example 10
Source File: _UserController.java From jpress with GNU Lesser General Public License v3.0 | 5 votes |
@AdminMenu(text = "用户管理", groupId = JPressConsts.SYSTEM_MENU_USER, order = 0) public void index() { Columns columns = Columns.create("status", getPara("status")); columns.likeAppendPercent("username", getTrimPara("username")); // columns.likeAppendPercent("nickname", getPara("username")); columns.likeAppendPercent("email", getTrimPara("email")); columns.likeAppendPercent("mobile", getTrimPara("mobile")); columns.eq("create_source", getPara("create_source")); List<MemberGroup> memberGroups = memberGroupService.findAll(); setAttr("memberGroups", memberGroups); Page<User> page = userService._paginate(getPagePara(), 10, columns, getParaToLong("group_id"), getPara("tag")); int lockedCount = userService.findCountByStatus(User.STATUS_LOCK); int regCount = userService.findCountByStatus(User.STATUS_REG); int okCount = userService.findCountByStatus(User.STATUS_OK); setAttr("lockedCount", lockedCount); setAttr("regCount", regCount); setAttr("okCount", okCount); setAttr("totalCount", lockedCount + regCount + okCount); setAttr("page", page); List<Role> roles = roleService.findAll(); setAttr("roles", roles); render("user/list.html"); }
Example 11
Source File: SqlUtils.java From jpress with GNU Lesser General Public License v3.0 | 5 votes |
public static void main(String[] args){ Columns columns = Columns.create(); columns.eq("a.id",1); System.out.println(toWhereSql(columns)); columns.in("c.id",1,2,4,5); System.out.println(toWhereSql(columns)); columns.or(); columns.between("created",new Date(),new Date()); System.out.println(toWhereSql(columns)); }