【升级】新增用户组选择器,优化其他选择器、升级前端依赖、新增后端sys支持对其他模块的api接口

master
俞宝山 2025-01-12 17:44:10 +08:00
parent fb41f62944
commit a04edce750
18 changed files with 704 additions and 10 deletions

View File

@ -27,7 +27,7 @@
"@vue-office/docx": "1.6.2", "@vue-office/docx": "1.6.2",
"@vue-office/excel": "1.7.11", "@vue-office/excel": "1.7.11",
"@vue-office/pdf": "2.0.2", "@vue-office/pdf": "2.0.2",
"ant-design-vue": "4.2.5", "ant-design-vue": "4.2.6",
"axios": "1.7.7", "axios": "1.7.7",
"cropperjs": "1.6.2", "cropperjs": "1.6.2",
"dayjs": "1.11.13", "dayjs": "1.11.13",
@ -48,7 +48,7 @@
"snowflake-id": "1.1.0", "snowflake-id": "1.1.0",
"sortablejs": "1.15.3", "sortablejs": "1.15.3",
"tinymce": "7.3.0", "tinymce": "7.3.0",
"vue": "3.5.10", "vue": "3.5.13",
"vue-cropper": "1.1.4", "vue-cropper": "1.1.4",
"vue-i18n": "10.0.0", "vue-i18n": "10.0.0",
"vue-router": "4.4.5", "vue-router": "4.4.5",
@ -57,7 +57,7 @@
"vuedraggable-es": "4.1.1" "vuedraggable-es": "4.1.1"
}, },
"devDependencies": { "devDependencies": {
"@babel/eslint-parser": "7.19.1", "@babel/eslint-parser": "7.25.9",
"@vitejs/plugin-legacy": "6.0.0", "@vitejs/plugin-legacy": "6.0.0",
"@vitejs/plugin-vue": "5.2.1", "@vitejs/plugin-vue": "5.2.1",
"@vitejs/plugin-vue-jsx": "4.1.1", "@vitejs/plugin-vue-jsx": "4.1.1",
@ -65,10 +65,10 @@
"@vue/eslint-config-standard": "8.0.1", "@vue/eslint-config-standard": "8.0.1",
"antd-less-to-css-variable": "1.0.5", "antd-less-to-css-variable": "1.0.5",
"autoprefixer": "10.4.20", "autoprefixer": "10.4.20",
"eslint": "8.57.0", "eslint": "8.57.1",
"eslint-config-prettier": "9.1.0", "eslint-config-prettier": "9.1.0",
"eslint-plugin-prettier": "5.0.1", "eslint-plugin-prettier": "5.2.1",
"eslint-plugin-vue": "9.7.0", "eslint-plugin-vue": "9.32.0",
"less": "4.2.0", "less": "4.2.0",
"postcss": "8.4.47", "postcss": "8.4.47",
"prettier": "3.3.3", "prettier": "3.3.3",

View File

@ -98,6 +98,10 @@ export default {
userCenterGetRoleListByIdList(data) { userCenterGetRoleListByIdList(data) {
return request('getRoleListByIdList', data) return request('getRoleListByIdList', data)
}, },
// 根据id集合获取用户组集合
userCenterGetGroupListByIdList(data) {
return request('getGroupListByIdList', data)
},
// 根据id获取头像 // 根据id获取头像
userCenterGtAvatarById(data) { userCenterGtAvatarById(data) {
return request('getAvatarById', data) return request('getAvatarById', data)

View File

@ -0,0 +1,486 @@
<template>
<div v-if="props.show">
<a-tag v-for="data in dataArray" closable @close="deleteObj(data)" :key="data.id" class="mb-1">
{{ data.name }}
</a-tag>
<a-button
type="primary"
size="small"
@click="openModal"
v-if="(props.radioModel ? dataArray.length !== 1 : true) && addShow"
>
<slot name="button"></slot>
<span v-if="!hasContent('button')">
<plus-outlined />
选择
</span>
</a-button>
</div>
<a-modal
v-model:open="visible"
title="用户组选择"
:width="700"
:mask-closable="false"
:destroy-on-close="true"
@ok="handleOk"
@cancel="handleClose"
>
<a-row :gutter="10">
<a-col :span="14">
<div class="table-operator xn-mb10">
<a-form ref="searchFormRef" name="advanced_search" class="ant-advanced-search-form" :model="searchFormState">
<a-row :gutter="24">
<a-col :span="12">
<a-form-item name="searchKey">
<a-input v-model:value="searchFormState.searchKey" placeholder="请输入名称" />
</a-form-item>
</a-col>
<a-col :span="12">
<a-button type="primary" class="xn-mr-10" @click="loadData()"> </a-button>
<a-button @click="reset()"> </a-button>
</a-col>
</a-row>
</a-form>
</div>
<div class="selector-table">
<a-table size="small" :columns="commons" bordered :data-source="tableData" :loading="pageLoading">
<template #title>
<span>待选择列表 {{ tableRecordNum }} </span>
<div v-if="!radioModel" class="xn-fdr">
<a-button type="dashed" size="small" @click="addAllPageRecord"></a-button>
</div>
</template>
<template #bodyCell="{ column, record }">
<template v-if="column.dataIndex === 'action'">
<a-button type="dashed" size="small" @click="addRecord(record)"><PlusOutlined /></a-button>
</template>
</template>
</a-table>
</div>
</a-col>
<a-col :span="10">
<div class="selector-table">
<a-table
ref="selectedTable"
size="small"
:columns="selectedCommons"
:data-source="selectedData"
:expand-row-by-click="true"
:loading="selectedTableListLoading"
bordered
>
<template #title>
<span>已选择: {{ selectedData.length }}</span>
<div v-if="!radioModel" class="xn-fdr">
<a-button type="dashed" danger size="small" @click="delAllRecord"></a-button>
</div>
</template>
<template #bodyCell="{ column, record }">
<template v-if="column.dataIndex === 'action'">
<a-button type="dashed" danger size="small" @click="delRecord(record)"><MinusOutlined /></a-button>
</template>
</template>
</a-table>
</div>
</a-col>
</a-row>
</a-modal>
</template>
<script setup name="groupSelector">
import { message } from 'ant-design-vue'
import { remove, isEmpty, cloneDeep } from 'lodash-es'
import { useSlots } from 'vue'
import userCenterApi from '@/api/sys/userCenterApi'
const dataArray = ref([])
const visible = ref(false)
const tableData = ref([])
const searchFormState = ref({})
const searchFormRef = ref()
const selectedTable = ref()
const selectedData = ref([])
const recordIds = ref([])
const selectedTableListLoading = ref(false)
const tableRecordNum = ref()
const pageLoading = ref(false)
//
const current = ref(0) //
const pageSize = ref(20) //
const total = ref(0) //
const slots = useSlots()
const hasContent = (slotName) => {
return !!(slots[slotName] && slots[slotName]().length > 0)
}
const props = defineProps({
radioModel: {
type: Boolean,
default: () => false
},
dataIsConverterFlw: {
type: Boolean,
default: () => false
},
selectorConverterKey: {
type: String,
default: () => 'USER_GROUP'
},
dataPageApi: {
type: Function
},
dataDetailByIdListApi: {
type: Function
},
// eslint-disable-next-line vue/require-prop-types
value: {
default: () => []
},
dataType: {
type: String,
default: () => 'array' // stringarray
},
show: {
type: Boolean,
default: () => true
},
addShow: {
type: Boolean,
default: () => true
},
processModelId: {
type: String,
default: () => undefined
}
})
const emit = defineEmits(['update:value', 'onBack', 'onChange'])
const commons = [
{
title: '操作',
dataIndex: 'action',
align: 'center',
width: 50
},
{
title: '名称',
dataIndex: 'name',
ellipsis: true
}
]
// common
const selectedCommons = [
{
title: '操作',
dataIndex: 'action',
align: 'center',
width: 50
},
{
title: '名称',
dataIndex: 'name',
ellipsis: true
}
]
//
const showModel = (ids = []) => {
const data = goDataConverter(ids)
recordIds.value = data
getDataNameById(data)
openModal()
}
//
const deleteObj = (obj) => {
//
remove(dataArray.value, (item) => item.id === obj.id)
//
remove(selectedData.value, (item) => item.id === obj.id)
//
remove(recordIds.value, (item) => item === obj.id)
const value = []
const showData = []
dataArray.value.forEach((item) => {
const obj = {
id: item.id,
name: item.name
}
value.push(item.id)
// obj
const objClone = cloneDeep(obj)
showData.push(objClone)
})
dataArray.value = showData
//
const resultData = outDataConverter(value)
emit('update:value', resultData)
emit('onBack', resultData)
}
// api
const groupPage = (param) => {
if (typeof props.dataPageApi === 'function') {
return props.dataPageApi(param)
} else {
message.warning('未配置选择器API')
return Promise.resolve([])
}
}
// api
const groupListByIdList = (param) => {
if (typeof props.dataDetailByIdListApi === 'function') {
return props.dataDetailByIdListApi(param)
} else {
return userCenterApi.userCenterGetGroupListByIdList(param).then((data) => {
return Promise.resolve(data)
})
}
}
const openModal = () => {
if (typeof props.dataPageApi !== 'function') {
message.warning('未配置选择器需要的dataPageApi接口')
return
}
visible.value = true
searchFormState.value.size = pageSize.value
loadData()
if (isEmpty(recordIds.value)) {
return
}
const param = {
idList: recordIds.value
}
selectedTableListLoading.value = true
groupListByIdList(param)
.then((data) => {
selectedData.value = data
})
.finally(() => {
selectedTableListLoading.value = false
})
}
//
const handleOk = () => {
dataArray.value = []
const value = []
const showData = []
selectedData.value.forEach((item) => {
const obj = {
id: item.id,
name: item.name
}
value.push(item.id)
// obj
const objClone = cloneDeep(obj)
showData.push(objClone)
})
dataArray.value = showData
//
const resultData = outDataConverter(value)
emit('update:value', resultData)
emit('onBack', resultData)
handleClose()
}
const handleClose = () => {
searchFormState.value = {}
tableRecordNum.value = 0
tableData.value = []
current.value = 0
pageSize.value = 20
total.value = 0
visible.value = false
}
const loadData = () => {
pageLoading.value = true
groupPage(searchFormState.value)
.then((data) => {
current.value = data.current
total.value = data.total
//
tableData.value = []
tableRecordNum.value = 0
tableData.value = data.records
if (data.records) {
tableRecordNum.value = data.records.length
} else {
tableRecordNum.value = 0
}
})
.finally(() => {
pageLoading.value = false
})
}
const reset = () => {
delete searchFormState.value.searchKey
loadData()
}
const judge = () => {
return !(props.radioModel && selectedData.value.length > 0)
}
//
const addRecord = (record) => {
if (!judge()) {
message.warning('只可选择一条')
return
}
const selectedRecord = selectedData.value.filter((item) => item.id === record.id)
if (selectedRecord.length === 0) {
selectedData.value.push(record)
} else {
message.warning('该记录已存在')
}
}
//
const addAllPageRecord = () => {
let newArray = selectedData.value.concat(tableData.value)
let list = []
for (let item1 of newArray) {
let flag = true
for (let item2 of list) {
if (item1.id === item2.id) {
flag = false
}
}
if (flag) {
list.push(item1)
}
}
selectedData.value = list
}
//
const delRecord = (record) => {
remove(selectedData.value, (item) => item.id === record.id)
}
//
const delAllRecord = () => {
selectedData.value = []
}
//
const goDataConverter = (data) => {
if (props.dataIsConverterFlw) {
const resultData = []
//
if (!isEmpty(data.value)) {
const values = data.value.split(',')
if (values.length > 0) {
values.forEach((id) => {
resultData.push(id)
})
} else {
resultData.push(data.value)
}
} else {
//
if (!isEmpty(data) && !isEmpty(data[0]) && !isEmpty(data[0].value)) {
const values = data[0].value.split(',')
for (let i = 0; i < values.length; i++) {
resultData.push(values[i])
}
}
}
return resultData
} else {
if (getValueType() !== 'string') {
return data
}
if (data.length > 1) {
const resultData = []
data.split(',').forEach((id) => {
resultData.push(id)
})
return resultData
} else {
return data
}
}
}
//
const outDataConverter = (data) => {
if (props.dataIsConverterFlw) {
data = dataArray.value
const obj = {}
let label = ''
let value = ''
for (let i = 0; i < data.length; i++) {
if (data.length === i + 1) {
label = label + data[i].name
value = value + data[i].id
} else {
label = label + data[i].name + ','
value = value + data[i].id + ','
}
}
obj.key = props.selectorConverterKey
obj.label = label
obj.value = value
obj.extJson = ''
return obj
} else {
if (getValueType() !== 'string') {
return data
}
let resultData = ''
data.forEach((id) => {
resultData = resultData + ',' + id
})
resultData = resultData.substring(1, resultData.length)
return resultData
}
}
//
const getValueType = () => {
if (props.dataType) {
return props.dataType
} else {
if (props.radioModel) {
return 'string'
}
return typeof typeof props.value
}
}
const getDataNameById = (ids) => {
if (isEmpty(dataArray.value) && !isEmpty(ids)) {
const param = {
idList: recordIds.value
}
//
groupListByIdList(param).then((data) => {
dataArray.value = data
})
}
}
watch(
() => props.value,
(newValue) => {
if (!isEmpty(props.value)) {
const ids = goDataConverter(newValue)
recordIds.value = ids
getDataNameById(ids)
} else {
dataArray.value = []
selectedData.value = []
}
},
{
immediate: true //
}
)
defineExpose({
showModel
})
</script>
<style lang="less" scoped>
.xn-mr-5 {
margin-right: 5px;
}
.xn-mr-10 {
margin-right: 10px;
}
.selectorTreeDiv {
max-height: 500px;
overflow: auto;
}
.ant-form-item {
margin-bottom: 0 !important;
}
.selector-table {
overflow: auto;
max-height: 450px;
}
</style>

View File

@ -172,6 +172,10 @@
type: Boolean, type: Boolean,
default: () => false default: () => false
}, },
selectorConverterKey: {
type: String,
default: () => 'ORG'
},
orgTreeApi: { orgTreeApi: {
type: Function type: Function
}, },
@ -502,7 +506,7 @@
value = value + data[i].id + ',' value = value + data[i].id + ','
} }
} }
obj.key = 'ORG' obj.key = props.selectorConverterKey
obj.label = label obj.label = label
obj.value = value obj.value = value
obj.extJson = '' obj.extJson = ''
@ -548,6 +552,9 @@
const ids = goDataConverter(newValue) const ids = goDataConverter(newValue)
recordIds.value = ids recordIds.value = ids
getDataNameById(ids) getDataNameById(ids)
} else {
dataArray.value = []
selectedData.value = []
} }
}, },
{ {

View File

@ -548,6 +548,9 @@
const ids = goDataConverter(newValue) const ids = goDataConverter(newValue)
recordIds.value = ids recordIds.value = ids
getDataNameById(ids) getDataNameById(ids)
} else {
dataArray.value = []
selectedData.value = []
} }
}, },
{ {

View File

@ -576,6 +576,9 @@
const ids = goDataConverter(newValue) const ids = goDataConverter(newValue)
recordIds.value = ids recordIds.value = ids
getDataNameById(ids) getDataNameById(ids)
} else {
dataArray.value = []
selectedData.value = []
} }
}, },
{ {

View File

@ -556,6 +556,9 @@
const ids = goDataConverter(newValue) const ids = goDataConverter(newValue)
recordIds.value = ids recordIds.value = ids
getUserAvatarById(ids) getUserAvatarById(ids)
} else {
userObj.value = []
selectedData.value = []
} }
}, },
{ {

View File

@ -12,24 +12,26 @@
*/ */
package vip.xiaonuo.sys.api; package vip.xiaonuo.sys.api;
import cn.hutool.json.JSONObject;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import java.util.List; import java.util.List;
/** /**
* Api * Api
* *
* @author xuyuxiang * @author xuyuxiang
* @date 2022/6/6 11:33 * @date 2022/6/6 11:33
**/ **/
public interface SysGroupApi { public interface SysGroupApi {
/** /**
* *
* *
* @author xuyuxiang * @author xuyuxiang
* @date 2022/5/13 21:00 * @date 2022/5/13 21:00
*/ */
List<String> ownUser(String userId); List<String> ownUser(String groupId);
/** /**
* *
@ -38,4 +40,12 @@ public interface SysGroupApi {
* @date 2022/8/1 18:28 * @date 2022/8/1 18:28
*/ */
void grantUser(String groupId, List<String> userIdList); void grantUser(String groupId, List<String> userIdList);
/**
*
*
* @author yubaoshan
* @date 2025/1/12 02:36
*/
Page<JSONObject> groupSelector(String searchKey, int current, int size);
} }

View File

@ -30,6 +30,14 @@ public interface SysRelationApi {
**/ **/
List<String> getUserIdListByRoleIdList(List<String> roleIdList); List<String> getUserIdListByRoleIdList(List<String> roleIdList);
/**
* idid
*
* @author xuyuxiang
* @date 2022/6/6 11:43
**/
List<String> getUserIdListByGroupIdList(List<String> groupIdList);
/** /**
* Id * Id
* *

View File

@ -0,0 +1,40 @@
/*
* Copyright [2022] [https://www.xiaonuo.vip]
*
* SnowyAPACHE LICENSE 2.0使
*
* 1.LICENSE
* 2.Snowy
* 3.使使
* 4. https://www.xiaonuo.vip
* 5.xiaonuobase@qq.com
* 6.Snowy https://www.xiaonuo.vip
*/
package vip.xiaonuo.sys.modular.group.param;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Getter;
import lombok.Setter;
/**
*
*
* @author yubaoshan
* @date 2025/1/12 02:36
**/
@Getter
@Setter
public class SysGroupSelectorParam {
/** 当前页 */
@Schema(description = "当前页码")
private Integer current;
/** 每页条数 */
@Schema(description = "每页条数")
private Integer size;
/** 姓名关键词 */
@Schema(description = "姓名关键词")
private String searchKey;
}

View File

@ -12,11 +12,15 @@
*/ */
package vip.xiaonuo.sys.modular.group.provider; package vip.xiaonuo.sys.modular.group.provider;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.json.JSONObject;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import jakarta.annotation.Resource; import jakarta.annotation.Resource;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import vip.xiaonuo.sys.api.SysGroupApi; import vip.xiaonuo.sys.api.SysGroupApi;
import vip.xiaonuo.sys.modular.group.param.SysGroupGrantUserParam; import vip.xiaonuo.sys.modular.group.param.SysGroupGrantUserParam;
import vip.xiaonuo.sys.modular.group.param.SysGroupIdParam; import vip.xiaonuo.sys.modular.group.param.SysGroupIdParam;
import vip.xiaonuo.sys.modular.group.param.SysGroupSelectorParam;
import vip.xiaonuo.sys.modular.group.service.SysGroupService; import vip.xiaonuo.sys.modular.group.service.SysGroupService;
import java.util.List; import java.util.List;
@ -46,4 +50,14 @@ public class SysGroupApiProvider implements SysGroupApi {
sysGroupGrantUserParam.setGrantInfoList(userIdList); sysGroupGrantUserParam.setGrantInfoList(userIdList);
sysGroupService.grantUser(sysGroupGrantUserParam); sysGroupService.grantUser(sysGroupGrantUserParam);
} }
@SuppressWarnings("ALL")
@Override
public Page<JSONObject> groupSelector(String searchKey, int current, int size) {
SysGroupSelectorParam sysGroupSelectorParam = new SysGroupSelectorParam();
sysGroupSelectorParam.setCurrent(current);
sysGroupSelectorParam.setSize(size);
sysGroupSelectorParam.setSearchKey(searchKey);
return BeanUtil.toBean(sysGroupService.groupSelector(sysGroupSelectorParam), Page.class);
}
} }

