CrmCustomerContactsController.java 3.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. package com.fs.crm.controller;
  2. import java.util.List;
  3. import org.springframework.security.access.prepost.PreAuthorize;
  4. import org.springframework.beans.factory.annotation.Autowired;
  5. import org.springframework.web.bind.annotation.GetMapping;
  6. import org.springframework.web.bind.annotation.PostMapping;
  7. import org.springframework.web.bind.annotation.PutMapping;
  8. import org.springframework.web.bind.annotation.DeleteMapping;
  9. import org.springframework.web.bind.annotation.PathVariable;
  10. import org.springframework.web.bind.annotation.RequestBody;
  11. import org.springframework.web.bind.annotation.RequestMapping;
  12. import org.springframework.web.bind.annotation.RestController;
  13. import com.fs.common.annotation.Log;
  14. import com.fs.common.core.controller.BaseController;
  15. import com.fs.common.core.domain.AjaxResult;
  16. import com.fs.common.enums.BusinessType;
  17. import com.fs.crm.domain.CrmCustomerContacts;
  18. import com.fs.crm.service.ICrmCustomerContactsService;
  19. import com.fs.common.utils.poi.ExcelUtil;
  20. import com.fs.common.core.page.TableDataInfo;
  21. /**
  22. * 客户联系人Controller
  23. *
  24. * @author fs
  25. * @date 2023-03-14
  26. */
  27. @RestController
  28. @RequestMapping("/crm/customerContacts")
  29. public class CrmCustomerContactsController extends BaseController
  30. {
  31. @Autowired
  32. private ICrmCustomerContactsService crmCustomerContactsService;
  33. /**
  34. * 查询客户联系人列表
  35. */
  36. @GetMapping("/list")
  37. public TableDataInfo list(CrmCustomerContacts crmCustomerContacts)
  38. {
  39. startPage();
  40. List<CrmCustomerContacts> list = crmCustomerContactsService.selectCrmCustomerContactsList(crmCustomerContacts);
  41. return getDataTable(list);
  42. }
  43. /**
  44. * 导出客户联系人列表
  45. */
  46. @PreAuthorize("@ss.hasPermi('crm:customerContacts:export')")
  47. @Log(title = "客户联系人", businessType = BusinessType.EXPORT)
  48. @GetMapping("/export")
  49. public AjaxResult export(CrmCustomerContacts crmCustomerContacts)
  50. {
  51. List<CrmCustomerContacts> list = crmCustomerContactsService.selectCrmCustomerContactsList(crmCustomerContacts);
  52. ExcelUtil<CrmCustomerContacts> util = new ExcelUtil<CrmCustomerContacts>(CrmCustomerContacts.class);
  53. return util.exportExcel(list, "customerContacts");
  54. }
  55. /**
  56. * 获取客户联系人详细信息
  57. */
  58. @GetMapping(value = "/{contactsId}")
  59. public AjaxResult getInfo(@PathVariable("contactsId") Long contactsId)
  60. {
  61. return AjaxResult.success(crmCustomerContactsService.selectCrmCustomerContactsById(contactsId));
  62. }
  63. /**
  64. * 新增客户联系人
  65. */
  66. @Log(title = "客户联系人", businessType = BusinessType.INSERT)
  67. @PostMapping
  68. public AjaxResult add(@RequestBody CrmCustomerContacts crmCustomerContacts)
  69. {
  70. return toAjax(crmCustomerContactsService.insertCrmCustomerContacts(crmCustomerContacts));
  71. }
  72. /**
  73. * 修改客户联系人
  74. */
  75. @Log(title = "客户联系人", businessType = BusinessType.UPDATE)
  76. @PutMapping
  77. public AjaxResult edit(@RequestBody CrmCustomerContacts crmCustomerContacts)
  78. {
  79. return toAjax(crmCustomerContactsService.updateCrmCustomerContacts(crmCustomerContacts));
  80. }
  81. /**
  82. * 删除客户联系人
  83. */
  84. @Log(title = "客户联系人", businessType = BusinessType.DELETE)
  85. @DeleteMapping("/{contactsIds}")
  86. public AjaxResult remove(@PathVariable Long[] contactsIds)
  87. {
  88. return toAjax(crmCustomerContactsService.deleteCrmCustomerContactsByIds(contactsIds));
  89. }
  90. }