Format
Plain text
Post date
2016-11-24 21:35
Publication Period
Unlimited
  1. MWorkKbnDao
  2. @Dao(config = AppConfig.class)
  3. public interface MWorkKbnDao {
  4. @Select
  5. List<MWorkKbn> selectMWorkKbn( String eigyoCd);
  6. @Select
  7. List <MWorkKbn> selectAll() ;
  8. /**
  9. * @param eigyoCd
  10. * @param ninuCd
  11. * @param workKbn
  12. * @return the MWorkKbn entity
  13. */
  14. @Select
  15. MWorkKbn selectById(String eigyoCd, String ninuCd, String workKbn);
  16. /**
  17. * @param entity
  18. * @return affected rows
  19. */
  20. @Insert
  21. int insert(MWorkKbn entity);
  22. /**
  23. * @param entity
  24. * @return affected rows
  25. */
  26. @Update
  27. int update(MWorkKbn entity);
  28. /**
  29. * @param entity
  30. * @return affected rows
  31. */
  32. @Delete
  33. int delete(MWorkKbn entity);
  34. }
  35. PC005Action
  36. @Path("/")
  37. public class PC005Action {
  38. Logger logger = Logger.getGlobal();
  39. @GET
  40. @Path("/action/mworkkbn")
  41. @Produces(MediaType.APPLICATION_JSON)
  42. public HashMap<String, Object> selectmworkkbn(@QueryParam("eigyoCd") String eigyoCd){
  43. logger.log(Level.INFO, "作業者情報取得API 処理開始");
  44. // トランザクションの取得
  45. TransactionManager tm = AppConfig.singleton().getTransactionManager();
  46. //返却値
  47. HashMap<String,Object> vResult = new HashMap<String,Object>();
  48. // MWorkerInfo
  49. MWorkKbnDao daoWInfo = new MWorkKbnDaoImpl();
  50. MWorkKbn resInfo = (MWorkKbn) tm.required(() -> {
  51. try{
  52. return daoWInfo.selectMWorkKbn(eigyoCd);
  53. }catch(Exception e){
  54. e.getStackTrace();
  55. return null ;
  56. }
  57. });
  58. vResult.put("result", (resInfo == null ? false : true)); //検索結果、1件以上取得できた場合はtrue
  59. vResult.put("dataInfo", resInfo); //検索結果
  60. // 処理終了
  61. logger.log(Level.INFO, "作業者情報取得API 処理終了");
  62. return vResult;
  63. }
  64. }
  65. selectAll.SQL
  66. SELECT
  67. /*%expand*/*
  68. FROM
  69. M_WORK_KBN
  70. selectById.sql
  71. select
  72. EIGYO_CD,
  73. NINU_CD,
  74. WORK_KBN,
  75. WORK_NAME,
  76. DEL_FLG,
  77. UPDATE_COUNT,
  78. CREATE_DT,
  79. CREATE_TERMID,
  80. CREATE_PGMID,
  81. UPDATE_DT,
  82. UPDATE_TERMID,
  83. UPDATE_PGMID
  84. from
  85. M_WORK_KBN
  86. where
  87. EIGYO_CD = /* eigyoCd */'a'
  88. and
  89. NINU_CD = /* ninuCd */'a'
  90. and
  91. WORK_KBN = /* workKbn */'a'
  92. selectMWorkKbn.sql
  93. SELECT
  94. *
  95. FROM
  96. M_Work_Kbn
  97. WHERE
  98. eigyo_cd = /* eigyoCd */'0001'
Download Printable view

URL of this paste

Embed with JavaScript

Embed with iframe

Raw text