Skip to main content

Posts

Service

  @Service public class CustomerService { @Autowired private CustomerDao customerDao ; public ResponseEntity<ResponseStructure<Customer>> saveCustomer(Customer customer ) { ResponseStructure<Customer> structure = new ResponseStructure<Customer>(); structure .setBody( customerDao .saveCustomer( customer )); structure .setMessage( "Saved Successfully" ); structure .setCode(HttpStatus. ACCEPTED .value()); return new ResponseEntity<ResponseStructure<Customer>> ( structure ,HttpStatus. ACCEPTED ); } public ResponseEntity<ResponseStructure<Customer>> updateCustomer(Customer customer ) { ResponseStructure<Customer> structure = new ResponseStructure<Customer>(); structure .setBody( customerDao .updateCustomer( customer )); structure .setMessage( "Saved Successfully" ); structure .setCode(HttpStatus. ACCEPTED .value()); return new ResponseEntity<Respo...

Repository

  public interface CustomerRepository extends JpaRepository<Customer, Integer> { @Query ( "select c from Customer c where first_name=?1 and phone=?2" ) Option verifyCustomer(String name , long phone ); }

Dao

  @Repository public class CustomerDao { @Autowired private CustomerRepository repository ; public Customer saveCustomer(Customer customer ) { return repository .save( customer ); } public Customer updateCustomer(Customer customer ) { return repository .save( customer ); } public void deleteCustomer( int id ) { repository .deleteById( id ); } public Optional<Customer> getCustomer( int id ) { return repository .findById( id ); } public List<Customer> getAll() { return repository .findAll(); } }

controller

  @RestController @CrossOrigin public class CustomerController { @Autowired private CustomerService customerService ; @PostMapping ( "/customer" ) public ResponseEntity<ResponseStructure<Customer>> saveCustomer( @RequestBody Customer customer ) { return customerService .saveCustomer( customer ); } @PutMapping ( "/customer" ) public ResponseEntity<ResponseStructure<Customer>> updateCustomer( @RequestBody Customer customer ) { return customerService .saveCustomer( customer ); } @DeleteMapping ( "/customer/{id}" ) public ResponseEntity<ResponseStructure<String>> deleteCustomer( @PathVariable int id ) { return customerService .deleteCustomer( id ); } // @GetMapping("/customer/{id}") // public ResponseEntity<ResponseStructure<Customer>> getCustomer(@PathVariable int id) // { // return customerService.getCustomer(id); // } @GetMapping ( "/hosp...

application.properties

Spring boot  application.properties Code #spring.datasource.username=root #spring.datasource.password= admin #spring.datasource.url= jdbc : mysql :// localhost :3306/customer?createDatabaseIfNotExist=true #spring.jpa.hibernate.ddl-auto=update #spring.jpa.properties.format- sql =true #spring.jpa.show- sql =true #spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQL8Dialect spring.datasource.url= jdbc : mysql :// localhost :3306/customer?createDatabaseIfNotExist=true spring.datasource.username= root spring.datasource.password= admin spring.jpa.hibernate.ddl-auto= update spring.jpa.properties.hibernate.format_sql= true spring.jpa.show-sql= true spring.jpa.properties.hibernate.dialect = org.hibernate.dialect.MySQL8Dialect

how to increase traffic in my website?

  how to increase traffic to my website There are many ways to increase traffic to a website, some of which include: Search Engine Optimization (SEO): Optimize your website to rank higher in search engines like Google by using keywords, meta descriptions, and backlinks. Content Marketing: Create high-quality, relevant, and engaging content that appeals to your target audience and provides value. Share the content on your website and social media to drive traffic. Social Media Marketing: Utilize social media platforms to promote your website and engage with your audience. Paid Advertising: Consider running paid advertising campaigns on search engines, social media, and other websites to drive traffic to your site. Email Marketing: Build an email list and send regular newsletters or promotional offers to your subscribers to keep them engaged and drive traffic to your site. Collaborations and Partnerships: Partner with other websites and businesses in your industry to cross-promote ea...

What is ChatGPT AI?

  ChatGPT AI ChatGPT is a language model developed by OpenAI. It is a conversational AI model that can answer questions and generate text based on the input it receives. It was trained on a massive amount of text data and can generate human-like responses to various questions. ChatGPT is commonly used in customer service, virtual assistants, and chatbots. Benefits of ChatGPT AI Natural language processing: ChatGPT utilizes advanced NLP algorithms to understand human language, making conversations more human-like and natural. Easy access to information: ChatGPT can provide answers to a wide range of questions, making it an ideal tool for customers who are looking for quick answers. Improved customer experience: With ChatGPT, customers can get answers to their questions instantly, reducing the waiting time and improving their overall experience. 24/7 availability: ChatGPT is available 24/7, which means that customers can get answers to their questions at any time of the day, even out...