1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117
| package org.fkit.hrm.dao;
import java.util.List; import java.util.Map; import org.apache.ibatis.annotations.Delete; import org.apache.ibatis.annotations.One; import org.apache.ibatis.annotations.Result; import org.apache.ibatis.annotations.Results; import org.apache.ibatis.annotations.Select; import org.apache.ibatis.annotations.SelectProvider; import org.apache.ibatis.mapping.FetchType; import org.fkit.hrm.dao.provider.EmployeeDynaSqlProvider; import org.fkit.hrm.domain.Employee; import static org.fkit.hrm.util.common.HrmConstants.EMPLOYEETABLE;
public interface EmployeeDao { @SelectProvider( type = EmployeeDynaSqlProvider.class, method = "count") Integer count(Map<String, Object> params);
@SelectProvider( type = EmployeeDynaSqlProvider.class, method = "selectWhitParam") @Results( {@Result( id = true, column = "id", property = "id"), @Result( column = "CARD_ID", property = "cardId"), @Result( column = "POST_CODE", property = "postCode"), @Result( column = "QQ_NUM", property = "qqNum"), @Result( column = "BIRTHDAY", property = "birthday", javaType = java.util.Date.class), @Result( column = "CREATE_DATE", property = "createDate", javaType = java.util.Date.class), @Result( column = "DEPT_ID", property = "dept", one = @One( select = "org.fkit.hrm.dao.DeptDao.selectById", fetchType = FetchType.EAGER)), @Result( column = "JOB_ID", property = "job", one = @One( select = "org.fkit.hrm.dao.JobDao.selectById", fetchType = FetchType.EAGER))}) List<Employee> selectByPage(Map<String, Object> params);
@SelectProvider( type = EmployeeDynaSqlProvider.class, method = "insertEmployee") void save(Employee employee);
@Delete(" delete from " + EMPLOYEETABLE + " where id = #{id} ") void deleteById(Integer id);
@Select("select * from " + EMPLOYEETABLE + " where ID = #{id}") @Results( {@Result( id = true, column = "id", property = "id"), @Result( column = "CARD_ID", property = "cardId"), @Result( column = "POST_CODE", property = "postCode"), @Result( column = "QQ_NUM", property = "qqNum"), @Result( column = "BIRTHDAY", property = "birthday", javaType = java.util.Date.class), @Result( column = "CREATE_DATE", property = "createDate", javaType = java.util.Date.class), @Result( column = "DEPT_ID", property = "dept", one = @One( select = "org.fkit.hrm.dao.DeptDao.selectById", fetchType = FetchType.EAGER)), @Result( column = "JOB_ID", property = "job", one = @One( select = "org.fkit.hrm.dao.JobDao.selectById", fetchType = FetchType.EAGER))}) Employee selectById(Integer id);
@SelectProvider( type = EmployeeDynaSqlProvider.class, method = "updateEmployee") void update(Employee employee); }
|