123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125 |
- package com.yijia.customer.controller;
- import com.yijia.common.core.domain.entity.SysDept;
- import com.yijia.common.core.domain.model.LoginUser;
- import com.yijia.common.utils.SecurityUtils;
- import com.yijia.common.utils.poi.ExcelUtil;
- import com.yijia.customer.domain.CustomerManage;
- import com.yijia.customer.service.ICustomerManageService;
- import com.yijia.system.service.ISysDeptService;
- import com.yijia.system.service.ISysUserService;
- import org.springframework.security.access.prepost.PreAuthorize;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.web.bind.annotation.GetMapping;
- import org.springframework.web.bind.annotation.PostMapping;
- import org.springframework.web.bind.annotation.PutMapping;
- import org.springframework.web.bind.annotation.DeleteMapping;
- import org.springframework.web.bind.annotation.PathVariable;
- import org.springframework.web.bind.annotation.RequestBody;
- import org.springframework.web.bind.annotation.RequestMapping;
- import org.springframework.web.bind.annotation.RestController;
- import com.yijia.common.annotation.Log;
- import com.yijia.common.core.controller.BaseController;
- import com.yijia.common.core.domain.AjaxResult;
- import com.yijia.common.enums.BusinessType;
- import com.yijia.common.core.page.TableDataInfo;
- import java.util.Arrays;
- import java.util.List;
- /**
- * 客户管理Controller
- *
- * @author yijia
- * @date 2020-12-21
- */
- @RestController
- @RequestMapping("/customer/manage")
- public class CustomerManageController extends BaseController
- {
- @Autowired
- private ICustomerManageService customerManageService;
- @Autowired
- private ISysDeptService deptService;
- /**
- * 查询客户管理列表
- */
- @PreAuthorize("@ss.hasPermi('customer:manage:list')")
- @GetMapping("/list")
- public TableDataInfo list(CustomerManage customerManage)
- {
- if(customerManage!=null &&customerManage.getStationId()!=null){
- SysDept dept =new SysDept();
- dept.setDeptId(customerManage.getStationId());
- List<String> list = deptService.selectDeptId(dept);
- customerManage.setStationIdList(list);
- customerManage.setStationId(null);
- }
- startPage();
- List<CustomerManage> list = customerManageService.selectCustomerManageList(customerManage);
- return getDataTable(list);
- }
- /**
- * 导出客户管理列表
- */
- @PreAuthorize("@ss.hasPermi('customer:manage:export')")
- @Log(title = "客户管理", businessType = BusinessType.EXPORT)
- @GetMapping("/export")
- public AjaxResult export(CustomerManage customerManage)
- {
- if(customerManage!=null &&customerManage.getStationId()!=null){
- SysDept dept =new SysDept();
- dept.setDeptId(customerManage.getStationId());
- List<String> list = deptService.selectDeptId(dept);
- customerManage.setStationIdList(list);
- customerManage.setStationId(null);
- }
- List<CustomerManage> list = customerManageService.selectCustomerManageList(customerManage);
- ExcelUtil<CustomerManage> util = new ExcelUtil<CustomerManage>(CustomerManage.class);
- return util.exportExcel(list, "manage");
- }
- /**
- * 获取客户管理详细信息
- */
- @PreAuthorize("@ss.hasPermi('customer:manage:query')")
- @GetMapping(value = "/{id}")
- public AjaxResult getInfo(@PathVariable("id") Long id)
- {
- return AjaxResult.success(customerManageService.selectCustomerManageById(id));
- }
- /**
- * 新增客户管理
- */
- @PreAuthorize("@ss.hasPermi('customer:manage:add')")
- @Log(title = "客户管理", businessType = BusinessType.INSERT)
- @PostMapping
- public AjaxResult add(@RequestBody CustomerManage customerManage)
- {
- return toAjax(customerManageService.insertCustomerManage(customerManage));
- }
- /**
- * 修改客户管理
- */
- @PreAuthorize("@ss.hasPermi('customer:manage:edit')")
- @Log(title = "客户管理", businessType = BusinessType.UPDATE)
- @PutMapping
- public AjaxResult edit(@RequestBody CustomerManage customerManage)
- {
- return toAjax(customerManageService.updateCustomerManage(customerManage));
- }
- /**
- * 删除客户管理
- */
- @PreAuthorize("@ss.hasPermi('customer:manage:remove')")
- @Log(title = "客户管理", businessType = BusinessType.DELETE)
- @DeleteMapping("/{ids}")
- public AjaxResult remove(@PathVariable Long[] ids)
- {
- return toAjax(customerManageService.deleteCustomerManageByIds(ids));
- }
- }
|