View File

@ -108,4 +108,12 @@ public interface SysGroupService extends IService<SysGroup> {
* @date 2024/12/21 01:25 * @date 2024/12/21 01:25
*/ */
void grantUser(SysGroupGrantUserParam sysGroupGrantUserParam); void grantUser(SysGroupGrantUserParam sysGroupGrantUserParam);
/**
*
*
* @author yubaoshan
* @date 2024/12/21 01:25
*/
Page<SysGroup> groupSelector(SysGroupSelectorParam sysGroupSelectorParam);
} }

View File

@ -171,4 +171,19 @@ public class SysGroupServiceImpl extends ServiceImpl<SysGroupMapper, SysGroup> i
return sysRelation; return sysRelation;
}).collect(Collectors.toList())); }).collect(Collectors.toList()));
} }
@Override
public Page<SysGroup> groupSelector(SysGroupSelectorParam sysGroupSelectorParam) {
LambdaQueryWrapper<SysGroup> lambdaQueryWrapper = new LambdaQueryWrapper<>();
// 只查询部分字段排掉extJson
lambdaQueryWrapper.select(SysGroup::getId, SysGroup::getName, SysGroup::getSortCode, SysGroup::getRemark);
lambdaQueryWrapper.orderByAsc(SysGroup::getSortCode);
// 如果查询条件为空,则直接查询
if (!ObjectUtil.isAllEmpty(sysGroupSelectorParam.getSearchKey())) {
if (ObjectUtil.isNotEmpty(sysGroupSelectorParam.getSearchKey())) {
lambdaQueryWrapper.like(SysGroup::getName, sysGroupSelectorParam.getSearchKey());
}
}
return this.page(CommonPageRequest.defaultPage(), lambdaQueryWrapper);
}
} }

