100 lines
3.1 KiB
Java
100 lines
3.1 KiB
Java
|
|
package com.klp.crm.controller;
|
||
|
|
|
||
|
|
import java.util.List;
|
||
|
|
import java.util.Arrays;
|
||
|
|
|
||
|
|
import lombok.RequiredArgsConstructor;
|
||
|
|
import javax.servlet.http.HttpServletResponse;
|
||
|
|
import javax.validation.constraints.*;
|
||
|
|
import org.springframework.web.bind.annotation.*;
|
||
|
|
import org.springframework.validation.annotation.Validated;
|
||
|
|
import com.klp.common.annotation.RepeatSubmit;
|
||
|
|
import com.klp.common.annotation.Log;
|
||
|
|
import com.klp.common.core.controller.BaseController;
|
||
|
|
import com.klp.common.core.domain.PageQuery;
|
||
|
|
import com.klp.common.core.domain.R;
|
||
|
|
import com.klp.common.core.validate.AddGroup;
|
||
|
|
import com.klp.common.core.validate.EditGroup;
|
||
|
|
import com.klp.common.enums.BusinessType;
|
||
|
|
import com.klp.common.utils.poi.ExcelUtil;
|
||
|
|
import com.klp.crm.domain.vo.CrmContractVo;
|
||
|
|
import com.klp.crm.domain.bo.CrmContractBo;
|
||
|
|
import com.klp.crm.service.ICrmContractService;
|
||
|
|
import com.klp.common.core.page.TableDataInfo;
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 合同信息
|
||
|
|
*
|
||
|
|
* @author klp
|
||
|
|
* @date 2026-03-30
|
||
|
|
*/
|
||
|
|
@Validated
|
||
|
|
@RequiredArgsConstructor
|
||
|
|
@RestController
|
||
|
|
@RequestMapping("/crm/contract")
|
||
|
|
public class CrmContractController extends BaseController {
|
||
|
|
|
||
|
|
private final ICrmContractService iCrmContractService;
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 查询合同信息列表
|
||
|
|
*/
|
||
|
|
@GetMapping("/list")
|
||
|
|
public TableDataInfo<CrmContractVo> list(CrmContractBo bo, PageQuery pageQuery) {
|
||
|
|
return iCrmContractService.queryPageList(bo, pageQuery);
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 导出合同信息列表
|
||
|
|
*/
|
||
|
|
@Log(title = "合同信息", businessType = BusinessType.EXPORT)
|
||
|
|
@PostMapping("/export")
|
||
|
|
public void export(CrmContractBo bo, HttpServletResponse response) {
|
||
|
|
List<CrmContractVo> list = iCrmContractService.queryList(bo);
|
||
|
|
ExcelUtil.exportExcel(list, "合同信息", CrmContractVo.class, response);
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 获取合同信息详细信息
|
||
|
|
*
|
||
|
|
* @param contractId 主键
|
||
|
|
*/
|
||
|
|
@GetMapping("/{contractId}")
|
||
|
|
public R<CrmContractVo> getInfo(@NotNull(message = "主键不能为空")
|
||
|
|
@PathVariable Long contractId) {
|
||
|
|
return R.ok(iCrmContractService.queryById(contractId));
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 新增合同信息
|
||
|
|
*/
|
||
|
|
@Log(title = "合同信息", businessType = BusinessType.INSERT)
|
||
|
|
@RepeatSubmit()
|
||
|
|
@PostMapping()
|
||
|
|
public R<Void> add(@Validated(AddGroup.class) @RequestBody CrmContractBo bo) {
|
||
|
|
return toAjax(iCrmContractService.insertByBo(bo));
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 修改合同信息
|
||
|
|
*/
|
||
|
|
@Log(title = "合同信息", businessType = BusinessType.UPDATE)
|
||
|
|
@RepeatSubmit()
|
||
|
|
@PutMapping()
|
||
|
|
public R<Void> edit(@Validated(EditGroup.class) @RequestBody CrmContractBo bo) {
|
||
|
|
return toAjax(iCrmContractService.updateByBo(bo));
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 删除合同信息
|
||
|
|
*
|
||
|
|
* @param contractIds 主键串
|
||
|
|
*/
|
||
|
|
@Log(title = "合同信息", businessType = BusinessType.DELETE)
|
||
|
|
@DeleteMapping("/{contractIds}")
|
||
|
|
public R<Void> remove(@NotEmpty(message = "主键不能为空")
|
||
|
|
@PathVariable Long[] contractIds) {
|
||
|
|
return toAjax(iCrmContractService.deleteWithValidByIds(Arrays.asList(contractIds), true));
|
||
|
|
}
|
||
|
|
}
|