yh
This commit is contained in:
@@ -0,0 +1,98 @@
|
||||
package com.ruoyi.web.controller.back;
|
||||
|
||||
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.domain.entity.Product;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.system.service.IProductService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 商品Controller
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2025-10-27
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/back/product")
|
||||
public class ProductController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private IProductService productService;
|
||||
|
||||
/**
|
||||
* 查询商品列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:product:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(Product product)
|
||||
{
|
||||
startPage();
|
||||
List<Product> list = productService.selectProductList(product);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出商品列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:product:export')")
|
||||
@Log(title = "商品", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, Product product)
|
||||
{
|
||||
List<Product> list = productService.selectProductList(product);
|
||||
ExcelUtil<Product> util = new ExcelUtil<Product>(Product.class);
|
||||
util.exportExcel(response, list, "商品数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取商品详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:product:query')")
|
||||
@GetMapping(value = "/{id}")
|
||||
public AjaxResult getInfo(@PathVariable("id") String id)
|
||||
{
|
||||
return success(productService.selectProductById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增商品
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:product:add')")
|
||||
@Log(title = "商品", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody Product product)
|
||||
{
|
||||
return toAjax(productService.insertProduct(product));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改商品
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:product:edit')")
|
||||
@Log(title = "商品", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody Product product)
|
||||
{
|
||||
return toAjax(productService.updateProduct(product));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除商品
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:product:remove')")
|
||||
@Log(title = "商品", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public AjaxResult remove(@PathVariable String[] ids)
|
||||
{
|
||||
return toAjax(productService.deleteProductByIds(ids));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
package com.ruoyi.web.controller.client;
|
||||
|
||||
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.domain.entity.Product;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.system.service.IProductService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 商品Controller
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2025-10-27
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/client/product")
|
||||
public class ClientProductController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private IProductService productService;
|
||||
|
||||
/**
|
||||
* 查询商品列表
|
||||
*/
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(Product product)
|
||||
{
|
||||
startPage();
|
||||
List<Product> list = productService.selectProductList(product);
|
||||
return getDataTableData(list);
|
||||
}
|
||||
}
|
||||
@@ -4,12 +4,10 @@ package com.ruoyi.web.controller.client;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.core.domain.entity.MusicInfo;
|
||||
import com.ruoyi.common.core.domain.entity.Notifications;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.utils.SecurityUtils;
|
||||
import com.ruoyi.system.service.IBannerInfoService;
|
||||
import com.ruoyi.system.service.ICategoryInfoService;
|
||||
import com.ruoyi.system.service.IMusicInfoService;
|
||||
import com.ruoyi.system.service.IRecommendInfoService;
|
||||
import com.ruoyi.system.service.*;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
@@ -32,6 +30,8 @@ public class IndexController extends BaseController {
|
||||
private IRecommendInfoService recommendInfoService;
|
||||
@Autowired
|
||||
private IMusicInfoService musicService;
|
||||
@Autowired
|
||||
private INotificationsService notificationsService;
|
||||
/**
|
||||
* @return com.ruoyi.common.core.domain.AjaxResult
|
||||
* 获取banner
|
||||
@@ -85,6 +85,11 @@ public class IndexController extends BaseController {
|
||||
return getDataTableData(list);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// 获取消息通知
|
||||
@GetMapping("/notice")
|
||||
public AjaxResult getNotice(){
|
||||
Long userId = SecurityUtils.getUserId();
|
||||
List<Notifications> result = notificationsService.selectNotificationsByUserId(userId);
|
||||
return AjaxResult.success(result);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,10 +16,10 @@ ruoyi:
|
||||
# 开发环境配置
|
||||
server:
|
||||
# 服务器的HTTP端口,默认为8080
|
||||
port: 8085
|
||||
port: 8080
|
||||
servlet:
|
||||
# 应用的访问路径
|
||||
context-path: /dev-api
|
||||
context-path: /
|
||||
tomcat:
|
||||
# tomcat的URI编码
|
||||
uri-encoding: UTF-8
|
||||
@@ -67,14 +67,21 @@ spring:
|
||||
enabled: true
|
||||
# redis 配置
|
||||
redis:
|
||||
# 地址
|
||||
host: 127.0.0.1
|
||||
host: 116.204.124.80
|
||||
# 端口,默认为6379
|
||||
port: 6379
|
||||
port: 16379
|
||||
# 数据库索引
|
||||
database: 0
|
||||
# 密码
|
||||
password:
|
||||
password: Lwz19520416443@
|
||||
# 地址
|
||||
# host: 127.0.0.1
|
||||
# # 端口,默认为6379
|
||||
# port: 6379
|
||||
# # 数据库索引
|
||||
# database: 0
|
||||
# # 密码
|
||||
# password:
|
||||
# 连接超时时间
|
||||
timeout: 10s
|
||||
lettuce:
|
||||
|
||||
Reference in New Issue
Block a user