35 lines
728 B
Java
35 lines
728 B
Java
|
package achievements.services;
|
||
|
|
||
|
import achievements.misc.DbConnection;
|
||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||
|
import org.springframework.stereotype.Service;
|
||
|
|
||
|
import javax.annotation.PostConstruct;
|
||
|
import java.sql.Connection;
|
||
|
|
||
|
@Service
|
||
|
public class AchievementService {
|
||
|
|
||
|
@Autowired
|
||
|
private DbConnection dbs;
|
||
|
private Connection db;
|
||
|
|
||
|
@Autowired
|
||
|
private ImageService imageService;
|
||
|
|
||
|
@PostConstruct
|
||
|
private void init() {
|
||
|
db = dbs.getConnection();
|
||
|
}
|
||
|
|
||
|
public String[] getIcon(int achievementId) {
|
||
|
try {
|
||
|
var stmt = db.prepareCall("{call GetAchievementIcon(?)}");
|
||
|
return imageService.getImageType(stmt, achievementId);
|
||
|
} catch (Exception e) {
|
||
|
e.printStackTrace();
|
||
|
}
|
||
|
return null;
|
||
|
}
|
||
|
}
|