Commit 4639661a authored by wangtao's avatar wangtao

区域基本信息相关代码生成

根据区划类型查询对应数据接口
parent bf1659b4
package net.wanji.opt.controllerv2.judgeanalysis;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import net.wanji.common.framework.exception.DubboProviderException;
import net.wanji.common.framework.i18n.I18nResourceBundle;
import net.wanji.common.framework.rest.AbstractRestServer;
import net.wanji.common.framework.rest.JsonViewObject;
import net.wanji.common.framework.rest.Page;
import net.wanji.common.framework.rest.impl.AbstractRestServerImpl;
import net.wanji.databus.po.BaseAreaInfoPO;
import net.wanji.opt.entity.BaseAreaInfo;
import net.wanji.opt.servicev2.judgeanalysis.BaseAreaInfoService;
import net.wanji.opt.vo.GreenWaveRunStateVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.ws.rs.core.MediaType;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* <p>
* 区域基础信息 接口API
* </p>
* @version 1.0
* @author wangtao
* @Date 2025-03-18
*/
@RestController
@Slf4j
@RequestMapping("/base-area-info")
@Api(value="BaseAreaInfoController", description="区域基础信息接口", tags = "区域基础信息")
public class BaseAreaInfoController {
@Autowired
private BaseAreaInfoService baseAreaInfoService;
@ApiOperation(httpMethod="GET",value="区域基础信息-根据区划类型查询对应集合数据", notes="")
@GetMapping(value = "/byCondition")
public JsonViewObject getListByType(@RequestParam(value = "type", required = false, defaultValue = "2") Integer type) {
JsonViewObject jsonViewObject = JsonViewObject.newInstance();
try {
List<BaseAreaInfoPO> list = baseAreaInfoService.selectByType(type);
jsonViewObject.success(list);
} catch (Exception e) {
jsonViewObject.fail(I18nResourceBundle.getConstants("GET_FAILED_MSG"));
log.error("{} getAll error", this.getClass().getSimpleName(), e);
}
return jsonViewObject;
}
}
package net.wanji.opt.entity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import net.wanji.common.framework.domain.TrackableEntity;
import java.util.Date;
import java.math.BigDecimal;
/**
* <p>
* 区域基础信息
* </p>
*
* @Author wangtao
* @Date 2025-03-18
*/
@Data
@ApiModel(value="BaseAreaInfo对象", description="区域基础信息")
public class BaseAreaInfo extends TrackableEntity {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "行政区划代码")
private Long code;
@ApiModelProperty(value = "行政区划名称")
private String name;
@ApiModelProperty(value = "道路名称")
private String roadName;
@ApiModelProperty(value = "区划类型:1行政区划;2交警辖区;3商圈;4交通小区;5热点区域;6道路")
private Integer type;
@ApiModelProperty(value = "父节点")
private Integer parentCode;
@ApiModelProperty(value = "区域中心点")
private String location;
@ApiModelProperty(value = "区域边界")
private String polylines;
@ApiModelProperty(value = "备注")
private String remark;
@ApiModelProperty(value = "创建时间")
private Date gmtCreate;
@ApiModelProperty(value = "修改时间")
private Date gmtModified;
}
package net.wanji.opt.servicev2.judgeanalysis;
import net.wanji.databus.po.BaseAreaInfoPO;
import java.util.List;
/**
* <p>
* 区域基础信息
* </p>
*
* @Author wangtao
* @Date 2025-03-18
*/
public interface BaseAreaInfoService {
List<BaseAreaInfoPO> selectByType(Integer type);
}
package net.wanji.opt.servicev2.judgeanalysis.impl;
import net.wanji.common.framework.dubbointerface.impl.BaseDubboInterfaceImpl;
import net.wanji.common.framework.mapper.BaseInterfaceMapper;
import net.wanji.databus.dao.mapper.BaseAreaInfoMapper;
import net.wanji.databus.po.BaseAreaInfoPO;
import net.wanji.opt.entity.BaseAreaInfo;
import lombok.extern.slf4j.Slf4j;
import net.wanji.opt.servicev2.judgeanalysis.BaseAreaInfoService;
import org.apache.dubbo.config.annotation.Service;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.util.List;
/**
* <p>
* 区域基础信息
* </p>
*
* @Author wangtao
* @Date 2025-03-18
*/
@Slf4j
@Component
@Service
public class BaseAreaInfoServiceImpl implements BaseAreaInfoService {
@Resource
private BaseAreaInfoMapper baseAreaInfoMapper;
public List<BaseAreaInfoPO> selectByType(Integer type){
return baseAreaInfoMapper.selectByType(type);
}
}
......@@ -2,6 +2,7 @@ package net.wanji.common.framework.rest;
import net.wanji.common.framework.domain.TrackableEntity;
import io.swagger.annotations.*;
import net.wanji.common.framework.exception.DubboProviderException;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
......@@ -26,6 +27,10 @@ public interface AbstractRestServer<Entity extends TrackableEntity> {
@GetMapping(value = "/byAll", produces = MediaType.APPLICATION_JSON)
JsonViewObject getAll();
@ApiOperation(value = "区域基础信息-根据条件查询记录", notes = "根据条件查询记录", consumes = MediaType.APPLICATION_JSON)
@GetMapping(value = "/byCondition", produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
JsonViewObject getByWhere(@RequestParam(value = "type", required = false, defaultValue = "2") Integer type) throws DubboProviderException;
/**
* 根据条件分页查询记录
*
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment