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

📄 emtopsf01client.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
/*-----------------F01客户信息控制类--------
 ----------------------------------------------*/
public class EMTopsF01Client extends TopsJ2EEBaseControl {
    private static EMTopsF01Client instance = null;
    public static synchronized EMTopsF01Client getInstance() {
        if (instance == null) {
            instance = new EMTopsF01Client();
        }
        return instance;
    }

    private TopsF01ClientDAO _TopsF01ClientDAO = null;
    private TopsF03LinkmanDAO _TopsF03LinkmanDAO = null;
    private EMTopsF01Client() {
        _TopsF01ClientDAO = TopsF01ClientDAO.getNewInstance();
        _TopsF03LinkmanDAO = TopsF03LinkmanDAO.getNewInstance();
    }

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

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

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

    public synchronized ActfrmTopsF01Client load(String id) throws
            BugReportBaseException {
        ActfrmTopsF01Client result = null;
        try {
            //编写业务代码
            result = this._TopsF01ClientDAO.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++) {
                ActfrmTopsF01Client one = this._TopsF01ClientDAO.
                                          findByPrimaryKey(ids[i], _session);
                if (one != null) {
                    this._TopsF01ClientDAO.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._TopsF01ClientDAO.findAll();
        } catch (BugReportBaseException bex) {
            throw bex;
        }
        return result;
    }

    public synchronized DataPage findAllByPage(String pageurl, int page) throws
            BugReportBaseException {
        DataPage result = null;
        try {
            //编写业务代码

            result = this._TopsF01ClientDAO.findAll(pageurl, page,
                    this.defaultPageSize);
            List clients = result.getPageData();
            for (int i = 0; i < clients.size(); i++) {
                ActfrmTopsF01Client client = (ActfrmTopsF01Client) clients.get(
                        i);
                String hql =
                        "from ActfrmViewF03Linkman where clientUuid='" +
                        client.getId() + "' order by name";
                client.setLinkMans(_TopsF01ClientDAO.findByHQL(hql));
            }

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

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

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

    }

    /**
     * findPageByCondition
     *
     * @param searchCondition ActfrmTopsF01Client
     * @param pageUrl String
     * @param i int
     * @return DataPage
     */
    public DataPage findPageByCondition(ActfrmTopsF01Client searchCondition,
                                        String pageUrl, int page) throws
            BugReportBaseException {
        DataPage result = null;
        try {
            //编写业务代码
            String hql = "from ActfrmTopsF01Client where clientName like '%" +
                         searchCondition.getKeyword() +
                         "%' or clientLinkman like '%" +
                         searchCondition.getKeyword() +
                         "%' or clientLinktel1 like '%" +
                         searchCondition.getKeyword() +
                         "%' or clientEmail like '%" +
                         searchCondition.getKeyword() +
                         "%' order by clientName";
            result = this._TopsF01ClientDAO.findPageByHQL(hql, pageUrl, page,
                    this.defaultPageSize);
        } catch (BugReportBaseException bex) {
            throw bex;
        }
        return result;

    }

    public ActfrmTopsF01Client removelinkman(String linkManUuid) throws
            BugReportBaseException {
        ActfrmTopsF01Client result = null;
        this.startTransaction();
        try {
            //编写业务代码
            ActfrmTopsF03Linkman linkman = _TopsF03LinkmanDAO.findByPrimaryKey(
                    linkManUuid, _session);
            String id = linkman.getClientUuid();
            if (id != null) {
                linkman.setClientUuid(null);
                _TopsF03LinkmanDAO.saveChange(linkman, _session, _tx);
                result = this._TopsF01ClientDAO.findByPrimaryKey(id, _session);
            }
            this.commitTransaction();
        } catch (BugReportBaseException bex) {
            this.rollbaseTransaction();
            throw bex;
        }
        return result;

    }

}

⌨️ 快捷键说明

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