LineService.java 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. package com.gyee.benchmarkinghive.service;
  2. import com.gyee.benchmarkinghive.model.auto.Line;
  3. import org.springframework.beans.factory.annotation.Autowired;
  4. import org.springframework.jdbc.core.RowMapper;
  5. import org.springframework.stereotype.Service;
  6. import java.sql.ResultSet;
  7. import java.sql.SQLException;
  8. import java.util.List;
  9. /**
  10. * @ClassName : LineService
  11. * @Author : xieshengjie
  12. * @Date: 2021/6/15 18:08
  13. * @Description : 线路service
  14. */
  15. @Service
  16. public class LineService extends GenericService {
  17. public List<Line> lineList(){
  18. List<Line> lineList = jdbcTemplate.query("select * from gyee_test.line", new RowMapper<Line>() {
  19. @Override
  20. public Line mapRow(ResultSet rs, int rowNum) throws SQLException {
  21. Line line = new Line();
  22. line.setId(rs.getString("id"));
  23. line.setCode(rs.getString("code"));
  24. line.setName(rs.getString("name"));
  25. line.setAname(rs.getString("aname"));
  26. line.setProjectid(rs.getString("projectid"));
  27. line.setOrdernum(rs.getInt("ordernum"));
  28. line.setCapacity(rs.getDouble("capacity"));
  29. line.setCapacityunit(rs.getString("capacityunit"));
  30. line.setQuantity(rs.getInt("quantity"));
  31. return line;
  32. }
  33. });
  34. return lineList;
  35. }
  36. }