package com.example.hosdata.controller; import com.example.hosdata.pojo.Medicine; import com.example.hosdata.pojo.RegisterRecord; import com.example.hosdata.pojo.ShopRecord; import com.example.hosdata.service.ShopService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.*; import java.util.List; @RestController public class ShopController { @Autowired ShopService shopService; @ResponseBody @CrossOrigin @GetMapping(value = "/api/shop") public List shop() { return shopService.MedicineList(); } @CrossOrigin @PostMapping("/api/shop") public ShopRecord Add(@RequestBody ShopRecord SR) throws Exception { shopService.addOrUpdate(SR); return SR; } @CrossOrigin @PostMapping("/api/Admin") public Medicine Update(@RequestBody Medicine medicine) throws Exception { shopService.Update(medicine); return medicine; } @CrossOrigin @GetMapping("/api/shoprecords") public List listbymyzh() throws Exception { return shopService.listBymyzh(); } }