package com.ltkj.web.controller.mall;
|
|
import java.util.List;
|
import javax.servlet.http.HttpServletResponse;
|
|
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.ltkj.common.annotation.Log;
|
import com.ltkj.common.core.controller.BaseController;
|
import com.ltkj.common.core.domain.AjaxResult;
|
import com.ltkj.common.enums.BusinessType;
|
import com.ltkj.mall.domain.MallKeyword;
|
import com.ltkj.mall.service.IMallKeywordService;
|
import com.ltkj.common.utils.poi.ExcelUtil;
|
import com.ltkj.common.core.page.TableDataInfo;
|
|
/**
|
* 关键字Controller
|
*
|
* @author ltkj_赵佳豪&李格
|
* @date 2023-07-13
|
*/
|
@RestController
|
@RequestMapping("/mall/keyword")
|
public class MallKeywordController extends BaseController {
|
@Autowired
|
private IMallKeywordService mallKeywordService;
|
|
/**
|
* 查询关键字列表
|
*/
|
@PreAuthorize("@ss.hasPermi('mall:keyword:list')")
|
@GetMapping("/list")
|
public TableDataInfo list(MallKeyword mallKeyword) {
|
startPage();
|
List<MallKeyword> list = mallKeywordService.selectMallKeywordList(mallKeyword);
|
return getDataTable(list);
|
}
|
|
/**
|
* 导出关键字列表
|
*/
|
@PreAuthorize("@ss.hasPermi('mall:keyword:export')")
|
@Log(title = "关键字", businessType = BusinessType.EXPORT)
|
@PostMapping("/export")
|
public void export(HttpServletResponse response, MallKeyword mallKeyword) {
|
List<MallKeyword> list = mallKeywordService.selectMallKeywordList(mallKeyword);
|
ExcelUtil<MallKeyword> util = new ExcelUtil<MallKeyword>(MallKeyword.class);
|
util.exportExcel(response, list, "关键字数据");
|
}
|
|
/**
|
* 获取关键字详细信息
|
*/
|
@PreAuthorize("@ss.hasPermi('mall:keyword:query')")
|
@GetMapping(value = "/{id}")
|
public AjaxResult getInfo(@PathVariable("id") Long id) {
|
return success(mallKeywordService.selectMallKeywordById(id));
|
}
|
|
/**
|
* 新增关键字
|
*/
|
@PreAuthorize("@ss.hasPermi('mall:keyword:add')")
|
@Log(title = "关键字", businessType = BusinessType.INSERT)
|
@PostMapping
|
public AjaxResult add(@RequestBody MallKeyword mallKeyword) {
|
return toAjax(mallKeywordService.insertMallKeyword(mallKeyword));
|
}
|
|
/**
|
* 修改关键字
|
*/
|
@PreAuthorize("@ss.hasPermi('mall:keyword:edit')")
|
@Log(title = "关键字", businessType = BusinessType.UPDATE)
|
@PutMapping
|
public AjaxResult edit(@RequestBody MallKeyword mallKeyword) {
|
return toAjax(mallKeywordService.updateMallKeyword(mallKeyword));
|
}
|
|
/**
|
* 删除关键字
|
*/
|
@PreAuthorize("@ss.hasPermi('mall:keyword:remove')")
|
@Log(title = "关键字", businessType = BusinessType.DELETE)
|
@DeleteMapping("/{ids}")
|
public AjaxResult remove(@PathVariable Long[] ids) {
|
return toAjax(mallKeywordService.deleteMallKeywordByIds(ids));
|
}
|
}
|