获取最新一条数据密码

new
JilingLee 1 year ago
parent f9062b177d
commit 787dec8227

@ -74,6 +74,14 @@ public class PasswordsController {
return success(PasswordsConvert.INSTANCE.convert(passwords)); return success(PasswordsConvert.INSTANCE.convert(passwords));
} }
@GetMapping("/getLastPasswords")
@Operation(summary = "获得最新数据密码")
@PreAuthorize("@ss.hasPermission('setting:passwords:query')")
public CommonResult<PasswordsRespVO> getLastPasswords() {
PasswordsDO passwords = passwordsService.getLastPasswords();
return success(PasswordsConvert.INSTANCE.convert(passwords));
}
@GetMapping("/jsonToXmlConverter") @GetMapping("/jsonToXmlConverter")
@Operation(summary = "json带密码转xml") @Operation(summary = "json带密码转xml")
@PreAuthorize("@ss.hasPermission('setting:passwords:query')") @PreAuthorize("@ss.hasPermission('setting:passwords:query')")

@ -60,6 +60,13 @@ public interface PasswordsService {
*/ */
PasswordsDO getPasswords(Long id); PasswordsDO getPasswords(Long id);
/**
*
*
* @return
*/
PasswordsDO getLastPasswords();
/** /**
* *
* *

@ -159,6 +159,13 @@ public class PasswordsServiceImpl implements PasswordsService {
return passwordsMapper.selectById(id); return passwordsMapper.selectById(id);
} }
@Override
public PasswordsDO getLastPasswords() {
QueryWrapper<PasswordsDO> wrapper = new QueryWrapper<>();
wrapper.orderByDesc("create_time").last("LIMIT 1");
return passwordsMapper.selectOne(wrapper);
}
@Override @Override
public List<PasswordsDO> getPasswordsList(Collection<Long> ids) { public List<PasswordsDO> getPasswordsList(Collection<Long> ids) {
return passwordsMapper.selectBatchIds(ids); return passwordsMapper.selectBatchIds(ids);

Loading…
Cancel
Save