package cn.com.chinautrust.idm.repo.mybatis.mapper; import java.util.List; import org.apache.ibatis.annotations.Delete; import org.apache.ibatis.annotations.Insert; import org.apache.ibatis.annotations.Options; import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.ResultType; import org.apache.ibatis.annotations.Select; import org.apache.ibatis.annotations.SelectProvider; import org.apache.ibatis.annotations.Update; import org.apache.ibatis.annotations.UpdateProvider; import cn.com.chinautrust.idm.bo.user.AdminVO; import cn.com.chinautrust.idm.repo.mybatis.base.IBaseMapper; import cn.com.chinautrust.idm.repo.mybatis.provider.AdminVOProvider; public interface IAdminMapper extends IBaseMapper<AdminVO>{ @Options(useGeneratedKeys=true) @Insert("INSERT INTO ADMIN_INFO(adminName, adminLoginName, adminRole, deptName, pwd, lastTime, deptCodeLimit, deptCodeSkip) VALUES(#{adminName}, #{adminLoginName}, #{adminRole}, #{deptName}, #{pwd}, #{lastTime}, #{deptCodeLimit}, #{deptCodeSkip})") public int insert(AdminVO bean); @UpdateProvider(type = AdminVOProvider.class, method="update") public void update(AdminVO bean); @Delete("DELETE FROM ADMIN_INFO WHERE id = #{value}") public void delById(Integer id); @ResultType(AdminVO.class) @Select("SELECT id, adminName,adminLoginName,adminRole,deptName,pwd,lastTime,deptCodeLimit,deptCodeSkip FROM ADMIN_INFO where id=#{value}") public AdminVO findOneById(Integer id); @ResultType(AdminVO.class) @SelectProvider(type = AdminVOProvider.class, method="findListByBean") public List<AdminVO> findListByBean(AdminVO bean); @Select("SELECT COUNT(*) FROM ADMIN_INFO where ${value}") public long countBySql(String sql); @ResultType(AdminVO.class) @SelectProvider(type = AdminVOProvider.class, method="findListBySql") public List<AdminVO> findListBySql(String sql, String contextSql); @ResultType(AdminVO.class) @Select("SELECT id, adminName,adminLoginName,adminRole,deptName,pwd,lastTime,deptCodeLimit,deptCodeSkip FROM ADMIN_INFO where deptName=#{value} ORDER BY lastTime DESC") List<AdminVO> getAllAdminDeptId(String deptName); @Delete("DELETE FROM ADMIN_INFO WHERE adminLoginName=#{value}") void delAdminByLoginName(String loginName); @Delete("DELETE FROM ADMIN_INFO WHERE deptName like #{value}") void delAdminByDeptDn(String deptDn); @ResultType(AdminVO.class) @Select("SELECT id, adminName,adminLoginName,adminRole,deptName,pwd,lastTime,deptCodeLimit,deptCodeSkip FROM ADMIN_INFO where ${value}") List<AdminVO> find(String queryString); @Update("UPDATE ADMIN_INFO set PWD=#{pwd}, ADMINNAME=#{adminName}, ADMINROLE=#{adminRole}, LASTTIME=#{lastTime} where adminLoginName=#{adminLoginName}") void updateAdminByLoginName(AdminVO adminVo); @ResultType(AdminVO.class) @Select("SELECT id, adminName,adminLoginName,adminRole,deptName,pwd,lastTime,deptCodeLimit,deptCodeSkip FROM ADMIN_INFO where adminLoginName=#{0} and pwd=#{1}") List<AdminVO> getAdminByLoginNameAndPwd(String loginName, String pwd); @ResultType(AdminVO.class) @Select("SELECT id, adminName,adminLoginName,adminRole,deptName,pwd,lastTime,deptCodeLimit,deptCodeSkip FROM ADMIN_INFO where adminLoginName=#{value}") List<AdminVO> getAdminByLoginName(String loginName); @Update("UPDATE ADMIN_INFO set pwd=#{newpassword} where adminLoginName=#{loginName} and pwd=#{oldpassword}") int updatePersonPwd(@Param("loginName") String loginName, @Param("oldpassword") String oldpassword, @Param("newpassword") String newpassword); }