MiniDao是JEECG自己的持久化解决方案,具备了Hibernate实体维护和Mybaits SQL分离的两大优势。 具有以下特征:
※向下兼容Hibernate实体维护方式,实体的增删改查SQL自动生成
@MiniDao public interfACE EmployeeDao { @Arguments("employee") public ListgetAllEmployees(Employee employee); @Arguments("empno") Employee getEmployee(String empno); @Arguments({"empno","name"}) Map getMap(String empno,String name); @Sql("SELECT count(*) FROM employee") Integer getCount(); @Arguments("employee") int upDate(Employee employee); @Arguments("employee") void insert(Employee employee);
}
SELECT * FROM employee where 1=1 <#if employee.age ?exists> and age = :employee.age <#if employee.name ?exists> and name = :employee.name <#if employee.empno ?exists> and empno = :employee.empno
examples.dao.*
public class ClIEnt { public static void main(String args[]) { BeanFacTory factory = new ClassPathXmlApplicationContext( "applicationContext.xml"); EmployeeDao employeeDao = (EmployeeDao) factory.getBean("employeeDao"); Employee employee = new Employee(); Listlist = employeeDao.getAllEmployees(employee); for(Map mp:list){ System.out.println(mp.get("id")); System.out.println(mp.get("name")); System.out.println(mp.get("empno")); System.out.println(mp.get("age")); System.out.println(mp.get("BIRThday")); System.out.println(mp.get("salary")); } } }
发布于 2017-08-18 08:59:59 | 126 次阅读
发布于 2016-09-12 04:29:56 | 96 次阅读
发布于 2016-07-20 07:22:25 | 121 次阅读
发布于 2016-01-19 03:02:44 | 109 次阅读