Browse Source

employee,filemanager

huwhois 5 years ago
parent
commit
4d85119097
18 changed files with 1106 additions and 3 deletions
  1. 5 0
      pom.xml
  2. 105 0
      src/main/java/io/renren/modules/admin/adminmenu/controller/AdminMenuController.java
  3. 23 0
      src/main/java/io/renren/modules/admin/adminmenu/dao/AdminMenuDao.java
  4. 74 0
      src/main/java/io/renren/modules/admin/adminmenu/entity/AdminMenuEntity.java
  5. 26 0
      src/main/java/io/renren/modules/admin/adminmenu/service/AdminMenuService.java
  6. 95 0
      src/main/java/io/renren/modules/admin/adminmenu/service/impl/AdminMenuServiceImpl.java
  7. 182 0
      src/main/java/io/renren/modules/admin/employee/controller/EmployeeController.java
  8. 35 0
      src/main/java/io/renren/modules/admin/employee/dao/EmployeeDao.java
  9. 185 0
      src/main/java/io/renren/modules/admin/employee/entity/EmployeeEntity.java
  10. 37 0
      src/main/java/io/renren/modules/admin/employee/service/EmployeeService.java
  11. 70 0
      src/main/java/io/renren/modules/admin/employee/service/impl/EmployeeServiceImpl.java
  12. 13 0
      src/main/java/io/renren/modules/admin/meeting/controller/MeetingController.java
  13. 11 0
      src/main/java/io/renren/modules/admin/meeting/dao/MeetingDao.java
  14. 6 1
      src/main/java/io/renren/modules/admin/meeting/service/MeetingService.java
  15. 12 0
      src/main/java/io/renren/modules/admin/meeting/service/impl/MeetingServiceImpl.java
  16. 222 0
      src/main/java/io/renren/modules/sys/controller/FileManagerController.java
  17. 0 1
      src/main/java/io/renren/modules/sys/controller/SysConfigController.java
  18. 5 1
      src/main/resources/application-dev.yml

+ 5 - 0
pom.xml

@ -242,6 +242,11 @@
242 242
			<artifactId>javase</artifactId>
243 243
			<version>3.1.0</version>
244 244
		</dependency>
245
		<dependency>
246
            <groupId>net.coobird</groupId>
247
            <artifactId>thumbnailator</artifactId>
248
            <version>0.4.8</version>
249
        </dependency>
245 250
	</dependencies>
246 251
247 252
	<build>

+ 105 - 0
src/main/java/io/renren/modules/admin/adminmenu/controller/AdminMenuController.java

@ -0,0 +1,105 @@
1
package io.renren.modules.admin.adminmenu.controller;
2
3
import java.util.Arrays;
4
import java.util.Map;
5
import java.util.List;
6
import java.util.Set;
7
8
import org.apache.shiro.authz.annotation.RequiresPermissions;
9
import org.springframework.beans.factory.annotation.Autowired;
10
import org.springframework.web.bind.annotation.PathVariable;
11
import org.springframework.web.bind.annotation.RequestBody;
12
import org.springframework.web.bind.annotation.RequestMapping;
13
import org.springframework.web.bind.annotation.GetMapping;
14
import org.springframework.web.bind.annotation.RequestParam;
15
import org.springframework.web.bind.annotation.RestController;
16
17
import io.renren.modules.admin.adminmenu.entity.AdminMenuEntity;
18
import io.renren.modules.admin.adminmenu.service.AdminMenuService;
19
import io.renren.common.utils.PageUtils;
20
import io.renren.common.utils.R;
21
import io.renren.modules.sys.controller.AbstractController;
22
import io.renren.modules.sys.service.ShiroService;
23
24
/**
25
 * 管理员菜单管理
26
 *
27
 * @author chenshun
28
 * @email sunlightcs@gmail.com
29
 * @date 2020-02-28 19:20:56
30
 */
31
@RestController
32
@RequestMapping("admin/adminmenu")
33
public class AdminMenuController extends AbstractController {
34
    @Autowired
35
    private AdminMenuService adminMenuService;
36
    @Autowired
37
	private ShiroService shiroService;
38
39
    /**
40
     * 导航菜单
41
     */
42
    @GetMapping("/nav")
43
    public R nav(){
44
        List<AdminMenuEntity> menuList = adminMenuService.getUserMenuList(getUserId());
45
        Set<String> permissions = shiroService.getUserPermissions(getUserId());
46
        return R.ok().put("menuList", menuList).put("permissions", permissions);
47
    }
48
49
    /**
50
     * 列表
51
     */
52
    @RequestMapping("/list")
53
    @RequiresPermissions("admin:adminmenu:list")
54
    public R list(@RequestParam Map<String, Object> params){
55
        PageUtils page = adminMenuService.queryPage(params);
56
57
        return R.ok().put("page", page);
58
    }
59
60
61
    /**
62
     * 信息
63
     */
64
    @RequestMapping("/info/{menuId}")
65
    @RequiresPermissions("admin:adminmenu:info")
66
    public R info(@PathVariable("menuId") Long menuId){
67
		AdminMenuEntity adminMenu = adminMenuService.getById(menuId);
68
69
        return R.ok().put("adminMenu", adminMenu);
70
    }
71
72
    /**
73
     * 保存
74
     */
75
    @RequestMapping("/save")
76
    @RequiresPermissions("admin:adminmenu:save")
77
    public R save(@RequestBody AdminMenuEntity adminMenu){
78
		adminMenuService.save(adminMenu);
79
80
        return R.ok();
81
    }
82
83
    /**
84
     * 修改
85
     */
86
    @RequestMapping("/update")
87
    @RequiresPermissions("admin:adminmenu:update")
88
    public R update(@RequestBody AdminMenuEntity adminMenu){
89
		adminMenuService.updateById(adminMenu);
90
91
        return R.ok();
92
    }
93
94
    /**
95
     * 删除
96
     */
97
    @RequestMapping("/delete")
98
    @RequiresPermissions("admin:adminmenu:delete")
99
    public R delete(@RequestBody Long[] menuIds){
100
		adminMenuService.removeByIds(Arrays.asList(menuIds));
101
102
        return R.ok();
103
    }
104
105
}

