Example #1
0
 public int deleteByAssocIds(AssociateTable table, List<Long> ids) {
   Map<String, Object> map = new HashMap<String, Object>();
   map.put("table", table.getTableName());
   map.put("assocCol", table.getAssocCol());
   map.put("ids", ids);
   return this.getSession().delete(NAMESPACE + DELETE_IDS_SQL, map);
 }
Example #2
0
 public int deleteByAssoc(AssociateTable table, Long id) {
   String clause = table.getAssocCol() + "=" + id;
   Map<String, String> map = new HashMap<String, String>();
   map.put("table", table.getTableName());
   map.put("clause", clause);
   return this.getSession().delete(NAMESPACE + DELETE_SQL, map);
 }
Example #3
0
 public int deleteByAssocString(AssociateTable table, String str) {
   String clause = table.getInverseCol() + "='" + str + "'";
   Map<String, String> map = new HashMap<String, String>();
   map.put("table", table.getTableName());
   map.put("clause", clause);
   return this.getSession().delete(NAMESPACE + DELETE_SQL, map);
 }
Example #4
0
  public List<?> selectListByAssoc(AssociateTable table, Long id) {
    String cols = table.getAssocCol() + " as assocCol," + table.getInverseCol() + " as inverseCol";
    String clause = table.getAssocCol() + "=" + id;
    Map<String, String> map = new HashMap<String, String>();
    map.put("table", table.getTableName());
    map.put("cols", cols);
    map.put("clause", clause);

    return this.getSession().selectList(NAMESPACE + SELECT_SQL, map);
  }
Example #5
0
 public void batchInsertByString(AssociateTable table, Long assocCol, List<String> inverseCols) {
   String insertField = table.getAssocCol() + "," + table.getInverseCol();
   for (String str : inverseCols) {
     Map<String, Object> map = new HashMap<String, Object>();
     map.put("table", table.getTableName());
     map.put("insertField", insertField);
     map.put("assocCol", assocCol);
     map.put("inverseCol", str);
     this.getSession().insert(NAMESPACE + INSERT_SQL, map);
   }
 }