TCustomerController.java 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. package com.ruoyi.web.controller.tool;
  2. import java.util.List;
  3. import javax.servlet.http.HttpServletResponse;
  4. import com.ruoyi.system.domain.crm.TCustomer;
  5. import com.ruoyi.system.service.crm.ITCustomerService;
  6. import io.swagger.annotations.Api;
  7. import io.swagger.annotations.ApiOperation;
  8. import org.springframework.security.access.prepost.PreAuthorize;
  9. import org.springframework.beans.factory.annotation.Autowired;
  10. import org.springframework.web.bind.annotation.GetMapping;
  11. import org.springframework.web.bind.annotation.PostMapping;
  12. import org.springframework.web.bind.annotation.PutMapping;
  13. import org.springframework.web.bind.annotation.DeleteMapping;
  14. import org.springframework.web.bind.annotation.PathVariable;
  15. import org.springframework.web.bind.annotation.RequestBody;
  16. import org.springframework.web.bind.annotation.RequestMapping;
  17. import org.springframework.web.bind.annotation.RestController;
  18. import com.ruoyi.common.annotation.Log;
  19. import com.ruoyi.common.core.controller.BaseController;
  20. import com.ruoyi.common.core.domain.AjaxResult;
  21. import com.ruoyi.common.enums.BusinessType;
  22. import com.ruoyi.common.utils.poi.ExcelUtil;
  23. import com.ruoyi.common.core.page.TableDataInfo;
  24. /**
  25. * crmController
  26. *
  27. * @author ruoyi
  28. * @date 2023-11-28
  29. */
  30. @Api(tags = "CRM系统接口")
  31. @RestController
  32. @RequestMapping("/system/customer")
  33. public class TCustomerController extends BaseController
  34. {
  35. @Autowired
  36. private ITCustomerService tCustomerService;
  37. /**
  38. * 查询crm列表
  39. */
  40. @ApiOperation(value = "获取客户列表")
  41. @PreAuthorize("@ss.hasPermi('system:customer:list')")
  42. @GetMapping("/list")
  43. public TableDataInfo list(TCustomer tCustomer)
  44. {
  45. startPage();
  46. List<TCustomer> list = tCustomerService.selectTCustomerList(tCustomer);
  47. return getDataTable(list);
  48. }
  49. /**
  50. * 导出crm列表
  51. */
  52. @ApiOperation(value = "导出客户列表")
  53. @PreAuthorize("@ss.hasPermi('system:customer:export')")
  54. @Log(title = "crm", businessType = BusinessType.EXPORT)
  55. @PostMapping("/export")
  56. public void export(HttpServletResponse response, TCustomer tCustomer)
  57. {
  58. List<TCustomer> list = tCustomerService.selectTCustomerList(tCustomer);
  59. ExcelUtil<TCustomer> util = new ExcelUtil<TCustomer>(TCustomer.class);
  60. util.exportExcel(response, list, "crm数据");
  61. }
  62. /**
  63. * 获取crm详细信息
  64. */
  65. @ApiOperation(value = "获取crm详细信息")
  66. @PreAuthorize("@ss.hasPermi('system:customer:query')")
  67. @GetMapping(value = "/{id}")
  68. public AjaxResult getInfo(@PathVariable("id") String id)
  69. {
  70. return success(tCustomerService.selectTCustomerById(id));
  71. }
  72. /**
  73. * 新增crm
  74. */
  75. @ApiOperation(value = "新增crm")
  76. @PreAuthorize("@ss.hasPermi('system:customer:add')")
  77. @Log(title = "crm", businessType = BusinessType.INSERT)
  78. @PostMapping
  79. public AjaxResult add(@RequestBody TCustomer tCustomer)
  80. {
  81. tCustomer.setCreateBy(getUsername());
  82. return toAjax(tCustomerService.insertTCustomer(tCustomer));
  83. }
  84. /**
  85. * 修改crm
  86. */
  87. @ApiOperation(value = "修改crm")
  88. @PreAuthorize("@ss.hasPermi('system:customer:edit')")
  89. @Log(title = "crm", businessType = BusinessType.UPDATE)
  90. @PutMapping
  91. public AjaxResult edit(@RequestBody TCustomer tCustomer)
  92. {
  93. return toAjax(tCustomerService.updateTCustomer(tCustomer));
  94. }
  95. /**
  96. * 删除crm
  97. */
  98. @ApiOperation(value = "删除crm")
  99. @PreAuthorize("@ss.hasPermi('system:customer:remove')")
  100. @Log(title = "crm", businessType = BusinessType.DELETE)
  101. @DeleteMapping("/{ids}")
  102. public AjaxResult remove(@PathVariable String[] ids)
  103. {
  104. return toAjax(tCustomerService.deleteTCustomerByIds(ids));
  105. }
  106. }