This commit is contained in:
2025-12-23 15:57:11 +08:00
parent 33a16342d3
commit 68daf391af
23 changed files with 608 additions and 523 deletions

View File

@@ -178,6 +178,7 @@ public class GuestController {
// 3. 来客不存在,创建新来客
if (guest == null) {
TbGuestDTO newGuest = new TbGuestDTO();
newGuest.setOptsn(IdUtil.getOptsn());
newGuest.setUserId(IdUtil.generateID());
newGuest.setWechatId(loginParam.getWechatId());
newGuest.setPhone(loginParam.getPhone());

View File

@@ -13,6 +13,7 @@ import org.xyzh.common.core.page.PageDomain;
import org.xyzh.common.core.page.PageRequest;
import org.xyzh.common.dto.sys.TbGuestDTO;
import org.xyzh.common.dto.sys.TbSysUserRoleDTO;
import org.xyzh.common.utils.id.IdUtil;
import org.xyzh.system.mapper.user.TbGuestMapper;
import org.xyzh.system.mapper.user.TbSysUserRoleMapper;
@@ -48,6 +49,7 @@ public class GuestServiceImpl implements GuestService{
// 绑定访客角色(role_guest)
TbSysUserRoleDTO userRole = new TbSysUserRoleDTO();
userRole.setOptsn(IdUtil.getOptsn());
userRole.setUserId(guest.getUserId());
userRole.setRoleId("role_guest");
userRole.setDeptId("dept_root");

View File

@@ -224,12 +224,15 @@ public class SysUserServiceImpl implements SysUserService {
@Override
public ResultDomain<SysUserVO> getLoginUser(SysUserVO filter) {
// 登录查询语义与 getUser 相同(可根据用户名/手机号/邮箱查询)
// 登录查询语义与 getUser 相同(可根据用户名/手机号/邮箱/wechatId查询)
if(NonUtils.isNotNull(filter.getPhone())){
filter.setPhone(filter.getPhone());
}
SysUserVO userVO = userMapper.getUserByFilter(filter).get(0);
return ResultDomain.success("查询成功", userVO);
List<SysUserVO> list = userMapper.getUserByFilter(filter);
if (list == null || list.isEmpty()) {
return ResultDomain.failure("用户不存在");
}
return ResultDomain.success("查询成功", list.get(0));
}
@Override

View File

@@ -172,6 +172,9 @@
<if test="filter.username !=null and filter.username !=''">
AND ui.username = #{filter.username}
</if>
<if test="filter.wechatId !=null and filter.wechatId !=''">
AND u.wechat_id = #{filter.wechatId}
</if>
<!-- username / userType / deptPath 在表中不存在,按 SQL 为准移除相关条件 -->
AND (u.deleted IS NULL OR u.deleted = false)
</where>

View File

@@ -7,6 +7,7 @@
<!-- 用户角色关系字段 -->
<id column="user_id" property="userId" jdbcType="VARCHAR"/>
<id column="role_id" property="roleId" jdbcType="VARCHAR"/>
<id column="dept_id" property="deptId" jdbcType="VARCHAR"/>
<!-- 基础字段 -->
<result column="optsn" property="optsn" jdbcType="VARCHAR"/>
<result column="creator" property="creator" jdbcType="VARCHAR"/>
@@ -62,7 +63,7 @@
<!-- 基础列 -->
<sql id="Base_Column_List">
user_id, role_id,
user_id, role_id, dept_id,
optsn, creator, updater, dept_path, remark, create_time, update_time, delete_time, deleted
</sql>
@@ -73,6 +74,7 @@
<!-- 必填字段user_id, role_id, optsn -->
user_id,
role_id,
dept_id,
optsn,
<!-- 可选字段:基础字段按是否有值动态拼接 -->
<if test="creator != null and creator != ''">creator,</if>
@@ -88,6 +90,7 @@
<!-- 必填字段值 -->
#{userId},
#{roleId},
#{deptId},
#{optsn},
<!-- 可选字段值 -->
<if test="creator != null and creator != ''">#{creator},</if>