New file |
| | |
| | | package com.example.springboot.controller; |
| | | |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | |
| | | import com.example.springboot.mapper.HomeMapper; |
| | | import com.example.springboot.service.HomeService; |
| | | import com.example.springboot.common.Result; |
| | | import com.example.springboot.entity.StorageCage; |
| | | |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | @RestController |
| | | @RequestMapping("/home") |
| | | public class HomeController { |
| | | @Autowired |
| | | HomeMapper homeMapper; |
| | | |
| | | @Autowired |
| | | HomeService storageRackService; |
| | | |
| | | @GetMapping("/load") |
| | | public Result selectAll(){ |
| | | List<StorageCage> storageCagelist=homeMapper.selectAll(); |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("list",storageCagelist); |
| | | return Result.success(map); |
| | | } |
| | | |
| | | @GetMapping("/loads") |
| | | public Result selectRack(){ |
| | | List<StorageCage> storageCagelist1=homeMapper.selectRack1(); |
| | | List<StorageCage> storageCagelist2=homeMapper.selectRack2(); |
| | | List<StorageCage> storageCagelist3=homeMapper.selectRack3(); |
| | | List<StorageCage> storageCagelist4=homeMapper.selectRack4(); |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("list1",storageCagelist1); |
| | | map.put("list2",storageCagelist2); |
| | | map.put("list3",storageCagelist3); |
| | | map.put("list4",storageCagelist4); |
| | | return Result.success(map); |
| | | } |
| | | |
| | | |
| | | @GetMapping("/loadinout") |
| | | public Result selectinout(Integer types){ |
| | | List<StorageCage> storageCageinout=homeMapper.selectinout(types); |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("list",storageCageinout); |
| | | return Result.success(map); |
| | | } |
| | | |
| | | @GetMapping("/InsertOrder") |
| | | public Result InsertOrder(String orderid){ |
| | | short result=homeMapper.SelectOrder(orderid); |
| | | Map<String, Object> map = new HashMap<>(); |
| | | if(result>0){ |
| | | homeMapper.updateOrder(); |
| | | homeMapper.InsertOrder(orderid); |
| | | map.put("message","200"); |
| | | }else{ |
| | | map.put("message","500"); |
| | | } |
| | | return Result.success(map); |
| | | } |
| | | |
| | | @GetMapping("/Addglassid") |
| | | public Result Addglassid(Integer glassid){ |
| | | Map<String, Object> map = new HashMap<>(); |
| | | short taskno=homeMapper.SelectOutTask(); |
| | | if(taskno>0){ |
| | | map.put("message2","500"); |
| | | }else{ |
| | | map.put("message2","200"); |
| | | //调用伍上片函数 |
| | | |
| | | } |
| | | return Result.success(map); |
| | | } |
| | | } |