Example #1
0
  public List<Manager> list(
      Integer rows, Integer page, String userName, Short userType, Boolean valid) {

    String sql =
        "SELECT t.userId, t.userName,t1.typeName AS userType,t.note FROM managers t LEFT JOIN manager_type t1 ON t.userType = t1.typeId where 1 = 1";
    List<Object> list = new ArrayList<Object>();
    if (userName != null) {
      sql = sql + " and t.userName like ?";
      list.add("%" + userName + "%");
    }
    if (userType != null) {
      sql = sql + " and t.userType = ?";
      list.add(userType);
    }
    if (valid != null) {
      sql = sql + " and t.valid = ?";
      list.add(valid);
    }
    sql = "select * from (" + sql + ")a";
    return RSMapper.queryPage(jdbcTemplate, sql, rows, page, Manager.class, list.toArray());
  }
Example #2
0
 public Manager findByUserName(String userName) {
   String sql = "select * from managers where userName = ?";
   return RSMapper.query(jdbcTemplate, sql, Manager.class, userName);
 }
Example #3
0
 public Manager findById_(Integer userId) {
   String sql =
       "SELECT t.userId, t.userName,t1.typeName AS userType, t.note FROM managers t LEFT JOIN manager_type t1 ON t.userType = t1.typeId where t.userId = ?";
   sql = "select * from (" + sql + ")a";
   return RSMapper.query(jdbcTemplate, sql, Manager.class, userId);
 }