From 21f4b0f75b4c62c84465abc78951c4ec13912c0b Mon Sep 17 00:00:00 2001 From: skyouc Date: 星期一, 24 二月 2025 12:33:52 +0800 Subject: [PATCH] #新增&修改 1. 删除货主管理 2. 删除客户管理 3.新增往来企业管理 --- rsf-server/src/main/java/com/vincent/rsf/server/manager/entity/Companys.java | 266 ++++++++++++++ rsf-admin/src/page/basicInfo/companys/CompanysCreate.jsx | 196 ++++++++++ rsf-server/src/main/java/com/vincent/rsf/server/manager/service/CompanysService.java | 8 rsf-admin/src/page/basicInfo/companys/CompanysList.jsx | 58 ++- rsf-server/src/main/java/com/vincent/rsf/server/common/CodeBuilder.java | 4 rsf-server/src/main/java/com/vincent/rsf/server/manager/service/impl/CompanysServiceImpl.java | 12 /dev/null | 18 - rsf-server/src/main/java/companys.sql | 33 + rsf-server/src/main/java/com/vincent/rsf/server/manager/controller/CompanysController.java | 110 ++++++ rsf-server/src/main/resources/mapper/manager/CompanysMapper.xml | 5 rsf-admin/src/page/basicInfo/companys/CompanysEdit.jsx | 168 +++++++++ rsf-server/src/main/java/com/vincent/rsf/server/manager/mapper/CompanysMapper.java | 12 rsf-admin/src/page/basicInfo/companys/index.jsx | 8 rsf-admin/src/i18n/zh.js | 17 rsf-admin/src/i18n/en.js | 15 rsf-admin/src/page/ResourceContent.js | 9 rsf-admin/src/page/basicInfo/companys/CompanysPanel.jsx | 123 ++++++ 17 files changed, 1,012 insertions(+), 50 deletions(-) diff --git a/rsf-admin/src/i18n/en.js b/rsf-admin/src/i18n/en.js index c1cf780..070ab41 100644 --- a/rsf-admin/src/i18n/en.js +++ b/rsf-admin/src/i18n/en.js @@ -132,6 +132,7 @@ qlyInspect: 'QlyInspect', dictType: 'DictType', dictData: 'DictData', + companys: 'Companys', @@ -353,6 +354,20 @@ sort: "sort", color: "color", }, + companys: { + code: "Code", + name: "Name", + nameEn: "NameEn", + breifCode: "BreifCode", + type: "Type", + contact: "Contact", + tel: "Tel", + email: "Email", + pcode: "PCode", + province: "Province", + city: "City", + address: "Address", + }, } }, page: { diff --git a/rsf-admin/src/i18n/zh.js b/rsf-admin/src/i18n/zh.js index edbb37d..d9d40da 100644 --- a/rsf-admin/src/i18n/zh.js +++ b/rsf-admin/src/i18n/zh.js @@ -131,7 +131,7 @@ qlyInspect: '璐ㄦ淇℃伅', dictType: '鏁版嵁瀛楀吀', dictData: '瀛楀吀鏁版嵁闆�', - + companys: '寰�鏉ヤ紒涓�', }, @@ -353,6 +353,21 @@ sort: "鎺掑簭", color: "棰滆壊", }, + companys: { + code: "浼佷笟缂栫爜", + name: "鍚嶇О", + nameEn: "鑻辨枃鍒悕", + breifCode: "鍔╄鐮�", + type: "绫诲瀷", + contact: "鑱旂郴浜�", + tel: "鑱旂郴鐢佃瘽", + email: "鐢靛瓙閭欢", + pcode: "閭紪", + province: "鐪佷唤", + city: "鍩庡競", + address: "鍦板潃", + }, + } }, page: { diff --git a/rsf-admin/src/page/ResourceContent.js b/rsf-admin/src/page/ResourceContent.js index 4fe2594..43069ae 100644 --- a/rsf-admin/src/page/ResourceContent.js +++ b/rsf-admin/src/page/ResourceContent.js @@ -13,8 +13,6 @@ import menu from './system/menu' import user from './system/user'; import operationRecord from './system/operationRecord'; -import customer from './customer'; -import shipper from './basicInfo/shipper'; import matnr from './basicInfo/matnr'; import matnrGroup from './basicInfo/matnrGroup'; import warehouse from './basicInfo/warehouse'; @@ -25,6 +23,7 @@ import qlyInspect from './qlyInspect'; import dictType from './dictType'; import dictData from './dictData'; +import companys from './basicInfo/companys'; const ResourceContent = (node) => { @@ -47,10 +46,6 @@ return user; case 'operationRecord': return operationRecord; - case 'customer': - return customer; - case 'shipper': - return shipper; case 'matnr': return matnr; case 'matnrGroup': @@ -71,6 +66,8 @@ return dictType; case 'dictData': return dictData; + case 'companys': + return companys; default: return { list: ListGuesser, diff --git a/rsf-admin/src/page/basicInfo/companys/CompanysCreate.jsx b/rsf-admin/src/page/basicInfo/companys/CompanysCreate.jsx new file mode 100644 index 0000000..fea93d5 --- /dev/null +++ b/rsf-admin/src/page/basicInfo/companys/CompanysCreate.jsx @@ -0,0 +1,196 @@ +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 CompanysCreate = (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.companys.code" + source="code" + parse={v => v} + autoFocus + /> + </Grid> + <Grid item xs={6} display="flex" gap={1}> + <TextInput + label="table.field.companys.name" + source="name" + parse={v => v} + /> + </Grid> + <Grid item xs={6} display="flex" gap={1}> + <TextInput + label="table.field.companys.nameEn" + source="nameEn" + parse={v => v} + /> + </Grid> + <Grid item xs={6} display="flex" gap={1}> + <TextInput + label="table.field.companys.breifCode" + source="breifCode" + parse={v => v} + /> + </Grid> + <Grid item xs={6} display="flex" gap={1}> + <TextInput + label="table.field.companys.type" + source="type" + parse={v => v} + validate={required()} + /> + </Grid> + <Grid item xs={6} display="flex" gap={1}> + <TextInput + label="table.field.companys.contact" + source="contact" + parse={v => v} + /> + </Grid> + <Grid item xs={6} display="flex" gap={1}> + <TextInput + label="table.field.companys.tel" + source="tel" + parse={v => v} + /> + </Grid> + <Grid item xs={6} display="flex" gap={1}> + <TextInput + label="table.field.companys.email" + source="email" + parse={v => v} + /> + </Grid> + <Grid item xs={6} display="flex" gap={1}> + <TextInput + label="table.field.companys.pcode" + source="pcode" + parse={v => v} + /> + </Grid> + <Grid item xs={6} display="flex" gap={1}> + <TextInput + label="table.field.companys.province" + source="province" + parse={v => v} + /> + </Grid> + <Grid item xs={6} display="flex" gap={1}> + <TextInput + label="table.field.companys.city" + source="city" + parse={v => v} + /> + </Grid> + <Grid item xs={6} display="flex" gap={1}> + <TextInput + label="table.field.companys.address" + source="address" + 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 CompanysCreate; diff --git a/rsf-admin/src/page/basicInfo/companys/CompanysEdit.jsx b/rsf-admin/src/page/basicInfo/companys/CompanysEdit.jsx new file mode 100644 index 0000000..a559320 --- /dev/null +++ b/rsf-admin/src/page/basicInfo/companys/CompanysEdit.jsx @@ -0,0 +1,168 @@ +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 CompanysEdit = () => { + 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.companys.code" + source="code" + parse={v => v} + autoFocus + /> + </Stack> + <Stack direction='row' gap={2}> + <TextInput + label="table.field.companys.name" + source="name" + parse={v => v} + /> + </Stack> + <Stack direction='row' gap={2}> + <TextInput + label="table.field.companys.nameEn" + source="nameEn" + parse={v => v} + /> + </Stack> + <Stack direction='row' gap={2}> + <TextInput + label="table.field.companys.breifCode" + source="breifCode" + parse={v => v} + /> + </Stack> + <Stack direction='row' gap={2}> + <TextInput + label="table.field.companys.type" + source="type" + parse={v => v} + validate={required()} + /> + </Stack> + <Stack direction='row' gap={2}> + <TextInput + label="table.field.companys.contact" + source="contact" + parse={v => v} + /> + </Stack> + <Stack direction='row' gap={2}> + <TextInput + label="table.field.companys.tel" + source="tel" + parse={v => v} + /> + </Stack> + <Stack direction='row' gap={2}> + <TextInput + label="table.field.companys.email" + source="email" + parse={v => v} + /> + </Stack> + <Stack direction='row' gap={2}> + <TextInput + label="table.field.companys.pcode" + source="pcode" + parse={v => v} + /> + </Stack> + <Stack direction='row' gap={2}> + <TextInput + label="table.field.companys.province" + source="province" + parse={v => v} + /> + </Stack> + <Stack direction='row' gap={2}> + <TextInput + label="table.field.companys.city" + source="city" + parse={v => v} + /> + </Stack> + <Stack direction='row' gap={2}> + <TextInput + label="table.field.companys.address" + source="address" + 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 CompanysEdit; diff --git a/rsf-admin/src/page/basicInfo/shipper/ShipperList.jsx b/rsf-admin/src/page/basicInfo/companys/CompanysList.jsx similarity index 65% rename from rsf-admin/src/page/basicInfo/shipper/ShipperList.jsx rename to rsf-admin/src/page/basicInfo/companys/CompanysList.jsx index facfcd5..dd3561b 100644 --- a/rsf-admin/src/page/basicInfo/shipper/ShipperList.jsx +++ b/rsf-admin/src/page/basicInfo/companys/CompanysList.jsx @@ -34,13 +34,13 @@ } from 'react-admin'; import { Box, Typography, Card, Stack } from '@mui/material'; import { styled } from '@mui/material/styles'; -import ShipperCreate from "./ShipperCreate"; -import ShipperPanel from "./ShipperPanel"; -import EmptyData from "@/page/components/EmptyData"; -import MyCreateButton from "@/page/components/MyCreateButton"; -import MyExportButton from '@/page/components/MyExportButton'; -import PageDrawer from "@/page/components/PageDrawer"; -import MyField from "@/page/components/MyField"; +import CompanysCreate from "./CompanysCreate"; +import CompanysPanel from "./CompanysPanel"; +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'; @@ -63,8 +63,18 @@ <DateInput label='common.time.after' source="timeStart" alwaysOn />, <DateInput label='common.time.before' source="timeEnd" alwaysOn />, - <TextInput source="uuid" label="table.field.shipper.uuid" />, - <TextInput source="name" label="table.field.shipper.name" />, + <TextInput source="code" label="table.field.companys.code" />, + <TextInput source="name" label="table.field.companys.name" />, + <TextInput source="nameEn" label="table.field.companys.nameEn" />, + <TextInput source="breifCode" label="table.field.companys.breifCode" />, + <TextInput source="type" label="table.field.companys.type" />, + <TextInput source="contact" label="table.field.companys.contact" />, + <TextInput source="tel" label="table.field.companys.tel" />, + <TextInput source="email" label="table.field.companys.email" />, + <TextInput source="pcode" label="table.field.companys.pcode" />, + <TextInput source="province" label="table.field.companys.province" />, + <TextInput source="city" label="table.field.companys.city" />, + <TextInput source="address" label="table.field.companys.address" />, <TextInput label="common.field.memo" source="memo" />, <SelectInput @@ -78,7 +88,7 @@ />, ] -const ShipperList = () => { +const CompanysList = () => { const translate = useTranslate(); const [createDialog, setCreateDialog] = useState(false); @@ -95,7 +105,7 @@ }), marginRight: !!drawerVal ? `${PAGE_DRAWER_WIDTH}px` : 0, }} - title={"menu.shipper"} + title={"menu.companys"} empty={<EmptyData onClick={() => { setCreateDialog(true) }} />} filters={filters} sort={{ field: "create_time", order: "desc" }} @@ -103,23 +113,33 @@ <TopToolbar> <FilterButton /> <MyCreateButton onClick={() => { setCreateDialog(true) }} /> - <SelectColumnsButton preferenceKey='shipper' /> + <SelectColumnsButton preferenceKey='companys' /> <MyExportButton /> </TopToolbar> )} perPage={DEFAULT_PAGE_SIZE} > <StyledDatagrid - preferenceKey='shipper' + preferenceKey='companys' bulkActionButtons={() => <BulkDeleteButton mutationMode={OPERATE_MODE} />} rowClick={(id, resource, record) => false} - expand={() => <ShipperPanel />} + expand={() => <CompanysPanel />} expandSingle={true} omit={['id', 'createTime', 'createBy', 'memo']} > <NumberField source="id" /> - <TextField source="uuid" label="table.field.shipper.uuid" /> - <TextField source="name" label="table.field.shipper.name" /> + <TextField source="code" label="table.field.companys.code" /> + <TextField source="name" label="table.field.companys.name" /> + <TextField source="nameEn" label="table.field.companys.nameEn" /> + <TextField source="breifCode" label="table.field.companys.breifCode" /> + <TextField source="type" label="table.field.companys.type" /> + <TextField source="contact" label="table.field.companys.contact" /> + <TextField source="tel" label="table.field.companys.tel" /> + <TextField source="email" label="table.field.companys.email" /> + <TextField source="pcode" label="table.field.companys.pcode" /> + <TextField source="province" label="table.field.companys.province" /> + <TextField source="city" label="table.field.companys.city" /> + <TextField source="address" label="table.field.companys.address" /> <ReferenceField source="updateBy" label="common.field.updateBy" reference="user" link={false} sortable={false}> <TextField source="nickname" /> @@ -137,12 +157,12 @@ </WrapperField> </StyledDatagrid> </List> - <ShipperCreate + <CompanysCreate open={createDialog} setOpen={setCreateDialog} /> <PageDrawer - title='Shipper Detail' + title='Companys Detail' drawerVal={drawerVal} setDrawerVal={setDrawerVal} > @@ -151,4 +171,4 @@ ) } -export default ShipperList; +export default CompanysList; diff --git a/rsf-admin/src/page/basicInfo/companys/CompanysPanel.jsx b/rsf-admin/src/page/basicInfo/companys/CompanysPanel.jsx new file mode 100644 index 0000000..d0cdf5b --- /dev/null +++ b/rsf-admin/src/page/basicInfo/companys/CompanysPanel.jsx @@ -0,0 +1,123 @@ +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 CompanysPanel = () => { + 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.companys.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.companys.code" + property={record.code} + /> + </Grid> + <Grid item xs={6}> + <PanelTypography + title="table.field.companys.name" + property={record.name} + /> + </Grid> + <Grid item xs={6}> + <PanelTypography + title="table.field.companys.nameEn" + property={record.nameEn} + /> + </Grid> + <Grid item xs={6}> + <PanelTypography + title="table.field.companys.breifCode" + property={record.breifCode} + /> + </Grid> + <Grid item xs={6}> + <PanelTypography + title="table.field.companys.type" + property={record.type} + /> + </Grid> + <Grid item xs={6}> + <PanelTypography + title="table.field.companys.contact" + property={record.contact} + /> + </Grid> + <Grid item xs={6}> + <PanelTypography + title="table.field.companys.tel" + property={record.tel} + /> + </Grid> + <Grid item xs={6}> + <PanelTypography + title="table.field.companys.email" + property={record.email} + /> + </Grid> + <Grid item xs={6}> + <PanelTypography + title="table.field.companys.pcode" + property={record.pcode} + /> + </Grid> + <Grid item xs={6}> + <PanelTypography + title="table.field.companys.province" + property={record.province} + /> + </Grid> + <Grid item xs={6}> + <PanelTypography + title="table.field.companys.city" + property={record.city} + /> + </Grid> + <Grid item xs={6}> + <PanelTypography + title="table.field.companys.address" + property={record.address} + /> + </Grid> + + </Grid> + </CardContent> + </Card > + </> + ); +}; + +export default CompanysPanel; diff --git a/rsf-admin/src/page/basicInfo/shipper/index.jsx b/rsf-admin/src/page/basicInfo/companys/index.jsx similarity index 67% rename from rsf-admin/src/page/basicInfo/shipper/index.jsx rename to rsf-admin/src/page/basicInfo/companys/index.jsx index 27015aa..afa36e5 100644 --- a/rsf-admin/src/page/basicInfo/shipper/index.jsx +++ b/rsf-admin/src/page/basicInfo/companys/index.jsx @@ -5,12 +5,12 @@ ShowGuesser, } from "react-admin"; -import ShipperList from "./ShipperList"; -import ShipperEdit from "./ShipperEdit"; +import CompanysList from "./CompanysList"; +import CompanysEdit from "./CompanysEdit"; export default { - list: ShipperList, - edit: ShipperEdit, + list: CompanysList, + edit: CompanysEdit, show: ShowGuesser, recordRepresentation: (record) => { return `${record.name}` diff --git a/rsf-admin/src/page/basicInfo/shipper/ShipperCreate.jsx b/rsf-admin/src/page/basicInfo/shipper/ShipperCreate.jsx deleted file mode 100644 index b45fd01..0000000 --- a/rsf-admin/src/page/basicInfo/shipper/ShipperCreate.jsx +++ /dev/null @@ -1,125 +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 "@/page/components/DialogCloseButton"; -import StatusSelectInput from "@/page/components/StatusSelectInput"; -import MemoInput from "@/page/components/MemoInput"; - -const ShipperCreate = (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.shipper.uuid" - source="uuid" - parse={v => v} - autoFocus - /> - </Grid> - <Grid item xs={6} display="flex" gap={1}> - <TextInput - label="table.field.shipper.name" - source="name" - 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 ShipperCreate; diff --git a/rsf-admin/src/page/basicInfo/shipper/ShipperEdit.jsx b/rsf-admin/src/page/basicInfo/shipper/ShipperEdit.jsx deleted file mode 100644 index e81f51e..0000000 --- a/rsf-admin/src/page/basicInfo/shipper/ShipperEdit.jsx +++ /dev/null @@ -1,97 +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 "@/page/components/EditBaseAside"; -import CustomerTopToolBar from "@/page/components/EditTopToolBar"; -import MemoInput from "@/page/components/MemoInput"; -import StatusSelectInput from "@/page/components/StatusSelectInput"; - -const FormToolbar = () => { - const { getValues } = useFormContext(); - - return ( - <Toolbar sx={{ justifyContent: 'space-between' }}> - <SaveButton /> - <DeleteButton mutationMode="optimistic" /> - </Toolbar> - ) -} - -const ShipperEdit = () => { - 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.shipper.uuid" - source="uuid" - parse={v => v} - autoFocus - /> - </Stack> - <Stack direction='row' gap={2}> - <TextInput - label="table.field.shipper.name" - source="name" - 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 ShipperEdit; diff --git a/rsf-admin/src/page/basicInfo/shipper/ShipperPanel.jsx b/rsf-admin/src/page/basicInfo/shipper/ShipperPanel.jsx deleted file mode 100644 index f548e14..0000000 --- a/rsf-admin/src/page/basicInfo/shipper/ShipperPanel.jsx +++ /dev/null @@ -1,63 +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 "@/page/components/PanelTypography"; -import * as Common from '@/utils/common' - -const ShipperPanel = () => { - 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.shipper.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.shipper.uuid" - property={record.uuid} - /> - </Grid> - <Grid item xs={6}> - <PanelTypography - title="table.field.shipper.name" - property={record.name} - /> - </Grid> - - </Grid> - </CardContent> - </Card > - </> - ); -}; - -export default ShipperPanel; diff --git a/rsf-admin/src/page/customer/CustomerCreate.jsx b/rsf-admin/src/page/customer/CustomerCreate.jsx deleted file mode 100644 index 2d82ef9..0000000 --- a/rsf-admin/src/page/customer/CustomerCreate.jsx +++ /dev/null @@ -1,125 +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 CustomerCreate = (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.customer.uuid" - source="uuid" - parse={v => v} - autoFocus - /> - </Grid> - <Grid item xs={6} display="flex" gap={1}> - <TextInput - label="table.field.customer.name" - source="name" - 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 CustomerCreate; diff --git a/rsf-admin/src/page/customer/CustomerEdit.jsx b/rsf-admin/src/page/customer/CustomerEdit.jsx deleted file mode 100644 index 1419e8f..0000000 --- a/rsf-admin/src/page/customer/CustomerEdit.jsx +++ /dev/null @@ -1,97 +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 CustomerEdit = () => { - 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.customer.uuid" - source="uuid" - parse={v => v} - autoFocus - /> - </Stack> - <Stack direction='row' gap={2}> - <TextInput - label="table.field.customer.name" - source="name" - 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 CustomerEdit; diff --git a/rsf-admin/src/page/customer/CustomerList.jsx b/rsf-admin/src/page/customer/CustomerList.jsx deleted file mode 100644 index 6973f5f..0000000 --- a/rsf-admin/src/page/customer/CustomerList.jsx +++ /dev/null @@ -1,154 +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 CustomerCreate from "./CustomerCreate"; -import CustomerPanel from "./CustomerPanel"; -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="uuid" label="table.field.customer.uuid" />, - <TextInput source="name" label="table.field.customer.name" />, - - <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 CustomerList = () => { - 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.customer"} - empty={<EmptyData onClick={() => { setCreateDialog(true) }} />} - filters={filters} - sort={{ field: "create_time", order: "desc" }} - actions={( - <TopToolbar> - <FilterButton /> - <MyCreateButton onClick={() => { setCreateDialog(true) }} /> - <SelectColumnsButton preferenceKey='customer' /> - <MyExportButton /> - </TopToolbar> - )} - perPage={DEFAULT_PAGE_SIZE} - > - <StyledDatagrid - preferenceKey='customer' - bulkActionButtons={() => <BulkDeleteButton mutationMode={OPERATE_MODE} />} - rowClick={(id, resource, record) => false} - expand={() => <CustomerPanel />} - expandSingle={true} - omit={['id', 'createTime', 'createBy', 'memo']} - > - <NumberField source="id" /> - <TextField source="uuid" label="table.field.customer.uuid" /> - <TextField source="name" label="table.field.customer.name" /> - - <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> - <CustomerCreate - open={createDialog} - setOpen={setCreateDialog} - /> - <PageDrawer - title='Customer Detail' - drawerVal={drawerVal} - setDrawerVal={setDrawerVal} - > - </PageDrawer> - </Box> - ) -} - -export default CustomerList; diff --git a/rsf-admin/src/page/customer/CustomerPanel.jsx b/rsf-admin/src/page/customer/CustomerPanel.jsx deleted file mode 100644 index d03f129..0000000 --- a/rsf-admin/src/page/customer/CustomerPanel.jsx +++ /dev/null @@ -1,63 +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 CustomerPanel = () => { - 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.customer.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.customer.uuid" - property={record.uuid} - /> - </Grid> - <Grid item xs={6}> - <PanelTypography - title="table.field.customer.name" - property={record.name} - /> - </Grid> - - </Grid> - </CardContent> - </Card > - </> - ); -}; - -export default CustomerPanel; diff --git a/rsf-admin/src/page/customer/index.jsx b/rsf-admin/src/page/customer/index.jsx deleted file mode 100644 index 6ffbc95..0000000 --- a/rsf-admin/src/page/customer/index.jsx +++ /dev/null @@ -1,18 +0,0 @@ -import React, { useState, useRef, useEffect, useMemo } from "react"; -import { - ListGuesser, - EditGuesser, - ShowGuesser, -} from "react-admin"; - -import CustomerList from "./CustomerList"; -import CustomerEdit from "./CustomerEdit"; - -export default { - list: CustomerList, - edit: CustomerEdit, - show: ShowGuesser, - recordRepresentation: (record) => { - return `${record.name}` - } -}; 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 a6ffa38..357b792 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="sys_dict_data"; + generator.table="man_companys"; generator.tableDesc="瀛楀吀鏁版嵁闆�"; - generator.packagePath="com.vincent.rsf.server.system"; + generator.packagePath="com.vincent.rsf.server.manager"; generator.build(); } diff --git a/rsf-server/src/main/java/com/vincent/rsf/server/manager/controller/CompanysController.java b/rsf-server/src/main/java/com/vincent/rsf/server/manager/controller/CompanysController.java new file mode 100644 index 0000000..0c5d1f2 --- /dev/null +++ b/rsf-server/src/main/java/com/vincent/rsf/server/manager/controller/CompanysController.java @@ -0,0 +1,110 @@ +package com.vincent.rsf.server.manager.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.manager.entity.Companys; +import com.vincent.rsf.server.manager.service.CompanysService; +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 CompanysController extends BaseController { + + @Autowired + private CompanysService companysService; + + @PreAuthorize("hasAuthority('manager:companys:list')") + @PostMapping("/companys/page") + public R page(@RequestBody Map<String, Object> map) { + BaseParam baseParam = buildParam(map, BaseParam.class); + PageParam<Companys, BaseParam> pageParam = new PageParam<>(baseParam, Companys.class); + return R.ok().add(companysService.page(pageParam, pageParam.buildWrapper(true))); + } + + @PreAuthorize("hasAuthority('manager:companys:list')") + @PostMapping("/companys/list") + public R list(@RequestBody Map<String, Object> map) { + return R.ok().add(companysService.list()); + } + + @PreAuthorize("hasAuthority('manager:companys:list')") + @PostMapping({"/companys/many/{ids}", "/companyss/many/{ids}"}) + public R many(@PathVariable Long[] ids) { + return R.ok().add(companysService.listByIds(Arrays.asList(ids))); + } + + @PreAuthorize("hasAuthority('manager:companys:list')") + @GetMapping("/companys/{id}") + public R get(@PathVariable("id") Long id) { + return R.ok().add(companysService.getById(id)); + } + + @PreAuthorize("hasAuthority('manager:companys:save')") + @OperationLog("Create 瀛楀吀鏁版嵁闆�") + @PostMapping("/companys/save") + public R save(@RequestBody Companys companys) { + companys.setCreateBy(getLoginUserId()); + companys.setCreateTime(new Date()); + companys.setUpdateBy(getLoginUserId()); + companys.setUpdateTime(new Date()); + if (!companysService.save(companys)) { + return R.error("Save Fail"); + } + return R.ok("Save Success").add(companys); + } + + @PreAuthorize("hasAuthority('manager:companys:update')") + @OperationLog("Update 瀛楀吀鏁版嵁闆�") + @PostMapping("/companys/update") + public R update(@RequestBody Companys companys) { + companys.setUpdateBy(getLoginUserId()); + companys.setUpdateTime(new Date()); + if (!companysService.updateById(companys)) { + return R.error("Update Fail"); + } + return R.ok("Update Success").add(companys); + } + + @PreAuthorize("hasAuthority('manager:companys:remove')") + @OperationLog("Delete 瀛楀吀鏁版嵁闆�") + @PostMapping("/companys/remove/{ids}") + public R remove(@PathVariable Long[] ids) { + if (!companysService.removeByIds(Arrays.asList(ids))) { + return R.error("Delete Fail"); + } + return R.ok("Delete Success").add(ids); + } + + @PreAuthorize("hasAuthority('manager:companys:list')") + @PostMapping("/companys/query") + public R query(@RequestParam(required = false) String condition) { + List<KeyValVo> vos = new ArrayList<>(); + LambdaQueryWrapper<Companys> wrapper = new LambdaQueryWrapper<>(); + if (!Cools.isEmpty(condition)) { + wrapper.like(Companys::getName, condition); + } + companysService.page(new Page<>(1, 30), wrapper).getRecords().forEach( + item -> vos.add(new KeyValVo(item.getId(), item.getName())) + ); + return R.ok().add(vos); + } + + @PreAuthorize("hasAuthority('manager:companys:list')") + @PostMapping("/companys/export") + public void export(@RequestBody Map<String, Object> map, HttpServletResponse response) throws Exception { + ExcelUtil.build(ExcelUtil.create(companysService.list(), Companys.class), response); + } + +} diff --git a/rsf-server/src/main/java/com/vincent/rsf/server/manager/entity/Companys.java b/rsf-server/src/main/java/com/vincent/rsf/server/manager/entity/Companys.java new file mode 100644 index 0000000..44b0a5c --- /dev/null +++ b/rsf-server/src/main/java/com/vincent/rsf/server/manager/entity/Companys.java @@ -0,0 +1,266 @@ +package com.vincent.rsf.server.manager.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("man_companys") +public class Companys 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 code; + + /** + * 鍚嶇О + */ + @ApiModelProperty(value= "鍚嶇О") + private String name; + + /** + * 鑻辨枃鍒悕 + */ + @ApiModelProperty(value= "鑻辨枃鍒悕") + private String nameEn; + + /** + * 鍔╄鐮� + */ + @ApiModelProperty(value= "鍔╄鐮�") + private String breifCode; + + /** + * 甯愬彿绫诲瀷锛歴hipper锛氳揣涓伙紝customer锛氬鎴凤紝supplier锛氫緵搴斿晢 + */ + @ApiModelProperty(value= "甯愬彿绫诲瀷锛歴hipper锛氳揣涓伙紝customer锛氬鎴凤紝supplier锛氫緵搴斿晢") + private String type; + + /** + * 鑱旂郴浜� + */ + @ApiModelProperty(value= "鑱旂郴浜�") + private String contact; + + /** + * 鑱旂郴鐢佃瘽 + */ + @ApiModelProperty(value= "鑱旂郴鐢佃瘽") + private String tel; + + /** + * 閭 + */ + @ApiModelProperty(value= "閭") + private String email; + + /** + * 閭欢缂栫爜 + */ + @ApiModelProperty(value= "閭欢缂栫爜") + private String pcode; + + /** + * 鐪佷唤 + */ + @ApiModelProperty(value= "鐪佷唤") + private String province; + + /** + * 鍩庡競 + */ + @ApiModelProperty(value= "鍩庡競") + private String city; + + /** + * 鍦板潃 + */ + @ApiModelProperty(value= "鍦板潃") + private String address; + + /** + * 鐘舵�� 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 Companys() {} + + public Companys(String code,String name,String nameEn,String breifCode,String type,String contact,String tel,String email,String pcode,String province,String city,String address,Integer status,Integer deleted,Integer tenantId,Long createBy,Date createTime,Long updateBy,Date updateTime,String memo) { + this.code = code; + this.name = name; + this.nameEn = nameEn; + this.breifCode = breifCode; + this.type = type; + this.contact = contact; + this.tel = tel; + this.email = email; + this.pcode = pcode; + this.province = province; + this.city = city; + this.address = address; + this.status = status; + this.deleted = deleted; + this.tenantId = tenantId; + this.createBy = createBy; + this.createTime = createTime; + this.updateBy = updateBy; + this.updateTime = updateTime; + this.memo = memo; + } + +// Companys companys = new Companys( +// null, // 缂栧彿 +// null, // 鍚嶇О +// null, // 鑻辨枃鍒悕 +// null, // 鍔╄鐮� +// null, // 甯愬彿绫诲瀷锛歴hipper锛氳揣涓伙紝customer锛氬鎴凤紝supplier锛氫緵搴斿晢[闈炵┖] +// null, // 鑱旂郴浜� +// null, // 鑱旂郴鐢佃瘽 +// null, // 閭 +// null, // 閭欢缂栫爜 +// 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/manager/mapper/CompanysMapper.java b/rsf-server/src/main/java/com/vincent/rsf/server/manager/mapper/CompanysMapper.java new file mode 100644 index 0000000..a486b2c --- /dev/null +++ b/rsf-server/src/main/java/com/vincent/rsf/server/manager/mapper/CompanysMapper.java @@ -0,0 +1,12 @@ +package com.vincent.rsf.server.manager.mapper; + +import com.vincent.rsf.server.manager.entity.Companys; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.apache.ibatis.annotations.Mapper; +import org.springframework.stereotype.Repository; + +@Mapper +@Repository +public interface CompanysMapper extends BaseMapper<Companys> { + +} diff --git a/rsf-server/src/main/java/com/vincent/rsf/server/manager/service/CompanysService.java b/rsf-server/src/main/java/com/vincent/rsf/server/manager/service/CompanysService.java new file mode 100644 index 0000000..09974c6 --- /dev/null +++ b/rsf-server/src/main/java/com/vincent/rsf/server/manager/service/CompanysService.java @@ -0,0 +1,8 @@ +package com.vincent.rsf.server.manager.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.vincent.rsf.server.manager.entity.Companys; + +public interface CompanysService extends IService<Companys> { + +} diff --git a/rsf-server/src/main/java/com/vincent/rsf/server/manager/service/impl/CompanysServiceImpl.java b/rsf-server/src/main/java/com/vincent/rsf/server/manager/service/impl/CompanysServiceImpl.java new file mode 100644 index 0000000..63dc19e --- /dev/null +++ b/rsf-server/src/main/java/com/vincent/rsf/server/manager/service/impl/CompanysServiceImpl.java @@ -0,0 +1,12 @@ +package com.vincent.rsf.server.manager.service.impl; + +import com.vincent.rsf.server.manager.mapper.CompanysMapper; +import com.vincent.rsf.server.manager.entity.Companys; +import com.vincent.rsf.server.manager.service.CompanysService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +@Service("companysService") +public class CompanysServiceImpl extends ServiceImpl<CompanysMapper, Companys> implements CompanysService { + +} diff --git a/rsf-server/src/main/java/companys.sql b/rsf-server/src/main/java/companys.sql new file mode 100644 index 0000000..31f2b92 --- /dev/null +++ b/rsf-server/src/main/java/companys.sql @@ -0,0 +1,33 @@ +-- save companys record +-- mysql +insert into `sys_menu` ( `name`, `parent_id`, `route`, `component`, `type`, `sort`, `tenant_id`, `status`) values ( 'menu.companys', '0', '/manager/companys', 'companys', '0' , '0', '1' , '1'); + +insert into `sys_menu` ( `name`, `parent_id`, `type`, `authority`, `sort`, `tenant_id`, `status`) values ( 'Query 瀛楀吀鏁版嵁闆�', '', '1', 'manager:companys:list', '0', '1', '1'); +insert into `sys_menu` ( `name`, `parent_id`, `type`, `authority`, `sort`, `tenant_id`, `status`) values ( 'Create 瀛楀吀鏁版嵁闆�', '', '1', 'manager:companys:save', '1', '1', '1'); +insert into `sys_menu` ( `name`, `parent_id`, `type`, `authority`, `sort`, `tenant_id`, `status`) values ( 'Update 瀛楀吀鏁版嵁闆�', '', '1', 'manager:companys:update', '2', '1', '1'); +insert into `sys_menu` ( `name`, `parent_id`, `type`, `authority`, `sort`, `tenant_id`, `status`) values ( 'Delete 瀛楀吀鏁版嵁闆�', '', '1', 'manager:companys:remove', '3', '1', '1'); + +-- locale menu name +companys: 'Companys', + +-- locale field +companys: { + code: "code", + name: "name", + nameEn: "nameEn", + breifCode: "breifCode", + type: "type", + contact: "contact", + tel: "tel", + email: "email", + pcode: "pcode", + province: "province", + city: "city", + address: "address", +}, + +-- ResourceContent +import companys from './companys'; + +case 'companys': + return companys; diff --git a/rsf-server/src/main/resources/mapper/manager/CompanysMapper.xml b/rsf-server/src/main/resources/mapper/manager/CompanysMapper.xml new file mode 100644 index 0000000..418a43a --- /dev/null +++ b/rsf-server/src/main/resources/mapper/manager/CompanysMapper.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.CompanysMapper"> + +</mapper> -- Gitblit v1.9.1