Merge remote-tracking branch 'origin/dev_business' into dev_business
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | # å·¥èºåæ°ä¸å·¥èºåæ°æ¨¡æ¿ |
| | | |
| | | ## æ¶åé¡µé¢ |
| | | |
| | | - å·¥èºåæ°åè¡¨é¡µï¼æ°å¢ï¼ |
| | | - å·¥èºåæ°æ¨¡æ¿åè¡¨é¡µï¼æ°å¢ï¼ |
| | | |
| | | ## API |
| | | |
| | | ### å·¥èºåæ° |
| | | |
| | | | æ¹æ³ | è·¯å¾ | 说æ | |
| | | |------|------|------| |
| | | | POST | /mes/pd/process-param/create | å建工èºåæ° | |
| | | | PUT | /mes/pd/process-param/update | æ´æ°å·¥èºåæ° | |
| | | | DELETE | /mes/pd/process-param/delete?id= | å é¤å·¥èºåæ° | |
| | | | GET | /mes/pd/process-param/get?id= | è·åå·¥èºåæ°è¯¦æ
| |
| | | | GET | /mes/pd/process-param/page | å页æ¥è¯¢å·¥èºåæ° | |
| | | | GET | /mes/pd/process-param/export-excel | 导åºå·¥èºåæ° | |
| | | |
| | | **å建请æ±åæ°ï¼** |
| | | |
| | | | åæ° | ç±»å | å¿
å¡« | 说æ | |
| | | |------|------|------|------| |
| | | | paramName | String | æ¯ | åæ°åç§° | |
| | | | paramType | Integer | å¦ | åæ°ç±»åï¼åå
¸ mes_pd_process_param_typeï¼1=ææ¬ 2=æ°å¼ 3=å¸å° 4=æ¥æï¼ | |
| | | | unitMeasureId | Long | å¦ | 计éåä½ID | |
| | | | required | Boolean | å¦ | æ¯å¦å¿
å¡«ï¼é»è®¤false | |
| | | | remark | String | å¦ | 夿³¨ | |
| | | |
| | | 注æï¼åæ°ç¼ç ï¼paramCodeï¼ç±å端èªå¨çæï¼å端æ éä¼ å
¥ã |
| | | |
| | | **ååºï¼** |
| | | |
| | | ```json |
| | | { "code": 200, "data": 1, "msg": "æä½æå" } |
| | | ``` |
| | | |
| | | **å页æ¥è¯¢åæ°ï¼** |
| | | |
| | | | åæ° | ç±»å | å¿
å¡« | 说æ | |
| | | |------|------|------|------| |
| | | | pageNo | Integer | æ¯ | 页ç | |
| | | | pageSize | Integer | æ¯ | æ¯é¡µæ¡æ° | |
| | | | paramCode | String | å¦ | åæ°ç¼ç ï¼æ¨¡ç³æç´¢ï¼ | |
| | | | paramName | String | å¦ | åæ°åç§°ï¼æ¨¡ç³æç´¢ï¼ | |
| | | | paramType | Integer | å¦ | åæ°ç±»åï¼ç²¾ç¡®å¹é
ï¼ | |
| | | |
| | | **ååºç»æï¼** |
| | | |
| | | ```json |
| | | { |
| | | "code": 200, |
| | | "data": { |
| | | "list": [ |
| | | { |
| | | "id": 1, |
| | | "paramCode": "PP20240001", |
| | | "paramName": "æ³¨å¡æ¸©åº¦", |
| | | "paramType": 2, |
| | | "unitMeasureId": 1, |
| | | "unitMeasureName": "â", |
| | | "required": true, |
| | | "remark": "", |
| | | "createTime": "2024-01-01 00:00:00" |
| | | } |
| | | ], |
| | | "total": 1 |
| | | } |
| | | } |
| | | ``` |
| | | |
| | | ### å·¥èºåæ°æ¨¡æ¿ |
| | | |
| | | | æ¹æ³ | è·¯å¾ | 说æ | |
| | | |------|------|------| |
| | | | POST | /mes/pd/process-param-template/create | å建工èºåæ°æ¨¡æ¿ | |
| | | | PUT | /mes/pd/process-param-template/update | æ´æ°å·¥èºåæ°æ¨¡æ¿ | |
| | | | DELETE | /mes/pd/process-param-template/delete?id= | å é¤å·¥èºåæ°æ¨¡æ¿ | |
| | | | GET | /mes/pd/process-param-template/get?id= | è·åå·¥èºåæ°æ¨¡æ¿è¯¦æ
| |
| | | | GET | /mes/pd/process-param-template/page | å页æ¥è¯¢å·¥èºåæ°æ¨¡æ¿ | |
| | | | GET | /mes/pd/process-param-template/export-excel | 导åºå·¥èºåæ°æ¨¡æ¿ | |
| | | |
| | | **å建/æ´æ°è¯·æ±åæ°ï¼** |
| | | |
| | | | åæ° | ç±»å | å¿
å¡« | 说æ | |
| | | |------|------|------|------| |
| | | | id | Long | å¦ | ç¼å·ï¼æ´æ°æ¶å¿
å¡«ï¼ | |
| | | | templateName | String | æ¯ | 模æ¿åç§° | |
| | | | templateType | Integer | å¦ | 模æ¿ç±»åï¼åå
¸ mes_pd_process_param_template_typeï¼1=éç¨ 2=å·¥åº 3=产åï¼ | |
| | | | remark | String | å¦ | 夿³¨ | |
| | | | details | List\<Detail\> | æ¯ | æ¨¡æ¿æç»å表 | |
| | | |
| | | **Detail ç»æï¼** |
| | | |
| | | | åæ° | ç±»å | å¿
å¡« | 说æ | |
| | | |------|------|------|------| |
| | | | processParamId | Long | æ¯ | å·¥èºåæ°ID | |
| | | | required | Boolean | å¦ | æ¯å¦å¿
å¡«ï¼å¯è¦çåæ°é»è®¤å¼ï¼ | |
| | | | remark | String | å¦ | 夿³¨ï¼å¯è¦çåæ°é»è®¤å¼ï¼ | |
| | | |
| | | 注æï¼æ¨¡æ¿ç¼ç ï¼templateCodeï¼ç±å端èªå¨çæï¼å端æ éä¼ å
¥ãæ¨¡æ¿æç»éç¨å¿«ç
§æºå¶ââå
³èæ¶å¤å¶åæ°å¼ï¼æ¹åå·¥èºåæ°å表çå¼ä¸å½±å模æ¿ã |
| | | |
| | | **ååºç»æï¼** |
| | | |
| | | ```json |
| | | { |
| | | "code": 200, |
| | | "data": { |
| | | "id": 1, |
| | | "templateCode": "PPT20240001", |
| | | "templateName": "注å¡å·¥èºåæ°æ¨¡æ¿", |
| | | "templateType": 2, |
| | | "remark": "", |
| | | "createTime": "2024-01-01 00:00:00", |
| | | "details": [ |
| | | { |
| | | "id": 1, |
| | | "templateId": 1, |
| | | "processParamId": 1, |
| | | "paramCode": "PP20240001", |
| | | "paramName": "æ³¨å¡æ¸©åº¦", |
| | | "paramType": 2, |
| | | "unitMeasureId": 1, |
| | | "unitMeasureName": "â", |
| | | "required": true, |
| | | "remark": "" |
| | | } |
| | | ] |
| | | } |
| | | } |
| | | ``` |
| | | |
| | | ## å端修æ¹ç¹ |
| | | |
| | | ### 1. å·¥èºåæ°å表页 - æ°å¢é¡µé¢ |
| | | |
| | | æä»¶è·¯å¾ï¼`src/views/mes/pd/processparam/index.vue` |
| | | |
| | | ```html |
| | | <!-- æç´¢æ --> |
| | | <el-form :model="queryParams" ref="queryFormRef" :inline="true"> |
| | | <el-form-item label="åæ°ç¼ç " prop="paramCode"> |
| | | <el-input v-model="queryParams.paramCode" placeholder="请è¾å
¥åæ°ç¼ç " clearable /> |
| | | </el-form-item> |
| | | <el-form-item label="åæ°åç§°" prop="paramName"> |
| | | <el-input v-model="queryParams.paramName" placeholder="请è¾å
¥åæ°åç§°" clearable /> |
| | | </el-form-item> |
| | | <el-form-item label="åæ°ç±»å" prop="paramType"> |
| | | <el-select v-model="queryParams.paramType" placeholder="è¯·éæ©åæ°ç±»å" clearable> |
| | | <el-option v-for="dict in getIntDictOptions(DICT_TYPE.MES_PD_PROCESS_PARAM_TYPE)" |
| | | :key="dict.value" :label="dict.label" :value="dict.value" /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item> |
| | | <el-button type="primary" @click="handleQuery"><Icon icon="ep:search" />æç´¢</el-button> |
| | | <el-button @click="resetQuery"><Icon icon="ep:refresh" />éç½®</el-button> |
| | | </el-form-item> |
| | | </el-form> |
| | | |
| | | <!-- æä½æ --> |
| | | <el-row :gutter="10" class="mb8"> |
| | | <el-col :span="1.5"> |
| | | <el-button type="primary" @click="openForm('create')" |
| | | v-hasPermi="['mes:pd-process-param:create']"><Icon icon="ep:plus" />æ°å¢</el-button> |
| | | </el-col> |
| | | <el-col :span="1.5"> |
| | | <el-button type="warning" @click="handleExport" |
| | | v-hasPermi="['mes:pd-process-param:export']"><Icon icon="ep:download" />导åº</el-button> |
| | | </el-col> |
| | | </el-row> |
| | | |
| | | <!-- å表 --> |
| | | <el-table v-loading="loading" :data="list"> |
| | | <el-table-column label="ç¼å·" align="center" prop="id" /> |
| | | <el-table-column label="åæ°ç¼ç " align="center" prop="paramCode" /> |
| | | <el-table-column label="åæ°åç§°" align="center" prop="paramName" /> |
| | | <el-table-column label="åæ°ç±»å" align="center" prop="paramType"> |
| | | <template #default="scope"> |
| | | <dict-tag :type="DICT_TYPE.MES_PD_PROCESS_PARAM_TYPE" :value="scope.row.paramType" /> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="åä½" align="center" prop="unitMeasureName" /> |
| | | <el-table-column label="æ¯å¦å¿
å¡«" align="center" prop="required"> |
| | | <template #default="scope"> |
| | | <el-tag :type="scope.row.required ? 'danger' : 'info'">{{ scope.row.required ? 'æ¯' : 'å¦' }}</el-tag> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="夿³¨" align="center" prop="remark" show-overflow-tooltip /> |
| | | <el-table-column label="å建æ¶é´" align="center" prop="createTime" width="180" /> |
| | | <el-table-column label="æä½" align="center" width="150"> |
| | | <template #default="scope"> |
| | | <el-button link type="primary" @click="openForm('update', scope.row.id)" |
| | | v-hasPermi="['mes:pd-process-param:update']">ç¼è¾</el-button> |
| | | <el-button link type="danger" @click="handleDelete(scope.row.id)" |
| | | v-hasPermi="['mes:pd-process-param:delete']">å é¤</el-button> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | ``` |
| | | |
| | | ### 2. å·¥èºåæ°è¡¨åå¼¹çª - æ°å¢/ç¼è¾ |
| | | |
| | | æä»¶è·¯å¾ï¼`src/views/mes/pd/processparam/ProcessParamForm.vue` |
| | | |
| | | ```html |
| | | <el-dialog :title="dialogTitle" v-model="dialogVisible" width="500px"> |
| | | <el-form ref="formRef" :model="formData" :rules="formRules" label-width="100px"> |
| | | <el-form-item label="åæ°åç§°" prop="paramName"> |
| | | <el-input v-model="formData.paramName" placeholder="请è¾å
¥åæ°åç§°" /> |
| | | </el-form-item> |
| | | <el-form-item label="åæ°ç±»å" prop="paramType"> |
| | | <el-select v-model="formData.paramType" placeholder="è¯·éæ©åæ°ç±»å"> |
| | | <el-option v-for="dict in getIntDictOptions(DICT_TYPE.MES_PD_PROCESS_PARAM_TYPE)" |
| | | :key="dict.value" :label="dict.label" :value="dict.value" /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="计éåä½" prop="unitMeasureId"> |
| | | <el-select v-model="formData.unitMeasureId" placeholder="è¯·éæ©è®¡éåä½" clearable filterable> |
| | | <!-- ä»è®¡éå使¥å£è·åå表 --> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="æ¯å¦å¿
å¡«" prop="required"> |
| | | <el-switch v-model="formData.required" /> |
| | | </el-form-item> |
| | | <el-form-item label="夿³¨" prop="remark"> |
| | | <el-input v-model="formData.remark" type="textarea" placeholder="请è¾å
¥å¤æ³¨" /> |
| | | </el-form-item> |
| | | </el-form> |
| | | </el-dialog> |
| | | ``` |
| | | |
| | | ### 3. data æ°æ® |
| | | |
| | | ```js |
| | | const queryParams = reactive({ |
| | | pageNo: 1, |
| | | pageSize: 10, |
| | | paramCode: undefined, |
| | | paramName: undefined, |
| | | paramType: undefined, |
| | | }) |
| | | const formData = reactive({ |
| | | id: undefined, |
| | | paramName: undefined, |
| | | paramType: undefined, |
| | | unitMeasureId: undefined, |
| | | required: false, |
| | | remark: undefined, |
| | | }) |
| | | ``` |
| | | |
| | | ### 4. å·¥èºåæ°æ¨¡æ¿å表页 - æ°å¢é¡µé¢ |
| | | |
| | | æä»¶è·¯å¾ï¼`src/views/mes/pd/processparamtemplate/index.vue` |
| | | |
| | | ```html |
| | | <!-- æç´¢æ --> |
| | | <el-form :model="queryParams" ref="queryFormRef" :inline="true"> |
| | | <el-form-item label="模æ¿ç¼ç " prop="templateCode"> |
| | | <el-input v-model="queryParams.templateCode" placeholder="请è¾å
¥æ¨¡æ¿ç¼ç " clearable /> |
| | | </el-form-item> |
| | | <el-form-item label="模æ¿åç§°" prop="templateName"> |
| | | <el-input v-model="queryParams.templateName" placeholder="请è¾å
¥æ¨¡æ¿åç§°" clearable /> |
| | | </el-form-item> |
| | | <el-form-item label="模æ¿ç±»å" prop="templateType"> |
| | | <el-select v-model="queryParams.templateType" placeholder="è¯·éæ©æ¨¡æ¿ç±»å" clearable> |
| | | <el-option v-for="dict in getIntDictOptions(DICT_TYPE.MES_PD_PROCESS_PARAM_TEMPLATE_TYPE)" |
| | | :key="dict.value" :label="dict.label" :value="dict.value" /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item> |
| | | <el-button type="primary" @click="handleQuery"><Icon icon="ep:search" />æç´¢</el-button> |
| | | <el-button @click="resetQuery"><Icon icon="ep:refresh" />éç½®</el-button> |
| | | </el-form-item> |
| | | </el-form> |
| | | |
| | | <!-- å表 --> |
| | | <el-table v-loading="loading" :data="list"> |
| | | <el-table-column label="ç¼å·" align="center" prop="id" /> |
| | | <el-table-column label="模æ¿ç¼ç " align="center" prop="templateCode" /> |
| | | <el-table-column label="模æ¿åç§°" align="center" prop="templateName" /> |
| | | <el-table-column label="模æ¿ç±»å" align="center" prop="templateType"> |
| | | <template #default="scope"> |
| | | <dict-tag :type="DICT_TYPE.MES_PD_PROCESS_PARAM_TEMPLATE_TYPE" :value="scope.row.templateType" /> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="夿³¨" align="center" prop="remark" show-overflow-tooltip /> |
| | | <el-table-column label="å建æ¶é´" align="center" prop="createTime" width="180" /> |
| | | <el-table-column label="æä½" align="center" width="150"> |
| | | <template #default="scope"> |
| | | <el-button link type="primary" @click="openForm('update', scope.row.id)" |
| | | v-hasPermi="['mes:pd-process-param-template:update']">ç¼è¾</el-button> |
| | | <el-button link type="danger" @click="handleDelete(scope.row.id)" |
| | | v-hasPermi="['mes:pd-process-param-template:delete']">å é¤</el-button> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | ``` |
| | | |
| | | ### 5. å·¥èºåæ°æ¨¡æ¿è¡¨åå¼¹çªï¼å«æç»ï¼ |
| | | |
| | | æä»¶è·¯å¾ï¼`src/views/mes/pd/processparamtemplate/ProcessParamTemplateForm.vue` |
| | | |
| | | ```html |
| | | <el-dialog :title="dialogTitle" v-model="dialogVisible" width="800px"> |
| | | <el-form ref="formRef" :model="formData" :rules="formRules" label-width="100px"> |
| | | <el-form-item label="模æ¿åç§°" prop="templateName"> |
| | | <el-input v-model="formData.templateName" placeholder="请è¾å
¥æ¨¡æ¿åç§°" /> |
| | | </el-form-item> |
| | | <el-form-item label="模æ¿ç±»å" prop="templateType"> |
| | | <el-select v-model="formData.templateType" placeholder="è¯·éæ©æ¨¡æ¿ç±»å"> |
| | | <el-option v-for="dict in getIntDictOptions(DICT_TYPE.MES_PD_PROCESS_PARAM_TEMPLATE_TYPE)" |
| | | :key="dict.value" :label="dict.label" :value="dict.value" /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="夿³¨" prop="remark"> |
| | | <el-input v-model="formData.remark" type="textarea" placeholder="请è¾å
¥å¤æ³¨" /> |
| | | </el-form-item> |
| | | |
| | | <!-- æ¨¡æ¿æç»å表 --> |
| | | <el-form-item label="å·¥èºåæ°" prop="details"> |
| | | <el-button type="primary" size="small" @click="addDetail"><Icon icon="ep:plus" />æ·»å åæ°</el-button> |
| | | <el-table :data="formData.details" border style="width: 100%; margin-top: 10px"> |
| | | <el-table-column label="å·¥èºåæ°" align="center" min-width="200"> |
| | | <template #default="scope"> |
| | | <el-select v-model="scope.row.processParamId" placeholder="è¯·éæ©å·¥èºåæ°" filterable |
| | | @change="onParamChange(scope.row)"> |
| | | <!-- ä»å·¥èºåæ°å表æ¥å£è·å --> |
| | | </el-select> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="åæ°ç¼ç " align="center" prop="paramCode" width="120" /> |
| | | <el-table-column label="åæ°ç±»å" align="center" prop="paramTypeName" width="100" /> |
| | | <el-table-column label="åä½" align="center" prop="unitMeasureName" width="80" /> |
| | | <el-table-column label="æ¯å¦å¿
å¡«" align="center" width="100"> |
| | | <template #default="scope"> |
| | | <el-switch v-model="scope.row.required" /> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="夿³¨" align="center" min-width="120"> |
| | | <template #default="scope"> |
| | | <el-input v-model="scope.row.remark" placeholder="夿³¨" /> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="æä½" align="center" width="60"> |
| | | <template #default="scope"> |
| | | <el-button link type="danger" @click="removeDetail(scope.$index)">å é¤</el-button> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | </el-form-item> |
| | | </el-form> |
| | | </el-dialog> |
| | | ``` |
| | | |
| | | ### 6. API æ¥å£å®ä¹ |
| | | |
| | | æä»¶è·¯å¾ï¼`src/api/mes/pd/processparam/index.ts` |
| | | |
| | | ```ts |
| | | import request from '@/config/axios' |
| | | |
| | | // å建工èºåæ° |
| | | export const createProcessParam = (data) => { |
| | | return request.post({ url: '/mes/pd/process-param/create', data }) |
| | | } |
| | | |
| | | // æ´æ°å·¥èºåæ° |
| | | export const updateProcessParam = (data) => { |
| | | return request.put({ url: '/mes/pd/process-param/update', data }) |
| | | } |
| | | |
| | | // å é¤å·¥èºåæ° |
| | | export const deleteProcessParam = (id: number) => { |
| | | return request.delete({ url: '/mes/pd/process-param/delete?id=' + id }) |
| | | } |
| | | |
| | | // è·åå·¥èºåæ° |
| | | export const getProcessParam = (id: number) => { |
| | | return request.get({ url: '/mes/pd/process-param/get?id=' + id }) |
| | | } |
| | | |
| | | // è·åå·¥èºåæ°å页 |
| | | export const getProcessParamPage = (params) => { |
| | | return request.get({ url: '/mes/pd/process-param/page', params }) |
| | | } |
| | | |
| | | // 导åºå·¥èºåæ° Excel |
| | | export const exportProcessParamExcel = (params) => { |
| | | return request.download({ url: '/mes/pd/process-param/export-excel', params }) |
| | | } |
| | | ``` |
| | | |
| | | æä»¶è·¯å¾ï¼`src/api/mes/pd/processparamtemplate/index.ts` |
| | | |
| | | ```ts |
| | | import request from '@/config/axios' |
| | | |
| | | // å建工èºåæ°æ¨¡æ¿ |
| | | export const createProcessParamTemplate = (data) => { |
| | | return request.post({ url: '/mes/pd/process-param-template/create', data }) |
| | | } |
| | | |
| | | // æ´æ°å·¥èºåæ°æ¨¡æ¿ |
| | | export const updateProcessParamTemplate = (data) => { |
| | | return request.put({ url: '/mes/pd/process-param-template/update', data }) |
| | | } |
| | | |
| | | // å é¤å·¥èºåæ°æ¨¡æ¿ |
| | | export const deleteProcessParamTemplate = (id: number) => { |
| | | return request.delete({ url: '/mes/pd/process-param-template/delete?id=' + id }) |
| | | } |
| | | |
| | | // è·åå·¥èºåæ°æ¨¡æ¿ |
| | | export const getProcessParamTemplate = (id: number) => { |
| | | return request.get({ url: '/mes/pd/process-param-template/get?id=' + id }) |
| | | } |
| | | |
| | | // è·åå·¥èºåæ°æ¨¡æ¿å页 |
| | | export const getProcessParamTemplatePage = (params) => { |
| | | return request.get({ url: '/mes/pd/process-param-template/page', params }) |
| | | } |
| | | |
| | | // 导åºå·¥èºåæ°æ¨¡æ¿ Excel |
| | | export const exportProcessParamTemplateExcel = (params) => { |
| | | return request.download({ url: '/mes/pd/process-param-template/export-excel', params }) |
| | | } |
| | | ``` |
| | | |
| | | ## 注æäºé¡¹ |
| | | |
| | | - **å¿«ç
§æºå¶**ï¼æ¨¡æ¿å
³èå·¥èºåæ°æ¶ï¼å端ä¼å¤å¶åæ°çå½åå¼å°æ¨¡æ¿æç»ä¸ãä¹åä¿®æ¹å·¥èºåæ°çåç§°ãç±»åãåä½çï¼ä¸ä¼å½±åå·²å
³èçæ¨¡æ¿ãè¿æ¯è®¾è®¡ä¸è¦æ±ç"æ¹åå·¥èºåæ°å表çå¼ä¸è½å½±å模æ¿çåå"ã |
| | | - **åæ°ç¼ç 忍¡æ¿ç¼ç **ç±å端èªå¨çæï¼å端å建æ¶ä¸éè¦ä¼ å
¥ã |
| | | - å·¥èºåæ°ç±»ååå
¸ï¼`mes_pd_process_param_type`ï¼1=ææ¬ã2=æ°å¼ã3=å¸å°ã4=æ¥æï¼ |
| | | - å·¥èºåæ°æ¨¡æ¿ç±»ååå
¸ï¼`mes_pd_process_param_template_type`ï¼1=éç¨ã2=å·¥åºã3=产åï¼ |
| | | - 计éåä½ä¸ææ¡éè¦è°ç¨ MDM 模åç计éåä½å表æ¥å£è·åæ°æ® |
| | | - 模æ¿è¡¨åä¸çæç»è¡ï¼éæ©å·¥èºåæ°åä¼èªå¨å¸¦åºåæ°ç¼ç ãåç§°ãç±»åãåä½çä¿¡æ¯ |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | -- ============================================= |
| | | -- MES å·¥èºåæ°ä¸å·¥èºåæ°æ¨¡æ¿ - åå§åèæ¬ |
| | | -- ============================================= |
| | | |
| | | -- ---------------------------- |
| | | -- å·¥èºåæ° |
| | | -- ---------------------------- |
| | | CREATE TABLE IF NOT EXISTS `mes_pd_process_param` ( |
| | | `id` bigint NOT NULL AUTO_INCREMENT COMMENT 'ç¼å·', |
| | | `param_code` varchar(64) DEFAULT NULL COMMENT 'åæ°ç¼ç ', |
| | | `param_name` varchar(255) NOT NULL COMMENT 'åæ°åç§°', |
| | | `param_type` tinyint DEFAULT NULL COMMENT 'åæ°ç±»åï¼åå
¸ mes_pd_process_param_typeï¼', |
| | | `unit_measure_id` bigint DEFAULT NULL COMMENT '计éåä½IDï¼å
³è mes_md_unit_measureï¼', |
| | | `required` bit(1) NOT NULL DEFAULT b'0' COMMENT 'æ¯å¦å¿
å¡«', |
| | | `remark` varchar(500) DEFAULT NULL COMMENT '夿³¨', |
| | | `creator` varchar(64) DEFAULT '' COMMENT 'å建è
', |
| | | `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'å建æ¶é´', |
| | | `updater` varchar(64) DEFAULT '' COMMENT 'æ´æ°è
', |
| | | `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT 'æ´æ°æ¶é´', |
| | | `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT 'æ¯å¦å é¤', |
| | | `tenant_id` bigint NOT NULL DEFAULT 0 COMMENT 'ç§æ·ç¼å·', |
| | | PRIMARY KEY (`id`) |
| | | ) ENGINE=InnoDB COMMENT='MES å·¥èºåæ°'; |
| | | |
| | | -- ---------------------------- |
| | | -- å·¥èºåæ°æ¨¡æ¿ |
| | | -- ---------------------------- |
| | | CREATE TABLE IF NOT EXISTS `mes_pd_process_param_template` ( |
| | | `id` bigint NOT NULL AUTO_INCREMENT COMMENT 'ç¼å·', |
| | | `template_code` varchar(64) DEFAULT NULL COMMENT '模æ¿ç¼ç ', |
| | | `template_name` varchar(255) NOT NULL COMMENT '模æ¿åç§°', |
| | | `template_type` tinyint DEFAULT NULL COMMENT '模æ¿ç±»åï¼åå
¸ mes_pd_process_param_template_typeï¼', |
| | | `remark` varchar(500) DEFAULT NULL COMMENT '夿³¨', |
| | | `creator` varchar(64) DEFAULT '' COMMENT 'å建è
', |
| | | `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'å建æ¶é´', |
| | | `updater` varchar(64) DEFAULT '' COMMENT 'æ´æ°è
', |
| | | `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT 'æ´æ°æ¶é´', |
| | | `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT 'æ¯å¦å é¤', |
| | | `tenant_id` bigint NOT NULL DEFAULT 0 COMMENT 'ç§æ·ç¼å·', |
| | | PRIMARY KEY (`id`) |
| | | ) ENGINE=InnoDB COMMENT='MES å·¥èºåæ°æ¨¡æ¿'; |
| | | |
| | | -- ---------------------------- |
| | | -- å·¥èºåæ°æ¨¡æ¿æç»ï¼å¿«ç
§è¡¨ï¼ |
| | | -- ---------------------------- |
| | | CREATE TABLE IF NOT EXISTS `mes_pd_process_param_template_detail` ( |
| | | `id` bigint NOT NULL AUTO_INCREMENT COMMENT 'ç¼å·', |
| | | `template_id` bigint NOT NULL COMMENT '模æ¿IDï¼å
³è mes_pd_process_param_templateï¼', |
| | | `process_param_id` bigint DEFAULT NULL COMMENT 'å·¥èºåæ°IDï¼ä»
使º¯æºï¼ä¸å½±åå¿«ç
§å¼ï¼', |
| | | `param_code` varchar(64) DEFAULT NULL COMMENT 'åæ°ç¼ç ï¼å¿«ç
§ï¼', |
| | | `param_name` varchar(255) DEFAULT NULL COMMENT 'åæ°åç§°ï¼å¿«ç
§ï¼', |
| | | `param_type` tinyint DEFAULT NULL COMMENT 'åæ°ç±»åï¼å¿«ç
§ï¼', |
| | | `unit_measure_id` bigint DEFAULT NULL COMMENT '计éåä½IDï¼å¿«ç
§ï¼', |
| | | `required` bit(1) NOT NULL DEFAULT b'0' COMMENT 'æ¯å¦å¿
å¡«ï¼å¿«ç
§ï¼', |
| | | `remark` varchar(500) DEFAULT NULL COMMENT '夿³¨ï¼å¿«ç
§ï¼', |
| | | `creator` varchar(64) DEFAULT '' COMMENT 'å建è
', |
| | | `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'å建æ¶é´', |
| | | `updater` varchar(64) DEFAULT '' COMMENT 'æ´æ°è
', |
| | | `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT 'æ´æ°æ¶é´', |
| | | `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT 'æ¯å¦å é¤', |
| | | `tenant_id` bigint NOT NULL DEFAULT 0 COMMENT 'ç§æ·ç¼å·', |
| | | PRIMARY KEY (`id`) |
| | | ) ENGINE=InnoDB COMMENT='MES å·¥èºåæ°æ¨¡æ¿æç»'; |
| | | |
| | | -- ---------------------------- |
| | | -- åå
¸ç±»å |
| | | -- ---------------------------- |
| | | INSERT INTO `system_dict_type` (`name`, `type`, `status`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES |
| | | ('å·¥èºåæ°ç±»å', 'mes_pd_process_param_type', 0, 'å·¥èºåæ°ç±»å', '1', NOW(), '1', NOW(), b'0'), |
| | | ('å·¥èºåæ°æ¨¡æ¿ç±»å', 'mes_pd_process_param_template_type', 0, 'å·¥èºåæ°æ¨¡æ¿ç±»å', '1', NOW(), '1', NOW(), b'0'); |
| | | |
| | | -- ---------------------------- |
| | | -- åå
¸æ°æ® - å·¥èºåæ°ç±»å |
| | | -- ---------------------------- |
| | | INSERT INTO `system_dict_data` (`sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES |
| | | (0, 'ææ¬', '1', 'mes_pd_process_param_type', 0, 'default', '', '', '1', NOW(), '1', NOW(), b'0'), |
| | | (1, 'æ°å¼', '2', 'mes_pd_process_param_type', 0, 'primary', '', '', '1', NOW(), '1', NOW(), b'0'), |
| | | (2, 'å¸å°', '3', 'mes_pd_process_param_type', 0, 'success', '', '', '1', NOW(), '1', NOW(), b'0'), |
| | | (3, 'æ¥æ', '4', 'mes_pd_process_param_type', 0, 'warning', '', '', '1', NOW(), '1', NOW(), b'0'); |
| | | |
| | | -- ---------------------------- |
| | | -- åå
¸æ°æ® - å·¥èºåæ°æ¨¡æ¿ç±»å |
| | | -- ---------------------------- |
| | | INSERT INTO `system_dict_data` (`sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES |
| | | (0, 'éç¨', '1', 'mes_pd_process_param_template_type', 0, 'default', '', '', '1', NOW(), '1', NOW(), b'0'), |
| | | (1, 'å·¥åº', '2', 'mes_pd_process_param_template_type', 0, 'primary', '', '', '1', NOW(), '1', NOW(), b'0'), |
| | | (2, '产å', '3', 'mes_pd_process_param_template_type', 0, 'success', '', '', '1', NOW(), '1', NOW(), b'0'); |
| | | |
| | | -- ---------------------------- |
| | | -- èå - å·¥èºåæ°ï¼äºçº§èåï¼æå¨äº§å设计ä¸ï¼ |
| | | -- 注æï¼parent_id 使ç¨åé @pd_menu_idï¼éä¸ mes_pd_init.sql ä¸ç产å设计ä¸çº§èåé
å |
| | | -- å¦æäº§å设计èåå·²åå¨ï¼è¯·å
设置 @pd_menu_id 为å®é
çèåID |
| | | -- ---------------------------- |
| | | |
| | | -- äºçº§èåï¼å·¥èºåæ° |
| | | INSERT INTO `system_menu` (`name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES |
| | | ('å·¥èºåæ°', '', 2, 3, @pd_menu_id, 'process-param', '', 'mes/pd/processparam/index', 0, '1', NOW(), '1', NOW(), b'0'); |
| | | SET @process_param_menu_id = LAST_INSERT_ID(); |
| | | |
| | | -- å·¥èºåæ°æé®æé |
| | | INSERT INTO `system_menu` (`name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES |
| | | ('å·¥èºåæ°æ¥è¯¢', 'mes:pd-process-param:query', 3, 1, @process_param_menu_id, '', '', '', 0, '1', NOW(), '1', NOW(), b'0'), |
| | | ('å·¥èºåæ°å建', 'mes:pd-process-param:create', 3, 2, @process_param_menu_id, '', '', '', 0, '1', NOW(), '1', NOW(), b'0'), |
| | | ('å·¥èºåæ°æ´æ°', 'mes:pd-process-param:update', 3, 3, @process_param_menu_id, '', '', '', 0, '1', NOW(), '1', NOW(), b'0'), |
| | | ('å·¥èºåæ°å é¤', 'mes:pd-process-param:delete', 3, 4, @process_param_menu_id, '', '', '', 0, '1', NOW(), '1', NOW(), b'0'), |
| | | ('å·¥èºåæ°å¯¼åº', 'mes:pd-process-param:export', 3, 5, @process_param_menu_id, '', '', '', 0, '1', NOW(), '1', NOW(), b'0'); |
| | | |
| | | -- äºçº§èåï¼å·¥èºåæ°æ¨¡æ¿ |
| | | INSERT INTO `system_menu` (`name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES |
| | | ('å·¥èºåæ°æ¨¡æ¿', '', 2, 4, @pd_menu_id, 'process-param-template', '', 'mes/pd/processparamtemplate/index', 0, '1', NOW(), '1', NOW(), b'0'); |
| | | SET @template_menu_id = LAST_INSERT_ID(); |
| | | |
| | | -- å·¥èºåæ°æ¨¡æ¿æé®æé |
| | | INSERT INTO `system_menu` (`name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES |
| | | ('å·¥èºåæ°æ¨¡æ¿æ¥è¯¢', 'mes:pd-process-param-template:query', 3, 1, @template_menu_id, '', '', '', 0, '1', NOW(), '1', NOW(), b'0'), |
| | | ('å·¥èºåæ°æ¨¡æ¿å建', 'mes:pd-process-param-template:create', 3, 2, @template_menu_id, '', '', '', 0, '1', NOW(), '1', NOW(), b'0'), |
| | | ('å·¥èºåæ°æ¨¡æ¿æ´æ°', 'mes:pd-process-param-template:update', 3, 3, @template_menu_id, '', '', '', 0, '1', NOW(), '1', NOW(), b'0'), |
| | | ('å·¥èºåæ°æ¨¡æ¿å é¤', 'mes:pd-process-param-template:delete', 3, 4, @template_menu_id, '', '', '', 0, '1', NOW(), '1', NOW(), b'0'), |
| | | ('å·¥èºåæ°æ¨¡æ¿å¯¼åº', 'mes:pd-process-param-template:export', 3, 5, @template_menu_id, '', '', '', 0, '1', NOW(), '1', NOW(), b'0'); |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.mes.controller.admin.pd.processparam; |
| | | |
| | | import cn.hutool.core.collection.CollUtil; |
| | | import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog; |
| | | import cn.iocoder.yudao.framework.common.pojo.CommonResult; |
| | | import cn.iocoder.yudao.framework.common.pojo.PageParam; |
| | | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| | | import cn.iocoder.yudao.framework.common.util.collection.MapUtils; |
| | | import cn.iocoder.yudao.framework.common.util.object.BeanUtils; |
| | | import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.pd.processparam.vo.MesPdProcessParamPageReqVO; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.pd.processparam.vo.MesPdProcessParamRespVO; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.pd.processparam.vo.MesPdProcessParamSaveReqVO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.md.unitmeasure.MesMdUnitMeasureDO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.pd.processparam.MesPdProcessParamDO; |
| | | import cn.iocoder.yudao.module.mes.service.md.unitmeasure.MesMdUnitMeasureService; |
| | | import cn.iocoder.yudao.module.mes.service.pd.processparam.MesPdProcessParamService; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import io.swagger.v3.oas.annotations.Parameter; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | import jakarta.annotation.Resource; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | import jakarta.validation.Valid; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.io.IOException; |
| | | import java.util.Collections; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.EXPORT; |
| | | import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; |
| | | import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertSet; |
| | | |
| | | @Tag(name = "管çåå° - MES å·¥èºåæ°") |
| | | @RestController |
| | | @RequestMapping("/mes/pd/process-param") |
| | | @Validated |
| | | public class MesPdProcessParamController { |
| | | |
| | | @Resource |
| | | private MesPdProcessParamService processParamService; |
| | | |
| | | @Resource |
| | | private MesMdUnitMeasureService unitMeasureService; |
| | | |
| | | @PostMapping("/create") |
| | | @Operation(summary = "å建工èºåæ°") |
| | | @PreAuthorize("@ss.hasPermission('mes:pd-process-param:create')") |
| | | public CommonResult<Long> createProcessParam(@Valid @RequestBody MesPdProcessParamSaveReqVO createReqVO) { |
| | | return success(processParamService.createProcessParam(createReqVO)); |
| | | } |
| | | |
| | | @PutMapping("/update") |
| | | @Operation(summary = "æ´æ°å·¥èºåæ°") |
| | | @PreAuthorize("@ss.hasPermission('mes:pd-process-param:update')") |
| | | public CommonResult<Boolean> updateProcessParam(@Valid @RequestBody MesPdProcessParamSaveReqVO updateReqVO) { |
| | | processParamService.updateProcessParam(updateReqVO); |
| | | return success(true); |
| | | } |
| | | |
| | | @DeleteMapping("/delete") |
| | | @Operation(summary = "å é¤å·¥èºåæ°") |
| | | @Parameter(name = "id", description = "ç¼å·", required = true) |
| | | @PreAuthorize("@ss.hasPermission('mes:pd-process-param:delete')") |
| | | public CommonResult<Boolean> deleteProcessParam(@RequestParam("id") Long id) { |
| | | processParamService.deleteProcessParam(id); |
| | | return success(true); |
| | | } |
| | | |
| | | @GetMapping("/get") |
| | | @Operation(summary = "è·å¾å·¥èºåæ°") |
| | | @Parameter(name = "id", description = "ç¼å·", required = true, example = "1024") |
| | | @PreAuthorize("@ss.hasPermission('mes:pd-process-param:query')") |
| | | public CommonResult<MesPdProcessParamRespVO> getProcessParam(@RequestParam("id") Long id) { |
| | | MesPdProcessParamDO processParam = processParamService.getProcessParam(id); |
| | | if (processParam == null) { |
| | | return success(null); |
| | | } |
| | | return success(buildProcessParamRespVOList(Collections.singletonList(processParam)).get(0)); |
| | | } |
| | | |
| | | @GetMapping("/page") |
| | | @Operation(summary = "è·å¾å·¥èºåæ°å页") |
| | | @PreAuthorize("@ss.hasPermission('mes:pd-process-param:query')") |
| | | public CommonResult<PageResult<MesPdProcessParamRespVO>> getProcessParamPage(@Valid MesPdProcessParamPageReqVO pageReqVO) { |
| | | PageResult<MesPdProcessParamDO> pageResult = processParamService.getProcessParamPage(pageReqVO); |
| | | return success(new PageResult<>(buildProcessParamRespVOList(pageResult.getList()), pageResult.getTotal())); |
| | | } |
| | | |
| | | @GetMapping("/export-excel") |
| | | @Operation(summary = "导åºå·¥èºåæ° Excel") |
| | | @PreAuthorize("@ss.hasPermission('mes:pd-process-param:export')") |
| | | @ApiAccessLog(operateType = EXPORT) |
| | | public void exportProcessParamExcel(@Valid MesPdProcessParamPageReqVO pageReqVO, |
| | | HttpServletResponse response) throws IOException { |
| | | pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE); |
| | | List<MesPdProcessParamDO> list = processParamService.getProcessParamPage(pageReqVO).getList(); |
| | | // å¯¼åº Excel |
| | | ExcelUtils.write(response, "å·¥èºåæ°.xls", "æ°æ®", MesPdProcessParamRespVO.class, |
| | | buildProcessParamRespVOList(list)); |
| | | } |
| | | |
| | | // ==================== æ¼æ¥ VO ==================== |
| | | |
| | | private List<MesPdProcessParamRespVO> buildProcessParamRespVOList(List<MesPdProcessParamDO> list) { |
| | | if (CollUtil.isEmpty(list)) { |
| | | return Collections.emptyList(); |
| | | } |
| | | // 1. æ¹éè·åå
³èæ°æ®ï¼è®¡éåä½ï¼ |
| | | Map<Long, MesMdUnitMeasureDO> unitMeasureMap = unitMeasureService.getUnitMeasureMap( |
| | | convertSet(list, MesPdProcessParamDO::getUnitMeasureId)); |
| | | // 2. æ¼æ¥ VO |
| | | return BeanUtils.toBean(list, MesPdProcessParamRespVO.class, vo -> |
| | | MapUtils.findAndThen(unitMeasureMap, vo.getUnitMeasureId(), |
| | | unitMeasure -> vo.setUnitMeasureName(unitMeasure.getName())) |
| | | ); |
| | | } |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.mes.controller.admin.pd.processparam.vo; |
| | | |
| | | import cn.iocoder.yudao.framework.common.pojo.PageParam; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | import lombok.ToString; |
| | | |
| | | @Schema(description = "管çåå° - MES å·¥èºåæ°å页 Request VO") |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = true) |
| | | @ToString(callSuper = true) |
| | | public class MesPdProcessParamPageReqVO extends PageParam { |
| | | |
| | | @Schema(description = "åæ°ç¼ç ", example = "PP2024001") |
| | | private String paramCode; |
| | | |
| | | @Schema(description = "åæ°åç§°", example = "温度") |
| | | private String paramName; |
| | | |
| | | @Schema(description = "åæ°ç±»å", example = "1") |
| | | private Integer paramType; |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.mes.controller.admin.pd.processparam.vo; |
| | | |
| | | import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; |
| | | import cn.iocoder.yudao.framework.excel.core.convert.DictConvert; |
| | | import cn.iocoder.yudao.module.mes.enums.DictTypeConstants; |
| | | import cn.idev.excel.annotation.ExcelIgnoreUnannotated; |
| | | import cn.idev.excel.annotation.ExcelProperty; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | |
| | | import java.time.LocalDateTime; |
| | | |
| | | @Schema(description = "管çåå° - MES å·¥èºåæ° Response VO") |
| | | @Data |
| | | @ExcelIgnoreUnannotated |
| | | public class MesPdProcessParamRespVO { |
| | | |
| | | @Schema(description = "ç¼å·", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") |
| | | @ExcelProperty("ç¼å·") |
| | | private Long id; |
| | | |
| | | @Schema(description = "åæ°ç¼ç ", requiredMode = Schema.RequiredMode.REQUIRED, example = "PP2024001") |
| | | @ExcelProperty("åæ°ç¼ç ") |
| | | private String paramCode; |
| | | |
| | | @Schema(description = "åæ°åç§°", requiredMode = Schema.RequiredMode.REQUIRED, example = "温度") |
| | | @ExcelProperty("åæ°åç§°") |
| | | private String paramName; |
| | | |
| | | @Schema(description = "åæ°ç±»å", example = "1") |
| | | @ExcelProperty(value = "åæ°ç±»å", converter = DictConvert.class) |
| | | @DictFormat(DictTypeConstants.MES_PD_PROCESS_PARAM_TYPE) |
| | | private Integer paramType; |
| | | |
| | | @Schema(description = "计éåä½ID", example = "1") |
| | | private Long unitMeasureId; |
| | | |
| | | @Schema(description = "计éåä½åç§°", example = "â") |
| | | @ExcelProperty("åä½") |
| | | private String unitMeasureName; |
| | | |
| | | @Schema(description = "æ¯å¦å¿
å¡«", example = "true") |
| | | @ExcelProperty("æ¯å¦å¿
å¡«") |
| | | private Boolean required; |
| | | |
| | | @Schema(description = "夿³¨", example = "æµè¯å¤æ³¨") |
| | | @ExcelProperty("夿³¨") |
| | | private String remark; |
| | | |
| | | @Schema(description = "å建æ¶é´", requiredMode = Schema.RequiredMode.REQUIRED) |
| | | @ExcelProperty("å建æ¶é´") |
| | | private LocalDateTime createTime; |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.mes.controller.admin.pd.processparam.vo; |
| | | |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | |
| | | import jakarta.validation.constraints.NotBlank; |
| | | |
| | | @Schema(description = "管çåå° - MES å·¥èºåæ°æ°å¢/ä¿®æ¹ Request VO") |
| | | @Data |
| | | public class MesPdProcessParamSaveReqVO { |
| | | |
| | | @Schema(description = "ç¼å·", requiredMode = Schema.RequiredMode.NOT_REQUIRED, example = "1024") |
| | | private Long id; |
| | | |
| | | @Schema(description = "åæ°åç§°", requiredMode = Schema.RequiredMode.REQUIRED, example = "温度") |
| | | @NotBlank(message = "åæ°åç§°ä¸è½ä¸ºç©º") |
| | | private String paramName; |
| | | |
| | | @Schema(description = "åæ°ç±»å", example = "1") |
| | | private Integer paramType; |
| | | |
| | | @Schema(description = "计éåä½ID", example = "1") |
| | | private Long unitMeasureId; |
| | | |
| | | @Schema(description = "æ¯å¦å¿
å¡«", example = "true") |
| | | private Boolean required; |
| | | |
| | | @Schema(description = "夿³¨", example = "æµè¯å¤æ³¨") |
| | | private String remark; |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.mes.controller.admin.pd.processparamtemplate; |
| | | |
| | | import cn.hutool.core.collection.CollUtil; |
| | | import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog; |
| | | import cn.iocoder.yudao.framework.common.pojo.CommonResult; |
| | | import cn.iocoder.yudao.framework.common.pojo.PageParam; |
| | | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| | | import cn.iocoder.yudao.framework.common.util.collection.MapUtils; |
| | | import cn.iocoder.yudao.framework.common.util.object.BeanUtils; |
| | | import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.pd.processparamtemplate.vo.MesPdProcessParamTemplatePageReqVO; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.pd.processparamtemplate.vo.MesPdProcessParamTemplateRespVO; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.pd.processparamtemplate.vo.MesPdProcessParamTemplateSaveReqVO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.md.unitmeasure.MesMdUnitMeasureDO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.pd.processparamtemplate.MesPdProcessParamTemplateDO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.pd.processparamtemplate.MesPdProcessParamTemplateDetailDO; |
| | | import cn.iocoder.yudao.module.mes.service.md.unitmeasure.MesMdUnitMeasureService; |
| | | import cn.iocoder.yudao.module.mes.service.pd.processparamtemplate.MesPdProcessParamTemplateService; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import io.swagger.v3.oas.annotations.Parameter; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | import jakarta.annotation.Resource; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | import jakarta.validation.Valid; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.io.IOException; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.EXPORT; |
| | | import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; |
| | | import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertSet; |
| | | |
| | | @Tag(name = "管çåå° - MES å·¥èºåæ°æ¨¡æ¿") |
| | | @RestController |
| | | @RequestMapping("/mes/pd/process-param-template") |
| | | @Validated |
| | | public class MesPdProcessParamTemplateController { |
| | | |
| | | @Resource |
| | | private MesPdProcessParamTemplateService templateService; |
| | | |
| | | @Resource |
| | | private MesMdUnitMeasureService unitMeasureService; |
| | | |
| | | @PostMapping("/create") |
| | | @Operation(summary = "å建工èºåæ°æ¨¡æ¿") |
| | | @PreAuthorize("@ss.hasPermission('mes:pd-process-param-template:create')") |
| | | public CommonResult<Long> createProcessParamTemplate(@Valid @RequestBody MesPdProcessParamTemplateSaveReqVO createReqVO) { |
| | | return success(templateService.createProcessParamTemplate(createReqVO)); |
| | | } |
| | | |
| | | @PutMapping("/update") |
| | | @Operation(summary = "æ´æ°å·¥èºåæ°æ¨¡æ¿") |
| | | @PreAuthorize("@ss.hasPermission('mes:pd-process-param-template:update')") |
| | | public CommonResult<Boolean> updateProcessParamTemplate(@Valid @RequestBody MesPdProcessParamTemplateSaveReqVO updateReqVO) { |
| | | templateService.updateProcessParamTemplate(updateReqVO); |
| | | return success(true); |
| | | } |
| | | |
| | | @DeleteMapping("/delete") |
| | | @Operation(summary = "å é¤å·¥èºåæ°æ¨¡æ¿") |
| | | @Parameter(name = "id", description = "ç¼å·", required = true) |
| | | @PreAuthorize("@ss.hasPermission('mes:pd-process-param-template:delete')") |
| | | public CommonResult<Boolean> deleteProcessParamTemplate(@RequestParam("id") Long id) { |
| | | templateService.deleteProcessParamTemplate(id); |
| | | return success(true); |
| | | } |
| | | |
| | | @GetMapping("/get") |
| | | @Operation(summary = "è·å¾å·¥èºåæ°æ¨¡æ¿") |
| | | @Parameter(name = "id", description = "ç¼å·", required = true, example = "1024") |
| | | @PreAuthorize("@ss.hasPermission('mes:pd-process-param-template:query')") |
| | | public CommonResult<MesPdProcessParamTemplateRespVO> getProcessParamTemplate(@RequestParam("id") Long id) { |
| | | MesPdProcessParamTemplateDO template = templateService.getProcessParamTemplate(id); |
| | | if (template == null) { |
| | | return success(null); |
| | | } |
| | | return success(buildTemplateRespVO(template)); |
| | | } |
| | | |
| | | @GetMapping("/page") |
| | | @Operation(summary = "è·å¾å·¥èºåæ°æ¨¡æ¿å页") |
| | | @PreAuthorize("@ss.hasPermission('mes:pd-process-param-template:query')") |
| | | public CommonResult<PageResult<MesPdProcessParamTemplateRespVO>> getProcessParamTemplatePage(@Valid MesPdProcessParamTemplatePageReqVO pageReqVO) { |
| | | PageResult<MesPdProcessParamTemplateDO> pageResult = templateService.getProcessParamTemplatePage(pageReqVO); |
| | | List<MesPdProcessParamTemplateRespVO> voList = buildTemplateRespVOList(pageResult.getList()); |
| | | return success(new PageResult<>(voList, pageResult.getTotal())); |
| | | } |
| | | |
| | | @GetMapping("/export-excel") |
| | | @Operation(summary = "导åºå·¥èºåæ°æ¨¡æ¿ Excel") |
| | | @PreAuthorize("@ss.hasPermission('mes:pd-process-param-template:export')") |
| | | @ApiAccessLog(operateType = EXPORT) |
| | | public void exportProcessParamTemplateExcel(@Valid MesPdProcessParamTemplatePageReqVO pageReqVO, |
| | | HttpServletResponse response) throws IOException { |
| | | pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE); |
| | | List<MesPdProcessParamTemplateDO> list = templateService.getProcessParamTemplatePage(pageReqVO).getList(); |
| | | // å¯¼åº Excel |
| | | ExcelUtils.write(response, "å·¥èºåæ°æ¨¡æ¿.xls", "æ°æ®", MesPdProcessParamTemplateRespVO.class, |
| | | buildTemplateRespVOList(list)); |
| | | } |
| | | |
| | | // ==================== æ¼æ¥ VO ==================== |
| | | |
| | | private MesPdProcessParamTemplateRespVO buildTemplateRespVO(MesPdProcessParamTemplateDO template) { |
| | | return buildTemplateRespVOList(Collections.singletonList(template)).get(0); |
| | | } |
| | | |
| | | private List<MesPdProcessParamTemplateRespVO> buildTemplateRespVOList(List<MesPdProcessParamTemplateDO> list) { |
| | | if (CollUtil.isEmpty(list)) { |
| | | return Collections.emptyList(); |
| | | } |
| | | // 1. æ¹éè·åæææ¨¡æ¿çæç» |
| | | Map<Long, List<MesPdProcessParamTemplateDetailDO>> detailMap = new HashMap<>(); |
| | | Set<Long> allUnitMeasureIds = new HashSet<>(); |
| | | for (MesPdProcessParamTemplateDO template : list) { |
| | | List<MesPdProcessParamTemplateDetailDO> details = |
| | | templateService.getProcessParamTemplateDetailListByTemplateId(template.getId()); |
| | | detailMap.put(template.getId(), details); |
| | | for (MesPdProcessParamTemplateDetailDO detail : details) { |
| | | if (detail.getUnitMeasureId() != null) { |
| | | allUnitMeasureIds.add(detail.getUnitMeasureId()); |
| | | } |
| | | } |
| | | } |
| | | // 2. æ¹éè·å计éåä½ |
| | | Map<Long, MesMdUnitMeasureDO> unitMeasureMap = unitMeasureService.getUnitMeasureMap(allUnitMeasureIds); |
| | | // 3. æ¼æ¥ VO |
| | | return BeanUtils.toBean(list, MesPdProcessParamTemplateRespVO.class, vo -> { |
| | | List<MesPdProcessParamTemplateDetailDO> details = detailMap.get(vo.getId()); |
| | | if (CollUtil.isNotEmpty(details)) { |
| | | List<MesPdProcessParamTemplateRespVO.DetailResp> detailResps = BeanUtils.toBean( |
| | | details, MesPdProcessParamTemplateRespVO.DetailResp.class, detailResp -> |
| | | MapUtils.findAndThen(unitMeasureMap, detailResp.getUnitMeasureId(), |
| | | unitMeasure -> detailResp.setUnitMeasureName(unitMeasure.getName())) |
| | | ); |
| | | vo.setDetails(detailResps); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.mes.controller.admin.pd.processparamtemplate.vo; |
| | | |
| | | import cn.iocoder.yudao.framework.common.pojo.PageParam; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | import lombok.ToString; |
| | | |
| | | @Schema(description = "管çåå° - MES å·¥èºåæ°æ¨¡æ¿å页 Request VO") |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = true) |
| | | @ToString(callSuper = true) |
| | | public class MesPdProcessParamTemplatePageReqVO extends PageParam { |
| | | |
| | | @Schema(description = "模æ¿ç¼ç ", example = "PPT2024001") |
| | | private String templateCode; |
| | | |
| | | @Schema(description = "模æ¿åç§°", example = "注å¡å·¥èºåæ°æ¨¡æ¿") |
| | | private String templateName; |
| | | |
| | | @Schema(description = "模æ¿ç±»å", example = "1") |
| | | private Integer templateType; |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.mes.controller.admin.pd.processparamtemplate.vo; |
| | | |
| | | import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; |
| | | import cn.iocoder.yudao.framework.excel.core.convert.DictConvert; |
| | | import cn.iocoder.yudao.module.mes.enums.DictTypeConstants; |
| | | import cn.idev.excel.annotation.ExcelIgnoreUnannotated; |
| | | import cn.idev.excel.annotation.ExcelProperty; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | |
| | | import java.time.LocalDateTime; |
| | | import java.util.List; |
| | | |
| | | @Schema(description = "管çåå° - MES å·¥èºåæ°æ¨¡æ¿ Response VO") |
| | | @Data |
| | | @ExcelIgnoreUnannotated |
| | | public class MesPdProcessParamTemplateRespVO { |
| | | |
| | | @Schema(description = "ç¼å·", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") |
| | | @ExcelProperty("ç¼å·") |
| | | private Long id; |
| | | |
| | | @Schema(description = "模æ¿ç¼ç ", requiredMode = Schema.RequiredMode.REQUIRED, example = "PPT2024001") |
| | | @ExcelProperty("模æ¿ç¼ç ") |
| | | private String templateCode; |
| | | |
| | | @Schema(description = "模æ¿åç§°", requiredMode = Schema.RequiredMode.REQUIRED, example = "注å¡å·¥èºåæ°æ¨¡æ¿") |
| | | @ExcelProperty("模æ¿åç§°") |
| | | private String templateName; |
| | | |
| | | @Schema(description = "模æ¿ç±»å", example = "1") |
| | | @ExcelProperty(value = "模æ¿ç±»å", converter = DictConvert.class) |
| | | @DictFormat(DictTypeConstants.MES_PD_PROCESS_PARAM_TEMPLATE_TYPE) |
| | | private Integer templateType; |
| | | |
| | | @Schema(description = "夿³¨", example = "æµè¯å¤æ³¨") |
| | | @ExcelProperty("夿³¨") |
| | | private String remark; |
| | | |
| | | @Schema(description = "å建æ¶é´", requiredMode = Schema.RequiredMode.REQUIRED) |
| | | @ExcelProperty("å建æ¶é´") |
| | | private LocalDateTime createTime; |
| | | |
| | | @Schema(description = "æ¨¡æ¿æç»å表") |
| | | private List<DetailResp> details; |
| | | |
| | | @Schema(description = "æ¨¡æ¿æç»") |
| | | @Data |
| | | public static class DetailResp { |
| | | |
| | | @Schema(description = "æç»ç¼å·", example = "1") |
| | | private Long id; |
| | | |
| | | @Schema(description = "模æ¿ID", example = "1") |
| | | private Long templateId; |
| | | |
| | | @Schema(description = "å·¥èºåæ°ID", example = "1") |
| | | private Long processParamId; |
| | | |
| | | @Schema(description = "åæ°ç¼ç ", example = "PP2024001") |
| | | private String paramCode; |
| | | |
| | | @Schema(description = "åæ°åç§°", example = "温度") |
| | | private String paramName; |
| | | |
| | | @Schema(description = "åæ°ç±»å", example = "1") |
| | | private Integer paramType; |
| | | |
| | | @Schema(description = "计éåä½ID", example = "1") |
| | | private Long unitMeasureId; |
| | | |
| | | @Schema(description = "计éåä½åç§°", example = "â") |
| | | private String unitMeasureName; |
| | | |
| | | @Schema(description = "æ¯å¦å¿
å¡«", example = "true") |
| | | private Boolean required; |
| | | |
| | | @Schema(description = "夿³¨", example = "æµè¯å¤æ³¨") |
| | | private String remark; |
| | | |
| | | } |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.mes.controller.admin.pd.processparamtemplate.vo; |
| | | |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | |
| | | import jakarta.validation.Valid; |
| | | import jakarta.validation.constraints.NotBlank; |
| | | import jakarta.validation.constraints.NotEmpty; |
| | | import jakarta.validation.constraints.NotNull; |
| | | import java.util.List; |
| | | |
| | | @Schema(description = "管çåå° - MES å·¥èºåæ°æ¨¡æ¿æ°å¢/ä¿®æ¹ Request VO") |
| | | @Data |
| | | public class MesPdProcessParamTemplateSaveReqVO { |
| | | |
| | | @Schema(description = "ç¼å·", requiredMode = Schema.RequiredMode.NOT_REQUIRED, example = "1024") |
| | | private Long id; |
| | | |
| | | @Schema(description = "模æ¿åç§°", requiredMode = Schema.RequiredMode.REQUIRED, example = "注å¡å·¥èºåæ°æ¨¡æ¿") |
| | | @NotBlank(message = "模æ¿åç§°ä¸è½ä¸ºç©º") |
| | | private String templateName; |
| | | |
| | | @Schema(description = "模æ¿ç±»å", example = "1") |
| | | private Integer templateType; |
| | | |
| | | @Schema(description = "夿³¨", example = "æµè¯å¤æ³¨") |
| | | private String remark; |
| | | |
| | | @Schema(description = "æ¨¡æ¿æç»å表", requiredMode = Schema.RequiredMode.REQUIRED) |
| | | @NotEmpty(message = "æ¨¡æ¿æç»ä¸è½ä¸ºç©º") |
| | | @Valid |
| | | private List<Detail> details; |
| | | |
| | | @Schema(description = "æ¨¡æ¿æç»") |
| | | @Data |
| | | public static class Detail { |
| | | |
| | | @Schema(description = "å·¥èºåæ°ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") |
| | | @NotNull(message = "å·¥èºåæ°IDä¸è½ä¸ºç©º") |
| | | private Long processParamId; |
| | | |
| | | @Schema(description = "æ¯å¦å¿
å¡«ï¼å¯è¦çåæ°é»è®¤å¼ï¼", example = "true") |
| | | private Boolean required; |
| | | |
| | | @Schema(description = "夿³¨ï¼å¯è¦çåæ°é»è®¤å¼ï¼", example = "èªå®ä¹å¤æ³¨") |
| | | private String remark; |
| | | |
| | | } |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.mes.dal.dataobject.pd.processparam; |
| | | |
| | | import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; |
| | | import cn.iocoder.yudao.module.mes.enums.DictTypeConstants; |
| | | import com.baomidou.mybatisplus.annotation.KeySequence; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import lombok.*; |
| | | |
| | | /** |
| | | * MES å·¥èºåæ° DO |
| | | * |
| | | * @author èéæºç |
| | | */ |
| | | @TableName("mes_pd_process_param") |
| | | @KeySequence("mes_pd_process_param_seq") // ç¨äº OracleãPostgreSQLãKingbaseãDB2ãH2 æ°æ®åºç主é®èªå¢ãå¦ææ¯ MySQL çæ°æ®åºï¼å¯ä¸åã |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = true) |
| | | @ToString(callSuper = true) |
| | | @Builder |
| | | @NoArgsConstructor |
| | | @AllArgsConstructor |
| | | public class MesPdProcessParamDO extends BaseDO { |
| | | |
| | | /** |
| | | * ç¼å· |
| | | */ |
| | | @TableId |
| | | private Long id; |
| | | /** |
| | | * åæ°ç¼ç |
| | | */ |
| | | private String paramCode; |
| | | /** |
| | | * åæ°åç§° |
| | | */ |
| | | private String paramName; |
| | | /** |
| | | * åæ°ç±»å |
| | | * |
| | | * åå
¸ {@link DictTypeConstants#MES_PD_PROCESS_PARAM_TYPE} |
| | | */ |
| | | private Integer paramType; |
| | | /** |
| | | * 计éåä½ID |
| | | * |
| | | * å
³è mes_md_unit_measure ç id |
| | | */ |
| | | private Long unitMeasureId; |
| | | /** |
| | | * æ¯å¦å¿
å¡« |
| | | */ |
| | | private Boolean required; |
| | | /** |
| | | * 夿³¨ |
| | | */ |
| | | private String remark; |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.mes.dal.dataobject.pd.processparamtemplate; |
| | | |
| | | import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; |
| | | import cn.iocoder.yudao.module.mes.enums.DictTypeConstants; |
| | | import com.baomidou.mybatisplus.annotation.KeySequence; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import lombok.*; |
| | | |
| | | /** |
| | | * MES å·¥èºåæ°æ¨¡æ¿ DO |
| | | * |
| | | * @author èéæºç |
| | | */ |
| | | @TableName("mes_pd_process_param_template") |
| | | @KeySequence("mes_pd_process_param_template_seq") // ç¨äº OracleãPostgreSQLãKingbaseãDB2ãH2 æ°æ®åºç主é®èªå¢ãå¦ææ¯ MySQL çæ°æ®åºï¼å¯ä¸åã |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = true) |
| | | @ToString(callSuper = true) |
| | | @Builder |
| | | @NoArgsConstructor |
| | | @AllArgsConstructor |
| | | public class MesPdProcessParamTemplateDO extends BaseDO { |
| | | |
| | | /** |
| | | * ç¼å· |
| | | */ |
| | | @TableId |
| | | private Long id; |
| | | /** |
| | | * 模æ¿ç¼ç |
| | | */ |
| | | private String templateCode; |
| | | /** |
| | | * 模æ¿åç§° |
| | | */ |
| | | private String templateName; |
| | | /** |
| | | * 模æ¿ç±»å |
| | | * |
| | | * åå
¸ {@link DictTypeConstants#MES_PD_PROCESS_PARAM_TEMPLATE_TYPE} |
| | | */ |
| | | private Integer templateType; |
| | | /** |
| | | * 夿³¨ |
| | | */ |
| | | private String remark; |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.mes.dal.dataobject.pd.processparamtemplate; |
| | | |
| | | import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; |
| | | import com.baomidou.mybatisplus.annotation.KeySequence; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import lombok.*; |
| | | |
| | | /** |
| | | * MES å·¥èºåæ°æ¨¡æ¿æç» DO |
| | | * <p> |
| | | * å¿«ç
§è¡¨ï¼åå¨å
³èæ¶å·¥èºåæ°ç坿¬å¼ï¼æ¹åå·¥èºåæ°å表çå¼ä¸å½±åæ¨¡æ¿æç»ã |
| | | * process_param_id ä»
使º¯æºï¼æ¨¡æ¿ä¸ä»åæ°ä¸»è¡¨è¯»åæ¾ç¤ºå¼ã |
| | | * |
| | | * @author èéæºç |
| | | */ |
| | | @TableName("mes_pd_process_param_template_detail") |
| | | @KeySequence("mes_pd_process_param_template_detail_seq") // ç¨äº OracleãPostgreSQLãKingbaseãDB2ãH2 æ°æ®åºç主é®èªå¢ãå¦ææ¯ MySQL çæ°æ®åºï¼å¯ä¸åã |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = true) |
| | | @ToString(callSuper = true) |
| | | @Builder |
| | | @NoArgsConstructor |
| | | @AllArgsConstructor |
| | | public class MesPdProcessParamTemplateDetailDO extends BaseDO { |
| | | |
| | | /** |
| | | * ç¼å· |
| | | */ |
| | | @TableId |
| | | private Long id; |
| | | /** |
| | | * 模æ¿ID |
| | | * |
| | | * å
³è {@link MesPdProcessParamTemplateDO#getId()} |
| | | */ |
| | | private Long templateId; |
| | | /** |
| | | * å·¥èºåæ°IDï¼ä»
使º¯æºï¼ä¸å½±åå¿«ç
§å¼ï¼ |
| | | * |
| | | * å
³è mes_pd_process_param ç id |
| | | */ |
| | | private Long processParamId; |
| | | /** |
| | | * åæ°ç¼ç ï¼å¿«ç
§ï¼ |
| | | */ |
| | | private String paramCode; |
| | | /** |
| | | * åæ°åç§°ï¼å¿«ç
§ï¼ |
| | | */ |
| | | private String paramName; |
| | | /** |
| | | * åæ°ç±»åï¼å¿«ç
§ï¼ |
| | | */ |
| | | private Integer paramType; |
| | | /** |
| | | * 计éåä½IDï¼å¿«ç
§ï¼ |
| | | */ |
| | | private Long unitMeasureId; |
| | | /** |
| | | * æ¯å¦å¿
å¡«ï¼å¿«ç
§ï¼ |
| | | */ |
| | | private Boolean required; |
| | | /** |
| | | * 夿³¨ï¼å¿«ç
§ï¼ |
| | | */ |
| | | private String remark; |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.mes.dal.mysql.pd.processparam; |
| | | |
| | | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| | | import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; |
| | | import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.pd.processparam.vo.MesPdProcessParamPageReqVO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.pd.processparam.MesPdProcessParamDO; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | |
| | | @Mapper |
| | | public interface MesPdProcessParamMapper extends BaseMapperX<MesPdProcessParamDO> { |
| | | |
| | | default PageResult<MesPdProcessParamDO> selectPage(MesPdProcessParamPageReqVO reqVO) { |
| | | return selectPage(reqVO, new LambdaQueryWrapperX<MesPdProcessParamDO>() |
| | | .likeIfPresent(MesPdProcessParamDO::getParamCode, reqVO.getParamCode()) |
| | | .likeIfPresent(MesPdProcessParamDO::getParamName, reqVO.getParamName()) |
| | | .eqIfPresent(MesPdProcessParamDO::getParamType, reqVO.getParamType()) |
| | | .orderByDesc(MesPdProcessParamDO::getId)); |
| | | } |
| | | |
| | | default MesPdProcessParamDO selectByParamCode(String paramCode) { |
| | | return selectOne(MesPdProcessParamDO::getParamCode, paramCode); |
| | | } |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.mes.dal.mysql.pd.processparamtemplate; |
| | | |
| | | import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.pd.processparamtemplate.MesPdProcessParamTemplateDetailDO; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Mapper |
| | | public interface MesPdProcessParamTemplateDetailMapper extends BaseMapperX<MesPdProcessParamTemplateDetailDO> { |
| | | |
| | | default List<MesPdProcessParamTemplateDetailDO> selectListByTemplateId(Long templateId) { |
| | | return selectList(MesPdProcessParamTemplateDetailDO::getTemplateId, templateId); |
| | | } |
| | | |
| | | default int deleteByTemplateId(Long templateId) { |
| | | return delete(MesPdProcessParamTemplateDetailDO::getTemplateId, templateId); |
| | | } |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.mes.dal.mysql.pd.processparamtemplate; |
| | | |
| | | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| | | import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; |
| | | import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.pd.processparamtemplate.vo.MesPdProcessParamTemplatePageReqVO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.pd.processparamtemplate.MesPdProcessParamTemplateDO; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | |
| | | @Mapper |
| | | public interface MesPdProcessParamTemplateMapper extends BaseMapperX<MesPdProcessParamTemplateDO> { |
| | | |
| | | default PageResult<MesPdProcessParamTemplateDO> selectPage(MesPdProcessParamTemplatePageReqVO reqVO) { |
| | | return selectPage(reqVO, new LambdaQueryWrapperX<MesPdProcessParamTemplateDO>() |
| | | .likeIfPresent(MesPdProcessParamTemplateDO::getTemplateCode, reqVO.getTemplateCode()) |
| | | .likeIfPresent(MesPdProcessParamTemplateDO::getTemplateName, reqVO.getTemplateName()) |
| | | .eqIfPresent(MesPdProcessParamTemplateDO::getTemplateType, reqVO.getTemplateType()) |
| | | .orderByDesc(MesPdProcessParamTemplateDO::getId)); |
| | | } |
| | | |
| | | default MesPdProcessParamTemplateDO selectByTemplateCode(String templateCode) { |
| | | return selectOne(MesPdProcessParamTemplateDO::getTemplateCode, templateCode); |
| | | } |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.mes.service.pd.processparam; |
| | | |
| | | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.pd.processparam.vo.MesPdProcessParamPageReqVO; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.pd.processparam.vo.MesPdProcessParamSaveReqVO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.pd.processparam.MesPdProcessParamDO; |
| | | import jakarta.validation.Valid; |
| | | |
| | | import java.util.Collection; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * MES å·¥èºåæ° Service æ¥å£ |
| | | * |
| | | * @author èéæºç |
| | | */ |
| | | public interface MesPdProcessParamService { |
| | | |
| | | /** |
| | | * å建工èºåæ° |
| | | * |
| | | * @param createReqVO åå»ºä¿¡æ¯ |
| | | * @return ç¼å· |
| | | */ |
| | | Long createProcessParam(@Valid MesPdProcessParamSaveReqVO createReqVO); |
| | | |
| | | /** |
| | | * æ´æ°å·¥èºåæ° |
| | | * |
| | | * @param updateReqVO æ´æ°ä¿¡æ¯ |
| | | */ |
| | | void updateProcessParam(@Valid MesPdProcessParamSaveReqVO updateReqVO); |
| | | |
| | | /** |
| | | * å é¤å·¥èºåæ° |
| | | * |
| | | * @param id ç¼å· |
| | | */ |
| | | void deleteProcessParam(Long id); |
| | | |
| | | /** |
| | | * æ ¡éªå·¥èºåæ°åå¨ |
| | | * |
| | | * @param id ç¼å· |
| | | * @return å·¥èºåæ° |
| | | */ |
| | | MesPdProcessParamDO validateProcessParamExists(Long id); |
| | | |
| | | /** |
| | | * è·å¾å·¥èºåæ° |
| | | * |
| | | * @param id ç¼å· |
| | | * @return å·¥èºåæ° |
| | | */ |
| | | MesPdProcessParamDO getProcessParam(Long id); |
| | | |
| | | /** |
| | | * è·å¾å·¥èºåæ°å页 |
| | | * |
| | | * @param pageReqVO å页æ¥è¯¢ |
| | | * @return å·¥èºåæ°å页 |
| | | */ |
| | | PageResult<MesPdProcessParamDO> getProcessParamPage(MesPdProcessParamPageReqVO pageReqVO); |
| | | |
| | | /** |
| | | * è·å¾å·¥èºåæ°å表 |
| | | * |
| | | * @param ids ç¼å·éå |
| | | * @return å·¥èºåæ°å表 |
| | | */ |
| | | List<MesPdProcessParamDO> getProcessParamList(Collection<Long> ids); |
| | | |
| | | /** |
| | | * è·å¾å·¥èºåæ° Map |
| | | * |
| | | * @param ids ç¼å·éå |
| | | * @return å·¥èºåæ° Map |
| | | */ |
| | | default Map<Long, MesPdProcessParamDO> getProcessParamMap(Collection<Long> ids) { |
| | | List<MesPdProcessParamDO> list = getProcessParamList(ids); |
| | | return cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertMap(list, MesPdProcessParamDO::getId); |
| | | } |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.mes.service.pd.processparam; |
| | | |
| | | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| | | import cn.iocoder.yudao.framework.common.util.object.BeanUtils; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.pd.processparam.vo.MesPdProcessParamPageReqVO; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.pd.processparam.vo.MesPdProcessParamSaveReqVO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.pd.processparam.MesPdProcessParamDO; |
| | | import cn.iocoder.yudao.module.mes.dal.mysql.pd.processparam.MesPdProcessParamMapper; |
| | | import cn.iocoder.yudao.module.mes.enums.md.autocode.MesMdAutoCodeRuleCodeEnum; |
| | | import cn.iocoder.yudao.module.mes.service.md.autocode.MesMdAutoCodeRecordService; |
| | | import jakarta.annotation.Resource; |
| | | import org.springframework.context.annotation.Lazy; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.validation.annotation.Validated; |
| | | |
| | | import java.util.Collection; |
| | | import java.util.List; |
| | | |
| | | import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; |
| | | import static cn.iocoder.yudao.module.mes.enums.ErrorCodeConstants.*; |
| | | |
| | | /** |
| | | * MES å·¥èºåæ° Service å®ç°ç±» |
| | | * |
| | | * @author èéæºç |
| | | */ |
| | | @Service |
| | | @Validated |
| | | public class MesPdProcessParamServiceImpl implements MesPdProcessParamService { |
| | | |
| | | @Resource |
| | | private MesPdProcessParamMapper processParamMapper; |
| | | |
| | | @Resource |
| | | @Lazy |
| | | private MesMdAutoCodeRecordService autoCodeRecordService; |
| | | |
| | | @Override |
| | | public Long createProcessParam(MesPdProcessParamSaveReqVO createReqVO) { |
| | | // çæåæ°ç¼ç |
| | | String paramCode = autoCodeRecordService.generateAutoCode( |
| | | MesMdAutoCodeRuleCodeEnum.PD_PROCESS_PARAM_CODE.getCode()); |
| | | // æå
¥ |
| | | MesPdProcessParamDO processParam = BeanUtils.toBean(createReqVO, MesPdProcessParamDO.class); |
| | | processParam.setParamCode(paramCode); |
| | | processParamMapper.insert(processParam); |
| | | return processParam.getId(); |
| | | } |
| | | |
| | | @Override |
| | | public void updateProcessParam(MesPdProcessParamSaveReqVO updateReqVO) { |
| | | // æ ¡éªåå¨ |
| | | validateProcessParamExists(updateReqVO.getId()); |
| | | // æ´æ° |
| | | MesPdProcessParamDO updateObj = BeanUtils.toBean(updateReqVO, MesPdProcessParamDO.class); |
| | | processParamMapper.updateById(updateObj); |
| | | } |
| | | |
| | | @Override |
| | | public void deleteProcessParam(Long id) { |
| | | // æ ¡éªåå¨ |
| | | validateProcessParamExists(id); |
| | | // å é¤ |
| | | processParamMapper.deleteById(id); |
| | | } |
| | | |
| | | @Override |
| | | public MesPdProcessParamDO validateProcessParamExists(Long id) { |
| | | MesPdProcessParamDO processParam = processParamMapper.selectById(id); |
| | | if (processParam == null) { |
| | | throw exception(PD_PROCESS_PARAM_NOT_EXISTS); |
| | | } |
| | | return processParam; |
| | | } |
| | | |
| | | @Override |
| | | public MesPdProcessParamDO getProcessParam(Long id) { |
| | | return processParamMapper.selectById(id); |
| | | } |
| | | |
| | | @Override |
| | | public PageResult<MesPdProcessParamDO> getProcessParamPage(MesPdProcessParamPageReqVO pageReqVO) { |
| | | return processParamMapper.selectPage(pageReqVO); |
| | | } |
| | | |
| | | @Override |
| | | public List<MesPdProcessParamDO> getProcessParamList(Collection<Long> ids) { |
| | | return processParamMapper.selectBatchIds(ids); |
| | | } |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.mes.service.pd.processparamtemplate; |
| | | |
| | | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.pd.processparamtemplate.vo.MesPdProcessParamTemplatePageReqVO; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.pd.processparamtemplate.vo.MesPdProcessParamTemplateSaveReqVO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.pd.processparamtemplate.MesPdProcessParamTemplateDO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.pd.processparamtemplate.MesPdProcessParamTemplateDetailDO; |
| | | import jakarta.validation.Valid; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * MES å·¥èºåæ°æ¨¡æ¿ Service æ¥å£ |
| | | * |
| | | * @author èéæºç |
| | | */ |
| | | public interface MesPdProcessParamTemplateService { |
| | | |
| | | /** |
| | | * å建工èºåæ°æ¨¡æ¿ |
| | | * |
| | | * @param createReqVO åå»ºä¿¡æ¯ |
| | | * @return ç¼å· |
| | | */ |
| | | Long createProcessParamTemplate(@Valid MesPdProcessParamTemplateSaveReqVO createReqVO); |
| | | |
| | | /** |
| | | * æ´æ°å·¥èºåæ°æ¨¡æ¿ |
| | | * |
| | | * @param updateReqVO æ´æ°ä¿¡æ¯ |
| | | */ |
| | | void updateProcessParamTemplate(@Valid MesPdProcessParamTemplateSaveReqVO updateReqVO); |
| | | |
| | | /** |
| | | * å é¤å·¥èºåæ°æ¨¡æ¿ |
| | | * |
| | | * @param id ç¼å· |
| | | */ |
| | | void deleteProcessParamTemplate(Long id); |
| | | |
| | | /** |
| | | * æ ¡éªå·¥èºåæ°æ¨¡æ¿åå¨ |
| | | * |
| | | * @param id ç¼å· |
| | | * @return å·¥èºåæ°æ¨¡æ¿ |
| | | */ |
| | | MesPdProcessParamTemplateDO validateProcessParamTemplateExists(Long id); |
| | | |
| | | /** |
| | | * è·å¾å·¥èºåæ°æ¨¡æ¿ |
| | | * |
| | | * @param id ç¼å· |
| | | * @return å·¥èºåæ°æ¨¡æ¿ |
| | | */ |
| | | MesPdProcessParamTemplateDO getProcessParamTemplate(Long id); |
| | | |
| | | /** |
| | | * è·å¾å·¥èºåæ°æ¨¡æ¿å页 |
| | | * |
| | | * @param pageReqVO å页æ¥è¯¢ |
| | | * @return å·¥èºåæ°æ¨¡æ¿å页 |
| | | */ |
| | | PageResult<MesPdProcessParamTemplateDO> getProcessParamTemplatePage(MesPdProcessParamTemplatePageReqVO pageReqVO); |
| | | |
| | | /** |
| | | * è·å¾å·¥èºåæ°æ¨¡æ¿æç»å表 |
| | | * |
| | | * @param templateId 模æ¿ID |
| | | * @return æ¨¡æ¿æç»å表 |
| | | */ |
| | | List<MesPdProcessParamTemplateDetailDO> getProcessParamTemplateDetailListByTemplateId(Long templateId); |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.mes.service.pd.processparamtemplate; |
| | | |
| | | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| | | import cn.iocoder.yudao.framework.common.util.object.BeanUtils; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.pd.processparamtemplate.vo.MesPdProcessParamTemplatePageReqVO; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.pd.processparamtemplate.vo.MesPdProcessParamTemplateSaveReqVO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.pd.processparam.MesPdProcessParamDO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.pd.processparamtemplate.MesPdProcessParamTemplateDO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.pd.processparamtemplate.MesPdProcessParamTemplateDetailDO; |
| | | import cn.iocoder.yudao.module.mes.dal.mysql.pd.processparamtemplate.MesPdProcessParamTemplateDetailMapper; |
| | | import cn.iocoder.yudao.module.mes.dal.mysql.pd.processparamtemplate.MesPdProcessParamTemplateMapper; |
| | | import cn.iocoder.yudao.module.mes.enums.md.autocode.MesMdAutoCodeRuleCodeEnum; |
| | | import cn.iocoder.yudao.module.mes.service.md.autocode.MesMdAutoCodeRecordService; |
| | | import cn.iocoder.yudao.module.mes.service.pd.processparam.MesPdProcessParamService; |
| | | import jakarta.annotation.Resource; |
| | | import org.springframework.context.annotation.Lazy; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.validation.annotation.Validated; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; |
| | | import static cn.iocoder.yudao.module.mes.enums.ErrorCodeConstants.*; |
| | | |
| | | /** |
| | | * MES å·¥èºåæ°æ¨¡æ¿ Service å®ç°ç±» |
| | | * |
| | | * @author èéæºç |
| | | */ |
| | | @Service |
| | | @Validated |
| | | public class MesPdProcessParamTemplateServiceImpl implements MesPdProcessParamTemplateService { |
| | | |
| | | @Resource |
| | | private MesPdProcessParamTemplateMapper templateMapper; |
| | | |
| | | @Resource |
| | | private MesPdProcessParamTemplateDetailMapper detailMapper; |
| | | |
| | | @Resource |
| | | @Lazy |
| | | private MesPdProcessParamService processParamService; |
| | | |
| | | @Resource |
| | | @Lazy |
| | | private MesMdAutoCodeRecordService autoCodeRecordService; |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public Long createProcessParamTemplate(MesPdProcessParamTemplateSaveReqVO createReqVO) { |
| | | // 1. çææ¨¡æ¿ç¼ç |
| | | String templateCode = autoCodeRecordService.generateAutoCode( |
| | | MesMdAutoCodeRuleCodeEnum.PD_PROCESS_PARAM_TEMPLATE_CODE.getCode()); |
| | | // 2. æå
¥æ¨¡æ¿ä¸»è¡¨ |
| | | MesPdProcessParamTemplateDO template = BeanUtils.toBean(createReqVO, MesPdProcessParamTemplateDO.class); |
| | | template.setTemplateCode(templateCode); |
| | | templateMapper.insert(template); |
| | | // 3. å¿«ç
§å·¥èºåæ°å¼å°æç»ä¸ |
| | | createTemplateDetails(template.getId(), createReqVO.getDetails()); |
| | | return template.getId(); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void updateProcessParamTemplate(MesPdProcessParamTemplateSaveReqVO updateReqVO) { |
| | | // 1. æ ¡éªåå¨ |
| | | validateProcessParamTemplateExists(updateReqVO.getId()); |
| | | // 2. æ´æ°æ¨¡æ¿ä¸»è¡¨ |
| | | MesPdProcessParamTemplateDO updateObj = BeanUtils.toBean(updateReqVO, MesPdProcessParamTemplateDO.class); |
| | | templateMapper.updateById(updateObj); |
| | | // 3. å 餿§æç»å¹¶éæ°æå
¥ï¼å¿«ç
§æ¨¡å¼ï¼å
å åæï¼ |
| | | detailMapper.deleteByTemplateId(updateReqVO.getId()); |
| | | createTemplateDetails(updateReqVO.getId(), updateReqVO.getDetails()); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void deleteProcessParamTemplate(Long id) { |
| | | // 1. æ ¡éªåå¨ |
| | | validateProcessParamTemplateExists(id); |
| | | // 2. å é¤æç» |
| | | detailMapper.deleteByTemplateId(id); |
| | | // 3. å 餿¨¡æ¿ä¸»è¡¨ |
| | | templateMapper.deleteById(id); |
| | | } |
| | | |
| | | @Override |
| | | public MesPdProcessParamTemplateDO validateProcessParamTemplateExists(Long id) { |
| | | MesPdProcessParamTemplateDO template = templateMapper.selectById(id); |
| | | if (template == null) { |
| | | throw exception(PD_PROCESS_PARAM_TEMPLATE_NOT_EXISTS); |
| | | } |
| | | return template; |
| | | } |
| | | |
| | | @Override |
| | | public MesPdProcessParamTemplateDO getProcessParamTemplate(Long id) { |
| | | return templateMapper.selectById(id); |
| | | } |
| | | |
| | | @Override |
| | | public PageResult<MesPdProcessParamTemplateDO> getProcessParamTemplatePage(MesPdProcessParamTemplatePageReqVO pageReqVO) { |
| | | return templateMapper.selectPage(pageReqVO); |
| | | } |
| | | |
| | | @Override |
| | | public List<MesPdProcessParamTemplateDetailDO> getProcessParamTemplateDetailListByTemplateId(Long templateId) { |
| | | return detailMapper.selectListByTemplateId(templateId); |
| | | } |
| | | |
| | | /** |
| | | * åå»ºæ¨¡æ¿æç»ï¼å¿«ç
§é»è¾ï¼ä»å·¥èºåæ°ä¸»è¡¨å¤å¶å¼å°æç»ï¼ |
| | | * |
| | | * @param templateId 模æ¿ID |
| | | * @param detailVOs æç»VOå表 |
| | | */ |
| | | private void createTemplateDetails(Long templateId, List<MesPdProcessParamTemplateSaveReqVO.Detail> detailVOs) { |
| | | if (detailVOs == null || detailVOs.isEmpty()) { |
| | | return; |
| | | } |
| | | List<MesPdProcessParamTemplateDetailDO> detailDOs = new ArrayList<>(); |
| | | for (MesPdProcessParamTemplateSaveReqVO.Detail detailVO : detailVOs) { |
| | | // æ¥æ¾æºå·¥èºåæ° |
| | | MesPdProcessParamDO param = processParamService.getProcessParam(detailVO.getProcessParamId()); |
| | | if (param == null) { |
| | | throw exception(PD_PROCESS_PARAM_NOT_EXISTS); |
| | | } |
| | | // å°å¼ä»åæ°å¤å¶å°æç»ï¼å¿«ç
§ï¼ï¼ |
| | | MesPdProcessParamTemplateDetailDO detail = MesPdProcessParamTemplateDetailDO.builder() |
| | | .templateId(templateId) |
| | | .processParamId(param.getId()) // ä»
使º¯æº |
| | | .paramCode(param.getParamCode()) // å¤å¶ |
| | | .paramName(param.getParamName()) // å¤å¶ |
| | | .paramType(param.getParamType()) // å¤å¶ |
| | | .unitMeasureId(param.getUnitMeasureId()) // å¤å¶ |
| | | .required(detailVO.getRequired() != null ? detailVO.getRequired() : param.getRequired()) // å
许è¦ç |
| | | .remark(detailVO.getRemark() != null ? detailVO.getRemark() : param.getRemark()) // å
许è¦ç |
| | | .build(); |
| | | detailDOs.add(detail); |
| | | } |
| | | detailDOs.forEach(detailMapper::insert); |
| | | } |
| | | |
| | | } |