feat: Refactor user ID card update logic and add corresponding database mapping
This commit is contained in:
@@ -19,7 +19,6 @@ import com.ruoyi.common.utils.StringUtils;
|
||||
import com.ruoyi.common.utils.SecurityUtils;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.ruoyi.system.service.ISysUserService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -47,9 +46,6 @@ public class CompanyController extends BaseController
|
||||
@Autowired
|
||||
private AppUserMapper appUserMapper;
|
||||
|
||||
@Autowired
|
||||
private ISysUserService sysUserService;
|
||||
|
||||
@Autowired
|
||||
SensitiveWordChecker sensitiveWordChecker;
|
||||
|
||||
@@ -226,12 +222,9 @@ public class CompanyController extends BaseController
|
||||
{
|
||||
SysUser currentUser = SecurityUtils.getLoginUser().getUser();
|
||||
SysUser sysUser = StringUtils.isNotEmpty(oldCode)
|
||||
? sysUserService.selectUserByIdCard(oldCode) : fallbackUser;
|
||||
? appUserMapper.selectSysUserIdcard(oldCode) : fallbackUser;
|
||||
if (sysUser != null) {
|
||||
SysUser updateUser = new SysUser();
|
||||
updateUser.setUserId(sysUser.getUserId());
|
||||
updateUser.setIdCard(newCode);
|
||||
sysUserService.updateUserProfile(updateUser);
|
||||
appUserMapper.updateSysUserIdCard(sysUser.getUserId(), newCode);
|
||||
// 当前请求中的登录对象可能仍是缓存实例,立即更新它以便本次请求链路保持一致。
|
||||
if (currentUser != null && java.util.Objects.equals(currentUser.getUserId(), sysUser.getUserId())) {
|
||||
currentUser.setIdCard(newCode);
|
||||
|
||||
@@ -37,5 +37,7 @@ public interface AppUserMapper extends BaseMapper<AppUser>
|
||||
|
||||
SysUser selectSysUserIdcard(@Param("idCard") String idCard);
|
||||
|
||||
int updateSysUserIdCard(@Param("userId") Long userId, @Param("idCard") String idCard);
|
||||
|
||||
List<AppUserShow> selectUserApplyList(AppUser appUser);
|
||||
}
|
||||
|
||||
@@ -129,6 +129,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
limit 1
|
||||
</select>
|
||||
|
||||
<update id="updateSysUserIdCard">
|
||||
update sys_user
|
||||
set id_card = #{idCard},
|
||||
update_time = sysdate()
|
||||
where user_id = #{userId}
|
||||
</update>
|
||||
|
||||
<select id="selectUserApplyList" parameterType="AppUser" resultType="com.ruoyi.common.core.domain.entity.AppUserShow">
|
||||
select a.user_id , a.name , a.age , a.sex , get_birth_date_from_id_card ( a.id_card ) as birth_date ,
|
||||
a.education , a.political_affiliation , a.phone , a.avatar , c.min_salary salaryMin ,c.max_salary salaryMax,a.area ,a.id_card ,
|
||||
@@ -149,4 +156,4 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
order by b.create_time desc
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
</mapper>
|
||||
|
||||
Reference in New Issue
Block a user