| | |
| | | import com.smartearth.poiexcel.entity.DkEntity; |
| | | import com.smartearth.poiexcel.entity.ResponseMsg; |
| | | import com.smartearth.poiexcel.mapper.DkMapper; |
| | | import com.smartearth.poiexcel.service.DkService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | |
| | | public class DkController extends BaseController { |
| | | @Resource |
| | | DkMapper dkMapper; |
| | | |
| | | @Resource |
| | | DkService dkService; |
| | | |
| | | @ApiOperation(value = "分页查询地块") |
| | | @ApiImplicitParams({ |
| | |
| | | return fail(ex, -1); |
| | | } |
| | | } |
| | | |
| | | @ApiOperation(value = "根据编号更新") |
| | | @GetMapping(value = "/updateByBh") |
| | | public ResponseMsg<Object> updateByBh() { |
| | | try { |
| | | QueryWrapper<DkEntity> wrapper = new QueryWrapper<>(); |
| | | wrapper.apply("length(dikuaibianhao) > 0"); |
| | | |
| | | List<DkEntity> list = dkMapper.selectList(wrapper); |
| | | if (null == list || list.isEmpty()) { |
| | | return success("没需要更新的地块", 0); |
| | | } |
| | | |
| | | int rows = 0; |
| | | for (DkEntity dk : list) { |
| | | boolean flag = dkService.updateByBh(dk); |
| | | if (flag) { |
| | | rows += dkMapper.updateById(dk); |
| | | } |
| | | } |
| | | |
| | | return success(rows); |
| | | } catch (Exception ex) { |
| | | return fail(ex, -1); |
| | | } |
| | | } |
| | | |
| | | @ApiOperation(value = "根据坐标更新") |
| | | @GetMapping(value = "/updateByCoord") |
| | | public ResponseMsg<Object> updateByCoord() { |
| | | try { |
| | | QueryWrapper<DkEntity> wrapper = new QueryWrapper<>(); |
| | | wrapper.apply("length(dikuaibianhao) > 0"); |
| | | |
| | | List<DkEntity> list = dkMapper.selectList(wrapper); |
| | | if (null == list || list.isEmpty()) { |
| | | return success("没需要更新的地块", 0); |
| | | } |
| | | |
| | | int rows = 0; |
| | | for (DkEntity dk : list) { |
| | | boolean flag = dkService.updateByCoord(dk); |
| | | if (flag) { |
| | | rows += dkMapper.updateById(dk); |
| | | } |
| | | } |
| | | |
| | | return success(rows); |
| | | } catch (Exception ex) { |
| | | return fail(ex, -1); |
| | | } |
| | | } |
| | | } |