Advertisement
Guest User

Untitled

a guest
Jun 20th, 2019
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.31 KB | None | 0 0
  1. @Entity
  2. @Table(name = "formation")
  3. public class Formation {
  4. @Id
  5. @GeneratedValue(strategy = GenerationType.AUTO)
  6. private Long id;
  7. private String cursus;
  8. private String groupeaction;
  9. private String module;
  10. private String formateur;
  11. @Temporal(TemporalType.DATE)
  12. private Date date;
  13. private Long nbrappart;
  14. private Long nbrabsent;
  15. private Long hf;
  16. private Long jf;
  17. private Long nbrheures;
  18. private Long tauxh;
  19. private Long ristourneprevis;
  20. private Long couthebergttc;
  21. private Long coutpausecafttc;
  22.  
  23. @Entity
  24. @Table(name = "tablef")
  25. public class Tablef {
  26.  
  27. @Id
  28. @GeneratedValue(strategy = GenerationType.AUTO)
  29. private Long id;
  30. private String cursus;
  31. private Long nbrappart;
  32. private Long Sumnbrheures;
  33. private Long Sumjf;
  34. private Long jhf;
  35. private String groupeaction;
  36.  
  37. public Boolean InserIntoTableF(Tablef tf) {
  38. Long id = ThreadLocalRandom.current().nextLong();
  39. tf.setId(id);
  40. jdbc.execute("insert into tablef (id,cursus,groupeaction
  41. ,nbrappart,sumnbrheures,sumjf,jhf)rn" +
  42. "select id,cursus,groupeaction,nbrappart,sum(nbrheures),sum(jf)
  43. ,sum(jf)*nbrappartrn" +
  44. " from formation rn" +
  45. "group by cursus ;");
  46. return true;
  47.  
  48.  
  49. }
  50.  
  51. @PostMapping(value = "/test")
  52. public Boolean AddTf(Tablef tf) {
  53. return formationservice.InserIntoTableF(tf);
  54.  
  55. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement