adding base project

This commit is contained in:
Azmat-7860
2026-10-22 16:06:48 +05:30
commit 147d52120c
718 changed files with 38983 additions and 0 deletions
@@ -0,0 +1,42 @@
package com.realnet.Abc_1665647440047_back.Controllers;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import com.realnet.Abc_1665647440047_back.Entity.Abc;
import com.realnet.Abc_1665647440047_back.Services.AbcService ;
@RequestMapping(value = "/_1665647440047_back")
@RestController
public class AbcController {
@Autowired
private AbcService Service;
@PostMapping("/Abc")
public Abc Savedata(@RequestBody Abc data) {
Abc save = Service.Savedata(data) ;
return save;
}
@GetMapping("/Abc")
public List<Abc> getdetails() {
List<Abc> get = Service.getdetails();
return get;
}
@GetMapping("/Abc/{id}")
public Abc getdetailsbyId(@PathVariable Long id ) {
Abc get = Service.getdetailsbyId(id);
return get;
}
@DeleteMapping("/Abc/{id}")
public void delete_by_id(@PathVariable Long id ) {
Service.delete_by_id(id);
}
@PutMapping("/Abc/{id}")
public Abc update(@RequestBody Abc data,@PathVariable Long id ) {
Abc update = Service.update(data,id);
return update;
}
}
@@ -0,0 +1,18 @@
package com.realnet.Abc_1665647440047_back.Entity;
import lombok.*;
import javax.persistence.*;
import java.time.LocalDateTime;
import java.util.*;
@Entity
@Data
public class Abc{
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
private String name;
private int name_id;
}
@@ -0,0 +1,13 @@
package com.realnet.Abc_1665647440047_back.Repository;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
import com.realnet.Abc_1665647440047_back.Entity.Abc;
@Repository
public interface AbcRepository extends JpaRepository<Abc, Long> {
}
@@ -0,0 +1,37 @@
package com.realnet.Abc_1665647440047_back.Services;
import com.realnet.Abc_1665647440047_back.Repository.AbcRepository;
import com.realnet.Abc_1665647440047_back.Entity.Abc;import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@Service
public class AbcService {
@Autowired
private AbcRepository Repository;
public Abc Savedata(Abc data) {
return Repository.save(data);
}
public List<Abc> getdetails() {
return (List<Abc>) Repository.findAll();
}
public Abc getdetailsbyId(Long id) {
return Repository.findById(id).get();
}
public void delete_by_id(Long id) {
Repository.deleteById(id);
}
public Abc update(Abc data,Long id) {
Abc old = Repository.findById(id).get();
old.setName(data.getName());
old.setName_id(data.getName_id());
final Abc test = Repository.save(old);
return test;}}
@@ -0,0 +1,15 @@
package com.realnet.model;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
public class TestModel {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private int id;
private String name;
private String email;
private String mob_no;
}