package edu.travel.country.web; import com.baomidou.mybatisplus.core.metadata.IPage; import edu.travel.commodity.dto.BaseCountryDto; import edu.travel.commodity.remote.BaseCountryRemoteController; import edu.travel.commodity.vo.BaseCountryVo; import edu.travel.country.entity.BaseCountry; import edu.travel.country.service.BaseCountryService; import edu.travel.rpc.RPCBaseResponse; 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)表控制层 * * @author xxxxx */ @RestController @RequestMapping("/baseCountry") public class BaseCountryController extends BaseController implements BaseCountryRemoteController { /** * 服务对象 */ @Autowired private BaseCountryService baseCountryService; //国家树 @GetMapping("/getCountryTree") public RPCBaseResponse> getCountryTree() { return baseCountryService.getCountryTree(); } //国家分页 @GetMapping("/getCountryPage") public RPCBaseResponse> getCountryPage(BaseCountryDto baseCountryDTO) { return baseCountryService.getCountryPage(baseCountryDTO); } @Override @GetMapping("/getFormId") public RPCBaseResponse getFormId(String id) { RPCBaseResponse countryRPCBaseResponse = super.getId(id); RPCBaseResponse baseCountryVoRPCBaseResponse = new RPCBaseResponse<>(); BeanUtils.copyProperties(countryRPCBaseResponse, baseCountryVoRPCBaseResponse); return baseCountryVoRPCBaseResponse; } @Override @PostMapping("/updateFormId") public RPCBaseResponse updateTargetFormId(@RequestBody BaseCountryDto entity) { BaseCountry baseCountry = new BaseCountry(); BeanUtils.copyProperties(entity, baseCountry); RPCBaseResponse baseCountryRPCBaseResponse = super.updateTargetById(baseCountry); RPCBaseResponse baseCountryVoRPCBaseResponse = new RPCBaseResponse<>(); BeanUtils.copyProperties(baseCountryRPCBaseResponse, baseCountryVoRPCBaseResponse); return baseCountryVoRPCBaseResponse; } @Override @PostMapping("/saveForm") public RPCBaseResponse saveFormTarget(@RequestBody BaseCountryDto entity) { BaseCountry baseCountry = new BaseCountry(); BeanUtils.copyProperties(entity, baseCountry); RPCBaseResponse baseCountryRPCBaseResponse = super.saveTarget(baseCountry); RPCBaseResponse baseCountryVoRPCBaseResponse = new RPCBaseResponse<>(); BeanUtils.copyProperties(baseCountryRPCBaseResponse, baseCountryVoRPCBaseResponse); return baseCountryVoRPCBaseResponse; } @Override @PostMapping("/deleteFormId") public RPCBaseResponse deleteTargetFormId(@RequestBody List ids) { RPCBaseResponse baseCountryRPCBaseResponse = super.deleteTargetById(ids); RPCBaseResponse baseCountryVoRPCBaseResponse = new RPCBaseResponse<>(); BeanUtils.copyProperties(baseCountryRPCBaseResponse, baseCountryVoRPCBaseResponse); return baseCountryVoRPCBaseResponse; } @Override @GetMapping("/listForm") public RPCBaseResponse> getAllForm() { RPCBaseResponse> listRPCBaseResponse = super.listAll(); RPCBaseResponse> baseCountryVoRPCBaseResponse = new RPCBaseResponse<>(); BeanUtils.copyProperties(listRPCBaseResponse, baseCountryVoRPCBaseResponse); return baseCountryVoRPCBaseResponse; } }