Java Code Examples for com.jfinal.plugin.activerecord.Db#getSqlPara()

The following examples show how to use com.jfinal.plugin.activerecord.Db#getSqlPara() . 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: ResServiceImpl.java    From jboot-admin with Apache License 2.0 5 votes vote down vote up
@Override
public List<Res> findByRoleIdAndStatusUsed(Long id) {
    SqlPara sp = Db.getSqlPara("system-res.findByRoleIdAndStatusUsed");
    sp.addPara(ResStatus.USED);
    sp.addPara(RoleStatus.USED);
    sp.addPara(id);
    return DAO.find(sp);
}
 
Example 2
Source File: ResServiceImpl.java    From jboot-admin with Apache License 2.0 5 votes vote down vote up
@Override
public List<Res> findByUserNameAndStatusUsed(String name) {
    SqlPara sp = Db.getSqlPara("system-res.findByUserNameAndStatusUsed");
    sp.addPara(ResStatus.USED);
    sp.addPara(RoleStatus.USED);
    sp.addPara(name);
    return DAO.find(sp);
}
 
Example 3
Source File: ResServiceImpl.java    From jboot-admin with Apache License 2.0 5 votes vote down vote up
@Override
public List<Res> findTopMenuByUserName(String name) {
    SqlPara sp = Db.getSqlPara("system-res.findTopMenuByUserName");
    sp.addPara(ResStatus.USED);
    sp.addPara(RoleStatus.USED);
    sp.addPara(0L);
    sp.addPara(name);
    return DAO.find(sp);
}
 
Example 4
Source File: ResServiceImpl.java    From jboot-admin with Apache License 2.0 5 votes vote down vote up
@Override
public List<Res> findLeftMenuByUserNameAndPid(String name, Long pid) {
    SqlPara sp = Db.getSqlPara("system-res.findLeftMenuByUserNameAndPid");
    sp.addPara(ResStatus.USED);
    sp.addPara(RoleStatus.USED);
    sp.addPara(pid);
    sp.addPara(name);
    return DAO.find(sp);
}
 
Example 5
Source File: SysUserDao.java    From sdb-mall with Apache License 2.0 5 votes vote down vote up
public List<String> queryAllPerms(Long userId) {
    SqlPara sqlPara = Db.getSqlPara("sysUser.queryAllPerms", Kv.by("userId", userId));
    List<Record> sysUserList = Db.find(sqlPara);
    List<String> perms = new ArrayList<>();
    for (Record r:sysUserList
         ) {
        if(r == null || r.get("perms") == null) {
            continue;
        }
        perms.add(r.get("perms"));
    }

    return perms;
}
 
Example 6
Source File: SysUserDao.java    From sdb-mall with Apache License 2.0 5 votes vote down vote up
public List<Long> queryAllMenuId(Long userId) {
    SqlPara sqlPara = Db.getSqlPara("sysUser.queryAllMenuId", Kv.by("userId", userId));
    List<Record> sysMenuList = Db.find(sqlPara);
    List<Long> menuIds = new ArrayList<>();
    for (Record r:sysMenuList
         ) {
        if(r == null || r.get("menu_id") == null) {
            continue;
        }
        menuIds.add(r.get("menu_id"));
    }

    return menuIds;
}
 
Example 7
Source File: SysConfigServiceImpl.java    From sdb-mall with Apache License 2.0 5 votes vote down vote up
@Override
@JFinalTx
public void updateValueByKey(String key, String value) {
	SqlPara sqlPara = Db.getSqlPara("sysConfig.updateValueByKey", Kv.by("paramValue", value).set("paramKey", key));
	Db.update(sqlPara);
	sysConfigRedis.delete(key);
}
 
Example 8
Source File: FavoriteGoodsServiceImpl.java    From sdb-mall with Apache License 2.0 5 votes vote down vote up
@Override
public List<FavoriteGoodsDTO> list(String userId) {
    SqlPara sqlPara =  Db.getSqlPara("favoriteGoods.list", Kv.by("userId", userId));
    List<Record> recordList = Db.find(sqlPara);
    List<FavoriteGoodsDTO> favoriteGoodsDTOList = RecordUtils.converModel(recordList, FavoriteGoodsDTO.class);
    return favoriteGoodsDTOList;
}
 
