更新部门管理功能代码

This commit is contained in:
user 2025-03-03 17:05:40 +08:00
parent a3400eafe3
commit aab2936255
8 changed files with 103 additions and 9 deletions

View File

@ -33,12 +33,12 @@ MySQL数据库要求如下:
请将前端有现的静态菜单 增加到菜单表格 ,然后修改前端为动态菜单方式,读取数据库的菜单配置信息,并显示
99. 请将项目前端和后端 打包生成一个运行jar包
////////////////////////////////////////////////
建表语句结构和数据:
区域信息表jhi_region 包括以下字段:详细地圵,联系人,联系电话,邮箱,联系地址,备注
这个表将包含区域编号使用短UUID格式、父区域编号、区域名称等基本信息字段通过parent_number字段建立父子关系实现区域的层级管理
每个数据表都要包括有以下字段: id, company(与jhi_company.number对应所属公司), created_by, created_date, updated_by, updated_date, version(乐观锁,默认值为0)。
用liquibase创建表结构和csv例数据
请用liquibase创建表结构和csv例数据
后端代码:
需要编写jhi_region表的后端API基本接口功能不需要DTO类请参考menu相详模块的代码方式来写。
@ -49,7 +49,26 @@ MySQL数据库要求如下:
4. 查询区域信息 GET /api/regions/{id}
5. 查询区域列表 GET /api/regions 需要有分页功能,并返回总数量。
6. 查询区域树状结构 GET /api/regions/tree
7. 查询区域树状结构 GET /api/regions/tree/{id}
前端代码:
在entity-menu下增子菜单 /master/region 地区管理 还需要增加相应的维护UI界面(包括层级管理),请编写生成相应的前端文件,风格保持一致
由于前端 是用Vue3 要增加 compatConfig: { MODE: 3 },
////////////////////////////////////////////////////
部门信息表jhi_depart表包括以下字段
部门编号number使用短UUID格式、父部门编号parent_number、部门名称, 属性, 备注, 排序 等字段通过parent_number字段建立父子关系实现部门的层级管理
每个数据表都要包括有以下字段: id, company(与jhi_company.number对应所属公司), created_by, created_date, updated_by, updated_date, version(乐观锁,默认值为0)。
请用liquibase创建表结构和csv例子数据
需要编写部门管理(jhi_depart表)的功能的后端API基本接口功能不需要DTO类
数据表都要包括有以下字段: id, company(与jhi_company.number对应所属公司), created_by, created_date, updated_by, updated_date, version(乐观锁,默认值为0),
有层次关系(number, parent_number), 还需要region字段(与jhi_region.number对应所属区域),
请按照 region模块的代码风格方式来写。
后端API基本接口功能
1. 新增部门信息 POST /api/departs
2. 修改部门信息 PUT /api/departs/{id}
3. 删除部门信息 DELETE /api/departs/{id}
4. 查询部门信息 GET /api/departs/{id}
5. 查询部门列表 GET /api/departs 需要有分页功能,并返回总数量。
6. 查询部门树状结构 GET /api/departs/tree
docker:
compose:
@ -81,4 +100,4 @@ https://gitea.vxnet.cn/admingit/jewpms.git
请修正此问题
已设置 updatable = false
但那两个字段在 UPDATE 数据时, 仍然被更新,如何修正
请执行 将已改好的代码 提交并推送, 说明内容需要加双引号.

View File

@ -11,7 +11,7 @@
The initial schema has the '00000000000001' id, so that it is over-written if we re-generate it.
-->
<changeSet id="00000000000001" author="jhipster">
<createTable tableName="jhi_user">
<createTable tableName="jhi_user" remarks="用户信息表">
<column name="id" type="bigint" autoIncrement="true" startWith="1050" remarks="主键ID">
<constraints primaryKey="true" nullable="false"/>
</column>
@ -65,13 +65,13 @@
</column>
</createTable>
<createTable tableName="jhi_authority">
<createTable tableName="jhi_authority" remarks="权限信息表">
<column name="name" type="varchar(50)">
<constraints primaryKey="true" nullable="false"/>
</column>
</createTable>
<createTable tableName="jhi_user_authority">
<createTable tableName="jhi_user_authority" remarks="用户权限关联">
<column name="user_id" type="bigint">
<constraints nullable="false"/>
</column>

View File

@ -7,7 +7,7 @@
http://www.liquibase.org/xml/ns/dbchangelog-ext http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd">
<changeSet id="20240325000001" author="system">
<createTable tableName="jhi_menu">
<createTable tableName="jhi_menu" remarks="菜单信息表">
<column name="id" type="bigint" autoIncrement="true" remarks="主键ID">
<constraints primaryKey="true" nullable="false"/>
</column>

View File

@ -7,7 +7,7 @@
http://www.liquibase.org/xml/ns/dbchangelog-ext http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd">
<changeSet id="20240325000002" author="system">
<createTable tableName="jhi_company">
<createTable tableName="jhi_company" remarks="公司信息表">
<column name="id" type="bigint" autoIncrement="true" remarks="主键ID">
<constraints primaryKey="true" nullable="false"/>
</column>

View File

