/**
 * MIT License
 * 
 * Copyright (c) 2016 iMinusMinus
 * 
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 * 
 * The above copyright notice and this permission notice shall be included in all
 * copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 * SOFTWARE.
 */
package ml.iamwhatiam.tao.dao;

import java.util.List;

/**
 * basic dal: CRUD
 * 
 * @author iMinusMinus
 * @since 2017-02-09
 * @version 0.0.1
 *
 */
public interface CrudDao<T> {
	
	List<T> findAll();
	
	List<T> query(T condition, int offset, int limit);
	
	long count(T condition);
	
	T findOne(long id);
	
	long save(T domain);
	
	boolean update(T domain);
	
	boolean delete(long id);
	
	//boolean delete(T domain);

}

@@ -1129,16 +1129,17 @@
 LINGS IN
+0
  THE%0D%0A *
@@ -1235,15 +1235,59 @@
 c da
-l
+o
 : CRUD
+.%0D%0A * Mybatis scanner can take it as a mark!
 %0D%0A *
@@ -1402,207 +1402,1269 @@
 %09%0D%0A%09
-List%3CT%3E findAll();%0D%0A%09%0D%0A%09List%3CT%3E query(T condition, int offset, int limit);%0D%0A%09%0D%0A%09long count(T condition);%0D%0A%09%0D%0A%09T findOne(long id);%0D%0A%09%0D%0A%09long save(T domain);%0D%0A%09%0D%0A%09boolean update(T domain);%0D%0A%09%0D%0A%09boolean
+/**%0D%0A%09* fetch all rows%0D%0A%09* @return entire table data%0D%0A%09*/%0D%0A%09List%3CT%3E findAll();%0D%0A%09%0D%0A%09/**%0D%0A%09* fetch qualified rows in range%0D%0A%09* @param condition query condition%0D%0A%09* @param offset skip some data%0D%0A%09* @param limit fetch less than %7B@code limit%7D%0D%0A%09* @return qualified data start with %7B@code offset%7D and end with %7B@code offset + limit%7D%0D%0A%09*/%0D%0A%09List%3CT%3E query(T condition, int offset, int limit);%0D%0A%09%0D%0A%09/**%0D%0A%09* count qualified rows%0D%0A%09* @param condition query condition%0D%0A%09* @return how many rows can we fetch%0D%0A%09*/%0D%0A%09long count(T condition);%0D%0A%09%0D%0A%09/**%0D%0A%09* fetch a row by id%0D%0A%09* @param id table primary key%0D%0A%09* @return one row at most%0D%0A%09*/%0D%0A%09T findOne(long id);%0D%0A%09%0D%0A%09/**%0D%0A%09* fetch a row by unique index or other which can be identified%0D%0A%09* @param domain include query condition can tell one and other apart%0D%0A%09* @return one row, if more than one, exception will be thrown%0D%0A%09*/%0D%0A%09T findOne(T domain);%0D%0A%09%0D%0A%09/**%0D%0A%09* persist data and return id%0D%0A%09* @param domain data to persist%0D%0A%09* @return row id%0D%0A%09*/%0D%0A%09long save(T domain);%0D%0A%09%0D%0A%09/**%0D%0A%09* update fields by id%0D%0A%09* @param domain fields to update and id to tell apart%0D%0A%09* @return rows affected%0D%0A%09*/%0D%0A%09int update(T domain);%0D%0A%09%0D%0A%09/**%0D%0A%09* delete one row by id(may be logic delete).%0D%0A%09* @param id row id%0D%0A%09* @return rows affected%0D%0A%09*/%0D%0A%09int
  del

add comments, add a method