Example 9
Source File: ProductServiceImpl.java    From sdb-mall with Apache License 2.0 5 votes vote down vote up
@Override
public List<ProductDTO> listDetailByProductIds(String productIds) {
    String[] productIdArr = productIds.split(",");
    SqlPara sqlPara = Db.getSqlPara("product.listDetailByProductIds", Kv.by("productIds", productIdArr));
    List<Record> recordList = Db.find(sqlPara);
    List<ProductDTO> productDTOList = RecordUtils.converModel(recordList, ProductDTO.class);

    return productDTOList;
}
 
Example 10
Source File: CartServiceImpl.java    From sdb-mall with Apache License 2.0 5 votes vote down vote up
@Override
public List<CartDTO> listDetail(String userId) {
    SqlPara sqlPara =  Db.getSqlPara("cart.listDetail", Kv.by("userId", userId));
    List<Record> recordList = Db.find(sqlPara);
    List<CartDTO> cartDTOList = RecordUtils.converModel(recordList, CartDTO.class);
    return cartDTOList;
}
 
Example 11
Source File: SysUserDaoTest.java    From sdb-mall with Apache License 2.0 5 votes vote down vote up
@Test
public void test() {
    List<Filter> filterList = new ArrayList<>();
    Filter filter = new Filter();
    filter.setProperty("aaa");
    filter.setOperator(Filter.Operator.eq);
    filter.setValue("123");
    filterList.add(filter);

    filter = new Filter();
    filter.setProperty(null);
    filter.setOperator(Filter.Operator.eq);
    filter.setValue("111");
    filterList.add(filter);

    filter = new Filter();
    filter.setProperty("bbb");
    filter.setOperator(Filter.Operator.eq);
    filter.setValue("321");
    filterList.add(filter);

    filter = new Filter();
    filter.setProperty("intest");
    filter.setOperator(Filter.Operator.in);
    filter.setValue(new ArrayList<String>() {
        {add("aaa");add("bbb");}
    });
    filterList.add(filter);
    SqlPara sqlPara = Db.getSqlPara("common.findList", Kv.by("tableName", "aaa").set("filters", filterList));
    List<Record> record = Db.find(sqlPara);
    log.info("{}", record);
}
 
Example 12
Source File: RoleServiceImpl.java    From jboot-admin with Apache License 2.0 4 votes vote down vote up
@Override
public List<Role> findByUserName(String name) {
    SqlPara sp = Db.getSqlPara("system-role.findByUserName");
    sp.addPara(name);
    return DAO.find(sp);
}
 
Example 13
Source File: ProductCategoryDao.java    From sdb-mall with Apache License 2.0 4 votes vote down vote up
public List<ProductCategory> queryListOrder(){
    SqlPara sqlPara = Db.getSqlPara("productCategory.queryListOrder");
    return this.find(sqlPara);
}
 
Example 14
Source File: SysMenuDao.java    From sdb-mall with Apache License 2.0 4 votes vote down vote up
public List<SysMenu> queryNotButtonList() {
    SqlPara sqlPara = Db.getSqlPara("sysMenu.queryNotButtonList");
    return this.find(sqlPara);
}
 
Example 15
Source File: SysUserDao.java    From sdb-mall with Apache License 2.0 4 votes vote down vote up
public SysUser queryByUserName(String name) {
    SqlPara sqlPara = Db.getSqlPara("sysUser.queryByUserName", Kv.by("username", name));
    SysUser sysUserList = this.findFirst(sqlPara);
    return sysUserList;
}
 
Example 16
Source File: OrderMasterServiceImpl.java    From sdb-mall with Apache License 2.0 4 votes vote down vote up
@Override
public Boolean updateByGrouponId(String grouponId,Integer status) {
    SqlPara sqlPara = Db.getSqlPara("order.updateByGrouponId", Kv.by("orderStatus", status).set("grouponId", grouponId));
    return Db.update(sqlPara) > 0;
}