+ 23 - 0
src/main/java/io/renren/modules/admin/adminmenu/dao/AdminMenuDao.java

@ -0,0 +1,23 @@
1
package io.renren.modules.admin.adminmenu.dao;
2
3
import java.util.List;
4
import io.renren.modules.admin.adminmenu.entity.AdminMenuEntity;
5
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
6
import org.apache.ibatis.annotations.Mapper;
7
import org.apache.ibatis.annotations.Select;
8
/**
9
 * 管理员菜单管理
10
 * 
11
 * @author chenshun
12
 * @email sunlightcs@gmail.com
13
 * @date 2020-02-28 19:20:56
14
 */
15
@Mapper
16
public interface AdminMenuDao extends BaseMapper<AdminMenuEntity> {
17
	/**
18
	 * 根据父菜单,查询子菜单
19
	 * @param parentId 父菜单ID
20
	 */
21
	@Select("select * from admin_menu where parent_id = #{parentId} order by order_num asc")
22
	List<AdminMenuEntity> queryListParentId(Long parentId);
23
}

+ 74 - 0
src/main/java/io/renren/modules/admin/adminmenu/entity/AdminMenuEntity.java

@ -0,0 +1,74 @@
1
package io.renren.modules.admin.adminmenu.entity;
2
3
import com.baomidou.mybatisplus.annotation.TableField;
4
import com.baomidou.mybatisplus.annotation.TableId;
5
import com.baomidou.mybatisplus.annotation.TableName;
6
7
import java.io.Serializable;
8
import java.util.Date;
9
import lombok.Data;
10
import java.util.List;
11
12
/**
13
 * 管理员菜单管理
14
 * 
15
 * @author chenshun
16
 * @email sunlightcs@gmail.com
17
 * @date 2020-02-28 19:20:56
18
 */
19
@Data
20
@TableName("admin_menu")
21
public class AdminMenuEntity implements Serializable {
22
	private static final long serialVersionUID = 1L;
23
24
	/**
25
	 * 
26
	 */
27
	@TableId
28
	private Long menuId;
29
	/**
30
	 * 父菜单ID,一级菜单为0
31
	 */
32
	private Long parentId;
33
	/**
34
	 * 菜单名称
35
	 */
36
	private String name;
37
	/**
38
	 * 菜单URL
39
	 */
40
	private String url;
41
	/**
42
	 * 授权(多个用逗号分隔,如:user:list,user:create)
43
	 */
44
	private String perms;
45
	/**
46
	 * 类型   0:目录   1:菜单   2:按钮
47
	 */
48
	private Integer type;
49
	/**
50
	 * 菜单图标
51
	 */
52
	private String icon;
53
	/**
54
	 * 排序
55
	 */
56
	private Integer orderNum;
57
	/**
58
	 * 会议目录
59
	 */
60
	private Integer me;
61
	/**
62
	 * tab
63
	 */
64
	private Integer isTab;
65
66
	/**
67
	 * ztree属性
68
	 */
69
	@TableField(exist=false)
70
	private Boolean open;
71
72
	@TableField(exist=false)
73
	private List<?> list;
74
}

+ 26 - 0
src/main/java/io/renren/modules/admin/adminmenu/service/AdminMenuService.java

@ -0,0 +1,26 @@
1
package io.renren.modules.admin.adminmenu.service;
2
3
import com.baomidou.mybatisplus.extension.service.IService;
4
import io.renren.common.utils.PageUtils;
5
import io.renren.modules.admin.adminmenu.entity.AdminMenuEntity;
6
7
import java.util.Map;
8
import java.util.List;
9
10
/**
11
 * 管理员菜单管理
12
 *
13
 * @author chenshun
14
 * @email sunlightcs@gmail.com
15
 * @date 2020-02-28 19:20:56
16
 */
17
public interface AdminMenuService extends IService<AdminMenuEntity> {
18
19
    PageUtils queryPage(Map<String, Object> params);
20
21
    /**
22
	 * 获取用户菜单列表
23
	 */
24
	List<AdminMenuEntity> getUserMenuList(Long userId);
25
}
26

+ 95 - 0
src/main/java/io/renren/modules/admin/adminmenu/service/impl/AdminMenuServiceImpl.java

