| | |
| | | } |
| | | //添加经营区域 |
| | | 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); |
| | | } |
| | | } |
| | | |