查询部门信息 by name
This commit is contained in:
parent
c7a4e1219c
commit
1b46f676f2
|
@ -11,15 +11,13 @@ import io.renren.modules.sys.dto.SysDeptDTO;
|
|||
import io.renren.modules.sys.service.SysDeptService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.jdbc.core.JdbcTemplate;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* 部门管理
|
||||
|
@ -47,9 +45,13 @@ public class SysDeptController {
|
|||
@ApiOperation("查询所有部门列表")
|
||||
@LogOperation("查询所有部门列表")
|
||||
// @RequiresPermissions("sys:dept:list")
|
||||
public Result<List<Map<String, Object>>> all() {
|
||||
List<Map<String, Object>> list = jdbcTemplate.queryForList("SELECT id,`name` FROM sys_dept;");
|
||||
|
||||
public Result<List<Map<String, Object>>> all(String name) {
|
||||
List<Map<String, Object>> list = new ArrayList<>();
|
||||
if (StringUtils.isNotEmpty(name)) {
|
||||
list = jdbcTemplate.queryForList(String.format("SELECT id,`name` FROM sys_dept WHERE `name` LIKE '%s';", name));
|
||||
} else {
|
||||
list = jdbcTemplate.queryForList("SELECT id,`name` FROM sys_dept;");
|
||||
}
|
||||
return new Result<List<Map<String, Object>>>().ok(list);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue