Commit cb8143c8570e7b6c51046776fcaab536969392ca
1 parent
84cec146
把仓库字段传入token
Showing
18 changed files
with
850 additions
and
22 deletions
jeecg-boot-master/ant-design-vue-jeecg/src/views/system/config/CompanyList.vue
... | ... | @@ -17,7 +17,7 @@ |
17 | 17 | <template v-if="toggleSearchStatus"> |
18 | 18 | <a-col :xl="6" :lg="7" :md="8" :sm="24"> |
19 | 19 | <a-form-item label="仓库编码"> |
20 | - <a-input placeholder="请输入仓库编码" v-model="queryParam.warehousecode"></a-input> | |
20 | + <a-input placeholder="请输入仓库编码" v-model="queryParam.warehouseCode"></a-input> | |
21 | 21 | </a-form-item> |
22 | 22 | </a-col> |
23 | 23 | </template> |
... | ... | @@ -161,7 +161,7 @@ |
161 | 161 | { |
162 | 162 | title:'仓库编码', |
163 | 163 | align:"center", |
164 | - dataIndex: 'warehousecode' | |
164 | + dataIndex: 'warehouseCode' | |
165 | 165 | }, |
166 | 166 | { |
167 | 167 | title:'地址', |
... | ... | @@ -218,7 +218,7 @@ |
218 | 218 | deleteBatch: "/config/company/deleteBatch", |
219 | 219 | exportXlsUrl: "/config/company/exportXls", |
220 | 220 | importExcelUrl: "config/company/importExcel", |
221 | - | |
221 | + | |
222 | 222 | }, |
223 | 223 | dictOptions:{}, |
224 | 224 | superFieldList:[], |
... | ... |
jeecg-boot-master/ant-design-vue-jeecg/src/views/system/config/SysUserWarehouseList.vue
0 → 100644
1 | +<template> | |
2 | + <a-card :bordered="false"> | |
3 | + <!-- 查询区域 --> | |
4 | + <div class="table-page-search-wrapper"> | |
5 | + <a-form layout="inline" @keyup.enter.native="searchQuery"> | |
6 | + <a-row :gutter="24"> | |
7 | + </a-row> | |
8 | + </a-form> | |
9 | + </div> | |
10 | + <!-- 查询区域-END --> | |
11 | + | |
12 | + <!-- 操作按钮区域 --> | |
13 | + <div class="table-operator"> | |
14 | + <a-button @click="handleAdd" type="primary" icon="plus">新增</a-button> | |
15 | + <a-button type="primary" icon="download" @click="handleExportXls('用户仓库关系表')">导出</a-button> | |
16 | + <a-upload name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader" :action="importExcelUrl" @change="handleImportExcel"> | |
17 | + <a-button type="primary" icon="import">导入</a-button> | |
18 | + </a-upload> | |
19 | + <!-- 高级查询区域 --> | |
20 | + <j-super-query :fieldList="superFieldList" ref="superQueryModal" @handleSuperQuery="handleSuperQuery"></j-super-query> | |
21 | + <a-dropdown v-if="selectedRowKeys.length > 0"> | |
22 | + <a-menu slot="overlay"> | |
23 | + <a-menu-item key="1" @click="batchDel"><a-icon type="delete"/>删除</a-menu-item> | |
24 | + </a-menu> | |
25 | + <a-button style="margin-left: 8px"> 批量操作 <a-icon type="down" /></a-button> | |
26 | + </a-dropdown> | |
27 | + </div> | |
28 | + | |
29 | + <!-- table区域-begin --> | |
30 | + <div> | |
31 | + <div class="ant-alert ant-alert-info" style="margin-bottom: 16px;"> | |
32 | + <i class="anticon anticon-info-circle ant-alert-icon"></i> 已选择 <a style="font-weight: 600">{{ selectedRowKeys.length }}</a>项 | |
33 | + <a style="margin-left: 24px" @click="onClearSelected">清空</a> | |
34 | + </div> | |
35 | + | |
36 | + <a-table | |
37 | + ref="table" | |
38 | + size="middle" | |
39 | + :scroll="{x:true}" | |
40 | + bordered | |
41 | + rowKey="id" | |
42 | + :columns="columns" | |
43 | + :dataSource="dataSource" | |
44 | + :pagination="ipagination" | |
45 | + :loading="loading" | |
46 | + :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}" | |
47 | + class="j-table-force-nowrap" | |
48 | + @change="handleTableChange"> | |
49 | + | |
50 | + <template slot="htmlSlot" slot-scope="text"> | |
51 | + <div v-html="text"></div> | |
52 | + </template> | |
53 | + <template slot="imgSlot" slot-scope="text"> | |
54 | + <span v-if="!text" style="font-size: 12px;font-style: italic;">无图片</span> | |
55 | + <img v-else :src="getImgView(text)" height="25px" alt="" style="max-width:80px;font-size: 12px;font-style: italic;"/> | |
56 | + </template> | |
57 | + <template slot="fileSlot" slot-scope="text"> | |
58 | + <span v-if="!text" style="font-size: 12px;font-style: italic;">无文件</span> | |
59 | + <a-button | |
60 | + v-else | |
61 | + :ghost="true" | |
62 | + type="primary" | |
63 | + icon="download" | |
64 | + size="small" | |
65 | + @click="downloadFile(text)"> | |
66 | + 下载 | |
67 | + </a-button> | |
68 | + </template> | |
69 | + | |
70 | + <span slot="action" slot-scope="text, record"> | |
71 | + <a @click="handleEdit(record)">编辑</a> | |
72 | + | |
73 | + <a-divider type="vertical" /> | |
74 | + <a-dropdown> | |
75 | + <a class="ant-dropdown-link">更多 <a-icon type="down" /></a> | |
76 | + <a-menu slot="overlay"> | |
77 | + <a-menu-item> | |
78 | + <a @click="handleDetail(record)">详情</a> | |
79 | + </a-menu-item> | |
80 | + <a-menu-item> | |
81 | + <a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)"> | |
82 | + <a>删除</a> | |
83 | + </a-popconfirm> | |
84 | + </a-menu-item> | |
85 | + </a-menu> | |
86 | + </a-dropdown> | |
87 | + </span> | |
88 | + | |
89 | + </a-table> | |
90 | + </div> | |
91 | + | |
92 | + <sys-user-warehouse-modal ref="modalForm" @ok="modalFormOk"></sys-user-warehouse-modal> | |
93 | + </a-card> | |
94 | +</template> | |
95 | + | |
96 | +<script> | |
97 | + | |
98 | + import '@/assets/less/TableExpand.less' | |
99 | + import { mixinDevice } from '@/utils/mixin' | |
100 | + import { JeecgListMixin } from '@/mixins/JeecgListMixin' | |
101 | + import SysUserWarehouseModal from './modules/SysUserWarehouseModal' | |
102 | + | |
103 | + export default { | |
104 | + name: 'SysUserWarehouseList', | |
105 | + mixins:[JeecgListMixin, mixinDevice], | |
106 | + components: { | |
107 | + SysUserWarehouseModal | |
108 | + }, | |
109 | + data () { | |
110 | + return { | |
111 | + description: '用户仓库关系表管理页面', | |
112 | + // 表头 | |
113 | + columns: [ | |
114 | + { | |
115 | + title: '#', | |
116 | + dataIndex: '', | |
117 | + key:'rowIndex', | |
118 | + width:60, | |
119 | + align:"center", | |
120 | + customRender:function (t,r,index) { | |
121 | + return parseInt(index)+1; | |
122 | + } | |
123 | + }, | |
124 | + { | |
125 | + title:'用户名称', | |
126 | + align:"center", | |
127 | + dataIndex: 'username' | |
128 | + }, | |
129 | + { | |
130 | + title:'用户表ID', | |
131 | + align:"center", | |
132 | + dataIndex: 'userid' | |
133 | + }, | |
134 | + { | |
135 | + title:'仓库编码', | |
136 | + align:"center", | |
137 | + dataIndex: 'warehousecode' | |
138 | + }, | |
139 | + { | |
140 | + title: '操作', | |
141 | + dataIndex: 'action', | |
142 | + align:"center", | |
143 | + fixed:"right", | |
144 | + width:147, | |
145 | + scopedSlots: { customRender: 'action' } | |
146 | + } | |
147 | + ], | |
148 | + url: { | |
149 | + list: "/config/sysUserWarehouse/list", | |
150 | + delete: "/config/sysUserWarehouse/delete", | |
151 | + deleteBatch: "/config/sysUserWarehouse/deleteBatch", | |
152 | + exportXlsUrl: "/config/sysUserWarehouse/exportXls", | |
153 | + importExcelUrl: "config/sysUserWarehouse/importExcel", | |
154 | + | |
155 | + }, | |
156 | + dictOptions:{}, | |
157 | + superFieldList:[], | |
158 | + } | |
159 | + }, | |
160 | + created() { | |
161 | + this.getSuperFieldList(); | |
162 | + }, | |
163 | + computed: { | |
164 | + importExcelUrl: function(){ | |
165 | + return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`; | |
166 | + }, | |
167 | + }, | |
168 | + methods: { | |
169 | + initDictConfig(){ | |
170 | + }, | |
171 | + getSuperFieldList(){ | |
172 | + let fieldList=[]; | |
173 | + fieldList.push({type:'string',value:'username',text:'用户名称',dictCode:''}) | |
174 | + fieldList.push({type:'int',value:'userid',text:'用户表ID',dictCode:''}) | |
175 | + fieldList.push({type:'string',value:'warehousecode',text:'仓库编码',dictCode:''}) | |
176 | + this.superFieldList = fieldList | |
177 | + } | |
178 | + } | |
179 | + } | |
180 | +</script> | |
181 | +<style scoped> | |
182 | + @import '~@assets/less/common.less'; | |
183 | +</style> | |
0 | 184 | \ No newline at end of file |
... | ... |
jeecg-boot-master/ant-design-vue-jeecg/src/views/system/config/modules/CompanyForm.vue
... | ... | @@ -14,10 +14,15 @@ |
14 | 14 | </a-form-model-item> |
15 | 15 | </a-col> |
16 | 16 | <a-col :span="24"> |
17 | - <a-form-model-item label="仓库编码" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="warehousecode"> | |
18 | - <a-input v-model="model.warehousecode" placeholder="请输入仓库编码" ></a-input> | |
17 | + <a-form-model-item label="仓库编码" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="warehouseCode"> | |
18 | + <a-input v-model="model.warehouseCode" placeholder="请输入仓库编码" ></a-input> | |
19 | 19 | </a-form-model-item> |
20 | 20 | </a-col> |
21 | +<!-- <a-col :span="24">--> | |
22 | +<!-- <a-form-model-item label="仓库编码" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="warehouseCode">--> | |
23 | +<!-- <j-dict-select-tag type="list" v-model="model.warehouseCode" dictCode="warehouse" placeholder="请选择仓库编码" />--> | |
24 | +<!-- </a-form-model-item>--> | |
25 | +<!-- </a-col>--> | |
21 | 26 | <a-col :span="24"> |
22 | 27 | <a-form-model-item label="地址" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="address"> |
23 | 28 | <a-input v-model="model.address" placeholder="请输入地址" ></a-input> |
... | ... | @@ -101,7 +106,7 @@ |
101 | 106 | name: [ |
102 | 107 | { required: true, message: '请输入货主名称!'}, |
103 | 108 | ], |
104 | - warehousecode: [ | |
109 | + warehouseCode: [ | |
105 | 110 | { required: true, message: '请输入仓库编码!'}, |
106 | 111 | ], |
107 | 112 | }, |
... | ... | @@ -155,7 +160,7 @@ |
155 | 160 | that.confirmLoading = false; |
156 | 161 | }) |
157 | 162 | } |
158 | - | |
163 | + | |
159 | 164 | }) |
160 | 165 | }, |
161 | 166 | } |
... | ... |
jeecg-boot-master/ant-design-vue-jeecg/src/views/system/config/modules/SysUserWarehouseForm.vue
0 → 100644
1 | +<template> | |
2 | + <a-spin :spinning="confirmLoading"> | |
3 | + <j-form-container :disabled="formDisabled"> | |
4 | + <a-form-model ref="form" :model="model" :rules="validatorRules" slot="detail"> | |
5 | + <a-row> | |
6 | + <a-col :span="24"> | |
7 | + <a-form-model-item label="用户名称" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="username"> | |
8 | + <a-input v-model="model.username" placeholder="请输入用户名称" ></a-input> | |
9 | + </a-form-model-item> | |
10 | + </a-col> | |
11 | + <a-col :span="24"> | |
12 | + <a-form-model-item label="用户表ID" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="userid"> | |
13 | + <a-input-number v-model="model.userid" placeholder="请输入用户表ID" style="width: 100%" /> | |
14 | + </a-form-model-item> | |
15 | + </a-col> | |
16 | + <a-col :span="24"> | |
17 | + <a-form-model-item label="仓库编码" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="warehousecode"> | |
18 | + <a-input v-model="model.warehousecode" placeholder="请输入仓库编码" ></a-input> | |
19 | + </a-form-model-item> | |
20 | + </a-col> | |
21 | + </a-row> | |
22 | + </a-form-model> | |
23 | + </j-form-container> | |
24 | + </a-spin> | |
25 | +</template> | |
26 | + | |
27 | +<script> | |
28 | + | |
29 | + import { httpAction, getAction } from '@/api/manage' | |
30 | + import { validateDuplicateValue } from '@/utils/util' | |
31 | + | |
32 | + export default { | |
33 | + name: 'SysUserWarehouseForm', | |
34 | + components: { | |
35 | + }, | |
36 | + props: { | |
37 | + //表单禁用 | |
38 | + disabled: { | |
39 | + type: Boolean, | |
40 | + default: false, | |
41 | + required: false | |
42 | + } | |
43 | + }, | |
44 | + data () { | |
45 | + return { | |
46 | + model:{ | |
47 | + }, | |
48 | + labelCol: { | |
49 | + xs: { span: 24 }, | |
50 | + sm: { span: 5 }, | |
51 | + }, | |
52 | + wrapperCol: { | |
53 | + xs: { span: 24 }, | |
54 | + sm: { span: 16 }, | |
55 | + }, | |
56 | + confirmLoading: false, | |
57 | + validatorRules: { | |
58 | + userid: [ | |
59 | + { required: true, message: '请输入用户表ID!'}, | |
60 | + ], | |
61 | + warehousecode: [ | |
62 | + { required: true, message: '请输入仓库编码!'}, | |
63 | + ], | |
64 | + }, | |
65 | + url: { | |
66 | + add: "/config/sysUserWarehouse/add", | |
67 | + edit: "/config/sysUserWarehouse/edit", | |
68 | + queryById: "/config/sysUserWarehouse/queryById" | |
69 | + } | |
70 | + } | |
71 | + }, | |
72 | + computed: { | |
73 | + formDisabled(){ | |
74 | + return this.disabled | |
75 | + }, | |
76 | + }, | |
77 | + created () { | |
78 | + //备份model原始值 | |
79 | + this.modelDefault = JSON.parse(JSON.stringify(this.model)); | |
80 | + }, | |
81 | + methods: { | |
82 | + add () { | |
83 | + this.edit(this.modelDefault); | |
84 | + }, | |
85 | + edit (record) { | |
86 | + this.model = Object.assign({}, record); | |
87 | + this.visible = true; | |
88 | + }, | |
89 | + submitForm () { | |
90 | + const that = this; | |
91 | + // 触发表单验证 | |
92 | + this.$refs.form.validate(valid => { | |
93 | + if (valid) { | |
94 | + that.confirmLoading = true; | |
95 | + let httpurl = ''; | |
96 | + let method = ''; | |
97 | + if(!this.model.id){ | |
98 | + httpurl+=this.url.add; | |
99 | + method = 'post'; | |
100 | + }else{ | |
101 | + httpurl+=this.url.edit; | |
102 | + method = 'put'; | |
103 | + } | |
104 | + httpAction(httpurl,this.model,method).then((res)=>{ | |
105 | + if(res.success){ | |
106 | + that.$message.success(res.message); | |
107 | + that.$emit('ok'); | |
108 | + }else{ | |
109 | + that.$message.warning(res.message); | |
110 | + } | |
111 | + }).finally(() => { | |
112 | + that.confirmLoading = false; | |
113 | + }) | |
114 | + } | |
115 | + | |
116 | + }) | |
117 | + }, | |
118 | + } | |
119 | + } | |
120 | +</script> | |
0 | 121 | \ No newline at end of file |
... | ... |
jeecg-boot-master/ant-design-vue-jeecg/src/views/system/config/modules/SysUserWarehouseModal.Style#Drawer.vue
0 → 100644
1 | +<template> | |
2 | + <a-drawer | |
3 | + :title="title" | |
4 | + :width="width" | |
5 | + placement="right" | |
6 | + :closable="false" | |
7 | + @close="close" | |
8 | + destroyOnClose | |
9 | + :visible="visible"> | |
10 | + <sys-user-warehouse-form ref="realForm" @ok="submitCallback" :disabled="disableSubmit" normal></sys-user-warehouse-form> | |
11 | + <div class="drawer-footer"> | |
12 | + <a-button @click="handleCancel" style="margin-bottom: 0;">关闭</a-button> | |
13 | + <a-button v-if="!disableSubmit" @click="handleOk" type="primary" style="margin-bottom: 0;">提交</a-button> | |
14 | + </div> | |
15 | + </a-drawer> | |
16 | +</template> | |
17 | + | |
18 | +<script> | |
19 | + | |
20 | + import SysUserWarehouseForm from './SysUserWarehouseForm' | |
21 | + | |
22 | + export default { | |
23 | + name: 'SysUserWarehouseModal', | |
24 | + components: { | |
25 | + SysUserWarehouseForm | |
26 | + }, | |
27 | + data () { | |
28 | + return { | |
29 | + title:"操作", | |
30 | + width:800, | |
31 | + visible: false, | |
32 | + disableSubmit: false | |
33 | + } | |
34 | + }, | |
35 | + methods: { | |
36 | + add () { | |
37 | + this.visible=true | |
38 | + this.$nextTick(()=>{ | |
39 | + this.$refs.realForm.add(); | |
40 | + }) | |
41 | + }, | |
42 | + edit (record) { | |
43 | + this.visible=true | |
44 | + this.$nextTick(()=>{ | |
45 | + this.$refs.realForm.edit(record); | |
46 | + }); | |
47 | + }, | |
48 | + close () { | |
49 | + this.$emit('close'); | |
50 | + this.visible = false; | |
51 | + }, | |
52 | + submitCallback(){ | |
53 | + this.$emit('ok'); | |
54 | + this.visible = false; | |
55 | + }, | |
56 | + handleOk () { | |
57 | + this.$refs.realForm.submitForm(); | |
58 | + }, | |
59 | + handleCancel () { | |
60 | + this.close() | |
61 | + } | |
62 | + } | |
63 | + } | |
64 | +</script> | |
65 | + | |
66 | +<style lang="less" scoped> | |
67 | +/** Button按钮间距 */ | |
68 | + .ant-btn { | |
69 | + margin-left: 30px; | |
70 | + margin-bottom: 30px; | |
71 | + float: right; | |
72 | + } | |
73 | + .drawer-footer{ | |
74 | + position: absolute; | |
75 | + bottom: -8px; | |
76 | + width: 100%; | |
77 | + border-top: 1px solid #e8e8e8; | |
78 | + padding: 10px 16px; | |
79 | + text-align: right; | |
80 | + left: 0; | |
81 | + background: #fff; | |
82 | + border-radius: 0 0 2px 2px; | |
83 | + } | |
84 | +</style> | |
0 | 85 | \ No newline at end of file |
... | ... |
jeecg-boot-master/ant-design-vue-jeecg/src/views/system/config/modules/SysUserWarehouseModal.vue
0 → 100644
1 | +<template> | |
2 | + <j-modal | |
3 | + :title="title" | |
4 | + :width="width" | |
5 | + :visible="visible" | |
6 | + switchFullscreen | |
7 | + @ok="handleOk" | |
8 | + :okButtonProps="{ class:{'jee-hidden': disableSubmit} }" | |
9 | + @cancel="handleCancel" | |
10 | + cancelText="关闭"> | |
11 | + <sys-user-warehouse-form ref="realForm" @ok="submitCallback" :disabled="disableSubmit"></sys-user-warehouse-form> | |
12 | + </j-modal> | |
13 | +</template> | |
14 | + | |
15 | +<script> | |
16 | + | |
17 | + import SysUserWarehouseForm from './SysUserWarehouseForm' | |
18 | + export default { | |
19 | + name: 'SysUserWarehouseModal', | |
20 | + components: { | |
21 | + SysUserWarehouseForm | |
22 | + }, | |
23 | + data () { | |
24 | + return { | |
25 | + title:'', | |
26 | + width:800, | |
27 | + visible: false, | |
28 | + disableSubmit: false | |
29 | + } | |
30 | + }, | |
31 | + methods: { | |
32 | + add () { | |
33 | + this.visible=true | |
34 | + this.$nextTick(()=>{ | |
35 | + this.$refs.realForm.add(); | |
36 | + }) | |
37 | + }, | |
38 | + edit (record) { | |
39 | + this.visible=true | |
40 | + this.$nextTick(()=>{ | |
41 | + this.$refs.realForm.edit(record); | |
42 | + }) | |
43 | + }, | |
44 | + close () { | |
45 | + this.$emit('close'); | |
46 | + this.visible = false; | |
47 | + }, | |
48 | + handleOk () { | |
49 | + this.$refs.realForm.submitForm(); | |
50 | + }, | |
51 | + submitCallback(){ | |
52 | + this.$emit('ok'); | |
53 | + this.visible = false; | |
54 | + }, | |
55 | + handleCancel () { | |
56 | + this.close() | |
57 | + } | |
58 | + } | |
59 | + } | |
60 | +</script> | |
0 | 61 | \ No newline at end of file |
... | ... |
jeecg-boot-master/ant-design-vue-jeecg/src/views/user/LoginAccount.vue
... | ... | @@ -12,17 +12,16 @@ |
12 | 12 | </a-input> |
13 | 13 | </a-form-model-item> |
14 | 14 | |
15 | - <a-form-item> | |
15 | + <a-form-model-item required prop="warehouseCode"> | |
16 | 16 | <a-select |
17 | 17 | show-search |
18 | - prop="warehouseCode" | |
19 | - v-model="model.warehouseCode" | |
20 | 18 | placeholder="请选择仓库" |
21 | 19 | option-filter-prop="children" |
20 | + v-model="model.warehouseCode" | |
22 | 21 | > |
23 | 22 | <a-select-option v-for="item in warehouseList" :key="item.name" :value="item.code">{{ item.name }}</a-select-option> |
24 | 23 | </a-select> |
25 | - </a-form-item> | |
24 | + </a-form-model-item> | |
26 | 25 | |
27 | 26 | <!-- <a-row :gutter="0">--> |
28 | 27 | <!-- <a-col :span="16">--> |
... | ... | @@ -71,7 +70,7 @@ |
71 | 70 | password: [{ |
72 | 71 | required: true, message: '请输入密码!', validator: 'click' |
73 | 72 | }], |
74 | - warehouseCode: [{ required: true, message: '请选择职级' }] , | |
73 | + warehouseCode: [{ required: true, message: '请选择仓库' , validator: 'click'}] , | |
75 | 74 | // inputCode: [{ |
76 | 75 | // required: true, message: '请输入验证码!' |
77 | 76 | // }] |
... | ... |
jeecg-boot-master/jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/system/util/JwtUtil.java
... | ... | @@ -94,6 +94,36 @@ public class JwtUtil { |
94 | 94 | } |
95 | 95 | |
96 | 96 | /** |
97 | + * 获得token中的信息无需secret解密也能获得 | |
98 | + * | |
99 | + * @return token中包含的用户名 | |
100 | + */ | |
101 | + public static String getWarehouseCode(String token) { | |
102 | + try { | |
103 | + DecodedJWT jwt = JWT.decode(token); | |
104 | + return jwt.getClaim("warehouseCode").asString(); | |
105 | + } catch (JWTDecodeException e) { | |
106 | + return null; | |
107 | + } | |
108 | + } | |
109 | + | |
110 | + /** | |
111 | + * 生成签名,5min后过期 | |
112 | + * | |
113 | + * @param username 用户名 | |
114 | + * @param secret 用户的密码 | |
115 | + * @param warehouseCode 登录仓库 | |
116 | + * @return 加密的token | |
117 | + */ | |
118 | + public static String sign(String username, String secret, String warehouseCode) { | |
119 | + Date date = new Date(System.currentTimeMillis() + EXPIRE_TIME); | |
120 | + Algorithm algorithm = Algorithm.HMAC256(secret); | |
121 | + // 附带username信息 | |
122 | + return JWT.create().withClaim("username", username).withClaim("warehouseCode", warehouseCode) | |
123 | + .withExpiresAt(date).sign(algorithm); | |
124 | + } | |
125 | + | |
126 | + /** | |
97 | 127 | * 生成签名,5min后过期 |
98 | 128 | * |
99 | 129 | * @param username 用户名 |
... | ... | @@ -105,7 +135,6 @@ public class JwtUtil { |
105 | 135 | Algorithm algorithm = Algorithm.HMAC256(secret); |
106 | 136 | // 附带username信息 |
107 | 137 | return JWT.create().withClaim("username", username).withExpiresAt(date).sign(algorithm); |
108 | - | |
109 | 138 | } |
110 | 139 | |
111 | 140 | /** |
... | ... | @@ -125,6 +154,22 @@ public class JwtUtil { |
125 | 154 | } |
126 | 155 | |
127 | 156 | /** |
157 | + * 根据request中的token获取用户账号 | |
158 | + * | |
159 | + * @param request | |
160 | + * @return | |
161 | + * @throws JeecgBootException | |
162 | + */ | |
163 | + public static String getWarehouseCodeByToken(HttpServletRequest request) throws JeecgBootException { | |
164 | + String accessToken = request.getHeader("X-Access-Token"); | |
165 | + String warehouseCode = getWarehouseCode(accessToken); | |
166 | + if (oConvertUtils.isEmpty(warehouseCode)) { | |
167 | + throw new JeecgBootException("未获取到仓库编码"); | |
168 | + } | |
169 | + return warehouseCode; | |
170 | + } | |
171 | + | |
172 | + /** | |
128 | 173 | * 从session中获取变量 |
129 | 174 | * @param key |
130 | 175 | * @return |
... | ... |
jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/controller/LoginController.java
... | ... | @@ -108,8 +108,13 @@ public class LoginController { |
108 | 108 | return result; |
109 | 109 | } |
110 | 110 | |
111 | + if(StringUtils.isEmpty(warehouseCode)) { | |
112 | + result.error500("仓库编码错误"); | |
113 | + return result; | |
114 | + } | |
115 | + | |
111 | 116 | //用户登录信息 |
112 | - userInfo(sysUser, result); | |
117 | + userInfo(sysUser, result, warehouseCode); | |
113 | 118 | //update-begin--Author:liusq Date:20210126 for:登录成功,删除redis中的验证码 |
114 | 119 | // redisUtil.del(realKey); |
115 | 120 | //update-begin--Author:liusq Date:20210126 for:登录成功,删除redis中的验证码 |
... | ... | @@ -127,14 +132,16 @@ public class LoginController { |
127 | 132 | @GetMapping("/user/getUserInfo") |
128 | 133 | public Result<JSONObject> getUserInfo(HttpServletRequest request){ |
129 | 134 | Result<JSONObject> result = new Result<JSONObject>(); |
130 | - String username = JwtUtil.getUserNameByToken(request); | |
135 | + String username = JwtUtil.getUserNameByToken(request); | |
136 | + String warehouseCode = JwtUtil.getWarehouseCodeByToken(request); | |
131 | 137 | if(oConvertUtils.isNotEmpty(username)) { |
132 | 138 | // 根据用户名查询用户信息 |
133 | 139 | SysUser sysUser = sysUserService.getUserByName(username); |
134 | 140 | //用户登录信息 |
135 | - Result<JSONObject> resultObj=userInfo(sysUser, result); | |
141 | + Result<JSONObject> resultObj=userInfo(sysUser, result, warehouseCode); | |
136 | 142 | JSONObject jsonObject=resultObj.getResult(); |
137 | 143 | JSONObject obj=new JSONObject(); |
144 | + obj.put("warehouseCode", warehouseCode); | |
138 | 145 | obj.put("userInfo",jsonObject.get("userInfo")); |
139 | 146 | obj.put("sysAllDictItems", sysDictService.queryAllDictItems()); |
140 | 147 | result.setResult(obj); |
... | ... | @@ -363,8 +370,13 @@ public class LoginController { |
363 | 370 | result.setMessage("手机验证码错误"); |
364 | 371 | return result; |
365 | 372 | } |
373 | + | |
374 | + String warehouseCode = jsonObject.getString("warehouseCode"); | |
375 | + if(StringUtils.isEmpty(warehouseCode)) { | |
376 | + return Result.error("仓库编码为空"); | |
377 | + } | |
366 | 378 | //用户信息 |
367 | - userInfo(sysUser, result); | |
379 | + userInfo(sysUser, result, warehouseCode); | |
368 | 380 | //添加日志 |
369 | 381 | baseCommonService.addLog("用户名: " + sysUser.getUsername() + ",登录成功!", CommonConstant.LOG_TYPE_1, null); |
370 | 382 | |
... | ... | @@ -377,9 +389,10 @@ public class LoginController { |
377 | 389 | * |
378 | 390 | * @param sysUser |
379 | 391 | * @param result |
392 | + * @param warehouseCode | |
380 | 393 | * @return |
381 | 394 | */ |
382 | - private Result<JSONObject> userInfo(SysUser sysUser, Result<JSONObject> result) { | |
395 | + private Result<JSONObject> userInfo(SysUser sysUser, Result<JSONObject> result, String warehouseCode) { | |
383 | 396 | String syspassword = sysUser.getPassword(); |
384 | 397 | String username = sysUser.getUsername(); |
385 | 398 | // 获取用户部门信息 |
... | ... | @@ -419,7 +432,7 @@ public class LoginController { |
419 | 432 | } |
420 | 433 | // update-end--Author:sunjianlei Date:20210802 for:获取用户租户信息 |
421 | 434 | // 生成token |
422 | - String token = JwtUtil.sign(username, syspassword); | |
435 | + String token = JwtUtil.sign(username, syspassword, warehouseCode); | |
423 | 436 | // 设置token缓存有效时间 |
424 | 437 | redisUtil.set(CommonConstant.PREFIX_USER_TOKEN + token, token); |
425 | 438 | redisUtil.expire(CommonConstant.PREFIX_USER_TOKEN + token, JwtUtil.EXPIRE_TIME * 2 / 1000); |
... | ... |
jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/config/company/controller/CompanyController.java
... | ... | @@ -11,6 +11,7 @@ import javax.servlet.http.HttpServletRequest; |
11 | 11 | import javax.servlet.http.HttpServletResponse; |
12 | 12 | import org.jeecg.common.api.vo.Result; |
13 | 13 | import org.jeecg.common.system.query.QueryGenerator; |
14 | +import org.jeecg.common.system.util.JwtUtil; | |
14 | 15 | import org.jeecg.common.util.oConvertUtils; |
15 | 16 | |
16 | 17 | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
... | ... | @@ -20,6 +21,7 @@ import lombok.extern.slf4j.Slf4j; |
20 | 21 | |
21 | 22 | import org.jeecg.modules.wms.config.company.entity.Company; |
22 | 23 | import org.jeecg.modules.wms.config.company.service.ICompanyService; |
24 | +import org.jeecg.utils.StringUtils; | |
23 | 25 | import org.jeecgframework.poi.excel.ExcelImportUtil; |
24 | 26 | import org.jeecgframework.poi.excel.def.NormalExcelConstants; |
25 | 27 | import org.jeecgframework.poi.excel.entity.ExportParams; |
... | ... | @@ -81,7 +83,11 @@ public class CompanyController extends JeecgController<Company, ICompanyService> |
81 | 83 | @AutoLog(value = "货主-添加") |
82 | 84 | @ApiOperation(value="货主-添加", notes="货主-添加") |
83 | 85 | @PostMapping(value = "/add") |
84 | - public Result<String> add(@RequestBody Company company) { | |
86 | + public Result<String> add(@RequestBody Company company, HttpServletRequest req) { | |
87 | + String warehouseCode = JwtUtil.getWarehouseCodeByToken(req); | |
88 | + if(StringUtils.isNotEmpty(warehouseCode)) { | |
89 | + company.setWarehouseCode(warehouseCode); | |
90 | + } | |
85 | 91 | companyService.save(company); |
86 | 92 | return Result.OK("添加成功!"); |
87 | 93 | } |
... | ... |
jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/config/company/entity/Company.java
... | ... | @@ -46,7 +46,7 @@ public class Company implements Serializable { |
46 | 46 | /**仓库代码*/ |
47 | 47 | @Excel(name = "仓库代码", width = 15) |
48 | 48 | @ApiModelProperty(value = "仓库代码") |
49 | - private String warehousecode; | |
49 | + private String warehouseCode; | |
50 | 50 | /**地址*/ |
51 | 51 | @Excel(name = "地址", width = 15) |
52 | 52 | @ApiModelProperty(value = "地址") |
... | ... |
jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/config/material/controller/MaterialController.java
... | ... | @@ -11,6 +11,7 @@ import javax.servlet.http.HttpServletRequest; |
11 | 11 | import javax.servlet.http.HttpServletResponse; |
12 | 12 | import org.jeecg.common.api.vo.Result; |
13 | 13 | import org.jeecg.common.system.query.QueryGenerator; |
14 | +import org.jeecg.common.system.util.JwtUtil; | |
14 | 15 | import org.jeecg.common.util.oConvertUtils; |
15 | 16 | |
16 | 17 | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
... | ... | @@ -20,6 +21,7 @@ import lombok.extern.slf4j.Slf4j; |
20 | 21 | |
21 | 22 | import org.jeecg.modules.wms.config.material.entity.Material; |
22 | 23 | import org.jeecg.modules.wms.config.material.service.IMaterialService; |
24 | +import org.jeecg.utils.StringUtils; | |
23 | 25 | import org.jeecgframework.poi.excel.ExcelImportUtil; |
24 | 26 | import org.jeecgframework.poi.excel.def.NormalExcelConstants; |
25 | 27 | import org.jeecgframework.poi.excel.entity.ExportParams; |
... | ... | @@ -66,6 +68,8 @@ public class MaterialController extends JeecgController<Material, IMaterialServi |
66 | 68 | @RequestParam(name="pageNo", defaultValue="1") Integer pageNo, |
67 | 69 | @RequestParam(name="pageSize", defaultValue="10") Integer pageSize, |
68 | 70 | HttpServletRequest req) { |
71 | + String username = JwtUtil.getUserNameByToken(req); | |
72 | + String warehouseCode = JwtUtil.getWarehouseCodeByToken(req); | |
69 | 73 | QueryWrapper<Material> queryWrapper = QueryGenerator.initQueryWrapper(material, req.getParameterMap()); |
70 | 74 | Page<Material> page = new Page<Material>(pageNo, pageSize); |
71 | 75 | IPage<Material> pageList = materialService.page(page, queryWrapper); |
... | ... | @@ -81,7 +85,11 @@ public class MaterialController extends JeecgController<Material, IMaterialServi |
81 | 85 | @AutoLog(value = "物料管理-添加") |
82 | 86 | @ApiOperation(value="物料管理-添加", notes="物料管理-添加") |
83 | 87 | @PostMapping(value = "/add") |
84 | - public Result<String> add(@RequestBody Material material) { | |
88 | + public Result<String> add(@RequestBody Material material, HttpServletRequest req) { | |
89 | + String warehouseCode = JwtUtil.getWarehouseCodeByToken(req); | |
90 | + if(StringUtils.isNotEmpty(warehouseCode)) { | |
91 | + material.setWarehousecode(warehouseCode); | |
92 | + } | |
85 | 93 | materialService.save(material); |
86 | 94 | return Result.OK("添加成功!"); |
87 | 95 | } |
... | ... |
jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/config/sysUserWarehouse/controller/SysUserWarehouseController.java
0 → 100644
1 | +package org.jeecg.modules.wms.config.sysUserWarehouse.controller; | |
2 | + | |
3 | +import java.util.Arrays; | |
4 | +import java.util.List; | |
5 | +import java.util.Map; | |
6 | +import java.util.stream.Collectors; | |
7 | +import java.io.IOException; | |
8 | +import java.io.UnsupportedEncodingException; | |
9 | +import java.net.URLDecoder; | |
10 | +import javax.servlet.http.HttpServletRequest; | |
11 | +import javax.servlet.http.HttpServletResponse; | |
12 | +import org.jeecg.common.api.vo.Result; | |
13 | +import org.jeecg.common.system.query.QueryGenerator; | |
14 | +import org.jeecg.common.util.oConvertUtils; | |
15 | + | |
16 | + | |
17 | +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | |
18 | +import com.baomidou.mybatisplus.core.metadata.IPage; | |
19 | +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | |
20 | +import lombok.extern.slf4j.Slf4j; | |
21 | + | |
22 | +import org.jeecg.modules.wms.config.sysUserWarehouse.entity.SysUserWarehouse; | |
23 | +import org.jeecg.modules.wms.config.sysUserWarehouse.service.ISysUserWarehouseService; | |
24 | +import org.jeecgframework.poi.excel.ExcelImportUtil; | |
25 | +import org.jeecgframework.poi.excel.def.NormalExcelConstants; | |
26 | +import org.jeecgframework.poi.excel.entity.ExportParams; | |
27 | +import org.jeecgframework.poi.excel.entity.ImportParams; | |
28 | +import org.jeecgframework.poi.excel.view.JeecgEntityExcelView; | |
29 | +import org.jeecg.common.system.base.controller.JeecgController; | |
30 | +import org.springframework.beans.factory.annotation.Autowired; | |
31 | +import org.springframework.web.bind.annotation.*; | |
32 | +import org.springframework.web.multipart.MultipartFile; | |
33 | +import org.springframework.web.multipart.MultipartHttpServletRequest; | |
34 | +import org.springframework.web.servlet.ModelAndView; | |
35 | +import com.alibaba.fastjson.JSON; | |
36 | +import io.swagger.annotations.Api; | |
37 | +import io.swagger.annotations.ApiOperation; | |
38 | +import org.jeecg.common.aspect.annotation.AutoLog; | |
39 | + | |
40 | + /** | |
41 | + * @Description: 用户仓库关系表 | |
42 | + * @Author: jeecg-boot | |
43 | + * @Date: 2022-10-21 | |
44 | + * @Version: V1.0 | |
45 | + */ | |
46 | +@Api(tags="用户仓库关系表") | |
47 | +@RestController | |
48 | +@RequestMapping("/config/sysUserWarehouse") | |
49 | +@Slf4j | |
50 | +public class SysUserWarehouseController extends JeecgController<SysUserWarehouse, ISysUserWarehouseService> { | |
51 | + @Autowired | |
52 | + private ISysUserWarehouseService sysUserWarehouseService; | |
53 | + | |
54 | + /** | |
55 | + * 分页列表查询 | |
56 | + * | |
57 | + * @param sysUserWarehouse | |
58 | + * @param pageNo | |
59 | + * @param pageSize | |
60 | + * @param req | |
61 | + * @return | |
62 | + */ | |
63 | + //@AutoLog(value = "用户仓库关系表-分页列表查询") | |
64 | + @ApiOperation(value="用户仓库关系表-分页列表查询", notes="用户仓库关系表-分页列表查询") | |
65 | + @GetMapping(value = "/list") | |
66 | + public Result<IPage<SysUserWarehouse>> queryPageList(SysUserWarehouse sysUserWarehouse, | |
67 | + @RequestParam(name="pageNo", defaultValue="1") Integer pageNo, | |
68 | + @RequestParam(name="pageSize", defaultValue="10") Integer pageSize, | |
69 | + HttpServletRequest req) { | |
70 | + QueryWrapper<SysUserWarehouse> queryWrapper = QueryGenerator.initQueryWrapper(sysUserWarehouse, req.getParameterMap()); | |
71 | + Page<SysUserWarehouse> page = new Page<SysUserWarehouse>(pageNo, pageSize); | |
72 | + IPage<SysUserWarehouse> pageList = sysUserWarehouseService.page(page, queryWrapper); | |
73 | + return Result.OK(pageList); | |
74 | + } | |
75 | + | |
76 | + /** | |
77 | + * 添加 | |
78 | + * | |
79 | + * @param sysUserWarehouse | |
80 | + * @return | |
81 | + */ | |
82 | + @AutoLog(value = "用户仓库关系表-添加") | |
83 | + @ApiOperation(value="用户仓库关系表-添加", notes="用户仓库关系表-添加") | |
84 | + @PostMapping(value = "/add") | |
85 | + public Result<String> add(@RequestBody SysUserWarehouse sysUserWarehouse) { | |
86 | + sysUserWarehouseService.save(sysUserWarehouse); | |
87 | + return Result.OK("添加成功!"); | |
88 | + } | |
89 | + | |
90 | + /** | |
91 | + * 编辑 | |
92 | + * | |
93 | + * @param sysUserWarehouse | |
94 | + * @return | |
95 | + */ | |
96 | + @AutoLog(value = "用户仓库关系表-编辑") | |
97 | + @ApiOperation(value="用户仓库关系表-编辑", notes="用户仓库关系表-编辑") | |
98 | + @RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST}) | |
99 | + public Result<String> edit(@RequestBody SysUserWarehouse sysUserWarehouse) { | |
100 | + sysUserWarehouseService.updateById(sysUserWarehouse); | |
101 | + return Result.OK("编辑成功!"); | |
102 | + } | |
103 | + | |
104 | + /** | |
105 | + * 通过id删除 | |
106 | + * | |
107 | + * @param id | |
108 | + * @return | |
109 | + */ | |
110 | + @AutoLog(value = "用户仓库关系表-通过id删除") | |
111 | + @ApiOperation(value="用户仓库关系表-通过id删除", notes="用户仓库关系表-通过id删除") | |
112 | + @DeleteMapping(value = "/delete") | |
113 | + public Result<String> delete(@RequestParam(name="id",required=true) String id) { | |
114 | + sysUserWarehouseService.removeById(id); | |
115 | + return Result.OK("删除成功!"); | |
116 | + } | |
117 | + | |
118 | + /** | |
119 | + * 批量删除 | |
120 | + * | |
121 | + * @param ids | |
122 | + * @return | |
123 | + */ | |
124 | + @AutoLog(value = "用户仓库关系表-批量删除") | |
125 | + @ApiOperation(value="用户仓库关系表-批量删除", notes="用户仓库关系表-批量删除") | |
126 | + @DeleteMapping(value = "/deleteBatch") | |
127 | + public Result<String> deleteBatch(@RequestParam(name="ids",required=true) String ids) { | |
128 | + this.sysUserWarehouseService.removeByIds(Arrays.asList(ids.split(","))); | |
129 | + return Result.OK("批量删除成功!"); | |
130 | + } | |
131 | + | |
132 | + /** | |
133 | + * 通过id查询 | |
134 | + * | |
135 | + * @param id | |
136 | + * @return | |
137 | + */ | |
138 | + //@AutoLog(value = "用户仓库关系表-通过id查询") | |
139 | + @ApiOperation(value="用户仓库关系表-通过id查询", notes="用户仓库关系表-通过id查询") | |
140 | + @GetMapping(value = "/queryById") | |
141 | + public Result<SysUserWarehouse> queryById(@RequestParam(name="id",required=true) String id) { | |
142 | + SysUserWarehouse sysUserWarehouse = sysUserWarehouseService.getById(id); | |
143 | + if(sysUserWarehouse==null) { | |
144 | + return Result.error("未找到对应数据"); | |
145 | + } | |
146 | + return Result.OK(sysUserWarehouse); | |
147 | + } | |
148 | + | |
149 | + /** | |
150 | + * 导出excel | |
151 | + * | |
152 | + * @param request | |
153 | + * @param sysUserWarehouse | |
154 | + */ | |
155 | + @RequestMapping(value = "/exportXls") | |
156 | + public ModelAndView exportXls(HttpServletRequest request, SysUserWarehouse sysUserWarehouse) { | |
157 | + return super.exportXls(request, sysUserWarehouse, SysUserWarehouse.class, "用户仓库关系表"); | |
158 | + } | |
159 | + | |
160 | + /** | |
161 | + * 通过excel导入数据 | |
162 | + * | |
163 | + * @param request | |
164 | + * @param response | |
165 | + * @return | |
166 | + */ | |
167 | + @RequestMapping(value = "/importExcel", method = RequestMethod.POST) | |
168 | + public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) { | |
169 | + return super.importExcel(request, response, SysUserWarehouse.class); | |
170 | + } | |
171 | + | |
172 | +} | |
... | ... |
jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/config/sysUserWarehouse/entity/SysUserWarehouse.java
0 → 100644
1 | +package org.jeecg.modules.wms.config.sysUserWarehouse.entity; | |
2 | + | |
3 | +import com.baomidou.mybatisplus.annotation.IdType; | |
4 | +import com.baomidou.mybatisplus.annotation.TableId; | |
5 | +import com.baomidou.mybatisplus.annotation.TableName; | |
6 | +import io.swagger.annotations.ApiModel; | |
7 | +import io.swagger.annotations.ApiModelProperty; | |
8 | +import lombok.Data; | |
9 | +import lombok.EqualsAndHashCode; | |
10 | +import lombok.experimental.Accessors; | |
11 | +import org.jeecgframework.poi.excel.annotation.Excel; | |
12 | + | |
13 | +import java.io.Serializable; | |
14 | +import java.util.Date; | |
15 | + | |
16 | +/** | |
17 | + * @Description: 用户仓库关系表 | |
18 | + * @Author: jeecg-boot | |
19 | + * @Date: 2022-10-21 | |
20 | + * @Version: V1.0 | |
21 | + */ | |
22 | +@Data | |
23 | +@TableName("sys_user_warehouse") | |
24 | +@Accessors(chain = true) | |
25 | +@EqualsAndHashCode(callSuper = false) | |
26 | +@ApiModel(value="sys_user_warehouse对象", description="用户仓库关系表") | |
27 | +public class SysUserWarehouse implements Serializable { | |
28 | + private static final long serialVersionUID = 1L; | |
29 | + | |
30 | + /**主键*/ | |
31 | + @TableId(type = IdType.ASSIGN_ID) | |
32 | + @ApiModelProperty(value = "主键") | |
33 | + private String id; | |
34 | + /**用户名称*/ | |
35 | + @Excel(name = "用户名称", width = 15) | |
36 | + @ApiModelProperty(value = "用户名称") | |
37 | + private String username; | |
38 | + /**用户表ID*/ | |
39 | + @Excel(name = "用户表ID", width = 15) | |
40 | + @ApiModelProperty(value = "用户表ID") | |
41 | + private Integer userid; | |
42 | + /**仓库编码*/ | |
43 | + @Excel(name = "仓库编码", width = 15) | |
44 | + @ApiModelProperty(value = "仓库编码") | |
45 | + private String warehousecode; | |
46 | + /**创建人*/ | |
47 | + @ApiModelProperty(value = "创建人") | |
48 | + private String createBy; | |
49 | + /**创建日期*/ | |
50 | + @ApiModelProperty(value = "创建日期") | |
51 | + private Date createTime; | |
52 | + /**更新人*/ | |
53 | + @ApiModelProperty(value = "更新人") | |
54 | + private String updateBy; | |
55 | + /**更新日期*/ | |
56 | + @ApiModelProperty(value = "更新日期") | |
57 | + private Date updateTime; | |
58 | +} | |
... | ... |
jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/config/sysUserWarehouse/mapper/SysUserWarehouseMapper.java
0 → 100644
1 | +package org.jeecg.modules.wms.config.sysUserWarehouse.mapper; | |
2 | + | |
3 | +import java.util.List; | |
4 | + | |
5 | +import org.apache.ibatis.annotations.Param; | |
6 | +import com.baomidou.mybatisplus.core.mapper.BaseMapper; | |
7 | +import org.jeecg.modules.wms.config.sysUserWarehouse.entity.SysUserWarehouse; | |
8 | + | |
9 | +/** | |
10 | + * @Description: 用户仓库关系表 | |
11 | + * @Author: jeecg-boot | |
12 | + * @Date: 2022-10-21 | |
13 | + * @Version: V1.0 | |
14 | + */ | |
15 | +public interface SysUserWarehouseMapper extends BaseMapper<SysUserWarehouse> { | |
16 | + | |
17 | +} | |
... | ... |
jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/config/sysUserWarehouse/mapper/xml/SysUserWarehouseMapper.xml
0 → 100644
jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/config/sysUserWarehouse/service/ISysUserWarehouseService.java
0 → 100644
1 | +package org.jeecg.modules.wms.config.sysUserWarehouse.service; | |
2 | + | |
3 | +import com.baomidou.mybatisplus.extension.service.IService; | |
4 | +import org.jeecg.modules.wms.config.sysUserWarehouse.entity.SysUserWarehouse; | |
5 | + | |
6 | +/** | |
7 | + * @Description: 用户仓库关系表 | |
8 | + * @Author: jeecg-boot | |
9 | + * @Date: 2022-10-21 | |
10 | + * @Version: V1.0 | |
11 | + */ | |
12 | +public interface ISysUserWarehouseService extends IService<SysUserWarehouse> { | |
13 | + | |
14 | + String getWarehouseCodeByName(String username); | |
15 | +} | |
... | ... |
jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/wms/config/sysUserWarehouse/service/impl/SysUserWarehouseServiceImpl.java
0 → 100644
1 | +package org.jeecg.modules.wms.config.sysUserWarehouse.service.impl; | |
2 | + | |
3 | +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | |
4 | +import com.baomidou.mybatisplus.core.toolkit.Wrappers; | |
5 | +import org.jeecg.modules.wms.config.sysUserWarehouse.entity.SysUserWarehouse; | |
6 | +import org.jeecg.modules.wms.config.sysUserWarehouse.mapper.SysUserWarehouseMapper; | |
7 | +import org.jeecg.modules.wms.config.sysUserWarehouse.service.ISysUserWarehouseService; | |
8 | +import org.jeecg.utils.StringUtils; | |
9 | +import org.springframework.stereotype.Service; | |
10 | + | |
11 | +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | |
12 | + | |
13 | +import java.sql.Wrapper; | |
14 | + | |
15 | +/** | |
16 | + * @Description: 用户仓库关系表 | |
17 | + * @Author: jeecg-boot | |
18 | + * @Date: 2022-10-21 | |
19 | + * @Version: V1.0 | |
20 | + */ | |
21 | +@Service | |
22 | +public class SysUserWarehouseServiceImpl extends ServiceImpl<SysUserWarehouseMapper, SysUserWarehouse> implements ISysUserWarehouseService { | |
23 | + | |
24 | + @Override | |
25 | + public String getWarehouseCodeByName(String username) { | |
26 | + if(StringUtils.isEmpty(username)) { | |
27 | + return null; | |
28 | + } | |
29 | + LambdaQueryWrapper<SysUserWarehouse> warehouseLambdaQueryWrapper = Wrappers.lambdaQuery(); | |
30 | + warehouseLambdaQueryWrapper.eq(SysUserWarehouse::getUsername, username); | |
31 | + SysUserWarehouse sysUserWarehouse = this.getOne(warehouseLambdaQueryWrapper); | |
32 | + if(sysUserWarehouse == null) { | |
33 | + return null; | |
34 | + } | |
35 | + String warehouseCode = sysUserWarehouse.getWarehousecode(); | |
36 | + return warehouseCode; | |
37 | + } | |
38 | +} | |
... | ... |