@ -0,0 +1,66 @@
<?xml version="1.0" encoding="utf-8"?>
<databaseChangeLog
xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-latest.xsd
http://www.liquibase.org/xml/ns/dbchangelog-ext http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd">
<changeSet id="20240325000003-1" author="jhipster">
<createTable tableName="jhi_depart" remarks="部门信息表">
<column name="id" type="bigint" autoIncrement="true" remarks="主键ID">
<constraints primaryKey="true" nullable="false"/>
</column>
<column name="number" type="varchar(36)" remarks="部门编号">
<constraints nullable="false" unique="true" uniqueConstraintName="ux_depart_number"/>
</column>
<column name="parent_number" type="varchar(36)" remarks="父部门编号"/>
<column name="name" type="varchar(100)" remarks="部门名称">
<constraints nullable="false"/>
</column>
<column name="property" type="varchar(100)" remarks="属性"/>
<column name="remark" type="varchar(500)" remarks="备注"/>
<column name="sort_no" type="int" remarks="排序号" defaultValue="0">
<constraints nullable="false"/>
</column>
<column name="company" type="varchar(36)" remarks="所属公司编号">
<constraints nullable="false"/>
</column>
<column name="region" type="varchar(36)" remarks="所属区域编号">
<constraints nullable="false"/>
</column>
<column name="created_by" type="varchar(50)" remarks="创建人">
<constraints nullable="false"/>
</column>
<column name="created_date" type="${datetimeType}" remarks="创建时间"/>
<column name="updated_by" type="varchar(50)" remarks="更新人"/>
<column name="updated_date" type="${datetimeType}" remarks="更新时间"/>
<column name="version" type="int" remarks="版本号" defaultValue="0">
<constraints nullable="false"/>
</column>
</createTable>
</changeSet>
<changeSet id="20240325000003-2" author="jhipster">
<loadData
file="config/liquibase/data/depart.csv"
separator=";"
tableName="jhi_depart"
usePreparedStatements="true">
<column name="id" type="numeric"/>
<column name="number" type="string"/>
<column name="parent_number" type="string"/>
<column name="name" type="string"/>
<column name="property" type="string"/>
<column name="remark" type="string"/>
<column name="sort_no" type="numeric"/>
<column name="company" type="string"/>
<column name="region" type="string"/>
<column name="created_by" type="string"/>
<column name="created_date" type="${datetimeType}"/>
<column name="updated_by" type="string"/>
<column name="updated_date" type="${datetimeType}"/>
<column name="version" type="numeric"/>
</loadData>
</changeSet>
</databaseChangeLog>

View File

@ -0,0 +1,7 @@
id;number;parent_number;name;property;remark;sort_no;company;region;created_by;created_date;updated_by;updated_date;version
1;d001;;总部;总部;总部;1;c001;r001;system;2024-03-25 00:00:00;system;2024-03-25 00:00:00;0
2;d002;d001;人事部;职能部门;人力资源管理;2;c001;r001;system;2024-03-25 00:00:00;system;2024-03-25 00:00:00;0
3;d003;d001;财务部;职能部门;财务管理;3;c001;r001;system;2024-03-25 00:00:00;system;2024-03-25 00:00:00;0
4;d004;d001;技术部;业务部门;技术研发;4;c001;r001;system;2024-03-25 00:00:00;system;2024-03-25 00:00:00;0
5;d005;d004;开发组;技术团队;软件开发;5;c001;r001;system;2024-03-25 00:00:00;system;2024-03-25 00:00:00;0
6;d006;d004;测试组;技术团队;质量保证;6;c001;r001;system;2024-03-25 00:00:00;system;2024-03-25 00:00:00;0
1 id number parent_number name property remark sort_no company region created_by created_date updated_by updated_date version
2 1 d001 总部 总部 总部 1 c001 r001 system 2024-03-25 00:00:00 system 2024-03-25 00:00:00 0
3 2 d002 d001 人事部 职能部门 人力资源管理 2 c001 r001 system 2024-03-25 00:00:00 system 2024-03-25 00:00:00 0
4 3 d003 d001 财务部 职能部门 财务管理 3 c001 r001 system 2024-03-25 00:00:00 system 2024-03-25 00:00:00 0
5 4 d004 d001 技术部 业务部门 技术研发 4 c001 r001 system 2024-03-25 00:00:00 system 2024-03-25 00:00:00 0
6 5 d005 d004 开发组 技术团队 软件开发 5 c001 r001 system 2024-03-25 00:00:00 system 2024-03-25 00:00:00 0
7 6 d006 d004 测试组 技术团队 质量保证 6 c001 r001 system 2024-03-25 00:00:00 system 2024-03-25 00:00:00 0

View File

@ -15,6 +15,7 @@
<include file="config/liquibase/changelog/20240325000001_added_entity_Menu.xml" relativeToChangelogFile="false"/>
<include file="config/liquibase/changelog/20240325000002_added_entity_Company.xml" relativeToChangelogFile="false"/>
<include file="config/liquibase/changelog/20240325000003_added_entity_Region.xml" relativeToChangelogFile="false"/>
<include file="config/liquibase/changelog/20240325000003_added_entity_Depart.xml" relativeToChangelogFile="false"/>
<!-- jhipster-needle-liquibase-add-changelog - JHipster will add liquibase changelogs here -->
<!-- jhipster-needle-liquibase-add-constraints-changelog - JHipster will add liquibase constraints changelogs here -->
<!-- jhipster-needle-liquibase-add-incremental-changelog - JHipster will add incremental liquibase changelogs here -->

View File

@ -8,6 +8,7 @@
"entities": {
"main": "数据",
"company": "公司管理",
"region": "地区管理",
"jhipster-needle-menu-add-entry": "JHipster will add additional entities here (do not translate!)"
},
"account": {