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

📄 emtopsf02provider.java

📁 Jbuilder2006开发的严格按MVC设计模式组织开发过程
💻 JAVA
字号:
package com.tops.crm.control;

import java.util.*;

import com.tops.crm.model.*;
import com.tops.j2eebase.control.*;
import com.tops.j2eebase.exception.*;
import com.tops.j2eebase.model.*;

//class head
/*-----------------F02供应商控制类--------
 ----------------------------------------------*/
public class EMTopsF02Provider extends TopsJ2EEBaseControl {
    private static EMTopsF02Provider instance = null;
    public static synchronized EMTopsF02Provider getInstance() {
        if (instance == null) {
            instance = new EMTopsF02Provider();
        }
        return instance;
    }

    private TopsF02ProviderDAO _TopsF02ProviderDAO = null;
    private TopsF03LinkmanDAO _TopsF03LinkmanDAO = null;
    private EMTopsF02Provider() {
        _TopsF02ProviderDAO = TopsF02ProviderDAO.getNewInstance();
        _TopsF03LinkmanDAO = TopsF03LinkmanDAO.getNewInstance();
    }

    public synchronized void add(ActfrmTopsF02Provider one) throws
            BugReportBaseException {
        startTransaction();
        try {
            //编写业务代码
            this._TopsF02ProviderDAO.create(one, this._session, this._tx);
            commitTransaction();
        } catch (BugReportBaseException bex) {
            rollbaseTransaction();
            throw bex;
        }
    }

    public synchronized void modify(ActfrmTopsF02Provider one) throws
            BugReportBaseException {
        startTransaction();
        try {
            //编写业务代码
            this._TopsF02ProviderDAO.saveChange(one, this._session, this._tx);
            commitTransaction();
        } catch (BugReportBaseException bex) {
            rollbaseTransaction();
            throw bex;
        }
    }

    public synchronized void delete(String id) throws BugReportBaseException {
        startTransaction();
        try {
            //编写业务代码
            ActfrmTopsF02Provider one = this._TopsF02ProviderDAO.
                                        findByPrimaryKey(id, _session);
            if (one != null) {
                this._TopsF02ProviderDAO.remove(one, this._session, this._tx);
            } else {
                throw new BugReportBaseException("记录不存在,不能删除", null, "");
            }
            commitTransaction();
        } catch (BugReportBaseException bex) {
            rollbaseTransaction();
            throw bex;
        }
    }

    public synchronized ActfrmTopsF02Provider load(String id) throws
            BugReportBaseException {
        ActfrmTopsF02Provider result = null;
        try {
            //编写业务代码
            result = this._TopsF02ProviderDAO.findByPrimaryKey(id, _session);
        } catch (BugReportBaseException bex) {
            throw bex;
        }
        return result;
    }

    public synchronized void deleteList(String[] ids) throws
            BugReportBaseException {
        startTransaction();
        try {
            //编写业务代码
            for (int i = 0; i < ids.length; i++) {
                ActfrmTopsF02Provider one = this._TopsF02ProviderDAO.
                                            findByPrimaryKey(ids[i], _session);
                if (one != null) {
                    this._TopsF02ProviderDAO.remove(one, this._session,
                            this._tx);
                } else {
                    throw new BugReportBaseException("记录不存在,不能删除", null, "");
                }
            }
            commitTransaction();
        } catch (BugReportBaseException bex) {
            rollbaseTransaction();
            throw bex;
        }
    }

    public synchronized List findAll() throws BugReportBaseException {
        List result = null;
        try {
            //编写业务代码
            result = this._TopsF02ProviderDAO.findAll();
        } catch (BugReportBaseException bex) {
            throw bex;
        }
        return result;
    }

    public synchronized DataPage findAllByPage(String pageurl, int page) throws
            BugReportBaseException {
        DataPage result = null;
        try {
            //编写业务代码
            result = this._TopsF02ProviderDAO.findAll(pageurl, page,
                    this.defaultPageSize);
            List providers = result.getPageData();
            for (int i = 0; i < providers.size(); i++) {
                ActfrmTopsF02Provider provider = (ActfrmTopsF02Provider)
                                                 providers.get(
                        i);
                String hql =
                        "from ActfrmViewF03Linkman where providerUuid='" +
                        provider.getId() + "' order by name";
                provider.setLinkMans(_TopsF02ProviderDAO.findByHQL(hql));
            }

        } catch (BugReportBaseException bex) {
            throw bex;
        }
        return result;
    }

    /**
     * inputhelp
     *
     * @param searchCondition ActfrmTopsF02Provider
     * @param pageUrl String
     * @param i int
     * @return DataPage
     */
    public DataPage inputhelp(ActfrmTopsF02Provider searchCondition,
                              String pageUrl, int page) throws
            BugReportBaseException {
        DataPage result = null;
        try {
            //编写业务代码
            String mainhql =
                    "from ActfrmTopsF02Provider where proriderName like '%" +
                    searchCondition.getKeyword() + "%'";
            result = this._TopsF02ProviderDAO.findPageByHQL(mainhql, pageUrl,
                    page,
                    this.defaultPageSize);

        } catch (BugReportBaseException bex) {
            throw bex;
        }
        return result;

    }

    public DataPage findPageByCondition(ActfrmTopsF02Provider searchCondition,
                                        String pageUrl, int page) throws
            BugReportBaseException {
        DataPage result = null;
        try {
            //编写业务代码
            String hql =
                    "from ActfrmTopsF02Provider where proriderName like '%" +
                    searchCondition.getKeyword() +
                    "%' or proriderLinktel1 like '%" +
                    searchCondition.getKeyword() +
                    "%' or proriderLinkman like '%" +
                    searchCondition.getKeyword() +
                    "%' or proriderEmail like '%" +
                    searchCondition.getKeyword() +
                    "%' order by proriderName";
            result = this._TopsF02ProviderDAO.findPageByHQL(hql, pageUrl, page,
                    this.defaultPageSize);
        } catch (BugReportBaseException bex) {
            throw bex;
        }
        return result;

    }

    /**
     * removelinkman
     *
     * @param linkManUuid String
     * @return ActfrmTopsF02Provider
     */
    public ActfrmTopsF02Provider removelinkman(String linkManUuid) throws
            BugReportBaseException {
        ActfrmTopsF02Provider result = null;
        this.startTransaction();
        try {
            //编写业务代码
            ActfrmTopsF03Linkman linkman = _TopsF03LinkmanDAO.findByPrimaryKey(
                    linkManUuid, _session);
            String id = linkman.getProviderUuid();
            if (id != null) {
                linkman.setProviderUuid(null);
                _TopsF03LinkmanDAO.saveChange(linkman, _session, _tx);
                result = this._TopsF02ProviderDAO.findByPrimaryKey(id, _session);
            }
            this.commitTransaction();
        } catch (BugReportBaseException bex) {
            this.rollbaseTransaction();
            throw bex;
        }
        return result;

    }

}

⌨️ 快捷键说明

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