@ -0,0 +1,95 @@
1
package io.renren.modules.admin.adminmenu.service.impl;
2
3
import org.springframework.stereotype.Service;
4
import org.springframework.beans.factory.annotation.Autowired;
5
import java.util.Map;
6
import java.util.List;
7
import java.util.ArrayList;
8
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
9
import com.baomidou.mybatisplus.core.metadata.IPage;
10
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
11
import io.renren.common.utils.PageUtils;
12
import io.renren.common.utils.Query;
13
import io.renren.common.utils.Constant;
14
15
import io.renren.modules.admin.adminmenu.dao.AdminMenuDao;
16
import io.renren.modules.admin.adminmenu.entity.AdminMenuEntity;
17
import io.renren.modules.admin.adminmenu.service.AdminMenuService;
18
import io.renren.modules.sys.service.SysUserService;
19
20
21
@Service("adminMenuService")
22
public class AdminMenuServiceImpl extends ServiceImpl<AdminMenuDao, AdminMenuEntity> implements AdminMenuService {
23
	@Autowired
24
	private SysUserService sysUserService;
25
26
    @Override
27
    public PageUtils queryPage(Map<String, Object> params) {
28
        IPage<AdminMenuEntity> page = this.page(
29
                new Query<AdminMenuEntity>().getPage(params),
30
                new QueryWrapper<AdminMenuEntity>()
31
        );
32
33
        return new PageUtils(page);
34
    }
35
36
	public List<AdminMenuEntity> queryListParentId(Long parentId, List<Long> menuIdList) {
37
		List<AdminMenuEntity> menuList = queryListParentId(parentId);
38
		if(menuIdList == null){
39
			return menuList;
40
		}
41
		
42
		List<AdminMenuEntity> userMenuList = new ArrayList<>();
43
		for(AdminMenuEntity menu : menuList){
44
			if(menuIdList.contains(menu.getMenuId())){
45
				userMenuList.add(menu);
46
			}
47
		}
48
		return userMenuList;
49
	}
50
51
	public List<AdminMenuEntity> queryListParentId(Long parentId) {
52
		return baseMapper.queryListParentId(parentId);
53
	}
54
55
	@Override
56
	public List<AdminMenuEntity> getUserMenuList(Long userId) {
57
		//系统管理员,拥有最高权限
58
		if(userId == Constant.SUPER_ADMIN){
59
			return getAllMenuList(null);
60
		}
61
		
62
		//用户菜单列表
63
		List<Long> menuIdList = sysUserService.queryAllMenuId(userId);
64
		return getAllMenuList(menuIdList);
65
	}
66
67
    /**
68
	 * 获取所有菜单列表
69
	 */
70
	private List<AdminMenuEntity> getAllMenuList(List<Long> menuIdList){
71
		//查询根菜单列表
72
		List<AdminMenuEntity> menuList = queryListParentId(0L, menuIdList);
73
		//递归获取子菜单
74
		getMenuTreeList(menuList, menuIdList);
75
		
76
		return menuList;
77
	}
78
79
	/**
80
	 * 递归
81
	 */
82
	private List<AdminMenuEntity> getMenuTreeList(List<AdminMenuEntity> menuList, List<Long> menuIdList){
83
		List<AdminMenuEntity> subMenuList = new ArrayList<AdminMenuEntity>();
84
		
85
		for(AdminMenuEntity entity : menuList){
86
			//目录
87
			if(entity.getType() == Constant.MenuType.CATALOG.getValue()){
88
				entity.setList(getMenuTreeList(queryListParentId(entity.getMenuId(), menuIdList), menuIdList));
89
			}
90
			subMenuList.add(entity);
91
		}
92
		
93
		return subMenuList;
94
	}
95
}

+ 182 - 0
src/main/java/io/renren/modules/admin/employee/controller/EmployeeController.java

@ -0,0 +1,182 @@
1
package io.renren.modules.admin.employee.controller;
2

3
import java.text.ParseException;
4
import java.text.SimpleDateFormat;
5
import java.util.Date;
6
import java.util.HashMap;
7
import java.util.List;
8
import java.util.Map;
9

10
import cn.hutool.core.util.StrUtil;
11
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
12
import com.baomidou.mybatisplus.core.metadata.IPage;
13
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
14
import io.renren.common.annotation.SysLog;
15
import io.renren.common.utils.Query;
16
import org.apache.shiro.authz.annotation.RequiresPermissions;
17
import org.springframework.beans.factory.annotation.Autowired;
18
import org.springframework.web.bind.annotation.*;
19

20
import io.renren.modules.admin.employee.entity.EmployeeEntity;
21
import io.renren.modules.admin.employee.service.EmployeeService;
22
import io.renren.common.utils.PageUtils;
23
import io.renren.common.utils.R;
24

25

26

27
/**
28
 * 
29
 *
30
 * @author chenshun
31
 * @email sunlightcs@gmail.com
32
 * @date 2020-02-17 13:38:28
33
 */
