完成工程管理模块前端页面与SQL脚本开发

This commit is contained in:
zuqijia
2026-06-12 14:21:54 +08:00
parent 41720e624c
commit 81d3c03f09
72 changed files with 9926 additions and 319 deletions

View File

@@ -1,175 +0,0 @@
package com.ruoyi.web.controller.tool;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.utils.StringUtils;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.tags.Tag;
/**
* swagger 用户测试方法
*
* @author ruoyi
*/
@Tag(name = "用户信息管理")
@RestController
@RequestMapping("/test/user")
public class TestController extends BaseController
{
private final static Map<Integer, UserEntity> users = new LinkedHashMap<Integer, UserEntity>();
{
users.put(1, new UserEntity(1, "admin", "admin123", "15888888888"));
users.put(2, new UserEntity(2, "ry", "admin123", "15666666666"));
}
@Operation(summary = "获取用户列表")
@GetMapping("/list")
public R<List<UserEntity>> userList()
{
List<UserEntity> userList = new ArrayList<UserEntity>(users.values());
return R.ok(userList);
}
@Operation(summary = "获取用户详细")
@GetMapping("/{userId}")
public R<UserEntity> getUser(@PathVariable(name = "userId")
Integer userId)
{
if (!users.isEmpty() && users.containsKey(userId))
{
return R.ok(users.get(userId));
}
else
{
return R.fail("用户不存在");
}
}
@Operation(summary = "新增用户")
@PostMapping("/save")
public R<String> save(UserEntity user)
{
if (StringUtils.isNull(user) || StringUtils.isNull(user.getUserId()))
{
return R.fail("用户ID不能为空");
}
users.put(user.getUserId(), user);
return R.ok();
}
@Operation(summary = "更新用户")
@PutMapping("/update")
public R<String> update(@RequestBody
UserEntity user)
{
if (StringUtils.isNull(user) || StringUtils.isNull(user.getUserId()))
{
return R.fail("用户ID不能为空");
}
if (users.isEmpty() || !users.containsKey(user.getUserId()))
{
return R.fail("用户不存在");
}
users.remove(user.getUserId());
users.put(user.getUserId(), user);
return R.ok();
}
@Operation(summary = "删除用户信息")
@DeleteMapping("/{userId}")
public R<String> delete(@PathVariable(name = "userId")
Integer userId)
{
if (!users.isEmpty() && users.containsKey(userId))
{
users.remove(userId);
return R.ok();
}
else
{
return R.fail("用户不存在");
}
}
}
@Schema(description = "用户实体")
class UserEntity
{
@Schema(title = "用户ID")
private Integer userId;
@Schema(title = "用户名称")
private String username;
@Schema(title = "用户密码")
private String password;
@Schema(title = "用户手机")
private String mobile;
public UserEntity()
{
}
public UserEntity(Integer userId, String username, String password, String mobile)
{
this.userId = userId;
this.username = username;
this.password = password;
this.mobile = mobile;
}
public Integer getUserId()
{
return userId;
}
public void setUserId(Integer userId)
{
this.userId = userId;
}
public String getUsername()
{
return username;
}
public void setUsername(String username)
{
this.username = username;
}
public String getPassword()
{
return password;
}
public void setPassword(String password)
{
this.password = password;
}
public String getMobile()
{
return mobile;
}
public void setMobile(String mobile)
{
this.mobile = mobile;
}
}

View File

@@ -6,9 +6,9 @@ spring:
druid:
# 主库数据源
master:
url: jdbc:mysql://localhost:3306/ry-vue?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
url: jdbc:mysql://localhost:3306/engineering?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&serverTimezone=GMT%2B8&allowPublicKeyRetrieval=true
username: root
password: password
password: 147123369A
# 从库数据源
slave:
# 从数据源开关/默认关闭

View File

