小区唯一查询
This commit is contained in:
+1
-1
@@ -1237,7 +1237,7 @@ public class DistrictController {
|
|||||||
*/
|
*/
|
||||||
public Object doAddAction(DistrictModel model) throws UnsupportedEncodingException {
|
public Object doAddAction(DistrictModel model) throws UnsupportedEncodingException {
|
||||||
District district = model.getDistrict();
|
District district = model.getDistrict();
|
||||||
List<District> districts = districtService.findByKey(district.getCity(), district.getRegion(),
|
List<District> districts = districtService.findAllByNameAndCat(district.getCity(), district.getRegion(),
|
||||||
district.getName(), "district");
|
district.getName(), "district");
|
||||||
if (!districts.isEmpty() && districts.get(0).getName().equals(district.getName())) {
|
if (!districts.isEmpty() && districts.get(0).getName().equals(district.getName())) {
|
||||||
model.setMsg("小区名已存在!");
|
model.setMsg("小区名已存在!");
|
||||||
|
|||||||
+2
@@ -466,6 +466,8 @@ public interface DistrictService extends ModeService<DistrictKey, DistrictBo> {
|
|||||||
*/
|
*/
|
||||||
public List<District> findByKey(String city, String region, String name, String cat);
|
public List<District> findByKey(String city, String region, String name, String cat);
|
||||||
|
|
||||||
|
public List<District> findAllByNameAndCat(String city, String region, String name, String cat);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查找周边最相似的楼盘
|
* 查找周边最相似的楼盘
|
||||||
*
|
*
|
||||||
|
|||||||
+14
@@ -2191,6 +2191,20 @@ public class DistrictServiceImpl implements DistrictService {
|
|||||||
return districtDao.findAllByParams(params);
|
return districtDao.findAllByParams(params);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<District> findAllByNameAndCat(String city, String region, String name, String cat) {
|
||||||
|
List<QueryParam> params = new ArrayList<QueryParam>(5);
|
||||||
|
params.add(new QueryParam("city", city));
|
||||||
|
if (StringUtils.isNotBlank(region)) {
|
||||||
|
params.add(new QueryParam("region", region));
|
||||||
|
}
|
||||||
|
if (StringUtils.isNotBlank(name)) {
|
||||||
|
params.add(new QueryParam("name", name));
|
||||||
|
}
|
||||||
|
params.add(new QueryParam("category", cat));
|
||||||
|
return districtDao.findAllByParams(params);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public District findOneByKey(DistrictKey districtKey, String cat) {
|
public District findOneByKey(DistrictKey districtKey, String cat) {
|
||||||
List<District> districts = findByKey(districtKey.getCity(), districtKey.getRegion(), districtKey.getName(),
|
List<District> districts = findByKey(districtKey.getCity(), districtKey.getRegion(), districtKey.getName(),
|
||||||
|
|||||||
Reference in New Issue
Block a user