Example #1
0
 @Override
 public <V> ModelCarType find(V id) {
   // TODO Auto-generated method stub
   ModelCarType t = super.find(id);
   ModelChargeStandard chargeStandard = iServChargeStandard.find(t.getChargeStandardId());
   t.setChargeStandard(chargeStandard);
   ModelFileUpload icon = iServFileUpload.find(t.getIconId());
   t.setIcon(icon);
   return t;
 }
Example #2
0
 @Override
 public List<ModelCarType> findByCondition(Condition<ModelCarType> condition, boolean injected) {
   List<ModelCarType> list = findByCondition(condition);
   if (list != null && injected) {
     for (ModelCarType t : list) {
       ModelChargeStandard chargeStandard = iServChargeStandard.find(t.getChargeStandardId());
       t.setChargeStandard(chargeStandard);
       ModelFileUpload icon = iServFileUpload.find(t.getIconId());
       t.setIcon(icon);
     }
   }
   return list;
 }
Example #3
0
 @Override
 public Integer update(ModelCarType t) {
   try {
     // validation
     if (t == null) {
       return null;
     }
     // persist object in security mode
     ModelCarType carTypeDB = find(t.getId());
     BeanUtils.copyProperties(carTypeDB, t, false);
     // update inner object chargeStandard
     ModelChargeStandard chargeStandard = t.getChargeStandard();
     if (chargeStandard != null) {
       iServChargeStandard.update(chargeStandard);
       carTypeDB.setChargeStandardId(chargeStandard.getId());
     }
     ModelFileUpload icon = t.getIcon();
     if (icon != null) {
       iServFileUpload.uploadFile(icon);
       carTypeDB.setIconId(icon.getId());
     }
     return super.update(carTypeDB);
   } catch (Exception e) {
     throw new ServException(e);
   }
 }
Example #4
0
 @Override
 public Integer add(ModelCarType t) {
   // validation
   if (t == null) {
     return null;
   }
   // update inner object chargeStandard
   ModelChargeStandard chargeStandard = t.getChargeStandard();
   if (chargeStandard != null) {
     iServChargeStandard.add(chargeStandard);
     t.setChargeStandardId(chargeStandard.getId());
   }
   // update t
   t.setCreateTime(new Date());
   t.setUpdateTime(new Date());
   // update icon information
   ModelFileUpload icon = t.getIcon();
   // update DB
   if (icon != null) {
     icon = iServFileUpload.uploadFile(icon);
     t.setIconId(icon.getId());
   }
   return super.add(t);
 }