Search in sources :

Example 1 with BuildQuery

use of cn.cerc.jdb.mysql.BuildQuery in project summer-bean by cn-cerc.

the class BookOptions method getAccInitYearMonth.

public static String getAccInitYearMonth(IHandle handle) {
    String result;
    String paramKey = AccInitYearMonth;
    // String result = getOption(owner, paramKey, "201301";
    try (MemoryBuffer buff = new MemoryBuffer(BufferType.getVineOptions, handle.getCorpNo(), paramKey)) {
        if (buff.isNull() || buff.getString("Value_").equals("")) {
            BuildQuery f = new BuildQuery(handle);
            String corpNo = handle.getCorpNo();
            f.add("select * from %s ", SystemTable.get(SystemTable.getBookOptions));
            f.byField("CorpNo_", corpNo);
            f.byField("Code_", paramKey);
            SqlQuery ds = f.open();
            if (!ds.eof()) {
                result = ds.getString("Value_");
                if ("".equals(result)) {
                    result = getBookCreateDate(handle).getYearMonth();
                    ds.edit();
                    ds.setField("Value_", result);
                    ds.post();
                }
            } else {
                result = getBookCreateDate(handle).getYearMonth();
                BookOptions app = new BookOptions(handle);
                app.appendToCorpOption(corpNo, paramKey, result);
            }
            buff.setField("Value_", result);
        }
        result = buff.getString("Value_");
    }
    // 做返回值复查
    if (result == null || "".equals(result))
        throw new RuntimeException("期初年月未设置,请先到系统参数中设置好后再进行此作业!");
    return result;
}
Also used : SqlQuery(cn.cerc.jdb.mysql.SqlQuery) BuildQuery(cn.cerc.jdb.mysql.BuildQuery)

Example 2 with BuildQuery

use of cn.cerc.jdb.mysql.BuildQuery in project summer-bean by cn-cerc.

the class BookOptions method getOption.

public static String getOption(IHandle handle, String ACode, String ADefault) {
    if (ACode.equals(AccInitYearMonth)) {
        return getOption2(handle, ACode, ADefault);
    }
    try (MemoryBuffer buff = new MemoryBuffer(BufferType.getVineOptions, handle.getCorpNo(), ACode)) {
        if (buff.isNull()) {
            BuildQuery f = new BuildQuery(handle);
            f.add("select Value_ from %s ", SystemTable.get(SystemTable.getBookOptions));
            f.byField("CorpNo_", handle.getCorpNo());
            f.byField("Code_", ACode);
            f.open();
            if (!f.getDataSet().eof())
                buff.setField("Value_", f.getDataSet().getString("Value_"));
            else
                buff.setField("Value_", ADefault);
        }
        return buff.getString("Value_");
    }
}
Also used : BuildQuery(cn.cerc.jdb.mysql.BuildQuery)

Example 3 with BuildQuery

use of cn.cerc.jdb.mysql.BuildQuery in project summer-mis by cn-cerc.

the class SvrCustomMenus method search.

public boolean search() {
    if (!SystemTable.ManageBook.equals(handle.getCorpNo()))
        throw new RuntimeException("您不是运营商账号不允许操作!");
    Record headIn = getDataIn().getHead();
    BuildQuery f = new BuildQuery(this);
    f.byField("s.Custom_", true);
    if (headIn.exists("SearchText_"))
        f.byLink(new String[] { "s.Name_", "c.CorpNo_", "oi.ShortName_" }, headIn.getString("SearchText_"));
    if (headIn.exists("MaxRecord_"))
        f.setMaximum(headIn.getInt("MaxRecord_"));
    if (headIn.exists("Custom"))
        f.byParam("c.CorpNo_ !='' and c.CorpNo_ is Not null");
    f.add("select s.Code_,s.Name_,c.Code_ as CostomCode_,oi.ShortName_,c.Remark_,c.CorpNo_,c.AppUser_,c.AppDate_ ");
    f.add("from %s s ", SystemTable.get(SystemTable.getAppMenus));
    f.add("left join %s c on s.Code_ = c.Code_", SystemTable.get(SystemTable.getCustomMenus));
    f.add("left join %s oi on oi.CorpNo_ = c.CorpNo_", SystemTable.get(SystemTable.getBookInfo));
    getDataOut().appendDataSet(f.open());
    return true;
}
Also used : BuildQuery(cn.cerc.jdb.mysql.BuildQuery) Record(cn.cerc.jdb.core.Record)

Example 4 with BuildQuery

use of cn.cerc.jdb.mysql.BuildQuery in project summer-mis by cn-cerc.

the class SvrCustomMenus method append.

public boolean append() {
    DataSet dataIn = getDataIn();
    String corpNo = dataIn.getHead().getString("CorpNo_");
    BuildQuery f1 = new BuildQuery(this);
    BuildQuery f2 = new BuildQuery(this);
    f1.byField("Custom_", true);
    f1.add("select * from %s ", SystemTable.get(SystemTable.getAppMenus));
    SqlQuery ds1 = f1.open();
    f2.byField("CorpNo_", corpNo);
    f2.add("select * from %s ", SystemTable.get(SystemTable.getCustomMenus));
    SqlQuery ds2 = f2.open();
    while (!ds2.eof()) {
        if (!dataIn.locate("id", ds2.getString("ID_")))
            ds2.delete();
        else
            ds2.next();
    }
    while (dataIn.fetch()) {
        if (!ds1.locate("ID_", dataIn.getString("id")))
            throw new RuntimeException("菜单错误,请核查!");
        if (!ds2.locate("ID_", dataIn.getString("id"))) {
            ds1.locate("ID_", dataIn.getString("id"));
            ds2.append();
            ds2.setField("CorpNo_", corpNo);
            ds2.setField("Code_", ds1.getString("Code_"));
            ds2.setField("Name_", ds1.getString("Name_"));
            ds2.setField("AppUser_", getUserCode());
            ds2.setField("AppDate_", TDateTime.Now().getDate());
            ds2.setField("Remark_", "");
            ds2.post();
        }
    }
    return true;
}
Also used : SqlQuery(cn.cerc.jdb.mysql.SqlQuery) DataSet(cn.cerc.jdb.core.DataSet) BuildQuery(cn.cerc.jdb.mysql.BuildQuery)

Example 5 with BuildQuery

use of cn.cerc.jdb.mysql.BuildQuery in project summer-mis by cn-cerc.

the class SvrUserLogin method isAutoLogin.

private boolean isAutoLogin(String userCode, String deviceId) {
    BuildQuery bs = new BuildQuery(this);
    bs.byField("MachineCode_", deviceId);
    bs.byField("Used_", true);
    bs.byField("UserCode_", userCode);
    bs.add("select * from %s", SystemTable.get(SystemTable.getDeviceVerify));
    DataSet ds = bs.open();
    if (!ds.eof()) {
        return ds.getBoolean("AutoLogin_");
    } else {
        return false;
    }
}
Also used : DataSet(cn.cerc.jdb.core.DataSet) BuildQuery(cn.cerc.jdb.mysql.BuildQuery)

Aggregations

BuildQuery (cn.cerc.jdb.mysql.BuildQuery)7 SqlQuery (cn.cerc.jdb.mysql.SqlQuery)3 DataSet (cn.cerc.jdb.core.DataSet)2 Record (cn.cerc.jdb.core.Record)1