project-manager-java/ruoyi-web/src/main/java/com/ruoyi/web/bst/CustomerFollowController.java
2025-02-11 18:15:13 +08:00

114 lines
4.1 KiB
Java

package com.ruoyi.web.bst;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.bst.customerFollow.domain.CustomerFollow;
import com.ruoyi.bst.customerFollow.domain.CustomerFollowQuery;
import com.ruoyi.bst.customerFollow.domain.CustomerFollowVO;
import com.ruoyi.bst.customerFollow.service.CustomerFollowService;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.core.validate.ValidGroup;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.poi.ExcelUtil;
/**
* 客户跟进记录Controller
*
* @author ruoyi
* @date 2025-01-22
*/
@RestController
@RequestMapping("/bst/customerFollow")
public class CustomerFollowController extends BaseController
{
@Autowired
private CustomerFollowService customerFollowService;
/**
* 查询客户跟进记录列表
*/
@PreAuthorize("@ss.hasPermi('bst:customerFollow:list')")
@GetMapping("/list")
public TableDataInfo list(CustomerFollowQuery query)
{
startPage();
startOrderBy();
List<CustomerFollowVO> list = customerFollowService.selectCustomerFollowList(query);
return getDataTable(list);
}
/**
* 导出客户跟进记录列表
*/
@PreAuthorize("@ss.hasPermi('bst:customerFollow:export')")
@Log(title = "客户跟进记录", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, CustomerFollowQuery query)
{
List<CustomerFollowVO> list = customerFollowService.selectCustomerFollowList(query);
ExcelUtil<CustomerFollowVO> util = new ExcelUtil<CustomerFollowVO>(CustomerFollowVO.class);
util.exportExcel(response, list, "客户跟进记录数据");
}
/**
* 获取客户跟进记录详细信息
*/
@PreAuthorize("@ss.hasPermi('bst:customerFollow:query')")
@GetMapping(value = "/{followId}")
public AjaxResult getInfo(@PathVariable("followId") Long followId)
{
return success(customerFollowService.selectCustomerFollowByFollowId(followId));
}
/**
* 新增客户跟进记录
*/
@PreAuthorize("@ss.hasPermi('bst:customerFollow:add')")
@Log(title = "客户跟进记录", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody @Validated(ValidGroup.Create.class) CustomerFollow customerFollow)
{
customerFollow.setUserId(getUserId());
return toAjax(customerFollowService.insertCustomerFollow(customerFollow));
}
/**
* 修改客户跟进记录
*/
@PreAuthorize("@ss.hasPermi('bst:customerFollow:edit')")
@Log(title = "客户跟进记录", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody @Validated(ValidGroup.Update.class) CustomerFollow customerFollow)
{
return toAjax(customerFollowService.updateCustomerFollow(customerFollow));
}
/**
* 删除客户跟进记录
*/
@PreAuthorize("@ss.hasPermi('bst:customerFollow:remove')")
@Log(title = "客户跟进记录", businessType = BusinessType.DELETE)
@DeleteMapping("/{followIds}")
public AjaxResult remove(@PathVariable Long[] followIds)
{
return toAjax(customerFollowService.deleteCustomerFollowByFollowIds(followIds));
}
}