You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
hospital/src/controller/ShopController.java

47 lines
1.2 KiB

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<Medicine> 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<ShopRecord> listbymyzh() throws Exception {
return shopService.listBymyzh();
}
}