feat: SQL
This commit is contained in:
21
db/create_users.sql
Normal file
21
db/create_users.sql
Normal file
@@ -0,0 +1,21 @@
|
||||
-- 创建系统用户表
|
||||
CREATE TABLE IF NOT EXISTS `sys_users` (
|
||||
`id` INT NOT NULL AUTO_INCREMENT COMMENT '用户ID',
|
||||
`username` VARCHAR(50) NOT NULL COMMENT '用户名',
|
||||
`password_hash` VARCHAR(255) NOT NULL COMMENT '密码哈希值',
|
||||
`salt` VARCHAR(32) NOT NULL COMMENT '盐值',
|
||||
`user_role` TINYINT NOT NULL DEFAULT 0 COMMENT '用户角色:0=普通用户,1=管理员',
|
||||
`status` TINYINT NOT NULL DEFAULT 1 COMMENT '状态:0=禁用,1=启用',
|
||||
`create_time` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||||
`update_time` DATETIME DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
|
||||
`last_login_time` DATETIME DEFAULT NULL COMMENT '最后登录时间',
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `uk_username` (`username`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='系统用户表';
|
||||
|
||||
-- 插入默认管理员账户
|
||||
-- 用户名: admin
|
||||
-- 密码: admin123
|
||||
INSERT INTO `sys_users` (`username`, `password_hash`, `salt`, `user_role`, `status`, `create_time`)
|
||||
VALUES
|
||||
('admin', 'n5Z+2zK4E0X6tQhV8K7L9n3P2Z5T6s8=', 'Vb6D9gF3H5jK8mN0pQ2R5tU8wX1z=', 1, 1, NOW());
|
||||
@@ -65,16 +65,16 @@
|
||||
<Reference Include="MySql.Data, Version=9.5.0.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\MySql.Data.9.5.0\lib\net462\MySql.Data.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="NModbus4">
|
||||
<Reference Include="NModbus4, Version=2.1.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\NModbus4.2.1.0\lib\net40\NModbus4.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="PresentationCore" />
|
||||
<Reference Include="PresentationFramework" />
|
||||
<Reference Include="SunnyUI">
|
||||
<HintPath>..\packages\SunnyUI.3.8.9\lib\net472\SunnyUI.dll</HintPath>
|
||||
<Reference Include="SunnyUI, Version=3.9.1.0, Culture=neutral, PublicKeyToken=3f4ebed4237db5e1, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\SunnyUI.3.9.1\lib\net472\SunnyUI.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="SunnyUI.Common">
|
||||
<HintPath>..\packages\SunnyUI.Common.3.8.9\lib\net472\SunnyUI.Common.dll</HintPath>
|
||||
<Reference Include="SunnyUI.Common, Version=3.9.1.0, Culture=neutral, PublicKeyToken=3f4ebed4237db5e1, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\SunnyUI.Common.3.9.1\lib\net472\SunnyUI.Common.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Buffers, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
@@ -85,6 +85,7 @@
|
||||
<HintPath>..\packages\System.Configuration.ConfigurationManager.8.0.0\lib\net462\System.Configuration.ConfigurationManager.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Design" />
|
||||
<Reference Include="System.IO.Pipelines, Version=5.0.0.2, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.IO.Pipelines.5.0.2\lib\net461\System.IO.Pipelines.dll</HintPath>
|
||||
</Reference>
|
||||
@@ -104,6 +105,7 @@
|
||||
<HintPath>..\packages\System.Threading.Tasks.Extensions.4.5.4\lib\net461\System.Threading.Tasks.Extensions.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Transactions" />
|
||||
<Reference Include="System.Web.Extensions" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
@@ -128,13 +130,18 @@
|
||||
<Compile Include="CommonDefs.cs" />
|
||||
<Compile Include="DATA\BoolSign.cs" />
|
||||
<Compile Include="DATA\ConductividyClass.cs" />
|
||||
<Compile Include="DATA\DatabaseInitializer.cs" />
|
||||
<Compile Include="DATA\DataChange.cs" />
|
||||
<Compile Include="DATA\FormManager.cs" />
|
||||
<Compile Include="DATA\Function.cs" />
|
||||
<Compile Include="DATA\keyboard.cs" />
|
||||
<Compile Include="DATA\LoginData.cs" />
|
||||
<Compile Include="DATA\LoginDebugHelper.cs" />
|
||||
<Compile Include="DATA\ModbusResourceManager.cs" />
|
||||
<Compile Include="DATA\PLC_Data.cs" />
|
||||
<Compile Include="DATA\PasswordHelper.cs" />
|
||||
<Compile Include="DATA\User.cs" />
|
||||
<Compile Include="DATA\UserRepository.cs" />
|
||||
<Compile Include="ScanImport.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
@@ -148,6 +155,30 @@
|
||||
<DependentUpon>NormalTemperatureMode.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Program.cs" />
|
||||
<Compile Include="Forms\ChangePasswordForm.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Forms\ChangePasswordForm.Designer.cs">
|
||||
<DependentUpon>ChangePasswordForm.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Forms\LoginForm.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Forms\LoginForm.Designer.cs">
|
||||
<DependentUpon>LoginForm.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Forms\UserEditForm.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Forms\UserEditForm.Designer.cs">
|
||||
<DependentUpon>UserEditForm.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Forms\UserManagerForm.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Forms\UserManagerForm.Designer.cs">
|
||||
<DependentUpon>UserManagerForm.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="Report.cs">
|
||||
<SubType>Form</SubType>
|
||||
@@ -158,6 +189,9 @@
|
||||
<EmbeddedResource Include="Coeffiicientsetting.resx">
|
||||
<DependentUpon>Coeffiicientsetting.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Forms\LoginForm.resx">
|
||||
<DependentUpon>LoginForm.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="ScanImport.resx">
|
||||
<DependentUpon>ScanImport.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
|
||||
Reference in New Issue
Block a user