Pu Zhibing
2024-12-27 7732cac9da04bb75e9f655b6fd7e068e14bfc1cc
ManagementIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/controller/general/TCompanyController.java
@@ -323,18 +323,20 @@
    }
    //添加经营区域
    public void addSocpe(String subArr,Integer id){
        tCompanyCityService.delete(new EntityWrapper<TCompanyCity>().eq("companyId", id));
        JSONArray jsonArray = JSON.parseArray(subArr);
        int size = jsonArray.size();
        for (int i = 0; i < size; i++){
        List<TCompanyCity> list = new ArrayList<>();
        for (int i = 0; i < size; i++) {
            JSONObject jsonObject = jsonArray.getJSONObject(i);
            TCompanyCity tCompanyCity = tCompanyCityService.selectOne(new EntityWrapper<TCompanyCity>().eq("id", jsonObject.getInteger("recordId")).eq("companyId", id));
            if (SinataUtil.isEmpty(tCompanyCity)){
                tCompanyCity = new TCompanyCity();
                tCompanyCity.setCityId(jsonObject.getInteger("cityId"));
                tCompanyCity.setCompanyId(id);
                tCompanyCity.setState(1);
                tCompanyCityService.insert(tCompanyCity);
            }
            TCompanyCity tCompanyCity = new TCompanyCity();
            tCompanyCity.setCityId(jsonObject.getInteger("cityId"));
            tCompanyCity.setCompanyId(id);
            tCompanyCity.setState(1);
            list.add(tCompanyCity);
        }
        if(list.size() > 0){
            tCompanyCityService.insertBatch(list);
        }
    }