Exemplo n.º 1
0
 public int changeOrder(Map param) {
   // TODO Auto-generated method stub
   int result = 1;
   String displayOrder = String.valueOf(param.get("display_order"));
   String editOrder = String.valueOf(param.get("edit_order"));
   String dicTypeId = String.valueOf(param.get("dicTypeId"));
   String parentId = String.valueOf(param.get("parent_id"));
   String newDisplayOrder =
       String.valueOf(Integer.valueOf(displayOrder) + Integer.valueOf(editOrder));
   Map params = new HashMap();
   params.put("display_order", newDisplayOrder);
   params.put("parent_id", parentId);
   params.put("dicTypeId", dicTypeId);
   List<BaseDicValue> listIsExtis = dicValueDao.checkDispalyOrder(params);
   List<BaseDicValue> listOldOrg = dicValueDao.checkDispalyOrder(param);
   String maxOrd =
       ((Map) dicValueDao.queryDisplayOrderMax(param).get(0)).get("DISPLAY_ORDER").toString();
   String minOrd =
       ((Map) dicValueDao.queryDisplayOrderMin(param).get(0)).get("DISPLAY_ORDER").toString();
   if (Integer.valueOf(editOrder) > 0) {
     if (Integer.valueOf(newDisplayOrder) <= Integer.valueOf(maxOrd) - 1) {
       while (listIsExtis.size() == 0) {
         newDisplayOrder =
             String.valueOf(Integer.valueOf(newDisplayOrder) + Integer.valueOf(editOrder));
         params.put("display_order", newDisplayOrder);
         listIsExtis = dicValueDao.checkDispalyOrder(params);
       }
       if (listIsExtis.size() > 0) {
         BaseDicValue baseDicValue = listIsExtis.get(0);
         baseDicValue.setDisplayOrder(new BigDecimal(displayOrder));
         dicValueDao.updateByPrimaryKey(baseDicValue);
         BaseDicValue oldDicValue = listOldOrg.get(0);
         oldDicValue.setDisplayOrder(new BigDecimal(newDisplayOrder));
         dicValueDao.updateByPrimaryKey(oldDicValue);
       }
     }
   } else {
     if (Integer.valueOf(newDisplayOrder) > Integer.valueOf(minOrd) - 1) {
       while (listIsExtis.size() == 0) {
         newDisplayOrder =
             String.valueOf(Integer.valueOf(newDisplayOrder) + Integer.valueOf(editOrder));
         params.put("display_order", newDisplayOrder);
         listIsExtis = dicValueDao.checkDispalyOrder(params);
       }
       if (listIsExtis.size() > 0) {
         BaseDicValue baseDicValue = listIsExtis.get(0);
         baseDicValue.setDisplayOrder(new BigDecimal(displayOrder));
         dicValueDao.updateByPrimaryKey(baseDicValue);
         BaseDicValue oldDicValue = listOldOrg.get(0);
         oldDicValue.setDisplayOrder(new BigDecimal(newDisplayOrder));
         dicValueDao.updateByPrimaryKey(oldDicValue);
       }
     }
   }
   return result;
 }
Exemplo n.º 2
0
 public int modifyDicValueInfo(BaseDicValue baseDicValue) {
   // TODO Auto-generated method stub
   baseDicValue.setModifyTime(new Timestamp(new java.util.Date().getTime()));
   baseDicValue.setChSpell(StringUtil.strTospell(baseDicValue.getDicValueName()));
   baseDicValue.setDisplayOrder(baseDicValue.getDisplayOrder());
   if (baseDicValue.getParentId() == null) {
     baseDicValue.setParentId("1");
   }
   int result = dicValueDao.updateByPrimaryKey(baseDicValue);
   return result;
 }
Exemplo n.º 3
0
 public int insertDicValueInfo(BaseDicValue baseDicValue) {
   // TODO Auto-generated method stub
   baseDicValue.setId(UUIDGeneratorUtil.getUUID());
   baseDicValue.setCreateTime(new Timestamp(new java.util.Date().getTime()));
   baseDicValue.setModifyTime(new Timestamp(new java.util.Date().getTime()));
   baseDicValue.setChSpell(StringUtil.strTospell(baseDicValue.getDicValueName()));
   String display_order =
       queryDisplayOrder(baseDicValue.getParentId(), baseDicValue.getDicTypeId());
   BigDecimal B = new BigDecimal(display_order);
   baseDicValue.setDisplayOrder(B);
   if (baseDicValue.getParentId() == "" || baseDicValue.getParentId() == null) {
     baseDicValue.setParentId(0 + "");
   }
   int result = dicValueDao.insert(baseDicValue);
   return result;
 }