public ErrorResponse updateCategory(List<Categories> categories) { for (Categories category : categories) { if (categoriesMapper.checkCategories(category).size() != 0) { return new ErrorResponse.Builder(1, "更新失败").build(); } categoriesMapper.updateCategory(category); } return new ErrorResponse.Builder(0, "OK").build(); }
public ErrorResponse addCategory(List<Categories> categories) { for (Categories category : categories) { if (categoriesMapper.checkCategories(category).size() != 0) { return new ErrorResponse.Builder(1, "类别已存在").build(); } categoriesMapper.addCategoory(category); } logger.info("插入数据成功,共" + categories.size() + "条"); return new ErrorResponse.Builder(0, "OK").build(); }
public List<Categories> getCategories() { return categoriesMapper.getCategories(); }
public ErrorResponse delCategory(String cate_ids) { for (String cate_id : cate_ids.split(",")) { categoriesMapper.delCategory(Integer.parseInt(cate_id)); } return new ErrorResponse.Builder(0, "OK").build(); }