Compare commits

...

2 Commits

  1. 9
      jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/mapper/SysUserMapper.java
  2. 6
      jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/service/ISysUserService.java
  3. 17
      jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/service/impl/SysUserServiceImpl.java

@ -164,4 +164,13 @@ public interface SysUserMapper extends BaseMapper<SysUser> {
@Select("select * from zy_order where id =#{id}") @Select("select * from zy_order where id =#{id}")
ZyOrder getallzyo(String id); ZyOrder getallzyo(String id);
//这个是根据roleid查询用户id
@Select("select user_id from sys_user_role where role_id =#{roleid}")
List<String> getuserids(String roleid);
//根据id获取用户
@Select("select * from sys_user where id=#{needid}")
SysUser getneeduser(String needid);
} }

@ -263,4 +263,10 @@ public interface ISysUserService extends IService<SysUser> {
//这个是用于获取一个订单的全部信息 //这个是用于获取一个订单的全部信息
ZyOrder getallzyo(String id); ZyOrder getallzyo(String id);
//这里是产生一个随机虚拟用户,用于虚拟下单
SysUser getuser();
} }

@ -561,4 +561,21 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
return userMapper.getallzyo(id); return userMapper.getallzyo(id);
} }
//这个是获取一个虚拟用户的对象
@Override
public SysUser getuser() {
//虚拟角色id
String roleid="1630020854744330241";
//根据角色id查询用户id
List<String> uids = new ArrayList<>();
//获取用户id的合集
uids = userMapper.getuserids(roleid);
Random random = new Random();
int n = random.nextInt(uids.size());
String needid = uids.get(n);
SysUser sysUser = new SysUser();
sysUser = userMapper.getneeduser(needid);
return sysUser;
}
} }

Loading…
Cancel
Save