34
@RestController
35
@RequestMapping("admin/employee")
36
public class EmployeeController {
37
    @Autowired
38
    private EmployeeService employeeService;
39

40
//     /**
41
//      * 列表
42
//      */
43
//    @RequestMapping("/list")
44
//    @RequiresPermissions("admin:employee:list")
45
//    public  Map<String,Object> SelectMyPage (Page page,@RequestBody EmployeeEntity employeeEntity){
46
//        Map<String,Object> map = new HashMap<>();
47
//        QueryWrapper<EmployeeEntity> queryWrapper = new QueryWrapper<>();
48
//        if(StrUtil.isNotBlank(employeeEntity.getUsername())){
49
//            queryWrapper.like("e.username",employeeEntity.getUsername());
50
//        }
51
//        if(StrUtil.isNotBlank(employeeEntity.getTruename())){
52
//            queryWrapper.like("e.truename",employeeEntity.getTruename());
53
//        }
54

55
//        IPage<EmployeeEntity> selectMyPage = employeeService.queryPage(page, queryWrapper);
56
//        map.put("page",selectMyPage);
57
//        return map ;
58
//     }
59

60
    /**
61
     * 列表
62
     */
63
    @RequestMapping("/listtest")
64
    @RequiresPermissions("admin:employee:list")
65
    public R listtest(@RequestParam Map<String, Object> params){
66
        String key = (String) params.get("key");
67
        int p = Integer.valueOf(params.get("page").toString());
68
        int limit = Integer.valueOf(params.get("limit").toString());
69
        PageUtils page = employeeService.queryList(p,limit, key);
70
        return R.ok().put("page",page);
71
    }
72

73
    /**
74
     * findAll
75
     */
76
    @RequestMapping("/findAllByisDel/{is_del}")
77
    @RequiresPermissions("admin:employee:findAllByisDel")
78
    public List<EmployeeEntity> findAllByisDel(@PathVariable("is_del") int isDel){
79
        List<EmployeeEntity> employeeEntityList = employeeService.findAllByisDel(isDel);
80
        return  employeeEntityList;
81
    }
82

83
    /**
84
     * 信息
85
     */
86
    @RequestMapping("/info/{id}")
87
    @RequiresPermissions("admin:employee:info")
88
    public R info(@PathVariable("id") Long id){
89
		EmployeeEntity employee = employeeService.getById(id);
90

91
        return R.ok().put("employee", employee);
92
    }
93

94
    /**
95
     * 保存
96
     */
97
    @RequestMapping("/save")
98
    @RequiresPermissions("admin:employee:save")
99
    public R save(@RequestBody EmployeeEntity employee){
100
//        Date date = new Date();
101
////        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
102
////        String format = dateFormat.format(date);
103
        //创建时间
104
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-mm-dd hh:mm:ss");
105
        java.util.Date time = null;
106
        try {
107
            time= sdf.parse(sdf.format(new Date()));
108

109
        } catch (ParseException e) {
110
            e.printStackTrace();
111
        }
112
        employee.setCreateTime(time);
113
		employeeService.save(employee);
114

115
        return R.ok();
116
    }
117

118
    /**
119
     * 修改
120
     */
121
    @RequestMapping("/update")
122
    @RequiresPermissions("admin:employee:update")
123
    public R update(@RequestBody EmployeeEntity employee){
124

125

126
        //修改时间
127
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-mm-dd hh:mm:ss");
128
        java.util.Date time = null;
129
        try {
130
            time= sdf.parse(sdf.format(new Date()));
131

132
        } catch (ParseException e) {
133
            e.printStackTrace();
134
        }
135
        employee.setModifyTime(time);
136
		employeeService.updateById(employee);
137
        return R.ok();
138
    }
139

140
//    /**
141
//     * 删除
142
//     */
143
//    @RequestMapping("/delete")
144
//    @RequiresPermissions("admin:employee:delete")
145
//    public R delete(@RequestBody Long[] ids){
146
//		employeeService.removeByIds(Arrays.asList(ids));
147
//
148
//        return R.ok();
149
//    }
150

151
    /**
152
     * 删除
153
     */
154
    @RequestMapping("/delete/{id}")
155
    @RequiresPermissions("admin:employee:delete")
156
    public R delete(@PathVariable("id") Long id){
157
		//employeeService.removeByIds(Arrays.asList(ids));
158
        boolean flag = employeeService.delete(id);
159
        if(flag){
160
            R.ok("逻辑删除成功");
161
        }
162

163
        return R.ok();
164
    }
165

166
    /**
167
     * 重置密码
168
     */
169
    @SysLog("修改密码")
170
    @PostMapping("/password/{id}")
171
    @RequiresPermissions("admin:employee:password")
172
    public R password(@PathVariable("id") Long id){
173
        boolean flag = employeeService.updatePasswordByid(id);
174

175
        if(flag){
176
            return  R.ok("重置密码成功");
177
        }
178
        return R.ok();
179

180
    }
181

182
}

+ 35 - 0
src/main/java/io/renren/modules/admin/employee/dao/EmployeeDao.java

@ -0,0 +1,35 @@
1
package io.renren.modules.admin.employee.dao;
2

3
import io.renren.modules.admin.employee.entity.EmployeeEntity;
4
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
5
import org.apache.ibatis.annotations.Mapper;
6
import org.apache.ibatis.annotations.Select;
7

8
import java.util.List;
9
import java.util.Map;
10

11
/**
12
 * 
13
 * 
14
 * @author chenshun
15
 * @email sunlightcs@gmail.com
16
 * @date 2020-02-17 13:38:28
17
 */
18
@Mapper
19
public interface EmployeeDao extends BaseMapper<EmployeeEntity> {
20
	List<EmployeeEntity> findAllByisDel(int isDel);
21

22
    boolean updatePasswordByid(Long id);
23

24
    boolean delete(Long id);
25

26
    //多表联查 + 分页
27
    @Select("select e.id,e.truename,e.username,e.password,e.phone,e.email,e.create_time,e.modify_time,e.is_del,c.companyname " +
28
            " from employee e left JOIN company c on e.company_id = c.id" +
29
            " where e.is_del = 0 AND (e.truename like '%${key}%' or e.username like '%${key2}%') limit #{page},#{limit}")
30
    List<Map<String,Object>> queryListBykey(int page, int limit, String key,String key2);
31

32
    @Select("select count(*) from employee where is_del=0 and (truename like '%${key}%' or username like '%${key2}%')")
33
    Integer queryTotalCount(String key,String key2);
34
//    IPage<EmployeeEntity> selectMyPage(Page page, Wrapper<EmployeeEntity> queryWrapper);
35
}

