123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124 |
- package edu.travel.country.web;
- import com.baomidou.mybatisplus.core.metadata.IPage;
- import edu.travel.country.entity.BaseCountryServe;
- import edu.travel.country.service.BaseCountryServeService;
- import edu.travel.dto.BaseCountryServeDto;
- import edu.travel.remote.BaseCountryServeRemoteController;
- import edu.travel.rpc.RPCBaseResponse;
- import edu.travel.vo.BaseCountryServeVo;
- import edu.travel.web.BaseController;
- import org.springframework.beans.BeanUtils;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.web.bind.annotation.*;
- import java.util.List;
- /**
- * 服务国家表(base_country_serve)表控制层
- *
- * @author xxxxx
- */
- @RestController
- @RequestMapping("/baseCountryServe")
- public class BaseCountryServeController extends BaseController<BaseCountryServe> implements BaseCountryServeRemoteController {
- /**
- * 服务国家表(base_country_serve)表控制层
- *
- */
- @Autowired
- private BaseCountryServeService baseCountryServeService;
- /**
- * 分页
- * @param dto
- * @return
- */
- @GetMapping("/getCountryServePage")
- public RPCBaseResponse<IPage<BaseCountryServeVo>> getCountryServePage(BaseCountryServeDto dto) {
- return baseCountryServeService.getCountryServePage(dto);
- }
- /**
- * 服务国家树
- */
- @GetMapping("/getCountryServeTree")
- public RPCBaseResponse<List<BaseCountryServeVo>> getCountryServeTree(){
- System.out.println("获取服务国家树");
- return baseCountryServeService.getCountryServeTree();
- }
- /**
- * 获取服务国家信息
- * @param id
- * @return
- */
- @Override
- @GetMapping("/getCountryServeFormId")
- public RPCBaseResponse<BaseCountryServeVo> getFormId(String id) {
- RPCBaseResponse<BaseCountryServe> baseCountryServeRPCBaseResponse = super.getId(id);
- RPCBaseResponse<BaseCountryServeVo> baseCountryServeVoPRCBaseResponse = new RPCBaseResponse<>();
- BeanUtils.copyProperties(baseCountryServeRPCBaseResponse, baseCountryServeVoPRCBaseResponse);
- return baseCountryServeVoPRCBaseResponse;
- }
- /**
- * 更新服务国家信息
- * @param entity
- * @return
- */
- @Override
- @PostMapping("/updateCountryServeFormId")
- public RPCBaseResponse<BaseCountryServeVo> updateTargetFormId(@RequestBody BaseCountryServeDto entity) {
- BaseCountryServe baseCountryServe = new BaseCountryServe();
- BeanUtils.copyProperties(entity, baseCountryServe);
- RPCBaseResponse<BaseCountryServe> baseCountryServeRPCBaseResponse = super.updateTargetById(baseCountryServe);
- RPCBaseResponse<BaseCountryServeVo> baseCountryServeVoRPCBaseResponse = new RPCBaseResponse<>();
- BeanUtils.copyProperties(baseCountryServeRPCBaseResponse, baseCountryServeVoRPCBaseResponse);
- return baseCountryServeVoRPCBaseResponse;
- }
- /**
- * 新增服务国家信息
- * @param entity
- * @return
- */
- @Override
- @PostMapping("/saveCountryServeForm")
- public RPCBaseResponse<BaseCountryServeVo> saveFormTarget(@RequestBody BaseCountryServeDto entity) {
- BaseCountryServe baseCountryServe = new BaseCountryServe();
- BeanUtils.copyProperties(entity, baseCountryServe);
- RPCBaseResponse<BaseCountryServe> baseCountryServeRPCBaseResponse = super.saveTarget(baseCountryServe);
- RPCBaseResponse<BaseCountryServeVo> baseCountryServeVoRPCBaseResponse = new RPCBaseResponse<>();
- BeanUtils.copyProperties(baseCountryServeRPCBaseResponse, baseCountryServeVoRPCBaseResponse);
- return baseCountryServeVoRPCBaseResponse;
- }
- /**
- * 删除服务国家信息
- * @param ids
- * @return
- */
- @Override
- @PostMapping("/deleteCountryServeFormId")
- public RPCBaseResponse<BaseCountryServeVo> deleteTargetFormId(@RequestBody List<String> ids) {
- RPCBaseResponse<BaseCountryServe> baseCountryServeRPCBaseResponse = super.deleteTargetById(ids);
- RPCBaseResponse<BaseCountryServeVo> baseCountryServeVoRPCBaseResponse = new RPCBaseResponse<>();
- BeanUtils.copyProperties(baseCountryServeRPCBaseResponse, baseCountryServeVoRPCBaseResponse);
- return baseCountryServeVoRPCBaseResponse;
- }
- /**
- * 获取服务国家列表
- * @return
- */
- @Override
- @GetMapping("/listForm")
- public RPCBaseResponse<List<BaseCountryServeVo>> getAllForm() {
- RPCBaseResponse<List<BaseCountryServe>> listRPCBaseResponse = super.listAll();
- RPCBaseResponse<List<BaseCountryServeVo>> baseCountryServeVoRPCBaseResponse = new RPCBaseResponse<>();
- BeanUtils.copyProperties(listRPCBaseResponse, baseCountryServeVoRPCBaseResponse);
- return baseCountryServeVoRPCBaseResponse;
- }
- }
|