serv-课程任务
This commit is contained in:
@@ -12,6 +12,8 @@ import org.xyzh.api.system.user.UserService;
|
||||
import org.xyzh.common.annotation.HttpLogin;
|
||||
import org.xyzh.common.core.domain.LoginDomain;
|
||||
import org.xyzh.common.core.domain.ResultDomain;
|
||||
import org.xyzh.common.core.page.PageParam;
|
||||
import org.xyzh.common.core.page.PageRequest;
|
||||
import org.xyzh.common.dto.user.TbSysUser;
|
||||
import org.xyzh.common.dto.user.TbSysUserDeptRole;
|
||||
import org.xyzh.common.dto.user.TbSysUserInfo;
|
||||
@@ -94,6 +96,19 @@ public class UserController {
|
||||
return userService.getUserByFilter(filter);
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 获取用户列表分页
|
||||
* @param filter
|
||||
* @author yslg
|
||||
* @since 2025-10-09
|
||||
*/
|
||||
@PostMapping("/page")
|
||||
public ResultDomain<TbSysUser> getUserPage(@RequestBody PageRequest<TbSysUser> pageRequest) {
|
||||
TbSysUser filter = pageRequest.getFilter();
|
||||
PageParam pageParam = pageRequest.getPageParam();
|
||||
return userService.getUserPage(filter, pageParam);
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 绑定用户部门角色
|
||||
* @param filter
|
||||
|
||||
@@ -3,6 +3,7 @@ package org.xyzh.system.mapper;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.xyzh.common.core.page.PageParam;
|
||||
import org.xyzh.common.dto.user.TbSysUser;
|
||||
import org.xyzh.common.dto.user.TbSysUserInfo;
|
||||
import org.xyzh.common.vo.UserVO;
|
||||
@@ -95,6 +96,16 @@ public interface UserMapper extends BaseMapper<TbSysUser> {
|
||||
@Param("email") String email,
|
||||
@Param("status") String status);
|
||||
|
||||
/**
|
||||
* @description 查询用户列表(分页)
|
||||
* @param filter 过滤条件
|
||||
* @param pageParam 分页参数
|
||||
* @return List<TbSysUser> 用户列表
|
||||
* @author yslg
|
||||
* @since 2025-09-28
|
||||
*/
|
||||
List<TbSysUser> selectUserPage(@Param("filter") TbSysUser filter, @Param("pageParam") PageParam pageParam);
|
||||
|
||||
/**
|
||||
* @description 批量删除用户(逻辑删除)
|
||||
* @param userIds 用户ID列表
|
||||
|
||||
@@ -7,6 +7,8 @@ import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.StringUtils;
|
||||
import org.xyzh.common.core.domain.ResultDomain;
|
||||
import org.xyzh.common.core.page.PageDomain;
|
||||
import org.xyzh.common.core.page.PageParam;
|
||||
import org.xyzh.common.dto.user.TbSysUser;
|
||||
import org.xyzh.common.dto.user.TbSysUserDeptRole;
|
||||
import org.xyzh.common.dto.user.TbSysUserInfo;
|
||||
@@ -227,6 +229,17 @@ public class SysUserServiceImpl implements SysUserService {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResultDomain<TbSysUser> getUserPage(TbSysUser filter, PageParam pageParam) {
|
||||
ResultDomain<TbSysUser> resultDomain = new ResultDomain<>();
|
||||
List<TbSysUser> users = userMapper.selectUserPage(filter, pageParam);
|
||||
PageDomain<TbSysUser> pageDomain = new PageDomain<>();
|
||||
pageDomain.setDataList(users);
|
||||
pageDomain.setPageParam(pageParam);
|
||||
resultDomain.success("查询成功", pageDomain);
|
||||
return resultDomain;
|
||||
}
|
||||
|
||||
@Transactional
|
||||
@Override
|
||||
public ResultDomain<TbSysUser> createUser(TbSysUser user) {
|
||||
|
||||
@@ -84,6 +84,30 @@
|
||||
</where>
|
||||
</sql>
|
||||
|
||||
<sql id="Filter_Clause">
|
||||
<where>
|
||||
deleted = 0
|
||||
<if test="filter.id != null and filter.id != ''">
|
||||
AND id = #{filter.id}
|
||||
</if>
|
||||
<if test="filter.username != null and filter.username != ''">
|
||||
AND username = #{filter.username}
|
||||
</if>
|
||||
<if test="filter.email != null and filter.email != ''">
|
||||
AND email = #{filter.email}
|
||||
</if>
|
||||
<if test="filter.phone != null and filter.phone != ''">
|
||||
AND phone = #{filter.phone}
|
||||
</if>
|
||||
<if test="filter.status != null">
|
||||
AND status = #{filter.status}
|
||||
</if>
|
||||
<if test="filter.wechatID != null and filter.wechatID != ''">
|
||||
AND wechat_id = #{filter.wechatID}
|
||||
</if>
|
||||
</where>
|
||||
</sql>
|
||||
|
||||
<!-- 根据用户名查询用户 -->
|
||||
<select id="selectByUsername" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
@@ -151,6 +175,16 @@
|
||||
ORDER BY create_time DESC
|
||||
</select>
|
||||
|
||||
<!-- 查询用户列表(分页) -->
|
||||
<select id="selectUserPage" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
<include refid="Base_Column_List"/>
|
||||
FROM tb_sys_user
|
||||
<include refid="Where_Clause"/>
|
||||
ORDER BY create_time DESC
|
||||
LIMIT #{pageParam.pageSize} OFFSET #{pageParam.offset}
|
||||
</select>
|
||||
|
||||
<!-- 批量删除用户(逻辑删除) -->
|
||||
<update id="batchDeleteByIds">
|
||||
UPDATE tb_sys_user
|
||||
|
||||
Reference in New Issue
Block a user