refactor: 修改登录检查是否修改密码的方法

This commit is contained in:
CaptainB 2022-06-06 16:37:45 +08:00 committed by f2c-ci-robot[bot]
parent 68d817354a
commit edce0168e7
3 changed files with 8 additions and 7 deletions

View File

@ -14,5 +14,5 @@ public interface ExtOperatingLogMapper {
List<OperatingLogDTO> findBySourceIdEnv(@Param("request") OperatingLogRequest request); List<OperatingLogDTO> findBySourceIdEnv(@Param("request") OperatingLogRequest request);
boolean isNewInstallation();
} }

View File

@ -128,4 +128,8 @@
LEFT JOIN project t2 ON tt.project_id = t2.id LEFT JOIN project t2 ON tt.project_id = t2.id
order by tt.oper_time desc order by tt.oper_time desc
</select> </select>
<select id="isNewInstallation" resultType="boolean">
SELECT count(1) = 0 from operating_log limit 1
</select>
</mapper> </mapper>

View File

@ -5,10 +5,7 @@ import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import io.metersphere.base.domain.*; import io.metersphere.base.domain.*;
import io.metersphere.base.mapper.*; import io.metersphere.base.mapper.*;
import io.metersphere.base.mapper.ext.ExtProjectMapper; import io.metersphere.base.mapper.ext.*;
import io.metersphere.base.mapper.ext.ExtUserGroupMapper;
import io.metersphere.base.mapper.ext.ExtUserMapper;
import io.metersphere.base.mapper.ext.ExtWorkspaceMapper;
import io.metersphere.commons.constants.*; import io.metersphere.commons.constants.*;
import io.metersphere.commons.exception.MSException; import io.metersphere.commons.exception.MSException;
import io.metersphere.commons.user.SessionUser; import io.metersphere.commons.user.SessionUser;
@ -94,7 +91,7 @@ public class UserService {
@Resource @Resource
private ExtWorkspaceMapper extWorkspaceMapper; private ExtWorkspaceMapper extWorkspaceMapper;
@Resource @Resource
private OperatingLogMapper operatingLogMapper; private ExtOperatingLogMapper extOperatingLogMapper;
public List<UserDetail> queryTypeByIds(List<String> userIds) { public List<UserDetail> queryTypeByIds(List<String> userIds) {
return extUserMapper.queryTypeByIds(userIds); return extUserMapper.queryTypeByIds(userIds);
@ -1356,7 +1353,7 @@ public class UserService {
public boolean checkWhetherChangePasswordOrNot(LoginRequest request) { public boolean checkWhetherChangePasswordOrNot(LoginRequest request) {
// 首次登录需要提示 // 首次登录需要提示
if (operatingLogMapper.countByExample(new OperatingLogExample()) == 0) { if (extOperatingLogMapper.isNewInstallation()) {
return true; return true;
} }