Indent 相关基本实现

This commit is contained in:
myh
2023-10-26 11:44:14 +08:00
parent 309a5c8df9
commit 80f43b37f6
4 changed files with 88 additions and 0 deletions

View File

@@ -0,0 +1,13 @@
package com.example.springdemo.service;
import com.example.springdemo.entities.Indent;
public interface IndentService {
Indent addIndent(Indent indent);
void deleteIndentById(Long id);
Indent updateIndent(Indent indent);
Iterable<Indent> findAllIndents();
}

View File

@@ -0,0 +1,32 @@
package com.example.springdemo.service;
import com.example.springdemo.dao.IndentRepository;
import com.example.springdemo.entities.Indent;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;
@Service
public class IndentServiceImpl implements IndentService{
@Resource
private IndentRepository indentRepository;
@Override
public Indent addIndent(Indent indent) {
return indentRepository.save(indent);
}
@Override
public void deleteIndentById(Long id) {
indentRepository.deleteById(id);
}
@Override
public Indent updateIndent(Indent indent) {
return indentRepository.save(indent);
}
@Override
public Iterable<Indent> findAllIndents() {
return indentRepository.findAll();
}
}