コード例 #1
0
 @Override
 public List<MobileUnitConfigDTO> getUnitConfigByLayoutId(long layoutId) {
   List<MobileUnitConfigDTO> unitDTOList = new ArrayList<>();
   List<MobileUnitConfig> unitList = mobileUnitConfigMapper.getUnitConfigListByLayoutId(layoutId);
   for (MobileUnitConfig unit : unitList) {
     unitDTOList.add(new MobileUnitConfigDTO(unit));
   }
   Collections.sort(unitDTOList);
   return unitDTOList;
 }
コード例 #2
0
 @Override
 @Transactional
 public boolean deteleLayout(int pageId, int layoutOrder, AppConfigStatus status) {
   List<MobileLayoutConfig> layoutList =
       mobileLayoutConfigMapper.getLayoutByPageIdAndOrder(pageId, layoutOrder);
   if (CollectionUtils.isNotEmpty(layoutList)) {
     MobileLayoutConfig layout = layoutList.get(0);
     long layoutId = layout.getId();
     if (mobileLayoutConfigMapper.delete(layoutId) > 0) {
       return mobileUnitConfigMapper.deleteByLayoutId(layoutId) > 0
           && mobileLayoutFormMapper.deleteByLayoutId(layoutId) > 0;
     }
   }
   return true;
 }
コード例 #3
0
 @Override
 @Transactional
 public boolean saveLayoutConfig(MobileLayoutConfigDTO layoutDTO) {
   if (deteleLayout(layoutDTO.getPageId(), layoutDTO.getLayoutOrder(), AppConfigStatus.SAVED)) {
     int ret = mobileLayoutConfigMapper.add(layoutDTO);
     if (ret > 0) {
       long layoutId = layoutDTO.getId();
       List<MobileUnitConfigDTO> unitList = layoutDTO.getUnitList();
       for (MobileUnitConfigDTO unit : unitList) {
         unit.setLayoutId(layoutId);
       }
       MobileLayoutForm form = layoutDTO.getLayoutForm();
       form.setLayoutId(layoutId);
       int addRet = mobileUnitConfigMapper.addList(unitList);
       if (addRet < unitList.size()) {
         throw new RuntimeException("单元保存异常...");
       }
       return mobileLayoutFormMapper.add(form) > 0;
     }
   }
   return false;
 }