⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 managelogserviceimpl.java

📁 这是一款最新的野蔷薇论坛源码,有需要的朋友可以尽情下载
💻 JAVA
字号:
/* 
 * Created on 2007-4-24
 * Last modified on 2007-4-24
 * Powered by YeQiangWei.com
 */
package com.yeqiangwei.club.service.util.impl;

import java.util.List;

import com.yeqiangwei.club.dao.DAOLocator;
import com.yeqiangwei.club.dao.DAOWrapper;
import com.yeqiangwei.club.dao.ManageLogDAO;
import com.yeqiangwei.club.dao.model.ManageLog;
import com.yeqiangwei.club.param.ManageLogParameter;
import com.yeqiangwei.club.service.model.ManageLogModel;
import com.yeqiangwei.club.util.BeanLocator;
import com.yeqiangwei.club.util.BeanUtils;
import com.yeqiangwei.club.util.MessageUtils;
import com.yeqiangwei.util.TypeChange;
import com.yeqiangwei.util.Validator;
import com.yeqiangwei.club.service.util.ManageLogService;

public class ManageLogServiceImpl extends MessageUtils implements ManageLogService{

	public int deleteByTopicId(int topicId) {
		if(topicId>0){
			return this.getManageLogDAO().deleteByTopicId(topicId);
		}
		return 0;
	}

	public int deleteByReplyId(int replyId) {
		if(replyId>0){
			return this.getManageLogDAO().deleteByReplyId(replyId);
		}
		return 0;
	}

	public ManageLogModel findById(int id) {
		ManageLogModel model = null;
		if(id>0){
			ManageLog item = this.getManageLogDAO().findById(id);
			if(!Validator.isEmpty(item)){
				model = new ManageLogModel();
				BeanUtils.copyProperties(model,item);
			}
		}
		return model;
	}

	public ManageLogModel createOrUpdate(ManageLogModel model) {
		if(model.getManageLogId()>0){
			model = this.update(model);
		}else{
			model = this.create(model);
		}
		return model;
	}

	public ManageLogModel create(ManageLogModel model) {
		if(!Validator.isEmpty(model)){
			ManageLog item = new ManageLog();
			BeanUtils.copyProperties(item,model);
			item = this.getManageLogDAO().create(item);
			if(!Validator.isEmpty(item)){
				BeanUtils.copyProperties(model,item);
			}else{
				model = null;
			}
		}
		return model;
	}

	public ManageLogModel update(ManageLogModel model) {
		if(!Validator.isEmpty(model)){
			ManageLog item = this.getManageLogDAO().findById(model.getManageLogId());
			BeanUtils.copyProperties(item,model);
			item = this.getManageLogDAO().update(item);
			if(!Validator.isEmpty(item)){
				BeanUtils.copyProperties(model,item);
			}else{
				model = null;
			}
		}
		return model;
	}

	public int delete(ManageLogModel model) {
		int c = 0;
		if(!Validator.isEmpty(model)){
			ManageLog item = new ManageLog();
			BeanUtils.copyProperties(item,model);
			c = this.getManageLogDAO().delete(item);
			if(c>0){
				this.setMessage(MessageUtils.getMessage("success"));
			}else{
				this.setMessage(MessageUtils.getMessage("error"));
			}
		}
		return c;
	}

	public int delete(String[] ids) {
		int s = 0;
		int e = 0;
		if(!Validator.isEmpty(ids)){
			for(int i=0; i<ids.length; i++){
				int id = TypeChange.stringToInt(ids[i]);
				ManageLogModel model = new ManageLogModel();
				model.setManageLogId(id);
				if(this.delete(model)>0){
					s++;
				}else{
					e++;
				}
			}
		}
		this.setMessage(MessageUtils.getMessage(s,e));
		return s;
	}
	
	public List<ManageLogModel> findByParameter(ManageLogParameter param) {
		List<ManageLog> list = this.getManageLogDAO().findByParameter(param);
		List<ManageLogModel> mlist = BeanUtils.copyList(list,BeanLocator.MANAGELOGMODEL);
		return mlist;
	}

	public long countByParameter(ManageLogParameter param) {
		return this.getManageLogDAO().countByParameter(param);
	}

	public ManageLogDAO getManageLogDAO() {
		return DAOWrapper.<ManageLogDAO>getSingletonInstance(DAOLocator.MANAGELOG);
	}
	
	/*
	public static void main(String args[]){
		com.yeqiangwei.club.dao.hibernate.ConnectionManager.init();
		ManageLogServiceImpl m = new ManageLogServiceImpl();
		ManageLogParameter param = new ManageLogParameter();
		param.setTopicId(949);
		param.setPage(1);
		param.setRows(10);
		param.setIsList(true);
		List<ManageLogModel> list = m.findByParameter(param);
		for(int i=0; i<list.size(); i++){
			ManageLogModel model = list.get(i);
			System.out.println(model.getMemo());
		}
	}
	*/
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -