123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108 |
- package com.yijia.label.controller;
- import java.util.List;
- import com.yijia.common.core.domain.model.LoginUser;
- import com.yijia.common.utils.SecurityUtils;
- import com.yijia.system.service.ISysDeptService;
- 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.label.domain.CustomerLabel;
- import com.yijia.label.service.ICustomerLabelService;
- import com.yijia.common.utils.poi.ExcelUtil;
- import com.yijia.common.core.page.TableDataInfo;
- /**
- * 用户标签Controller
- *
- * @author yijia
- * @date 2021-06-15
- */
- @RestController
- @RequestMapping("/label/label")
- public class CustomerLabelController extends BaseController
- {
- @Autowired
- private ICustomerLabelService customerLabelService;
- @Autowired
- private ISysDeptService deptService;
- /**
- * 查询用户标签列表
- */
- @GetMapping("/list")
- public TableDataInfo list(CustomerLabel customerLabel)
- {
- startPage();
- List<CustomerLabel> list = customerLabelService.selectCustomerLabelList(customerLabel);
- return getDataTable(list);
- }
- /**
- * 导出用户标签列表
- */
- @Log(title = "用户标签", businessType = BusinessType.EXPORT)
- @GetMapping("/export")
- public AjaxResult export(CustomerLabel customerLabel)
- {
- List<CustomerLabel> list = customerLabelService.selectCustomerLabelList(customerLabel);
- ExcelUtil<CustomerLabel> util = new ExcelUtil<CustomerLabel>(CustomerLabel.class);
- return util.exportExcel(list, "label");
- }
- /**
- * 获取用户标签详细信息
- */
- @GetMapping(value = "/{id}")
- public AjaxResult getInfo(@PathVariable("id") Integer id)
- {
- return AjaxResult.success(customerLabelService.selectCustomerLabelById(id));
- }
- /**
- * 新增用户标签
- */
- @Log(title = "用户标签", businessType = BusinessType.INSERT)
- @PostMapping
- public AjaxResult add(@RequestBody CustomerLabel customerLabel)
- {
- LoginUser currentUser = SecurityUtils.getLoginUser();
- customerLabel.setCreateBy(currentUser.getUser().getUserId()+"");
- customerLabel.setDelFlag("0");
- return toAjax(customerLabelService.insertCustomerLabel(customerLabel));
- }
- /**
- * 修改用户标签
- */
- @Log(title = "用户标签", businessType = BusinessType.UPDATE)
- @PutMapping
- public AjaxResult edit(@RequestBody CustomerLabel customerLabel)
- {
- LoginUser currentUser = SecurityUtils.getLoginUser();
- customerLabel.setUpdateBy(currentUser.getUser().getUserId()+"");
- return toAjax(customerLabelService.updateCustomerLabel(customerLabel));
- }
- /**
- * 删除用户标签
- */
- @Log(title = "用户标签", businessType = BusinessType.DELETE)
- @DeleteMapping("/{ids}")
- public AjaxResult remove(@PathVariable Integer[] ids)
- {
- return toAjax(customerLabelService.deleteCustomerLabelByIds(ids));
- }
- }
|