package admin.core;
import java.io.FileInputStream;
import java.io.Serializable;
import java.lang.reflect.Field;
import java.util.List;
import org.apache.log4j.Logger;
import admin.dao.common.condition.Nullable;
import admin.dao.common.condition.OrderBy;
import admin.dao.common.page.Pagination;
import admin.util.TimeUtil;
public class BaseBizImpl<T extends Serializable> implements BaseBiz<T> {
protected BaseDao<T> dao;
protected Logger log = Logger.getLogger(getClass());
public int count() {
return dao.count(new Nullable[]{});
}
public void setDao(BaseDao<T> dao) {
this.dao = dao;
}
public Pagination<T> findEntity(int pageNo, int pageSize) {
int total = count();
Pagination<T> pag = new Pagination<T>(pageNo, pageSize, total);
pag.setList(dao.findList(null, pageNo, pageSize,null,null,null,false));
return pag;
}
public Pagination<T> findEntity(T entity,int pageNo, int pageSize,OrderBy order) {
int total = count();
Pagination<T> pag = new Pagination<T>(pageNo, pageSize, total);
pag.setList(dao.findList(null, pageNo, pageSize,null,new OrderBy[]{order},null,false));
return pag;
}
public BaseDao<T> getDao() {
return dao;
}
public T getById(String id) {
return dao.getById(id);
}
public boolean update(T t) {
return dao.update(t,null);
}
public boolean update(T t,String[] exclusivePros){
return dao.update(t, exclusivePros);
}
public boolean update(T t,String exclusivePro){
return dao.update(t, new String[]{exclusivePro});
}
public boolean save(List<T> entities){
Class<?> clazz=null;
for(int i=0;i<entities.size();i++){
T entity=entities.get(i);
if(entity==null){
continue;
}
clazz=entity.getClass();
try {
Field field = clazz.getDeclaredField("addtime");
field.setAccessible(true);
Object addtime= field.get(entity);
if(addtime!=null && addtime.toString().trim().length()==0){
field.set(entity, TimeUtil.getFormatDate("yyyy-MM-dd HH:mm:ss"));
}
} catch (Exception e) {
log.info("反射对象默认值出错==>"+e);
return false;
}
}
return dao.save(entities);
}
public boolean save(T t) {
if(t==null){
return false;
}
Class<?> clazz = t.getClass();
// String name = clazz.getSimpleName();
try {
// Field field = clazz.getDeclaredField(name.toLowerCase() + "Id");
// field.setAccessible(true);
// field.set(t, CommonUtil.getGenerateId());
Field field = clazz.getDeclaredField("addtime");
field.setAccessible(true);
field.set(t, TimeUtil.getFormatDate("yyyy-MM-dd HH:mm:ss"));
} catch (Exception e) {
log.info("反射对象默认值出错==>"+e);
}
int i = dao.save(t);
if(i<=0){
return false;
}
return true;
}
public boolean deleteById(String id) {
return dao.deleteById(id);
}
public boolean deleteByIds(String ids) {
return dao.deleteByIds(ids);
}
public List<T> findList(int pageNo, int pageSize) {
return dao.findList(null,pageNo, pageSize, null, null,new String[]{},false);
}
public List<T> findList(int pageNo, int pageSize, OrderBy[] orders,String[] exclusivePros){
return dao.findList(null,pageNo, pageSize,new Nullable[]{ },orders,exclusivePros,false);
}
public List<T> findList(int pageNo, int pageSize, OrderBy[] orders,String exclusivePro){
return dao.findList(null,pageNo, pageSize,new Nullable[]{ },orders,new String[]{exclusivePro},false);
}
public List<T> findList(int pageNo, int pageSize, Nullable[] nullable,String[] exclusivePros){
return dao.findList(null,pageNo, pageSize,nullable,new OrderBy[]{},exclusivePros,false);
}
public List<T> findList(int pageNo, int pageSize, Nullable[] nullable,String exclusivePro){
return dao.findList(null,pageNo, pageSize,nullable,new OrderBy[]{},new String[]{exclusivePro},false);
}
public List<T> findList(int pageNo, int pageSize, Nullable nullable,String[] exclusivePros){
return dao.findList(null,pageNo, pageSize,new Nullable[]{nullable},new OrderBy[]{},exclusivePros,false);
}
public List<T> findList(int pageNo, int pageSize, Nullable nullable,String exclusivePro){
return dao.findList(null,pageNo, pageSize,new Nullable[]{nullable},new OrderBy[]{},new String[]{exclusivePro},false);
}
public List<T> findList(int pageNo, int pageSize, OrderBy order,String[] exclusivePros){
return dao.findList(null,pageNo, pageSize,new Nullable[]{},new OrderBy[]{order},exclusivePros,false);
}
public List<T> findList(int pageNo, int pageSize, OrderBy order,String exclusivePro){
return dao.findList(null,pageNo, pageSize,new Nullable[]{},new OrderBy[]{order},new String[]{exclusivePro},false);
}
public List<T> findList(int pageNo, int pageSize, Nullable nullable){
return dao.findList(null,pageNo, pageSize,new Nullable[]{ nullable},new OrderBy[]{}, new String[]{},false);
}
public Pagination<T> findEntity(int pageNo, int pageSize,
Nullable[] nullable, OrderBy[] orders) {
return findEntity(pageNo, pageSize, new Nullable[]{},
new OrderBy[]{},new String[]{});
}
public Pagination<T> findEntity(int pageNo, int pageSize, Nullable[] nullable,
OrderBy[] orders,String exclusivePro){
int total = count(nullable);
Pagination<T> pag = new Pagination<T>(pageNo, pageSize, total);
pag.setList(dao.findList(null, pageNo, pageSize, nullable, orders,new String[]{ exclusivePro},false));
return pag;
}
public Pagination<T> findEntity(int pageNo, int pageSize,String exclusivePro){
return findEntity(pageNo, pageSize, new Nullable[]{},
new OrderBy[]{},new String[]{exclusivePro});
}
public Pagination<T> findEntity(int pageNo, int pageSize, Nullable nullable,
OrderBy order,String exclusivePro){
return findEntity(pageNo, pageSize, new Nullable[]{nullable},
new OrderBy[]{order},new String[]{exclusivePro});
}
public Pagination<T> findEntity(int pageNo, int pageSize, OrderBy[] orders,String exclusivePro){
return findEntity(pageNo, pageSize, new Nullable[]{},
orders,new String[]{exclusivePro});
}
public Pagination<T> findEntity(int pageNo, int pageSize, OrderBy order,String exclusivePro){
return findEntity(pageNo, pageSize, new Nullable[]{},
new OrderBy[]{order},new String[]{exclusivePro});
}
public Pagination<T> findEntity(int pageNo, int pageSize, Nullable[] nullable,String exclusivePro){
return findEntity(pageNo, pageSize, nullable,
new OrderBy[]{},new String[]{exclusivePro});
}
public Pagination<T> findEntity(int pageNo, int pageSize, Nullable nullable,String exclusivePro){
return findEntity(pageNo, pageSize, new Nullable[]{nullable},
new OrderBy[]{},new String[]{exclusivePro});
}
public Pagination<T> findEntity(int pageNo, int pageSize, Nullable[] nullable,
OrderBy[] orders,String[] exclusivePros){
int total = count(nullable);
Pagination<T> pag = new Pagination<T>(pageNo, pageSize, total);
pag.setList(dao.findList(null,pageNo, pageSize, nullable, orders,exclusivePros,false));
return pag;
}
public Pagination<T> findEntity(int pageNo, int pageSize,String[] exclusivePros){
return findEntity( pageNo, pageSize,new Nullable[] {},
new OrderBy[] {}, exclusivePros);
}
public Pagination<T> findEntity(int pageNo, int pageSize, Nullable nullable,
OrderBy order,String[] exclusivePros){
return findEntity( pageNo, pageSize,new Nullable[] {nullable},
new OrderBy[] {order}, exclusivePros);
}
public Pagination<T> findEntity(int pageNo, int pageSize, OrderBy[] orders,String[] exclusivePros){
return findEntity( pageNo, pageSize,new Nullable[] {},
orders, exclusivePros);
}
public Pagination<T> findEntity(int pageNo, int pageSize, OrderBy order,String[] exclusivePros){
return findEntity( pageNo, pageSize,new Nullab
没有合适的资源?快使用搜索试试~ 我知道了~
dwz.rar_dwz_dwz struts
共874个文件
gif:275个
png:192个
html:70个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 74 浏览量
2022-09-22
23:57:31
上传
评论
收藏 20.69MB RAR 举报
温馨提示
dwz+struts+仿habernate
资源推荐
资源详情
资源评论
收起资源包目录
dwz.rar_dwz_dwz struts (874个子文件)
.tmp_db_widget.html.19591~ 9KB
gzjs.bat 2KB
dwz-user-guide.chm 363KB
BaseBizImpl.class 67KB
BaseDaoImpl.class 41KB
BaseBiz.class 38KB
CoreDaoImpl.class 35KB
BaseDao.class 21KB
BaseAction.class 11KB
UsersAuthorityAction.class 7KB
LoginAction.class 7KB
UsersBizImpl.class 7KB
BaseResourceBizImpl.class 6KB
SimplePage.class 5KB
RequestUtils.class 5KB
UserManagerAction.class 5KB
CustomersBizImpl.class 4KB
FileUploadUtil.class 4KB
LoginVisitRecordBizImpl.class 4KB
Menu.class 4KB
LoginRecordBizImpl.class 4KB
CustomersAction.class 3KB
CoreDao.class 3KB
BaseResourceAction.class 3KB
Users.class 3KB
RolesBizImpl.class 3KB
LoginVisitRecordAction.class 3KB
Customers.class 3KB
LoginRecordAction.class 3KB
BaseResource.class 3KB
DaoHelper.class 2KB
ImageTool.class 2KB
TimeUtil.class 2KB
ExportFileUtil.class 2KB
CommonUtil.class 2KB
OrderBy.class 2KB
Log4jInit.class 2KB
LoginVisitRecords.class 2KB
LoginRecord.class 2KB
Roles.class 2KB
LoginVisitRecord.class 1KB
OrderBy$OrderType.class 1KB
Pagination.class 1KB
BaseResourceBiz.class 931B
Test.class 893B
Nullable.class 805B
UsersBiz.class 764B
UserRoles.class 749B
Condition.class 739B
CustomersBiz.class 677B
Paginable.class 631B
LoginRecordBiz.class 627B
LoginVisitRecordDaoImpl.class 534B
LoginVisitRecordBiz.class 527B
Menus.class 505B
BaseResourceDaoImpl.class 494B
LoginRecordDaoImpl.class 484B
CustomersDaoImpl.class 464B
RolesBiz.class 451B
RolesDaoImpl.class 424B
UsersDaoImpl.class 424B
LoginVisitRecordDao.class 264B
BaseResourceDao.class 248B
LoginRecordDao.class 244B
CustomersDao.class 236B
RolesDao.class 220B
UsersDao.class 220B
.classpath 324B
org.eclipse.wst.common.component 439B
org.eclipse.wst.jsdt.ui.superType.container 49B
core.css 41KB
style.css 11KB
style.css 11KB
style.css 11KB
style.css 11KB
style.css 11KB
ui.css 10KB
ui.css 10KB
ui.css 10KB
ui.css 10KB
ui.css 10KB
ieHack.css 4KB
login.css 3KB
uploadify.css 3KB
iframe.css 2KB
iframe.css 2KB
iframe.css 2KB
iframe.css 2KB
iframe.css 2KB
multiupload.css 1KB
print.css 986B
Thumbs.db 14KB
Thumbs.db 12KB
Thumbs.db 10KB
Thumbs.db 10KB
Thumbs.db 9KB
Thumbs.db 9KB
Thumbs.db 5KB
Thumbs.db 4KB
gzip.exe 90KB
共 874 条
- 1
- 2
- 3
- 4
- 5
- 6
- 9
资源评论
朱moyimi
- 粉丝: 61
- 资源: 1万+
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功