@@ -0,0 +1,18 @@
spring:
datasource:
type: com.alibaba.druid.pool.DruidDataSource
driverClassName: org.h2.Driver
url: jdbc:h2:mem:ry-vue;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE
username: sa
password:
h2:
console:
enabled: true
path: /h2-console
sql:
init:
mode: always
schema-locations: classpath*:schema/*.sql
pagehelper:
helperDialect: h2

View File

@@ -98,8 +98,8 @@ token:
header: Authorization
# 令牌密钥
secret: abcdefghijklmnopqrstuvwxyz
# 令牌有效期默认30分钟
expireTime: 30
# 令牌有效期默认3600秒
expireTime: 3600
# MyBatis配置
mybatis:

View File

@@ -0,0 +1,359 @@
CREATE TABLE IF NOT EXISTS engineering_supplier (
supplier_id BIGINT AUTO_INCREMENT PRIMARY KEY,
supplier_code VARCHAR(50) NOT NULL UNIQUE,
supplier_name VARCHAR(200) NOT NULL,
short_name VARCHAR(100),
contact_person VARCHAR(50),
contact_phone VARCHAR(20),
email VARCHAR(100),
address VARCHAR(500),
business_scope TEXT,
qualification VARCHAR(200),
register_capital DECIMAL(18,4),
establish_date DATE,
status VARCHAR(20) DEFAULT 'normal',
cooperation_status VARCHAR(20) DEFAULT 'cooperating',
total_contract_amount DECIMAL(18,4) DEFAULT 0,
total_payment_amount DECIMAL(18,4) DEFAULT 0,
remark TEXT,
create_by VARCHAR(64) DEFAULT '',
create_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
update_by VARCHAR(64) DEFAULT '',
update_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);
CREATE TABLE IF NOT EXISTS engineering_supplier_account (
account_id BIGINT AUTO_INCREMENT PRIMARY KEY,
supplier_id BIGINT NOT NULL,
bank_name VARCHAR(100),
account_no VARCHAR(50),
account_name VARCHAR(100),
currency VARCHAR(10) DEFAULT 'CNY',
is_default VARCHAR(1) DEFAULT '0',
remark TEXT,
create_by VARCHAR(64) DEFAULT '',
create_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
update_by VARCHAR(64) DEFAULT '',
update_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
CONSTRAINT fk_supplier_account FOREIGN KEY (supplier_id) REFERENCES engineering_supplier(supplier_id) ON DELETE CASCADE
);
CREATE TABLE IF NOT EXISTS engineering_supplier_payment_record (
record_id BIGINT AUTO_INCREMENT PRIMARY KEY,
supplier_id BIGINT NOT NULL,
payment_id BIGINT,
amount DECIMAL(18,4) NOT NULL,
payment_date DATE,
contract_id BIGINT,
payment_type VARCHAR(20),
remark TEXT,
create_by VARCHAR(64) DEFAULT '',
create_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
CONSTRAINT fk_payment_record_supplier FOREIGN KEY (supplier_id) REFERENCES engineering_supplier(supplier_id) ON DELETE CASCADE
);
CREATE TABLE IF NOT EXISTS engineering_contract (
contract_id BIGINT AUTO_INCREMENT PRIMARY KEY,
contract_no VARCHAR(50) NOT NULL UNIQUE,
contract_name VARCHAR(200) NOT NULL,
contract_type VARCHAR(50),
supplier_id BIGINT NOT NULL,
amount DECIMAL(18,4) NOT NULL,
paid_amount DECIMAL(18,4) DEFAULT 0,
sign_date DATE,
start_date DATE,
end_date DATE,
status VARCHAR(20) DEFAULT 'pending',
contract_file VARCHAR(500),
remark TEXT,
create_by VARCHAR(64) DEFAULT '',
create_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
update_by VARCHAR(64) DEFAULT '',
update_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
CONSTRAINT fk_contract_supplier FOREIGN KEY (supplier_id) REFERENCES engineering_supplier(supplier_id)
);
CREATE TABLE IF NOT EXISTS engineering_contract_change (
change_id BIGINT AUTO_INCREMENT PRIMARY KEY,
contract_id BIGINT NOT NULL,
change_type VARCHAR(50),
contract_name VARCHAR(200),
contract_type VARCHAR(50),
amount DECIMAL(18,4),
sign_date DATE,
start_date DATE,
end_date DATE,
reason TEXT,
status VARCHAR(20) DEFAULT 'pending',
approval_remark TEXT,
create_by VARCHAR(64) DEFAULT '',
create_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
update_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
CONSTRAINT fk_contract_change FOREIGN KEY (contract_id) REFERENCES engineering_contract(contract_id) ON DELETE CASCADE
);
CREATE TABLE IF NOT EXISTS engineering_construction (
construction_id BIGINT AUTO_INCREMENT PRIMARY KEY,
contract_id BIGINT NOT NULL,
parent_id BIGINT DEFAULT 0,
node_name VARCHAR(200) NOT NULL,
node_code VARCHAR(50),
node_level INT DEFAULT 1,
progress DECIMAL(5,2) DEFAULT 0,
status VARCHAR(20) DEFAULT 'in_progress',
plan_start_date DATE,
plan_end_date DATE,
actual_start_date DATE,
actual_end_date DATE,
acceptance_status VARCHAR(20) DEFAULT 'not_submitted',
acceptance_result VARCHAR(20),
acceptance_date DATE,
acceptance_remark TEXT,
sort_order INT DEFAULT 0,
remark TEXT,
create_by VARCHAR(64) DEFAULT '',
create_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
update_by VARCHAR(64) DEFAULT '',
update_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
CONSTRAINT fk_construction_contract FOREIGN KEY (contract_id) REFERENCES engineering_contract(contract_id) ON DELETE CASCADE,
CONSTRAINT fk_construction_parent FOREIGN KEY (parent_id) REFERENCES engineering_construction(construction_id)
);
CREATE TABLE IF NOT EXISTS engineering_material (
material_id BIGINT AUTO_INCREMENT PRIMARY KEY,
material_code VARCHAR(50) NOT NULL UNIQUE,
material_name VARCHAR(200) NOT NULL,
specification VARCHAR(200),
unit VARCHAR(20),
stock DECIMAL(18,4) DEFAULT 0,
min_stock DECIMAL(18,4) DEFAULT 0,
category VARCHAR(50),
location VARCHAR(200),
status VARCHAR(20) DEFAULT 'normal',
remark TEXT,
create_by VARCHAR(64) DEFAULT '',
create_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
update_by VARCHAR(64) DEFAULT '',
update_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);
CREATE TABLE IF NOT EXISTS engineering_material_in (
in_id BIGINT AUTO_INCREMENT PRIMARY KEY,
material_id BIGINT NOT NULL,
quantity DECIMAL(18,4) NOT NULL,
price DECIMAL(18,4),
total_amount DECIMAL(18,4),
in_date DATE,
supplier_id BIGINT,
batch_no VARCHAR(50),
expiry_date DATE,
location VARCHAR(200),
status VARCHAR(20) DEFAULT 'pending',
remark TEXT,
create_by VARCHAR(64) DEFAULT '',
create_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
update_by VARCHAR(64) DEFAULT '',
update_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
CONSTRAINT fk_material_in_material FOREIGN KEY (material_id) REFERENCES engineering_material(material_id),
CONSTRAINT fk_material_in_supplier FOREIGN KEY (supplier_id) REFERENCES engineering_supplier(supplier_id)
);
CREATE TABLE IF NOT EXISTS engineering_material_out (
out_id BIGINT AUTO_INCREMENT PRIMARY KEY,
material_id BIGINT NOT NULL,
quantity DECIMAL(18,4) NOT NULL,
price DECIMAL(18,4),
total_amount DECIMAL(18,4),
out_date DATE,
contract_id BIGINT,
construction_id BIGINT,
use_purpose VARCHAR(200),
status VARCHAR(20) DEFAULT 'pending',
remark TEXT,
create_by VARCHAR(64) DEFAULT '',
create_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
update_by VARCHAR(64) DEFAULT '',
update_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
CONSTRAINT fk_material_out_material FOREIGN KEY (material_id) REFERENCES engineering_material(material_id),
CONSTRAINT fk_material_out_contract FOREIGN KEY (contract_id) REFERENCES engineering_contract(contract_id),
CONSTRAINT fk_material_out_construction FOREIGN KEY (construction_id) REFERENCES engineering_construction(construction_id)
);
CREATE TABLE IF NOT EXISTS engineering_payment (
payment_id BIGINT AUTO_INCREMENT PRIMARY KEY,
contract_id BIGINT NOT NULL,
supplier_id BIGINT NOT NULL,
amount DECIMAL(18,4) NOT NULL,
payment_date DATE,
payment_type VARCHAR(20),
payment_method VARCHAR(20),
bank_account VARCHAR(100),
status VARCHAR(20) DEFAULT 'pending',
remark TEXT,
create_by VARCHAR(64) DEFAULT '',
create_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
update_by VARCHAR(64) DEFAULT '',
update_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
CONSTRAINT fk_payment_contract FOREIGN KEY (contract_id) REFERENCES engineering_contract(contract_id),
CONSTRAINT fk_payment_supplier FOREIGN KEY (supplier_id) REFERENCES engineering_supplier(supplier_id)
);
-- ================================================
-- 工程管理模块菜单初始化数据
-- ================================================
-- 工程管理一级菜单
INSERT INTO sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
SELECT '工程管理', 0, 5, 'engineering', NULL, 1, 0, 'M', '0', '0', '', 'build', 'admin', CURRENT_TIMESTAMP, '', NULL, '工程管理目录'
WHERE NOT EXISTS (SELECT 1 FROM sys_menu WHERE menu_name = '工程管理');
-- 获取工程管理菜单ID
SET @engineeringMenuId = (SELECT menu_id FROM sys_menu WHERE menu_name = '工程管理');
-- 供应商管理二级菜单
INSERT INTO sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
SELECT '供应商管理', @engineeringMenuId, 1, 'supplier', 'engineering/supplier/index', 1, 0, 'C', '0', '0', 'system:engineering:supplier:list', 'people', 'admin', CURRENT_TIMESTAMP, '', NULL, '供应商管理菜单'
WHERE NOT EXISTS (SELECT 1 FROM sys_menu WHERE menu_name = '供应商管理' AND parent_id = @engineeringMenuId);
-- 供应商管理按钮
SET @supplierMenuId = (SELECT menu_id FROM sys_menu WHERE menu_name = '供应商管理' AND parent_id = @engineeringMenuId);
INSERT INTO sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
SELECT '供应商查询', @supplierMenuId, 1, '#', '', 1, 0, 'F', '0', '0', 'system:engineering:supplier:query', '#', 'admin', CURRENT_TIMESTAMP, '', NULL, ''
WHERE NOT EXISTS (SELECT 1 FROM sys_menu WHERE menu_name = '供应商查询' AND parent_id = @supplierMenuId);
INSERT INTO sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
SELECT '供应商新增', @supplierMenuId, 2, '#', '', 1, 0, 'F', '0', '0', 'system:engineering:supplier:add', '#', 'admin', CURRENT_TIMESTAMP, '', NULL, ''
WHERE NOT EXISTS (SELECT 1 FROM sys_menu WHERE menu_name = '供应商新增' AND parent_id = @supplierMenuId);
INSERT INTO sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
SELECT '供应商修改', @supplierMenuId, 3, '#', '', 1, 0, 'F', '0', '0', 'system:engineering:supplier:edit', '#', 'admin', CURRENT_TIMESTAMP, '', NULL, ''
WHERE NOT EXISTS (SELECT 1 FROM sys_menu WHERE menu_name = '供应商修改' AND parent_id = @supplierMenuId);
INSERT INTO sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
SELECT '供应商删除', @supplierMenuId, 4, '#', '', 1, 0, 'F', '0', '0', 'system:engineering:supplier:remove', '#', 'admin', CURRENT_TIMESTAMP, '', NULL, ''
WHERE NOT EXISTS (SELECT 1 FROM sys_menu WHERE menu_name = '供应商删除' AND parent_id = @supplierMenuId);
INSERT INTO sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
SELECT '供应商导出', @supplierMenuId, 5, '#', '', 1, 0, 'F', '0', '0', 'system:engineering:supplier:export', '#', 'admin', CURRENT_TIMESTAMP, '', NULL, ''
WHERE NOT EXISTS (SELECT 1 FROM sys_menu WHERE menu_name = '供应商导出' AND parent_id = @supplierMenuId);
-- 合同管理二级菜单
INSERT INTO sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
SELECT '合同管理', @engineeringMenuId, 2, 'contract', 'engineering/contract/index', 1, 0, 'C', '0', '0', 'system:engineering:contract:list', 'file-text', 'admin', CURRENT_TIMESTAMP, '', NULL, '合同管理菜单'
WHERE NOT EXISTS (SELECT 1 FROM sys_menu WHERE menu_name = '合同管理' AND parent_id = @engineeringMenuId);
-- 合同管理按钮
SET @contractMenuId = (SELECT menu_id FROM sys_menu WHERE menu_name = '合同管理' AND parent_id = @engineeringMenuId);
INSERT INTO sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
SELECT '合同查询', @contractMenuId, 1, '#', '', 1, 0, 'F', '0', '0', 'system:engineering:contract:query', '#', 'admin', CURRENT_TIMESTAMP, '', NULL, ''
WHERE NOT EXISTS (SELECT 1 FROM sys_menu WHERE menu_name = '合同查询' AND parent_id = @contractMenuId);
INSERT INTO sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
SELECT '合同新增', @contractMenuId, 2, '#', '', 1, 0, 'F', '0', '0', 'system:engineering:contract:add', '#', 'admin', CURRENT_TIMESTAMP, '', NULL, ''
WHERE NOT EXISTS (SELECT 1 FROM sys_menu WHERE menu_name = '合同新增' AND parent_id = @contractMenuId);
INSERT INTO sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
SELECT '合同修改', @contractMenuId, 3, '#', '', 1, 0, 'F', '0', '0', 'system:engineering:contract:edit', '#', 'admin', CURRENT_TIMESTAMP, '', NULL, ''
WHERE NOT EXISTS (SELECT 1 FROM sys_menu WHERE menu_name = '合同修改' AND parent_id = @contractMenuId);
INSERT INTO sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
SELECT '合同删除', @contractMenuId, 4, '#', '', 1, 0, 'F', '0', '0', 'system:engineering:contract:remove', '#', 'admin', CURRENT_TIMESTAMP, '', NULL, ''
WHERE NOT EXISTS (SELECT 1 FROM sys_menu WHERE menu_name = '合同删除' AND parent_id = @contractMenuId);
INSERT INTO sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
SELECT '合同导出', @contractMenuId, 5, '#', '', 1, 0, 'F', '0', '0', 'system:engineering:contract:export', '#', 'admin', CURRENT_TIMESTAMP, '', NULL, ''
WHERE NOT EXISTS (SELECT 1 FROM sys_menu WHERE menu_name = '合同导出' AND parent_id = @contractMenuId);
-- 施工进度管理二级菜单
INSERT INTO sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
SELECT '施工进度管理', @engineeringMenuId, 3, 'construction', 'engineering/construction/index', 1, 0, 'C', '0', '0', 'system:engineering:construction:list', 'tree-table', 'admin', CURRENT_TIMESTAMP, '', NULL, '施工进度管理菜单'
WHERE NOT EXISTS (SELECT 1 FROM sys_menu WHERE menu_name = '施工进度管理' AND parent_id = @engineeringMenuId);
-- 施工进度管理按钮
SET @constructionMenuId = (SELECT menu_id FROM sys_menu WHERE menu_name = '施工进度管理' AND parent_id = @engineeringMenuId);
INSERT INTO sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
SELECT '施工进度查询', @constructionMenuId, 1, '#', '', 1, 0, 'F', '0', '0', 'system:engineering:construction:query', '#', 'admin', CURRENT_TIMESTAMP, '', NULL, ''
WHERE NOT EXISTS (SELECT 1 FROM sys_menu WHERE menu_name = '施工进度查询' AND parent_id = @constructionMenuId);
INSERT INTO sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
SELECT '施工进度新增', @constructionMenuId, 2, '#', '', 1, 0, 'F', '0', '0', 'system:engineering:construction:add', '#', 'admin', CURRENT_TIMESTAMP, '', NULL, ''
WHERE NOT EXISTS (SELECT 1 FROM sys_menu WHERE menu_name = '施工进度新增' AND parent_id = @constructionMenuId);
INSERT INTO sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
SELECT '施工进度修改', @constructionMenuId, 3, '#', '', 1, 0, 'F', '0', '0', 'system:engineering:construction:edit', '#', 'admin', CURRENT_TIMESTAMP, '', NULL, ''
WHERE NOT EXISTS (SELECT 1 FROM sys_menu WHERE menu_name = '施工进度修改' AND parent_id = @constructionMenuId);
INSERT INTO sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
SELECT '施工进度删除', @constructionMenuId, 4, '#', '', 1, 0, 'F', '0', '0', 'system:engineering:construction:remove', '#', 'admin', CURRENT_TIMESTAMP, '', NULL, ''
WHERE NOT EXISTS (SELECT 1 FROM sys_menu WHERE menu_name = '施工进度删除' AND parent_id = @constructionMenuId);
-- 物料管理二级菜单
INSERT INTO sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
SELECT '物料管理', @engineeringMenuId, 4, 'material', 'engineering/material/index', 1, 0, 'C', '0', '0', 'system:engineering:material:list', 'shopping', 'admin', CURRENT_TIMESTAMP, '', NULL, '物料管理菜单'
WHERE NOT EXISTS (SELECT 1 FROM sys_menu WHERE menu_name = '物料管理' AND parent_id = @engineeringMenuId);
-- 物料管理按钮
SET @materialMenuId = (SELECT menu_id FROM sys_menu WHERE menu_name = '物料管理' AND parent_id = @engineeringMenuId);
INSERT INTO sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
SELECT '物料查询', @materialMenuId, 1, '#', '', 1, 0, 'F', '0', '0', 'system:engineering:material:query', '#', 'admin', CURRENT_TIMESTAMP, '', NULL, ''
WHERE NOT EXISTS (SELECT 1 FROM sys_menu WHERE menu_name = '物料查询' AND parent_id = @materialMenuId);
INSERT INTO sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
SELECT '物料新增', @materialMenuId, 2, '#', '', 1, 0, 'F', '0', '0', 'system:engineering:material:add', '#', 'admin', CURRENT_TIMESTAMP, '', NULL, ''
WHERE NOT EXISTS (SELECT 1 FROM sys_menu WHERE menu_name = '物料新增' AND parent_id = @materialMenuId);
INSERT INTO sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
SELECT '物料修改', @materialMenuId, 3, '#', '', 1, 0, 'F', '0', '0', 'system:engineering:material:edit', '#', 'admin', CURRENT_TIMESTAMP, '', NULL, ''
WHERE NOT EXISTS (SELECT 1 FROM sys_menu WHERE menu_name = '物料修改' AND parent_id = @materialMenuId);
INSERT INTO sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
SELECT '物料删除', @materialMenuId, 4, '#', '', 1, 0, 'F', '0', '0', 'system:engineering:material:remove', '#', 'admin', CURRENT_TIMESTAMP, '', NULL, ''
WHERE NOT EXISTS (SELECT 1 FROM sys_menu WHERE menu_name = '物料删除' AND parent_id = @materialMenuId);
INSERT INTO sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
SELECT '物料入库', @materialMenuId, 5, '#', '', 1, 0, 'F', '0', '0', 'system:engineering:material:in:add', '#', 'admin', CURRENT_TIMESTAMP, '', NULL, ''
WHERE NOT EXISTS (SELECT 1 FROM sys_menu WHERE menu_name = '物料入库' AND parent_id = @materialMenuId);
INSERT INTO sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
SELECT '物料出库', @materialMenuId, 6, '#', '', 1, 0, 'F', '0', '0', 'system:engineering:material:out:add', '#', 'admin', CURRENT_TIMESTAMP, '', NULL, ''
WHERE NOT EXISTS (SELECT 1 FROM sys_menu WHERE menu_name = '物料出库' AND parent_id = @materialMenuId);
-- 付款管理二级菜单
INSERT INTO sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
SELECT '付款管理', @engineeringMenuId, 5, 'payment', 'engineering/payment/index', 1, 0, 'C', '0', '0', 'system:engineering:payment:list', 'money', 'admin', CURRENT_TIMESTAMP, '', NULL, '付款管理菜单'
WHERE NOT EXISTS (SELECT 1 FROM sys_menu WHERE menu_name = '付款管理' AND parent_id = @engineeringMenuId);
-- 付款管理按钮
SET @paymentMenuId = (SELECT menu_id FROM sys_menu WHERE menu_name = '付款管理' AND parent_id = @engineeringMenuId);
INSERT INTO sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
SELECT '付款查询', @paymentMenuId, 1, '#', '', 1, 0, 'F', '0', '0', 'system:engineering:payment:query', '#', 'admin', CURRENT_TIMESTAMP, '', NULL, ''
WHERE NOT EXISTS (SELECT 1 FROM sys_menu WHERE menu_name = '付款查询' AND parent_id = @paymentMenuId);
INSERT INTO sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
SELECT '付款新增', @paymentMenuId, 2, '#', '', 1, 0, 'F', '0', '0', 'system:engineering:payment:add', '#', 'admin', CURRENT_TIMESTAMP, '', NULL, ''
WHERE NOT EXISTS (SELECT 1 FROM sys_menu WHERE menu_name = '付款新增' AND parent_id = @paymentMenuId);
INSERT INTO sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
SELECT '付款修改', @paymentMenuId, 3, '#', '', 1, 0, 'F', '0', '0', 'system:engineering:payment:edit', '#', 'admin', CURRENT_TIMESTAMP, '', NULL, ''
WHERE NOT EXISTS (SELECT 1 FROM sys_menu WHERE menu_name = '付款修改' AND parent_id = @paymentMenuId);
INSERT INTO sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
SELECT '付款删除', @paymentMenuId, 4, '#', '', 1, 0, 'F', '0', '0', 'system:engineering:payment:remove', '#', 'admin', CURRENT_TIMESTAMP, '', NULL, ''
WHERE NOT EXISTS (SELECT 1 FROM sys_menu WHERE menu_name = '付款删除' AND parent_id = @paymentMenuId);
INSERT INTO sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
SELECT '付款审批', @paymentMenuId, 5, '#', '', 1, 0, 'F', '0', '0', 'system:engineering:payment:approve', '#', 'admin', CURRENT_TIMESTAMP, '', NULL, ''
WHERE NOT EXISTS (SELECT 1 FROM sys_menu WHERE menu_name = '付款审批' AND parent_id = @paymentMenuId);
-- ================================================
-- 为超级管理员角色分配工程管理菜单权限
-- ================================================
SET @adminRoleId = (SELECT role_id FROM sys_role WHERE role_key = 'admin');
INSERT INTO sys_role_menu (role_id, menu_id)
SELECT @adminRoleId, menu_id FROM sys_menu WHERE perms LIKE 'system:engineering:%'
ON DUPLICATE KEY UPDATE role_id = role_id;
INSERT INTO sys_role_menu (role_id, menu_id)
SELECT @adminRoleId, @engineeringMenuId
ON DUPLICATE KEY UPDATE role_id = role_id;