完善订单功能
This commit is contained in:
@ -1,6 +1,14 @@
|
||||
package com.ruoyi.web.controller.custom;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.ruoyi.common.core.domain.entity.SysUser;
|
||||
import com.ruoyi.system.domain.SysPost;
|
||||
import com.ruoyi.system.domain.SysUserPost;
|
||||
import com.ruoyi.system.domain.custom.UserPostOption;
|
||||
import com.ruoyi.system.service.ISysPostService;
|
||||
import com.ruoyi.system.service.ISysUserService;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
@ -28,31 +36,36 @@ import com.ruoyi.common.core.page.TableDataInfo;
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/custom/order")
|
||||
public class SysOrderController extends BaseController
|
||||
{
|
||||
public class SysOrderController extends BaseController {
|
||||
@Autowired
|
||||
private ISysOrderService sysOrderService;
|
||||
|
||||
@Autowired
|
||||
private ISysPostService postService;
|
||||
|
||||
@Autowired
|
||||
private ISysUserService userService;
|
||||
|
||||
|
||||
/**
|
||||
* 查询销售订单列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('custom:order:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(SysOrder sysOrder)
|
||||
{
|
||||
public TableDataInfo list(SysOrder sysOrder) {
|
||||
startPage();
|
||||
List<SysOrder> list = sysOrderService.selectSysOrderList(sysOrder);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 导出销售订单列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('custom:order:export')")
|
||||
@Log(title = "销售订单", businessType = BusinessType.EXPORT)
|
||||
@GetMapping("/export")
|
||||
public AjaxResult export(SysOrder sysOrder)
|
||||
{
|
||||
public AjaxResult export(SysOrder sysOrder) {
|
||||
List<SysOrder> list = sysOrderService.selectSysOrderList(sysOrder);
|
||||
ExcelUtil<SysOrder> util = new ExcelUtil<SysOrder>(SysOrder.class);
|
||||
return util.exportExcel(list, "order");
|
||||
@ -63,8 +76,7 @@ public class SysOrderController extends BaseController
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('custom:order:query')")
|
||||
@GetMapping(value = "/{orderId}")
|
||||
public AjaxResult getInfo(@PathVariable("orderId") Long orderId)
|
||||
{
|
||||
public AjaxResult getInfo(@PathVariable("orderId") Long orderId) {
|
||||
return AjaxResult.success(sysOrderService.selectSysOrderById(orderId));
|
||||
}
|
||||
|
||||
@ -74,8 +86,7 @@ public class SysOrderController extends BaseController
|
||||
@PreAuthorize("@ss.hasPermi('custom:order:add')")
|
||||
@Log(title = "销售订单", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody SysOrder sysOrder)
|
||||
{
|
||||
public AjaxResult add(@RequestBody SysOrder sysOrder) {
|
||||
return toAjax(sysOrderService.insertSysOrder(sysOrder));
|
||||
}
|
||||
|
||||
@ -85,8 +96,7 @@ public class SysOrderController extends BaseController
|
||||
@PreAuthorize("@ss.hasPermi('custom:order:edit')")
|
||||
@Log(title = "销售订单", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody SysOrder sysOrder)
|
||||
{
|
||||
public AjaxResult edit(@RequestBody SysOrder sysOrder) {
|
||||
return toAjax(sysOrderService.updateSysOrder(sysOrder));
|
||||
}
|
||||
|
||||
@ -96,8 +106,29 @@ public class SysOrderController extends BaseController
|
||||
@PreAuthorize("@ss.hasPermi('custom:order:remove')")
|
||||
@Log(title = "销售订单", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{orderIds}")
|
||||
public AjaxResult remove(@PathVariable Long[] orderIds)
|
||||
{
|
||||
public AjaxResult remove(@PathVariable Long[] orderIds) {
|
||||
return toAjax(sysOrderService.deleteSysOrderByIds(orderIds));
|
||||
}
|
||||
|
||||
@GetMapping("/getOptions")
|
||||
public AjaxResult getOptions() {
|
||||
AjaxResult ajax = AjaxResult.success();
|
||||
List<SysUserPost> userPosts = postService.selectUserPostAll();
|
||||
|
||||
List<UserPostOption> userPostOptions = new ArrayList<>();
|
||||
|
||||
for (SysUserPost userPost : userPosts) {
|
||||
SysPost post = postService.selectPostById(userPost.getPostId());
|
||||
SysUser user = userService.selectUserById(userPost.getUserId());
|
||||
UserPostOption userPostOption = new UserPostOption();
|
||||
userPostOption.setPostCode(post.getPostCode());
|
||||
userPostOption.setUserId(userPost.getUserId());
|
||||
userPostOption.setUserName(user.getNickName());
|
||||
userPostOptions.add(userPostOption);
|
||||
}
|
||||
|
||||
ajax.put(AjaxResult.DATA_TAG, userPostOptions);
|
||||
return ajax;
|
||||
}
|
||||
|
||||
}
|
@ -1,57 +1,60 @@
|
||||
# 数据源配置
|
||||
spring:
|
||||
datasource:
|
||||
type: com.alibaba.druid.pool.DruidDataSource
|
||||
driverClassName: com.mysql.cj.jdbc.Driver
|
||||
druid:
|
||||
# 主库数据源
|
||||
master:
|
||||
url: jdbc:mysql://localhost:3306/ry-vue?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
|
||||
username: root
|
||||
password: wonderdb
|
||||
# 从库数据源
|
||||
slave:
|
||||
# 从数据源开关/默认关闭
|
||||
enabled: false
|
||||
url:
|
||||
username:
|
||||
password:
|
||||
# 初始连接数
|
||||
initialSize: 5
|
||||
# 最小连接池数量
|
||||
minIdle: 10
|
||||
# 最大连接池数量
|
||||
maxActive: 20
|
||||
# 配置获取连接等待超时的时间
|
||||
maxWait: 60000
|
||||
# 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
|
||||
timeBetweenEvictionRunsMillis: 60000
|
||||
# 配置一个连接在池中最小生存的时间,单位是毫秒
|
||||
minEvictableIdleTimeMillis: 300000
|
||||
# 配置一个连接在池中最大生存的时间,单位是毫秒
|
||||
maxEvictableIdleTimeMillis: 900000
|
||||
# 配置检测连接是否有效
|
||||
validationQuery: SELECT 1 FROM DUAL
|
||||
testWhileIdle: true
|
||||
testOnBorrow: false
|
||||
testOnReturn: false
|
||||
webStatFilter:
|
||||
enabled: true
|
||||
statViewServlet:
|
||||
enabled: true
|
||||
# 设置白名单,不填则允许所有访问
|
||||
allow:
|
||||
url-pattern: /druid/*
|
||||
# 控制台管理用户名和密码
|
||||
login-username:
|
||||
login-password:
|
||||
filter:
|
||||
stat:
|
||||
enabled: true
|
||||
# 慢SQL记录
|
||||
log-slow-sql: true
|
||||
slow-sql-millis: 1000
|
||||
merge-sql: true
|
||||
wall:
|
||||
config:
|
||||
multi-statement-allow: true
|
||||
datasource:
|
||||
type: com.alibaba.druid.pool.DruidDataSource
|
||||
driverClassName: com.mysql.cj.jdbc.Driver
|
||||
druid:
|
||||
# 主库数据源
|
||||
master:
|
||||
# url: jdbc:mysql://localhost:3306/ry-vue?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
|
||||
# password: wonderdb
|
||||
|
||||
url: jdbc:mysql://47.97.194.44:3306/long_shop?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
|
||||
password: 9gPUnV$#2s/j(7_(
|
||||
username: root
|
||||
# 从库数据源
|
||||
slave:
|
||||
# 从数据源开关/默认关闭
|
||||
enabled: false
|
||||
url:
|
||||
username:
|
||||
password:
|
||||
# 初始连接数
|
||||
initialSize: 5
|
||||
# 最小连接池数量
|
||||
minIdle: 10
|
||||
# 最大连接池数量
|
||||
maxActive: 20
|
||||
# 配置获取连接等待超时的时间
|
||||
maxWait: 60000
|
||||
# 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
|
||||
timeBetweenEvictionRunsMillis: 60000
|
||||
# 配置一个连接在池中最小生存的时间,单位是毫秒
|
||||
minEvictableIdleTimeMillis: 300000
|
||||
# 配置一个连接在池中最大生存的时间,单位是毫秒
|
||||
maxEvictableIdleTimeMillis: 900000
|
||||
# 配置检测连接是否有效
|
||||
validationQuery: SELECT 1 FROM DUAL
|
||||
testWhileIdle: true
|
||||
testOnBorrow: false
|
||||
testOnReturn: false
|
||||
webStatFilter:
|
||||
enabled: true
|
||||
statViewServlet:
|
||||
enabled: true
|
||||
# 设置白名单,不填则允许所有访问
|
||||
allow:
|
||||
url-pattern: /druid/*
|
||||
# 控制台管理用户名和密码
|
||||
login-username:
|
||||
login-password:
|
||||
filter:
|
||||
stat:
|
||||
enabled: true
|
||||
# 慢SQL记录
|
||||
log-slow-sql: true
|
||||
slow-sql-millis: 1000
|
||||
merge-sql: true
|
||||
wall:
|
||||
config:
|
||||
multi-statement-allow: true
|
Reference in New Issue
Block a user