Search in sources :

Example 56 with Pojo

use of org.nutz.dao.sql.Pojo in project nutz by nutzam.

the class DoUpdateRelationLinkVisitor method visit.

public void visit(Object obj, LinkField lnk) {
    if (lnk instanceof ManyManyLinkField) {
        ManyManyLinkField mm = (ManyManyLinkField) lnk;
        Entity<?> en = opt.makeEntity(mm.getRelationName(), map);
        Pojo pojo = opt.maker().makeUpdate(en, null);
        pojo.setOperatingObject(map);
        pojo.append(items);
        opt.add(pojo);
    }
}
Also used : Pojo(org.nutz.dao.sql.Pojo) ManyManyLinkField(org.nutz.dao.impl.entity.field.ManyManyLinkField)

Example 57 with Pojo

use of org.nutz.dao.sql.Pojo in project nutz by nutzam.

the class NutPojoMaker method makeQuery.

@Override
public Pojo makeQuery(Entity<?> en) {
    Pojo pojo = Pojos.pojo(expert, en, SqlType.SELECT);
    pojo.setEntity(en);
    pojo.append(Pojos.Items.queryEntityFields());
    pojo.append(Pojos.Items.wrap("FROM"));
    pojo.append(Pojos.Items.entityViewName());
    return pojo;
}
Also used : Pojo(org.nutz.dao.sql.Pojo)

Example 58 with Pojo

use of org.nutz.dao.sql.Pojo in project nutz by nutzam.

the class NutPojoMaker method makeDelete.

@Override
public Pojo makeDelete(String tableName) {
    Pojo pojo = makePojo(SqlType.DELETE);
    pojo.append(Pojos.Items.wrap("FROM"));
    pojo.append(Pojos.Items.wrap(tableName));
    return pojo;
}
Also used : Pojo(org.nutz.dao.sql.Pojo)

Example 59 with Pojo

use of org.nutz.dao.sql.Pojo in project nutz by nutzam.

the class NutPojoMaker method makeQuery.

@Override
public Pojo makeQuery(String tableName, String fields) {
    String[] ss = tableName.split(":");
    // String idFieldName = ss.length > 1 ? ss[1] : "*";//按id字段来统计,比较快
    Pojo pojo = makePojo(SqlType.SELECT);
    // pojo.append(Pojos.Items.wrap(idFieldName));//与org.nutz.dao.test.normal.QueryTest.query_records_pager()冲突
    pojo.append(Pojos.Items.wrap(fields));
    pojo.append(Pojos.Items.wrap("FROM"));
    pojo.append(Pojos.Items.wrap(ss[0]));
    return pojo;
}
Also used : Pojo(org.nutz.dao.sql.Pojo)

Example 60 with Pojo

use of org.nutz.dao.sql.Pojo in project nutz by nutzam.

the class NutPojoMaker method makeDelete.

@Override
public Pojo makeDelete(Entity<?> en) {
    Pojo pojo = Pojos.pojo(expert, en, SqlType.DELETE);
    pojo.setEntity(en);
    pojo.append(Pojos.Items.wrap("FROM"));
    pojo.append(Pojos.Items.entityTableName());
    return pojo;
}
Also used : Pojo(org.nutz.dao.sql.Pojo)

Aggregations

Pojo (org.nutz.dao.sql.Pojo)67 SqlFieldMacro (org.nutz.dao.impl.entity.macro.SqlFieldMacro)6 LinkField (org.nutz.dao.entity.LinkField)5 LinkVisitor (org.nutz.dao.entity.LinkVisitor)5 ExitLoop (org.nutz.lang.ExitLoop)5 LoopException (org.nutz.lang.LoopException)5 DaoException (org.nutz.dao.DaoException)4 ManyManyLinkField (org.nutz.dao.impl.entity.field.ManyManyLinkField)4 Criteria (org.nutz.dao.sql.Criteria)4 PItem (org.nutz.dao.sql.PItem)4 ArrayList (java.util.ArrayList)3 DoClearLinkVisitor (org.nutz.dao.impl.link.DoClearLinkVisitor)3 DoClearRelationByHostFieldLinkVisitor (org.nutz.dao.impl.link.DoClearRelationByHostFieldLinkVisitor)3 DoClearRelationByLinkedFieldLinkVisitor (org.nutz.dao.impl.link.DoClearRelationByLinkedFieldLinkVisitor)3 DoDeleteLinkVisitor (org.nutz.dao.impl.link.DoDeleteLinkVisitor)3 DoInsertLinkVisitor (org.nutz.dao.impl.link.DoInsertLinkVisitor)3 DoInsertRelationLinkVisitor (org.nutz.dao.impl.link.DoInsertRelationLinkVisitor)3 DoUpdateLinkVisitor (org.nutz.dao.impl.link.DoUpdateLinkVisitor)3 DoUpdateRelationLinkVisitor (org.nutz.dao.impl.link.DoUpdateRelationLinkVisitor)3 ConditionPItem (org.nutz.dao.impl.sql.pojo.ConditionPItem)3