View File

@ -47,6 +47,12 @@ public class SysRelationApiProvider implements SysRelationApi {
SysRelationCategoryEnum.SYS_USER_HAS_ROLE.getValue()); SysRelationCategoryEnum.SYS_USER_HAS_ROLE.getValue());
} }
@Override
public List<String> getUserIdListByGroupIdList(List<String> groupIdList) {
return sysRelationService.getRelationObjectIdListByTargetIdListAndCategory(groupIdList,
SysRelationCategoryEnum.SYS_USER_HAS_GROUP.getValue());
}
@Override @Override
public void removeRoleHasMobileMenuRelation(List<String> targetIdList) { public void removeRoleHasMobileMenuRelation(List<String> targetIdList) {
sysRelationService.remove(new LambdaQueryWrapper<SysRelation>().in(SysRelation::getTargetId, targetIdList) sysRelationService.remove(new LambdaQueryWrapper<SysRelation>().in(SysRelation::getTargetId, targetIdList)

View File

@ -24,6 +24,7 @@ import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import vip.xiaonuo.common.annotation.CommonLog; import vip.xiaonuo.common.annotation.CommonLog;
import vip.xiaonuo.common.pojo.CommonResult; import vip.xiaonuo.common.pojo.CommonResult;
import vip.xiaonuo.sys.modular.group.entity.SysGroup;
import vip.xiaonuo.sys.modular.org.entity.SysOrg; import vip.xiaonuo.sys.modular.org.entity.SysOrg;
import vip.xiaonuo.sys.modular.position.entity.SysPosition; import vip.xiaonuo.sys.modular.position.entity.SysPosition;
import vip.xiaonuo.sys.modular.role.entity.SysRole; import vip.xiaonuo.sys.modular.role.entity.SysRole;
@ -325,4 +326,28 @@ public class SysUserCenterController {
public CommonResult<List<SysRole>> getRoleListByIdList(@RequestBody @Valid SysUserIdListParam sysUserIdListParam) { public CommonResult<List<SysRole>> getRoleListByIdList(@RequestBody @Valid SysUserIdListParam sysUserIdListParam) {
return CommonResult.data(sysUserService.getRoleListByIdList(sysUserIdListParam)); return CommonResult.data(sysUserService.getRoleListByIdList(sysUserIdListParam));
} }
/**
* id
*
* @author xuyuxiang
* @date 2022/4/24 20:00
*/
@Operation(summary = "根据id集合获取用户组集合")
@PostMapping("/sys/userCenter/getGroupListByIdList")
public CommonResult<List<SysGroup>> getGroupListByIdList(@RequestBody @Valid SysUserGroupIdListParam sysUserGroupIdListParam) {
return CommonResult.data(sysUserService.getGroupListByIdList(sysUserGroupIdListParam));
}
/**
* id
*
* @author xuyuxiang
* @date 2022/4/24 20:00
*/
@Operation(summary = "根据id获取头像")
@PostMapping("/sys/userCenter/getAvatarById")
public CommonResult<String> getAvatarById(@RequestBody @javax.validation.Valid SysUserIdParam sysUserIdParam) {
return CommonResult.data(sysUserService.getAvatarById(sysUserIdParam));
}
} }

View File

@ -0,0 +1,36 @@
/*
* Copyright [2022] [https://www.xiaonuo.vip]
*
* SnowyAPACHE LICENSE 2.0使
*
* 1.LICENSE
* 2.Snowy
* 3.使使
* 4. https://www.xiaonuo.vip
* 5.xiaonuobase@qq.com
* 6.Snowy https://www.xiaonuo.vip
*/
package vip.xiaonuo.sys.modular.user.param;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotNull;
import lombok.Getter;
import lombok.Setter;
import java.util.List;
/**
* id
*
* @author yubaoshan
* @date 2025/1/12 02:36
**/
@Getter
@Setter
public class SysUserGroupIdListParam {
/** id集合 */
@Schema(description = "id集合")
@NotNull(message = "idList不能为空")
private List<String> idList;
}

View File

@ -18,6 +18,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import jakarta.servlet.http.HttpServletResponse; import jakarta.servlet.http.HttpServletResponse;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import vip.xiaonuo.sys.modular.group.entity.SysGroup;
import vip.xiaonuo.sys.modular.org.entity.SysOrg; import vip.xiaonuo.sys.modular.org.entity.SysOrg;
import vip.xiaonuo.sys.modular.position.entity.SysPosition; import vip.xiaonuo.sys.modular.position.entity.SysPosition;
import vip.xiaonuo.sys.modular.role.entity.SysRole; import vip.xiaonuo.sys.modular.role.entity.SysRole;
@ -470,6 +471,14 @@ public interface SysUserService extends IService<SysUser> {
**/ **/
List<SysPosition> getPositionListByIdList(SysUserIdListParam sysUserIdListParam); List<SysPosition> getPositionListByIdList(SysUserIdListParam sysUserIdListParam);
/**
* id
*
* @author yubaoshan
* @date 2025/1/12 02:36
*/
List<SysGroup> getGroupListByIdList(SysUserGroupIdListParam sysUserGroupIdListParam);
/** /**
* id * id
* *

View File

@ -79,6 +79,8 @@ import vip.xiaonuo.mobile.api.MobileButtonApi;
import vip.xiaonuo.mobile.api.MobileMenuApi; import vip.xiaonuo.mobile.api.MobileMenuApi;
import vip.xiaonuo.sys.core.enums.SysBuildInEnum; import vip.xiaonuo.sys.core.enums.SysBuildInEnum;
import vip.xiaonuo.sys.core.enums.SysDataTypeEnum; import vip.xiaonuo.sys.core.enums.SysDataTypeEnum;
import vip.xiaonuo.sys.modular.group.entity.SysGroup;
import vip.xiaonuo.sys.modular.group.service.SysGroupService;
import vip.xiaonuo.sys.modular.org.entity.SysOrg; import vip.xiaonuo.sys.modular.org.entity.SysOrg;
import vip.xiaonuo.sys.modular.org.service.SysOrgService; import vip.xiaonuo.sys.modular.org.service.SysOrgService;
import vip.xiaonuo.sys.modular.position.entity.SysPosition; import vip.xiaonuo.sys.modular.position.entity.SysPosition;
@ -174,6 +176,9 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
@Resource @Resource
private MobileButtonApi mobileButtonApi; private MobileButtonApi mobileButtonApi;
@Resource
private SysGroupService sysGroupService;
@Override @Override
public SysLoginUser getUserById(String id) { public SysLoginUser getUserById(String id) {
SysUser sysUser = this.getById(id); SysUser sysUser = this.getById(id);
@ -1565,6 +1570,18 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
return sysPositionService.list(lambdaQueryWrapper); return sysPositionService.list(lambdaQueryWrapper);
} }
@Override
public List<SysGroup> getGroupListByIdList(SysUserGroupIdListParam sysUserGroupIdListParam) {
if (ObjectUtil.isEmpty(sysUserGroupIdListParam.getIdList())) {
return CollectionUtil.newArrayList();
}
LambdaQueryWrapper<SysGroup> lambdaQueryWrapper = new LambdaQueryWrapper<>();
// 查询部分字段
lambdaQueryWrapper.select(SysGroup::getId, SysGroup::getName, SysGroup::getRemark, SysGroup::getSortCode)
.in(SysGroup::getId, sysUserGroupIdListParam.getIdList()).orderByAsc(SysGroup::getSortCode);
return sysGroupService.list(lambdaQueryWrapper);
}
@Override @Override
public List<SysRole> getRoleListByIdList(SysUserIdListParam sysUserIdListParam) { public List<SysRole> getRoleListByIdList(SysUserIdListParam sysUserIdListParam) {
if (ObjectUtil.isEmpty(sysUserIdListParam.getIdList())) { if (ObjectUtil.isEmpty(sysUserIdListParam.getIdList())) {