17 changed files with 931 additions and 26 deletions
@ -0,0 +1,15 @@ |
|||
package com.epmet.constant; |
|||
|
|||
/** |
|||
* @Author zxc |
|||
* @DateTime 2020/11/10 5:18 下午 |
|||
*/ |
|||
public interface NeighborhoodConstant { |
|||
|
|||
String NEIGHBOR_HOOD= "neighbourHood"; |
|||
|
|||
String BUILDING = "building"; |
|||
|
|||
String HOUSE = "house"; |
|||
|
|||
} |
@ -0,0 +1,110 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* <p> |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.epmet.dto.form; |
|||
|
|||
import com.epmet.commons.tools.validator.group.AddGroup; |
|||
import com.epmet.commons.tools.validator.group.CustomerClientShowGroup; |
|||
import com.epmet.commons.tools.validator.group.UpdateGroup; |
|||
import lombok.Data; |
|||
import org.hibernate.validator.constraints.Length; |
|||
|
|||
import javax.validation.constraints.NotBlank; |
|||
import java.io.Serializable; |
|||
|
|||
|
|||
|
|||
@Data |
|||
public class IcNeighborHoodFormDTO implements Serializable { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
public interface DeleteGroup extends CustomerClientShowGroup { |
|||
} |
|||
/** |
|||
* 小区id |
|||
*/ |
|||
@NotBlank(message = "小区id不能为空", groups = {UpdateGroup.class,DeleteGroup.class}) |
|||
private String neighborHoodId; |
|||
|
|||
/** |
|||
* 小区名称 |
|||
*/ |
|||
@NotBlank(message = "小区名称不能为空", groups = {AddGroup.class, UpdateGroup.class}) |
|||
@Length(max=50,message = "小区名称不能超过50个字", groups = {AddGroup.class, UpdateGroup.class}) |
|||
private String neighborHoodName; |
|||
|
|||
/** |
|||
* 客户id |
|||
*/ |
|||
/* @NotBlank(message = "客户id不能为空", groups = {AddGroup.class, UpdateGroup.class}) |
|||
private String customerId;*/ |
|||
|
|||
/** |
|||
* 组织id |
|||
*/ |
|||
@NotBlank(message = "组织id不能为空", groups = {AddGroup.class, UpdateGroup.class}) |
|||
private String agencyId; |
|||
|
|||
|
|||
/** |
|||
* 网格id |
|||
*/ |
|||
@NotBlank(message = "网格id不能为空", groups = {AddGroup.class, UpdateGroup.class}) |
|||
private String gridId; |
|||
/** |
|||
* 关联物业id |
|||
*/ |
|||
@NotBlank(message = "关联物业ID不能为空", groups = {UpdateGroup.class}) |
|||
private String propertyId; |
|||
|
|||
/** |
|||
* 详细地址 |
|||
*/ |
|||
@NotBlank(message = "详细地址不能为空", groups = {AddGroup.class, UpdateGroup.class}) |
|||
private String address; |
|||
|
|||
/** |
|||
* 备注 |
|||
*/ |
|||
@NotBlank(message = "备注不能为空", groups = {UpdateGroup.class}) |
|||
@Length(max=500,message = "备注不能超过500个字", groups = {AddGroup.class, UpdateGroup.class}) |
|||
private String remark; |
|||
/** |
|||
* 坐标位置 |
|||
*/ |
|||
@NotBlank(message = "坐标位置不能为空", groups = {AddGroup.class, UpdateGroup.class}) |
|||
private String location; |
|||
|
|||
|
|||
/** |
|||
* 中心点位:经度 |
|||
*/ |
|||
@NotBlank(message = "经度不能为空", groups = {UpdateGroup.class}) |
|||
private String longitude; |
|||
|
|||
/** |
|||
* 中心点位:纬度 |
|||
*/ |
|||
@NotBlank(message = "维度不能为空", groups = {UpdateGroup.class}) |
|||
private String latitude; |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
} |
@ -0,0 +1,73 @@ |
|||
package com.epmet.dto.form;/** |
|||
* Created by 11 on 2020/3/19. |
|||
*/ |
|||
|
|||
import lombok.Data; |
|||
|
|||
import javax.validation.constraints.Min; |
|||
import javax.validation.constraints.NotBlank; |
|||
import javax.validation.constraints.Pattern; |
|||
import java.io.Serializable; |
|||
|
|||
/** |
|||
* @Description 陌生人导览查询附近网格传参定义 |
|||
* @ClassName ListCustomerGridFormDTO |
|||
* @Author wangc |
|||
* @date 2020.03.19 15:00 |
|||
*/ |
|||
@Data |
|||
public class ListIcNeighborHoodFormDTO implements Serializable{ |
|||
|
|||
private static final long serialVersionUID = -1L; |
|||
|
|||
|
|||
/** |
|||
* 当前页 |
|||
* */ |
|||
private Integer pageNo = 1; |
|||
|
|||
/** |
|||
* 每页显示数量 |
|||
* */ |
|||
private Integer pageSize = 20; |
|||
|
|||
/** |
|||
* 组织ID |
|||
*/ |
|||
private String agencyId; |
|||
/** |
|||
* 网格ID |
|||
*/ |
|||
private String gridId; |
|||
/** |
|||
* 小区名字 |
|||
*/ |
|||
private String neighborHoodName; |
|||
/** |
|||
* 楼栋名字 |
|||
*/ |
|||
private String buildingName; |
|||
/** |
|||
* 房主姓名 |
|||
*/ |
|||
private String ownerName; |
|||
/** |
|||
* 房主电话 |
|||
*/ |
|||
private String ownerPhone; |
|||
/** |
|||
* 数据类型【小区:neighbourHood,楼栋:building,房屋:house】 |
|||
*/ |
|||
// @Pattern(regexp = "^(neighbourHood|building|house)?$",message = "数据类型选择错误")
|
|||
private String dataType; |
|||
/** |
|||
* 楼栋ID |
|||
*/ |
|||
private String buildingId; |
|||
/** |
|||
* 小区ID |
|||
*/ |
|||
private String neighborHoodId; |
|||
|
|||
|
|||
} |
@ -0,0 +1,36 @@ |
|||
package com.epmet.dto.result; |
|||
|
|||
import lombok.AllArgsConstructor; |
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
/** |
|||
* @Description 网格列表信息 |
|||
* @ClassName GridListInfoResultDTO |
|||
* @Author wangc |
|||
* @date 2020.04.23 14:21 |
|||
*/ |
|||
@Data |
|||
public class IcNeighborHoodResultDTO implements Serializable { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
/** |
|||
* 总条数 |
|||
* */ |
|||
private Long total; |
|||
|
|||
/** |
|||
* 数据类型【小区:neighbourHood,楼栋:building,房屋:house】 |
|||
* */ |
|||
private String dataType; |
|||
|
|||
/** |
|||
* 结果集 |
|||
*/ |
|||
private List<Map<String,Object>> list; |
|||
|
|||
|
|||
} |
@ -0,0 +1,133 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* <p> |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.epmet.controller; |
|||
|
|||
import com.epmet.commons.tools.annotation.LoginUser; |
|||
import com.epmet.commons.tools.page.PageData; |
|||
import com.epmet.commons.tools.security.dto.TokenDto; |
|||
import com.epmet.commons.tools.utils.Result; |
|||
import com.epmet.commons.tools.validator.AssertUtils; |
|||
import com.epmet.commons.tools.validator.ValidatorUtils; |
|||
import com.epmet.commons.tools.validator.group.AddGroup; |
|||
import com.epmet.commons.tools.validator.group.DefaultGroup; |
|||
import com.epmet.commons.tools.validator.group.UpdateGroup; |
|||
import com.epmet.dto.IcNeighborHoodDTO; |
|||
import com.epmet.dto.form.IcNeighborHoodFormDTO; |
|||
import com.epmet.dto.form.ListIcNeighborHoodFormDTO; |
|||
import com.epmet.dto.result.IcNeighborHoodResultDTO; |
|||
import com.epmet.service.IcNeighborHoodService; |
|||
import com.epmet.service.NeighborHoodService; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.web.bind.annotation.*; |
|||
|
|||
import java.util.Map; |
|||
|
|||
|
|||
/** |
|||
* 小区表 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2021-10-25 |
|||
*/ |
|||
@RestController |
|||
@RequestMapping("neighborhood") |
|||
public class NeighborHoodController { |
|||
|
|||
@Autowired |
|||
private IcNeighborHoodService icNeighborHoodService; |
|||
@Autowired |
|||
private NeighborHoodService neighborHoodService; |
|||
|
|||
|
|||
|
|||
|
|||
@PostMapping("neighborhoodlist") |
|||
public Result neighborhoodlist(@RequestBody ListIcNeighborHoodFormDTO formDTO){ |
|||
//效验数据
|
|||
ValidatorUtils.validateEntity(ListIcNeighborHoodFormDTO.class); |
|||
IcNeighborHoodResultDTO icNeighborHoodResultDTO = neighborHoodService.listNeighborhood(formDTO); |
|||
return new Result().ok(icNeighborHoodResultDTO); |
|||
|
|||
} |
|||
|
|||
@PostMapping("neighborhoodadd") |
|||
public Result neighborhoodadd(@LoginUser TokenDto tokenDTO, @RequestBody IcNeighborHoodFormDTO formDTO){ |
|||
//效验数据
|
|||
ValidatorUtils.validateEntity(formDTO, AddGroup.class); |
|||
String customerId = tokenDTO.getCustomerId(); |
|||
|
|||
neighborHoodService.AddNeighborhood(customerId,formDTO); |
|||
return new Result(); |
|||
} |
|||
|
|||
@PostMapping("neighborhoodupdate") |
|||
public Result neighborhoodupdate(@LoginUser TokenDto tokenDTO, @RequestBody IcNeighborHoodFormDTO formDTO){ |
|||
//效验数据
|
|||
ValidatorUtils.validateEntity(formDTO, UpdateGroup.class); |
|||
String customerId = tokenDTO.getCustomerId(); |
|||
neighborHoodService.UpdateNeighborhood(customerId,formDTO); |
|||
return new Result(); |
|||
} |
|||
|
|||
@PostMapping("neighborhooddel") |
|||
public Result neighborhooddel(@LoginUser TokenDto tokenDTO, @RequestBody IcNeighborHoodFormDTO formDTO){ |
|||
//效验数据
|
|||
ValidatorUtils.validateEntity(formDTO, IcNeighborHoodFormDTO.DeleteGroup.class); |
|||
String neighborHoodId = formDTO.getNeighborHoodId(); |
|||
neighborHoodService.DelNeighborhood(neighborHoodId); |
|||
return new Result(); |
|||
} |
|||
|
|||
|
|||
@GetMapping("page") |
|||
public Result<PageData<IcNeighborHoodDTO>> page(@RequestParam Map<String, Object> params){ |
|||
PageData<IcNeighborHoodDTO> page = icNeighborHoodService.page(params); |
|||
return new Result<PageData<IcNeighborHoodDTO>>().ok(page); |
|||
} |
|||
|
|||
@GetMapping("{id}") |
|||
public Result<IcNeighborHoodDTO> get(@PathVariable("id") String id){ |
|||
IcNeighborHoodDTO data = icNeighborHoodService.get(id); |
|||
return new Result<IcNeighborHoodDTO>().ok(data); |
|||
} |
|||
|
|||
@PostMapping |
|||
public Result save(@RequestBody IcNeighborHoodDTO dto){ |
|||
//效验数据
|
|||
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); |
|||
icNeighborHoodService.save(dto); |
|||
return new Result(); |
|||
} |
|||
|
|||
@PutMapping |
|||
public Result update(@RequestBody IcNeighborHoodDTO dto){ |
|||
//效验数据
|
|||
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); |
|||
icNeighborHoodService.update(dto); |
|||
return new Result(); |
|||
} |
|||
|
|||
@DeleteMapping |
|||
public Result delete(@RequestBody String[] ids){ |
|||
//效验数据
|
|||
AssertUtils.isArrayEmpty(ids, "id"); |
|||
icNeighborHoodService.delete(ids); |
|||
return new Result(); |
|||
} |
|||
|
|||
} |
@ -0,0 +1,43 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* <p> |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.epmet.service; |
|||
|
|||
import com.epmet.dto.form.IcNeighborHoodFormDTO; |
|||
import com.epmet.dto.form.ListIcNeighborHoodFormDTO; |
|||
import com.epmet.dto.result.IcNeighborHoodResultDTO; |
|||
|
|||
/** |
|||
* 小区表 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2021-10-25 |
|||
*/ |
|||
public interface NeighborHoodService{ |
|||
|
|||
void AddNeighborhood(String customerId, IcNeighborHoodFormDTO formDTO); |
|||
|
|||
IcNeighborHoodResultDTO listNeighborhood(ListIcNeighborHoodFormDTO formDTO); |
|||
|
|||
void UpdateNeighborhood(String customerId, IcNeighborHoodFormDTO formDTO); |
|||
|
|||
/** |
|||
* 删除小区 |
|||
* @param neighborHoodId |
|||
*/ |
|||
void DelNeighborhood(String neighborHoodId); |
|||
} |
@ -0,0 +1,186 @@ |
|||
package com.epmet.service.impl; |
|||
|
|||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|||
import com.baomidou.mybatisplus.core.metadata.IPage; |
|||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|||
import com.epmet.commons.tools.exception.EpmetErrorCode; |
|||
import com.epmet.commons.tools.exception.RenException; |
|||
import com.epmet.commons.tools.utils.ConvertUtils; |
|||
import com.epmet.commons.tools.utils.Result; |
|||
import com.epmet.constant.NeighborhoodConstant; |
|||
import com.epmet.dao.IcNeighborHoodDao; |
|||
import com.epmet.dao.IcNeighborHoodPropertyDao; |
|||
import com.epmet.dto.CustomerAgencyDTO; |
|||
import com.epmet.dto.IcNeighborHoodDTO; |
|||
import com.epmet.dto.IcNeighborHoodPropertyDTO; |
|||
import com.epmet.dto.form.IcNeighborHoodFormDTO; |
|||
import com.epmet.dto.form.ListIcNeighborHoodFormDTO; |
|||
import com.epmet.dto.result.IcNeighborHoodResultDTO; |
|||
import com.epmet.entity.IcNeighborHoodEntity; |
|||
import com.epmet.entity.IcNeighborHoodPropertyEntity; |
|||
import com.epmet.feign.GovOrgOpenFeignClient; |
|||
import com.epmet.service.IcNeighborHoodPropertyService; |
|||
import com.epmet.service.IcNeighborHoodService; |
|||
import com.epmet.service.NeighborHoodService; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.stereotype.Service; |
|||
import org.springframework.transaction.annotation.Transactional; |
|||
import org.springframework.util.StringUtils; |
|||
|
|||
import javax.annotation.Resource; |
|||
import java.util.HashMap; |
|||
import java.util.Map; |
|||
import java.util.Optional; |
|||
|
|||
@Slf4j |
|||
@Service |
|||
public class NeighborHoodServiceImpl implements NeighborHoodService { |
|||
|
|||
@Autowired |
|||
private GovOrgOpenFeignClient govOrgOpenFeignClient; |
|||
|
|||
|
|||
@Autowired |
|||
private IcNeighborHoodService icNeighborHoodService; |
|||
|
|||
@Autowired |
|||
private IcNeighborHoodPropertyService icNeighborHoodPropertyService; |
|||
|
|||
@Resource |
|||
private IcNeighborHoodPropertyDao icNeighborHoodPropertyDao; |
|||
|
|||
@Resource |
|||
private IcNeighborHoodDao icNeighborHoodDao; |
|||
|
|||
@Override |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public void AddNeighborhood(String customerId, IcNeighborHoodFormDTO formDTO) { |
|||
IcNeighborHoodDTO icNeighborHoodDTO = ConvertUtils.sourceToTarget(formDTO, IcNeighborHoodDTO.class); |
|||
icNeighborHoodDTO.setCustomerId(customerId); |
|||
Result<CustomerAgencyDTO> customerAgencyResult = govOrgOpenFeignClient.getAgencyById(icNeighborHoodDTO.getAgencyId()); |
|||
// customerAgency.getData().get
|
|||
if (!customerAgencyResult.success()) { |
|||
throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode()); |
|||
} |
|||
CustomerAgencyDTO customerAgencyDTO = Optional.ofNullable(customerAgencyResult.getData()).orElse(new CustomerAgencyDTO()); |
|||
icNeighborHoodDTO.setParentAgencyId(customerAgencyDTO.getPid()); |
|||
icNeighborHoodDTO.setAgencyPids(customerAgencyDTO.getPids()); |
|||
icNeighborHoodService.save(icNeighborHoodDTO); |
|||
|
|||
//设置物业关联
|
|||
String propertyId = formDTO.getPropertyId(); |
|||
if(!StringUtils.isEmpty(propertyId)){ |
|||
//保存物业关系表
|
|||
IcNeighborHoodPropertyDTO icNeighborHoodPropertyDTO = new IcNeighborHoodPropertyDTO(); |
|||
icNeighborHoodPropertyDTO.setNeighborHoodId(icNeighborHoodDTO.getId()); |
|||
icNeighborHoodPropertyDTO.setPropertyId(propertyId); |
|||
icNeighborHoodPropertyService.save(icNeighborHoodPropertyDTO); |
|||
} |
|||
} |
|||
|
|||
/** |
|||
* 查询 |
|||
* @param formDTO |
|||
*/ |
|||
@Override |
|||
public IcNeighborHoodResultDTO listNeighborhood(ListIcNeighborHoodFormDTO formDTO) { |
|||
String dataType = formDTO.getDataType(); |
|||
Integer pageNo = formDTO.getPageNo(); |
|||
Integer pageSize = formDTO.getPageSize(); |
|||
|
|||
|
|||
|
|||
IcNeighborHoodResultDTO result = new IcNeighborHoodResultDTO(); |
|||
result.setDataType(dataType); |
|||
|
|||
if(StringUtils.isEmpty(dataType)|| NeighborhoodConstant.NEIGHBOR_HOOD.equals(dataType)){ |
|||
//如果类型是neighbourHood 查小区
|
|||
IPage<Map<String, Object>> resultMap = searchNeighborhood(formDTO); |
|||
result.setTotal(resultMap.getTotal()); |
|||
result.setList(resultMap.getRecords()); |
|||
}else if(NeighborhoodConstant.BUILDING.equals(dataType)){ |
|||
//如果类型是building 查楼栋
|
|||
IPage<Map<String, Object>> resultMap = searchNeighborhood(formDTO); |
|||
}else if(NeighborhoodConstant.HOUSE.equals(dataType)){ |
|||
//如果类型是house 查房屋
|
|||
IPage<Map<String, Object>> resultMap = searchNeighborhood(formDTO); |
|||
} |
|||
return result; |
|||
|
|||
} |
|||
/** |
|||
* 更新 |
|||
* @param customerId |
|||
* @param formDTO |
|||
*/ |
|||
@Override |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public void UpdateNeighborhood(String customerId, IcNeighborHoodFormDTO formDTO) { |
|||
IcNeighborHoodDTO icNeighborHoodDTO = ConvertUtils.sourceToTarget(formDTO, IcNeighborHoodDTO.class); |
|||
icNeighborHoodDTO.setId(formDTO.getNeighborHoodId()); |
|||
icNeighborHoodDTO.setCustomerId(customerId); |
|||
|
|||
Result<CustomerAgencyDTO> customerAgencyResult = govOrgOpenFeignClient.getAgencyById(icNeighborHoodDTO.getAgencyId()); |
|||
// customerAgency.getData().get
|
|||
if (!customerAgencyResult.success()) { |
|||
throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode()); |
|||
} |
|||
CustomerAgencyDTO customerAgencyDTO = Optional.ofNullable(customerAgencyResult.getData()).orElse(new CustomerAgencyDTO()); |
|||
icNeighborHoodDTO.setParentAgencyId(customerAgencyDTO.getPid()); |
|||
icNeighborHoodDTO.setAgencyPids(customerAgencyDTO.getPids()); |
|||
icNeighborHoodService.update(icNeighborHoodDTO); |
|||
|
|||
//设置物业关联
|
|||
String propertyId = formDTO.getPropertyId(); |
|||
String neighborHoodId = icNeighborHoodDTO.getId(); |
|||
if(!StringUtils.isEmpty(propertyId)){ |
|||
//更新物业关系表
|
|||
QueryWrapper<IcNeighborHoodPropertyEntity> queryWrapper = new QueryWrapper<>(); |
|||
queryWrapper.lambda().eq(IcNeighborHoodPropertyEntity::getNeighborHoodId,neighborHoodId); |
|||
IcNeighborHoodPropertyEntity icNeighborHoodProperty = icNeighborHoodPropertyDao.selectOne(queryWrapper); |
|||
icNeighborHoodProperty = Optional.ofNullable(icNeighborHoodProperty).orElse(new IcNeighborHoodPropertyEntity()); |
|||
icNeighborHoodProperty.setNeighborHoodId(neighborHoodId); |
|||
icNeighborHoodProperty.setPropertyId(propertyId); |
|||
if(StringUtils.isEmpty(icNeighborHoodProperty.getId())){ |
|||
//插入
|
|||
icNeighborHoodPropertyService.insert(icNeighborHoodProperty); |
|||
}else{ |
|||
//更新
|
|||
icNeighborHoodPropertyService.updateById(icNeighborHoodProperty); |
|||
} |
|||
|
|||
|
|||
} |
|||
} |
|||
|
|||
/** |
|||
* 删除 |
|||
* @param neighborHoodId |
|||
*/ |
|||
@Override |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public void DelNeighborhood(String neighborHoodId) { |
|||
//删除小区
|
|||
icNeighborHoodService.deleteById(neighborHoodId); |
|||
//删除小区物业关联
|
|||
Map<String,Object> columnMap = new HashMap<>(); |
|||
QueryWrapper<IcNeighborHoodPropertyEntity> queryWrapper = new QueryWrapper<>(); |
|||
queryWrapper.lambda().eq(IcNeighborHoodPropertyEntity::getNeighborHoodId,neighborHoodId); |
|||
icNeighborHoodPropertyDao.delete(queryWrapper); |
|||
|
|||
} |
|||
|
|||
private IPage<Map<String,Object>> searchNeighborhood(ListIcNeighborHoodFormDTO formDTO) { |
|||
|
|||
IPage<IcNeighborHoodEntity> page = new Page<IcNeighborHoodEntity>(formDTO.getPageNo(),formDTO.getPageSize()); |
|||
|
|||
QueryWrapper<IcNeighborHoodEntity> neighborHoodEntityQueryWrapper = new QueryWrapper<>(); |
|||
neighborHoodEntityQueryWrapper.lambda() |
|||
.eq(!StringUtils.isEmpty(formDTO.getNeighborHoodId()),IcNeighborHoodEntity::getId,formDTO.getNeighborHoodId()) |
|||
.like(!StringUtils.isEmpty(formDTO.getNeighborHoodName()),IcNeighborHoodEntity::getNeighborHoodName,formDTO.getNeighborHoodName()); |
|||
|
|||
|
|||
return icNeighborHoodDao.searchNeighborhoodByPage(page, neighborHoodEntityQueryWrapper); |
|||
} |
|||
} |
Loading…
Reference in new issue