Exemplo n.º 1
0
 @Override
 public int updateModule(Module module) {
   // TODO Auto-generated method stub
   String sqlStr =
       "update "
           + TABLE_NAME
           + " SET "
           + MODULE_NAME
           + "=?,"
           + ENABLE
           + "=?,"
           + PICTURE
           + "=?,"
           + TARGET
           + "=? WHERE "
           + ID
           + "=?";
   Object[] obj = {
     module.getModuleName(),
     module.getEnable(),
     module.getPicture(),
     module.getTarget(),
     module.getId()
   };
   return jdbcTemplate.update(sqlStr, obj);
 }
Exemplo n.º 2
0
 @Override
 public int insertModule(Module module) {
   // TODO Auto-generated method stub
   String sqlStr =
       "insert into "
           + TABLE_NAME
           + " ("
           + MODULE_NAME
           + ","
           + ENABLE
           + ","
           + PICTURE
           + ","
           + TARGET
           + ") VALUES(?,?,?,?)";
   Object[] obj = {
     module.getModuleName(), module.getEnable(), module.getPicture(), module.getTarget()
   };
   return jdbcTemplate.update(sqlStr, obj);
 }
Exemplo n.º 3
0
 @Override
 public List<Module> getAllModule() {
   // TODO Auto-generated method stub
   String sqlStr =
       "SELECT "
           + ID
           + ","
           + MODULE_NAME
           + ","
           + ENABLE
           + ","
           + PICTURE
           + ","
           + TARGET
           + " FROM "
           + TABLE_NAME;
   List<Module> moduleList = new ArrayList<Module>();
   SqlRowSet rs = jdbcTemplate.queryForRowSet(sqlStr);
   while (rs.next()) {
     Module module = new Module();
     module.setEnable(rs.getInt(ENABLE));
     module.setId(rs.getInt(ID));
     module.setModuleName(rs.getString(MODULE_NAME));
     module.setPicture(rs.getString(PICTURE));
     module.setTarget(rs.getString(TARGET));
     moduleList.add(module);
   }
   return moduleList;
 }