|
@@ -4,11 +4,15 @@ import com.sysu.admin.controller.city.CityRepository;
|
|
|
import com.sysu.admin.controller.city.DistrictRepository;
|
|
|
import com.sysu.admin.controller.city.TownRepository;
|
|
|
import com.sysu.admin.support.base.BaseService;
|
|
|
+import com.sysu.admin.support.system.user.User;
|
|
|
import com.sysu.admin.utils.MySimpleDateFormat;
|
|
|
import com.sysu.admin.utils.TextUtil;
|
|
|
import com.xiesx.fastboot.core.jpa.JpaPlusRepository;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.data.domain.PageRequest;
|
|
|
+import org.springframework.data.domain.Pageable;
|
|
|
+import org.springframework.data.domain.Sort;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import java.util.ArrayList;
|
|
@@ -89,6 +93,22 @@ public class LandService extends BaseService<Land,Long> {
|
|
|
return list;
|
|
|
}
|
|
|
|
|
|
+ public List<Land> list(String district, Integer townId, Integer limit){
|
|
|
+ limit = limit == null ? 50 : limit;
|
|
|
+ String wkt = null;
|
|
|
+ if(townId != null) {
|
|
|
+ wkt = townRepository.findWktById(townId);
|
|
|
+ }else if(StringUtils.isNotBlank(district)) {
|
|
|
+ wkt = districtRepository.findWktByCode(district);
|
|
|
+ }
|
|
|
+ if(wkt == null) {
|
|
|
+ Pageable pageable = PageRequest.of(1, limit, Sort.by(Land.FIELDS.id));
|
|
|
+ return landRepository.findAll(pageable).toList();
|
|
|
+ }else{
|
|
|
+ return landRepository.findListByWkt(wkt, limit);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
@Override
|
|
|
public JpaPlusRepository<Land, Long> r() {
|