¶Ô±ÈÐÂÎļþ |
| | |
| | | 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); |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | 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; |
| | | |
| | | /** |
| | | * ç»´ä¿®åid |
| | | */ |
| | | 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; |
| | | |
| | | /** |
| | | * ç»´ä¿®åid |
| | | */ |
| | | 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; |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | import { requestClient } from '#/api/request'; |
| | | |
| | | enum Api { |
| | | generateCode = '/eims/generate/' |
| | | } |
| | | |
| | | /** |
| | | * çæåç§åå· |
| | | * @param prefix åå·åç¼ |
| | | */ |
| | | export function generateCode(prefix: string) { |
| | | return requestClient.get<string>(`${Api.generateCode}/${prefix}`); |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <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> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <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> |
| | |
| | | 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'; |
| | |
| | | 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'; |
| | |
| | | fixed: 'left' |
| | | }, |
| | | { |
| | | title: '设å¤ç¼å·', |
| | | title: '设å¤ç¼ç ', |
| | | field: 'equCode', |
| | | sortable: true, |
| | | minWidth: 100 |
| | |
| | | // 左边é¨é¨ç¨ |
| | | const selectDeptId = ref<string[]>([]); |
| | | |
| | | defineExpose({ |
| | | tableSelect |
| | | }); |
| | | |
| | | const formOptions: VbenFormProps = { |
| | | commonConfig: { |
| | | labelWidth: 80, |
| | |
| | | // è¿ç¨æåº |
| | | remote: true, |
| | | // æ¯æå¤å段æåº é»è®¤å
³é |
| | | multiple: true, |
| | | multiple: true |
| | | }, |
| | | id: 'eims-equ-index' |
| | | }; |
| | |
| | | formOptions, |
| | | gridOptions, |
| | | gridEvents: { |
| | | sortChange: (sortParams) => vxeSortEvent(tableApi, sortParams), |
| | | }, |
| | | sortChange: (sortParams) => vxeSortEvent(tableApi, sortParams) |
| | | } |
| | | }); |
| | | |
| | | const [EquDrawer, equDrawerApi] = useVbenDrawer({ |
| | |
| | | function handleDetail(record: Recordable<any>) { |
| | | router.push(`/equ/detail/${record.equId}`); |
| | | } |
| | | // é䏿°æ® |
| | | function tableSelect() { |
| | | return tableApi.grid.getCheckboxRecords(); |
| | | } |
| | | </script> |
| | | |
| | | <template> |
| | |
| | | { |
| | | component: 'Input', |
| | | fieldName: 'equCode', |
| | | label: '设å¤ç¼å·' |
| | | label: '设å¤ç¼ç ' |
| | | }, |
| | | { |
| | | component: 'Input', |
| | |
| | | } |
| | | }, |
| | | { |
| | | title: '设å¤ç¼å·', |
| | | title: '设å¤ç¼ç ', |
| | | field: 'equCode', |
| | | minWidth: 120, |
| | | fixed: 'left' |
| | |
| | | /** æ ¹æ®é¨é¨IDå è½½ç¨æ· */ |
| | | await setupUserOptions(deptId); |
| | | /** åååéè¦éæ°éæ©ç¨æ· */ |
| | | formModel.respPerson = undefined; |
| | | formModel.inventoryUser = undefined; |
| | | }, |
| | | placeholder: 'è¯·éæ©', |
| | | showSearch: true, |
| | |
| | | /** æ ¹æ®é¨é¨IDå è½½ç¨æ· */ |
| | | await setupUserOptions(deptId); |
| | | /** åååéè¦éæ°éæ©ç¨æ· */ |
| | | formModel.respPerson = undefined; |
| | | formModel.inventoryUser = undefined; |
| | | }, |
| | | placeholder: 'è¯·éæ©', |
| | | showSearch: true, |
¶Ô±ÈÐÂÎļþ |
| | |
| | | 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', |
| | | // å¨draweréæ´æ° è¿éä¸éè¦é»è®¤ç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', |
| | | // å¨draweréæ´æ° è¿éä¸éè¦é»è®¤çcomponentProps |
| | | defaultValue: undefined, |
| | | fieldName: 'reqDept', |
| | | label: 'æ¥ä¿®é¨é¨', |
| | | help: `æ¥ä¿®äººåæå±é¨é¨` |
| | | // rules: 'selectRequired', |
| | | }, |
| | | { |
| | | component: 'Select', |
| | | componentProps: { |
| | | showSearch: true, |
| | | allowClear: true, |
| | | getPopupContainer |
| | | }, |
| | | fieldName: 'reqUser', |
| | | label: 'æ¥ä¿®äºº' |
| | | } |
| | | ]; |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <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> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <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> |
| | |
| | | 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', // 设å¤ç¶æ |
| | |
| | | */ |
| | | String PWD_ERR_CNT_KEY = "pwd_err_cnt:"; |
| | | |
| | | /** |
| | | * çæåå· redis key |
| | | * codeç»æè§å prefix + å¹´ææ¥ + åºå· |
| | | */ |
| | | String EIMS_GENERATE_CODE = "eims_generate_code:"; |
| | | |
| | | } |
| | |
| | | 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 |
¶Ô±ÈÐÂÎļþ |
| | |
| | | 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)); |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | 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); |
| | | |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | 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; |
| | | |
| | | /** |
| | | * ç»´ä¿®åid |
| | | */ |
| | | private Long repairId; |
| | | |
| | | /** |
| | | * 维修人é¨é¨ |
| | | */ |
| | | private Long repairDept; |
| | | |
| | | /** |
| | | * 维修人 |
| | | */ |
| | | private Long repairUser; |
| | | |
| | | /** |
| | | * æ
éç±»å« |
| | | */ |
| | | private String faultType; |
| | | |
| | | /** |
| | | * 夿³¨ |
| | | */ |
| | | private String remark; |
| | | |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | 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; |
| | | |
| | | /** |
| | | * ç»´ä¿®åid |
| | | */ |
| | | private Long repairId; |
| | | |
| | | /** |
| | | * 维修人é¨é¨ |
| | | */ |
| | | private Long repairDept; |
| | | |
| | | /** |
| | | * 维修人 |
| | | */ |
| | | private Long repairUser; |
| | | |
| | | /** |
| | | * æ
éç±»å« |
| | | */ |
| | | @NotBlank(message = "æ
éç±»å«ä¸è½ä¸ºç©º", groups = { AddGroup.class, EditGroup.class }) |
| | | private String faultType; |
| | | |
| | | /** |
| | | * 夿³¨ |
| | | */ |
| | | private String remark; |
| | | |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | 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; |
| | | |
| | | /** |
| | | * ç»´ä¿®åid |
| | | */ |
| | | @ExcelProperty(value = "ç»´ä¿®åid") |
| | | 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; |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | 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); |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | 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); |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | 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; |
| | | } |
| | | |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <?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> |