build_app

This commit is contained in:
risadmin_prod 2025-03-22 05:26:50 +00:00
parent d90d4676f2
commit 44a4068944
6 changed files with 262 additions and 0 deletions

View File

@ -69,6 +69,9 @@ public class BuilderService {
executeDump(true);
// ADD OTHER SERVICE
addCustomMenu( "Tesrt", "Transcations");
System.out.println("dashboard and menu inserted...");

View File

@ -0,0 +1,99 @@
package com.realnet.forma.Controllers;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import com.fasterxml.jackson.core.JsonProcessingException;
import org.springframework.web.bind.annotation.CrossOrigin;
import com.fasterxml.jackson.databind.JsonMappingException;
import com.realnet.config.EmailService;
import com.realnet.users.entity1.AppUser;
import com.realnet.users.service1.AppUserServiceImpl;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.http.ResponseEntity;
import org.springframework.data.domain.Pageable;
import org.springframework.beans.factory.annotation.*;
import com.realnet.forma.Entity.Tesrt;
import com.realnet.forma.Services.TesrtService ;
@RequestMapping(value = "/Tesrt")
@CrossOrigin("*")
@RestController
public class TesrtController {
@Autowired
private TesrtService Service;
@Value("${projectPath}")
private String projectPath;
@PostMapping("/Tesrt")
public Tesrt Savedata(@RequestBody Tesrt data) {
Tesrt save = Service.Savedata(data) ;
System.out.println("data saved..." + save);
return save;
}
@PutMapping("/Tesrt/{id}")
public Tesrt update(@RequestBody Tesrt data,@PathVariable Integer id ) {
Tesrt update = Service.update(data,id);
System.out.println("data update..." + update);
return update;
}
// get all with pagination
@GetMapping("/Tesrt/getall/page")
public Page<Tesrt> getall(@RequestParam(value = "page", required = false) Integer page,
@RequestParam(value = "size", required = false) Integer size) {
Pageable paging = PageRequest.of(page, size);
Page<Tesrt> get = Service.getAllWithPagination(paging);
return get;
}
@GetMapping("/Tesrt")
public List<Tesrt> getdetails() {
List<Tesrt> get = Service.getdetails();
return get;
}
// get all without authentication
@GetMapping("/token/Tesrt")
public List<Tesrt> getallwioutsec() {
List<Tesrt> get = Service.getdetails();
return get;
}
@GetMapping("/Tesrt/{id}")
public Tesrt getdetailsbyId(@PathVariable Integer id ) {
Tesrt get = Service.getdetailsbyId(id);
return get;
}
@DeleteMapping("/Tesrt/{id}")
public void delete_by_id(@PathVariable Integer id ) {
Service.delete_by_id(id);
}
}

View File

@ -0,0 +1,34 @@
package com.realnet.forma.Entity;
import lombok.*;
import com.realnet.WhoColumn.Entity.Extension;
import javax.persistence.*;
import java.time.LocalDateTime;
import java.util.*;
@Entity
@Data
public class Tesrt extends Extension {
/**
*
*/
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Integer id;
private String name;
@Column(length = 2000)
private String description;
private boolean active;
}

View File

@ -0,0 +1,30 @@
package com.realnet.forma.Repository;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;
import java.util.*;
import com.realnet.forma.Entity.Tesrt;
@Repository
public interface TesrtRepository extends JpaRepository<Tesrt, Integer> {
@Query(value = "select * from tesrt where created_by=?1", nativeQuery = true)
List<Tesrt> findAll(Long creayedBy);
@Query(value = "select * from tesrt where created_by=?1", nativeQuery = true)
Page<Tesrt> findAll(Pageable page, Long creayedBy);
}

View File

@ -0,0 +1,94 @@
package com.realnet.forma.Services;
import com.realnet.forma.Repository.TesrtRepository;
import com.realnet.forma.Entity.Tesrt;import java.util.List;
import java.util.ArrayList;
import org.springframework.beans.factory.annotation.Autowired;
import com.realnet.SequenceGenerator.Service.SequenceService;
import com.realnet.Notification.Entity.NotificationService;
import org.springframework.data.domain.Page;
import com.realnet.realm.Entity.Realm;
import com.realnet.realm.Services.RealmService;import org.springframework.data.domain.Pageable;
import org.springframework.http.ResponseEntity;
import com.realnet.users.service1.AppUserServiceImpl;
import org.springframework.http.HttpStatus;
import com.realnet.users.entity1.AppUser;
import org.springframework.stereotype.Service;
@Service
public class TesrtService {
@Autowired
private TesrtRepository Repository;
@Autowired
private AppUserServiceImpl userService;
@Autowired
private RealmService realmService;
public Tesrt Savedata(Tesrt data) {
data.setUpdatedBy(getUser().getUserId());
data.setCreatedBy(getUser().getUserId());
data.setAccountId(getUser().getAccount().getAccount_id());
Tesrt save = Repository.save(data);
return save;
}
// get all with pagination
public Page<Tesrt> getAllWithPagination(Pageable page) {
return Repository.findAll(page, getUser().getUserId());
}
public List<Tesrt> getdetails() {
List<Realm> realm = realmService.findByUserId(getUser().getUserId());
List<Tesrt> all = Repository.findAll(getUser().getUserId());
return all ; }
public Tesrt getdetailsbyId(Integer id) {
return Repository.findById(id).get();
}
public void delete_by_id(Integer id) {
Repository.deleteById(id);
}
public Tesrt update(Tesrt data,Integer id) {
Tesrt old = Repository.findById(id).get();
old.setName(data.getName());
old.setDescription(data.getDescription());
old.setActive (data.isActive());
final Tesrt test = Repository.save(old);
data.setUpdatedBy(getUser().getUserId());
return test;}
public AppUser getUser() {
AppUser user = userService.getLoggedInUser();
return user;
}}

View File

@ -0,0 +1,2 @@
CREATE TABLE db.Tesrt(id BIGINT NOT NULL AUTO_INCREMENT, active VARCHAR(400), description VARCHAR(400), name VARCHAR(400), PRIMARY KEY (id));