From 3f476e9dc149c89df5fff1513a690ff05ec545c9 Mon Sep 17 00:00:00 2001 From: 朱桂飞 <zhuguifei@zhuguifeideMacBook-Air.local> Date: 星期三, 12 二月 2025 14:36:30 +0800 Subject: [PATCH] 新增故障报修 --- eims-ui/apps/web-antd/src/views/eims/inventory/inventory-drawer.vue | 2 eims-ui/apps/web-antd/src/views/eims/equ-statu/data.tsx | 2 eims-ui/apps/web-antd/src/views/eims/equ/data.tsx | 4 eims-ui/apps/web-antd/src/api/eims/utils/index.ts | 13 eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/domain/EimsRepairReq.java | 113 +++ eims-ui/apps/web-antd/src/api/eims/repair-req/index.ts | 61 + eims-ui/packages/@core/base/shared/src/constants/dict-enum.ts | 4 eims-ui/apps/web-antd/src/views/eims/equ/index.vue | 14 eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/mapper/EimsRepairReqMapper.java | 20 eims-ui/apps/web-antd/src/views/eims/components/equ-modal.vue | 49 + eims-ui/apps/web-antd/src/api/eims/repair-req/model.d.ts | 235 ++++++ eims-ui/apps/web-antd/src/views/eims/components/code-input.vue | 72 ++ eims/ruoyi-extend/ruoyi-snailjob-server/src/main/resources/application-dev.yml | 4 eims-ui/apps/web-antd/src/views/eims/inventory/index.vue | 2 eims/ruoyi-common/ruoyi-common-core/src/main/java/org/dromara/common/core/constant/CacheConstants.java | 6 eims-ui/apps/web-antd/src/views/eims/repair-req/data.tsx | 259 +++++++ eims-ui/apps/web-antd/src/views/eims/repair-req/index.vue | 230 ++++++ eims/ruoyi-modules/lb-eims/src/main/resources/mapper/eims/EimsRepairReqMapper.xml | 20 eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/service/IEimsRepairReqService.java | 78 ++ eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/controller/EimsRepairReqController.java | 106 +++ eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/domain/bo/EimsRepairReqBo.java | 122 +++ eims-ui/apps/web-antd/src/views/eims/repair-req/repair-req-drawer.vue | 262 +++++++ eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/controller/GenerateCodeController.java | 59 + eims-ui/apps/web-antd/src/views/eims/inventory-detail/data.tsx | 4 eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/domain/vo/EimsRepairReqVo.java | 152 ++++ eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/service/impl/EimsRepairReqServiceImpl.java | 170 ++++ 26 files changed, 2,049 insertions(+), 14 deletions(-) diff --git a/eims-ui/apps/web-antd/src/api/eims/repair-req/index.ts b/eims-ui/apps/web-antd/src/api/eims/repair-req/index.ts new file mode 100644 index 0000000..dcd668c --- /dev/null +++ b/eims-ui/apps/web-antd/src/api/eims/repair-req/index.ts @@ -0,0 +1,61 @@ +import type { RepairReqVO } from './model'; + +import type { ID, IDS } from '#/api/common'; + +import { commonExport } from '#/api/helper'; +import { requestClient } from '#/api/request'; + +enum Api { + repairReqExport = '/eims/repairReq/export', + repairReqList = '/eims/repairReq/list', + root = '/eims/repairReq' +} + +/** + * 鏌ヨ鏁呴殰鎶ヤ慨鍒楄〃 + * @param query + * @returns {*} + */ + +export function listRepairReq(params?: any) { + return requestClient.get<RepairReqVO[]>(Api.repairReqList, { params }); +} + +/** + * 鏌ヨ鏁呴殰鎶ヤ慨璇︾粏 + * @param repairReqId + */ +export function getRepairReq(repairReqId: ID) { + return requestClient.get<RepairReqVO>(`${Api.root}/${repairReqId}`); +} + +/** + * 鏂板鏁呴殰鎶ヤ慨 + * @param data + */ +export function addRepairReq(data: any) { + return requestClient.postWithMsg<void>(Api.root, data); +} + +/** + * 淇敼鏁呴殰鎶ヤ慨 + * @param data + */ +export function updateRepairReq(data: any) { + return requestClient.putWithMsg<void>(Api.root, data); +} + +/** + * 鍒犻櫎鏁呴殰鎶ヤ慨 + * @param repairReqId + */ +export function delRepairReq(repairReqId: IDS) { + return requestClient.deleteWithMsg<void>(`${Api.root}/${repairReqId}`); +} +/** + * 瀵煎嚭 + * @param + */ +export function repairReqExport(data: any) { + return commonExport(Api.repairReqExport, data); +} diff --git a/eims-ui/apps/web-antd/src/api/eims/repair-req/model.d.ts b/eims-ui/apps/web-antd/src/api/eims/repair-req/model.d.ts new file mode 100644 index 0000000..5b2c03f --- /dev/null +++ b/eims-ui/apps/web-antd/src/api/eims/repair-req/model.d.ts @@ -0,0 +1,235 @@ +export interface RepairReqVO { + /** + * 鎶ヤ慨id + */ + id: number | string; + + /** + * 鎶ヤ慨鍗曞彿 + */ + code: string; + + /** + * 鎶ヤ慨鐘舵�� + */ + status: string; + + /** + * 鍙戠敓浜嬩欢 + */ + occTime: string; + + /** + * 鎶ヤ慨鏃堕棿 + */ + reqTime: string; + + /** + * 鎶ヤ慨浜洪儴闂� + */ + reqDept: number; + + /** + * 鎶ヤ慨浜� + */ + reqUser: number; + + /** + * 鎶ヤ慨鎻忚堪 + */ + reqDesc: string; + + /** + * 绱ф�ョ▼搴� + */ + urgencyLevel: string; + + /** + * 鏁呴殰鍥剧墖 + */ + faultPicture: string; + + /** + * 鎶ヤ慨绫诲瀷 + */ + reqType: string; + + /** + * 璁惧id + */ + equId: number | string; + + /** + * 缁翠慨鍗昳d + */ + repairId: number | string; + + /** + * 缁翠慨浜洪儴闂� + */ + repairDept: number; + + /** + * 缁翠慨浜� + */ + repairUser: number; + + /** + * 鏁呴殰绫诲埆 + */ + faultType: string; + + /** + * 澶囨敞 + */ + remark: string; +} + +export interface RepairReqForm extends BaseEntity { + /** + * 鎶ヤ慨id + */ + id?: number | string; + + /** + * 鎶ヤ慨鍗曞彿 + */ + code?: string; + + /** + * 鎶ヤ慨鐘舵�� + */ + status?: string; + + /** + * 鍙戠敓浜嬩欢 + */ + occTime?: string; + + /** + * 鎶ヤ慨鏃堕棿 + */ + reqTime?: string; + + /** + * 鎶ヤ慨浜洪儴闂� + */ + reqDept?: number; + + /** + * 鎶ヤ慨浜� + */ + reqUser?: number; + + /** + * 鎶ヤ慨鎻忚堪 + */ + reqDesc?: string; + + /** + * 绱ф�ョ▼搴� + */ + urgencyLevel?: string; + + /** + * 鏁呴殰鍥剧墖 + */ + faultPicture?: string; + + /** + * 鎶ヤ慨绫诲瀷 + */ + reqType?: string; + + /** + * 璁惧id + */ + equId?: number | string; + + /** + * 缁翠慨鍗昳d + */ + repairId?: number | string; + + /** + * 缁翠慨浜洪儴闂� + */ + repairDept?: number; + + /** + * 缁翠慨浜� + */ + repairUser?: number; + + /** + * 鏁呴殰绫诲埆 + */ + faultType?: string; + + /** + * 澶囨敞 + */ + remark?: string; +} + +export interface RepairReqQuery extends PageQuery { + /** + * 鎶ヤ慨鍗曞彿 + */ + code?: string; + + /** + * 鎶ヤ慨鐘舵�� + */ + status?: string; + + /** + * 鎶ヤ慨鏃堕棿 + */ + reqTime?: string; + + /** + * 鎶ヤ慨浜洪儴闂� + */ + reqDept?: number; + + /** + * 鎶ヤ慨浜� + */ + reqUser?: number; + + /** + * 绱ф�ョ▼搴� + */ + urgencyLevel?: string; + + /** + * 鎶ヤ慨绫诲瀷 + */ + reqType?: string; + + /** + * 璁惧id + */ + equId?: number | string; + + /** + * 缁翠慨浜洪儴闂� + */ + repairDept?: number; + + /** + * 缁翠慨浜� + */ + repairUser?: number; + + /** + * 鏁呴殰绫诲埆 + */ + faultType?: string; + + /** + * 鏃ユ湡鑼冨洿鍙傛暟 + */ + params?: any; +} diff --git a/eims-ui/apps/web-antd/src/api/eims/utils/index.ts b/eims-ui/apps/web-antd/src/api/eims/utils/index.ts new file mode 100644 index 0000000..8efa174 --- /dev/null +++ b/eims-ui/apps/web-antd/src/api/eims/utils/index.ts @@ -0,0 +1,13 @@ +import { requestClient } from '#/api/request'; + +enum Api { + generateCode = '/eims/generate/' +} + +/** + * 鐢熸垚鍚勭鍗曞彿 + * @param prefix 鍗曞彿鍓嶇紑 + */ +export function generateCode(prefix: string) { + return requestClient.get<string>(`${Api.generateCode}/${prefix}`); +} diff --git a/eims-ui/apps/web-antd/src/views/eims/components/code-input.vue b/eims-ui/apps/web-antd/src/views/eims/components/code-input.vue new file mode 100644 index 0000000..46d8a1a --- /dev/null +++ b/eims-ui/apps/web-antd/src/views/eims/components/code-input.vue @@ -0,0 +1,72 @@ +<script setup lang="ts"> +import { IconifyIcon } from '@vben/icons'; + +import { Input } from 'ant-design-vue'; + +import { generateCode } from '#/api/eims/utils'; + +defineOptions({ name: 'CodeInput' }); + +/** + * 鐗瑰埆娉ㄦ剰锛屽崟鍙锋牴鎹墠缂�鐢熸垚 + * BXD-鎶ヤ慨鍗� + */ + +const props = defineProps({ + disabled: { + default: false, + type: Boolean + }, + prefix: { + default: null, + type: String + }, + placeholder: { + default: '鑷姩鐢熸垚', + type: String + } +}); + +const value = defineModel<string>('value', { + required: false, + type: String +}); + +async function refreshCode() { + // 鏍规嵁 + // value.value = buildUUID(); + const code = await generateCode(props.prefix); + value.value = code; +} + +/** + * 涓囦竴瑕佸湪姣忔鏂板鏃舵墦寮�Drawer鍒锋柊 + * 闇�瑕佽皟鐢ㄥ疄渚嬫柟娉� + */ +defineExpose({ refreshCode }); +</script> + +<template> + <Input v-model:value="value" :disabled="disabled" :placeholder="placeholder"> + <template v-if="!disabled" #addonAfter> + <a-button type="primary" @click="refreshCode"> + <div class="flex items-center gap-[4px]"> + <IconifyIcon icon="charm:refresh" /> + <span>鑷姩鐢熸垚</span> + </div> + </a-button> + </template> + </Input> +</template> + +<style lang="scss" scoped> +:deep(.ant-input-group-addon) { + padding: 0; + border: none; +} + +:deep(.ant-btn-primary) { + border-top-left-radius: 0; + border-bottom-left-radius: 0; +} +</style> diff --git a/eims-ui/apps/web-antd/src/views/eims/components/equ-modal.vue b/eims-ui/apps/web-antd/src/views/eims/components/equ-modal.vue new file mode 100644 index 0000000..fb84aa2 --- /dev/null +++ b/eims-ui/apps/web-antd/src/views/eims/components/equ-modal.vue @@ -0,0 +1,49 @@ +<script setup lang="ts"> +import { ref } from 'vue'; + +import { useVbenModal } from '@vben/common-ui'; + +import { message } from 'ant-design-vue'; + +import EquView from '#/views/eims/equ/index.vue'; + +const emit = defineEmits<{ updateEqu: [any] }>(); + +const [BasicModal, modalApi] = useVbenModal({ + fullscreenButton: false, + draggable: true, + onCancel: handleCancel, + onConfirm: handleConfirm +}); +const equView = ref(); + +async function handleConfirm() { + try { + modalApi.modalLoading(true); + const tableSelect = equView.value.tableSelect(); + if (tableSelect.length > 1) { + message.error('鏈�澶氬彧鑳介�夋嫨涓�鍙拌澶囷紒'); + modalApi.modalLoading(false); + return false; + } + emit('updateEqu', tableSelect[0]); + await handleCancel(); + } catch (error) { + console.error(error); + } finally { + modalApi.modalLoading(false); + } +} + +async function handleCancel() { + modalApi.close(); +} +</script> + +<template> + <BasicModal :fullscreen-button="true" class="w-[800px]"> + <EquView ref="equView" /> + </BasicModal> +</template> + +<style scoped></style> diff --git a/eims-ui/apps/web-antd/src/views/eims/equ-statu/data.tsx b/eims-ui/apps/web-antd/src/views/eims/equ-statu/data.tsx index 3790277..3f9bed4 100644 --- a/eims-ui/apps/web-antd/src/views/eims/equ-statu/data.tsx +++ b/eims-ui/apps/web-antd/src/views/eims/equ-statu/data.tsx @@ -4,8 +4,6 @@ import { DictEnum } from '@vben/constants'; import { getPopupContainer } from '@vben/utils'; -import { Tag } from 'ant-design-vue'; - import { type FormSchemaGetter } from '#/adapter/form'; import { getDictOptions } from '#/utils/dict'; import { renderDict } from '#/utils/render'; diff --git a/eims-ui/apps/web-antd/src/views/eims/equ/data.tsx b/eims-ui/apps/web-antd/src/views/eims/equ/data.tsx index ff11e78..f73fc31 100644 --- a/eims-ui/apps/web-antd/src/views/eims/equ/data.tsx +++ b/eims-ui/apps/web-antd/src/views/eims/equ/data.tsx @@ -3,8 +3,6 @@ import { DictEnum } from '@vben/constants'; import { getPopupContainer } from '@vben/utils'; -import { Tag } from 'ant-design-vue'; - import { type FormSchemaGetter, z } from '#/adapter/form'; import { getDictOptions } from '#/utils/dict'; import { renderDict } from '#/utils/render'; @@ -65,7 +63,7 @@ fixed: 'left' }, { - title: '璁惧缂栧彿', + title: '璁惧缂栫爜', field: 'equCode', sortable: true, minWidth: 100 diff --git a/eims-ui/apps/web-antd/src/views/eims/equ/index.vue b/eims-ui/apps/web-antd/src/views/eims/equ/index.vue index 71f4108..1dd8597 100644 --- a/eims-ui/apps/web-antd/src/views/eims/equ/index.vue +++ b/eims-ui/apps/web-antd/src/views/eims/equ/index.vue @@ -20,6 +20,10 @@ // 宸﹁竟閮ㄩ棬鐢� const selectDeptId = ref<string[]>([]); +defineExpose({ + tableSelect +}); + const formOptions: VbenFormProps = { commonConfig: { labelWidth: 80, @@ -80,7 +84,7 @@ // 杩滅▼鎺掑簭 remote: true, // 鏀寔澶氬瓧娈垫帓搴� 榛樿鍏抽棴 - multiple: true, + multiple: true }, id: 'eims-equ-index' }; @@ -89,8 +93,8 @@ formOptions, gridOptions, gridEvents: { - sortChange: (sortParams) => vxeSortEvent(tableApi, sortParams), - }, + sortChange: (sortParams) => vxeSortEvent(tableApi, sortParams) + } }); const [EquDrawer, equDrawerApi] = useVbenDrawer({ @@ -146,6 +150,10 @@ function handleDetail(record: Recordable<any>) { router.push(`/equ/detail/${record.equId}`); } +// 閫変腑鏁版嵁 +function tableSelect() { + return tableApi.grid.getCheckboxRecords(); +} </script> <template> diff --git a/eims-ui/apps/web-antd/src/views/eims/inventory-detail/data.tsx b/eims-ui/apps/web-antd/src/views/eims/inventory-detail/data.tsx index 6acc5ef..13b8bc8 100644 --- a/eims-ui/apps/web-antd/src/views/eims/inventory-detail/data.tsx +++ b/eims-ui/apps/web-antd/src/views/eims/inventory-detail/data.tsx @@ -10,7 +10,7 @@ { component: 'Input', fieldName: 'equCode', - label: '璁惧缂栧彿' + label: '璁惧缂栫爜' }, { component: 'Input', @@ -60,7 +60,7 @@ } }, { - title: '璁惧缂栧彿', + title: '璁惧缂栫爜', field: 'equCode', minWidth: 120, fixed: 'left' diff --git a/eims-ui/apps/web-antd/src/views/eims/inventory/index.vue b/eims-ui/apps/web-antd/src/views/eims/inventory/index.vue index edfcb99..1bdfa55 100644 --- a/eims-ui/apps/web-antd/src/views/eims/inventory/index.vue +++ b/eims-ui/apps/web-antd/src/views/eims/inventory/index.vue @@ -169,7 +169,7 @@ /** 鏍规嵁閮ㄩ棬ID鍔犺浇鐢ㄦ埛 */ await setupUserOptions(deptId); /** 鍙樺寲鍚庨渶瑕侀噸鏂伴�夋嫨鐢ㄦ埛 */ - formModel.respPerson = undefined; + formModel.inventoryUser = undefined; }, placeholder: '璇烽�夋嫨', showSearch: true, diff --git a/eims-ui/apps/web-antd/src/views/eims/inventory/inventory-drawer.vue b/eims-ui/apps/web-antd/src/views/eims/inventory/inventory-drawer.vue index 5851a2b..88fc62e 100644 --- a/eims-ui/apps/web-antd/src/views/eims/inventory/inventory-drawer.vue +++ b/eims-ui/apps/web-antd/src/views/eims/inventory/inventory-drawer.vue @@ -150,7 +150,7 @@ /** 鏍规嵁閮ㄩ棬ID鍔犺浇鐢ㄦ埛 */ await setupUserOptions(deptId); /** 鍙樺寲鍚庨渶瑕侀噸鏂伴�夋嫨鐢ㄦ埛 */ - formModel.respPerson = undefined; + formModel.inventoryUser = undefined; }, placeholder: '璇烽�夋嫨', showSearch: true, diff --git a/eims-ui/apps/web-antd/src/views/eims/repair-req/data.tsx b/eims-ui/apps/web-antd/src/views/eims/repair-req/data.tsx new file mode 100644 index 0000000..3be5e5f --- /dev/null +++ b/eims-ui/apps/web-antd/src/views/eims/repair-req/data.tsx @@ -0,0 +1,259 @@ +import type { VxeGridProps } from '#/adapter/vxe-table'; + +import { DictEnum } from '@vben/constants'; +import { getPopupContainer } from '@vben/utils'; + +import { type FormSchemaGetter } from '#/adapter/form'; +import { getDictOptions } from '#/utils/dict'; +import { renderDict } from '#/utils/render'; + +export const querySchema: FormSchemaGetter = () => [ + { + component: 'Input', + fieldName: 'code', + label: '鎶ヤ慨鍗曞彿' + }, + { + component: 'Select', + componentProps: { + options: getDictOptions(DictEnum.REPAIR_REQ_STATUS) + }, + fieldName: 'status', + label: '鎶ヤ慨鐘舵��' + }, + + { + component: 'TreeSelect', + // 鍦╠rawer閲屾洿鏂� 杩欓噷涓嶉渶瑕侀粯璁ょ殑componentProps + defaultValue: undefined, + fieldName: 'reqDept', + label: '鎶ヤ慨閮ㄩ棬', + // rules: 'selectRequired', + }, + { + component: 'Select', + componentProps: { + showSearch: true, + allowClear: true, + getPopupContainer + }, + fieldName: 'reqUser', + label: '鎶ヤ慨浜�' + }, + { + component: 'Select', + componentProps: { + options: getDictOptions(DictEnum.REPAIR_REQ_TYPE) + }, + fieldName: 'reqType', + label: '鎶ヤ慨绫诲瀷' + }, + { + component: 'Select', + componentProps: { + options: getDictOptions(DictEnum.REPAIR_FAULT_TYPE) + }, + fieldName: 'faultType', + label: '鏁呴殰绫诲埆' + }, + { + component: 'Select', + componentProps: { + options: getDictOptions(DictEnum.REPAIR_URGENCY_LEVEL) + }, + fieldName: 'urgencyLevel', + label: '绱ф�ョ▼搴�' + }, + { + component: 'RangePicker', + fieldName: 'reqTime', + label: '鎶ヤ慨鏃堕棿' + } +]; + +export const columns: VxeGridProps['columns'] = [ + { type: 'checkbox', width: 60, fixed: 'left' }, + { + title: '鎶ヤ慨鍗曞彿', + field: 'code', + minWidth: 160, + fixed: 'left' + }, + { + title: '澶勭悊鐘舵��', + field: 'status', + minWidth: 100, + fixed: 'left', + slots: { + default: ({ row }) => { + return renderDict(row.status, DictEnum.REPAIR_REQ_STATUS); + } + } + }, + { + title: '鎶ヤ慨绫诲瀷', + field: 'reqType', + sortable: true, + minWidth: 100, + slots: { + default: ({ row }) => { + return renderDict(row.reqType, DictEnum.REPAIR_REQ_TYPE); + } + } + }, + { + title: '鎶ヤ慨鏃堕棿', + field: 'reqTime', + sortable: true, + minWidth: 200 + }, + { + title: '鏁呴殰绫诲埆', + field: 'faultType', + minWidth: 100, + slots: { + default: ({ row }) => { + return renderDict(row.faultType, DictEnum.REPAIR_FAULT_TYPE); + } + } + }, + { + title: '鎶ヤ慨閮ㄩ棬', + field: 'reqDeptName', + minWidth: 100 + }, + { + title: '鎶ヤ慨浜�', + field: 'reqUserName', + minWidth: 100 + }, + { + title: '鏁呴殰鎻忚堪', + field: 'reqDesc', + minWidth: 120 + }, + { + field: 'action', + fixed: 'right', + slots: { default: 'action' }, + title: '鎿嶄綔', + width: 130 + } +]; + +export const drawerSchema: FormSchemaGetter = () => [ + { + component: 'Input', + dependencies: { + show: () => false, + triggerFields: [''] + }, + fieldName: 'id' + }, + { + component: 'Select', + componentProps: { + getPopupContainer, + }, + fieldName: 'reqType', + label: '鎶ヤ慨绫诲瀷', + help: `鎶ヤ慨绫诲瀷锛屽璁惧鏁呴殰銆佸伐鍏凤紙娌诲叿锛夋晠闅滅瓑` + }, + { + component: 'Input', + fieldName: 'code', + label: '鎶ヤ慨鍗曞彿' + }, + { + component: 'Input', + fieldName: 'equName', + label: '璁惧鍚嶇О', + dependencies: { + show: () => false, + triggerFields: [''] + } + }, + { + component: 'Input', + fieldName: 'equId', + label: '璁惧id', + dependencies: { + show: () => false, + triggerFields: [''] + } + }, + { + component: 'Select', + componentProps: { + getPopupContainer, + options: getDictOptions(DictEnum.REPAIR_REQ_STATUS) + }, + fieldName: 'status', + label: '澶勭悊鐘舵��' + }, + { + component: 'DatePicker', + componentProps: { + format: 'YYYY-MM-DD HH:mm:ss', + showTime: true, + valueFormat: 'YYYY-MM-DD HH:mm:ss', + getPopupContainer + }, + fieldName: 'reqTime', + label: '鎶ヤ慨鏃堕棿' + }, + { + component: 'DatePicker', + componentProps: { + format: 'YYYY-MM-DD HH:mm:ss', + showTime: true, + valueFormat: 'YYYY-MM-DD HH:mm:ss', + getPopupContainer + }, + fieldName: 'occTime', + label: '鍙戠敓鏃堕棿' + }, + { + component: 'Select', + componentProps: { + getPopupContainer, + options: getDictOptions(DictEnum.REPAIR_FAULT_TYPE) + }, + fieldName: 'faultType', + label: '鏁呴殰绫诲埆' + }, + { + component: 'Select', + componentProps: { + getPopupContainer, + options: getDictOptions(DictEnum.REPAIR_URGENCY_LEVEL) + }, + fieldName: 'urgencyLevel', + label: '绱ф�ョ▼搴�' + }, + { + component: 'Textarea', + formItemClass: 'items-baseline', + fieldName: 'reqDesc', + label: '鏁呴殰鎻忚堪' + }, + { + component: 'TreeSelect', + // 鍦╠rawer閲屾洿鏂� 杩欓噷涓嶉渶瑕侀粯璁ょ殑componentProps + defaultValue: undefined, + fieldName: 'reqDept', + label: '鎶ヤ慨閮ㄩ棬', + help: `鎶ヤ慨浜哄憳鎵�灞為儴闂╜ + // rules: 'selectRequired', + }, + { + component: 'Select', + componentProps: { + showSearch: true, + allowClear: true, + getPopupContainer + }, + fieldName: 'reqUser', + label: '鎶ヤ慨浜�' + } +]; diff --git a/eims-ui/apps/web-antd/src/views/eims/repair-req/index.vue b/eims-ui/apps/web-antd/src/views/eims/repair-req/index.vue new file mode 100644 index 0000000..14bf3ea --- /dev/null +++ b/eims-ui/apps/web-antd/src/views/eims/repair-req/index.vue @@ -0,0 +1,230 @@ +<script setup lang="ts"> +import type { Recordable } from '@vben/types'; + +import { onMounted } from 'vue'; + +import { Page, useVbenDrawer, type VbenFormProps } from '@vben/common-ui'; +import { $t } from '@vben/locales'; +import { addFullName, getPopupContainer, getVxePopupContainer } from '@vben/utils'; + +import { Modal, Popconfirm, Space } from 'ant-design-vue'; + +import { useVbenVxeGrid, vxeCheckboxChecked, type VxeGridProps, vxeSortEvent } from '#/adapter/vxe-table'; +import { delRepairReq, listRepairReq, repairReqExport } from '#/api/eims/repair-req'; +import { getDeptTree, userList } from '#/api/system/user'; +import { commonDownloadExcel } from '#/utils/file/download'; + +import { columns, querySchema } from './data'; +import repairReqDrawer from './repair-req-drawer.vue'; + +const formOptions: VbenFormProps = { + commonConfig: { + labelWidth: 80, + componentProps: { + allowClear: true + } + }, + schema: querySchema(), + collapsed: true, + wrapperClass: 'grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4', + // 鏃ユ湡閫夋嫨鏍煎紡鍖� + fieldMappingTime: [['reqTime', ['params[beginReqTime]', 'params[endReqTime]'], ['YYYY-MM-DD 00:00:00', 'YYYY-MM-DD 23:59:59']]] +}; + +const gridOptions: VxeGridProps = { + checkboxConfig: { + // 楂樹寒 + highlight: true, + // 缈婚〉鏃朵繚鐣欓�変腑鐘舵�� + reserve: true + // 鐐瑰嚮琛岄�変腑 + // trigger: 'row' + }, + columns, + height: 'auto', + keepSource: true, + pagerConfig: {}, + proxyConfig: { + ajax: { + query: async ({ page }, formValues = {}) => { + return await listRepairReq({ + pageNum: page.currentPage, + pageSize: page.pageSize, + ...formValues + }); + } + } + }, + rowConfig: { + isHover: true, + keyField: 'id' + }, + sortConfig: { + // 杩滅▼鎺掑簭 + remote: true, + // 鏀寔澶氬瓧娈垫帓搴� 榛樿鍏抽棴 + multiple: true + }, + id: 'eims-repair-req-index' +}; + +const [BasicTable, tableApi] = useVbenVxeGrid({ + formOptions, + gridOptions, + gridEvents: { + sortChange: (sortParams) => vxeSortEvent(tableApi, sortParams) + } +}); + +const [RepairReqDrawer, repairReqDrawerApi] = useVbenDrawer({ + connectedComponent: repairReqDrawer +}); + +function handleAdd() { + repairReqDrawerApi.setData({}); + repairReqDrawerApi.open(); +} + +async function handleEdit(record: Recordable<any>) { + repairReqDrawerApi.setData({ id: record.id }); + repairReqDrawerApi.open(); +} + +async function handleDelete(row: Recordable<any>) { + await delRepairReq(row.id); + await tableApi.query(); +} + +function handleMultiDelete() { + const rows = tableApi.grid.getCheckboxRecords(); + const ids = rows.map((row: any) => row.id); + Modal.confirm({ + title: '鎻愮ず', + okType: 'danger', + content: `纭鍒犻櫎閫変腑鐨�${ids.length}鏉¤褰曞悧锛焋, + onOk: async () => { + await delRepairReq(ids); + await tableApi.query(); + } + }); +} + +function handleDownloadExcel() { + commonDownloadExcel(repairReqExport, '鏁呴殰鎶ヤ慨璁板綍', tableApi.formApi.form.values, { + fieldMappingTime: formOptions.fieldMappingTime + }); +} + +onMounted(async () => { + await setupDeptSelect(); +}); + +/** + * 鐢ㄦ埛鐨勫姞杞� + */ +async function setupUserOptions(deptId: any) { + const params = { deptId }; + const userPageResult = await userList({ + pageNum: 1, + pageSize: 500, + ...params + }); + const options = userPageResult.rows.map((item) => ({ + label: item.nickName || item.userName, + value: item.userId + })); + // 绛涢�� + const filterOption = (input: string, option: any) => { + return option.label.toLowerCase().includes(input.toLowerCase()); + }; + + const placeholder = options.length > 0 ? '璇烽�夋嫨' : '璇ラ儴闂ㄤ笅鏆傛棤鐢ㄦ埛'; + tableApi.formApi.updateSchema([ + { + componentProps: { options, placeholder, filterOption }, + fieldName: 'reqUser' + } + ]); +} + +/** + * 鍒濆鍖栭儴闂ㄩ�夋嫨 + */ +async function setupDeptSelect() { + // updateSchema + const deptTree = await getDeptTree(); + // 閫変腑鍚庢樉绀哄湪杈撳叆妗嗙殑鍊� 鍗崇埗鑺傜偣 / 瀛愯妭鐐� + addFullName(deptTree, 'label', ' / '); + tableApi.formApi.updateSchema([ + { + componentProps: (formModel) => ({ + class: 'w-full', + fieldNames: { + key: 'id', + value: 'id', + children: 'children' + }, + getPopupContainer, + async onSelect(deptId: number | string) { + /** 鏍规嵁閮ㄩ棬ID鍔犺浇鐢ㄦ埛 */ + await setupUserOptions(deptId); + /** 鍙樺寲鍚庨渶瑕侀噸鏂伴�夋嫨鐢ㄦ埛 */ + formModel.reqUser = undefined; + }, + placeholder: '璇烽�夋嫨', + showSearch: true, + treeData: deptTree, + treeDefaultExpandAll: true, + treeLine: { showLeafIcon: false }, + // 绛涢�夌殑瀛楁 + treeNodeFilterProp: 'label', + // 閫変腑鍚庢樉绀哄湪杈撳叆妗嗙殑鍊� + treeNodeLabelProp: 'fullName' + }), + fieldName: 'reqDept' + } + ]); +} +</script> + +<template> + <Page :auto-content-height="true"> + <div class="flex h-full gap-[8px]"> + <BasicTable class="flex-1 overflow-hidden" table-title="璁惧鐩樼偣鍒楄〃"> + <template #toolbar-tools> + <Space> + <a-button v-access:code="['eims:repairReq:export']" @click="handleDownloadExcel"> + {{ $t('pages.common.export') }} + </a-button> + <a-button + :disabled="!vxeCheckboxChecked(tableApi)" + danger + type="primary" + v-access:code="['eims:repairReq:remove']" + @click="handleMultiDelete" + > + {{ $t('pages.common.delete') }} + </a-button> + <a-button type="primary" v-access:code="['eims:repairReq:add']" @click="handleAdd"> + {{ $t('pages.common.add') }} + </a-button> + </Space> + </template> + + <template #action="{ row }"> + <Space> + <ghost-button v-access:code="['eims:repairReq:edit']" @click.stop="handleEdit(row)"> + {{ $t('pages.common.edit') }} + </ghost-button> + <Popconfirm :get-popup-container="getVxePopupContainer" placement="left" title="纭鍒犻櫎锛�" @confirm="handleDelete(row)"> + <ghost-button danger v-access:code="['eims:repairReq:remove']" @click.stop=""> + {{ $t('pages.common.delete') }} + </ghost-button> + </Popconfirm> + </Space> + </template> + </BasicTable> + </div> + <RepairReqDrawer @reload="tableApi.query()" /> + </Page> +</template> diff --git a/eims-ui/apps/web-antd/src/views/eims/repair-req/repair-req-drawer.vue b/eims-ui/apps/web-antd/src/views/eims/repair-req/repair-req-drawer.vue new file mode 100644 index 0000000..314c0c8 --- /dev/null +++ b/eims-ui/apps/web-antd/src/views/eims/repair-req/repair-req-drawer.vue @@ -0,0 +1,262 @@ +<script setup lang="ts"> +import { computed, onMounted, ref } from 'vue'; + +import { useVbenDrawer, useVbenModal } from '@vben/common-ui'; +import { DictEnum } from '@vben/constants'; +import { $t } from '@vben/locales'; +import { addFullName, cloneDeep, getPopupContainer, listToTree } from '@vben/utils'; + +import { InputSearch } from 'ant-design-vue'; + +import { useVbenForm } from '#/adapter/form'; +import { listEquType } from '#/api/eims/equ-type'; +import { addRepairReq, getRepairReq, updateRepairReq } from '#/api/eims/repair-req'; +import { getDeptTree, userList } from '#/api/system/user'; +import { getDictOptions } from '#/utils/dict'; +import CodeInput from '#/views/eims/components/code-input.vue'; +import equModal from '#/views/eims/components/equ-modal.vue'; + +import { drawerSchema } from './data'; + +const emit = defineEmits<{ reload: [] }>(); + +const isUpdate = ref(false); +const title = computed(() => { + return isUpdate.value ? $t('pages.common.edit') : $t('pages.common.add'); +}); + +const [BasicForm, formApi] = useVbenForm({ + commonConfig: { + formItemClass: 'col-span-2', + componentProps: { + class: 'w-full' + }, + labelWidth: 120 + }, + schema: drawerSchema(), + showDefaultActions: false, + wrapperClass: 'grid-cols-2' +}); + +const [BasicDrawer, drawerApi] = useVbenDrawer({ + onCancel: handleCancel, + onConfirm: handleConfirm, + async onOpenChange(isOpen) { + if (!isOpen) { + return null; + } + // 鍔ㄦ�佸垏鎹㈣〃鍗� + formApi.updateSchema([ + { + componentProps: () => ({ + disabled: isUpdate.value, + options: getDictOptions(DictEnum.REPAIR_REQ_TYPE), + async onSelect(reqType: string) { + // 绫诲瀷瑙佸瓧鍏�-REPAIR_REQ_TYPE + formApi.updateSchema([ + { + dependencies: { + show: () => reqType === '1', + triggerFields: [''] + }, + fieldName: 'equName' + } + ]); + } + }), + fieldName: 'reqType' + }, + { + dependencies: { + show: () => false, + triggerFields: [''] + }, + fieldName: 'equName' + } + ]); + drawerApi.drawerLoading(true); + const { id } = drawerApi.getData() as { id?: number | string }; + isUpdate.value = !!id; + // 鍒濆鍖� + await setupDeptSelect(); + await setupEquTypeSelect(); + // 鏇存柊 && 璧嬪�� + if (isUpdate.value && id) { + const record = await getRepairReq(id); + const reqType = record.reqType; + await formApi.setValues(record); + // 鏇存柊鏃朵笉鍙慨鏀圭洏鐐硅寖鍥� + if (isUpdate.value && record.reqDept) { + await setupUserOptions(record.reqDept); + } + formApi.updateSchema([ + { + dependencies: { + show: () => reqType === '1', + triggerFields: [''] + }, + fieldName: 'equName' + } + ]); + } + + + drawerApi.drawerLoading(false); + } +}); + +const [EquModal, equModalApi] = useVbenModal({ + connectedComponent: equModal, + draggable: true, + title: '閫夋嫨璁惧' +}); + +function handleOpenModal() { + equModalApi.setData({}); + equModalApi.open(); +} + +/** + * 鍔犺浇璁惧绫绘爲 + */ +const equTypeTree = ref(); + +async function setupEquTypeSelect() { + const result = (await listEquType()) || []; + // 鏋勫缓缁勪欢闇�瑕佹暟鎹� + const equArray = result.map((item) => { + return { + ...item, // 淇濈暀鍘熸湁瀵硅薄鐨勬墍鏈夊睘鎬� + id: item.equTypeId, + label: item.typeName, + weight: item.orderNum + }; + }); + // support i18n + equArray.forEach((item) => { + item.typeName = $t(item.typeName); + }); + const equTree = listToTree(equArray, { id: 'id', pid: 'parentId' }); + equTypeTree.value = equTree; +} + +/** + * 鐢ㄦ埛鐨勫姞杞� + */ +async function setupUserOptions(deptId: any) { + const params = { deptId }; + const userPageResult = await userList({ + pageNum: 1, + pageSize: 500, + ...params + }); + const options = userPageResult.rows.map((item) => ({ + label: item.nickName || item.userName, + value: item.userId + })); + // 绛涢�� + const filterOption = (input: string, option: any) => { + return option.label.toLowerCase().includes(input.toLowerCase()); + }; + + const placeholder = options.length > 0 ? '璇烽�夋嫨' : '璇ラ儴闂ㄤ笅鏆傛棤鐢ㄦ埛'; + formApi.updateSchema([ + { + componentProps: { options, placeholder, filterOption }, + fieldName: 'reqUser' + } + ]); +} + +/** + * 鍒濆鍖栭儴闂ㄩ�夋嫨 + */ +async function setupDeptSelect() { + // updateSchema + const deptTree = await getDeptTree(); + // 閫変腑鍚庢樉绀哄湪杈撳叆妗嗙殑鍊� 鍗崇埗鑺傜偣 / 瀛愯妭鐐� + addFullName(deptTree, 'label', ' / '); + formApi.updateSchema([ + { + componentProps: (formModel) => ({ + class: 'w-full', + fieldNames: { + key: 'id', + value: 'id', + children: 'children' + }, + getPopupContainer, + async onSelect(deptId: number | string) { + /** 鏍规嵁閮ㄩ棬ID鍔犺浇鐢ㄦ埛 */ + await setupUserOptions(deptId); + /** 鍙樺寲鍚庨渶瑕侀噸鏂伴�夋嫨鐢ㄦ埛 */ + formModel.reqUser = undefined; + }, + placeholder: '璇烽�夋嫨', + showSearch: true, + treeData: deptTree, + treeDefaultExpandAll: true, + treeLine: { showLeafIcon: false }, + // 绛涢�夌殑瀛楁 + treeNodeFilterProp: 'label', + // 閫変腑鍚庢樉绀哄湪杈撳叆妗嗙殑鍊� + treeNodeLabelProp: 'fullName' + }), + fieldName: 'reqDept' + } + ]); +} + +async function handleConfirm() { + try { + drawerApi.drawerLoading(true); + const { valid } = await formApi.validate(); + if (!valid) { + return; + } + const data = cloneDeep(await formApi.getValues()); + await (isUpdate.value ? updateRepairReq(data) : addRepairReq(data)); + emit('reload'); + await handleCancel(); + } catch (error) { + console.error(error); + } finally { + drawerApi.drawerLoading(false); + } +} + +async function handleCancel() { + drawerApi.close(); + await formApi.resetForm(); +} + +/** + * 鎵撳紑鏌ヨ璁惧 + */ +function onSearchEqu() { + handleOpenModal(); +} + +/** + * 鏇存柊閫夋嫨鐨勮澶� + * @param equ + */ +async function updateEqu(equ: any) { + await formApi.setValues({ 'equId': equ.equId, 'equName': equ.equName }); +} +</script> + +<template> + <BasicDrawer :close-on-click-modal="false" :title="title" class="w-[600px]"> + <BasicForm> + <template #code="slotProps"> + <CodeInput v-bind="slotProps" :disabled="isUpdate" prefix="BXD" /> + </template> + <template #equName="slotProps"> + <InputSearch :enter-button="true" placeholder="璇烽�夋嫨璁惧" @search="onSearchEqu" v-bind="slotProps" + :disabled="isUpdate" /> + </template> + </BasicForm> + <EquModal class="w-[1200px]" @update-equ="updateEqu" /> + </BasicDrawer> +</template> diff --git a/eims-ui/packages/@core/base/shared/src/constants/dict-enum.ts b/eims-ui/packages/@core/base/shared/src/constants/dict-enum.ts index 529282a..5637ef2 100644 --- a/eims-ui/packages/@core/base/shared/src/constants/dict-enum.ts +++ b/eims-ui/packages/@core/base/shared/src/constants/dict-enum.ts @@ -1,6 +1,10 @@ export enum DictEnum { EIMS_INVENTORY_DETAIL_STATU = 'inventory_detail_statu', // 璁惧鐩樼偣鐘舵�� EIMS_INVENTORY_STATU = 'inventory_statu', // 璁惧鐩樼偣鐘舵�� + REPAIR_REQ_STATUS = 'repair_req_status', // 鎶ヤ慨鐘舵�� + REPAIR_FAULT_TYPE = 'repair_fault_type', // 鎶ヤ慨鐘舵�� + REPAIR_REQ_TYPE = 'repair_req_type', // 鎶ヤ慨绫诲瀷 + REPAIR_URGENCY_LEVEL = 'repair_urgency_level', // 鎶ヤ慨绱ф�ョ▼搴� SYS_COMMON_STATUS = 'sys_common_status', SYS_DEVICE_TYPE = 'sys_device_type', // 璁惧绫诲瀷 SYS_EQU_STATUS = 'sys_equ_status', // 璁惧鐘舵�� diff --git a/eims/ruoyi-common/ruoyi-common-core/src/main/java/org/dromara/common/core/constant/CacheConstants.java b/eims/ruoyi-common/ruoyi-common-core/src/main/java/org/dromara/common/core/constant/CacheConstants.java index ceb8370..0b2d7c2 100644 --- a/eims/ruoyi-common/ruoyi-common-core/src/main/java/org/dromara/common/core/constant/CacheConstants.java +++ b/eims/ruoyi-common/ruoyi-common-core/src/main/java/org/dromara/common/core/constant/CacheConstants.java @@ -27,4 +27,10 @@ */ String PWD_ERR_CNT_KEY = "pwd_err_cnt:"; + /** + * 鐢熸垚鍗曞彿 redis key + * code缁勬垚瑙勫垯 prefix + 骞存湀鏃� + 搴忓彿 + */ + String EIMS_GENERATE_CODE = "eims_generate_code:"; + } diff --git a/eims/ruoyi-extend/ruoyi-snailjob-server/src/main/resources/application-dev.yml b/eims/ruoyi-extend/ruoyi-snailjob-server/src/main/resources/application-dev.yml index cbe40be..a8169ea 100644 --- a/eims/ruoyi-extend/ruoyi-snailjob-server/src/main/resources/application-dev.yml +++ b/eims/ruoyi-extend/ruoyi-snailjob-server/src/main/resources/application-dev.yml @@ -2,9 +2,9 @@ datasource: type: com.zaxxer.hikari.HikariDataSource driver-class-name: com.mysql.cj.jdbc.Driver - url: jdbc:mysql://localhost:3306/ry-vue?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true + url: jdbc:mysql://localhost:3306/eims?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true username: root - password: root + password: 123456 hikari: connection-timeout: 30000 validation-timeout: 5000 diff --git a/eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/controller/EimsRepairReqController.java b/eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/controller/EimsRepairReqController.java new file mode 100644 index 0000000..ac48037 --- /dev/null +++ b/eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/controller/EimsRepairReqController.java @@ -0,0 +1,106 @@ +package org.dromara.eims.controller; + +import java.util.List; + +import lombok.RequiredArgsConstructor; +import jakarta.servlet.http.HttpServletResponse; +import jakarta.validation.constraints.*; +import cn.dev33.satoken.annotation.SaCheckPermission; +import org.springframework.web.bind.annotation.*; +import org.springframework.validation.annotation.Validated; +import org.dromara.common.idempotent.annotation.RepeatSubmit; +import org.dromara.common.log.annotation.Log; +import org.dromara.common.web.core.BaseController; +import org.dromara.common.mybatis.core.page.PageQuery; +import org.dromara.common.core.domain.R; +import org.dromara.common.core.validate.AddGroup; +import org.dromara.common.core.validate.EditGroup; +import org.dromara.common.log.enums.BusinessType; +import org.dromara.common.excel.utils.ExcelUtil; +import org.dromara.eims.domain.vo.EimsRepairReqVo; +import org.dromara.eims.domain.bo.EimsRepairReqBo; +import org.dromara.eims.service.IEimsRepairReqService; +import org.dromara.common.mybatis.core.page.TableDataInfo; + +/** + * 鏁呴殰鎶ヤ慨 + * + * @author zhuguifei + * @date 2025-02-10 + */ +@Validated +@RequiredArgsConstructor +@RestController +@RequestMapping("/eims/repairReq") +public class EimsRepairReqController extends BaseController { + + private final IEimsRepairReqService eimsRepairReqService; + + /** + * 鏌ヨ鏁呴殰鎶ヤ慨鍒楄〃 + */ + @SaCheckPermission("eims:repairReq:list") + @GetMapping("/list") + public TableDataInfo<EimsRepairReqVo> list(EimsRepairReqBo bo, PageQuery pageQuery) { + //return eimsRepairReqService.queryPageList(bo, pageQuery); + return eimsRepairReqService.queryPageListCustom(bo, pageQuery); + } + + /** + * 瀵煎嚭鏁呴殰鎶ヤ慨鍒楄〃 + */ + @SaCheckPermission("eims:repairReq:export") + @Log(title = "鏁呴殰鎶ヤ慨", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(EimsRepairReqBo bo, HttpServletResponse response) { + List<EimsRepairReqVo> list = eimsRepairReqService.queryList(bo); + ExcelUtil.exportExcel(list, "鏁呴殰鎶ヤ慨", EimsRepairReqVo.class, response); + } + + /** + * 鑾峰彇鏁呴殰鎶ヤ慨璇︾粏淇℃伅 + * + * @param id 涓婚敭 + */ + @SaCheckPermission("eims:repairReq:query") + @GetMapping("/{id}") + public R<EimsRepairReqVo> getInfo(@NotNull(message = "涓婚敭涓嶈兘涓虹┖") + @PathVariable Long id) { + return R.ok(eimsRepairReqService.queryById(id)); + } + + /** + * 鏂板鏁呴殰鎶ヤ慨 + */ + @SaCheckPermission("eims:repairReq:add") + @Log(title = "鏁呴殰鎶ヤ慨", businessType = BusinessType.INSERT) + @RepeatSubmit() + @PostMapping() + public R<Void> add(@Validated(AddGroup.class) @RequestBody EimsRepairReqBo bo) { + return toAjax(eimsRepairReqService.insertByBo(bo)); + } + + /** + * 淇敼鏁呴殰鎶ヤ慨 + */ + @SaCheckPermission("eims:repairReq:edit") + @Log(title = "鏁呴殰鎶ヤ慨", businessType = BusinessType.UPDATE) + @RepeatSubmit() + @PutMapping() + public R<Void> edit(@Validated(EditGroup.class) @RequestBody EimsRepairReqBo bo) { + return toAjax(eimsRepairReqService.updateByBo(bo)); + } + + /** + * 鍒犻櫎鏁呴殰鎶ヤ慨 + * + * @param ids 涓婚敭涓� + */ + @SaCheckPermission("eims:repairReq:remove") + @Log(title = "鏁呴殰鎶ヤ慨", businessType = BusinessType.DELETE) + @DeleteMapping("/{ids}") + public R<Void> remove(@NotEmpty(message = "涓婚敭涓嶈兘涓虹┖") + @PathVariable Long[] ids) { + return toAjax(eimsRepairReqService.deleteWithValidByIds(List.of(ids), true)); + } +} diff --git a/eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/controller/GenerateCodeController.java b/eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/controller/GenerateCodeController.java new file mode 100644 index 0000000..9f7aac5 --- /dev/null +++ b/eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/controller/GenerateCodeController.java @@ -0,0 +1,59 @@ +package org.dromara.eims.controller; + +import jakarta.validation.constraints.NotNull; +import lombok.RequiredArgsConstructor; +import org.dromara.common.core.constant.CacheConstants; +import org.dromara.common.core.domain.R; +import org.dromara.common.redis.utils.RedisUtils; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import java.time.LocalDate; +import java.time.format.DateTimeFormatter; + + +/** + * 銆愮敓鎴愮紪鐮併�� + * + * @author zhuguifei + * @date 2025-02-11 + */ +@Validated +@RequiredArgsConstructor +@RestController +@RequestMapping("/eims/generate") +public class GenerateCodeController { + /** + * 鏍规嵁鍓嶇紑鐢熸垚鍚勭缂栫爜 + * + * @param prefix 鍓嶇紑 + * @return + */ + @GetMapping("/{prefix}") + public R<String> generateCode(@NotNull(message = "绫诲瀷涓嶈兘涓虹┖") + @PathVariable String prefix) { + String todayStr = DateTimeFormatter.ofPattern("yyyyMMdd").format(LocalDate.now()); + String key = CacheConstants.EIMS_GENERATE_CODE + ":" + prefix; + String code; + // 浣跨敤Redis鐨勫師瀛愭�ф搷浣滈伩鍏嶅苟鍙戦棶棰� + String oldCode = RedisUtils.getCacheObject(key); + if (oldCode != null && oldCode.contains(todayStr)) { + int no = Integer.parseInt(oldCode.substring(oldCode.length() - 4)); + code = String.format("%s%s%04d", prefix, todayStr, no + 1); + } else { + code = String.format("%s%s%04d", prefix, todayStr, 1); + } + // 鏇存柊缂撳瓨 + try { + RedisUtils.setCacheObject(key, code); + } catch (Exception e) { + return R.fail("鐢熸垚缂栫爜澶辫触锛岃绋嶅悗閲嶈瘯锛�"); + } + + return R.ok("鐢熸垚鎴愬姛锛�", code); + + } +} diff --git a/eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/domain/EimsRepairReq.java b/eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/domain/EimsRepairReq.java new file mode 100644 index 0000000..e8d2a0c --- /dev/null +++ b/eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/domain/EimsRepairReq.java @@ -0,0 +1,113 @@ +package org.dromara.eims.domain; + +import org.dromara.common.mybatis.core.domain.BaseEntity; +import com.baomidou.mybatisplus.annotation.*; +import lombok.Data; +import lombok.EqualsAndHashCode; +import java.util.Date; +import com.fasterxml.jackson.annotation.JsonFormat; + +import java.io.Serial; + +/** + * 鏁呴殰鎶ヤ慨瀵硅薄 eims_repair_req + * + * @author zhuguifei + * @date 2025-02-10 + */ +@Data +@EqualsAndHashCode(callSuper = true) +@TableName("eims_repair_req") +public class EimsRepairReq extends BaseEntity { + + @Serial + private static final long serialVersionUID = 1L; + + /** + * 鎶ヤ慨id + */ + @TableId(value = "id") + private Long id; + + /** + * 鎶ヤ慨鍗曞彿 + */ + private String code; + + /** + * 鎶ヤ慨鐘舵�� + */ + private String status; + + /** + * 鍙戠敓浜嬩欢 + */ + private Date occTime; + + /** + * 鎶ヤ慨鏃堕棿 + */ + private Date reqTime; + + /** + * 鎶ヤ慨浜洪儴闂� + */ + private Long reqDept; + + /** + * 鎶ヤ慨浜� + */ + private Long reqUser; + + /** + * 鎶ヤ慨鎻忚堪 + */ + private String reqDesc; + + /** + * 绱ф�ョ▼搴� + */ + private String urgencyLevel; + + /** + * 鏁呴殰鍥剧墖 + */ + private String faultPicture; + + /** + * 鎶ヤ慨绫诲瀷 + */ + private String reqType; + + /** + * 璁惧id + */ + private Long equId; + + /** + * 缁翠慨鍗昳d + */ + private Long repairId; + + /** + * 缁翠慨浜洪儴闂� + */ + private Long repairDept; + + /** + * 缁翠慨浜� + */ + private Long repairUser; + + /** + * 鏁呴殰绫诲埆 + */ + private String faultType; + + /** + * 澶囨敞 + */ + private String remark; + + +} diff --git a/eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/domain/bo/EimsRepairReqBo.java b/eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/domain/bo/EimsRepairReqBo.java new file mode 100644 index 0000000..d6f346e --- /dev/null +++ b/eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/domain/bo/EimsRepairReqBo.java @@ -0,0 +1,122 @@ +package org.dromara.eims.domain.bo; + +import org.dromara.eims.domain.EimsRepairReq; +import org.dromara.common.mybatis.core.domain.BaseEntity; +import org.dromara.common.core.validate.AddGroup; +import org.dromara.common.core.validate.EditGroup; +import io.github.linpeilie.annotations.AutoMapper; +import lombok.Data; +import lombok.EqualsAndHashCode; +import jakarta.validation.constraints.*; +import java.util.Date; +import com.fasterxml.jackson.annotation.JsonFormat; + +/** + * 鏁呴殰鎶ヤ慨涓氬姟瀵硅薄 eims_repair_req + * + * @author zhuguifei + * @date 2025-02-10 + */ +@Data +@EqualsAndHashCode(callSuper = true) +@AutoMapper(target = EimsRepairReq.class, reverseConvertGenerate = false) +public class EimsRepairReqBo extends BaseEntity { + + /** + * 鎶ヤ慨id + */ + @NotNull(message = "鎶ヤ慨id涓嶈兘涓虹┖", groups = { EditGroup.class }) + private Long id; + + /** + * 鎶ヤ慨鍗曞彿 + */ + @NotBlank(message = "鎶ヤ慨鍗曞彿涓嶈兘涓虹┖", groups = { AddGroup.class, EditGroup.class }) + private String code; + + /** + * 鎶ヤ慨鐘舵�� + */ + @NotBlank(message = "鎶ヤ慨鐘舵�佷笉鑳戒负绌�", groups = { AddGroup.class, EditGroup.class }) + private String status; + + /** + * 鍙戠敓鏃堕棿 + */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private Date occTime; + + /** + * 鎶ヤ慨鏃堕棿 + */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private Date reqTime; + + /** + * 鎶ヤ慨浜洪儴闂� + */ + @NotNull(message = "鎶ヤ慨浜洪儴闂ㄤ笉鑳戒负绌�", groups = { AddGroup.class, EditGroup.class }) + private Long reqDept; + + /** + * 鎶ヤ慨浜� + */ + @NotNull(message = "鎶ヤ慨浜轰笉鑳戒负绌�", groups = { AddGroup.class, EditGroup.class }) + private Long reqUser; + + /** + * 鎶ヤ慨鎻忚堪 + */ + @NotBlank(message = "鎶ヤ慨鎻忚堪涓嶈兘涓虹┖", groups = { AddGroup.class, EditGroup.class }) + private String reqDesc; + + /** + * 绱ф�ョ▼搴� + */ + @NotBlank(message = "绱ф�ョ▼搴︿笉鑳戒负绌�", groups = { AddGroup.class, EditGroup.class }) + private String urgencyLevel; + + /** + * 鏁呴殰鍥剧墖 + */ + private String faultPicture; + + /** + * 鎶ヤ慨绫诲瀷 + */ + @NotBlank(message = "鎶ヤ慨绫诲瀷涓嶈兘涓虹┖", groups = { AddGroup.class, EditGroup.class }) + private String reqType; + + /** + * 璁惧id + */ + private Long equId; + + /** + * 缁翠慨鍗昳d + */ + private Long repairId; + + /** + * 缁翠慨浜洪儴闂� + */ + private Long repairDept; + + /** + * 缁翠慨浜� + */ + private Long repairUser; + + /** + * 鏁呴殰绫诲埆 + */ + @NotBlank(message = "鏁呴殰绫诲埆涓嶈兘涓虹┖", groups = { AddGroup.class, EditGroup.class }) + private String faultType; + + /** + * 澶囨敞 + */ + private String remark; + + +} diff --git a/eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/domain/vo/EimsRepairReqVo.java b/eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/domain/vo/EimsRepairReqVo.java new file mode 100644 index 0000000..f1b6233 --- /dev/null +++ b/eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/domain/vo/EimsRepairReqVo.java @@ -0,0 +1,152 @@ +package org.dromara.eims.domain.vo; + +import java.util.Date; + +import com.fasterxml.jackson.annotation.JsonFormat; +import org.dromara.common.translation.annotation.Translation; +import org.dromara.common.translation.constant.TransConstant; +import org.dromara.eims.domain.EimsRepairReq; +import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; +import com.alibaba.excel.annotation.ExcelProperty; +import org.dromara.common.excel.annotation.ExcelDictFormat; +import org.dromara.common.excel.convert.ExcelDictConvert; +import io.github.linpeilie.annotations.AutoMapper; +import lombok.Data; + +import java.io.Serial; +import java.io.Serializable; +import java.util.Date; + + +/** + * 鏁呴殰鎶ヤ慨瑙嗗浘瀵硅薄 eims_repair_req + * + * @author zhuguifei + * @date 2025-02-10 + */ +@Data +@ExcelIgnoreUnannotated +@AutoMapper(target = EimsRepairReq.class) +public class EimsRepairReqVo implements Serializable { + + @Serial + private static final long serialVersionUID = 1L; + + /** + * 鎶ヤ慨id + */ + @ExcelProperty(value = "鎶ヤ慨id") + private Long id; + + /** + * 鎶ヤ慨鍗曞彿 + */ + @ExcelProperty(value = "鎶ヤ慨鍗曞彿") + private String code; + + /** + * 鎶ヤ慨鐘舵�� + */ + @ExcelProperty(value = "鎶ヤ慨鐘舵��") + private String status; + + /** + * 鍙戠敓浜嬩欢 + */ + @ExcelProperty(value = "鍙戠敓鏃堕棿") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private Date occTime; + + /** + * 鎶ヤ慨鏃堕棿 + */ + @ExcelProperty(value = "鎶ヤ慨鏃堕棿") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private Date reqTime; + + /** + * 鎶ヤ慨浜洪儴闂� + */ + @ExcelProperty(value = "鎶ヤ慨浜洪儴闂�") + private Long reqDept; + + @Translation(type = TransConstant.DEPT_ID_TO_NAME, mapper = "reqDept") + private String reqDeptName; + + /** + * 鎶ヤ慨浜� + */ + @ExcelProperty(value = "鎶ヤ慨浜�") + private Long reqUser; + + @Translation(type = TransConstant.USER_ID_TO_NICKNAME, mapper = "reqUser") + private String reqUserName; + + /** + * 鎶ヤ慨鎻忚堪 + */ + @ExcelProperty(value = "鎶ヤ慨鎻忚堪") + private String reqDesc; + + /** + * 绱ф�ョ▼搴� + */ + @ExcelProperty(value = "绱ф�ョ▼搴�") + private String urgencyLevel; + + /** + * 鏁呴殰鍥剧墖 + */ + @ExcelProperty(value = "鏁呴殰鍥剧墖") + private String faultPicture; + + /** + * 鎶ヤ慨绫诲瀷 + */ + @ExcelProperty(value = "鎶ヤ慨绫诲瀷") + private String reqType; + + /** + * 璁惧id + */ + @ExcelProperty(value = "璁惧id") + private Long equId; + + /** + * 缁翠慨鍗昳d + */ + @ExcelProperty(value = "缁翠慨鍗昳d") + private Long repairId; + + /** + * 缁翠慨浜洪儴闂� + */ + @ExcelProperty(value = "缁翠慨浜洪儴闂�") + private Long repairDept; + + /** + * 缁翠慨浜� + */ + @ExcelProperty(value = "缁翠慨浜�") + private Long repairUser; + + /** + * 鏁呴殰绫诲埆 + */ + @ExcelProperty(value = "鏁呴殰绫诲埆") + private String faultType; + + /** + * 澶囨敞 + */ + @ExcelProperty(value = "澶囨敞") + private String remark; + + private String equCode; + private String assetNo; + @Translation(type = TransConstant.EQU_ID_TO_NAME, mapper = "equId") + private String equName; + private String equLocation; + private String equTypeName; + +} diff --git a/eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/mapper/EimsRepairReqMapper.java b/eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/mapper/EimsRepairReqMapper.java new file mode 100644 index 0000000..f3c6ec4 --- /dev/null +++ b/eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/mapper/EimsRepairReqMapper.java @@ -0,0 +1,20 @@ +package org.dromara.eims.mapper; + +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.toolkit.Constants; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import org.apache.ibatis.annotations.Param; +import org.dromara.common.mybatis.core.mapper.BaseMapperPlus; +import org.dromara.eims.domain.EimsRepairReq; +import org.dromara.eims.domain.vo.EimsRepairReqVo; + +/** + * 鏁呴殰鎶ヤ慨Mapper鎺ュ彛 + * + * @author zhuguifei + * @date 2025-02-11 + */ +public interface EimsRepairReqMapper extends BaseMapperPlus<EimsRepairReq, EimsRepairReqVo> { + Page<EimsRepairReqVo> selectRepairReqList(@Param("page") Page<EimsRepairReqVo> page, @Param(Constants.WRAPPER) Wrapper<EimsRepairReq> queryWrapper); + +} diff --git a/eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/service/IEimsRepairReqService.java b/eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/service/IEimsRepairReqService.java new file mode 100644 index 0000000..858df95 --- /dev/null +++ b/eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/service/IEimsRepairReqService.java @@ -0,0 +1,78 @@ +package org.dromara.eims.service; + +import org.dromara.eims.domain.vo.EimsRepairReqVo; +import org.dromara.eims.domain.bo.EimsRepairReqBo; +import org.dromara.common.mybatis.core.page.TableDataInfo; +import org.dromara.common.mybatis.core.page.PageQuery; + +import java.util.Collection; +import java.util.List; + +/** + * 鏁呴殰鎶ヤ慨Service鎺ュ彛 + * + * @author zhuguifei + * @date 2025-02-10 + */ +public interface IEimsRepairReqService { + + /** + * 鏌ヨ鏁呴殰鎶ヤ慨 + * + * @param id 涓婚敭 + * @return 鏁呴殰鎶ヤ慨 + */ + EimsRepairReqVo queryById(Long id); + + /** + * 鍒嗛〉鏌ヨ鏁呴殰鎶ヤ慨鍒楄〃 + * + * @param bo 鏌ヨ鏉′欢 + * @param pageQuery 鍒嗛〉鍙傛暟 + * @return 鏁呴殰鎶ヤ慨鍒嗛〉鍒楄〃 + */ + TableDataInfo<EimsRepairReqVo> queryPageList(EimsRepairReqBo bo, PageQuery pageQuery); + + /** + * 鏌ヨ绗﹀悎鏉′欢鐨勬晠闅滄姤淇垪琛� + * + * @param bo 鏌ヨ鏉′欢 + * @return 鏁呴殰鎶ヤ慨鍒楄〃 + */ + List<EimsRepairReqVo> queryList(EimsRepairReqBo bo); + + /** + * 鏂板鏁呴殰鎶ヤ慨 + * + * @param bo 鏁呴殰鎶ヤ慨 + * @return 鏄惁鏂板鎴愬姛 + */ + Boolean insertByBo(EimsRepairReqBo bo); + + /** + * 淇敼鏁呴殰鎶ヤ慨 + * + * @param bo 鏁呴殰鎶ヤ慨 + * @return 鏄惁淇敼鎴愬姛 + */ + Boolean updateByBo(EimsRepairReqBo bo); + + /** + * 鏍¢獙骞舵壒閲忓垹闄ゆ晠闅滄姤淇俊鎭� + * + * @param ids 寰呭垹闄ょ殑涓婚敭闆嗗悎 + * @param isValid 鏄惁杩涜鏈夋晥鎬ф牎楠� + * @return 鏄惁鍒犻櫎鎴愬姛 + */ + Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid); + + + /** + * 鍒嗛〉鏌ヨ鏁呴殰鎶ヤ慨鍒楄〃-澶氳〃鏌ヨ + * + * @param bo 鏌ヨ鏉′欢 + * @param pageQuery 鍒嗛〉鍙傛暟 + * @return 鏁呴殰鎶ヤ慨鍒嗛〉鍒楄〃 + */ + TableDataInfo<EimsRepairReqVo> queryPageListCustom(EimsRepairReqBo bo, PageQuery pageQuery); +} diff --git a/eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/service/impl/EimsRepairReqServiceImpl.java b/eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/service/impl/EimsRepairReqServiceImpl.java new file mode 100644 index 0000000..42fa842 --- /dev/null +++ b/eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/service/impl/EimsRepairReqServiceImpl.java @@ -0,0 +1,170 @@ +package org.dromara.eims.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import org.dromara.common.core.utils.MapstructUtils; +import org.dromara.common.core.utils.StringUtils; +import org.dromara.common.mybatis.core.page.TableDataInfo; +import org.dromara.common.mybatis.core.page.PageQuery; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import lombok.RequiredArgsConstructor; +import org.dromara.eims.domain.EimsEqu; +import org.dromara.eims.domain.vo.EimsInventoryDetailVo; +import org.springframework.stereotype.Service; +import org.dromara.eims.domain.bo.EimsRepairReqBo; +import org.dromara.eims.domain.vo.EimsRepairReqVo; +import org.dromara.eims.domain.EimsRepairReq; +import org.dromara.eims.mapper.EimsRepairReqMapper; +import org.dromara.eims.service.IEimsRepairReqService; + +import java.util.List; +import java.util.Map; +import java.util.Collection; + +/** + * 鏁呴殰鎶ヤ慨Service涓氬姟灞傚鐞� + * + * @author zhuguifei + * @date 2025-02-10 + */ +@RequiredArgsConstructor +@Service +public class EimsRepairReqServiceImpl implements IEimsRepairReqService { + + private final EimsRepairReqMapper baseMapper; + + /** + * 鏌ヨ鏁呴殰鎶ヤ慨 + * + * @param id 涓婚敭 + * @return 鏁呴殰鎶ヤ慨 + */ + @Override + public EimsRepairReqVo queryById(Long id){ + return baseMapper.selectVoById(id); + } + + /** + * 鍒嗛〉鏌ヨ鏁呴殰鎶ヤ慨鍒楄〃 + * + * @param bo 鏌ヨ鏉′欢 + * @param pageQuery 鍒嗛〉鍙傛暟 + * @return 鏁呴殰鎶ヤ慨鍒嗛〉鍒楄〃 + */ + @Override + public TableDataInfo<EimsRepairReqVo> queryPageList(EimsRepairReqBo bo, PageQuery pageQuery) { + LambdaQueryWrapper<EimsRepairReq> lqw = buildQueryWrapper(bo); + Page<EimsRepairReqVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw); + return TableDataInfo.build(result); + } + + @Override + public TableDataInfo<EimsRepairReqVo> queryPageListCustom(EimsRepairReqBo bo, PageQuery pageQuery) { + Page<EimsRepairReqVo> page = baseMapper.selectRepairReqList(pageQuery.build(), buildWrapper(bo)); + return TableDataInfo.build(page); + } + + private QueryWrapper<EimsRepairReq> buildWrapper(EimsRepairReqBo bo) { + Map<String, Object> params = bo.getParams(); + QueryWrapper<EimsRepairReq> qw = Wrappers.query(); + qw.eq(StringUtils.isNotBlank(bo.getCode()),"code", bo.getCode()); + qw.eq(StringUtils.isNotBlank(bo.getStatus()), "status", bo.getStatus()); + qw.eq(bo.getReqTime() != null, "req_time", bo.getReqTime()); + qw.eq(bo.getReqDept() != null, "req_dept", bo.getReqDept()); + qw.eq(bo.getReqUser() != null,"req_user", bo.getReqUser()); + qw.eq(StringUtils.isNotBlank(bo.getUrgencyLevel()), "urgency_level", bo.getUrgencyLevel()); + qw.eq(StringUtils.isNotBlank(bo.getReqType()), "req_type", bo.getReqType()); + qw.eq(bo.getEquId() != null, "equ_id", bo.getEquId()); + qw.eq(bo.getRepairDept() != null,"repair_dept", bo.getRepairDept()); + qw.eq(bo.getRepairUser() != null, "repair_user", bo.getRepairUser()); + qw.eq(StringUtils.isNotBlank(bo.getFaultType()), "fault_type", bo.getFaultType()); + qw.between(params.get("beginReqTime") != null && params.get("endReqTime") != null, + "req_time", params.get("beginReqTime"), params.get("endReqTime")); + return qw; + } + + + /** + * 鏌ヨ绗﹀悎鏉′欢鐨勬晠闅滄姤淇垪琛� + * + * @param bo 鏌ヨ鏉′欢 + * @return 鏁呴殰鎶ヤ慨鍒楄〃 + */ + @Override + public List<EimsRepairReqVo> queryList(EimsRepairReqBo bo) { + LambdaQueryWrapper<EimsRepairReq> lqw = buildQueryWrapper(bo); + return baseMapper.selectVoList(lqw); + } + + private LambdaQueryWrapper<EimsRepairReq> buildQueryWrapper(EimsRepairReqBo bo) { + Map<String, Object> params = bo.getParams(); + LambdaQueryWrapper<EimsRepairReq> lqw = Wrappers.lambdaQuery(); + lqw.eq(StringUtils.isNotBlank(bo.getCode()), EimsRepairReq::getCode, bo.getCode()); + lqw.eq(StringUtils.isNotBlank(bo.getStatus()), EimsRepairReq::getStatus, bo.getStatus()); + lqw.eq(bo.getReqTime() != null, EimsRepairReq::getReqTime, bo.getReqTime()); + lqw.eq(bo.getReqDept() != null, EimsRepairReq::getReqDept, bo.getReqDept()); + lqw.eq(bo.getReqUser() != null, EimsRepairReq::getReqUser, bo.getReqUser()); + lqw.eq(StringUtils.isNotBlank(bo.getUrgencyLevel()), EimsRepairReq::getUrgencyLevel, bo.getUrgencyLevel()); + lqw.eq(StringUtils.isNotBlank(bo.getReqType()), EimsRepairReq::getReqType, bo.getReqType()); + lqw.eq(bo.getEquId() != null, EimsRepairReq::getEquId, bo.getEquId()); + lqw.eq(bo.getRepairDept() != null, EimsRepairReq::getRepairDept, bo.getRepairDept()); + lqw.eq(bo.getRepairUser() != null, EimsRepairReq::getRepairUser, bo.getRepairUser()); + lqw.eq(StringUtils.isNotBlank(bo.getFaultType()), EimsRepairReq::getFaultType, bo.getFaultType()); + return lqw; + } + + /** + * 鏂板鏁呴殰鎶ヤ慨 + * + * @param bo 鏁呴殰鎶ヤ慨 + * @return 鏄惁鏂板鎴愬姛 + */ + @Override + public Boolean insertByBo(EimsRepairReqBo bo) { + EimsRepairReq add = MapstructUtils.convert(bo, EimsRepairReq.class); + validEntityBeforeSave(add); + boolean flag = baseMapper.insert(add) > 0; + if (flag) { + bo.setId(add.getId()); + } + return flag; + } + + /** + * 淇敼鏁呴殰鎶ヤ慨 + * + * @param bo 鏁呴殰鎶ヤ慨 + * @return 鏄惁淇敼鎴愬姛 + */ + @Override + public Boolean updateByBo(EimsRepairReqBo bo) { + EimsRepairReq update = MapstructUtils.convert(bo, EimsRepairReq.class); + validEntityBeforeSave(update); + return baseMapper.updateById(update) > 0; + } + + /** + * 淇濆瓨鍓嶇殑鏁版嵁鏍¢獙 + */ + private void validEntityBeforeSave(EimsRepairReq entity){ + //TODO 鍋氫竴浜涙暟鎹牎楠�,濡傚敮涓�绾︽潫 + } + + /** + * 鏍¢獙骞舵壒閲忓垹闄ゆ晠闅滄姤淇俊鎭� + * + * @param ids 寰呭垹闄ょ殑涓婚敭闆嗗悎 + * @param isValid 鏄惁杩涜鏈夋晥鎬ф牎楠� + * @return 鏄惁鍒犻櫎鎴愬姛 + */ + @Override + public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) { + if(isValid){ + //TODO 鍋氫竴浜涗笟鍔′笂鐨勬牎楠�,鍒ゆ柇鏄惁闇�瑕佹牎楠� + } + return baseMapper.deleteByIds(ids) > 0; + } + + +} diff --git a/eims/ruoyi-modules/lb-eims/src/main/resources/mapper/eims/EimsRepairReqMapper.xml b/eims/ruoyi-modules/lb-eims/src/main/resources/mapper/eims/EimsRepairReqMapper.xml new file mode 100644 index 0000000..77129e0 --- /dev/null +++ b/eims/ruoyi-modules/lb-eims/src/main/resources/mapper/eims/EimsRepairReqMapper.xml @@ -0,0 +1,20 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<!DOCTYPE mapper +PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" +"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> +<mapper namespace="org.dromara.eims.mapper.EimsRepairReqMapper"> + <resultMap type="org.dromara.eims.domain.vo.EimsRepairReqVo" id="EimsRepairReqResult"> + </resultMap> + <select id="selectRepairReqList" resultMap="EimsRepairReqResult"> + SELECT a.*, + b.equ_code equCode, + b.asset_no assetNo, + b.equ_name equName, + b.location equLocation, + c.type_name equTypeName + FROM eims_repair_req a + LEFT JOIN eims_equ b on a.equ_id = b.equ_id + LEFT JOIN eims_equ_type c on b.equ_type_id = c.equ_type_id + ${ew.getCustomSqlSegment} + </select> +</mapper> -- Gitblit v1.9.3