From de109165ccd993b838e7c4e137009aec582ea23f Mon Sep 17 00:00:00 2001 From: risadmin_prod Date: Fri, 21 Mar 2025 04:44:10 +0000 Subject: [PATCH] build_app --- .../Builders/Services/BuilderService.java | 3 + .../pack/Controllers/WireController.java | 99 +++++++++++++++++++ .../java/com/realnet/pack/Entity/Wire.java | 34 +++++++ .../pack/Repository/WireRepository.java | 30 ++++++ .../realnet/pack/Services/WireService.java | 94 ++++++++++++++++++ .../authsec_mysql/mysql/wf_table/wf_table.sql | 2 + 6 files changed, 262 insertions(+) create mode 100644 flutter2-back-b/authsec_springboot/backend/src/main/java/com/realnet/pack/Controllers/WireController.java create mode 100644 flutter2-back-b/authsec_springboot/backend/src/main/java/com/realnet/pack/Entity/Wire.java create mode 100644 flutter2-back-b/authsec_springboot/backend/src/main/java/com/realnet/pack/Repository/WireRepository.java create mode 100644 flutter2-back-b/authsec_springboot/backend/src/main/java/com/realnet/pack/Services/WireService.java create mode 100755 flutter2-db-d/authsec_mysql/mysql/wf_table/wf_table.sql diff --git a/flutter2-back-b/authsec_springboot/backend/src/main/java/com/realnet/Builders/Services/BuilderService.java b/flutter2-back-b/authsec_springboot/backend/src/main/java/com/realnet/Builders/Services/BuilderService.java index 11edc5f..5834802 100644 --- a/flutter2-back-b/authsec_springboot/backend/src/main/java/com/realnet/Builders/Services/BuilderService.java +++ b/flutter2-back-b/authsec_springboot/backend/src/main/java/com/realnet/Builders/Services/BuilderService.java @@ -69,6 +69,9 @@ public class BuilderService { executeDump(true); // ADD OTHER SERVICE +addCustomMenu( "Wire", "Transcations"); + + System.out.println("dashboard and menu inserted..."); diff --git a/flutter2-back-b/authsec_springboot/backend/src/main/java/com/realnet/pack/Controllers/WireController.java b/flutter2-back-b/authsec_springboot/backend/src/main/java/com/realnet/pack/Controllers/WireController.java new file mode 100644 index 0000000..81da309 --- /dev/null +++ b/flutter2-back-b/authsec_springboot/backend/src/main/java/com/realnet/pack/Controllers/WireController.java @@ -0,0 +1,99 @@ +package com.realnet.pack.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.pack.Entity.Wire; +import com.realnet.pack.Services.WireService ; + + + + + + +@RequestMapping(value = "/Wire") + @CrossOrigin("*") +@RestController +public class WireController { + @Autowired + private WireService Service; + +@Value("${projectPath}") + private String projectPath; + + + + + + + + @PostMapping("/Wire") + public Wire Savedata(@RequestBody Wire data) { + Wire save = Service.Savedata(data) ; + + + + + + System.out.println("data saved..." + save); + + return save; + } +@PutMapping("/Wire/{id}") + public Wire update(@RequestBody Wire data,@PathVariable Integer id ) { + Wire update = Service.update(data,id); + System.out.println("data update..." + update); + return update; + } +// get all with pagination + @GetMapping("/Wire/getall/page") + public Page getall(@RequestParam(value = "page", required = false) Integer page, + @RequestParam(value = "size", required = false) Integer size) { + Pageable paging = PageRequest.of(page, size); + Page get = Service.getAllWithPagination(paging); + + return get; + + } + @GetMapping("/Wire") + public List getdetails() { + List get = Service.getdetails(); + return get; +} +// get all without authentication + + @GetMapping("/token/Wire") + public List getallwioutsec() { + List get = Service.getdetails(); + return get; +} +@GetMapping("/Wire/{id}") + public Wire getdetailsbyId(@PathVariable Integer id ) { + Wire get = Service.getdetailsbyId(id); + return get; + } +@DeleteMapping("/Wire/{id}") + public void delete_by_id(@PathVariable Integer id ) { + Service.delete_by_id(id); + + } + + + + + + + +} \ No newline at end of file diff --git a/flutter2-back-b/authsec_springboot/backend/src/main/java/com/realnet/pack/Entity/Wire.java b/flutter2-back-b/authsec_springboot/backend/src/main/java/com/realnet/pack/Entity/Wire.java new file mode 100644 index 0000000..8f15b0d --- /dev/null +++ b/flutter2-back-b/authsec_springboot/backend/src/main/java/com/realnet/pack/Entity/Wire.java @@ -0,0 +1,34 @@ +package com.realnet.pack.Entity; + import lombok.*; +import com.realnet.WhoColumn.Entity.Extension; + import javax.persistence.*; + import java.time.LocalDateTime; + import java.util.*; + + + + + + + + @Entity + @Data + public class Wire 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; + + +} diff --git a/flutter2-back-b/authsec_springboot/backend/src/main/java/com/realnet/pack/Repository/WireRepository.java b/flutter2-back-b/authsec_springboot/backend/src/main/java/com/realnet/pack/Repository/WireRepository.java new file mode 100644 index 0000000..b11321d --- /dev/null +++ b/flutter2-back-b/authsec_springboot/backend/src/main/java/com/realnet/pack/Repository/WireRepository.java @@ -0,0 +1,30 @@ +package com.realnet.pack.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.pack.Entity.Wire; + +@Repository +public interface WireRepository extends JpaRepository { + +@Query(value = "select * from wire where created_by=?1", nativeQuery = true) + List findAll(Long creayedBy); + +@Query(value = "select * from wire where created_by=?1", nativeQuery = true) + Page findAll(Pageable page, Long creayedBy); +} \ No newline at end of file diff --git a/flutter2-back-b/authsec_springboot/backend/src/main/java/com/realnet/pack/Services/WireService.java b/flutter2-back-b/authsec_springboot/backend/src/main/java/com/realnet/pack/Services/WireService.java new file mode 100644 index 0000000..0ddf2c6 --- /dev/null +++ b/flutter2-back-b/authsec_springboot/backend/src/main/java/com/realnet/pack/Services/WireService.java @@ -0,0 +1,94 @@ +package com.realnet.pack.Services; +import com.realnet.pack.Repository.WireRepository; +import com.realnet.pack.Entity.Wire;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 WireService { +@Autowired +private WireRepository Repository; + @Autowired + private AppUserServiceImpl userService; +@Autowired + private RealmService realmService; + + + + + +public Wire Savedata(Wire data) { + + + + + + + data.setUpdatedBy(getUser().getUserId()); + data.setCreatedBy(getUser().getUserId()); + data.setAccountId(getUser().getAccount().getAccount_id()); +Wire save = Repository.save(data); + return save; + } + + +// get all with pagination + public Page getAllWithPagination(Pageable page) { + return Repository.findAll(page, getUser().getUserId()); + } +public List getdetails() { + List realm = realmService.findByUserId(getUser().getUserId()); +List all = Repository.findAll(getUser().getUserId()); + + return all ; } + + +public Wire getdetailsbyId(Integer id) { + return Repository.findById(id).get(); + } + + + public void delete_by_id(Integer id) { + Repository.deleteById(id); +} + + +public Wire update(Wire data,Integer id) { + Wire old = Repository.findById(id).get(); +old.setName(data.getName()); + +old.setDescription(data.getDescription()); + +old.setActive (data.isActive()); + +final Wire test = Repository.save(old); + data.setUpdatedBy(getUser().getUserId()); + return test;} + + + + + + + public AppUser getUser() { + AppUser user = userService.getLoggedInUser(); + return user; + + }} diff --git a/flutter2-db-d/authsec_mysql/mysql/wf_table/wf_table.sql b/flutter2-db-d/authsec_mysql/mysql/wf_table/wf_table.sql new file mode 100755 index 0000000..7ae5cff --- /dev/null +++ b/flutter2-db-d/authsec_mysql/mysql/wf_table/wf_table.sql @@ -0,0 +1,2 @@ +CREATE TABLE db.Wire(id BIGINT NOT NULL AUTO_INCREMENT, active VARCHAR(400), description VARCHAR(400), name VARCHAR(400), PRIMARY KEY (id)); +