+ 185 - 0
src/main/java/io/renren/modules/admin/employee/entity/EmployeeEntity.java

@ -0,0 +1,185 @@
1
package io.renren.modules.admin.employee.entity;
2

3
import com.baomidou.mybatisplus.annotation.TableId;
4
import com.baomidou.mybatisplus.annotation.TableLogic;
5
import com.baomidou.mybatisplus.annotation.TableName;
6

7
import java.io.Serializable;
8
import java.util.Date;
9
import lombok.Data;
10

11
/**
12
 * 
13
 * 
14
 * @author chenshun
15
 * @email sunlightcs@gmail.com
16
 * @date 2020-02-17 13:38:28
17
 */
18
@Data
19
@TableName("employee")
20
public class EmployeeEntity implements Serializable {
21
	private static final long serialVersionUID = 1L;
22

23
	/**
24
	 * 员工id (员工表)
25
	 */
26
	@TableId
27
	private Long id;
28
	/**
29
	 * 账号
30
	 */
31
	private String username;
32
	/**
33
	 * 密码
34
	 */
35
	private String password;
36
	/**
37
	 * 姓名
38
	 */
39
	private String truename;
40
	/**
41
	 * 单位id
42
	 */
43
	private Long companyId;
44
	/**
45
	 * 角色id(控制权限)
46
	 */
47
	private Long roleId;
48
	/**
49
	 * 部门id
50
	 */
51
	private Long departmentId;
52
	/**
53
	 * 职位id
54
	 */
55
	private Long positionId;
56
	/**
57
	 * 联系电话
58
	 */
59
	private String phone;
60
	/**
61
	 * 邮箱
62
	 */
63
	private String email;
64
	/**
65
	 * 创建时间
66
	 */
67
	private Date createTime;
68
	/**
69
	 * 修改时间
70
	 */
71
	private Date modifyTime;
72
	/**
73
	 * 是否被删除 状态  0:正常   1:删除
74
	 */
75
	@TableLogic
76
	private Integer isDel;
77

78
	public static long getSerialVersionUID() {
79
		return serialVersionUID;
80
	}
81

82
	public Long getId() {
83
		return id;
84
	}
85

86
	public void setId(Long id) {
87
		this.id = id;
88
	}
89

90
	public String getUsername() {
91
		return username;
92
	}
93

94
	public void setUsername(String username) {
95
		this.username = username;
96
	}
97

98
	public String getPassword() {
99
		return password;
100
	}
101

102
	public void setPassword(String password) {
103
		this.password = password;
104
	}
105

106
	public String getTruename() {
107
		return truename;
108
	}
109

110
	public void setTruename(String truename) {
111
		this.truename = truename;
112
	}
113

114
	public Long getCompanyId() {
115
		return companyId;
116
	}
117

118
	public void setCompanyId(Long companyId) {
119
		this.companyId = companyId;
120
	}
121

122
	public Long getRoleId() {
123
		return roleId;
124
	}
125

126
	public void setRoleId(Long roleId) {
127
		this.roleId = roleId;
128
	}
129

130
	public Long getDepartmentId() {
131
		return departmentId;
132
	}
133

134
	public void setDepartmentId(Long departmentId) {
135
		this.departmentId = departmentId;
136
	}
137

138
	public Long getPositionId() {
139
		return positionId;
140
	}
141

142
	public void setPositionId(Long positionId) {
143
		this.positionId = positionId;
144
	}
145

146
	public String getPhone() {
147
		return phone;
148
	}
149

150
	public void setPhone(String phone) {
151
		this.phone = phone;
152
	}
153

154
	public String getEmail() {
155
		return email;
156
	}
157

158
	public void setEmail(String email) {
159
		this.email = email;
160
	}
161

162
	public Date getCreateTime() {
163
		return createTime;
164
	}
165

166
	public void setCreateTime(Date createTime) {
167
		this.createTime = createTime;
168
	}
169

170
	public Date getModifyTime() {
171
		return modifyTime;
172
	}
173

174
	public void setModifyTime(Date modifyTime) {
175
		this.modifyTime = modifyTime;
176
	}
177

178
	public Integer getIsDel() {
179
		return isDel;
180
	}
181

182
	public void setIsDel(Integer isDel) {
183
		this.isDel = isDel;
184
	}
185
}

+ 37 - 0
src/main/java/io/renren/modules/admin/employee/service/EmployeeService.java

@ -0,0 +1,37 @@
1
package io.renren.modules.admin.employee.service;
2

3
import com.baomidou.mybatisplus.core.conditions.Wrapper;
4
import com.baomidou.mybatisplus.core.metadata.IPage;
5
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
6
import com.baomidou.mybatisplus.extension.service.IService;
7
import io.renren.common.utils.PageUtils;
8
import io.renren.modules.admin.employee.entity.EmployeeEntity;
9
import javafx.scene.control.Pagination;
10
import org.apache.ibatis.annotations.Param;
11

12

13
import java.util.List;
14
import java.util.Map;
15

16
/**
17
 * 
18
 *
19
 * @author chenshun
20
 * @email sunlightcs@gmail.com
21
 * @date 2020-02-17 13:38:28
22
 */
