更新公司管理功能:1. 优化数据库结构 2. 实现分页功能 3. 更新前端界面
This commit is contained in:
parent
3a8e01d536
commit
0d39feee20
@ -16,6 +16,11 @@ public class Company implements Serializable {
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
private Long id;
|
||||
|
||||
@NotNull
|
||||
@Size(max = 50)
|
||||
@Column(name = "number", length = 50, nullable = false, unique = true)
|
||||
private String number;
|
||||
|
||||
@NotNull
|
||||
@Size(max = 100)
|
||||
@Column(name = "name", length = 100, nullable = false)
|
||||
@ -55,6 +60,14 @@ public class Company implements Serializable {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getNumber() {
|
||||
return number;
|
||||
}
|
||||
|
||||
public void setNumber(String number) {
|
||||
this.number = number;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
@ -10,6 +10,7 @@ import java.net.URISyntaxException;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.data.domain.PageRequest;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.server.ResponseStatusException;
|
||||
@ -81,6 +82,15 @@ public class CompanyResource {
|
||||
* @return the {@link ResponseEntity} with status {@code 200 (OK)} and the list of companies in body.
|
||||
*/
|
||||
@GetMapping("/companies")
|
||||
public Mono<ResponseEntity<Flux<Company>>> getAllCompanies(
|
||||
@RequestParam(defaultValue = "0") int page,
|
||||
@RequestParam(defaultValue = "10") int size
|
||||
) {
|
||||
log.debug("REST request to get Companies with pagination - Page: {}, Size: {}", page, size);
|
||||
Pageable pageable = PageRequest.of(page, size);
|
||||
return Mono.just(ResponseEntity.ok().body(companyService.findAll(pageable)));
|
||||
}
|
||||
|
||||
public Flux<Company> getAllCompanies() {
|
||||
log.debug("REST request to get all Companies");
|
||||
return companyService.getAllCompanies();
|
||||
|
||||
@ -11,6 +11,9 @@
|
||||
<column name="id" type="bigint" autoIncrement="true">
|
||||
<constraints primaryKey="true" nullable="false"/>
|
||||
</column>
|
||||
<column name="number" type="varchar(50)">
|
||||
<constraints nullable="false" unique="true"/>
|
||||
</column>
|
||||
<column name="name" type="varchar(100)">
|
||||
<constraints nullable="false"/>
|
||||
</column>
|
||||
@ -30,6 +33,7 @@
|
||||
tableName="jhi_company"
|
||||
usePreparedStatements="true">
|
||||
<column name="id" type="numeric"/>
|
||||
<column name="number" type="string"/>
|
||||
<column name="name" type="string"/>
|
||||
<column name="address" type="string"/>
|
||||
<column name="license_no" type="string"/>
|
||||
|
||||
@ -1,3 +1,3 @@
|
||||
id;name;address;license_no;license_expire;createtime;updatetime;lastmodby;version
|
||||
1;测试公司;广州市天河区天河路100号;GZ202403250001;2025-03-25 00:00:00;2024-03-25 00:00:00;2024-03-25 00:00:00;system;0
|
||||
2;示例企业;深圳市南山区科技园;SZ202403250002;2025-03-25 00:00:00;2024-03-25 00:00:00;2024-03-25 00:00:00;system;0
|
||||
id;number;name;address;license_no;license_expire;createtime;updatetime;lastmodby;version
|
||||
1;C001;测试公司;广州市天河区天河路100号;GZ202403250001;2025-03-25 00:00:00;2024-03-25 00:00:00;2024-03-25 00:00:00;system;0
|
||||
2;C002;示例企业;深圳市南山区科技园;SZ202403250002;2025-03-25 00:00:00;2024-03-25 00:00:00;2024-03-25 00:00:00;system;0
|
||||
|
@ -6,7 +6,6 @@ import axios from 'axios';
|
||||
import TreeTable from 'vue-table-with-tree-grid';
|
||||
|
||||
export default defineComponent({
|
||||
compatConfig: { MODE: 3 },
|
||||
name: 'Menu',
|
||||
components: {
|
||||
TreeTable,
|
||||
@ -102,8 +101,8 @@ export default defineComponent({
|
||||
loadAll();
|
||||
};
|
||||
|
||||
const showEditDialog = ref(false);
|
||||
const showDeleteDialog = ref(false);
|
||||
const editDialogRef = ref(null);
|
||||
const deleteDialogRef = ref(null);
|
||||
|
||||
const openDialog = () => {
|
||||
dialogTitle.value = t('jewpmsApp.menu.home.createLabel');
|
||||
@ -121,27 +120,29 @@ export default defineComponent({
|
||||
lastmodby: '',
|
||||
version: 0,
|
||||
};
|
||||
showEditDialog.value = true;
|
||||
const modal = document.getElementById('editDialog');
|
||||
if (modal) {
|
||||
const bModal = (modal as any).__vue__.$refs.modal;
|
||||
if (bModal) {
|
||||
bModal.show();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
const closeDialog = () => {
|
||||
showEditDialog.value = false;
|
||||
};
|
||||
|
||||
const closeDeleteDialog = () => {
|
||||
showDeleteDialog.value = false;
|
||||
editDialogRef.value?.hide();
|
||||
};
|
||||
|
||||
const prepareEdit = menuItem => {
|
||||
dialogTitle.value = t('jewpmsApp.menu.home.editLabel');
|
||||
menu.value = { ...menuItem };
|
||||
showEditDialog.value = true;
|
||||
editDialogRef.value?.show();
|
||||
};
|
||||
|
||||
const prepareDelete = menuItem => {
|
||||
removeId.value = menuItem.id;
|
||||
menu.value = menuItem;
|
||||
showDeleteDialog.value = true;
|
||||
deleteDialogRef.value?.show();
|
||||
};
|
||||
|
||||
const save = async () => {
|
||||
@ -193,9 +194,8 @@ export default defineComponent({
|
||||
removeMenu,
|
||||
deleteMenu: removeMenu,
|
||||
getParentName,
|
||||
showEditDialog,
|
||||
showDeleteDialog,
|
||||
closeDeleteDialog,
|
||||
editDialogRef,
|
||||
deleteDialogRef,
|
||||
};
|
||||
},
|
||||
});
|
||||
|
||||
@ -3,6 +3,10 @@
|
||||
<h2 class="jh-entity-heading" data-cy="MenuHeading">
|
||||
<span v-text="$t('jewpmsApp.menu.home.title')"></span>
|
||||
<div class="d-flex justify-content-end">
|
||||
<b-button v-b-modal.modal-1>Launch demo modal</b-button>
|
||||
<b-modal id="modal-1" title="BootstrapVue">
|
||||
<p class="my-4">Hello from modal!</p>
|
||||
</b-modal>
|
||||
<button class="btn btn-info mr-2" v-on:click="handleSyncList" data-cy="entitySyncListButton">
|
||||
<font-awesome-icon icon="sync" />
|
||||
<span v-text="$t('jewpmsApp.menu.home.refreshListLabel')"></span>
|
||||
@ -57,7 +61,7 @@
|
||||
</div>
|
||||
|
||||
<!-- 新增/编辑对话框 -->
|
||||
<b-modal id="editDialog" :title="dialogTitle" @hidden="closeDialog" @ok="save">
|
||||
<b-modal ref="editDialog" :title="dialogTitle" @hidden="closeDialog" @ok="save">
|
||||
<div class="form-group">
|
||||
<label v-text="$t('jewpmsApp.menu.name')"></label>
|
||||
<input type="text" class="form-control" v-model="menu.name" />
|
||||
@ -94,7 +98,7 @@
|
||||
</b-modal>
|
||||
|
||||
<!-- 删除确认对话框 -->
|
||||
<b-modal id="deleteDialog" :title="$t('entity.delete.title')" @ok="deleteMenu">
|
||||
<b-modal ref="deleteDialog" :title="$t('entity.delete.title')" @ok="deleteMenu">
|
||||
<p v-text="$t('jewpmsApp.menu.delete.question', { id: menu.id })"></p>
|
||||
</b-modal>
|
||||
</div>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user