From 73d2ddaa437c174423409667650355632e4a5bbf Mon Sep 17 00:00:00 2001 From: skyouc Date: 星期一, 24 二月 2025 10:22:13 +0800 Subject: [PATCH] #新增 1. 新增数据字典管理功能 2. 新增字典数据集管理功能 3. 删除库存,库存信息管理功能 --- rsf-admin/src/page/dictType/DictTypeList.jsx | 43 - rsf-server/src/main/java/com/vincent/rsf/server/system/entity/DictType.java | 194 +++++++ rsf-server/src/main/java/com/vincent/rsf/server/system/service/impl/DictDataServiceImpl.java | 12 version/db/sys_dict_type.sql | 36 + rsf-server/src/main/java/com/vincent/rsf/server/system/service/DictDataService.java | 8 rsf-server/src/main/java/com/vincent/rsf/server/common/CodeBuilder.java | 6 rsf-admin/src/page/dictData/DictDataPanel.jsx | 48 - rsf-admin/src/page/dictType/DictTypePanel.jsx | 63 ++ rsf-admin/src/page/dictData/index.jsx | 8 rsf-server/src/main/java/com/vincent/rsf/server/system/entity/DictData.java | 229 ++++++++ rsf-server/src/main/java/com/vincent/rsf/server/system/mapper/DictTypeMapper.java | 12 version/db/sys_dict_data.sql | 40 + rsf-admin/src/page/dictData/DictDataCreate.jsx | 72 +- rsf-admin/src/page/dictData/DictDataEdit.jsx | 72 +- rsf-server/src/main/java/com/vincent/rsf/server/system/controller/DictTypeController.java | 110 ++++ rsf-admin/src/i18n/zh.js | 50 - rsf-server/src/main/resources/mapper/system/DictTypeMapper.xml | 5 rsf-server/src/main/java/dictData.sql | 27 + rsf-server/src/main/resources/mapper/system/DictDataMapper.xml | 5 rsf-admin/src/i18n/en.js | 48 - rsf-admin/src/page/ResourceContent.js | 12 rsf-admin/src/page/dictType/DictTypeCreate.jsx | 124 ++++ rsf-server/src/main/resources/mapper/manager/DictTypeMapper.xml | 5 rsf-admin/src/page/dictType/DictTypeEdit.jsx | 96 +++ rsf-server/src/main/java/com/vincent/rsf/server/system/service/impl/DictTypeServiceImpl.java | 12 rsf-admin/src/page/dictType/index.jsx | 18 /dev/null | 48 - rsf-admin/src/page/dictData/DictDataList.jsx | 50 - rsf-server/src/main/java/com/vincent/rsf/server/system/controller/DictDataController.java | 110 ++++ rsf-server/src/main/java/dictType.sql | 24 rsf-server/src/main/java/com/vincent/rsf/server/system/mapper/DictDataMapper.java | 12 rsf-server/src/main/java/com/vincent/rsf/server/system/service/DictTypeService.java | 8 32 files changed, 1,304 insertions(+), 303 deletions(-) diff --git a/rsf-admin/src/i18n/en.js b/rsf-admin/src/i18n/en.js index 0d2fe64..c1cf780 100644 --- a/rsf-admin/src/i18n/en.js +++ b/rsf-admin/src/i18n/en.js @@ -129,7 +129,12 @@ loc: 'Loc', container: 'Container', contract: 'Contract', - stockItem: 'StockItem', + qlyInspect: 'QlyInspect', + dictType: 'DictType', + dictData: 'DictData', + + + }, table: { field: { @@ -332,34 +337,21 @@ name: "Name", projectName: "ProjectName", }, - stockItem: { - stockId: "stockId", - matnrId: "matnrId", + qlyInspect: { code: "code", - matnrk: "matnrk", - anfme: "anfme", - workQty: "workQty", - qty: "qty", - weight: "weight", - unit: "unit", - shipperId: "shipperId", - splrId: "splrId", - brand: "brand", - batch: "batch", - prodTime: "prodTime", - inspectId: "inspectId", - splrBtch: "splrBtch", - asnOrder: "asnOrder", - erpToken: "erpToken", - erpOrder: "erpOrder", - erpStkAdr: "erpStkAdr", - locId: "locId", - barcode: "barcode", - purPrice: "purPrice", - lockReason: "lockReason", - lockStatus: "lockStatus", - locker: "locker", - lockedTime: "lockedTime", + name: "name", + }, + dictType: { + name: "name", + description: "description", + }, + dictData: { + dictTypeId: "dictTypeId", + dictTypeCode: "dictTypeCode", + value: "value", + label: "label", + sort: "sort", + color: "color", }, } }, diff --git a/rsf-admin/src/i18n/zh.js b/rsf-admin/src/i18n/zh.js index de93393..edbb37d 100644 --- a/rsf-admin/src/i18n/zh.js +++ b/rsf-admin/src/i18n/zh.js @@ -128,9 +128,10 @@ loc: '鍩虹搴撲綅', container: '瀹瑰櫒绠$悊', contract: '鍚堝悓淇℃伅', - stockItem: '搴撳瓨鏄庣粏', - stock: '搴撳瓨淇℃伅', qlyInspect: '璐ㄦ淇℃伅', + dictType: '鏁版嵁瀛楀吀', + dictData: '瀛楀吀鏁版嵁闆�', + }, @@ -336,43 +337,22 @@ name: "鍚嶇О", projectName: "椤圭洰鍚嶇О", }, - stock: { - asnOrder: "搴撳瓨鍗曟嵁", - erpToken: "ERP鍑瘉", - erpOrder: "ERP鍗曟嵁", - erpStkAdr: "ERP搴撳瓨鍦�", - contractId: "鍚堝悓鏍囪瘑", - lockReason: "鍔犻攣鍘熷洜", - lockStatus: "鍔犺浇鐘舵��", - locker: "鍔犻攣浜�", - lockedTime: "鍔犻攣鏃堕棿", - }, - stockItem: { - stockId: "搴撳瓨鏍囪瘑", - matnrId: "鐗╂枡鏍囪瘑", - code: "鐗╂枡缂栫爜", - matnrk: "鐗╂枡鍚嶇О", - anfme: "鏁伴噺", - workQty: "鎵ц涓暟閲�", - qty: "宸插畬鎴愭暟閲�", - weight: "閲嶉噺", - unit: "鍗曚綅", - shipperId: "璐т富", - splrId: "渚涘簲鍟�", - brand: "鍝佺墝", - batch: "鎵规", - prodTime: "鐢熶骇鏃ユ湡", - inspectId: "璐ㄦ煡鏍囪瘑", - splrBtch: "渚涘簲鍟嗘壒娆�", - locId: "搴撲綅鏍囪瘑", - barcode: "瀹瑰櫒缂栫爜", - purPrice: "閲囪喘浠�", - }, qlyInspect: { code: "缂栫爜", name: "鍚嶇О", }, - + dictType: { + name: "瀛楀吀鍚嶇О", + description: "鍐呭鎻忚堪", + }, + dictData: { + dictTypeId: "瀛楀吀鏍囪瘑", + dictTypeCode: "瀛楀吀缂栫爜", + value: "鍊�", + label: "鍒悕", + sort: "鎺掑簭", + color: "棰滆壊", + }, } }, page: { diff --git a/rsf-admin/src/page/ResourceContent.js b/rsf-admin/src/page/ResourceContent.js index d91a310..4fe2594 100644 --- a/rsf-admin/src/page/ResourceContent.js +++ b/rsf-admin/src/page/ResourceContent.js @@ -22,9 +22,9 @@ import loc from './loc'; import container from './container'; import contract from './contract'; -import stockItem from './stockItem'; -import stock from './stock'; import qlyInspect from './qlyInspect'; +import dictType from './dictType'; +import dictData from './dictData'; const ResourceContent = (node) => { @@ -65,12 +65,12 @@ return container; case 'contract': return contract; - case 'stockItem': - return stockItem; - case 'stock': - return stock; case 'qlyInspect': return qlyInspect; + case 'dictType': + return dictType; + case 'dictData': + return dictData; default: return { list: ListGuesser, diff --git a/rsf-admin/src/page/stock/StockCreate.jsx b/rsf-admin/src/page/dictData/DictDataCreate.jsx similarity index 72% rename from rsf-admin/src/page/stock/StockCreate.jsx rename to rsf-admin/src/page/dictData/DictDataCreate.jsx index 75fccd1..2c609cc 100644 --- a/rsf-admin/src/page/stock/StockCreate.jsx +++ b/rsf-admin/src/page/dictData/DictDataCreate.jsx @@ -31,7 +31,7 @@ import StatusSelectInput from "../components/StatusSelectInput"; import MemoInput from "../components/MemoInput"; -const StockCreate = (props) => { +const DictDataCreate = (props) => { const { open, setOpen } = props; const translate = useTranslate(); @@ -86,8 +86,8 @@ <Grid container rowSpacing={2} columnSpacing={2}> <Grid item xs={6} display="flex" gap={1}> <TextInput - label="table.field.stock.asnOrder" - source="asnOrder" + label="table.field.dictData.dictTypeId" + source="dictTypeId" parse={v => v} autoFocus validate={required()} @@ -95,57 +95,39 @@ </Grid> <Grid item xs={6} display="flex" gap={1}> <TextInput - label="table.field.stock.erpToken" - source="erpToken" + label="table.field.dictData.dictTypeCode" + source="dictTypeCode" parse={v => v} - /> - </Grid> - <Grid item xs={6} display="flex" gap={1}> - <TextInput - label="table.field.stock.erpOrder" - source="erpOrder" - parse={v => v} - /> - </Grid> - <Grid item xs={6} display="flex" gap={1}> - <TextInput - label="table.field.stock.erpStkAdr" - source="erpStkAdr" - parse={v => v} - /> - </Grid> - <Grid item xs={6} display="flex" gap={1}> - <TextInput - label="table.field.stock.contractId" - source="contractId" - parse={v => v} - /> - </Grid> - <Grid item xs={6} display="flex" gap={1}> - <TextInput - label="table.field.stock.lockReason" - source="lockReason" - parse={v => v} - /> - </Grid> - <Grid item xs={6} display="flex" gap={1}> - <NumberInput - label="table.field.stock.lockStatus" - source="lockStatus" validate={required()} /> </Grid> <Grid item xs={6} display="flex" gap={1}> <TextInput - label="table.field.stock.locker" - source="locker" + label="table.field.dictData.value" + source="value" parse={v => v} + validate={required()} /> </Grid> <Grid item xs={6} display="flex" gap={1}> - <DateInput - label="table.field.stock.lockedTime" - source="lockedTime" + <TextInput + label="table.field.dictData.label" + source="label" + parse={v => v} + validate={required()} + /> + </Grid> + <Grid item xs={6} display="flex" gap={1}> + <NumberInput + label="table.field.dictData.sort" + source="sort" + /> + </Grid> + <Grid item xs={6} display="flex" gap={1}> + <TextInput + label="table.field.dictData.color" + source="color" + parse={v => v} /> </Grid> @@ -171,4 +153,4 @@ ) } -export default StockCreate; +export default DictDataCreate; diff --git a/rsf-admin/src/page/stock/StockEdit.jsx b/rsf-admin/src/page/dictData/DictDataEdit.jsx similarity index 68% rename from rsf-admin/src/page/stock/StockEdit.jsx rename to rsf-admin/src/page/dictData/DictDataEdit.jsx index 384dd79..b267372 100644 --- a/rsf-admin/src/page/stock/StockEdit.jsx +++ b/rsf-admin/src/page/dictData/DictDataEdit.jsx @@ -40,7 +40,7 @@ ) } -const StockEdit = () => { +const DictDataEdit = () => { const translate = useTranslate(); return ( @@ -65,8 +65,8 @@ </Typography> <Stack direction='row' gap={2}> <TextInput - label="table.field.stock.asnOrder" - source="asnOrder" + label="table.field.dictData.dictTypeId" + source="dictTypeId" parse={v => v} autoFocus validate={required()} @@ -74,57 +74,39 @@ </Stack> <Stack direction='row' gap={2}> <TextInput - label="table.field.stock.erpToken" - source="erpToken" + label="table.field.dictData.dictTypeCode" + source="dictTypeCode" parse={v => v} - /> - </Stack> - <Stack direction='row' gap={2}> - <TextInput - label="table.field.stock.erpOrder" - source="erpOrder" - parse={v => v} - /> - </Stack> - <Stack direction='row' gap={2}> - <TextInput - label="table.field.stock.erpStkAdr" - source="erpStkAdr" - parse={v => v} - /> - </Stack> - <Stack direction='row' gap={2}> - <TextInput - label="table.field.stock.contractId" - source="contractId" - parse={v => v} - /> - </Stack> - <Stack direction='row' gap={2}> - <TextInput - label="table.field.stock.lockReason" - source="lockReason" - parse={v => v} - /> - </Stack> - <Stack direction='row' gap={2}> - <NumberInput - label="table.field.stock.lockStatus" - source="lockStatus" validate={required()} /> </Stack> <Stack direction='row' gap={2}> <TextInput - label="table.field.stock.locker" - source="locker" + label="table.field.dictData.value" + source="value" parse={v => v} + validate={required()} /> </Stack> <Stack direction='row' gap={2}> - <DateInput - label="table.field.stock.lockedTime" - source="lockedTime" + <TextInput + label="table.field.dictData.label" + source="label" + parse={v => v} + validate={required()} + /> + </Stack> + <Stack direction='row' gap={2}> + <NumberInput + label="table.field.dictData.sort" + source="sort" + /> + </Stack> + <Stack direction='row' gap={2}> + <TextInput + label="table.field.dictData.color" + source="color" + parse={v => v} /> </Stack> @@ -143,4 +125,4 @@ ) } -export default StockEdit; +export default DictDataEdit; diff --git a/rsf-admin/src/page/stock/StockList.jsx b/rsf-admin/src/page/dictData/DictDataList.jsx similarity index 72% copy from rsf-admin/src/page/stock/StockList.jsx copy to rsf-admin/src/page/dictData/DictDataList.jsx index a6f49fa..d20971b 100644 --- a/rsf-admin/src/page/stock/StockList.jsx +++ b/rsf-admin/src/page/dictData/DictDataList.jsx @@ -34,8 +34,8 @@ } from 'react-admin'; import { Box, Typography, Card, Stack } from '@mui/material'; import { styled } from '@mui/material/styles'; -import StockCreate from "./StockCreate"; -import StockPanel from "./StockPanel"; +import DictDataCreate from "./DictDataCreate"; +import DictDataPanel from "./DictDataPanel"; import EmptyData from "../components/EmptyData"; import MyCreateButton from "../components/MyCreateButton"; import MyExportButton from '../components/MyExportButton'; @@ -63,15 +63,12 @@ <DateInput label='common.time.after' source="timeStart" alwaysOn />, <DateInput label='common.time.before' source="timeEnd" alwaysOn />, - <TextInput source="asnOrder" label="table.field.stock.asnOrder" />, - <TextInput source="erpToken" label="table.field.stock.erpToken" />, - <TextInput source="erpOrder" label="table.field.stock.erpOrder" />, - <TextInput source="erpStkAdr" label="table.field.stock.erpStkAdr" />, - <TextInput source="contractId" label="table.field.stock.contractId" />, - <TextInput source="lockReason" label="table.field.stock.lockReason" />, - <NumberInput source="lockStatus" label="table.field.stock.lockStatus" />, - <TextInput source="locker" label="table.field.stock.locker" />, - <DateInput source="lockedTime" label="table.field.stock.lockedTime" />, + <TextInput source="dictTypeId" label="table.field.dictData.dictTypeId" />, + <TextInput source="dictTypeCode" label="table.field.dictData.dictTypeCode" />, + <TextInput source="value" label="table.field.dictData.value" />, + <TextInput source="label" label="table.field.dictData.label" />, + <NumberInput source="sort" label="table.field.dictData.sort" />, + <TextInput source="color" label="table.field.dictData.color" />, <TextInput label="common.field.memo" source="memo" />, <SelectInput @@ -85,7 +82,7 @@ />, ] -const StockList = () => { +const DictDataList = () => { const translate = useTranslate(); const [createDialog, setCreateDialog] = useState(false); @@ -102,7 +99,7 @@ }), marginRight: !!drawerVal ? `${PAGE_DRAWER_WIDTH}px` : 0, }} - title={"menu.stock"} + title={"menu.dictData"} empty={<EmptyData onClick={() => { setCreateDialog(true) }} />} filters={filters} sort={{ field: "create_time", order: "desc" }} @@ -110,30 +107,27 @@ <TopToolbar> <FilterButton /> <MyCreateButton onClick={() => { setCreateDialog(true) }} /> - <SelectColumnsButton preferenceKey='stock' /> + <SelectColumnsButton preferenceKey='dictData' /> <MyExportButton /> </TopToolbar> )} perPage={DEFAULT_PAGE_SIZE} > <StyledDatagrid - preferenceKey='stock' + preferenceKey='dictData' bulkActionButtons={() => <BulkDeleteButton mutationMode={OPERATE_MODE} />} rowClick={(id, resource, record) => false} - expand={() => <StockPanel />} + expand={() => <DictDataPanel />} expandSingle={true} omit={['id', 'createTime', 'createBy', 'memo']} > <NumberField source="id" /> - <TextField source="asnOrder" label="table.field.stock.asnOrder" /> - <TextField source="erpToken" label="table.field.stock.erpToken" /> - <TextField source="erpOrder" label="table.field.stock.erpOrder" /> - <TextField source="erpStkAdr" label="table.field.stock.erpStkAdr" /> - <TextField source="contractId" label="table.field.stock.contractId" /> - <TextField source="lockReason" label="table.field.stock.lockReason" /> - <NumberField source="lockStatus" label="table.field.stock.lockStatus" /> - <TextField source="locker" label="table.field.stock.locker" /> - <DateField source="lockedTime" label="table.field.stock.lockedTime" showTime /> + <TextField source="dictTypeId" label="table.field.dictData.dictTypeId" /> + <TextField source="dictTypeCode" label="table.field.dictData.dictTypeCode" /> + <TextField source="value" label="table.field.dictData.value" /> + <TextField source="label" label="table.field.dictData.label" /> + <NumberField source="sort" label="table.field.dictData.sort" /> + <TextField source="color" label="table.field.dictData.color" /> <ReferenceField source="updateBy" label="common.field.updateBy" reference="user" link={false} sortable={false}> <TextField source="nickname" /> @@ -151,12 +145,12 @@ </WrapperField> </StyledDatagrid> </List> - <StockCreate + <DictDataCreate open={createDialog} setOpen={setCreateDialog} /> <PageDrawer - title='Stock Detail' + title='DictData Detail' drawerVal={drawerVal} setDrawerVal={setDrawerVal} > @@ -165,4 +159,4 @@ ) } -export default StockList; +export default DictDataList; diff --git a/rsf-admin/src/page/stock/StockPanel.jsx b/rsf-admin/src/page/dictData/DictDataPanel.jsx similarity index 64% rename from rsf-admin/src/page/stock/StockPanel.jsx rename to rsf-admin/src/page/dictData/DictDataPanel.jsx index d018da4..557a79c 100644 --- a/rsf-admin/src/page/stock/StockPanel.jsx +++ b/rsf-admin/src/page/dictData/DictDataPanel.jsx @@ -7,7 +7,7 @@ import PanelTypography from "../components/PanelTypography"; import * as Common from '@/utils/common' -const StockPanel = () => { +const DictDataPanel = () => { const record = useRecordContext(); if (!record) return null; const translate = useTranslate(); @@ -23,7 +23,7 @@ overflow: 'hidden', textOverflow: 'ellipsis', }}> - {Common.camelToPascalWithSpaces(translate('table.field.stock.id'))}: {record.id} + {Common.camelToPascalWithSpaces(translate('table.field.dictData.id'))}: {record.id} </Typography> {/* inherit, primary, secondary, textPrimary, textSecondary, error */} <Typography variant="h6" gutterBottom align="right" > @@ -42,56 +42,38 @@ <Grid container spacing={2}> <Grid item xs={6}> <PanelTypography - title="table.field.stock.asnOrder" - property={record.asnOrder} + title="table.field.dictData.dictTypeId" + property={record.dictTypeId$} /> </Grid> <Grid item xs={6}> <PanelTypography - title="table.field.stock.erpToken" - property={record.erpToken} + title="table.field.dictData.dictTypeCode" + property={record.dictTypeCode} /> </Grid> <Grid item xs={6}> <PanelTypography - title="table.field.stock.erpOrder" - property={record.erpOrder} + title="table.field.dictData.value" + property={record.value} /> </Grid> <Grid item xs={6}> <PanelTypography - title="table.field.stock.erpStkAdr" - property={record.erpStkAdr} + title="table.field.dictData.label" + property={record.label} /> </Grid> <Grid item xs={6}> <PanelTypography - title="table.field.stock.contractId" - property={record.contractId$} + title="table.field.dictData.sort" + property={record.sort} /> </Grid> <Grid item xs={6}> <PanelTypography - title="table.field.stock.lockReason" - property={record.lockReason} - /> - </Grid> - <Grid item xs={6}> - <PanelTypography - title="table.field.stock.lockStatus" - property={record.lockStatus} - /> - </Grid> - <Grid item xs={6}> - <PanelTypography - title="table.field.stock.locker" - property={record.locker} - /> - </Grid> - <Grid item xs={6}> - <PanelTypography - title="table.field.stock.lockedTime" - property={record.lockedTime$} + title="table.field.dictData.color" + property={record.color} /> </Grid> @@ -102,4 +84,4 @@ ); }; -export default StockPanel; +export default DictDataPanel; diff --git a/rsf-admin/src/page/stock/index.jsx b/rsf-admin/src/page/dictData/index.jsx similarity index 66% rename from rsf-admin/src/page/stock/index.jsx rename to rsf-admin/src/page/dictData/index.jsx index 6f846bf..31b11ac 100644 --- a/rsf-admin/src/page/stock/index.jsx +++ b/rsf-admin/src/page/dictData/index.jsx @@ -5,12 +5,12 @@ ShowGuesser, } from "react-admin"; -import StockList from "./StockList"; -import StockEdit from "./StockEdit"; +import DictDataList from "./DictDataList"; +import DictDataEdit from "./DictDataEdit"; export default { - list: StockList, - edit: StockEdit, + list: DictDataList, + edit: DictDataEdit, show: ShowGuesser, recordRepresentation: (record) => { return `${record.id}` diff --git a/rsf-admin/src/page/dictType/DictTypeCreate.jsx b/rsf-admin/src/page/dictType/DictTypeCreate.jsx new file mode 100644 index 0000000..1425007 --- /dev/null +++ b/rsf-admin/src/page/dictType/DictTypeCreate.jsx @@ -0,0 +1,124 @@ +import React, { useState, useRef, useEffect, useMemo } from "react"; +import { + CreateBase, + useTranslate, + TextInput, + NumberInput, + BooleanInput, + DateInput, + SaveButton, + SelectInput, + ReferenceInput, + ReferenceArrayInput, + AutocompleteInput, + Toolbar, + required, + useDataProvider, + useNotify, + Form, + useCreateController, +} from 'react-admin'; +import { + Dialog, + DialogActions, + DialogContent, + DialogTitle, + Stack, + Grid, + Box, +} from '@mui/material'; +import DialogCloseButton from "../components/DialogCloseButton"; +import StatusSelectInput from "../components/StatusSelectInput"; +import MemoInput from "../components/MemoInput"; + +const DictTypeCreate = (props) => { + const { open, setOpen } = props; + + const translate = useTranslate(); + const notify = useNotify(); + + const handleClose = (event, reason) => { + if (reason !== "backdropClick") { + setOpen(false); + } + }; + + const handleSuccess = async (data) => { + setOpen(false); + notify('common.response.success'); + }; + + const handleError = async (error) => { + notify(error.message || 'common.response.fail', { type: 'error', messageArgs: { _: error.message } }); + }; + + return ( + <> + <CreateBase + record={{}} + transform={(data) => { + return data; + }} + mutationOptions={{ onSuccess: handleSuccess, onError: handleError }} + > + <Dialog + open={open} + onClose={handleClose} + aria-labelledby="form-dialog-title" + fullWidth + disableRestoreFocus + maxWidth="md" // 'xs' | 'sm' | 'md' | 'lg' | 'xl' + > + <Form> + <DialogTitle id="form-dialog-title" sx={{ + position: 'sticky', + top: 0, + backgroundColor: 'background.paper', + zIndex: 1000 + }} + > + {translate('create.title')} + <Box sx={{ position: 'absolute', top: 8, right: 8, zIndex: 1001 }}> + <DialogCloseButton onClose={handleClose} /> + </Box> + </DialogTitle> + <DialogContent sx={{ mt: 2 }}> + <Grid container rowSpacing={2} columnSpacing={2}> + <Grid item xs={6} display="flex" gap={1}> + <TextInput + label="table.field.dictType.name" + source="name" + parse={v => v} + /> + </Grid> + <Grid item xs={6} display="flex" gap={1}> + <TextInput + label="table.field.dictType.description" + source="description" + parse={v => v} + /> + </Grid> + + <Grid item xs={6} display="flex" gap={1}> + <StatusSelectInput /> + </Grid> + <Grid item xs={12} display="flex" gap={1}> + <Stack direction="column" spacing={1} width={'100%'}> + <MemoInput /> + </Stack> + </Grid> + </Grid> + </DialogContent> + <DialogActions sx={{ position: 'sticky', bottom: 0, backgroundColor: 'background.paper', zIndex: 1000 }}> + <Toolbar sx={{ width: '100%', justifyContent: 'space-between' }} > + <SaveButton /> + </Toolbar> + </DialogActions> + </Form> + </Dialog> + </CreateBase> + </> + ) +} + +export default DictTypeCreate; diff --git a/rsf-admin/src/page/dictType/DictTypeEdit.jsx b/rsf-admin/src/page/dictType/DictTypeEdit.jsx new file mode 100644 index 0000000..31ac57a --- /dev/null +++ b/rsf-admin/src/page/dictType/DictTypeEdit.jsx @@ -0,0 +1,96 @@ +import React, { useState, useRef, useEffect, useMemo } from "react"; +import { + Edit, + SimpleForm, + FormDataConsumer, + useTranslate, + TextInput, + NumberInput, + BooleanInput, + DateInput, + SelectInput, + ReferenceInput, + ReferenceArrayInput, + AutocompleteInput, + SaveButton, + Toolbar, + Labeled, + NumberField, + required, + useRecordContext, + DeleteButton, +} from 'react-admin'; +import { useWatch, useFormContext } from "react-hook-form"; +import { Stack, Grid, Box, Typography } from '@mui/material'; +import * as Common from '@/utils/common'; +import { EDIT_MODE, REFERENCE_INPUT_PAGESIZE } from '@/config/setting'; +import EditBaseAside from "../components/EditBaseAside"; +import CustomerTopToolBar from "../components/EditTopToolBar"; +import MemoInput from "../components/MemoInput"; +import StatusSelectInput from "../components/StatusSelectInput"; + +const FormToolbar = () => { + const { getValues } = useFormContext(); + + return ( + <Toolbar sx={{ justifyContent: 'space-between' }}> + <SaveButton /> + <DeleteButton mutationMode="optimistic" /> + </Toolbar> + ) +} + +const DictTypeEdit = () => { + const translate = useTranslate(); + + return ( + <Edit + redirect="list" + mutationMode={EDIT_MODE} + actions={<CustomerTopToolBar />} + aside={<EditBaseAside />} + > + <SimpleForm + shouldUnregister + warnWhenUnsavedChanges + toolbar={<FormToolbar />} + mode="onTouched" + defaultValues={{}} + // validate={(values) => { }} + > + <Grid container width={{ xs: '100%', xl: '80%' }} rowSpacing={3} columnSpacing={3}> + <Grid item xs={12} md={8}> + <Typography variant="h6" gutterBottom> + {translate('common.edit.title.main')} + </Typography> + <Stack direction='row' gap={2}> + <TextInput + label="table.field.dictType.name" + source="name" + parse={v => v} + /> + </Stack> + <Stack direction='row' gap={2}> + <TextInput + label="table.field.dictType.description" + source="description" + parse={v => v} + /> + </Stack> + + </Grid> + <Grid item xs={12} md={4}> + <Typography variant="h6" gutterBottom> + {translate('common.edit.title.common')} + </Typography> + <StatusSelectInput /> + <Box mt="2em" /> + <MemoInput /> + </Grid> + </Grid> + </SimpleForm> + </Edit > + ) +} + +export default DictTypeEdit; diff --git a/rsf-admin/src/page/stock/StockList.jsx b/rsf-admin/src/page/dictType/DictTypeList.jsx similarity index 72% rename from rsf-admin/src/page/stock/StockList.jsx rename to rsf-admin/src/page/dictType/DictTypeList.jsx index a6f49fa..d668008 100644 --- a/rsf-admin/src/page/stock/StockList.jsx +++ b/rsf-admin/src/page/dictType/DictTypeList.jsx @@ -34,8 +34,8 @@ } from 'react-admin'; import { Box, Typography, Card, Stack } from '@mui/material'; import { styled } from '@mui/material/styles'; -import StockCreate from "./StockCreate"; -import StockPanel from "./StockPanel"; +import DictTypeCreate from "./DictTypeCreate"; +import DictTypePanel from "./DictTypePanel"; import EmptyData from "../components/EmptyData"; import MyCreateButton from "../components/MyCreateButton"; import MyExportButton from '../components/MyExportButton'; @@ -63,15 +63,9 @@ <DateInput label='common.time.after' source="timeStart" alwaysOn />, <DateInput label='common.time.before' source="timeEnd" alwaysOn />, - <TextInput source="asnOrder" label="table.field.stock.asnOrder" />, - <TextInput source="erpToken" label="table.field.stock.erpToken" />, - <TextInput source="erpOrder" label="table.field.stock.erpOrder" />, - <TextInput source="erpStkAdr" label="table.field.stock.erpStkAdr" />, - <TextInput source="contractId" label="table.field.stock.contractId" />, - <TextInput source="lockReason" label="table.field.stock.lockReason" />, - <NumberInput source="lockStatus" label="table.field.stock.lockStatus" />, - <TextInput source="locker" label="table.field.stock.locker" />, - <DateInput source="lockedTime" label="table.field.stock.lockedTime" />, + <TextInput source="uuid" label="table.field.dictType.uuid" />, + <TextInput source="name" label="table.field.dictType.name" />, + <TextInput source="description" label="table.field.dictType.description" />, <TextInput label="common.field.memo" source="memo" />, <SelectInput @@ -85,7 +79,7 @@ />, ] -const StockList = () => { +const DictTypeList = () => { const translate = useTranslate(); const [createDialog, setCreateDialog] = useState(false); @@ -102,7 +96,7 @@ }), marginRight: !!drawerVal ? `${PAGE_DRAWER_WIDTH}px` : 0, }} - title={"menu.stock"} + title={"menu.dictType"} empty={<EmptyData onClick={() => { setCreateDialog(true) }} />} filters={filters} sort={{ field: "create_time", order: "desc" }} @@ -110,30 +104,23 @@ <TopToolbar> <FilterButton /> <MyCreateButton onClick={() => { setCreateDialog(true) }} /> - <SelectColumnsButton preferenceKey='stock' /> + <SelectColumnsButton preferenceKey='dictType' /> <MyExportButton /> </TopToolbar> )} perPage={DEFAULT_PAGE_SIZE} > <StyledDatagrid - preferenceKey='stock' + preferenceKey='dictType' bulkActionButtons={() => <BulkDeleteButton mutationMode={OPERATE_MODE} />} rowClick={(id, resource, record) => false} - expand={() => <StockPanel />} + expand={() => <DictTypePanel />} expandSingle={true} omit={['id', 'createTime', 'createBy', 'memo']} > <NumberField source="id" /> - <TextField source="asnOrder" label="table.field.stock.asnOrder" /> - <TextField source="erpToken" label="table.field.stock.erpToken" /> - <TextField source="erpOrder" label="table.field.stock.erpOrder" /> - <TextField source="erpStkAdr" label="table.field.stock.erpStkAdr" /> - <TextField source="contractId" label="table.field.stock.contractId" /> - <TextField source="lockReason" label="table.field.stock.lockReason" /> - <NumberField source="lockStatus" label="table.field.stock.lockStatus" /> - <TextField source="locker" label="table.field.stock.locker" /> - <DateField source="lockedTime" label="table.field.stock.lockedTime" showTime /> + <TextField source="name" label="table.field.dictType.name" /> + <TextField source="description" label="table.field.dictType.description" /> <ReferenceField source="updateBy" label="common.field.updateBy" reference="user" link={false} sortable={false}> <TextField source="nickname" /> @@ -151,12 +138,12 @@ </WrapperField> </StyledDatagrid> </List> - <StockCreate + <DictTypeCreate open={createDialog} setOpen={setCreateDialog} /> <PageDrawer - title='Stock Detail' + title='DictType Detail' drawerVal={drawerVal} setDrawerVal={setDrawerVal} > @@ -165,4 +152,4 @@ ) } -export default StockList; +export default DictTypeList; diff --git a/rsf-admin/src/page/dictType/DictTypePanel.jsx b/rsf-admin/src/page/dictType/DictTypePanel.jsx new file mode 100644 index 0000000..846681f --- /dev/null +++ b/rsf-admin/src/page/dictType/DictTypePanel.jsx @@ -0,0 +1,63 @@ +import React, { useState, useRef, useEffect, useMemo } from "react"; +import { Box, Card, CardContent, Grid, Typography, Tooltip } from '@mui/material'; +import { + useTranslate, + useRecordContext, +} from 'react-admin'; +import PanelTypography from "../components/PanelTypography"; +import * as Common from '@/utils/common' + +const DictTypePanel = () => { + const record = useRecordContext(); + if (!record) return null; + const translate = useTranslate(); + return ( + <> + <Card sx={{ width: { xs: 300, sm: 500, md: 600, lg: 800 }, margin: 'auto' }}> + <CardContent> + <Grid container spacing={2}> + <Grid item xs={12} sx={{ display: 'flex', justifyContent: 'space-between' }}> + <Typography variant="h6" gutterBottom align="left" sx={{ + maxWidth: { xs: '100px', sm: '180px', md: '260px', lg: '360px' }, + whiteSpace: 'nowrap', + overflow: 'hidden', + textOverflow: 'ellipsis', + }}> + {Common.camelToPascalWithSpaces(translate('table.field.dictType.name'))}: {record.name} + </Typography> + {/* inherit, primary, secondary, textPrimary, textSecondary, error */} + <Typography variant="h6" gutterBottom align="right" > + ID: {record.id} + </Typography> + </Grid> + </Grid> + <Grid container spacing={2}> + <Grid item xs={12} container alignContent="flex-end"> + <Typography variant="caption" color="textSecondary" sx={{ wordWrap: 'break-word', wordBreak: 'break-all' }}> + {Common.camelToPascalWithSpaces(translate('common.field.memo'))}:{record.memo} + </Typography> + </Grid> + </Grid> + <Box height={20}> </Box> + <Grid container spacing={2}> + <Grid item xs={6}> + <PanelTypography + title="table.field.dictType.name" + property={record.name} + /> + </Grid> + <Grid item xs={6}> + <PanelTypography + title="table.field.dictType.description" + property={record.description} + /> + </Grid> + + </Grid> + </CardContent> + </Card > + </> + ); +}; + +export default DictTypePanel; diff --git a/rsf-admin/src/page/dictType/index.jsx b/rsf-admin/src/page/dictType/index.jsx new file mode 100644 index 0000000..7dc7dcb --- /dev/null +++ b/rsf-admin/src/page/dictType/index.jsx @@ -0,0 +1,18 @@ +import React, { useState, useRef, useEffect, useMemo } from "react"; +import { + ListGuesser, + EditGuesser, + ShowGuesser, +} from "react-admin"; + +import DictTypeList from "./DictTypeList"; +import DictTypeEdit from "./DictTypeEdit"; + +export default { + list: DictTypeList, + edit: DictTypeEdit, + show: ShowGuesser, + recordRepresentation: (record) => { + return `${record.name}` + } +}; diff --git a/rsf-admin/src/page/stockItem/StockItemCreate.jsx b/rsf-admin/src/page/stockItem/StockItemCreate.jsx deleted file mode 100644 index b604451..0000000 --- a/rsf-admin/src/page/stockItem/StockItemCreate.jsx +++ /dev/null @@ -1,318 +0,0 @@ -import React, { useState, useRef, useEffect, useMemo } from "react"; -import { - CreateBase, - useTranslate, - TextInput, - NumberInput, - BooleanInput, - DateInput, - SaveButton, - SelectInput, - ReferenceInput, - ReferenceArrayInput, - AutocompleteInput, - Toolbar, - required, - useDataProvider, - useNotify, - Form, - useCreateController, -} from 'react-admin'; -import { - Dialog, - DialogActions, - DialogContent, - DialogTitle, - Stack, - Grid, - Box, -} from '@mui/material'; -import DialogCloseButton from "../components/DialogCloseButton"; -import StatusSelectInput from "../components/StatusSelectInput"; -import MemoInput from "../components/MemoInput"; - -const StockItemCreate = (props) => { - const { open, setOpen } = props; - - const translate = useTranslate(); - const notify = useNotify(); - - const handleClose = (event, reason) => { - if (reason !== "backdropClick") { - setOpen(false); - } - }; - - const handleSuccess = async (data) => { - setOpen(false); - notify('common.response.success'); - }; - - const handleError = async (error) => { - notify(error.message || 'common.response.fail', { type: 'error', messageArgs: { _: error.message } }); - }; - - return ( - <> - <CreateBase - record={{}} - transform={(data) => { - return data; - }} - mutationOptions={{ onSuccess: handleSuccess, onError: handleError }} - > - <Dialog - open={open} - onClose={handleClose} - aria-labelledby="form-dialog-title" - fullWidth - disableRestoreFocus - maxWidth="md" // 'xs' | 'sm' | 'md' | 'lg' | 'xl' - > - <Form> - <DialogTitle id="form-dialog-title" sx={{ - position: 'sticky', - top: 0, - backgroundColor: 'background.paper', - zIndex: 1000 - }} - > - {translate('create.title')} - <Box sx={{ position: 'absolute', top: 8, right: 8, zIndex: 1001 }}> - <DialogCloseButton onClose={handleClose} /> - </Box> - </DialogTitle> - <DialogContent sx={{ mt: 2 }}> - <Grid container rowSpacing={2} columnSpacing={2}> - <Grid item xs={6} display="flex" gap={1}> - <TextInput - label="table.field.stockItem.stockId" - source="stockId" - parse={v => v} - autoFocus - validate={required()} - /> - </Grid> - <Grid item xs={6} display="flex" gap={1}> - <ReferenceInput - source="matnrId" - reference="matnr" - > - <AutocompleteInput - label="table.field.stockItem.matnrId" - optionText="unit" - filterToQuery={(val) => ({ unit: val })} - validate={required()} - /> - </ReferenceInput> - </Grid> - <Grid item xs={6} display="flex" gap={1}> - <TextInput - label="table.field.stockItem.code" - source="code" - parse={v => v} - validate={required()} - /> - </Grid> - <Grid item xs={6} display="flex" gap={1}> - <TextInput - label="table.field.stockItem.matnrk" - source="matnrk" - parse={v => v} - /> - </Grid> - <Grid item xs={6} display="flex" gap={1}> - <NumberInput - label="table.field.stockItem.anfme" - source="anfme" - /> - </Grid> - <Grid item xs={6} display="flex" gap={1}> - <NumberInput - label="table.field.stockItem.workQty" - source="workQty" - /> - </Grid> - <Grid item xs={6} display="flex" gap={1}> - <NumberInput - label="table.field.stockItem.qty" - source="qty" - /> - </Grid> - <Grid item xs={6} display="flex" gap={1}> - <NumberInput - label="table.field.stockItem.weight" - source="weight" - /> - </Grid> - <Grid item xs={6} display="flex" gap={1}> - <TextInput - label="table.field.stockItem.unit" - source="unit" - parse={v => v} - /> - </Grid> - <Grid item xs={6} display="flex" gap={1}> - <ReferenceInput - source="shipperId" - reference="shipper" - > - <AutocompleteInput - label="table.field.stockItem.shipperId" - optionText="name" - filterToQuery={(val) => ({ name: val })} - /> - </ReferenceInput> - </Grid> - <Grid item xs={6} display="flex" gap={1}> - <TextInput - label="table.field.stockItem.splrId" - source="splrId" - parse={v => v} - /> - </Grid> - <Grid item xs={6} display="flex" gap={1}> - <TextInput - label="table.field.stockItem.brand" - source="brand" - parse={v => v} - /> - </Grid> - <Grid item xs={6} display="flex" gap={1}> - <TextInput - label="table.field.stockItem.batch" - source="batch" - parse={v => v} - /> - </Grid> - <Grid item xs={6} display="flex" gap={1}> - <TextInput - label="table.field.stockItem.prodTime" - source="prodTime" - parse={v => v} - /> - </Grid> - <Grid item xs={6} display="flex" gap={1}> - <ReferenceInput - source="inspectId" - reference="qlyInspect" - > - <AutocompleteInput - label="table.field.stockItem.inspectId" - optionText="name" - filterToQuery={(val) => ({ name: val })} - /> - </ReferenceInput> - </Grid> - <Grid item xs={6} display="flex" gap={1}> - <TextInput - label="table.field.stockItem.splrBtch" - source="splrBtch" - parse={v => v} - /> - </Grid> - <Grid item xs={6} display="flex" gap={1}> - <TextInput - label="table.field.stockItem.asnOrder" - source="asnOrder" - parse={v => v} - validate={required()} - /> - </Grid> - <Grid item xs={6} display="flex" gap={1}> - <TextInput - label="table.field.stockItem.erpToken" - source="erpToken" - parse={v => v} - /> - </Grid> - <Grid item xs={6} display="flex" gap={1}> - <TextInput - label="table.field.stockItem.erpOrder" - source="erpOrder" - parse={v => v} - /> - </Grid> - <Grid item xs={6} display="flex" gap={1}> - <TextInput - label="table.field.stockItem.erpStkAdr" - source="erpStkAdr" - parse={v => v} - /> - </Grid> - <Grid item xs={6} display="flex" gap={1}> - <ReferenceInput - source="locId" - reference="loc" - > - <AutocompleteInput - label="table.field.stockItem.locId" - optionText="name" - filterToQuery={(val) => ({ name: val })} - /> - </ReferenceInput> - </Grid> - <Grid item xs={6} display="flex" gap={1}> - <TextInput - label="table.field.stockItem.barcode" - source="barcode" - parse={v => v} - /> - </Grid> - <Grid item xs={6} display="flex" gap={1}> - <NumberInput - label="table.field.stockItem.purPrice" - source="purPrice" - /> - </Grid> - <Grid item xs={6} display="flex" gap={1}> - <TextInput - label="table.field.stockItem.lockReason" - source="lockReason" - parse={v => v} - /> - </Grid> - <Grid item xs={6} display="flex" gap={1}> - <NumberInput - label="table.field.stockItem.lockStatus" - source="lockStatus" - validate={required()} - /> - </Grid> - <Grid item xs={6} display="flex" gap={1}> - <TextInput - label="table.field.stockItem.locker" - source="locker" - parse={v => v} - /> - </Grid> - <Grid item xs={6} display="flex" gap={1}> - <DateInput - label="table.field.stockItem.lockedTime" - source="lockedTime" - /> - </Grid> - - <Grid item xs={6} display="flex" gap={1}> - <StatusSelectInput /> - </Grid> - <Grid item xs={12} display="flex" gap={1}> - <Stack direction="column" spacing={1} width={'100%'}> - <MemoInput /> - </Stack> - </Grid> - </Grid> - </DialogContent> - <DialogActions sx={{ position: 'sticky', bottom: 0, backgroundColor: 'background.paper', zIndex: 1000 }}> - <Toolbar sx={{ width: '100%', justifyContent: 'space-between' }} > - <SaveButton /> - </Toolbar> - </DialogActions> - </Form> - </Dialog> - </CreateBase> - </> - ) -} - -export default StockItemCreate; diff --git a/rsf-admin/src/page/stockItem/StockItemEdit.jsx b/rsf-admin/src/page/stockItem/StockItemEdit.jsx deleted file mode 100644 index 2e59917..0000000 --- a/rsf-admin/src/page/stockItem/StockItemEdit.jsx +++ /dev/null @@ -1,294 +0,0 @@ -import React, { useState, useRef, useEffect, useMemo } from "react"; -import { - Edit, - SimpleForm, - FormDataConsumer, - useTranslate, - TextInput, - NumberInput, - BooleanInput, - DateInput, - SelectInput, - ReferenceInput, - ReferenceArrayInput, - AutocompleteInput, - SaveButton, - Toolbar, - Labeled, - NumberField, - required, - useRecordContext, - DeleteButton, -} from 'react-admin'; -import { useWatch, useFormContext } from "react-hook-form"; -import { Stack, Grid, Box, Typography } from '@mui/material'; -import * as Common from '@/utils/common'; -import { EDIT_MODE, REFERENCE_INPUT_PAGESIZE } from '@/config/setting'; -import EditBaseAside from "../components/EditBaseAside"; -import CustomerTopToolBar from "../components/EditTopToolBar"; -import MemoInput from "../components/MemoInput"; -import StatusSelectInput from "../components/StatusSelectInput"; - -const FormToolbar = () => { - const { getValues } = useFormContext(); - - return ( - <Toolbar sx={{ justifyContent: 'space-between' }}> - <SaveButton /> - <DeleteButton mutationMode="optimistic" /> - </Toolbar> - ) -} - -const StockItemEdit = () => { - const translate = useTranslate(); - - return ( - <Edit - redirect="list" - mutationMode={EDIT_MODE} - actions={<CustomerTopToolBar />} - aside={<EditBaseAside />} - > - <SimpleForm - shouldUnregister - warnWhenUnsavedChanges - toolbar={<FormToolbar />} - mode="onTouched" - defaultValues={{}} - // validate={(values) => { }} - > - <Grid container width={{ xs: '100%', xl: '80%' }} rowSpacing={3} columnSpacing={3}> - <Grid item xs={12} md={8}> - <Typography variant="h6" gutterBottom> - {translate('common.edit.title.main')} - </Typography> - <Stack direction='row' gap={2}> - <TextInput - label="table.field.stockItem.stockId" - source="stockId" - parse={v => v} - autoFocus - validate={required()} - /> - </Stack> - <Stack direction='row' gap={2}> - <ReferenceInput - source="matnrId" - reference="matnr" - perPage={REFERENCE_INPUT_PAGESIZE} - > - <AutocompleteInput - label="table.field.stockItem.matnrId" - optionText="unit" - filterToQuery={(val) => ({ unit: val })} - validate={required()} - /> - </ReferenceInput> - </Stack> - <Stack direction='row' gap={2}> - <TextInput - label="table.field.stockItem.code" - source="code" - parse={v => v} - validate={required()} - /> - </Stack> - <Stack direction='row' gap={2}> - <TextInput - label="table.field.stockItem.matnrk" - source="matnrk" - parse={v => v} - /> - </Stack> - <Stack direction='row' gap={2}> - <NumberInput - label="table.field.stockItem.anfme" - source="anfme" - /> - </Stack> - <Stack direction='row' gap={2}> - <NumberInput - label="table.field.stockItem.workQty" - source="workQty" - /> - </Stack> - <Stack direction='row' gap={2}> - <NumberInput - label="table.field.stockItem.qty" - source="qty" - /> - </Stack> - <Stack direction='row' gap={2}> - <NumberInput - label="table.field.stockItem.weight" - source="weight" - /> - </Stack> - <Stack direction='row' gap={2}> - <TextInput - label="table.field.stockItem.unit" - source="unit" - parse={v => v} - /> - </Stack> - <Stack direction='row' gap={2}> - <ReferenceInput - source="shipperId" - reference="shipper" - perPage={REFERENCE_INPUT_PAGESIZE} - > - <AutocompleteInput - label="table.field.stockItem.shipperId" - optionText="name" - filterToQuery={(val) => ({ name: val })} - /> - </ReferenceInput> - </Stack> - <Stack direction='row' gap={2}> - <TextInput - label="table.field.stockItem.splrId" - source="splrId" - parse={v => v} - /> - </Stack> - <Stack direction='row' gap={2}> - <TextInput - label="table.field.stockItem.brand" - source="brand" - parse={v => v} - /> - </Stack> - <Stack direction='row' gap={2}> - <TextInput - label="table.field.stockItem.batch" - source="batch" - parse={v => v} - /> - </Stack> - <Stack direction='row' gap={2}> - <TextInput - label="table.field.stockItem.prodTime" - source="prodTime" - parse={v => v} - /> - </Stack> - <Stack direction='row' gap={2}> - <ReferenceInput - source="inspectId" - reference="qlyInspect" - perPage={REFERENCE_INPUT_PAGESIZE} - > - <AutocompleteInput - label="table.field.stockItem.inspectId" - optionText="name" - filterToQuery={(val) => ({ name: val })} - /> - </ReferenceInput> - </Stack> - <Stack direction='row' gap={2}> - <TextInput - label="table.field.stockItem.splrBtch" - source="splrBtch" - parse={v => v} - /> - </Stack> - <Stack direction='row' gap={2}> - <TextInput - label="table.field.stockItem.asnOrder" - source="asnOrder" - parse={v => v} - validate={required()} - /> - </Stack> - <Stack direction='row' gap={2}> - <TextInput - label="table.field.stockItem.erpToken" - source="erpToken" - parse={v => v} - /> - </Stack> - <Stack direction='row' gap={2}> - <TextInput - label="table.field.stockItem.erpOrder" - source="erpOrder" - parse={v => v} - /> - </Stack> - <Stack direction='row' gap={2}> - <TextInput - label="table.field.stockItem.erpStkAdr" - source="erpStkAdr" - parse={v => v} - /> - </Stack> - <Stack direction='row' gap={2}> - <ReferenceInput - source="locId" - reference="loc" - perPage={REFERENCE_INPUT_PAGESIZE} - > - <AutocompleteInput - label="table.field.stockItem.locId" - optionText="name" - filterToQuery={(val) => ({ name: val })} - /> - </ReferenceInput> - </Stack> - <Stack direction='row' gap={2}> - <TextInput - label="table.field.stockItem.barcode" - source="barcode" - parse={v => v} - /> - </Stack> - <Stack direction='row' gap={2}> - <NumberInput - label="table.field.stockItem.purPrice" - source="purPrice" - /> - </Stack> - <Stack direction='row' gap={2}> - <TextInput - label="table.field.stockItem.lockReason" - source="lockReason" - parse={v => v} - /> - </Stack> - <Stack direction='row' gap={2}> - <NumberInput - label="table.field.stockItem.lockStatus" - source="lockStatus" - validate={required()} - /> - </Stack> - <Stack direction='row' gap={2}> - <TextInput - label="table.field.stockItem.locker" - source="locker" - parse={v => v} - /> - </Stack> - <Stack direction='row' gap={2}> - <DateInput - label="table.field.stockItem.lockedTime" - source="lockedTime" - /> - </Stack> - - </Grid> - <Grid item xs={12} md={4}> - <Typography variant="h6" gutterBottom> - {translate('common.edit.title.common')} - </Typography> - <StatusSelectInput /> - <Box mt="2em" /> - <MemoInput /> - </Grid> - </Grid> - </SimpleForm> - </Edit > - ) -} - -export default StockItemEdit; diff --git a/rsf-admin/src/page/stockItem/StockItemList.jsx b/rsf-admin/src/page/stockItem/StockItemList.jsx deleted file mode 100644 index acf4155..0000000 --- a/rsf-admin/src/page/stockItem/StockItemList.jsx +++ /dev/null @@ -1,220 +0,0 @@ -import React, { useState, useRef, useEffect, useMemo, useCallback } from "react"; -import { useNavigate } from 'react-router-dom'; -import { - List, - DatagridConfigurable, - SearchInput, - TopToolbar, - SelectColumnsButton, - EditButton, - FilterButton, - CreateButton, - ExportButton, - BulkDeleteButton, - WrapperField, - useRecordContext, - useTranslate, - useNotify, - useListContext, - FunctionField, - TextField, - NumberField, - DateField, - BooleanField, - ReferenceField, - TextInput, - DateTimeInput, - DateInput, - SelectInput, - NumberInput, - ReferenceInput, - ReferenceArrayInput, - AutocompleteInput, - DeleteButton, -} from 'react-admin'; -import { Box, Typography, Card, Stack } from '@mui/material'; -import { styled } from '@mui/material/styles'; -import StockItemCreate from "./StockItemCreate"; -import StockItemPanel from "./StockItemPanel"; -import EmptyData from "../components/EmptyData"; -import MyCreateButton from "../components/MyCreateButton"; -import MyExportButton from '../components/MyExportButton'; -import PageDrawer from "../components/PageDrawer"; -import MyField from "../components/MyField"; -import { PAGE_DRAWER_WIDTH, OPERATE_MODE, DEFAULT_PAGE_SIZE } from '@/config/setting'; -import * as Common from '@/utils/common'; - -const StyledDatagrid = styled(DatagridConfigurable)(({ theme }) => ({ - '& .css-1vooibu-MuiSvgIcon-root': { - height: '.9em' - }, - '& .RaDatagrid-row': { - cursor: 'auto' - }, - '& .column-name': { - }, - '& .opt': { - width: 200 - }, -})); - -const filters = [ - <SearchInput source="condition" alwaysOn />, - <DateInput label='common.time.after' source="timeStart" alwaysOn />, - <DateInput label='common.time.before' source="timeEnd" alwaysOn />, - - <TextInput source="stockId" label="table.field.stockItem.stockId" />, - <ReferenceInput source="matnrId" label="table.field.stockItem.matnrId" reference="matnr"> - <AutocompleteInput label="table.field.stockItem.matnrId" optionText="unit" filterToQuery={(val) => ({ unit: val })} /> - </ReferenceInput>, - <TextInput source="code" label="table.field.stockItem.code" />, - <TextInput source="matnrk" label="table.field.stockItem.matnrk" />, - <NumberInput source="anfme" label="table.field.stockItem.anfme" />, - <NumberInput source="workQty" label="table.field.stockItem.workQty" />, - <NumberInput source="qty" label="table.field.stockItem.qty" />, - <NumberInput source="weight" label="table.field.stockItem.weight" />, - <TextInput source="unit" label="table.field.stockItem.unit" />, - <ReferenceInput source="shipperId" label="table.field.stockItem.shipperId" reference="shipper"> - <AutocompleteInput label="table.field.stockItem.shipperId" optionText="name" filterToQuery={(val) => ({ name: val })} /> - </ReferenceInput>, - <TextInput source="splrId" label="table.field.stockItem.splrId" />, - <TextInput source="brand" label="table.field.stockItem.brand" />, - <TextInput source="batch" label="table.field.stockItem.batch" />, - <TextInput source="prodTime" label="table.field.stockItem.prodTime" />, - <ReferenceInput source="inspectId" label="table.field.stockItem.inspectId" reference="qlyInspect"> - <AutocompleteInput label="table.field.stockItem.inspectId" optionText="name" filterToQuery={(val) => ({ name: val })} /> - </ReferenceInput>, - <TextInput source="splrBtch" label="table.field.stockItem.splrBtch" />, - <TextInput source="asnOrder" label="table.field.stockItem.asnOrder" />, - <TextInput source="erpToken" label="table.field.stockItem.erpToken" />, - <TextInput source="erpOrder" label="table.field.stockItem.erpOrder" />, - <TextInput source="erpStkAdr" label="table.field.stockItem.erpStkAdr" />, - <ReferenceInput source="locId" label="table.field.stockItem.locId" reference="loc"> - <AutocompleteInput label="table.field.stockItem.locId" optionText="name" filterToQuery={(val) => ({ name: val })} /> - </ReferenceInput>, - <TextInput source="barcode" label="table.field.stockItem.barcode" />, - <NumberInput source="purPrice" label="table.field.stockItem.purPrice" />, - <TextInput source="lockReason" label="table.field.stockItem.lockReason" />, - <NumberInput source="lockStatus" label="table.field.stockItem.lockStatus" />, - <TextInput source="locker" label="table.field.stockItem.locker" />, - <DateInput source="lockedTime" label="table.field.stockItem.lockedTime" />, - - <TextInput label="common.field.memo" source="memo" />, - <SelectInput - label="common.field.status" - source="status" - choices={[ - { id: '1', name: 'common.enums.statusTrue' }, - { id: '0', name: 'common.enums.statusFalse' }, - ]} - resettable - />, -] - -const StockItemList = () => { - const translate = useTranslate(); - - const [createDialog, setCreateDialog] = useState(false); - const [drawerVal, setDrawerVal] = useState(false); - - return ( - <Box display="flex"> - <List - sx={{ - flexGrow: 1, - transition: (theme) => - theme.transitions.create(['all'], { - duration: theme.transitions.duration.enteringScreen, - }), - marginRight: !!drawerVal ? `${PAGE_DRAWER_WIDTH}px` : 0, - }} - title={"menu.stockItem"} - empty={<EmptyData onClick={() => { setCreateDialog(true) }} />} - filters={filters} - sort={{ field: "create_time", order: "desc" }} - actions={( - <TopToolbar> - <FilterButton /> - <MyCreateButton onClick={() => { setCreateDialog(true) }} /> - <SelectColumnsButton preferenceKey='stockItem' /> - <MyExportButton /> - </TopToolbar> - )} - perPage={DEFAULT_PAGE_SIZE} - > - <StyledDatagrid - preferenceKey='stockItem' - bulkActionButtons={() => <BulkDeleteButton mutationMode={OPERATE_MODE} />} - rowClick={(id, resource, record) => false} - expand={() => <StockItemPanel />} - expandSingle={true} - omit={['id', 'createTime', 'createBy', 'memo']} - > - <NumberField source="id" /> - <TextField source="stockId" label="table.field.stockItem.stockId" /> - <ReferenceField source="matnrId" label="table.field.stockItem.matnrId" reference="matnr" link={false} sortable={false}> - <TextField source="unit" /> - </ReferenceField> - <TextField source="code" label="table.field.stockItem.code" /> - <TextField source="matnrk" label="table.field.stockItem.matnrk" /> - <NumberField source="anfme" label="table.field.stockItem.anfme" /> - <NumberField source="workQty" label="table.field.stockItem.workQty" /> - <NumberField source="qty" label="table.field.stockItem.qty" /> - <NumberField source="weight" label="table.field.stockItem.weight" /> - <TextField source="unit" label="table.field.stockItem.unit" /> - <ReferenceField source="shipperId" label="table.field.stockItem.shipperId" reference="shipper" link={false} sortable={false}> - <TextField source="name" /> - </ReferenceField> - <TextField source="splrId" label="table.field.stockItem.splrId" /> - <TextField source="brand" label="table.field.stockItem.brand" /> - <TextField source="batch" label="table.field.stockItem.batch" /> - <TextField source="prodTime" label="table.field.stockItem.prodTime" /> - <ReferenceField source="inspectId" label="table.field.stockItem.inspectId" reference="qlyInspect" link={false} sortable={false}> - <TextField source="name" /> - </ReferenceField> - <TextField source="splrBtch" label="table.field.stockItem.splrBtch" /> - <TextField source="asnOrder" label="table.field.stockItem.asnOrder" /> - <TextField source="erpToken" label="table.field.stockItem.erpToken" /> - <TextField source="erpOrder" label="table.field.stockItem.erpOrder" /> - <TextField source="erpStkAdr" label="table.field.stockItem.erpStkAdr" /> - <ReferenceField source="locId" label="table.field.stockItem.locId" reference="loc" link={false} sortable={false}> - <TextField source="name" /> - </ReferenceField> - <TextField source="barcode" label="table.field.stockItem.barcode" /> - <NumberField source="purPrice" label="table.field.stockItem.purPrice" /> - <TextField source="lockReason" label="table.field.stockItem.lockReason" /> - <NumberField source="lockStatus" label="table.field.stockItem.lockStatus" /> - <TextField source="locker" label="table.field.stockItem.locker" /> - <DateField source="lockedTime" label="table.field.stockItem.lockedTime" showTime /> - - <ReferenceField source="updateBy" label="common.field.updateBy" reference="user" link={false} sortable={false}> - <TextField source="nickname" /> - </ReferenceField> - <DateField source="updateTime" label="common.field.updateTime" showTime /> - <ReferenceField source="createBy" label="common.field.createBy" reference="user" link={false} sortable={false}> - <TextField source="nickname" /> - </ReferenceField> - <DateField source="createTime" label="common.field.createTime" showTime /> - <BooleanField source="statusBool" label="common.field.status" sortable={false} /> - <TextField source="memo" label="common.field.memo" sortable={false} /> - <WrapperField cellClassName="opt" label="common.field.opt"> - <EditButton sx={{ padding: '1px', fontSize: '.75rem' }} /> - <DeleteButton sx={{ padding: '1px', fontSize: '.75rem' }} mutationMode={OPERATE_MODE} /> - </WrapperField> - </StyledDatagrid> - </List> - <StockItemCreate - open={createDialog} - setOpen={setCreateDialog} - /> - <PageDrawer - title='StockItem Detail' - drawerVal={drawerVal} - setDrawerVal={setDrawerVal} - > - </PageDrawer> - </Box> - ) -} - -export default StockItemList; diff --git a/rsf-admin/src/page/stockItem/StockItemPanel.jsx b/rsf-admin/src/page/stockItem/StockItemPanel.jsx deleted file mode 100644 index bd73f01..0000000 --- a/rsf-admin/src/page/stockItem/StockItemPanel.jsx +++ /dev/null @@ -1,213 +0,0 @@ -import React, { useState, useRef, useEffect, useMemo } from "react"; -import { Box, Card, CardContent, Grid, Typography, Tooltip } from '@mui/material'; -import { - useTranslate, - useRecordContext, -} from 'react-admin'; -import PanelTypography from "../components/PanelTypography"; -import * as Common from '@/utils/common' - -const StockItemPanel = () => { - const record = useRecordContext(); - if (!record) return null; - const translate = useTranslate(); - return ( - <> - <Card sx={{ width: { xs: 300, sm: 500, md: 600, lg: 800 }, margin: 'auto' }}> - <CardContent> - <Grid container spacing={2}> - <Grid item xs={12} sx={{ display: 'flex', justifyContent: 'space-between' }}> - <Typography variant="h6" gutterBottom align="left" sx={{ - maxWidth: { xs: '100px', sm: '180px', md: '260px', lg: '360px' }, - whiteSpace: 'nowrap', - overflow: 'hidden', - textOverflow: 'ellipsis', - }}> - {Common.camelToPascalWithSpaces(translate('table.field.stockItem.matnrk'))}: {record.matnrk} - </Typography> - {/* inherit, primary, secondary, textPrimary, textSecondary, error */} - <Typography variant="h6" gutterBottom align="right" > - ID: {record.id} - </Typography> - </Grid> - </Grid> - <Grid container spacing={2}> - <Grid item xs={12} container alignContent="flex-end"> - <Typography variant="caption" color="textSecondary" sx={{ wordWrap: 'break-word', wordBreak: 'break-all' }}> - {Common.camelToPascalWithSpaces(translate('common.field.memo'))}:{record.memo} - </Typography> - </Grid> - </Grid> - <Box height={20}> </Box> - <Grid container spacing={2}> - <Grid item xs={6}> - <PanelTypography - title="table.field.stockItem.stockId" - property={record.stockId$} - /> - </Grid> - <Grid item xs={6}> - <PanelTypography - title="table.field.stockItem.matnrId" - property={record.matnrId$} - /> - </Grid> - <Grid item xs={6}> - <PanelTypography - title="table.field.stockItem.code" - property={record.code} - /> - </Grid> - <Grid item xs={6}> - <PanelTypography - title="table.field.stockItem.matnrk" - property={record.matnrk} - /> - </Grid> - <Grid item xs={6}> - <PanelTypography - title="table.field.stockItem.anfme" - property={record.anfme} - /> - </Grid> - <Grid item xs={6}> - <PanelTypography - title="table.field.stockItem.workQty" - property={record.workQty} - /> - </Grid> - <Grid item xs={6}> - <PanelTypography - title="table.field.stockItem.qty" - property={record.qty} - /> - </Grid> - <Grid item xs={6}> - <PanelTypography - title="table.field.stockItem.weight" - property={record.weight} - /> - </Grid> - <Grid item xs={6}> - <PanelTypography - title="table.field.stockItem.unit" - property={record.unit} - /> - </Grid> - <Grid item xs={6}> - <PanelTypography - title="table.field.stockItem.shipperId" - property={record.shipperId$} - /> - </Grid> - <Grid item xs={6}> - <PanelTypography - title="table.field.stockItem.splrId" - property={record.splrId} - /> - </Grid> - <Grid item xs={6}> - <PanelTypography - title="table.field.stockItem.brand" - property={record.brand} - /> - </Grid> - <Grid item xs={6}> - <PanelTypography - title="table.field.stockItem.batch" - property={record.batch} - /> - </Grid> - <Grid item xs={6}> - <PanelTypography - title="table.field.stockItem.prodTime" - property={record.prodTime} - /> - </Grid> - <Grid item xs={6}> - <PanelTypography - title="table.field.stockItem.inspectId" - property={record.inspectId$} - /> - </Grid> - <Grid item xs={6}> - <PanelTypography - title="table.field.stockItem.splrBtch" - property={record.splrBtch} - /> - </Grid> - <Grid item xs={6}> - <PanelTypography - title="table.field.stockItem.asnOrder" - property={record.asnOrder} - /> - </Grid> - <Grid item xs={6}> - <PanelTypography - title="table.field.stockItem.erpToken" - property={record.erpToken} - /> - </Grid> - <Grid item xs={6}> - <PanelTypography - title="table.field.stockItem.erpOrder" - property={record.erpOrder} - /> - </Grid> - <Grid item xs={6}> - <PanelTypography - title="table.field.stockItem.erpStkAdr" - property={record.erpStkAdr} - /> - </Grid> - <Grid item xs={6}> - <PanelTypography - title="table.field.stockItem.locId" - property={record.locId$} - /> - </Grid> - <Grid item xs={6}> - <PanelTypography - title="table.field.stockItem.barcode" - property={record.barcode} - /> - </Grid> - <Grid item xs={6}> - <PanelTypography - title="table.field.stockItem.purPrice" - property={record.purPrice} - /> - </Grid> - <Grid item xs={6}> - <PanelTypography - title="table.field.stockItem.lockReason" - property={record.lockReason} - /> - </Grid> - <Grid item xs={6}> - <PanelTypography - title="table.field.stockItem.lockStatus" - property={record.lockStatus} - /> - </Grid> - <Grid item xs={6}> - <PanelTypography - title="table.field.stockItem.locker" - property={record.locker} - /> - </Grid> - <Grid item xs={6}> - <PanelTypography - title="table.field.stockItem.lockedTime" - property={record.lockedTime$} - /> - </Grid> - - </Grid> - </CardContent> - </Card > - </> - ); -}; - -export default StockItemPanel; diff --git a/rsf-admin/src/page/stockItem/index.jsx b/rsf-admin/src/page/stockItem/index.jsx deleted file mode 100644 index 05d3021..0000000 --- a/rsf-admin/src/page/stockItem/index.jsx +++ /dev/null @@ -1,18 +0,0 @@ -import React, { useState, useRef, useEffect, useMemo } from "react"; -import { - ListGuesser, - EditGuesser, - ShowGuesser, -} from "react-admin"; - -import StockItemList from "./StockItemList"; -import StockItemEdit from "./StockItemEdit"; - -export default { - list: StockItemList, - edit: StockItemEdit, - show: ShowGuesser, - recordRepresentation: (record) => { - return `${record.matnrk}` - } -}; diff --git a/rsf-server/src/main/java/com/vincent/rsf/server/common/CodeBuilder.java b/rsf-server/src/main/java/com/vincent/rsf/server/common/CodeBuilder.java index 3677141..a6ffa38 100644 --- a/rsf-server/src/main/java/com/vincent/rsf/server/common/CodeBuilder.java +++ b/rsf-server/src/main/java/com/vincent/rsf/server/common/CodeBuilder.java @@ -22,9 +22,9 @@ // generator.username="sa"; // generator.password="Zoneyung@zy56$"; - generator.table="man_"; - generator.tableDesc="璐ㄦ淇℃伅"; - generator.packagePath="com.vincent.rsf.server.manager"; + generator.table="sys_dict_data"; + generator.tableDesc="瀛楀吀鏁版嵁闆�"; + generator.packagePath="com.vincent.rsf.server.system"; generator.build(); } diff --git a/rsf-server/src/main/java/com/vincent/rsf/server/system/controller/DictDataController.java b/rsf-server/src/main/java/com/vincent/rsf/server/system/controller/DictDataController.java new file mode 100644 index 0000000..fdf23e4 --- /dev/null +++ b/rsf-server/src/main/java/com/vincent/rsf/server/system/controller/DictDataController.java @@ -0,0 +1,110 @@ +package com.vincent.rsf.server.system.controller; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.vincent.rsf.framework.common.Cools; +import com.vincent.rsf.framework.common.R; +import com.vincent.rsf.server.common.utils.ExcelUtil; +import com.vincent.rsf.server.common.annotation.OperationLog; +import com.vincent.rsf.server.common.domain.BaseParam; +import com.vincent.rsf.server.common.domain.KeyValVo; +import com.vincent.rsf.server.common.domain.PageParam; +import com.vincent.rsf.server.system.entity.DictData; +import com.vincent.rsf.server.system.service.DictDataService; +import com.vincent.rsf.server.system.controller.BaseController; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletResponse; +import java.util.*; + +@RestController +public class DictDataController extends BaseController { + + @Autowired + private DictDataService dictDataService; + + @PreAuthorize("hasAuthority('system:dictData:list')") + @PostMapping("/dictData/page") + public R page(@RequestBody Map<String, Object> map) { + BaseParam baseParam = buildParam(map, BaseParam.class); + PageParam<DictData, BaseParam> pageParam = new PageParam<>(baseParam, DictData.class); + return R.ok().add(dictDataService.page(pageParam, pageParam.buildWrapper(true))); + } + + @PreAuthorize("hasAuthority('system:dictData:list')") + @PostMapping("/dictData/list") + public R list(@RequestBody Map<String, Object> map) { + return R.ok().add(dictDataService.list()); + } + + @PreAuthorize("hasAuthority('system:dictData:list')") + @PostMapping({"/dictData/many/{ids}", "/dictDatas/many/{ids}"}) + public R many(@PathVariable Long[] ids) { + return R.ok().add(dictDataService.listByIds(Arrays.asList(ids))); + } + + @PreAuthorize("hasAuthority('system:dictData:list')") + @GetMapping("/dictData/{id}") + public R get(@PathVariable("id") Long id) { + return R.ok().add(dictDataService.getById(id)); + } + + @PreAuthorize("hasAuthority('system:dictData:save')") + @OperationLog("Create 瀛楀吀鏁版嵁闆�") + @PostMapping("/dictData/save") + public R save(@RequestBody DictData dictData) { + dictData.setCreateBy(getLoginUserId()); + dictData.setCreateTime(new Date()); + dictData.setUpdateBy(getLoginUserId()); + dictData.setUpdateTime(new Date()); + if (!dictDataService.save(dictData)) { + return R.error("Save Fail"); + } + return R.ok("Save Success").add(dictData); + } + + @PreAuthorize("hasAuthority('system:dictData:update')") + @OperationLog("Update 瀛楀吀鏁版嵁闆�") + @PostMapping("/dictData/update") + public R update(@RequestBody DictData dictData) { + dictData.setUpdateBy(getLoginUserId()); + dictData.setUpdateTime(new Date()); + if (!dictDataService.updateById(dictData)) { + return R.error("Update Fail"); + } + return R.ok("Update Success").add(dictData); + } + + @PreAuthorize("hasAuthority('system:dictData:remove')") + @OperationLog("Delete 瀛楀吀鏁版嵁闆�") + @PostMapping("/dictData/remove/{ids}") + public R remove(@PathVariable Long[] ids) { + if (!dictDataService.removeByIds(Arrays.asList(ids))) { + return R.error("Delete Fail"); + } + return R.ok("Delete Success").add(ids); + } + + @PreAuthorize("hasAuthority('system:dictData:list')") + @PostMapping("/dictData/query") + public R query(@RequestParam(required = false) String condition) { + List<KeyValVo> vos = new ArrayList<>(); + LambdaQueryWrapper<DictData> wrapper = new LambdaQueryWrapper<>(); + if (!Cools.isEmpty(condition)) { + wrapper.like(DictData::getId, condition); + } + dictDataService.page(new Page<>(1, 30), wrapper).getRecords().forEach( + item -> vos.add(new KeyValVo(item.getId(), item.getId())) + ); + return R.ok().add(vos); + } + + @PreAuthorize("hasAuthority('system:dictData:list')") + @PostMapping("/dictData/export") + public void export(@RequestBody Map<String, Object> map, HttpServletResponse response) throws Exception { + ExcelUtil.build(ExcelUtil.create(dictDataService.list(), DictData.class), response); + } + +} diff --git a/rsf-server/src/main/java/com/vincent/rsf/server/system/controller/DictTypeController.java b/rsf-server/src/main/java/com/vincent/rsf/server/system/controller/DictTypeController.java new file mode 100644 index 0000000..fbeb7d9 --- /dev/null +++ b/rsf-server/src/main/java/com/vincent/rsf/server/system/controller/DictTypeController.java @@ -0,0 +1,110 @@ +package com.vincent.rsf.server.system.controller; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.vincent.rsf.framework.common.Cools; +import com.vincent.rsf.framework.common.R; +import com.vincent.rsf.server.common.utils.ExcelUtil; +import com.vincent.rsf.server.common.annotation.OperationLog; +import com.vincent.rsf.server.common.domain.BaseParam; +import com.vincent.rsf.server.common.domain.KeyValVo; +import com.vincent.rsf.server.common.domain.PageParam; +import com.vincent.rsf.server.system.entity.DictType; +import com.vincent.rsf.server.system.service.DictTypeService; +import com.vincent.rsf.server.system.controller.BaseController; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletResponse; +import java.util.*; + +@RestController +public class DictTypeController extends BaseController { + + @Autowired + private DictTypeService dictTypeService; + + @PreAuthorize("hasAuthority('system:dictType:list')") + @PostMapping("/dictType/page") + public R page(@RequestBody Map<String, Object> map) { + BaseParam baseParam = buildParam(map, BaseParam.class); + PageParam<DictType, BaseParam> pageParam = new PageParam<>(baseParam, DictType.class); + return R.ok().add(dictTypeService.page(pageParam, pageParam.buildWrapper(true))); + } + + @PreAuthorize("hasAuthority('system:dictType:list')") + @PostMapping("/dictType/list") + public R list(@RequestBody Map<String, Object> map) { + return R.ok().add(dictTypeService.list()); + } + + @PreAuthorize("hasAuthority('system:dictType:list')") + @PostMapping({"/dictType/many/{ids}", "/dictTypes/many/{ids}"}) + public R many(@PathVariable Long[] ids) { + return R.ok().add(dictTypeService.listByIds(Arrays.asList(ids))); + } + + @PreAuthorize("hasAuthority('system:dictType:list')") + @GetMapping("/dictType/{id}") + public R get(@PathVariable("id") Long id) { + return R.ok().add(dictTypeService.getById(id)); + } + + @PreAuthorize("hasAuthority('system:dictType:save')") + @OperationLog("Create 鏁版嵁瀛楀吀") + @PostMapping("/dictType/save") + public R save(@RequestBody DictType dictType) { + dictType.setCreateBy(getLoginUserId()); + dictType.setCreateTime(new Date()); + dictType.setUpdateBy(getLoginUserId()); + dictType.setUpdateTime(new Date()); + if (!dictTypeService.save(dictType)) { + return R.error("Save Fail"); + } + return R.ok("Save Success").add(dictType); + } + + @PreAuthorize("hasAuthority('system:dictType:update')") + @OperationLog("Update 鏁版嵁瀛楀吀") + @PostMapping("/dictType/update") + public R update(@RequestBody DictType dictType) { + dictType.setUpdateBy(getLoginUserId()); + dictType.setUpdateTime(new Date()); + if (!dictTypeService.updateById(dictType)) { + return R.error("Update Fail"); + } + return R.ok("Update Success").add(dictType); + } + + @PreAuthorize("hasAuthority('system:dictType:remove')") + @OperationLog("Delete 鏁版嵁瀛楀吀") + @PostMapping("/dictType/remove/{ids}") + public R remove(@PathVariable Long[] ids) { + if (!dictTypeService.removeByIds(Arrays.asList(ids))) { + return R.error("Delete Fail"); + } + return R.ok("Delete Success").add(ids); + } + + @PreAuthorize("hasAuthority('system:dictType:list')") + @PostMapping("/dictType/query") + public R query(@RequestParam(required = false) String condition) { + List<KeyValVo> vos = new ArrayList<>(); + LambdaQueryWrapper<DictType> wrapper = new LambdaQueryWrapper<>(); + if (!Cools.isEmpty(condition)) { + wrapper.like(DictType::getName, condition); + } + dictTypeService.page(new Page<>(1, 30), wrapper).getRecords().forEach( + item -> vos.add(new KeyValVo(item.getId(), item.getName())) + ); + return R.ok().add(vos); + } + + @PreAuthorize("hasAuthority('system:dictType:list')") + @PostMapping("/dictType/export") + public void export(@RequestBody Map<String, Object> map, HttpServletResponse response) throws Exception { + ExcelUtil.build(ExcelUtil.create(dictTypeService.list(), DictType.class), response); + } + +} diff --git a/rsf-server/src/main/java/com/vincent/rsf/server/system/entity/DictData.java b/rsf-server/src/main/java/com/vincent/rsf/server/system/entity/DictData.java new file mode 100644 index 0000000..11aa9bb --- /dev/null +++ b/rsf-server/src/main/java/com/vincent/rsf/server/system/entity/DictData.java @@ -0,0 +1,229 @@ +package com.vincent.rsf.server.system.entity; + +import com.baomidou.mybatisplus.annotation.TableLogic; +import java.text.SimpleDateFormat; +import java.util.Date; + +import com.vincent.rsf.server.system.service.DictTypeService; +import org.springframework.format.annotation.DateTimeFormat; +import java.text.SimpleDateFormat; +import java.util.Date; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableLogic; +import com.baomidou.mybatisplus.annotation.TableName; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import com.vincent.rsf.framework.common.Cools; +import com.vincent.rsf.framework.common.SpringUtils; +import com.vincent.rsf.server.system.service.UserService; +import com.vincent.rsf.server.system.entity.User; +import java.io.Serializable; +import java.util.Date; + +@Data +@TableName("sys_dict_data") +public class DictData implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @ApiModelProperty(value= "ID") + @TableId(value = "id", type = IdType.AUTO) + private Long id; + + /** + * 瀛楀吀ID + */ + @ApiModelProperty(value= "瀛楀吀ID") + private String dictTypeId; + + /** + * 瀛楀吀璇嗗埆鐮� + */ + @ApiModelProperty(value= "瀛楀吀璇嗗埆鐮�") + private String dictTypeCode; + + /** + * 鍊� + */ + @ApiModelProperty(value= "鍊�") + private String value; + + /** + * 鏍囩 + */ + @ApiModelProperty(value= "鏍囩") + private String label; + + /** + * 鎺掑簭 + */ + @ApiModelProperty(value= "鎺掑簭") + private Integer sort; + + /** + * 棰滆壊銆備緥濡傦細#FFFFFF銆乥lue銆乺gba(0,0,0,0.5) + */ + @ApiModelProperty(value= "棰滆壊銆備緥濡傦細#FFFFFF銆乥lue銆乺gba(0,0,0,0.5)") + private String color; + + /** + * 鐘舵�� 1: 姝e父 0: 鍐荤粨 + */ + @ApiModelProperty(value= "鐘舵�� 1: 姝e父 0: 鍐荤粨 ") + private Integer status; + + /** + * 鏄惁鍒犻櫎 1: 鏄� 0: 鍚� + */ + @ApiModelProperty(value= "鏄惁鍒犻櫎 1: 鏄� 0: 鍚� ") + @TableLogic + private Integer deleted; + + /** + * 绉熸埛 + */ + @ApiModelProperty(value= "绉熸埛") + private Integer tenantId; + + /** + * 娣诲姞浜哄憳 + */ + @ApiModelProperty(value= "娣诲姞浜哄憳") + private Long createBy; + + /** + * 娣诲姞鏃堕棿 + */ + @ApiModelProperty(value= "娣诲姞鏃堕棿") + @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") + private Date createTime; + + /** + * 淇敼浜哄憳 + */ + @ApiModelProperty(value= "淇敼浜哄憳") + private Long updateBy; + + /** + * 淇敼鏃堕棿 + */ + @ApiModelProperty(value= "淇敼鏃堕棿") + @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") + private Date updateTime; + + /** + * 澶囨敞 + */ + @ApiModelProperty(value= "澶囨敞") + private String memo; + + public DictData() {} + + public DictData(String dictTypeId,String dictTypeCode,String value,String label,Integer sort,String color,Integer status,Integer deleted,Integer tenantId,Long createBy,Date createTime,Long updateBy,Date updateTime,String memo) { + this.dictTypeId = dictTypeId; + this.dictTypeCode = dictTypeCode; + this.value = value; + this.label = label; + this.sort = sort; + this.color = color; + this.status = status; + this.deleted = deleted; + this.tenantId = tenantId; + this.createBy = createBy; + this.createTime = createTime; + this.updateBy = updateBy; + this.updateTime = updateTime; + this.memo = memo; + } + +// DictData dictData = new DictData( +// null, // 瀛楀吀ID[闈炵┖] +// null, // 瀛楀吀璇嗗埆鐮乕闈炵┖] +// null, // 鍊糩闈炵┖] +// null, // 鏍囩[闈炵┖] +// null, // 鎺掑簭 +// null, // 棰滆壊銆備緥濡傦細#FFFFFF銆乥lue銆乺gba(0,0,0,0.5) +// null, // 鐘舵�乕闈炵┖] +// null, // 鏄惁鍒犻櫎[闈炵┖] +// null, // 绉熸埛 +// null, // 娣诲姞浜哄憳 +// null, // 娣诲姞鏃堕棿[闈炵┖] +// null, // 淇敼浜哄憳 +// null, // 淇敼鏃堕棿[闈炵┖] +// null // 澶囨敞 +// ); + + public String getDictTypeId$(){ + DictTypeService service = SpringUtils.getBean(DictTypeService.class); + DictType dictType = service.getById(this.dictTypeId); + if (!Cools.isEmpty(dictType)){ + return String.valueOf(dictType.getName()); + } + return null; + } + + public String getStatus$(){ + if (null == this.status){ return null; } + switch (this.status){ + case 1: + return "姝e父"; + case 0: + return "鍐荤粨"; + default: + return String.valueOf(this.status); + } + } + + public String getCreateBy$(){ + UserService service = SpringUtils.getBean(UserService.class); + User user = service.getById(this.createBy); + if (!Cools.isEmpty(user)){ + return String.valueOf(user.getNickname()); + } + return null; + } + + public String getCreateTime$(){ + if (Cools.isEmpty(this.createTime)){ + return ""; + } + return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(this.createTime); + } + + public String getUpdateBy$(){ + UserService service = SpringUtils.getBean(UserService.class); + User user = service.getById(this.updateBy); + if (!Cools.isEmpty(user)){ + return String.valueOf(user.getNickname()); + } + return null; + } + + public String getUpdateTime$(){ + if (Cools.isEmpty(this.updateTime)){ + return ""; + } + return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(this.updateTime); + } + + + + public Boolean getStatusBool(){ + if (null == this.status){ return null; } + switch (this.status){ + case 1: + return true; + case 0: + return false; + default: + return null; + } + } + +} diff --git a/rsf-server/src/main/java/com/vincent/rsf/server/system/entity/DictType.java b/rsf-server/src/main/java/com/vincent/rsf/server/system/entity/DictType.java new file mode 100644 index 0000000..5faf9d4 --- /dev/null +++ b/rsf-server/src/main/java/com/vincent/rsf/server/system/entity/DictType.java @@ -0,0 +1,194 @@ +package com.vincent.rsf.server.system.entity; + +import com.baomidou.mybatisplus.annotation.TableLogic; +import java.text.SimpleDateFormat; +import java.util.Date; +import org.springframework.format.annotation.DateTimeFormat; +import java.text.SimpleDateFormat; +import java.util.Date; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableLogic; +import com.baomidou.mybatisplus.annotation.TableName; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import com.vincent.rsf.framework.common.Cools; +import com.vincent.rsf.framework.common.SpringUtils; +import com.vincent.rsf.server.system.service.UserService; +import com.vincent.rsf.server.system.entity.User; +import java.io.Serializable; +import java.util.Date; + +@Data +@TableName("sys_dict_type") +public class DictType implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @ApiModelProperty(value= "ID") + @TableId(value = "id", type = IdType.AUTO) + private Long id; + + /** + * 缂栧彿 + */ + @ApiModelProperty(value= "缂栧彿") + private String uuid; + + /** + * 鍚嶇О + */ + @ApiModelProperty(value= "鍚嶇О") + private String name; + + /** + * 鎻忚堪 + */ + @ApiModelProperty(value= "鎻忚堪") + private String description; + + /** + * 鐘舵�� 1: 姝e父 0: 鍐荤粨 + */ + @ApiModelProperty(value= "鐘舵�� 1: 姝e父 0: 鍐荤粨 ") + private Integer status; + + /** + * 鏄惁鍒犻櫎 1: 鏄� 0: 鍚� + */ + @ApiModelProperty(value= "鏄惁鍒犻櫎 1: 鏄� 0: 鍚� ") + @TableLogic + private Integer deleted; + + /** + * 绉熸埛 + */ + @ApiModelProperty(value= "绉熸埛") + private Integer tenantId; + + /** + * 娣诲姞浜哄憳 + */ + @ApiModelProperty(value= "娣诲姞浜哄憳") + private Long createBy; + + /** + * 娣诲姞鏃堕棿 + */ + @ApiModelProperty(value= "娣诲姞鏃堕棿") + @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") + private Date createTime; + + /** + * 淇敼浜哄憳 + */ + @ApiModelProperty(value= "淇敼浜哄憳") + private Long updateBy; + + /** + * 淇敼鏃堕棿 + */ + @ApiModelProperty(value= "淇敼鏃堕棿") + @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") + private Date updateTime; + + /** + * 澶囨敞 + */ + @ApiModelProperty(value= "澶囨敞") + private String memo; + + public DictType() {} + + public DictType(String uuid,String name,String description,Integer status,Integer deleted,Integer tenantId,Long createBy,Date createTime,Long updateBy,Date updateTime,String memo) { + this.uuid = uuid; + this.name = name; + this.description = description; + this.status = status; + this.deleted = deleted; + this.tenantId = tenantId; + this.createBy = createBy; + this.createTime = createTime; + this.updateBy = updateBy; + this.updateTime = updateTime; + this.memo = memo; + } + +// DictType dictType = new DictType( +// null, // 缂栧彿 +// null, // 鍚嶇О +// null, // 鎻忚堪 +// null, // 鐘舵�乕闈炵┖] +// null, // 鏄惁鍒犻櫎[闈炵┖] +// null, // 绉熸埛 +// null, // 娣诲姞浜哄憳 +// null, // 娣诲姞鏃堕棿[闈炵┖] +// null, // 淇敼浜哄憳 +// null, // 淇敼鏃堕棿[闈炵┖] +// null // 澶囨敞 +// ); + + public String getStatus$(){ + if (null == this.status){ return null; } + switch (this.status){ + case 1: + return "姝e父"; + case 0: + return "鍐荤粨"; + default: + return String.valueOf(this.status); + } + } + + public String getCreateBy$(){ + UserService service = SpringUtils.getBean(UserService.class); + User user = service.getById(this.createBy); + if (!Cools.isEmpty(user)){ + return String.valueOf(user.getNickname()); + } + return null; + } + + public String getCreateTime$(){ + if (Cools.isEmpty(this.createTime)){ + return ""; + } + return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(this.createTime); + } + + public String getUpdateBy$(){ + UserService service = SpringUtils.getBean(UserService.class); + User user = service.getById(this.updateBy); + if (!Cools.isEmpty(user)){ + return String.valueOf(user.getNickname()); + } + return null; + } + + public String getUpdateTime$(){ + if (Cools.isEmpty(this.updateTime)){ + return ""; + } + return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(this.updateTime); + } + + + + public Boolean getStatusBool(){ + if (null == this.status){ return null; } + switch (this.status){ + case 1: + return true; + case 0: + return false; + default: + return null; + } + } + +} diff --git a/rsf-server/src/main/java/com/vincent/rsf/server/system/mapper/DictDataMapper.java b/rsf-server/src/main/java/com/vincent/rsf/server/system/mapper/DictDataMapper.java new file mode 100644 index 0000000..92501c3 --- /dev/null +++ b/rsf-server/src/main/java/com/vincent/rsf/server/system/mapper/DictDataMapper.java @@ -0,0 +1,12 @@ +package com.vincent.rsf.server.system.mapper; + +import com.vincent.rsf.server.system.entity.DictData; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.apache.ibatis.annotations.Mapper; +import org.springframework.stereotype.Repository; + +@Mapper +@Repository +public interface DictDataMapper extends BaseMapper<DictData> { + +} diff --git a/rsf-server/src/main/java/com/vincent/rsf/server/system/mapper/DictTypeMapper.java b/rsf-server/src/main/java/com/vincent/rsf/server/system/mapper/DictTypeMapper.java new file mode 100644 index 0000000..3554de8 --- /dev/null +++ b/rsf-server/src/main/java/com/vincent/rsf/server/system/mapper/DictTypeMapper.java @@ -0,0 +1,12 @@ +package com.vincent.rsf.server.system.mapper; + +import com.vincent.rsf.server.system.entity.DictType; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.apache.ibatis.annotations.Mapper; +import org.springframework.stereotype.Repository; + +@Mapper +@Repository +public interface DictTypeMapper extends BaseMapper<DictType> { + +} diff --git a/rsf-server/src/main/java/com/vincent/rsf/server/system/service/DictDataService.java b/rsf-server/src/main/java/com/vincent/rsf/server/system/service/DictDataService.java new file mode 100644 index 0000000..70dbda9 --- /dev/null +++ b/rsf-server/src/main/java/com/vincent/rsf/server/system/service/DictDataService.java @@ -0,0 +1,8 @@ +package com.vincent.rsf.server.system.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.vincent.rsf.server.system.entity.DictData; + +public interface DictDataService extends IService<DictData> { + +} diff --git a/rsf-server/src/main/java/com/vincent/rsf/server/system/service/DictTypeService.java b/rsf-server/src/main/java/com/vincent/rsf/server/system/service/DictTypeService.java new file mode 100644 index 0000000..b28d6b4 --- /dev/null +++ b/rsf-server/src/main/java/com/vincent/rsf/server/system/service/DictTypeService.java @@ -0,0 +1,8 @@ +package com.vincent.rsf.server.system.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.vincent.rsf.server.system.entity.DictType; + +public interface DictTypeService extends IService<DictType> { + +} diff --git a/rsf-server/src/main/java/com/vincent/rsf/server/system/service/impl/DictDataServiceImpl.java b/rsf-server/src/main/java/com/vincent/rsf/server/system/service/impl/DictDataServiceImpl.java new file mode 100644 index 0000000..c788c76 --- /dev/null +++ b/rsf-server/src/main/java/com/vincent/rsf/server/system/service/impl/DictDataServiceImpl.java @@ -0,0 +1,12 @@ +package com.vincent.rsf.server.system.service.impl; + +import com.vincent.rsf.server.system.mapper.DictDataMapper; +import com.vincent.rsf.server.system.entity.DictData; +import com.vincent.rsf.server.system.service.DictDataService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +@Service("dictDataService") +public class DictDataServiceImpl extends ServiceImpl<DictDataMapper, DictData> implements DictDataService { + +} diff --git a/rsf-server/src/main/java/com/vincent/rsf/server/system/service/impl/DictTypeServiceImpl.java b/rsf-server/src/main/java/com/vincent/rsf/server/system/service/impl/DictTypeServiceImpl.java new file mode 100644 index 0000000..84a6300 --- /dev/null +++ b/rsf-server/src/main/java/com/vincent/rsf/server/system/service/impl/DictTypeServiceImpl.java @@ -0,0 +1,12 @@ +package com.vincent.rsf.server.system.service.impl; + +import com.vincent.rsf.server.system.mapper.DictTypeMapper; +import com.vincent.rsf.server.system.entity.DictType; +import com.vincent.rsf.server.system.service.DictTypeService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +@Service("dictTypeService") +public class DictTypeServiceImpl extends ServiceImpl<DictTypeMapper, DictType> implements DictTypeService { + +} diff --git a/rsf-server/src/main/java/dictData.sql b/rsf-server/src/main/java/dictData.sql new file mode 100644 index 0000000..be7e53e --- /dev/null +++ b/rsf-server/src/main/java/dictData.sql @@ -0,0 +1,27 @@ +-- save dictData record +-- mysql +insert into `sys_menu` ( `name`, `parent_id`, `route`, `component`, `type`, `sort`, `tenant_id`, `status`) values ( 'menu.dictData', '0', '/system/dictData', 'dictData', '0' , '0', '1' , '1'); + +insert into `sys_menu` ( `name`, `parent_id`, `type`, `authority`, `sort`, `tenant_id`, `status`) values ( 'Query 瀛楀吀鏁版嵁闆�', '113', '1', 'system:dictData:list', '0', '1', '1'); +insert into `sys_menu` ( `name`, `parent_id`, `type`, `authority`, `sort`, `tenant_id`, `status`) values ( 'Create 瀛楀吀鏁版嵁闆�', '113', '1', 'system:dictData:save', '1', '1', '1'); +insert into `sys_menu` ( `name`, `parent_id`, `type`, `authority`, `sort`, `tenant_id`, `status`) values ( 'Update 瀛楀吀鏁版嵁闆�', '113', '1', 'system:dictData:update', '2', '1', '1'); +insert into `sys_menu` ( `name`, `parent_id`, `type`, `authority`, `sort`, `tenant_id`, `status`) values ( 'Delete 瀛楀吀鏁版嵁闆�', '113', '1', 'system:dictData:remove', '3', '1', '1'); + +-- locale menu name +dictData: 'DictData', + +-- locale field +dictData: { + dictTypeId: "dictTypeId", + dictTypeCode: "dictTypeCode", + value: "value", + label: "label", + sort: "sort", + color: "color", +}, + +-- ResourceContent +import dictData from './dictData'; + +case 'dictData': + return dictData; diff --git a/rsf-server/src/main/java/dictType.sql b/rsf-server/src/main/java/dictType.sql new file mode 100644 index 0000000..ba01cea --- /dev/null +++ b/rsf-server/src/main/java/dictType.sql @@ -0,0 +1,24 @@ +-- save dictType record +-- mysql +insert into `sys_menu` ( `name`, `parent_id`, `route`, `component`, `type`, `sort`, `tenant_id`, `status`) values ( 'menu.dictType', '0', '/system/dictType', 'dictType', '0' , '0', '1' , '1'); + +insert into `sys_menu` ( `name`, `parent_id`, `type`, `authority`, `sort`, `tenant_id`, `status`) values ( 'Query 鏁版嵁瀛楀吀', '108', '1', 'system:dictType:list', '0', '1', '1'); +insert into `sys_menu` ( `name`, `parent_id`, `type`, `authority`, `sort`, `tenant_id`, `status`) values ( 'Create 鏁版嵁瀛楀吀', '108', '1', 'system:dictType:save', '1', '1', '1'); +insert into `sys_menu` ( `name`, `parent_id`, `type`, `authority`, `sort`, `tenant_id`, `status`) values ( 'Update 鏁版嵁瀛楀吀', '108', '1', 'system:dictType:update', '2', '1', '1'); +insert into `sys_menu` ( `name`, `parent_id`, `type`, `authority`, `sort`, `tenant_id`, `status`) values ( 'Delete 鏁版嵁瀛楀吀', '108', '1', 'system:dictType:remove', '3', '1', '1'); + +-- locale menu name +dictType: 'DictType', + +-- locale field +dictType: { + uuid: "uuid", + name: "name", + description: "description", +}, + +-- ResourceContent +import dictType from './dictType'; + +case 'dictType': + return dictType; diff --git a/rsf-server/src/main/java/stock.sql b/rsf-server/src/main/java/stock.sql deleted file mode 100644 index 2eb084d..0000000 --- a/rsf-server/src/main/java/stock.sql +++ /dev/null @@ -1,30 +0,0 @@ --- save stock record --- mysql -insert into `sys_menu` ( `name`, `parent_id`, `route`, `component`, `type`, `sort`, `tenant_id`, `status`) values ( 'menu.stock', '0', '/manager/stock', 'stock', '0' , '0', '1' , '1'); - -insert into `sys_menu` ( `name`, `parent_id`, `type`, `authority`, `sort`, `tenant_id`, `status`) values ( 'Query 鍚堝悓淇℃伅', '93', '1', 'manager:stock:list', '0', '1', '1'); -insert into `sys_menu` ( `name`, `parent_id`, `type`, `authority`, `sort`, `tenant_id`, `status`) values ( 'Create 鍚堝悓淇℃伅', '93', '1', 'manager:stock:save', '1', '1', '1'); -insert into `sys_menu` ( `name`, `parent_id`, `type`, `authority`, `sort`, `tenant_id`, `status`) values ( 'Update 鍚堝悓淇℃伅', '93', '1', 'manager:stock:update', '2', '1', '1'); -insert into `sys_menu` ( `name`, `parent_id`, `type`, `authority`, `sort`, `tenant_id`, `status`) values ( 'Delete 鍚堝悓淇℃伅', '93', '1', 'manager:stock:remove', '3', '1', '1'); - --- locale menu name -stock: 'Stock', - --- locale field -stock: { - asnOrder: "asnOrder", - erpToken: "erpToken", - erpOrder: "erpOrder", - erpStkAdr: "erpStkAdr", - contractId: "contractId", - lockReason: "lockReason", - lockStatus: "lockStatus", - locker: "locker", - lockedTime: "lockedTime", -}, - --- ResourceContent -import stock from './stock'; - -case 'stock': - return stock; diff --git a/rsf-server/src/main/java/stockItem.sql b/rsf-server/src/main/java/stockItem.sql deleted file mode 100644 index 8c1864a..0000000 --- a/rsf-server/src/main/java/stockItem.sql +++ /dev/null @@ -1,48 +0,0 @@ --- save stockItem record --- mysql -insert into `sys_menu` ( `name`, `parent_id`, `route`, `component`, `type`, `sort`, `tenant_id`, `status`) values ( 'menu.stockItem', '0', '/manager/stockItem', 'stockItem', '0' , '0', '1' , '1'); - -insert into `sys_menu` ( `name`, `parent_id`, `type`, `authority`, `sort`, `tenant_id`, `status`) values ( 'Query 搴撳瓨鏄庣粏琛�', '98', '1', 'manager:stockItem:list', '0', '1', '1'); -insert into `sys_menu` ( `name`, `parent_id`, `type`, `authority`, `sort`, `tenant_id`, `status`) values ( 'Create 搴撳瓨鏄庣粏琛�', '98', '1', 'manager:stockItem:save', '1', '1', '1'); -insert into `sys_menu` ( `name`, `parent_id`, `type`, `authority`, `sort`, `tenant_id`, `status`) values ( 'Update 搴撳瓨鏄庣粏琛�', '98', '1', 'manager:stockItem:update', '2', '1', '1'); -insert into `sys_menu` ( `name`, `parent_id`, `type`, `authority`, `sort`, `tenant_id`, `status`) values ( 'Delete 搴撳瓨鏄庣粏琛�', '98', '1', 'manager:stockItem:remove', '3', '1', '1'); - --- locale menu name -stockItem: 'StockItem', - --- locale field -stockItem: { - stockId: "stockId", - matnrId: "matnrId", - code: "code", - matnrk: "matnrk", - anfme: "anfme", - workQty: "workQty", - qty: "qty", - weight: "weight", - unit: "unit", - shipperId: "shipperId", - splrId: "splrId", - brand: "brand", - batch: "batch", - prodTime: "prodTime", - inspectId: "inspectId", - splrBtch: "splrBtch", - asnOrder: "asnOrder", - erpToken: "erpToken", - erpOrder: "erpOrder", - erpStkAdr: "erpStkAdr", - locId: "locId", - barcode: "barcode", - purPrice: "purPrice", - lockReason: "lockReason", - lockStatus: "lockStatus", - locker: "locker", - lockedTime: "lockedTime", -}, - --- ResourceContent -import stockItem from './stockItem'; - -case 'stockItem': - return stockItem; diff --git a/rsf-server/src/main/resources/mapper/manager/DictTypeMapper.xml b/rsf-server/src/main/resources/mapper/manager/DictTypeMapper.xml new file mode 100644 index 0000000..6b78f39 --- /dev/null +++ b/rsf-server/src/main/resources/mapper/manager/DictTypeMapper.xml @@ -0,0 +1,5 @@ +<?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="com.vincent.rsf.server.manager.mapper.DictTypeMapper"> + +</mapper> diff --git a/rsf-server/src/main/resources/mapper/system/DictDataMapper.xml b/rsf-server/src/main/resources/mapper/system/DictDataMapper.xml new file mode 100644 index 0000000..34587c1 --- /dev/null +++ b/rsf-server/src/main/resources/mapper/system/DictDataMapper.xml @@ -0,0 +1,5 @@ +<?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="com.vincent.rsf.server.system.mapper.DictDataMapper"> + +</mapper> diff --git a/rsf-server/src/main/resources/mapper/system/DictTypeMapper.xml b/rsf-server/src/main/resources/mapper/system/DictTypeMapper.xml new file mode 100644 index 0000000..37cac9c --- /dev/null +++ b/rsf-server/src/main/resources/mapper/system/DictTypeMapper.xml @@ -0,0 +1,5 @@ +<?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="com.vincent.rsf.server.system.mapper.DictTypeMapper"> + +</mapper> diff --git a/version/db/sys_dict_data.sql b/version/db/sys_dict_data.sql new file mode 100644 index 0000000..f72110f --- /dev/null +++ b/version/db/sys_dict_data.sql @@ -0,0 +1,40 @@ +/* + Navicat Premium Data Transfer + + Source Server : localhost + Source Server Type : MySQL + Source Server Version : 80011 (8.0.11) + Source Host : localhost:3306 + Source Schema : fortec-bm + + Target Server Type : MySQL + Target Server Version : 80011 (8.0.11) + File Encoding : 65001 + + Date: 24/02/2025 08:45:02 +*/ + +SET NAMES utf8mb4; +SET FOREIGN_KEY_CHECKS = 0; + +-- ---------------------------- +-- Table structure for sys_dict_data +-- ---------------------------- +DROP TABLE IF EXISTS `sys_dict_data`; +CREATE TABLE `sys_dict_data` ( + `id` bigint(20) NOT NULL COMMENT 'id', + `dict_type_id` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '瀛楀吀ID', + `dict_type_code` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '瀛楀吀璇嗗埆鐮�', + `value` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '鍊�', + `label` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '鏍囩', + `sort` int(11) DEFAULT NULL COMMENT '鎺掑簭', + `color` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '棰滆壊銆備緥濡傦細#FFFFFF銆乥lue銆乺gba(0,0,0,0.5)', + `creator` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'creator', + `gmt_create` datetime DEFAULT NULL COMMENT 'gmt_create', + `modifier` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'modifier', + `gmt_modified` datetime DEFAULT NULL COMMENT 'gmt_modified', + PRIMARY KEY (`id`) USING BTREE, + KEY `IX__value` (`value`) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC COMMENT='瀛楀吀瀛楁琛�'; + +SET FOREIGN_KEY_CHECKS = 1; diff --git a/version/db/sys_dict_type.sql b/version/db/sys_dict_type.sql new file mode 100644 index 0000000..1485dd3 --- /dev/null +++ b/version/db/sys_dict_type.sql @@ -0,0 +1,36 @@ +/* + Navicat Premium Data Transfer + + Source Server : localhost + Source Server Type : MySQL + Source Server Version : 80011 (8.0.11) + Source Host : localhost:3306 + Source Schema : fortec-bm + + Target Server Type : MySQL + Target Server Version : 80011 (8.0.11) + File Encoding : 65001 + + Date: 24/02/2025 08:45:14 +*/ + +SET NAMES utf8mb4; +SET FOREIGN_KEY_CHECKS = 0; + +-- ---------------------------- +-- Table structure for sys_dict_type +-- ---------------------------- +DROP TABLE IF EXISTS `sys_dict_type`; +CREATE TABLE `sys_dict_type` ( + `id` bigint(20) NOT NULL COMMENT 'id', + `code` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '璇嗗埆鐮�', + `name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '瀛楀吀鍚嶇О', + `description` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '鎻忚堪', + `creator` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'creator', + `gmt_create` datetime DEFAULT NULL COMMENT 'gmt_create', + `modifier` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'modifier', + `gmt_modified` datetime DEFAULT NULL COMMENT 'gmt_modified', + PRIMARY KEY (`id`) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC COMMENT='瀛楀吀琛�'; + +SET FOREIGN_KEY_CHECKS = 1; -- Gitblit v1.9.1