23
public interface EmployeeService extends IService<EmployeeEntity> {
24

25
    PageUtils queryPage(Map<String, Object> params);
26

27
    List<EmployeeEntity> findAllByisDel(int isDel);
28

29
    boolean updatePasswordByid(Long id);
30

31
    boolean delete(Long id);
32

33
    //多表联查 + 分页
34
   PageUtils queryList(int page,int limit,String key);
35

36
}
37


+ 70 - 0
src/main/java/io/renren/modules/admin/employee/service/impl/EmployeeServiceImpl.java

@ -0,0 +1,70 @@
1
package io.renren.modules.admin.employee.service.impl;
2

3
import com.baomidou.mybatisplus.core.conditions.Wrapper;
4
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
5
import javafx.scene.control.Pagination;
6
import org.apache.commons.lang.StringUtils;
7
import org.springframework.beans.factory.annotation.Autowired;
8
import org.springframework.stereotype.Service;
9

10
import java.util.List;
11
import java.util.Map;
12
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
13
import com.baomidou.mybatisplus.core.metadata.IPage;
14
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
15
import io.renren.common.utils.PageUtils;
16
import io.renren.common.utils.Query;
17

18
import io.renren.modules.admin.employee.dao.EmployeeDao;
19
import io.renren.modules.admin.employee.entity.EmployeeEntity;
20
import io.renren.modules.admin.employee.service.EmployeeService;
21

22

23
@Service("employeeService")
24
public class EmployeeServiceImpl extends ServiceImpl<EmployeeDao, EmployeeEntity> implements EmployeeService {
25
    @Override
26
    public PageUtils queryPage(Map<String, Object> params) {
27
        String key = (String) params.get("key");
28
        IPage<EmployeeEntity> page = this.page(
29
                new Query<EmployeeEntity>().getPage(params),
30
                new QueryWrapper<EmployeeEntity>()
31
                .like(StringUtils.isNotBlank(key),"username",key)
32
                        .or()
33
                .like(StringUtils.isNotBlank(key),"truename",key)
34
        );
35

36
        return new PageUtils(page);
37
    }
38

39
    @Override
40
    public List<EmployeeEntity> findAllByisDel(int isDel) {
41
        return  baseMapper.findAllByisDel(isDel);
42
    }
43

44
    @Override
45
    public boolean updatePasswordByid(Long id) {
46
        return baseMapper.updatePasswordByid(id);
47
    }
48

49
    @Override
50
    public boolean delete(Long id) {
51
        return baseMapper.delete(id);
52
    }
53

54
    @Override
55
    public PageUtils queryList(int page, int limit, String key) {
56
        System.out.println(page);
57
        System.out.println(limit);
58
        System.out.println(key);
59
        List<Map<String, Object>> mList = baseMapper.queryListBykey(page, limit, key, key);
60
       int total = baseMapper.queryTotalCount(key, key);
61

62

63
        return new PageUtils(mList,total,limit,page);
64
    }
65

66
//    @Override
67
//    public IPage<EmployeeEntity> selectMyPage(Page page, Wrapper<EmployeeEntity> queryWrapper) {
68
//        return baseMapper.selectMyPage(page,queryWrapper);
69
//    }
70
}

+ 13 - 0
src/main/java/io/renren/modules/admin/meeting/controller/MeetingController.java

@ -43,6 +43,19 @@ public class MeetingController {
43 43
        return R.ok().put("page", page);
44 44
    }
45 45
46
    /**
47
     * 列表2
48
     */
49
    @RequestMapping("/listtest")
50
    @RequiresPermissions("admin:meeting:list")
51
    public R listtest(@RequestParam Map<String, Object> params){
52
        String key = (String) params.get("key");
53
        int p = Integer.valueOf(params.get("page").toString());
54
        int l = Integer.valueOf(params.get("limit").toString());
55
        PageUtils page = meetingService.queryList(p, l, key);
56
57
        return R.ok().put("page", page);
58
    }
46 59
47 60
    /**
48 61
     * 信息

+ 11 - 0
src/main/java/io/renren/modules/admin/meeting/dao/MeetingDao.java

@ -1,9 +1,14 @@
1 1
package io.renren.modules.admin.meeting.dao;
2 2
3 3
import io.renren.modules.admin.meeting.entity.MeetingEntity;
4
5
import java.util.List;
6
import java.util.Map;
7
4 8
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
5 9
import org.apache.ibatis.annotations.Mapper;
6 10
import org.apache.ibatis.annotations.Update;
11
import org.apache.ibatis.annotations.Select;
7 12
8 13
/**
9 14
 * 会议表
@ -16,4 +21,10 @@ import org.apache.ibatis.annotations.Update;
16 21
public interface MeetingDao extends BaseMapper<MeetingEntity> {
17 22
	@Update("update meeting set is_check=#{isCheck} where id=#{id}")
18 23
    int updateStatus(Long id, Integer isCheck);
24
25
    @Select("select m.id,c.companyname,m.name_cn,m.address,m.start_time from meeting as m left JOIN company as c on m.company_id = c.id where m.is_del = 0 and (m.name_cn LIKE '%${key}%' or m.name_en LIKE '%${key2}%') limit #{page},#{limit} ")
26
    List<Map<String, Object>> queryCN(int page, int limit, String key, String key2);
27
28
    @Select("select count(*) from meeting  where is_del = 0 and (name_cn LIKE '%${key}%' or name_en LIKE '%${key2}%')")
29
    Integer queryCNCOUNTS(String key, String key2);
19 30
}

+ 6 - 1
src/main/java/io/renren/modules/admin/meeting/service/MeetingService.java

@ -15,7 +15,12 @@ import java.util.Map;
15 15
 */
