TaskDetailsController.java 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  1. package com.goafanti.techproject.controller;
  2. import com.goafanti.common.bo.Result;
  3. import com.goafanti.common.constant.ErrorConstants;
  4. import com.goafanti.common.controller.BaseController;
  5. import com.goafanti.common.model.TaskDetails;
  6. import com.goafanti.common.model.TaskDetailsLog;
  7. import com.goafanti.common.model.TaskFeature;
  8. import com.goafanti.techproject.service.TaskDetailsService;
  9. import org.springframework.web.bind.annotation.GetMapping;
  10. import org.springframework.web.bind.annotation.PostMapping;
  11. import org.springframework.web.bind.annotation.RequestMapping;
  12. import org.springframework.web.bind.annotation.RestController;
  13. import javax.annotation.Resource;
  14. import java.util.List;
  15. /**
  16. * 项目申报详情(TaskDetails)表控制层
  17. *
  18. * @author makejava
  19. * @since 2024-12-26 17:11:50
  20. */
  21. @RestController
  22. @RequestMapping("/api/admin/taskDetails")
  23. public class TaskDetailsController extends BaseController {
  24. /**
  25. * 服务对象
  26. */
  27. @Resource
  28. private TaskDetailsService taskDetailsService;
  29. /**
  30. * 新增项目进度数据
  31. *
  32. * @param taskDetails 实体
  33. * @param type 0=初步新增,1=新增切同步日志
  34. * @return 新增结果
  35. */
  36. @PostMapping("/add")
  37. public Result<TaskDetails> add(TaskDetails taskDetails,Integer type) {
  38. Result<TaskDetails> res = new Result<>();
  39. if (taskDetailsService.checkTid(taskDetails)){
  40. res.getError().add(buildError(ErrorConstants.PARAM_BEING_ERROR,"项目进度与年份"));
  41. return res;
  42. }
  43. return res.data(this.taskDetailsService.insert(taskDetails,type));
  44. }
  45. /**
  46. * 查询项目进度单条数据
  47. *
  48. * @param id 主键
  49. * @return 单条数据
  50. */
  51. @GetMapping("/get")
  52. public Result<TaskDetails> queryById(Integer id) {
  53. return new Result<>().data(this.taskDetailsService.queryById(id));
  54. }
  55. /**
  56. * 查询项目进度页面
  57. *
  58. * @param id 主键
  59. * @return 单条数据
  60. */
  61. @GetMapping("/getByTid")
  62. public Result<TaskDetails> getByTid(Integer id) {
  63. return new Result<>().data(this.taskDetailsService.upshByTid(id));
  64. }
  65. /**
  66. * 编辑项目进度数据
  67. *
  68. * @param taskDetails 实体
  69. * @return 编辑结果
  70. */
  71. @PostMapping("/update")
  72. public Result edit(TaskDetails taskDetails) {
  73. return new Result<>().data(this.taskDetailsService.update(taskDetails));
  74. }
  75. /**
  76. * 删除数据
  77. *
  78. * @param id 主键
  79. * @return 删除是否成功
  80. */
  81. @GetMapping("/delete")
  82. public Result deleteById(Integer id) {
  83. return new Result<>().data(this.taskDetailsService.deleteById(id));
  84. }
  85. /**
  86. * 列表查询
  87. *
  88. * @param in 参数
  89. * @return
  90. */
  91. @GetMapping("/list")
  92. public Result<TaskDetails> list(TaskDetails in, Integer pageNo, Integer pageSize) {
  93. return new Result<>().data(this.taskDetailsService.list(in, pageNo, pageSize));
  94. }
  95. /**
  96. * 导出数据
  97. *
  98. * @return
  99. */
  100. @GetMapping("/export")
  101. public Result export(Integer id) {
  102. return this.taskDetailsService.export(id);
  103. }
  104. /**
  105. * 新增特色工作
  106. * @param in
  107. * @return
  108. */
  109. @PostMapping("/addTaskFeature")
  110. public Result<TaskFeature> addTaskFeature(TaskFeature in) {
  111. Result<TaskFeature> res = new Result<>();
  112. return res.data(this.taskDetailsService.addFeature(in));
  113. }
  114. /**
  115. * 编辑项目特色工作
  116. *
  117. * @param in 实体
  118. * @return 编辑结果
  119. */
  120. @PostMapping("/updateTaskFeature")
  121. public Result<TaskFeature> updateTaskFeature(TaskFeature in) {
  122. return new Result<>().data(this.taskDetailsService.updateFeature(in));
  123. }
  124. /**
  125. * 日志列表查询
  126. *
  127. */
  128. @GetMapping("/logList")
  129. public Result<List<TaskDetailsLog>> logList(Integer id) {
  130. return new Result<>().data(this.taskDetailsService.logList(id));
  131. }
  132. /**
  133. * 日志列表查询
  134. *
  135. */
  136. @GetMapping("/logDetails")
  137. public Result logDetails(Integer id) {
  138. return new Result<>().data(this.taskDetailsService.logDetails(id));
  139. }
  140. }