feat: 新增解锁接口

This commit is contained in:
OpenCode
2026-07-21 13:17:25 +08:00
parent 0b6ee96645
commit a5aece156c
3 changed files with 18 additions and 0 deletions
@@ -40,6 +40,14 @@ public class AdminStockRecordController extends BaseController<StockRecordServic
return R.ok();
}
@Operation(summary = "解锁")
@PostMapping("/unlock")
public R<Void> unlock(@RequestBody JSONObject params) {
Long id = params.getLong("id");
service.unlock(id, CoolSecurityUtil.getCurrentUserId());
return R.ok();
}
@Operation(summary = "恢复")
@PostMapping("/restore")
public R<Void> restore(@RequestBody JSONObject params) {
@@ -7,4 +7,5 @@ public interface StockRecordService extends BaseService<StockRecordEntity> {
void archive(Long id, Long userId);
void restore(Long id, Long userId);
void lock(Long id, Long userId);
void unlock(Long id, Long userId);
}
@@ -37,6 +37,15 @@ public class StockRecordServiceImpl extends BaseServiceImpl<StockRecordMapper, S
}
}
@Override
public void unlock(Long id, Long userId) {
StockRecordEntity entity = getById(id);
if (entity != null && entity.getUserId().equals(userId) && Boolean.TRUE.equals(entity.getLocked())) {
entity.setLocked(false);
updateById(entity);
}
}
@Override
public void archive(Long id, Long userId) {
StockRecordEntity entity = getById(id);