16 16
public interface MeetingService extends IService<MeetingEntity> {
17 17
18
    PageUtils queryPage(Map<String, Object> params);
18
	PageUtils queryPage(Map<String, Object> params);
19
	
20
		/**
21
	 * 	带单位分页
22
	 */
23
	PageUtils queryList(int page, int limit, String key);
19 24
20 25
    /**
21 26
	 * 删除用户(逻辑删除)

+ 12 - 0
src/main/java/io/renren/modules/admin/meeting/service/impl/MeetingServiceImpl.java

@ -2,6 +2,7 @@ package io.renren.modules.admin.meeting.service.impl;
2 2
3 3
import org.springframework.stereotype.Service;
4 4
import java.util.Arrays;
5
import java.util.List;
5 6
import java.util.Map;
6 7
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
7 8
import com.baomidou.mybatisplus.core.metadata.IPage;
@ -27,6 +28,17 @@ public class MeetingServiceImpl extends ServiceImpl<MeetingDao, MeetingEntity> i
27 28
        return new PageUtils(page);
28 29
    }
29 30
31
    @Override
32
    public PageUtils queryList(int page, int limit, String key) {
33
        System.out.println(page);
34
        System.out.println(limit);
35
        System.out.println(key);
36
        List<Map<String, Object>> mList=baseMapper.queryCN(page, limit, key, key);
37
        Integer mc = baseMapper.queryCNCOUNTS(key, key);
38
39
        return new PageUtils(mList, mc, limit, page);
40
    }
41
30 42
    @Override
31 43
    public void delete(Long[] ids) {
32 44
        baseMapper.deleteBatchIds(Arrays.asList(ids));

+ 222 - 0
src/main/java/io/renren/modules/sys/controller/FileManagerController.java

@ -0,0 +1,222 @@
1
package io.renren.modules.sys.controller;
2
3
import java.io.File;
4
import java.io.IOException;
5
import java.time.LocalDateTime;
6
import java.time.format.DateTimeFormatter;
7
import java.util.ArrayList;
8
import java.util.HashMap;
9
import java.util.Map;
10
import java.util.UUID;
11
12
import javax.servlet.http.HttpServletRequest;
13
14
import org.springframework.beans.factory.annotation.Value;
15
import org.springframework.context.annotation.Configuration;
16
import org.springframework.web.bind.annotation.PostMapping;
17
import org.springframework.web.bind.annotation.RequestMapping;
18
import org.springframework.web.bind.annotation.RequestParam;
19
import org.springframework.web.bind.annotation.RestController;
20
import org.springframework.web.multipart.MultipartFile;
21
22
import io.renren.common.utils.R;
23
import net.coobird.thumbnailator.Thumbnails;
24
25
/**
26
 * Captcha by huwhois time 2019/11/22
27
 */
28
@RestController
29
@RequestMapping("/sys/filemanager")
30
@Configuration
31
public class FileManagerController {
32
33
    @Value("${file.datapath}")
34
    private String dataPath; // 读取配置文件中的指定目录
35
36
    @Value("${file.uploadFolder}")
37
    private String uploadFolder; // 读取配置文件中的指定目录
38
39
    @PostMapping("/uploadimg")
40
    public R uploadImage(@RequestParam(value = "upload_file") MultipartFile file, HttpServletRequest request) throws IOException {
41
        boolean isthumb = false;
42
        String thumb = request.getParameter("isthumb");
43
        if (thumb != null && thumb != "" && thumb.equals("1")) {
44
            isthumb = true;
45
        }
46
        // 根据相对路径转化为真实路径
47
        // String rootpath = request.getSession().getServletContext().getRealPath(File.separator);// 获得web应用的绝对路径
48
        // File createFile = new File(rootpath + "../data/upload/");
49
        String useUploadPath;   // 文件上传使用的目录
50
        String activePath = request.getParameter("activepath"); 
51
        if (activePath != null && activePath != "") {
52
            // 上传到指定目录
53
            useUploadPath = activePath + "/";
54
        } else {
55
            // 使用配置文件中的指定上传目录与当前年月新建文件夹
56
            LocalDateTime ldt = LocalDateTime.now();
57
            String today = ldt.format(DateTimeFormatter.BASIC_ISO_DATE);
58
            useUploadPath = uploadFolder  + "/" + today + "/";
59
        }
60
61
        // System.out.println(useUploadPath);
62
        String picDir = dataPath + useUploadPath;   // 文件绝对路径
63
64
        File createFile = new File(picDir);
65
        if (!createFile.exists()) {// 判断文件是否存在如果不存在则自动创建文件夹
66
            createFile.mkdir();
67
        }
68
        // System.out.println(picDir);
69
        String fileOldName = file.getOriginalFilename();
70
        // 上传的图片只允许是 png、jpg 或 gif 中的格式
71
        if (file.getOriginalFilename().contains(".png") || file.getOriginalFilename().contains(".jpg") || file.getOriginalFilename().contains(".gif")) {
72
            String uuid = UUID.randomUUID().toString().replace("-", "");// 随机生成一个唯一性的id 文件不重名
73
            String suffix = fileOldName.substring(fileOldName.lastIndexOf(".") + 1);
74
            String newFilename = uuid + "." + suffix;
75
            File f = new File(picDir + newFilename);
76
            if (f.exists()) {//上传的文件已经存在,则提示用户重新上传 apk 或者重命名
77
                return R.error("上传的文件已经存在,则提示用户重新上传 apk 或者重命名");
78
            } else {
79
                Map<String, Object> result = new HashMap<String, Object>();
80
81
                file.transferTo(f); // 将上传的文件写入到系统中
82
                if (isthumb) {
83
                    String thumbFilaname = uuid + "_200." + suffix;
84
                    Thumbnails.of(picDir + newFilename).width(200).toFile(picDir + thumbFilaname);
85
                    result.put("thumb", useUploadPath + thumbFilaname);
86
                }
87
                result.put("picname", useUploadPath + newFilename);
88
             
89
                return  R.ok(result);
90
            }
91
        } else {
92
            return R.error("上传文件失败");
93
        }
94
    }
95
96
    /*
97
     * 读取指定路径下的文件名和目录名
98
     */
99
    @RequestMapping("/list")
100
    public R list(HttpServletRequest request) {
101
        Map<String, Object> result = new HashMap<String, Object>();
102
        String activepath = request.getParameter("activepath");
103
        // System.out.println(activepath);
104
        String dir = "";
105
        if (activepath!=null && activepath!="") {
106
            dir = activepath;
107
        }
108
109
        File file = new File(dataPath + dir);
110
        // System.out.println(dataPath +  dir);
111
        File[] fileList = file.listFiles();
112
113
        ArrayList<String> dList = new ArrayList<>();
114
        ArrayList<Map<String, Object>> fList = new ArrayList<>();
115
116
        for (int i = 0; i < fileList.length; i++) {
117
            if (fileList[i].isDirectory()) {
118
                String fileName = fileList[i].getName();
119
                dList.add(fileName);
120
                // System.out.println("文件:" + fileName);       
121
                // System.out.println(fileName);     
122
            }
123
            
124
            if (fileList[i].isFile()) {
125
                File ifile = fileList[i];
126
                String fileName = ifile.getName();
127
                String suffix = fileName.substring(fileName.lastIndexOf(".") + 1);
128
                long size = ifile.length();
129
                long time = ifile.lastModified();
130
                // Map<String, Object> ofile = new HashMap<>();
131
                Map<String, Object> ofile = new HashMap<String, Object>();
132
                ofile.put("fileName", fileName);
133
                ofile.put("suffix", suffix);
134
                ofile.put("size", size);
135
                ofile.put("time", time);
136
                
137
                fList.add(ofile);
138
                // System.out.println("文件:" + fileName);       
139
                // System.out.println(fileName);       
140
            }
141
        }
142
        result.put("fList", fList);
143
        result.put("dList", dList);
144
        result.put("activepath", dir);
145
        // System.out.println(dir);
146
        return R.ok(result);
147
    }
148
149
    /**
150
	 * 删除文件
151
	 * 
152
	 * @param pathname
153
	 * @return
154
	 * @throws IOException
155
	 */
156
	public static boolean deleteFile(String pathname){
157
		boolean result = false;
158
		File file = new File(pathname);
159
		if (file.exists()) {
160
			file.delete();
161
			result = true;
162
		}
163
		return result;
164
    }
165
    
166
    /**
167
	 * 删除目录
168
	 * 
169
	 * @param pathname
170
	 * @return
171
	 * @throws IOException
172
	 */
173
	public static boolean deleteDir(String pathname){
174
		boolean result = false;
175
		File dir = new File(pathname);
176
		if (dir.exists()) {
177
            File[] files = dir.listFiles();
178
            if (null == files) {
179
                dir.delete();
180
                result = true;
181
            }
182
		}
183
		return result;
184
    }
185
186
    @PostMapping("/delete")
187
    public R deleteFile(String activePath, String fileName){
188
        boolean result = false;
189
        String dir = "";
190
        if (activePath!=null || activePath!="") {
191
            dir = activePath;
192
        }
193
        
194
        String pathname = dataPath + dir + "/" + fileName;
195
        // System.out.println(pathname);
196
        File file = new File(pathname);
197
        if (!file.exists()) {
198
            return R.error(1, "文件or文件夹不存在");
199
        }
200
201
        if (file.isDirectory()) {
202
            File[] files = file.listFiles();
203
            if (null != files) {
204
                for (File f : files) {
205
                    if (f.exists()) {
206
                        f.delete();
207
                    }
208
                }
209
            }
210
            result = file.delete();
211
        }
212
        
213
        if (file.isFile()) {
214
            result = file.delete();
215
        }
216
        
217
        if (!result) {
218
            return R.error("删除失败");
219
        }
220
        return R.ok();
221
    }
222
}

+ 0 - 1
src/main/java/io/renren/modules/sys/controller/SysConfigController.java

@ -8,7 +8,6 @@
8 8
9 9
package io.renren.modules.sys.controller;
10 10
11
12 11
import io.renren.common.annotation.SysLog;
13 12
import io.renren.common.utils.PageUtils;
14 13
import io.renren.common.utils.R;

+ 5 - 1
src/main/resources/application-dev.yml

@ -33,7 +33,6 @@ spring:
33 33
                    config:
34 34
                        multi-statement-allow: true
35 35
36
37 36
##多数据源的配置
38 37
#dynamic:
39 38
#  datasource:
@ -47,3 +46,8 @@ spring:
47 46
#      url: jdbc:postgresql://localhost:5432/renren_security
48 47
#      username: renren
49 48
#      password: 123456
49
50
## 图片文件目录配置
51
file:
52
    datapath: /web/static
53
    uploadFolder: /uploads