ChangesInstructionController.java 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. package com.uas.finance.controller;
  2. import com.uas.finance.service.ChangesInstructionService;
  3. import com.uas.finance.model.ChangesInstruction;
  4. import org.slf4j.Logger;
  5. import org.slf4j.LoggerFactory;
  6. import org.springframework.beans.factory.annotation.Autowired;
  7. import org.springframework.stereotype.Controller;
  8. import org.springframework.web.bind.annotation.RequestBody;
  9. import org.springframework.web.bind.annotation.RequestMapping;
  10. import org.springframework.web.bind.annotation.RequestMethod;
  11. import org.springframework.web.bind.annotation.ResponseBody;
  12. import java.util.ArrayList;
  13. import java.util.List;
  14. /**
  15. * 变更内容表单
  16. * created by shicr on 2017/12/20
  17. **/
  18. @Controller
  19. @RequestMapping("/changesInstruction")
  20. public class ChangesInstructionController {
  21. private final static Logger logger = LoggerFactory.getLogger(ChangesInstructionController.class);
  22. @Autowired
  23. private ChangesInstructionService service;
  24. /**
  25. * 变更内容保存
  26. *
  27. * @param instructions
  28. * @return
  29. */
  30. @ResponseBody
  31. @RequestMapping(value = "/save", method = RequestMethod.POST)
  32. public List<ChangesInstruction> save(@RequestBody ChangesInstruction[] instructions) {
  33. logger.info("变更内容保存", "success");
  34. ArrayList<ChangesInstruction> arrayList = new ArrayList<ChangesInstruction>();
  35. for (ChangesInstruction c : instructions) {
  36. ChangesInstruction changesInstruction = service.save(c);
  37. arrayList.add(changesInstruction);
  38. }
  39. return arrayList;
  40. }
  41. }