<repo_name>ichsan-pribadi/minipro-refresh-java<file_sep>/refresh-project/src/main/java/com/example/demo/service/impl/GejalaServiceImpl.java
package com.example.demo.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.example.demo.models.ModelGejala;
import com.example.demo.models.dto.listDto;
import com.example.demo.repositories.RepoGejala;
import com.example.demo.service.ServiceGejala;

@Service
public class GejalaServiceImpl implements ServiceGejala{

	@Autowired
	private RepoGejala RG;
	
	@Override
	public List<listDto> findlist() {
		// TODO Auto-generated method stub
		return RG.findlist();
	}

	@Override
	public ModelGejala save(ModelGejala modelgejala) {
		// TODO Auto-generated method stub
		return null;
	}

}
<file_sep>/refresh-project/src/main/resources/application.properties
server.port = 8080


spring.datasource.url= jdbc:postgresql://localhost:5432/db_refresh
spring.datasource.username=postgres
spring.datasource.password=<PASSWORD>
spring.jpa.properties.hibernate.dialect = org.hibernate.dialect.PostgreSQL95Dialect
spring.jpa.properties.hibernate.temp.use_jdbc_metadata_defaults =false

spring.jpa.show-sql= true
spring.jpa.hibernate.ddl-auto=update

<file_sep>/refresh-project/src/main/java/com/example/demo/service/ServicePasien.java
package com.example.demo.service;

import java.util.List;
import java.util.Optional;

import com.example.demo.models.ModelPasien;

public interface ServicePasien {
	
	ModelPasien save(ModelPasien modelpasien);
	List<ModelPasien>findAllPasien();
	Optional<ModelPasien> findpasienByKode(String kode);

}
<file_sep>/refresh-project/src/main/java/com/example/demo/restController/RestGejala.java
package com.example.demo.restController;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.example.demo.service.ServiceGejala;
import com.example.demo.service.ServicePasien;

@RestController
@RequestMapping(path = "/api/gejala", produces = "application/json")
@CrossOrigin(origins = "*")
public class RestGejala {
	
	@Autowired
	private ServiceGejala SG;
	
	@GetMapping("/findlist")
	public ResponseEntity<?> findlist() {
		
		return new ResponseEntity<>(SG.findlist(), HttpStatus.OK);
	}


}
<file_sep>/refresh-project/src/main/java/com/example/demo/service/impl/PaseienServiceImpl.java
package com.example.demo.service.impl;

import java.util.List;
import java.util.Optional;

import org.apache.tomcat.jni.PasswordCallback;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.example.demo.models.ModelGejala;
import com.example.demo.models.ModelPasien;
import com.example.demo.repositories.RepoPasien;
import com.example.demo.service.ServicePasien;

@Service
public class PaseienServiceImpl implements ServicePasien{
	
	@Autowired(required=true)
	private RepoPasien repoPasien;

	@Override
	public Optional<ModelPasien> findpasienByKode(String kode) {
		// TODO Auto-generated method stub
		return repoPasien.findpasienByKode(kode);
	}

	@Override
	public List<ModelPasien> findAllPasien() {
		// TODO Auto-generated method stub
		return repoPasien.findAllPasien();
	}

	@Override
	public ModelPasien save(ModelPasien modelpasien) {
		// TODO Auto-generated method stub
		return repoPasien.save(modelpasien);
	}


	

}
<file_sep>/refresh-project/src/main/java/com/example/demo/service/ServiceGejala.java
package com.example.demo.service;

import java.util.List;

import com.example.demo.models.ModelGejala;
import com.example.demo.models.ModelPasien;
import com.example.demo.models.dto.listDto;

public interface ServiceGejala {
	
	 List<listDto> findlist();
	 ModelGejala save(ModelGejala modelgejala);

}
