CeDo
2021-05-11 ec76ed1ea86e13cd76dc99ec0dfdf657d34919a5
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComMngVillageServiceImpl.java
@@ -14,9 +14,7 @@
import com.panzhihua.service_community.dao.ComActDAO;
import com.panzhihua.service_community.dao.ComActVillageDAO;
import com.panzhihua.service_community.dao.ComMngPopulationDAO;
import com.panzhihua.service_community.dao.ComMngVolunteerMngDAO;
import com.panzhihua.service_community.model.dos.ComActDO;
import com.panzhihua.service_community.model.dos.ComActDiscussDO;
import com.panzhihua.service_community.model.dos.ComMngPopulationDO;
import com.panzhihua.service_community.model.dos.ComMngVillageDO;
import com.panzhihua.service_community.service.ComMngVillageService;
@@ -25,10 +23,7 @@
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
 * @author: llming
@@ -160,4 +155,24 @@
        this.saveBatch(comMngVillageDOS);
        return R.ok("共计导入实有房屋数量:" + comMngVillageDOS.size());
    }
    @Override
    public R editVillage(Long villageId, ComMngVillageVO comMngVillageVO) {
        ComMngVillageDO comMngVillageDO = this.baseMapper.selectById(villageId);
        if (comMngVillageDO == null) {
            return R.fail("id有误!");
        }
        BeanUtils.copyProperties(comMngVillageVO, comMngVillageDO);
        ComActDO comActDO = comActDAO.selectById(comMngVillageDO.getCommunityId());
        if (comActDO == null || comActDO.getStreetId() == null) {
            return R.fail("社区没有绑定街道,请绑定后操作!");
        }
        comMngVillageDO.setStreetId(comActDO.getStreetId());
        int update = this.baseMapper.update(comMngVillageDO, new LambdaQueryWrapper<ComMngVillageDO>()
                .eq(ComMngVillageDO::getVillageId, villageId));
        if(update>0){
            return R.ok(comMngVillageVO);
        }
        return R.fail();
    }
}