系统会员使用sysUser。删除课件
This commit is contained in:
parent
604873a764
commit
0c26006436
|
|
@ -1,138 +0,0 @@
|
|||
package com.ruoyi.train.courseware.controller;
|
||||
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.base.AjaxResult;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import com.ruoyi.train.courseware.domain.TrainCoursewareCategory;
|
||||
import com.ruoyi.train.courseware.service.ITrainCoursewareCategoryService;
|
||||
import com.ruoyi.framework.web.base.BaseController;
|
||||
import com.ruoyi.framework.web.util.ShiroUtils;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.ModelMap;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 课件分类信息
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping("/train/courseware/category")
|
||||
public class TrainCoursewareCategoryController extends BaseController {
|
||||
private String prefix = "train/courseware/category";
|
||||
|
||||
@Autowired
|
||||
private ITrainCoursewareCategoryService trainCoursewareCategoryService;
|
||||
|
||||
@RequiresPermissions("train:courseware:category:view")
|
||||
@GetMapping()
|
||||
public String category() {
|
||||
return prefix + "/category";
|
||||
}
|
||||
|
||||
@RequiresPermissions("train:courseware:category:list")
|
||||
@GetMapping("/list")
|
||||
@ResponseBody
|
||||
public List<TrainCoursewareCategory> list(TrainCoursewareCategory category) {
|
||||
List<TrainCoursewareCategory> categoryList = trainCoursewareCategoryService.selectCategoryList( category );
|
||||
return categoryList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增课件分类
|
||||
*/
|
||||
@GetMapping("/add/{parentId}")
|
||||
public String add(@PathVariable("parentId") Long parentId, ModelMap mmap) {
|
||||
mmap.put( "category", trainCoursewareCategoryService.selectCategoryById( parentId ) );
|
||||
return prefix + "/add";
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增保存课件分类
|
||||
*/
|
||||
@Log(title = "课件分类管理", businessType = BusinessType.INSERT)
|
||||
@RequiresPermissions("train:courseware:category:add")
|
||||
@PostMapping("/add")
|
||||
@ResponseBody
|
||||
public AjaxResult addSave(TrainCoursewareCategory category) {
|
||||
category.setCreateBy( ShiroUtils.getLoginName() );
|
||||
return toAjax( trainCoursewareCategoryService.insertCategory( category ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改
|
||||
*/
|
||||
@GetMapping("/edit/{id}")
|
||||
public String edit(@PathVariable("id") Long id, ModelMap mmap) {
|
||||
TrainCoursewareCategory category = trainCoursewareCategoryService.selectCategoryById( id );
|
||||
if (StringUtils.isNotNull( category ) && 100L == id) {
|
||||
category.setParentName( "无" );
|
||||
}
|
||||
mmap.put( "category", category );
|
||||
return prefix + "/edit";
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存
|
||||
*/
|
||||
@Log(title = "课件分类管理", businessType = BusinessType.UPDATE)
|
||||
@RequiresPermissions("train:courseware:category:edit")
|
||||
@PostMapping("/edit")
|
||||
@ResponseBody
|
||||
public AjaxResult editSave(TrainCoursewareCategory category) {
|
||||
category.setUpdateBy( ShiroUtils.getLoginName() );
|
||||
return toAjax( trainCoursewareCategoryService.updateCategory( category ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*/
|
||||
@Log(title = "课件分类管理", businessType = BusinessType.DELETE)
|
||||
@RequiresPermissions("train:courseware:category:remove")
|
||||
@PostMapping("/remove/{id}")
|
||||
@ResponseBody
|
||||
public AjaxResult remove(@PathVariable("id") Long id) {
|
||||
if (trainCoursewareCategoryService.selectCategoryCount( id ) > 0) {
|
||||
return error( 1, "存在下级课件分类,不允许删除" );
|
||||
}
|
||||
if (trainCoursewareCategoryService.checkCategoryExistCourseware( id )) {
|
||||
return error( 1, "课件分类存在课件,不允许删除" );
|
||||
}
|
||||
return toAjax( trainCoursewareCategoryService.deleteCategoryById( id ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验课件分类名称
|
||||
*/
|
||||
@PostMapping("/checkCategoryNameUnique")
|
||||
@ResponseBody
|
||||
public String checkCategoryNameUnique(TrainCoursewareCategory category) {
|
||||
return trainCoursewareCategoryService.checkCategoryNameUnique( category );
|
||||
}
|
||||
|
||||
/**
|
||||
* 选择课件分类树
|
||||
*/
|
||||
@GetMapping("/selectCategoryTree/{id}")
|
||||
public String selectCategoryTree(@PathVariable("id") Long id, ModelMap mmap) {
|
||||
mmap.put( "category", trainCoursewareCategoryService.selectCategoryById( id ) );
|
||||
return prefix + "/tree";
|
||||
}
|
||||
|
||||
/**
|
||||
* 加载课件分类列表树
|
||||
*/
|
||||
@GetMapping("/treeData")
|
||||
@ResponseBody
|
||||
public List<Map<String, Object>> treeData() {
|
||||
List<Map<String, Object>> tree = trainCoursewareCategoryService.selectCategoryTree();
|
||||
return tree;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,133 +0,0 @@
|
|||
package com.ruoyi.train.courseware.controller;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.ruoyi.train.courseware.domain.TrainCourseware;
|
||||
import com.ruoyi.train.courseware.domain.TrainCoursewareCategory;
|
||||
import com.ruoyi.train.courseware.service.ITrainCoursewareCategoryService;
|
||||
import com.ruoyi.train.courseware.service.ITrainCoursewareService;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.ModelMap;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.framework.web.base.BaseController;
|
||||
import com.ruoyi.framework.web.page.TableDataInfo;
|
||||
import com.ruoyi.common.base.AjaxResult;
|
||||
import com.ruoyi.common.utils.ExcelUtil;
|
||||
|
||||
/**
|
||||
* 课件 信息操作处理
|
||||
*
|
||||
* @author zhujj
|
||||
* @date 2018-12-23
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping("/train/trainCourseware")
|
||||
public class TrainCoursewareController extends BaseController
|
||||
{
|
||||
private String prefix = "train/trainCourseware";
|
||||
|
||||
@Autowired
|
||||
private ITrainCoursewareService trainCoursewareService;
|
||||
|
||||
@Autowired
|
||||
private ITrainCoursewareCategoryService trainCoursewareCategoryService;
|
||||
@RequiresPermissions("train:trainCourseware:view")
|
||||
@GetMapping()
|
||||
public String trainCourseware()
|
||||
{
|
||||
return prefix + "/trainCourseware";
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询课件列表
|
||||
*/
|
||||
@RequiresPermissions("train:trainCourseware:list")
|
||||
@PostMapping("/list")
|
||||
@ResponseBody
|
||||
public TableDataInfo list(TrainCourseware trainCourseware)
|
||||
{
|
||||
List<TrainCourseware> list = trainCoursewareService.selectTrainCoursewarePage(trainCourseware);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 导出课件列表
|
||||
*/
|
||||
@RequiresPermissions("train:trainCourseware:export")
|
||||
@PostMapping("/export")
|
||||
@ResponseBody
|
||||
public AjaxResult export(TrainCourseware trainCourseware)
|
||||
{
|
||||
List<TrainCourseware> list = trainCoursewareService.selectTrainCoursewareList(trainCourseware);
|
||||
ExcelUtil<TrainCourseware> util = new ExcelUtil<TrainCourseware>(TrainCourseware.class);
|
||||
return util.exportExcel(list, "trainCourseware");
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增课件
|
||||
*/
|
||||
@GetMapping("/add")
|
||||
public String add()
|
||||
{
|
||||
return prefix + "/add";
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增保存课件
|
||||
*/
|
||||
@RequiresPermissions("train:trainCourseware:add")
|
||||
@Log(title = "课件", businessType = BusinessType.INSERT)
|
||||
@PostMapping("/add")
|
||||
@ResponseBody
|
||||
public AjaxResult addSave(TrainCourseware trainCourseware)
|
||||
{
|
||||
return toAjax(trainCoursewareService.insert(trainCourseware));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改课件
|
||||
*/
|
||||
@GetMapping("/edit/{id}")
|
||||
public String edit(@PathVariable("id") Integer id, ModelMap mmap)
|
||||
{
|
||||
TrainCourseware trainCourseware = trainCoursewareService.selectById(id);
|
||||
TrainCoursewareCategory category = trainCoursewareCategoryService.selectCategoryById((long)trainCourseware.getTrainCoursewareCategoryId());
|
||||
mmap.put("trainCourseware", trainCourseware);
|
||||
mmap.put("category", category);
|
||||
return prefix + "/edit";
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改保存课件
|
||||
*/
|
||||
@RequiresPermissions("train:trainCourseware:edit")
|
||||
@Log(title = "课件", businessType = BusinessType.UPDATE)
|
||||
@PostMapping("/edit")
|
||||
@ResponseBody
|
||||
public AjaxResult editSave(TrainCourseware trainCourseware)
|
||||
{
|
||||
return toAjax(trainCoursewareService.updateById(trainCourseware));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除课件
|
||||
*/
|
||||
@RequiresPermissions("train:trainCourseware:remove")
|
||||
@Log(title = "课件", businessType = BusinessType.DELETE)
|
||||
@PostMapping( "/remove")
|
||||
@ResponseBody
|
||||
public AjaxResult remove(String ids)
|
||||
{
|
||||
return toAjax(trainCoursewareService.deleteByIds(ids));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,43 +0,0 @@
|
|||
package com.ruoyi.train.courseware.controller;
|
||||
|
||||
import com.aliyuncs.DefaultAcsClient;
|
||||
import com.aliyuncs.exceptions.ClientException;
|
||||
import com.aliyuncs.exceptions.ServerException;
|
||||
import com.aliyuncs.profile.DefaultProfile;
|
||||
import com.aliyuncs.vod.model.v20170321.GetVideoPlayAuthRequest;
|
||||
import com.aliyuncs.vod.model.v20170321.GetVideoPlayAuthResponse;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
|
||||
@Controller
|
||||
@RequestMapping("/train/courseware/video")
|
||||
public class VideoController {
|
||||
|
||||
@GetMapping("")
|
||||
public GetVideoPlayAuthResponse authority(){
|
||||
DefaultProfile profile = DefaultProfile.getProfile("cn-shanghai", "LTAIo1i5PQB4pFme", "NyiVe3pqbVOMnwMQxnOkV39KrTx2jR");
|
||||
DefaultAcsClient client = new DefaultAcsClient(profile);
|
||||
GetVideoPlayAuthResponse response = getVideoPlayAuth(client);
|
||||
System.out.println(response.getPlayAuth());
|
||||
System.out.println(response.getVideoMeta());
|
||||
return response;
|
||||
}
|
||||
|
||||
|
||||
private GetVideoPlayAuthResponse getVideoPlayAuth(DefaultAcsClient client) {
|
||||
GetVideoPlayAuthRequest request = new GetVideoPlayAuthRequest();
|
||||
request.setVideoId("ID3dbb151b73c34b678efff61d3d50d999");
|
||||
GetVideoPlayAuthResponse response = null;
|
||||
try {
|
||||
response = client.getAcsResponse(request);
|
||||
} catch (ServerException e) {
|
||||
throw new RuntimeException("GetVideoPlayAuthRequest Server failed");
|
||||
} catch (ClientException e) {
|
||||
throw new RuntimeException("GetVideoPlayAuthRequest Client failed");
|
||||
}
|
||||
response.getPlayAuth(); // 播放凭证
|
||||
response.getVideoMeta(); // 视频Meta信息
|
||||
return response;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,236 +0,0 @@
|
|||
package com.ruoyi.train.courseware.domain;
|
||||
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
|
||||
import javax.persistence.Id;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 课件表 train_courseware
|
||||
*
|
||||
* @author zhujj
|
||||
* @date 2018-12-23
|
||||
*/
|
||||
public class TrainCourseware
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** */
|
||||
@Id
|
||||
private Integer id;
|
||||
/** 部门ID */
|
||||
private Integer deptId;
|
||||
/** 课件分类ID */
|
||||
private Integer trainCoursewareCategoryId;
|
||||
/** 部门名称 */
|
||||
private String name;
|
||||
/** 课件类型(1-文档,2-图文,3-视频,4-音频,5-图片,6-外部链接) */
|
||||
private String type;
|
||||
/** 学习时常(分钟) */
|
||||
private Integer learnTime;
|
||||
/** 是否公开(1-是,0-不是) */
|
||||
private String state;
|
||||
/** 地址 */
|
||||
private String url;
|
||||
/** 正文 */
|
||||
private String content;
|
||||
/** 删除标志(0代表存在 2代表删除) */
|
||||
private String delFlag;
|
||||
/** 创建者 */
|
||||
private String createBy;
|
||||
/** 创建时间 */
|
||||
private Date createTime;
|
||||
/** 更新者 */
|
||||
private String updateBy;
|
||||
/** 更新时间 */
|
||||
private Date updateTime;
|
||||
/** 备注 */
|
||||
private String remark;
|
||||
|
||||
/** 设置 */
|
||||
public void setId(Integer id)
|
||||
{
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
/** 获取 */
|
||||
public Integer getId()
|
||||
{
|
||||
return id;
|
||||
}
|
||||
/** 设置部门ID */
|
||||
public void setDeptId(Integer deptId)
|
||||
{
|
||||
this.deptId = deptId;
|
||||
}
|
||||
|
||||
/** 获取部门ID */
|
||||
public Integer getDeptId()
|
||||
{
|
||||
return deptId;
|
||||
}
|
||||
/** 设置课件分类ID */
|
||||
public void setTrainCoursewareCategoryId(Integer trainCoursewareCategoryId)
|
||||
{
|
||||
this.trainCoursewareCategoryId = trainCoursewareCategoryId;
|
||||
}
|
||||
|
||||
/** 获取课件分类ID */
|
||||
public Integer getTrainCoursewareCategoryId()
|
||||
{
|
||||
return trainCoursewareCategoryId;
|
||||
}
|
||||
/** 设置部门名称 */
|
||||
public void setName(String name)
|
||||
{
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
/** 获取部门名称 */
|
||||
public String getName()
|
||||
{
|
||||
return name;
|
||||
}
|
||||
/** 设置课件类型(1-文档,2-图文,3-视频,4-音频,5-图片,6-外部链接) */
|
||||
public void setType(String type)
|
||||
{
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
/** 获取课件类型(1-文档,2-图文,3-视频,4-音频,5-图片,6-外部链接) */
|
||||
public String getType()
|
||||
{
|
||||
return type;
|
||||
}
|
||||
/** 设置学习时常(分钟) */
|
||||
public void setLearnTime(Integer learnTime)
|
||||
{
|
||||
this.learnTime = learnTime;
|
||||
}
|
||||
|
||||
/** 获取学习时常(分钟) */
|
||||
public Integer getLearnTime()
|
||||
{
|
||||
return learnTime;
|
||||
}
|
||||
/** 设置是否公开(1-是,0-不是) */
|
||||
public void setState(String state)
|
||||
{
|
||||
this.state = state;
|
||||
}
|
||||
|
||||
/** 获取是否公开(1-是,0-不是) */
|
||||
public String getState()
|
||||
{
|
||||
return state;
|
||||
}
|
||||
/** 设置地址 */
|
||||
public void setUrl(String url)
|
||||
{
|
||||
this.url = url;
|
||||
}
|
||||
|
||||
/** 获取地址 */
|
||||
public String getUrl()
|
||||
{
|
||||
return url;
|
||||
}
|
||||
/** 设置正文 */
|
||||
public void setContent(String content)
|
||||
{
|
||||
this.content = content;
|
||||
}
|
||||
|
||||
/** 获取正文 */
|
||||
public String getContent()
|
||||
{
|
||||
return content;
|
||||
}
|
||||
/** 设置删除标志(0代表存在 2代表删除) */
|
||||
public void setDelFlag(String delFlag)
|
||||
{
|
||||
this.delFlag = delFlag;
|
||||
}
|
||||
|
||||
/** 获取删除标志(0代表存在 2代表删除) */
|
||||
public String getDelFlag()
|
||||
{
|
||||
return delFlag;
|
||||
}
|
||||
/** 设置创建者 */
|
||||
public void setCreateBy(String createBy)
|
||||
{
|
||||
this.createBy = createBy;
|
||||
}
|
||||
|
||||
/** 获取创建者 */
|
||||
public String getCreateBy()
|
||||
{
|
||||
return createBy;
|
||||
}
|
||||
/** 设置创建时间 */
|
||||
public void setCreateTime(Date createTime)
|
||||
{
|
||||
this.createTime = createTime;
|
||||
}
|
||||
|
||||
/** 获取创建时间 */
|
||||
public Date getCreateTime()
|
||||
{
|
||||
return createTime;
|
||||
}
|
||||
/** 设置更新者 */
|
||||
public void setUpdateBy(String updateBy)
|
||||
{
|
||||
this.updateBy = updateBy;
|
||||
}
|
||||
|
||||
/** 获取更新者 */
|
||||
public String getUpdateBy()
|
||||
{
|
||||
return updateBy;
|
||||
}
|
||||
/** 设置更新时间 */
|
||||
public void setUpdateTime(Date updateTime)
|
||||
{
|
||||
this.updateTime = updateTime;
|
||||
}
|
||||
|
||||
/** 获取更新时间 */
|
||||
public Date getUpdateTime()
|
||||
{
|
||||
return updateTime;
|
||||
}
|
||||
/** 设置备注 */
|
||||
public void setRemark(String remark)
|
||||
{
|
||||
this.remark = remark;
|
||||
}
|
||||
|
||||
/** 获取备注 */
|
||||
public String getRemark()
|
||||
{
|
||||
return remark;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("id", getId())
|
||||
.append("deptId", getDeptId())
|
||||
.append("trainCoursewareCategoryId", getTrainCoursewareCategoryId())
|
||||
.append("name", getName())
|
||||
.append("type", getType())
|
||||
.append("learnTime", getLearnTime())
|
||||
.append("state", getState())
|
||||
.append("url", getUrl())
|
||||
.append("content", getContent())
|
||||
.append("delFlag", getDelFlag())
|
||||
.append("createBy", getCreateBy())
|
||||
.append("createTime", getCreateTime())
|
||||
.append("updateBy", getUpdateBy())
|
||||
.append("updateTime", getUpdateTime())
|
||||
.append("remark", getRemark())
|
||||
.toString();
|
||||
}
|
||||
}
|
||||
|
|
@ -1,132 +0,0 @@
|
|||
package com.ruoyi.train.courseware.domain;
|
||||
|
||||
import com.ruoyi.common.base.BaseEntity;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
|
||||
import javax.persistence.Id;
|
||||
|
||||
/**
|
||||
* 课件分类表 sys_dept
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
public class TrainCoursewareCategory extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 分类ID */
|
||||
@Id
|
||||
private Long id;
|
||||
/**
|
||||
* 课件分类
|
||||
*/
|
||||
private Long deptId;
|
||||
/** 父课件分类ID */
|
||||
private Long parentId;
|
||||
|
||||
/** 祖级列表 */
|
||||
private String parentIds;
|
||||
|
||||
/** 课件分类名称 */
|
||||
private String name;
|
||||
|
||||
/** 显示顺序 */
|
||||
private String orderNum;
|
||||
|
||||
/** 删除标志(0代表存在 2代表删除) */
|
||||
private String delFlag;
|
||||
|
||||
/** 父课件分类名称 */
|
||||
private String parentName;
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Long getDeptId() {
|
||||
return deptId;
|
||||
}
|
||||
|
||||
public void setDeptId(Long deptId) {
|
||||
this.deptId = deptId;
|
||||
}
|
||||
|
||||
public Long getParentId()
|
||||
{
|
||||
return parentId;
|
||||
}
|
||||
|
||||
public void setParentId(Long parentId)
|
||||
{
|
||||
this.parentId = parentId;
|
||||
}
|
||||
|
||||
public String getParentIds() {
|
||||
return parentIds;
|
||||
}
|
||||
|
||||
public void setParentIds(String parentIds) {
|
||||
this.parentIds = parentIds;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getOrderNum()
|
||||
{
|
||||
return orderNum;
|
||||
}
|
||||
|
||||
public void setOrderNum(String orderNum)
|
||||
{
|
||||
this.orderNum = orderNum;
|
||||
}
|
||||
|
||||
|
||||
public String getDelFlag()
|
||||
{
|
||||
return delFlag;
|
||||
}
|
||||
|
||||
public void setDelFlag(String delFlag)
|
||||
{
|
||||
this.delFlag = delFlag;
|
||||
}
|
||||
|
||||
public String getParentName()
|
||||
{
|
||||
return parentName;
|
||||
}
|
||||
|
||||
public void setParentName(String parentName)
|
||||
{
|
||||
this.parentName = parentName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("id", getId())
|
||||
.append("deptId", getDeptId())
|
||||
.append("parentId", getParentId())
|
||||
.append("ancestors", getParentIds())
|
||||
.append("deptName", getName())
|
||||
.append("orderNum", getOrderNum())
|
||||
.append("delFlag", getDelFlag())
|
||||
.append("createBy", getCreateBy())
|
||||
.append("createTime", getCreateTime())
|
||||
.append("updateBy", getUpdateBy())
|
||||
.append("updateTime", getUpdateTime())
|
||||
.toString();
|
||||
}
|
||||
}
|
||||
|
|
@ -1,88 +0,0 @@
|
|||
package com.ruoyi.train.courseware.mapper;
|
||||
|
||||
import com.ruoyi.train.courseware.domain.TrainCoursewareCategory;
|
||||
import com.ruoyi.framework.web.base.MyMapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 课件分类管理 数据层
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
public interface TrainCoursewareCategoryMapper extends MyMapper<TrainCoursewareCategory> {
|
||||
/**
|
||||
* 查询课件分类人数
|
||||
*
|
||||
* @param category 课件分类信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int selectCategoryCount(TrainCoursewareCategory category);
|
||||
|
||||
/**
|
||||
* 查询课件分类是否存在用户
|
||||
*
|
||||
* @param id 课件分类ID
|
||||
* @return 结果
|
||||
*/
|
||||
public int checkCategoryExistCourseware(Long id);
|
||||
|
||||
/**
|
||||
* 查询课件分类管理数据
|
||||
*
|
||||
* @param category 课件分类信息
|
||||
* @return 课件分类信息集合
|
||||
*/
|
||||
public List<TrainCoursewareCategory> selectCategoryList(TrainCoursewareCategory category);
|
||||
|
||||
/**
|
||||
* 删除课件分类管理信息
|
||||
*
|
||||
* @param id 课件分类ID
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteCategoryById(Long id);
|
||||
|
||||
/**
|
||||
* 新增课件分类信息
|
||||
*
|
||||
* @param category 课件分类信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertCategory(TrainCoursewareCategory category);
|
||||
|
||||
/**
|
||||
* 修改课件分类信息
|
||||
*
|
||||
* @param category 课件分类信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateCategory(TrainCoursewareCategory category);
|
||||
|
||||
/**
|
||||
* 修改子元素关系
|
||||
*
|
||||
* @param categorys 子元素
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateCategoryChildren(@Param("categorys") List<TrainCoursewareCategory> categorys);
|
||||
|
||||
/**
|
||||
* 根据课件分类ID查询信息
|
||||
*
|
||||
* @param id 课件分类ID
|
||||
* @return 课件分类信息
|
||||
*/
|
||||
public TrainCoursewareCategory selectCategoryById(Long id);
|
||||
|
||||
/**
|
||||
* 校验课件分类名称是否唯一
|
||||
*
|
||||
* @param name 课件分类名称
|
||||
* @param parentId 父课件分类ID
|
||||
* @return 结果
|
||||
*/
|
||||
public TrainCoursewareCategory checkCategoryNameUnique(@Param("name") String name, @Param("parentId") Long parentId);
|
||||
|
||||
}
|
||||
|
|
@ -1,24 +0,0 @@
|
|||
package com.ruoyi.train.courseware.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import com.ruoyi.framework.web.base.MyMapper;
|
||||
import com.ruoyi.train.courseware.domain.TrainCourseware;
|
||||
|
||||
/**
|
||||
* 课件 数据层
|
||||
*
|
||||
* @author zhujj
|
||||
* @date 2018-12-23
|
||||
*/
|
||||
public interface TrainCoursewareMapper extends MyMapper<TrainCourseware>
|
||||
{
|
||||
|
||||
/**
|
||||
* 查询课件列表
|
||||
*
|
||||
* @param trainCourseware 课件信息
|
||||
* @return 课件集合
|
||||
*/
|
||||
public List<TrainCourseware> selectTrainCoursewareList(TrainCourseware trainCourseware);
|
||||
|
||||
}
|
||||
|
|
@ -1,88 +0,0 @@
|
|||
package com.ruoyi.train.courseware.service;
|
||||
|
||||
import com.ruoyi.train.courseware.domain.TrainCoursewareCategory;
|
||||
import com.ruoyi.framework.web.base.AbstractBaseService;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 课件分类管理 服务层
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
public interface ITrainCoursewareCategoryService extends AbstractBaseService<TrainCoursewareCategory>
|
||||
{
|
||||
/**
|
||||
* 查询课件分类管理数据
|
||||
*
|
||||
* @param category 课件分类信息
|
||||
* @return 课件分类信息集合
|
||||
*/
|
||||
public List<TrainCoursewareCategory> selectCategoryList(TrainCoursewareCategory category);
|
||||
|
||||
/**
|
||||
* 查询课件分类管理树
|
||||
*
|
||||
* @return 所有课件分类信息
|
||||
*/
|
||||
public List<Map<String, Object>> selectCategoryTree();
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 查询课件分类人数
|
||||
*
|
||||
* @param parentId 父课件分类ID
|
||||
* @return 结果
|
||||
*/
|
||||
public int selectCategoryCount(Long parentId);
|
||||
|
||||
/**
|
||||
* 查询课件分类是否存在用户
|
||||
*
|
||||
* @param id 课件分类ID
|
||||
* @return 结果 true 存在 false 不存在
|
||||
*/
|
||||
public boolean checkCategoryExistCourseware(Long id);
|
||||
|
||||
/**
|
||||
* 删除课件分类管理信息
|
||||
*
|
||||
* @param id 课件分类ID
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteCategoryById(Long id);
|
||||
|
||||
/**
|
||||
* 新增保存课件分类信息
|
||||
*
|
||||
* @param category 课件分类信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertCategory(TrainCoursewareCategory category);
|
||||
|
||||
/**
|
||||
* 修改保存课件分类信息
|
||||
*
|
||||
* @param category 课件分类信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateCategory(TrainCoursewareCategory category);
|
||||
|
||||
/**
|
||||
* 根据课件分类ID查询信息
|
||||
*
|
||||
* @param id 课件分类ID
|
||||
* @return 课件分类信息
|
||||
*/
|
||||
public TrainCoursewareCategory selectCategoryById(Long id);
|
||||
|
||||
/**
|
||||
* 校验课件分类名称是否唯一
|
||||
*
|
||||
* @param category 课件分类信息
|
||||
* @return 结果
|
||||
*/
|
||||
public String checkCategoryNameUnique(TrainCoursewareCategory category);
|
||||
}
|
||||
|
|
@ -1,31 +0,0 @@
|
|||
package com.ruoyi.train.courseware.service;
|
||||
|
||||
import java.util.List;
|
||||
import com.ruoyi.framework.web.base.AbstractBaseService;
|
||||
import com.ruoyi.train.courseware.domain.TrainCourseware;
|
||||
|
||||
/**
|
||||
* 课件 服务层
|
||||
*
|
||||
* @author zhujj
|
||||
* @date 2018-12-23
|
||||
*/
|
||||
public interface ITrainCoursewareService extends AbstractBaseService<TrainCourseware>
|
||||
{
|
||||
/**
|
||||
* 查询课件分页列表
|
||||
*
|
||||
* @param trainCourseware 课件信息
|
||||
* @return 课件集合
|
||||
*/
|
||||
public List<TrainCourseware> selectTrainCoursewarePage(TrainCourseware trainCourseware);
|
||||
/**
|
||||
* 查询课件列表
|
||||
*
|
||||
* @param trainCourseware 课件信息
|
||||
* @return 课件集合
|
||||
*/
|
||||
public List<TrainCourseware> selectTrainCoursewareList(TrainCourseware trainCourseware);
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -1,191 +0,0 @@
|
|||
package com.ruoyi.train.courseware.service.impl;
|
||||
|
||||
import com.ruoyi.common.annotation.DataScope;
|
||||
import com.ruoyi.common.constant.UserConstants;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import com.ruoyi.train.courseware.domain.TrainCoursewareCategory;
|
||||
import com.ruoyi.train.courseware.mapper.TrainCoursewareCategoryMapper;
|
||||
import com.ruoyi.train.courseware.service.ITrainCoursewareCategoryService;
|
||||
import com.ruoyi.framework.web.base.AbstractBaseServiceImpl;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 课件分类管理 服务实现
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@Service
|
||||
public class TrainCoursewareCategoryServiceImpl extends AbstractBaseServiceImpl<TrainCoursewareCategoryMapper, TrainCoursewareCategory> implements ITrainCoursewareCategoryService {
|
||||
@Autowired
|
||||
private TrainCoursewareCategoryMapper trainCoursewareCategoryMapper;
|
||||
/**
|
||||
* 查询课件分类管理数据
|
||||
*
|
||||
* @return 课件分类信息集合
|
||||
*/
|
||||
@Override
|
||||
@DataScope(tableAlias = "d")
|
||||
public List<TrainCoursewareCategory> selectCategoryList(TrainCoursewareCategory dept) {
|
||||
return trainCoursewareCategoryMapper.selectCategoryList( dept );
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询课件分类管理树
|
||||
*
|
||||
* @return 所有课件分类信息
|
||||
*/
|
||||
@Override
|
||||
public List<Map<String, Object>> selectCategoryTree() {
|
||||
List<Map<String, Object>> trees = new ArrayList<Map<String, Object>>();
|
||||
List<TrainCoursewareCategory> deptList = selectCategoryList( new TrainCoursewareCategory() );
|
||||
trees = getTrees( deptList, false, null );
|
||||
return trees;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 对象转课件分类树
|
||||
*
|
||||
* @param deptList 课件分类列表
|
||||
* @param isCheck 是否需要选中
|
||||
* @param roleCategoryList 角色已存在菜单列表
|
||||
* @return
|
||||
*/
|
||||
public List<Map<String, Object>> getTrees(List<TrainCoursewareCategory> deptList, boolean isCheck, List<String> roleCategoryList) {
|
||||
|
||||
List<Map<String, Object>> trees = new ArrayList<Map<String, Object>>();
|
||||
for (TrainCoursewareCategory dept : deptList) {
|
||||
if (UserConstants.DEPT_NORMAL.equals( dept.getDelFlag() )) {
|
||||
Map<String, Object> deptMap = new HashMap<String, Object>();
|
||||
deptMap.put( "id", dept.getId() );
|
||||
deptMap.put( "pId", dept.getParentId() );
|
||||
deptMap.put( "name", dept.getName() );
|
||||
deptMap.put( "title", dept.getName() );
|
||||
if (isCheck) {
|
||||
deptMap.put( "checked", roleCategoryList.contains( dept.getId() + dept.getName() ) );
|
||||
} else {
|
||||
deptMap.put( "checked", false );
|
||||
}
|
||||
trees.add( deptMap );
|
||||
}
|
||||
}
|
||||
return trees;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询课件分类人数
|
||||
*
|
||||
* @param parentId 课件分类ID
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int selectCategoryCount(Long parentId) {
|
||||
TrainCoursewareCategory dept = new TrainCoursewareCategory();
|
||||
dept.setParentId( parentId );
|
||||
return trainCoursewareCategoryMapper.selectCategoryCount( dept );
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询课件分类是否存在用户
|
||||
*
|
||||
* @param deptId 课件分类ID
|
||||
* @return 结果 true 存在 false 不存在
|
||||
*/
|
||||
@Override
|
||||
public boolean checkCategoryExistCourseware(Long deptId) {
|
||||
int result = trainCoursewareCategoryMapper.checkCategoryExistCourseware( deptId );
|
||||
return result > 0 ? true : false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除课件分类管理信息
|
||||
*
|
||||
* @param deptId 课件分类ID
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteCategoryById(Long deptId) {
|
||||
return trainCoursewareCategoryMapper.deleteCategoryById( deptId );
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增保存课件分类信息
|
||||
*
|
||||
* @param dept 课件分类信息
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertCategory(TrainCoursewareCategory dept) {
|
||||
TrainCoursewareCategory info = trainCoursewareCategoryMapper.selectCategoryById( dept.getParentId() );
|
||||
dept.setParentIds( info.getParentIds() + "," + dept.getParentId() );
|
||||
return trainCoursewareCategoryMapper.insertCategory( dept );
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改保存课件分类信息
|
||||
*
|
||||
* @param category 课件分类信息
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateCategory(TrainCoursewareCategory category) {
|
||||
TrainCoursewareCategory info = trainCoursewareCategoryMapper.selectCategoryById( category.getParentId() );
|
||||
if (StringUtils.isNotNull( info )) {
|
||||
String ancestors = info.getParentIds() + "," + category.getParentId();
|
||||
category.setParentIds( ancestors );
|
||||
updateCategoryChildren( category.getId(), ancestors );
|
||||
}
|
||||
return trainCoursewareCategoryMapper.updateCategory( category );
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改子元素关系
|
||||
*
|
||||
* @param deptId 课件分类ID
|
||||
* @param ancestors 元素列表
|
||||
*/
|
||||
public void updateCategoryChildren(Long deptId, String ancestors) {
|
||||
TrainCoursewareCategory dept = new TrainCoursewareCategory();
|
||||
dept.setParentId( deptId );
|
||||
List<TrainCoursewareCategory> childrens = trainCoursewareCategoryMapper.selectCategoryList( dept );
|
||||
for (TrainCoursewareCategory children : childrens) {
|
||||
children.setParentIds( ancestors + "," + dept.getParentId() );
|
||||
}
|
||||
if (childrens.size() > 0) {
|
||||
trainCoursewareCategoryMapper.updateCategoryChildren( childrens );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据课件分类ID查询信息
|
||||
*
|
||||
* @param deptId 课件分类ID
|
||||
* @return 课件分类信息
|
||||
*/
|
||||
@Override
|
||||
public TrainCoursewareCategory selectCategoryById(Long id) {
|
||||
return trainCoursewareCategoryMapper.selectCategoryById( id );
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验课件分类名称是否唯一
|
||||
*
|
||||
* @param dept 课件分类信息
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public String checkCategoryNameUnique(TrainCoursewareCategory dept) {
|
||||
Long deptId = StringUtils.isNull( dept.getId() ) ? -1L : dept.getId();
|
||||
TrainCoursewareCategory info = trainCoursewareCategoryMapper.checkCategoryNameUnique( dept.getName(), dept.getParentId() );
|
||||
if (StringUtils.isNotNull( info ) && info.getId().longValue() != deptId.longValue()) {
|
||||
return UserConstants.DEPT_NAME_NOT_UNIQUE;
|
||||
}
|
||||
return UserConstants.DEPT_NAME_UNIQUE;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,49 +0,0 @@
|
|||
package com.ruoyi.train.courseware.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.ruoyi.train.courseware.domain.TrainCourseware;
|
||||
import com.ruoyi.train.courseware.mapper.TrainCoursewareMapper;
|
||||
import com.ruoyi.train.courseware.service.ITrainCoursewareService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.ruoyi.common.support.Convert;
|
||||
import com.ruoyi.framework.web.base.AbstractBaseServiceImpl;
|
||||
/**
|
||||
* 课件 服务层实现
|
||||
*
|
||||
* @author zhujj
|
||||
* @date 2018-12-23
|
||||
*/
|
||||
@Service
|
||||
public class TrainCoursewareServiceImpl extends AbstractBaseServiceImpl<TrainCoursewareMapper,TrainCourseware> implements ITrainCoursewareService
|
||||
{
|
||||
@Autowired
|
||||
private TrainCoursewareMapper trainCoursewareMapper;
|
||||
|
||||
|
||||
/**
|
||||
* 查询课件列表
|
||||
*
|
||||
* @param trainCourseware 课件信息
|
||||
* @return 课件集合
|
||||
*/
|
||||
@Override
|
||||
public List<TrainCourseware> selectTrainCoursewareList(TrainCourseware trainCourseware)
|
||||
{
|
||||
return trainCoursewareMapper.selectTrainCoursewareList(trainCourseware);
|
||||
}
|
||||
/**
|
||||
* 查询课件分页列表
|
||||
*
|
||||
* @param trainCourseware 课件信息
|
||||
* @return 课件集合
|
||||
*/
|
||||
@Override
|
||||
public List<TrainCourseware> selectTrainCoursewarePage(TrainCourseware trainCourseware)
|
||||
{
|
||||
startPage();
|
||||
return trainCoursewareMapper.selectTrainCoursewareList(trainCourseware);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,39 +0,0 @@
|
|||
package com.ruoyi.train.courseware.utils;
|
||||
|
||||
import com.aliyuncs.DefaultAcsClient;
|
||||
import com.aliyuncs.exceptions.ClientException;
|
||||
import com.aliyuncs.exceptions.ServerException;
|
||||
import com.aliyuncs.profile.DefaultProfile;
|
||||
import com.aliyuncs.vod.model.v20170321.GetVideoPlayAuthRequest;
|
||||
import com.aliyuncs.vod.model.v20170321.GetVideoPlayAuthResponse;
|
||||
|
||||
public class VideoUtils {
|
||||
|
||||
// 设置AccessKey ID和AccessKey secret
|
||||
private static String access_key_id = "LTAILL4H4JcoUJdf";
|
||||
private static String access_key_secret = "6TtJ1MD7ueolOXWjx0VhaseX6nkPVe ";
|
||||
|
||||
public static void main(String[] args) {
|
||||
// 点播服务所在的地域,中国大陆地域请填cn-shanghai
|
||||
DefaultProfile profile = DefaultProfile.getProfile("cn-shanghai", access_key_id, access_key_secret);
|
||||
DefaultAcsClient client = new DefaultAcsClient(profile);
|
||||
// 传入视频ID
|
||||
GetVideoPlayAuthResponse response = getVideoPlayAuth(client, "3dbb151b73c34b678efff61d3d50d999");
|
||||
System.out.println(response.getPlayAuth());
|
||||
}
|
||||
|
||||
private static GetVideoPlayAuthResponse getVideoPlayAuth(DefaultAcsClient client, String videoId) {
|
||||
GetVideoPlayAuthRequest request = new GetVideoPlayAuthRequest();
|
||||
request.setVideoId(videoId);
|
||||
GetVideoPlayAuthResponse response = null;
|
||||
try {
|
||||
response = client.getAcsResponse(request);
|
||||
} catch (ServerException e) {
|
||||
throw new RuntimeException("GetVideoPlayAuthRequest Server failed");
|
||||
} catch (ClientException e) {
|
||||
throw new RuntimeException("GetVideoPlayAuthRequest Client failed");
|
||||
}
|
||||
return response;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,117 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.ruoyi.train.courseware.mapper.TrainCoursewareCategoryMapper">
|
||||
|
||||
<resultMap type="TrainCoursewareCategory" id="TrainCoursewareCategoryResult">
|
||||
<id property="id" column="id" />
|
||||
<result property="deptId" column="dept_id" />
|
||||
<result property="parentId" column="parent_id" />
|
||||
<result property="parentIds" column="parent_ids" />
|
||||
<result property="name" column="name" />
|
||||
<result property="orderNum" column="order_num" />
|
||||
<result property="delFlag" column="del_flag" />
|
||||
<result property="parentName" column="parent_name" />
|
||||
<result property="createBy" column="create_by" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="updateBy" column="update_by" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectCategoryVo">
|
||||
select d.id,d.dept_id, d.parent_id, d.parent_ids, d.name, d.order_num, d.del_flag, d.create_by, d.create_time
|
||||
from train_courseware_category d
|
||||
</sql>
|
||||
|
||||
<select id="selectCategoryList" parameterType="TrainCourseCategory" resultMap="TrainCoursewareCategoryResult">
|
||||
<include refid="selectCategoryVo"/>
|
||||
where d.del_flag = '0'
|
||||
<if test="parentId != null and parentId != 0">
|
||||
AND parent_id = #{parentId}
|
||||
</if>
|
||||
<if test="name != null and name != ''">
|
||||
AND name like concat('%', #{name}, '%')
|
||||
</if>
|
||||
|
||||
<!-- 数据范围过滤 -->
|
||||
${params.dataScope}
|
||||
</select>
|
||||
|
||||
<select id="checkCategoryExistCourseware" parameterType="Long" resultType="int">
|
||||
select count(1) from train_courseware where train_courseware_category_id = #{id} and del_flag = '0'
|
||||
</select>
|
||||
|
||||
<select id="selectCategoryCount" parameterType="TrainCourseCategory" resultType="int">
|
||||
select count(1) from train_courseware_category
|
||||
where del_flag = '0'
|
||||
<if test="id != null and id != 0"> and id = #{id} </if>
|
||||
<if test="parentId != null and parentId != 0"> and parent_id = #{parentId} </if>
|
||||
</select>
|
||||
|
||||
<select id="checkCategoryNameUnique" resultMap="TrainCoursewareCategoryResult">
|
||||
<include refid="selectCategoryVo"/>
|
||||
where name=#{name} and parent_id = #{parentId}
|
||||
</select>
|
||||
|
||||
<select id="selectCategoryById" parameterType="Long" resultMap="TrainCoursewareCategoryResult">
|
||||
select d.id, d.parent_id, d.parent_ids, d.name, d.order_num, d.del_flag,
|
||||
(select name from train_courseware_category where id = d.parent_id) parent_name
|
||||
from train_courseware_category d
|
||||
where d.id = #{id}
|
||||
</select>
|
||||
|
||||
<insert id="insertCategory" parameterType="TrainCourseCategory">
|
||||
insert into train_courseware_category(
|
||||
<if test="id != null and id != 0">id,</if>
|
||||
<if test="parentId != null and parentId != 0">parent_id,</if>
|
||||
<if test="name != null and name != ''">name,</if>
|
||||
<if test="parentIds != null and parentIds != ''">parent_ids,</if>
|
||||
<if test="orderNum != null and orderNum != ''">order_num,</if>
|
||||
|
||||
<if test="createBy != null and createBy != ''">create_by,</if>
|
||||
create_time
|
||||
)values(
|
||||
<if test="id != null and id != 0">#{id},</if>
|
||||
<if test="parentId != null and parentId != 0">#{parentId},</if>
|
||||
<if test="name != null and name != ''">#{name},</if>
|
||||
<if test="parentIds != null and parentIds != ''">#{parentIds},</if>
|
||||
<if test="orderNum != null and orderNum != ''">#{orderNum},</if>
|
||||
|
||||
<if test="createBy != null and createBy != ''">#{createBy},</if>
|
||||
sysdate()
|
||||
)
|
||||
</insert>
|
||||
|
||||
<update id="updateCategory" parameterType="TrainCourseCategory">
|
||||
update train_courseware_category
|
||||
<set>
|
||||
<if test="parentId != null and parentId != 0">parent_id = #{parentId},</if>
|
||||
<if test="name != null and name != ''">name = #{name},</if>
|
||||
<if test="parentIds != null and parentIds != ''">parent_ids = #{parentIds},</if>
|
||||
<if test="orderNum != null and orderNum != ''">order_num = #{orderNum},</if>
|
||||
|
||||
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
|
||||
update_time = sysdate()
|
||||
</set>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<update id="updateCategoryChildren" parameterType="java.util.List">
|
||||
update train_courseware_category set parent_ids =
|
||||
<foreach collection="depts" item="item" index="index"
|
||||
separator=" " open="case id" close="end">
|
||||
when #{item.id} then #{item.parent_ids}
|
||||
</foreach>
|
||||
where id in
|
||||
<foreach collection="depts" item="item" index="index"
|
||||
separator="," open="(" close=")">
|
||||
#{item.id}
|
||||
</foreach>
|
||||
</update>
|
||||
|
||||
<delete id="deleteCategoryById" parameterType="Long">
|
||||
update train_courseware_category set del_flag = '2' where id = #{id}
|
||||
</delete>
|
||||
|
||||
</mapper>
|
||||
|
|
@ -1,52 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.ruoyi.train.courseware.mapper.TrainCoursewareMapper">
|
||||
|
||||
<resultMap type="TrainCourseware" id="TrainCoursewareResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="deptId" column="dept_id" />
|
||||
<result property="trainCoursewareCategoryId" column="train_courseware_category_id" />
|
||||
<result property="name" column="name" />
|
||||
<result property="type" column="type" />
|
||||
<result property="learnTime" column="learn_time" />
|
||||
<result property="state" column="state" />
|
||||
<result property="url" column="url" />
|
||||
<result property="content" column="content" />
|
||||
<result property="delFlag" column="del_flag" />
|
||||
<result property="createBy" column="create_by" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="updateBy" column="update_by" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
<result property="remark" column="remark" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectTrainCoursewareVo">
|
||||
id, dept_id, train_courseware_category_id, name, type, learn_time, state, url, content, del_flag, create_by, create_time, update_by, update_time, remark </sql>
|
||||
|
||||
<select id="selectTrainCoursewareList" parameterType="TrainCourseware" resultMap="TrainCoursewareResult">
|
||||
select
|
||||
<include refid="selectTrainCoursewareVo"/>
|
||||
from train_courseware
|
||||
<where>
|
||||
<if test="id != null "> and id = #{id}</if>
|
||||
<if test="deptId != null "> and dept_id = #{deptId}</if>
|
||||
<if test="trainCoursewareCategoryId != null "> and train_courseware_category_id = #{trainCoursewareCategoryId}</if>
|
||||
<if test="name != null and name != '' "> and name = #{name}</if>
|
||||
<if test="type != null and type != '' "> and type = #{type}</if>
|
||||
<if test="learnTime != null "> and learn_time = #{learnTime}</if>
|
||||
<if test="state != null and state != '' "> and state = #{state}</if>
|
||||
<if test="url != null and url != '' "> and url = #{url}</if>
|
||||
<if test="content != null and content != '' "> and content = #{content}</if>
|
||||
<if test="delFlag != null and delFlag != '' "> and del_flag = #{delFlag}</if>
|
||||
<if test="createBy != null and createBy != '' "> and create_by = #{createBy}</if>
|
||||
<if test="createTime != null "> and create_time = #{createTime}</if>
|
||||
<if test="updateBy != null and updateBy != '' "> and update_by = #{updateBy}</if>
|
||||
<if test="updateTime != null "> and update_time = #{updateTime}</if>
|
||||
<if test="remark != null and remark != '' "> and remark = #{remark}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
|
||||
</mapper>
|
||||
|
|
@ -1,106 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
|
||||
<meta charset="utf-8">
|
||||
<head th:include="include :: header"></head>
|
||||
<body class="white-bg">
|
||||
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
|
||||
<form class="form-horizontal m" id="form-category-add">
|
||||
<input id="treeId" name="parentId" type="hidden" th:value="${category.id}" />
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label ">上级分类:</label>
|
||||
<div class="col-sm-8">
|
||||
<input class="form-control" type="text" onclick="selectCategoryTree()" id="treeName" readonly="true" th:value="${category.name}"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">分类名称:</label>
|
||||
<div class="col-sm-8">
|
||||
<input class="form-control" type="text" name="name" id="name">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">显示排序:</label>
|
||||
<div class="col-sm-8">
|
||||
<input class="form-control" type="text" name="orderNum">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">分类状态:</label>
|
||||
<div class="col-sm-8">
|
||||
<div class="radio-box" th:each="dict : ${@dict.getType('sys_normal_disable')}">
|
||||
<input type="radio" th:id="${dict.dictCode}" name="delFlag" th:value="${dict.dictValue}" th:checked="${dict.isDefault == 'Y' ? true : false}">
|
||||
<label th:for="${dict.dictCode}" th:text="${dict.dictLabel}"></label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<div th:include="include::footer"></div>
|
||||
<script type="text/javascript">
|
||||
var prefix = ctx + "train/courseware/category";
|
||||
|
||||
$("#form-category-add").validate({
|
||||
rules:{
|
||||
name:{
|
||||
required:true,
|
||||
remote: {
|
||||
url: prefix + "/checkCategoryNameUnique",
|
||||
type: "post",
|
||||
dataType: "json",
|
||||
data: {
|
||||
"parentId": function() {
|
||||
return $("input[name='parentId']").val();
|
||||
},
|
||||
"name" : function() {
|
||||
return $.common.trim($("#name").val());
|
||||
}
|
||||
},
|
||||
dataFilter: function(data, type) {
|
||||
return $.validate.unique(data);
|
||||
}
|
||||
}
|
||||
},
|
||||
orderNum:{
|
||||
required:true,
|
||||
digits:true
|
||||
},
|
||||
email:{
|
||||
email:true,
|
||||
},
|
||||
phone:{
|
||||
isPhone:true,
|
||||
},
|
||||
},
|
||||
messages: {
|
||||
"name": {
|
||||
remote: "分类已经存在"
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
function submitHandler() {
|
||||
if ($.validate.form()) {
|
||||
$.operate.save(prefix + "/add", $('#form-category-add').serialize());
|
||||
}
|
||||
}
|
||||
|
||||
/*分类管理-新增-选择父分类树*/
|
||||
function selectCategoryTree() {
|
||||
var options = {
|
||||
title: '分类选择',
|
||||
width: "380",
|
||||
url: prefix + "/selectCategoryTree/" + $("#treeId").val(),
|
||||
callBack: doSubmit
|
||||
};
|
||||
$.modal.openOptions(options);
|
||||
}
|
||||
|
||||
function doSubmit(index, layero){
|
||||
var body = layer.getChildFrame('body', index);
|
||||
$("#treeId").val(body.find('#treeId').val());
|
||||
$("#treeName").val(body.find('#treeName').val());
|
||||
layer.close(index);
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -1,115 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="zh" xmlns:th="http://www.thymeleaf.org"
|
||||
xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
|
||||
<meta charset="utf-8">
|
||||
<head th:include="include :: header"></head>
|
||||
<body class="gray-bg">
|
||||
<div class="container-div">
|
||||
<div class="row">
|
||||
<div class="col-sm-12 search-collapse">
|
||||
<form id="dept-form">
|
||||
<div class="select-list">
|
||||
<ul>
|
||||
<li>
|
||||
分类名称:<input type="text" name="deptName"/>
|
||||
</li>
|
||||
<li>
|
||||
<a class="btn btn-primary btn-rounded btn-sm" onclick="$.treeTable.search()"><i class="fa fa-search"></i> 搜索</a>
|
||||
<a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i> 重置</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<div class="btn-group-sm hidden-xs" id="toolbar" role="group">
|
||||
<a class="btn btn-success" onclick="$.operate.add(100)" shiro:hasPermission="train:courseware:category:add">
|
||||
<i class="fa fa-plus"></i> 新增
|
||||
</a>
|
||||
<a class="btn btn-primary" onclick="$.operate.editTree()" shiro:hasPermission="train:courseware:category:edit">
|
||||
<i class="fa fa-edit"></i> 修改
|
||||
</a>
|
||||
<a class="btn btn-info" id="expandAllBtn">
|
||||
<i class="fa fa-exchange"></i> 展开/折叠
|
||||
</a>
|
||||
</div>
|
||||
<div class="col-sm-12 select-table table-striped">
|
||||
<table id="bootstrap-tree-table" data-mobile-responsive="true"></table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div th:include="include :: footer"></div>
|
||||
<script th:inline="javascript">
|
||||
var addFlag = [[${@permission.hasPermi('train:courseware:category:add')}]];
|
||||
var editFlag = [[${@permission.hasPermi('train:courseware:category:edit')}]];
|
||||
var removeFlag = [[${@permission.hasPermi('train:courseware:category:remove')}]];
|
||||
var datas = [[${@dict.getType('sys_normal_disable')}]];
|
||||
var prefix = ctx + "train/courseware/category"
|
||||
|
||||
$(function() {
|
||||
var options = {
|
||||
code: "id",
|
||||
parentCode: "parentId",
|
||||
uniqueId: "id",
|
||||
url: prefix + "/list",
|
||||
createUrl: prefix + "/add/{id}",
|
||||
updateUrl: prefix + "/edit/{id}",
|
||||
removeUrl: prefix + "/remove/{id}",
|
||||
modalName: "分类",
|
||||
columns: [{
|
||||
field: 'selectItem',
|
||||
radio: true
|
||||
},
|
||||
{
|
||||
field: 'name',
|
||||
title: '分类名称',
|
||||
align: "left"
|
||||
},
|
||||
{
|
||||
field: 'orderNum',
|
||||
title: '排序',
|
||||
align: "left"
|
||||
},
|
||||
{
|
||||
field: 'createTime',
|
||||
title: '创建时间',
|
||||
align: "left"
|
||||
},
|
||||
{
|
||||
title: '操作',
|
||||
align: 'left',
|
||||
formatter: function(value, row, index) {
|
||||
if (row.parentId != 0) {
|
||||
var actions = [];
|
||||
actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="#" onclick="$.operate.edit(\'' + row.id + '\')"><i class="fa fa-edit">编辑</i></a> ');
|
||||
actions.push('<a class="btn btn-info btn-xs ' + addFlag + '" href="#" onclick="$.operate.add(\'' + row.id + '\')"><i class="fa fa-plus">新增</i></a> ');
|
||||
actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="#" onclick="remove(\'' + row.id + '\')"><i class="fa fa-remove">删除</i></a>');
|
||||
return actions.join('');
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
}]
|
||||
};
|
||||
$.treeTable.init(options);
|
||||
});
|
||||
|
||||
function remove(id) {
|
||||
$.modal.confirm("确定删除该条" + $.table._option.modalName + "信息吗?", function() {
|
||||
$.ajax({
|
||||
type : 'post',
|
||||
url: prefix + "/remove/" + id,
|
||||
success : function(result) {
|
||||
if (result.code == web_status.SUCCESS) {
|
||||
$.modal.msgSuccess(result.msg);
|
||||
$.treeTable.refresh();
|
||||
} else {
|
||||
$.modal.msgError(result.msg);
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -1,115 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
|
||||
<meta charset="utf-8">
|
||||
<head th:include="include :: header"></head>
|
||||
<body class="white-bg">
|
||||
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
|
||||
<form class="form-horizontal m" id="form-category-edit" th:object="${category}">
|
||||
<input name="id" type="hidden" th:field="*{id}" />
|
||||
<input id="treeId" name="parentId" type="hidden" th:field="*{parentId}" />
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label ">上级分类:</label>
|
||||
<div class="col-sm-8">
|
||||
<input class="form-control" type="text" id="treeName" onclick="selectCategoryTree()" readonly="true" th:field="*{parentName}"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">分类名称:</label>
|
||||
<div class="col-sm-8">
|
||||
<input class="form-control" type="text" name="name" th:field="*{name}" id="name">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">显示排序:</label>
|
||||
<div class="col-sm-8">
|
||||
<input class="form-control" type="text" name="orderNum" th:field="*{orderNum}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">分类状态:</label>
|
||||
<div class="col-sm-8">
|
||||
<div class="radio-box" th:each="dict : ${@dict.getType('sys_normal_disable')}">
|
||||
<input type="radio" th:id="${dict.dictCode}" name="delFlag" th:value="${dict.dictValue}" th:field="*{delFlag}">
|
||||
<label th:for="${dict.dictCode}" th:text="${dict.dictLabel}"></label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<div th:include="include::footer"></div>
|
||||
<script type="text/javascript">
|
||||
var prefix = ctx + "train/courseware/category";
|
||||
|
||||
$("#form-category-edit").validate({
|
||||
rules:{
|
||||
name:{
|
||||
required:true,
|
||||
remote: {
|
||||
url: prefix + "/checkCategoryNameUnique",
|
||||
type: "post",
|
||||
dataType: "json",
|
||||
data: {
|
||||
"id": function() {
|
||||
return $("#id").val();
|
||||
},
|
||||
"parentId": function() {
|
||||
return $("input[name='parentId']").val();
|
||||
},
|
||||
"name": function() {
|
||||
return $.common.trim($("#name").val());
|
||||
}
|
||||
},
|
||||
dataFilter: function(data, type) {
|
||||
return $.validate.unique(data);
|
||||
}
|
||||
}
|
||||
},
|
||||
orderNum:{
|
||||
required:true,
|
||||
digits:true
|
||||
},
|
||||
email:{
|
||||
email:true,
|
||||
},
|
||||
phone:{
|
||||
isPhone:true,
|
||||
},
|
||||
},
|
||||
messages: {
|
||||
"name": {
|
||||
remote: "分类已经存在"
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
function submitHandler() {
|
||||
if ($.validate.form()) {
|
||||
$.operate.save(prefix + "/edit", $('#form-category-edit').serialize());
|
||||
}
|
||||
}
|
||||
|
||||
/*分类管理-修改-选择分类树*/
|
||||
function selectCategoryTree() {
|
||||
var id = $("#treeId").val();
|
||||
if(id > 0) {
|
||||
var options = {
|
||||
title: '分类选择',
|
||||
width: "380",
|
||||
url: prefix + "/selectCategoryTree/" + $("#treeId").val(),
|
||||
callBack: doSubmit
|
||||
};
|
||||
$.modal.openOptions(options);
|
||||
} else {
|
||||
$.modal.alertError("父分类不能选择");
|
||||
}
|
||||
}
|
||||
|
||||
function doSubmit(index, layero){
|
||||
var body = layer.getChildFrame('body', index);
|
||||
$("#treeId").val(body.find('#treeId').val());
|
||||
$("#treeName").val(body.find('#treeName').val());
|
||||
layer.close(index);
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -1,48 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
|
||||
<meta charset="utf-8">
|
||||
<head th:include="include :: header"></head>
|
||||
<link th:href="@{/ajax/libs/jquery-ztree/3.5/css/metro/zTreeStyle.css}" rel="stylesheet"/>
|
||||
<style>
|
||||
body{height:auto;font-family: "Microsoft YaHei";}
|
||||
button{font-family: "SimSun","Helvetica Neue",Helvetica,Arial;}
|
||||
</style>
|
||||
<body class="hold-transition box box-main">
|
||||
<input id="treeId" name="treeId" type="hidden" th:value="${category.id}"/>
|
||||
<input id="treeName" name="treeName" type="hidden" th:value="${category.name}"/>
|
||||
<div class="wrapper"><div class="treeShowHideButton" onclick="$.tree.toggleSearch();">
|
||||
<label id="btnShow" title="显示搜索" style="display:none;">︾</label>
|
||||
<label id="btnHide" title="隐藏搜索">︽</label>
|
||||
</div>
|
||||
<div class="treeSearchInput" id="search">
|
||||
<label for="keyword">关键字:</label><input type="text" class="empty" id="keyword" maxlength="50">
|
||||
<button class="btn" id="btn" onclick="$.tree.searchNode()"> 搜索 </button>
|
||||
</div>
|
||||
<div class="treeExpandCollapse">
|
||||
<a href="#" onclick="$.tree.expand()">展开</a> /
|
||||
<a href="#" onclick="$.tree.collapse()">折叠</a>
|
||||
</div>
|
||||
<div id="tree" class="ztree treeselect"></div>
|
||||
</div>
|
||||
<div th:include="include::footer"></div>
|
||||
<script th:src="@{/ajax/libs/jquery-ztree/3.5/js/jquery.ztree.all-3.5.js}"></script>
|
||||
<script th:inline="javascript">
|
||||
$(function() {
|
||||
var url = ctx + "train/courseware/category/treeData";
|
||||
var options = {
|
||||
url: url,
|
||||
expandLevel: 2,
|
||||
onClick : zOnClick
|
||||
};
|
||||
$.tree.init(options);
|
||||
});
|
||||
|
||||
function zOnClick(event, treeId, treeNode) {
|
||||
var treeId = treeNode.id;
|
||||
var treeName = treeNode.name;
|
||||
$("#treeId").val(treeId);
|
||||
$("#treeName").val(treeName);
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -1,193 +0,0 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
|
||||
<meta charset="utf-8">
|
||||
<head th:include="include :: header"></head>
|
||||
<link th:href="@{/ajax/libs/layui/css/layui.css}" rel="stylesheet"/>
|
||||
<body class="white-bg">
|
||||
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
|
||||
<form class="form-horizontal m" id="form-trainCourseware-add">
|
||||
<input name="trainCoursewareCategoryId" type="hidden" id="treeId"/>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">课件分类:</label>
|
||||
<div class="col-sm-8">
|
||||
<input class="form-control" type="text" name="treeName" onclick="selectCategoryTree()" readonly="true" id="treeName">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">课件名称:</label>
|
||||
<div class="col-sm-8">
|
||||
<input id="name" name="name" class="form-control" type="text">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label" title="(1-文档,2-图文,3-视频,4-音频,5-图片,6-外部链接)">课件类型:</label>
|
||||
<div class="col-sm-8">
|
||||
<select id="type" name="type" th:with="type=${@dict.getType('train_courseware_category')}" class="form-control" >
|
||||
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">学习时常(分钟):</label>
|
||||
<div class="col-sm-8">
|
||||
<input id="learnTime" name="learnTime" class="form-control" type="text">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">是否公开:</label>
|
||||
<div class="col-sm-8">
|
||||
<div class="onoffswitch" title="(1-是,0-不是)">
|
||||
<input type="checkbox" th:checked="true" class="onoffswitch-checkbox" id="state" name="state">
|
||||
<label class="onoffswitch-label" for="state">
|
||||
<span class="onoffswitch-inner"></span>
|
||||
<span class="onoffswitch-switch"></span>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">上传:</label>
|
||||
<div class="col-sm-8">
|
||||
<div class="layui-upload">
|
||||
<button type="button" class="layui-btn layui-btn-normal" id="testList">选择多文件</button>
|
||||
<div class="layui-upload-list">
|
||||
<table class="layui-table">
|
||||
<thead>
|
||||
<tr><th>文件名</th>
|
||||
<th>大小</th>
|
||||
<th>状态</th>
|
||||
<th>操作</th>
|
||||
</tr></thead>
|
||||
<tbody id="demoList"></tbody>
|
||||
</table>
|
||||
</div>
|
||||
<!--<button type="button" class="layui-btn" id="testListAction">开始上传</button>-->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">正文:</label>
|
||||
<div class="col-sm-8">
|
||||
<input id="content" name="content" class="form-control" type="text">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">备注:</label>
|
||||
<div class="col-sm-8">
|
||||
<input id="remark" name="remark" class="form-control" type="text">
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<div th:include="include::footer"></div>
|
||||
<script th:src="@{/ajax/libs/layui/layui.js}"></script>
|
||||
<script type="text/javascript">
|
||||
var prefix = ctx + "train/trainCourseware"
|
||||
$("#form-trainCourseware-add").validate({
|
||||
rules:{
|
||||
xxxx:{
|
||||
required:true,
|
||||
},
|
||||
}
|
||||
});
|
||||
|
||||
function submitHandler() {
|
||||
if ($.validate.form()) {
|
||||
var formData=$('#form-trainCourseware-add').serializeObject();
|
||||
debugger
|
||||
formData.state= $("input[name='state']").is(':checked') == true ? 1 : 2;
|
||||
formData.url = fileList.join(",");
|
||||
$.operate.save(prefix + "/add", formData);
|
||||
}
|
||||
}
|
||||
/*课件管理-新增-选择分类树*/
|
||||
function selectCategoryTree() {
|
||||
var treeId = $("#treeId").val();
|
||||
var deptId = $.common.isEmpty(treeId) ? "100" : $("#treeId").val();
|
||||
var url = ctx + "train/courseware/category/selectCategoryTree/" + deptId;
|
||||
var options = {
|
||||
title: '选择部门',
|
||||
width: "380",
|
||||
url: url,
|
||||
callBack: doSubmit
|
||||
};
|
||||
$.modal.openOptions(options);
|
||||
}
|
||||
function doSubmit(index, layero){
|
||||
var tree = layero.find("iframe")[0].contentWindow.$._tree;
|
||||
if ($.tree.notAllowParents(tree)) {
|
||||
var body = layer.getChildFrame('body', index);
|
||||
$("#treeId").val(body.find('#treeId').val());
|
||||
$("#treeName").val(body.find('#treeName').val());
|
||||
layer.close(index);
|
||||
}
|
||||
}
|
||||
var fileList=new Array();
|
||||
layui.use('upload', function() {
|
||||
var $ = layui.jquery
|
||||
, upload = layui.upload;
|
||||
//多文件列表示例
|
||||
var demoListView = $('#demoList')
|
||||
,uploadListIns = upload.render({
|
||||
elem: '#testList'
|
||||
,url: '/upload/files'
|
||||
,data:{module:"train/courseware"}//文件存放路径
|
||||
,accept: 'file'
|
||||
,multiple: true
|
||||
,auto: true
|
||||
// ,bindAction: '#testListAction'
|
||||
,choose: function(obj){
|
||||
var files = this.files = obj.pushFile(); //将每次选择的文件追加到文件队列
|
||||
//读取本地文件
|
||||
obj.preview(function(index, file, result){
|
||||
var tr = $(['<tr id="upload-'+ index +'">'
|
||||
,'<td>'+ file.name +'</td>'
|
||||
,'<td>'+ (file.size/1014).toFixed(1) +'kb</td>'
|
||||
,'<td>等待上传</td>'
|
||||
,'<td>'
|
||||
,'<button class="layui-btn layui-btn-xs demo-reload layui-hide">重传</button>'
|
||||
,'<button class="layui-btn layui-btn-xs layui-btn-danger demo-delete">删除</button>'
|
||||
,'</td>'
|
||||
,'</tr>'].join(''));
|
||||
|
||||
//单个重传
|
||||
tr.find('.demo-reload').on('click', function(){
|
||||
obj.upload(index, file);
|
||||
});
|
||||
|
||||
//删除
|
||||
tr.find('.demo-delete').on('click', function(){
|
||||
delete files[index]; //删除对应的文件
|
||||
tr.remove();
|
||||
uploadListIns.config.elem.next()[0].value = ''; //清空 input file 值,以免删除后出现同名文件不可选
|
||||
});
|
||||
|
||||
demoListView.append(tr);
|
||||
});
|
||||
}
|
||||
,done: function(res, index, upload){
|
||||
if(res.code == 200){ //上传成功
|
||||
var tr = demoListView.find('tr#upload-'+ index)
|
||||
,tds = tr.children();
|
||||
tds.eq(2).html('<span style="color: #5FB878;">上传成功</span>');
|
||||
tds.eq(3).html(''); //清空操作
|
||||
fileList.push(res.fileName);
|
||||
return delete this.files[index]; //删除文件队列已经上传成功的文件
|
||||
}
|
||||
this.error(index, upload);
|
||||
}
|
||||
,error: function(index, upload){
|
||||
var tr = demoListView.find('tr#upload-'+ index)
|
||||
,tds = tr.children();
|
||||
tds.eq(2).html('<span style="color: #FF5722;">上传失败</span>');
|
||||
tds.eq(3).find('.demo-reload').removeClass('layui-hide'); //显示重传
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
|
@ -1,111 +0,0 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
|
||||
<meta charset="utf-8">
|
||||
<head th:include="include :: header"></head>
|
||||
<body class="white-bg">
|
||||
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
|
||||
<form class="form-horizontal m" id="form-trainCourseware-edit" th:object="${trainCourseware}">
|
||||
<input id="id" name="id" th:field="*{id}" type="hidden">
|
||||
<input name="trainCoursewareCategoryId" type="hidden" id="treeId" th:field="*{trainCoursewareCategoryId}"/>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">课件分类:</label>
|
||||
<div class="col-sm-8">
|
||||
<input class="form-control" type="text" name="treeName" th:field="*{name}" onclick="selectCategoryTree()" readonly="true" id="treeName">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">课件名称:</label>
|
||||
<div class="col-sm-8">
|
||||
<input id="name" name="name" th:field="*{name}" class="form-control" type="text">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label" title="(1-文档,2-图文,3-视频,4-音频,5-图片,6-外部链接)">课件类型:</label>
|
||||
<div class="col-sm-8">
|
||||
<select id="type" name="type" th:with="type=${@dict.getType('train_courseware_category')}" class="form-control" >
|
||||
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{type}"></option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">学习时常(分钟):</label>
|
||||
<div class="col-sm-8">
|
||||
<input id="learnTime" name="learnTime" th:field="*{learnTime}" class="form-control" type="text">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label" title="(1-是,0-不是)">是否公开:</label>
|
||||
<div class="col-sm-8">
|
||||
<div class="onoffswitch">
|
||||
<input type="checkbox" th:checked="${trainCourseware.state == '1' ? true : false}" class="onoffswitch-checkbox" id="state" name="state">
|
||||
<label class="onoffswitch-label" for="state">
|
||||
<span class="onoffswitch-inner"></span>
|
||||
<span class="onoffswitch-switch"></span>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">地址:</label>
|
||||
<div class="col-sm-8">
|
||||
<input id="url" name="url" th:field="*{url}" class="form-control" type="text">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">正文:</label>
|
||||
<div class="col-sm-8">
|
||||
<input id="content" name="content" th:field="*{content}" class="form-control" type="text">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">备注:</label>
|
||||
<div class="col-sm-8">
|
||||
<input id="remark" name="remark" th:field="*{remark}" class="form-control" type="text">
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<div th:include="include::footer"></div>
|
||||
<script type="text/javascript">
|
||||
var prefix = ctx + "train/trainCourseware"
|
||||
$("#form-trainCourseware-edit").validate({
|
||||
rules:{
|
||||
xxxx:{
|
||||
required:true,
|
||||
},
|
||||
}
|
||||
});
|
||||
|
||||
function submitHandler() {
|
||||
if ($.validate.form()) {
|
||||
var formData=$('#form-trainCourseware-edit').serializeObject();
|
||||
formData.state= $("input[name='state']").is(':checked') == true ? 1 : 2;
|
||||
$.operate.save(prefix + "/edit",formData);
|
||||
}
|
||||
}
|
||||
|
||||
/*课件管理-新增-选择分类树*/
|
||||
function selectCategoryTree() {
|
||||
var treeId = $("#treeId").val();
|
||||
var deptId = $.common.isEmpty(treeId) ? "100" : $("#treeId").val();
|
||||
var url = ctx + "train/courseware/category/selectCategoryTree/" + deptId;
|
||||
var options = {
|
||||
title: '选择部门',
|
||||
width: "380",
|
||||
url: url,
|
||||
callBack: doSubmit
|
||||
};
|
||||
$.modal.openOptions(options);
|
||||
}
|
||||
function doSubmit(index, layero){
|
||||
var tree = layero.find("iframe")[0].contentWindow.$._tree;
|
||||
if ($.tree.notAllowParents(tree)) {
|
||||
var body = layer.getChildFrame('body', index);
|
||||
$("#treeId").val(body.find('#treeId').val());
|
||||
$("#treeName").val(body.find('#treeName').val());
|
||||
layer.close(index);
|
||||
}
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -1,196 +0,0 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
|
||||
<meta charset="utf-8">
|
||||
<head th:include="include :: header"></head>
|
||||
<link th:href="@{/ajax/libs/jquery-layout/jquery.layout-latest.css}" rel="stylesheet"/>
|
||||
<link th:href="@{/ajax/libs/jquery-ztree/3.5/css/metro/zTreeStyle.css}" rel="stylesheet"/>
|
||||
<body class="gray-bg">
|
||||
<div class="ui-layout-west">
|
||||
<div class="main-content">
|
||||
<div class="box box-main">
|
||||
<div class="box-header">
|
||||
<div class="box-title">
|
||||
<i class="fa icon-grid"></i> 课件分类
|
||||
</div>
|
||||
<div class="box-tools pull-right">
|
||||
<a type="button" class="btn btn-box-tool menuItem" href="#" onclick="category()" title="管理分类"><i class="fa fa-edit"></i></a>
|
||||
<button type="button" class="btn btn-box-tool" id="btnExpand" title="展开" style="display:none;"><i class="fa fa-chevron-up"></i></button>
|
||||
<button type="button" class="btn btn-box-tool" id="btnCollapse" title="折叠"><i class="fa fa-chevron-down"></i></button>
|
||||
<button type="button" class="btn btn-box-tool" id="btnRefresh" title="刷新分类"><i class="fa fa-refresh"></i></button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="ui-layout-content">
|
||||
<div id="tree" class="ztree"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="container-div ui-layout-center">
|
||||
<div class="row">
|
||||
<div class="col-sm-12 search-collapse">
|
||||
|
||||
<input type="hidden" id="trainCoursewareCategoryId" name="trainCoursewareCategoryId">
|
||||
<input type="hidden" id="parentId" name="parentId">
|
||||
<form id="formId">
|
||||
<div class="select-list">
|
||||
<ul>
|
||||
<li>
|
||||
课件名称:<input type="text" name="name"/>
|
||||
</li>
|
||||
<li>
|
||||
课件类型:<!--(1-文档,2-图文,3-视频,4-音频,5-图片,6-外部链接)-->
|
||||
<select name="status" th:with="type=${@dict.getType('train_courseware_category')}">
|
||||
<option value="">所有</option>
|
||||
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
|
||||
</select>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i> 搜索</a>
|
||||
<a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i> 重置</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<div class="btn-group-sm hidden-xs" id="toolbar" role="group">
|
||||
<a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="train:trainCourseware:add">
|
||||
<i class="fa fa-plus"></i> 添加
|
||||
</a>
|
||||
<a class="btn btn-primary btn-edit disabled" onclick="$.operate.edit()" shiro:hasPermission="train:trainCourseware:edit">
|
||||
<i class="fa fa-edit"></i> 修改
|
||||
</a>
|
||||
<a class="btn btn-danger btn-del btn-del disabled" onclick="$.operate.removeAll()" shiro:hasPermission="train:trainCourseware:remove">
|
||||
<i class="fa fa-remove"></i> 删除
|
||||
</a>
|
||||
<a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="train:trainCourseware:export">
|
||||
<i class="fa fa-download"></i> 导出
|
||||
</a>
|
||||
</div>
|
||||
<div class="col-sm-12 select-table table-striped">
|
||||
<table id="bootstrap-table" data-mobile-responsive="true"></table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div th:include="include :: footer"></div>
|
||||
<script th:src="@{/ajax/libs/jquery-layout/jquery.layout-latest.js}"></script>
|
||||
<script th:src="@{/ajax/libs/jquery-ztree/3.5/js/jquery.ztree.all-3.5.js}"></script>
|
||||
<script th:inline="javascript">
|
||||
var editFlag = [[${@permission.hasPermi('train:trainCourseware:edit')}]];
|
||||
var removeFlag = [[${@permission.hasPermi('train:trainCourseware:remove')}]];
|
||||
var datas = [[${@dict.getType('train_courseware_category')}]];
|
||||
var datasState = [[${@dict.getType('train_open_state')}]];
|
||||
var prefix = ctx + "train/trainCourseware";
|
||||
|
||||
$(function() {
|
||||
$('body').layout({ west__size: 185 });
|
||||
queryCategoryTree();
|
||||
queryTrainCourseware();
|
||||
});
|
||||
function queryTrainCourseware() {
|
||||
var options = {
|
||||
url: prefix + "/list",
|
||||
createUrl: prefix + "/add",
|
||||
updateUrl: prefix + "/edit/{id}",
|
||||
removeUrl: prefix + "/remove",
|
||||
exportUrl: prefix + "/export",
|
||||
modalName: "课件",
|
||||
uniqueId:'id',
|
||||
search: false,
|
||||
showExport: true,
|
||||
columns: [{
|
||||
checkbox: true
|
||||
},
|
||||
{
|
||||
field : 'trainCoursewareCategoryId',
|
||||
title : '课件分类',
|
||||
sortable: true
|
||||
},
|
||||
{
|
||||
field : 'name',
|
||||
title : '课件名称',
|
||||
sortable: true
|
||||
},
|
||||
{
|
||||
field : 'type',
|
||||
title : '课件类型',
|
||||
formatter: function(value, row, index) {
|
||||
return $.table.selectDictLabel(datas, value);
|
||||
}
|
||||
},
|
||||
{
|
||||
field : 'learnTime',
|
||||
title : '学习时常(分钟)',
|
||||
},
|
||||
{
|
||||
field : 'state',
|
||||
title : '是否公开',
|
||||
formatter: function(value, row, index) {
|
||||
return $.table.selectDictLabel(datasState, value);
|
||||
}
|
||||
},
|
||||
{
|
||||
field : 'createBy',
|
||||
title : '创建者',
|
||||
},
|
||||
{
|
||||
field : 'createTime',
|
||||
title : '创建时间',
|
||||
sortable: true
|
||||
},
|
||||
{
|
||||
title: '操作',
|
||||
align: 'center',
|
||||
formatter: function(value, row, index) {
|
||||
var actions = [];
|
||||
actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="#" onclick="$.operate.edit(\'' + row.id + '\')"><i class="fa fa-edit"></i>编辑</a> ');
|
||||
actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="#" onclick="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-remove"></i>删除</a>');
|
||||
return actions.join('');
|
||||
}
|
||||
}]
|
||||
};
|
||||
$.table.init(options);
|
||||
}
|
||||
|
||||
function queryCategoryTree()
|
||||
{
|
||||
var url = ctx + "train/courseware/category/treeData";
|
||||
var options = {
|
||||
url: url,
|
||||
expandLevel: 2,
|
||||
onClick : zOnClick
|
||||
};
|
||||
$.tree.init(options);
|
||||
|
||||
function zOnClick(event, treeId, treeNode) {
|
||||
$("#trainCoursewareCategoryId").val(treeNode.id);
|
||||
$("#parentId").val(treeNode.pId);
|
||||
$.table.search();
|
||||
}
|
||||
}
|
||||
|
||||
$('#btnExpand').click(function() {
|
||||
$._tree.expandAll(true);
|
||||
$(this).hide();
|
||||
$('#btnCollapse').show();
|
||||
});
|
||||
|
||||
$('#btnCollapse').click(function() {
|
||||
$._tree.expandAll(false);
|
||||
$(this).hide();
|
||||
$('#btnExpand').show();
|
||||
});
|
||||
|
||||
$('#btnRefresh').click(function() {
|
||||
queryCategoryTree();
|
||||
});
|
||||
/*用户管理-部门*/
|
||||
function category() {
|
||||
var url = ctx + "system/dept";
|
||||
createMenuItem(url, "部门管理");
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
|
@ -1,167 +0,0 @@
|
|||
package com.ruoyi.vip.controller;
|
||||
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.base.AjaxResult;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.common.utils.ExcelUtil;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import com.ruoyi.framework.shiro.service.SysPasswordService;
|
||||
import com.ruoyi.framework.web.base.BaseController;
|
||||
import com.ruoyi.framework.web.page.TableDataInfo;
|
||||
import com.ruoyi.framework.web.util.ShiroUtils;
|
||||
import com.ruoyi.system.domain.SysUser;
|
||||
import com.ruoyi.vip.domain.VipUser;
|
||||
import com.ruoyi.vip.service.IVipUserService;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.ui.ModelMap;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 用户信息
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping("/vip/user")
|
||||
public class VipUserController extends BaseController {
|
||||
private String prefix = "vip/user";
|
||||
|
||||
@Autowired
|
||||
private IVipUserService userService;
|
||||
|
||||
@Autowired
|
||||
private SysPasswordService passwordService;
|
||||
|
||||
@RequiresPermissions("vip:user:view")
|
||||
@GetMapping()
|
||||
public String user() {
|
||||
return prefix + "/user";
|
||||
}
|
||||
|
||||
@RequiresPermissions("vip:user:list")
|
||||
@PostMapping("/list")
|
||||
@ResponseBody
|
||||
public TableDataInfo list(VipUser user) {
|
||||
|
||||
List<VipUser> list = userService.selectUserList( user );
|
||||
return getDataTable( list );
|
||||
}
|
||||
|
||||
@Log(title = "用户管理", businessType = BusinessType.EXPORT)
|
||||
@RequiresPermissions("vip:user:export")
|
||||
@PostMapping("/export")
|
||||
@ResponseBody
|
||||
public AjaxResult export(VipUser user) {
|
||||
List<VipUser> list = userService.selectUserList( user );
|
||||
ExcelUtil<VipUser> util = new ExcelUtil<VipUser>( VipUser.class );
|
||||
return util.exportExcel( list, "user" );
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增用户
|
||||
*/
|
||||
@GetMapping("/add")
|
||||
public String add(ModelMap mmap) {
|
||||
return prefix + "/add";
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增保存用户
|
||||
*/
|
||||
@RequiresPermissions("vip:user:add")
|
||||
@Log(title = "用户管理", businessType = BusinessType.INSERT)
|
||||
@PostMapping("/add")
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@ResponseBody
|
||||
public AjaxResult addSave(VipUser user) {
|
||||
user.setSalt( ShiroUtils.randomSalt() );
|
||||
user.setPassword( passwordService.encryptPassword( user.getLoginName(), user.getPassword(), user.getSalt() ) );
|
||||
user.setCreateBy( ShiroUtils.getLoginName() );
|
||||
return toAjax( userService.insertUser( user ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改用户
|
||||
*/
|
||||
@GetMapping("/edit/{userId}")
|
||||
public String edit(@PathVariable("userId") Long userId, ModelMap mmap) {
|
||||
mmap.put( "user", userService.selectUserById( userId ) );
|
||||
return prefix + "/edit";
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改保存用户
|
||||
*/
|
||||
@RequiresPermissions("vip:user:edit")
|
||||
@Log(title = "用户管理", businessType = BusinessType.UPDATE)
|
||||
@PostMapping("/edit")
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@ResponseBody
|
||||
public AjaxResult editSave(VipUser user) {
|
||||
|
||||
user.setUpdateBy( ShiroUtils.getLoginName() );
|
||||
return toAjax( userService.updateUser( user ) );
|
||||
}
|
||||
|
||||
@RequiresPermissions("vip:user:resetPwd")
|
||||
@Log(title = "重置密码", businessType = BusinessType.UPDATE)
|
||||
@GetMapping("/resetPwd/{userId}")
|
||||
public String resetPwd(@PathVariable("userId") Long userId, ModelMap mmap) {
|
||||
mmap.put( "user", userService.selectUserById( userId ) );
|
||||
return prefix + "/resetPwd";
|
||||
}
|
||||
|
||||
@RequiresPermissions("vip:user:resetPwd")
|
||||
@Log(title = "重置密码", businessType = BusinessType.UPDATE)
|
||||
@PostMapping("/resetPwd")
|
||||
@ResponseBody
|
||||
public AjaxResult resetPwdSave(VipUser user) {
|
||||
user.setSalt( ShiroUtils.randomSalt() );
|
||||
user.setPassword( passwordService.encryptPassword( user.getLoginName(), user.getPassword(), user.getSalt() ) );
|
||||
return toAjax( userService.resetUserPwd( user ) );
|
||||
}
|
||||
|
||||
@RequiresPermissions("vip:user:remove")
|
||||
@Log(title = "用户管理", businessType = BusinessType.DELETE)
|
||||
@PostMapping("/remove")
|
||||
@ResponseBody
|
||||
public AjaxResult remove(String ids) {
|
||||
try {
|
||||
return toAjax( userService.deleteUserByIds( ids ) );
|
||||
} catch (Exception e) {
|
||||
return error( e.getMessage() );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验用户名
|
||||
*/
|
||||
@PostMapping("/checkLoginNameUnique")
|
||||
@ResponseBody
|
||||
public String checkLoginNameUnique(VipUser user) {
|
||||
return userService.checkLoginNameUnique( user.getLoginName() );
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验手机号码
|
||||
*/
|
||||
@PostMapping("/checkPhoneUnique")
|
||||
@ResponseBody
|
||||
public String checkPhoneUnique(VipUser user) {
|
||||
return userService.checkPhoneUnique( user );
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验email邮箱
|
||||
*/
|
||||
@PostMapping("/checkEmailUnique")
|
||||
@ResponseBody
|
||||
public String checkEmailUnique(VipUser user) {
|
||||
return userService.checkEmailUnique( user );
|
||||
}
|
||||
}
|
||||
|
|
@ -1,264 +0,0 @@
|
|||
package com.ruoyi.vip.domain;
|
||||
|
||||
import com.ruoyi.common.annotation.Excel;
|
||||
import com.ruoyi.common.base.BaseEntity;
|
||||
import com.ruoyi.system.domain.SysDept;
|
||||
import com.ruoyi.system.domain.SysRole;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
|
||||
import javax.persistence.Id;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 用户对象 vip_user
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
public class VipUser extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 用户ID */
|
||||
@Excel(name = "用户序号")
|
||||
@Id
|
||||
private Long id;
|
||||
|
||||
/** 部门ID */
|
||||
private Long deptId;
|
||||
|
||||
/** 部门父ID */
|
||||
private Long parentId;
|
||||
|
||||
/** 登录名称 */
|
||||
@Excel(name = "登录名称")
|
||||
private String loginName;
|
||||
|
||||
/** 用户名称 */
|
||||
@Excel(name = "用户名称")
|
||||
private String userName;
|
||||
|
||||
/** 用户邮箱 */
|
||||
@Excel(name = "用户邮箱")
|
||||
private String email;
|
||||
|
||||
/** 手机号码 */
|
||||
@Excel(name = "手机号码")
|
||||
private String phonenumber;
|
||||
|
||||
/** 用户性别 */
|
||||
@Excel(name = "用户性别", readConverterExp = "0=男,1=女,2=未知")
|
||||
private String sex;
|
||||
|
||||
/** 用户头像 */
|
||||
private String avatar;
|
||||
|
||||
/** 密码 */
|
||||
private String password;
|
||||
|
||||
/** 盐加密 */
|
||||
private String salt;
|
||||
|
||||
/** 帐号状态(0正常 1停用) */
|
||||
@Excel(name = "帐号状态", readConverterExp = "0=正常,1=停用")
|
||||
private String status;
|
||||
|
||||
/** 删除标志(0代表存在 2代表删除) */
|
||||
private String delFlag;
|
||||
|
||||
/** 最后登陆IP */
|
||||
@Excel(name = "最后登陆IP")
|
||||
private String loginIp;
|
||||
|
||||
/** 最后登陆时间 */
|
||||
@Excel(name = "最后登陆时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date loginDate;
|
||||
|
||||
/** 部门对象 */
|
||||
private SysDept dept;
|
||||
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Long getDeptId()
|
||||
{
|
||||
return deptId;
|
||||
}
|
||||
|
||||
public void setDeptId(Long deptId)
|
||||
{
|
||||
this.deptId = deptId;
|
||||
}
|
||||
|
||||
public Long getParentId()
|
||||
{
|
||||
return parentId;
|
||||
}
|
||||
|
||||
public void setParentId(Long parentId)
|
||||
{
|
||||
this.parentId = parentId;
|
||||
}
|
||||
|
||||
public String getLoginName()
|
||||
{
|
||||
return loginName;
|
||||
}
|
||||
|
||||
public void setLoginName(String loginName)
|
||||
{
|
||||
this.loginName = loginName;
|
||||
}
|
||||
|
||||
public String getUserName()
|
||||
{
|
||||
return userName;
|
||||
}
|
||||
|
||||
public void setUserName(String userName)
|
||||
{
|
||||
this.userName = userName;
|
||||
}
|
||||
|
||||
public String getEmail()
|
||||
{
|
||||
return email;
|
||||
}
|
||||
|
||||
public void setEmail(String email)
|
||||
{
|
||||
this.email = email;
|
||||
}
|
||||
|
||||
public String getPhonenumber()
|
||||
{
|
||||
return phonenumber;
|
||||
}
|
||||
|
||||
public void setPhonenumber(String phonenumber)
|
||||
{
|
||||
this.phonenumber = phonenumber;
|
||||
}
|
||||
|
||||
public String getSex()
|
||||
{
|
||||
return sex;
|
||||
}
|
||||
|
||||
public void setSex(String sex)
|
||||
{
|
||||
this.sex = sex;
|
||||
}
|
||||
|
||||
public String getAvatar()
|
||||
{
|
||||
return avatar;
|
||||
}
|
||||
|
||||
public void setAvatar(String avatar)
|
||||
{
|
||||
this.avatar = avatar;
|
||||
}
|
||||
|
||||
public String getPassword()
|
||||
{
|
||||
return password;
|
||||
}
|
||||
|
||||
public void setPassword(String password)
|
||||
{
|
||||
this.password = password;
|
||||
}
|
||||
|
||||
public String getSalt()
|
||||
{
|
||||
return salt;
|
||||
}
|
||||
|
||||
public void setSalt(String salt)
|
||||
{
|
||||
this.salt = salt;
|
||||
}
|
||||
|
||||
public String getStatus()
|
||||
{
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(String status)
|
||||
{
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public String getDelFlag()
|
||||
{
|
||||
return delFlag;
|
||||
}
|
||||
|
||||
public void setDelFlag(String delFlag)
|
||||
{
|
||||
this.delFlag = delFlag;
|
||||
}
|
||||
|
||||
public String getLoginIp()
|
||||
{
|
||||
return loginIp;
|
||||
}
|
||||
|
||||
public void setLoginIp(String loginIp)
|
||||
{
|
||||
this.loginIp = loginIp;
|
||||
}
|
||||
|
||||
public Date getLoginDate()
|
||||
{
|
||||
return loginDate;
|
||||
}
|
||||
|
||||
public void setLoginDate(Date loginDate)
|
||||
{
|
||||
this.loginDate = loginDate;
|
||||
}
|
||||
|
||||
public SysDept getDept()
|
||||
{
|
||||
return dept;
|
||||
}
|
||||
|
||||
public void setDept(SysDept dept)
|
||||
{
|
||||
this.dept = dept;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("userId", getId())
|
||||
.append("deptId", getDeptId())
|
||||
.append("loginName", getLoginName())
|
||||
.append("userName", getUserName())
|
||||
.append("email", getEmail())
|
||||
.append("phonenumber", getPhonenumber())
|
||||
.append("sex", getSex())
|
||||
.append("avatar", getAvatar())
|
||||
.append("password", getPassword())
|
||||
.append("salt", getSalt())
|
||||
.append("status", getStatus())
|
||||
.append("delFlag", getDelFlag())
|
||||
.append("loginIp", getLoginIp())
|
||||
.append("loginDate", getLoginDate())
|
||||
.append("createBy", getCreateBy())
|
||||
.append("createTime", getCreateTime())
|
||||
.append("updateBy", getUpdateBy())
|
||||
.append("updateTime", getUpdateTime())
|
||||
.append("remark", getRemark())
|
||||
.toString();
|
||||
}
|
||||
}
|
||||
|
|
@ -1,32 +0,0 @@
|
|||
package com.ruoyi.vip.framework;
|
||||
|
||||
import org.apache.shiro.authc.UsernamePasswordToken;
|
||||
|
||||
/**
|
||||
* 自定义带用户类型token
|
||||
* @author Sunny
|
||||
*/
|
||||
public class UsernamePasswordByUserTypeToken extends UsernamePasswordToken {
|
||||
private static final long serialVersionUID = -7638434498222500528L;
|
||||
|
||||
/*
|
||||
* 用户类型
|
||||
* 1:积分后台用户(后台管理员)
|
||||
* 2:积分兑换端用户(店长店员)
|
||||
* 3:积分验证端用户(第三方合作店铺)
|
||||
*/
|
||||
private String userType;
|
||||
|
||||
public String getUserType() {
|
||||
return userType;
|
||||
}
|
||||
|
||||
public void setUserType(String userType) {
|
||||
this.userType = userType;
|
||||
}
|
||||
|
||||
public UsernamePasswordByUserTypeToken(String username, String password, String userType) {
|
||||
super(username, password);
|
||||
this.userType = userType;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,134 +0,0 @@
|
|||
package com.ruoyi.vip.framework;
|
||||
|
||||
import com.ruoyi.common.constant.Constants;
|
||||
import com.ruoyi.common.constant.ShiroConstants;
|
||||
import com.ruoyi.common.constant.UserConstants;
|
||||
import com.ruoyi.common.enums.UserStatus;
|
||||
import com.ruoyi.common.utils.DateUtils;
|
||||
import com.ruoyi.framework.manager.AsyncManager;
|
||||
import com.ruoyi.framework.manager.factory.AsyncFactory;
|
||||
import com.ruoyi.framework.shiro.service.SysPasswordService;
|
||||
import com.ruoyi.framework.web.exception.user.*;
|
||||
import com.ruoyi.framework.web.util.MessageUtils;
|
||||
import com.ruoyi.framework.web.util.ServletUtils;
|
||||
import com.ruoyi.framework.web.util.ShiroUtils;
|
||||
import com.ruoyi.vip.domain.VipUser;
|
||||
import com.ruoyi.vip.service.IVipUserService;
|
||||
import org.apache.shiro.authc.credential.PasswordService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
/**
|
||||
* 登录校验方法
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@Component
|
||||
public class VipLoginService
|
||||
{
|
||||
@Autowired
|
||||
private VipPasswordService vipPasswordService;
|
||||
|
||||
@Autowired
|
||||
private IVipUserService vipUserService;
|
||||
|
||||
/**
|
||||
* 登录
|
||||
*/
|
||||
public VipUser login(String username, String password)
|
||||
{
|
||||
// 验证码校验
|
||||
if (!StringUtils.isEmpty(ServletUtils.getRequest().getAttribute(ShiroConstants.CURRENT_CAPTCHA)))
|
||||
{
|
||||
AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_FAIL, MessageUtils.message("user.jcaptcha.error")));
|
||||
throw new CaptchaException();
|
||||
}
|
||||
// 用户名或密码为空 错误
|
||||
if (StringUtils.isEmpty(username) || StringUtils.isEmpty(password))
|
||||
{
|
||||
AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_FAIL, MessageUtils.message("not.null")));
|
||||
throw new UserNotExistsException();
|
||||
}
|
||||
// 密码如果不在指定范围内 错误
|
||||
if (password.length() < UserConstants.PASSWORD_MIN_LENGTH
|
||||
|| password.length() > UserConstants.PASSWORD_MAX_LENGTH)
|
||||
{
|
||||
AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_FAIL, MessageUtils.message("user.password.not.match")));
|
||||
throw new UserPasswordNotMatchException();
|
||||
}
|
||||
|
||||
// 用户名不在指定范围内 错误
|
||||
if (username.length() < UserConstants.USERNAME_MIN_LENGTH
|
||||
|| username.length() > UserConstants.USERNAME_MAX_LENGTH)
|
||||
{
|
||||
AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_FAIL, MessageUtils.message("user.password.not.match")));
|
||||
throw new UserPasswordNotMatchException();
|
||||
}
|
||||
|
||||
// 查询用户信息
|
||||
VipUser user = vipUserService.selectUserByLoginName(username);
|
||||
|
||||
if (user == null && maybeMobilePhoneNumber(username))
|
||||
{
|
||||
user = vipUserService.selectUserByPhoneNumber(username);
|
||||
}
|
||||
|
||||
if (user == null && maybeEmail(username))
|
||||
{
|
||||
user = vipUserService.selectUserByEmail(username);
|
||||
}
|
||||
|
||||
if (user == null)
|
||||
{
|
||||
AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_FAIL, MessageUtils.message("user.not.exists")));
|
||||
throw new UserNotExistsException();
|
||||
}
|
||||
|
||||
if (UserStatus.DELETED.getCode().equals(user.getDelFlag()))
|
||||
{
|
||||
AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_FAIL, MessageUtils.message("user.password.delete")));
|
||||
throw new UserDeleteException();
|
||||
}
|
||||
|
||||
if (UserStatus.DISABLE.getCode().equals(user.getStatus()))
|
||||
{
|
||||
AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_FAIL, MessageUtils.message("user.blocked", user.getRemark())));
|
||||
throw new UserBlockedException(user.getRemark());
|
||||
}
|
||||
|
||||
vipPasswordService.validate(user, password);
|
||||
|
||||
AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_SUCCESS, MessageUtils.message("user.login.success")));
|
||||
recordLoginInfo(user);
|
||||
return user;
|
||||
}
|
||||
|
||||
private boolean maybeEmail(String username)
|
||||
{
|
||||
if (!username.matches(UserConstants.EMAIL_PATTERN))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private boolean maybeMobilePhoneNumber(String username)
|
||||
{
|
||||
if (!username.matches(UserConstants.MOBILE_PHONE_NUMBER_PATTERN))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 记录登录信息
|
||||
*/
|
||||
public void recordLoginInfo(VipUser user)
|
||||
{
|
||||
user.setLoginIp(ShiroUtils.getIp());
|
||||
user.setLoginDate(DateUtils.getNowDate());
|
||||
vipUserService.updateUserInfo(user);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,87 +0,0 @@
|
|||
package com.ruoyi.vip.framework;
|
||||
|
||||
import com.ruoyi.common.constant.Constants;
|
||||
import com.ruoyi.framework.manager.AsyncManager;
|
||||
import com.ruoyi.framework.manager.factory.AsyncFactory;
|
||||
import com.ruoyi.framework.web.exception.user.UserPasswordNotMatchException;
|
||||
import com.ruoyi.framework.web.exception.user.UserPasswordRetryLimitExceedException;
|
||||
import com.ruoyi.framework.web.util.MessageUtils;
|
||||
import com.ruoyi.system.domain.SysUser;
|
||||
import com.ruoyi.vip.domain.VipUser;
|
||||
import org.apache.shiro.cache.Cache;
|
||||
import org.apache.shiro.cache.CacheManager;
|
||||
import org.apache.shiro.crypto.hash.Md5Hash;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
/**
|
||||
* 登录密码方法
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@Component
|
||||
public class VipPasswordService
|
||||
{
|
||||
@Autowired
|
||||
private CacheManager cacheManager;
|
||||
|
||||
private Cache<String, AtomicInteger> loginRecordCache;
|
||||
|
||||
@Value(value = "${user.password.maxRetryCount}")
|
||||
private String maxRetryCount;
|
||||
|
||||
@PostConstruct
|
||||
public void init()
|
||||
{
|
||||
loginRecordCache = cacheManager.getCache("loginRecordCache");
|
||||
}
|
||||
|
||||
public void validate(VipUser user, String password)
|
||||
{
|
||||
String loginName = user.getLoginName();
|
||||
|
||||
AtomicInteger retryCount = loginRecordCache.get(loginName);
|
||||
|
||||
if (retryCount == null)
|
||||
{
|
||||
retryCount = new AtomicInteger(0);
|
||||
loginRecordCache.put(loginName, retryCount);
|
||||
}
|
||||
if (retryCount.incrementAndGet() > Integer.valueOf(maxRetryCount).intValue())
|
||||
{
|
||||
AsyncManager.me().execute(AsyncFactory.recordLogininfor(loginName, Constants.LOGIN_FAIL, MessageUtils.message("user.password.retry.limit.exceed", maxRetryCount)));
|
||||
throw new UserPasswordRetryLimitExceedException(Integer.valueOf(maxRetryCount).intValue());
|
||||
}
|
||||
|
||||
if (!matches(user, password))
|
||||
{
|
||||
AsyncManager.me().execute(AsyncFactory.recordLogininfor(loginName, Constants.LOGIN_FAIL, MessageUtils.message("user.password.retry.limit.count", retryCount)));
|
||||
loginRecordCache.put(loginName, retryCount);
|
||||
throw new UserPasswordNotMatchException();
|
||||
}
|
||||
else
|
||||
{
|
||||
clearLoginRecordCache(loginName);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean matches(VipUser user, String newPassword)
|
||||
{
|
||||
return user.getPassword().equals(encryptPassword(user.getLoginName(), newPassword, user.getSalt()));
|
||||
}
|
||||
|
||||
public void clearLoginRecordCache(String username)
|
||||
{
|
||||
loginRecordCache.remove(username);
|
||||
}
|
||||
|
||||
public String encryptPassword(String username, String password, String salt)
|
||||
{
|
||||
return new Md5Hash(username + password + salt).toHex().toString();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,112 +0,0 @@
|
|||
package com.ruoyi.vip.framework;
|
||||
|
||||
import com.ruoyi.framework.shiro.service.SysLoginService;
|
||||
import com.ruoyi.framework.web.exception.user.*;
|
||||
import com.ruoyi.framework.web.util.ShiroUtils;
|
||||
import com.ruoyi.system.domain.SysUser;
|
||||
import com.ruoyi.system.service.ISysMenuService;
|
||||
import com.ruoyi.system.service.ISysRoleService;
|
||||
import com.ruoyi.vip.domain.VipUser;
|
||||
import com.ruoyi.vip.utils.VipUserUtils;
|
||||
import org.apache.shiro.SecurityUtils;
|
||||
import org.apache.shiro.authc.*;
|
||||
import org.apache.shiro.authz.AuthorizationInfo;
|
||||
import org.apache.shiro.authz.SimpleAuthorizationInfo;
|
||||
import org.apache.shiro.realm.AuthorizingRealm;
|
||||
import org.apache.shiro.subject.PrincipalCollection;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* 自定义Realm 处理登录 权限
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
public class VipUserRealm extends AuthorizingRealm
|
||||
{
|
||||
private static final Logger log = LoggerFactory.getLogger(VipUserRealm.class);
|
||||
|
||||
|
||||
@Autowired
|
||||
private VipLoginService vipLoginService;
|
||||
|
||||
/**
|
||||
* 授权
|
||||
*/
|
||||
@Override
|
||||
protected AuthorizationInfo doGetAuthorizationInfo(PrincipalCollection arg0)
|
||||
{
|
||||
VipUser user = VipUserUtils.getVipUser();
|
||||
// 角色列表
|
||||
Set<String> roles = new HashSet<String>();
|
||||
// 功能列表
|
||||
Set<String> menus = new HashSet<String>();
|
||||
SimpleAuthorizationInfo info = new SimpleAuthorizationInfo();
|
||||
|
||||
return info;
|
||||
}
|
||||
|
||||
/**
|
||||
* 登录认证
|
||||
*/
|
||||
@Override
|
||||
protected AuthenticationInfo doGetAuthenticationInfo(AuthenticationToken token) throws AuthenticationException
|
||||
{
|
||||
UsernamePasswordByUserTypeToken upToken = (UsernamePasswordByUserTypeToken) token;
|
||||
String username = upToken.getUsername();
|
||||
String password = "";
|
||||
if (upToken.getPassword() != null)
|
||||
{
|
||||
password = new String(upToken.getPassword());
|
||||
}
|
||||
|
||||
VipUser user = null;
|
||||
try
|
||||
{
|
||||
user = vipLoginService.login(username, password);
|
||||
}
|
||||
catch (CaptchaException e)
|
||||
{
|
||||
throw new AuthenticationException(e.getMessage(), e);
|
||||
}
|
||||
catch (UserNotExistsException e)
|
||||
{
|
||||
throw new UnknownAccountException(e.getMessage(), e);
|
||||
}
|
||||
catch (UserPasswordNotMatchException e)
|
||||
{
|
||||
throw new IncorrectCredentialsException(e.getMessage(), e);
|
||||
}
|
||||
catch (UserPasswordRetryLimitExceedException e)
|
||||
{
|
||||
throw new ExcessiveAttemptsException(e.getMessage(), e);
|
||||
}
|
||||
catch (UserBlockedException e)
|
||||
{
|
||||
throw new LockedAccountException(e.getMessage(), e);
|
||||
}
|
||||
catch (RoleBlockedException e)
|
||||
{
|
||||
throw new LockedAccountException(e.getMessage(), e);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
log.info("对用户[" + username + "]进行登录验证..验证未通过{}", e.getMessage());
|
||||
throw new AuthenticationException(e.getMessage(), e);
|
||||
}
|
||||
SimpleAuthenticationInfo info = new SimpleAuthenticationInfo(user, password, getName());
|
||||
return info;
|
||||
}
|
||||
|
||||
/**
|
||||
* 清理缓存权限
|
||||
*/
|
||||
public void clearCachedAuthorizationInfo()
|
||||
{
|
||||
this.clearCachedAuthorizationInfo(SecurityUtils.getSubject().getPrincipals());
|
||||
}
|
||||
}
|
||||
|
|
@ -1,110 +0,0 @@
|
|||
package com.ruoyi.vip.mapper;
|
||||
|
||||
import com.ruoyi.framework.web.base.MyMapper;
|
||||
import com.ruoyi.vip.domain.VipUser;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 用户表 数据层
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
public interface VipUserMapper extends MyMapper<VipUser>
|
||||
{
|
||||
/**
|
||||
* 根据条件分页查询用户对象
|
||||
*
|
||||
* @param sysUser 用户信息
|
||||
* @return 用户信息集合信息
|
||||
*/
|
||||
public List<VipUser> selectUserList(VipUser sysUser);
|
||||
|
||||
/**
|
||||
* 通过用户名查询用户
|
||||
*
|
||||
* @param userName 用户名
|
||||
* @return 用户对象信息
|
||||
*/
|
||||
public VipUser selectUserByLoginName(String userName);
|
||||
|
||||
/**
|
||||
* 通过手机号码查询用户
|
||||
*
|
||||
* @param phoneNumber 手机号码
|
||||
* @return 用户对象信息
|
||||
*/
|
||||
public VipUser selectUserByPhoneNumber(String phoneNumber);
|
||||
|
||||
/**
|
||||
* 通过邮箱查询用户
|
||||
*
|
||||
* @param email 邮箱
|
||||
* @return 用户对象信息
|
||||
*/
|
||||
public VipUser selectUserByEmail(String email);
|
||||
|
||||
/**
|
||||
* 通过用户ID查询用户
|
||||
*
|
||||
* @param userId 用户ID
|
||||
* @return 用户对象信息
|
||||
*/
|
||||
public VipUser selectUserById(Long userId);
|
||||
|
||||
/**
|
||||
* 通过用户ID删除用户
|
||||
*
|
||||
* @param userId 用户ID
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteUserById(Long userId);
|
||||
|
||||
/**
|
||||
* 批量删除用户信息
|
||||
*
|
||||
* @param ids 需要删除的数据ID
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteUserByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 修改用户信息
|
||||
*
|
||||
* @param user 用户信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateUser(VipUser user);
|
||||
|
||||
/**
|
||||
* 新增用户信息
|
||||
*
|
||||
* @param user 用户信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertUser(VipUser user);
|
||||
|
||||
/**
|
||||
* 校验用户名称是否唯一
|
||||
*
|
||||
* @param loginName 登录名称
|
||||
* @return 结果
|
||||
*/
|
||||
public int checkLoginNameUnique(String loginName);
|
||||
|
||||
/**
|
||||
* 校验手机号码是否唯一
|
||||
*
|
||||
* @param phonenumber 手机号码
|
||||
* @return 结果
|
||||
*/
|
||||
public VipUser checkPhoneUnique(String phonenumber);
|
||||
|
||||
/**
|
||||
* 校验email是否唯一
|
||||
*
|
||||
* @param email 用户邮箱
|
||||
* @return 结果
|
||||
*/
|
||||
public VipUser checkEmailUnique(String email);
|
||||
}
|
||||
|
|
@ -1,128 +0,0 @@
|
|||
package com.ruoyi.vip.service;
|
||||
|
||||
import com.ruoyi.framework.web.base.AbstractBaseService;
|
||||
import com.ruoyi.vip.domain.VipUser;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 用户 业务层
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
public interface IVipUserService extends AbstractBaseService<VipUser>
|
||||
{
|
||||
/**
|
||||
* 根据条件分页查询用户对象
|
||||
*
|
||||
* @param user 用户信息
|
||||
* @return 用户信息集合信息
|
||||
*/
|
||||
public List<VipUser> selectUserList(VipUser user);
|
||||
|
||||
/**
|
||||
* 通过用户名查询用户
|
||||
*
|
||||
* @param userName 用户名
|
||||
* @return 用户对象信息
|
||||
*/
|
||||
public VipUser selectUserByLoginName(String userName);
|
||||
|
||||
/**
|
||||
* 通过手机号码查询用户
|
||||
*
|
||||
* @param phoneNumber 手机号码
|
||||
* @return 用户对象信息
|
||||
*/
|
||||
public VipUser selectUserByPhoneNumber(String phoneNumber);
|
||||
|
||||
/**
|
||||
* 通过邮箱查询用户
|
||||
*
|
||||
* @param email 邮箱
|
||||
* @return 用户对象信息
|
||||
*/
|
||||
public VipUser selectUserByEmail(String email);
|
||||
|
||||
/**
|
||||
* 通过用户ID查询用户
|
||||
*
|
||||
* @param userId 用户ID
|
||||
* @return 用户对象信息
|
||||
*/
|
||||
public VipUser selectUserById(Long userId);
|
||||
|
||||
/**
|
||||
* 通过用户ID删除用户
|
||||
*
|
||||
* @param userId 用户ID
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteUserById(Long userId);
|
||||
|
||||
/**
|
||||
* 批量删除用户信息
|
||||
*
|
||||
* @param ids 需要删除的数据ID
|
||||
* @return 结果
|
||||
* @throws Exception 异常
|
||||
*/
|
||||
public int deleteUserByIds(String ids) throws Exception;
|
||||
|
||||
/**
|
||||
* 保存用户信息
|
||||
*
|
||||
* @param user 用户信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertUser(VipUser user);
|
||||
|
||||
/**
|
||||
* 保存用户信息
|
||||
*
|
||||
* @param user 用户信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateUser(VipUser user);
|
||||
|
||||
/**
|
||||
* 修改用户详细信息
|
||||
*
|
||||
* @param user 用户信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateUserInfo(VipUser user);
|
||||
|
||||
/**
|
||||
* 修改用户密码信息
|
||||
*
|
||||
* @param user 用户信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int resetUserPwd(VipUser user);
|
||||
|
||||
/**
|
||||
* 校验用户名称是否唯一
|
||||
*
|
||||
* @param loginName 登录名称
|
||||
* @return 结果
|
||||
*/
|
||||
public String checkLoginNameUnique(String loginName);
|
||||
|
||||
/**
|
||||
* 校验手机号码是否唯一
|
||||
*
|
||||
* @param user 用户信息
|
||||
* @return 结果
|
||||
*/
|
||||
public String checkPhoneUnique(VipUser user);
|
||||
|
||||
/**
|
||||
* 校验email是否唯一
|
||||
*
|
||||
* @param user 用户信息
|
||||
* @return 结果
|
||||
*/
|
||||
public String checkEmailUnique(VipUser user);
|
||||
|
||||
}
|
||||
|
|
@ -1,223 +0,0 @@
|
|||
package com.ruoyi.vip.service.impl;
|
||||
|
||||
import com.ruoyi.common.annotation.DataScope;
|
||||
import com.ruoyi.common.constant.UserConstants;
|
||||
import com.ruoyi.common.support.Convert;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import com.ruoyi.framework.web.base.AbstractBaseServiceImpl;
|
||||
import com.ruoyi.system.domain.SysPost;
|
||||
import com.ruoyi.system.domain.SysRole;
|
||||
import com.ruoyi.system.mapper.SysPostMapper;
|
||||
import com.ruoyi.system.mapper.SysRoleMapper;
|
||||
import com.ruoyi.system.mapper.SysUserPostMapper;
|
||||
import com.ruoyi.system.mapper.SysUserRoleMapper;
|
||||
import com.ruoyi.vip.domain.VipUser;
|
||||
import com.ruoyi.vip.mapper.VipUserMapper;
|
||||
import com.ruoyi.vip.service.IVipUserService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 用户 业务层处理
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@Service
|
||||
public class VipUserServiceImpl extends AbstractBaseServiceImpl<VipUserMapper, VipUser> implements IVipUserService {
|
||||
@Autowired
|
||||
private VipUserMapper userMapper;
|
||||
|
||||
@Autowired
|
||||
private SysRoleMapper roleMapper;
|
||||
|
||||
@Autowired
|
||||
private SysPostMapper postMapper;
|
||||
|
||||
@Autowired
|
||||
private SysUserPostMapper userPostMapper;
|
||||
|
||||
@Autowired
|
||||
private SysUserRoleMapper userRoleMapper;
|
||||
|
||||
/**
|
||||
* 根据条件分页查询用户对象
|
||||
*
|
||||
* @param user 用户信息
|
||||
* @return 用户信息集合信息
|
||||
*/
|
||||
@Override
|
||||
@DataScope(tableAlias = "u")
|
||||
public List<VipUser> selectUserList(VipUser user) {
|
||||
startPage();
|
||||
return userMapper.selectUserList( user );
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过用户名查询用户
|
||||
*
|
||||
* @param userName 用户名
|
||||
* @return 用户对象信息
|
||||
*/
|
||||
@Override
|
||||
public VipUser selectUserByLoginName(String userName) {
|
||||
return userMapper.selectUserByLoginName( userName );
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过手机号码查询用户
|
||||
*
|
||||
* @param phoneNumber 手机号码
|
||||
* @return 用户对象信息
|
||||
*/
|
||||
@Override
|
||||
public VipUser selectUserByPhoneNumber(String phoneNumber) {
|
||||
return userMapper.selectUserByPhoneNumber( phoneNumber );
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过邮箱查询用户
|
||||
*
|
||||
* @param email 邮箱
|
||||
* @return 用户对象信息
|
||||
*/
|
||||
@Override
|
||||
public VipUser selectUserByEmail(String email) {
|
||||
return userMapper.selectUserByEmail( email );
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过用户ID查询用户
|
||||
*
|
||||
* @param userId 用户ID
|
||||
* @return 用户对象信息
|
||||
*/
|
||||
@Override
|
||||
public VipUser selectUserById(Long userId) {
|
||||
return userMapper.selectUserById( userId );
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过用户ID删除用户
|
||||
*
|
||||
* @param userId 用户ID
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteUserById(Long userId) {
|
||||
// 删除用户与角色关联
|
||||
userRoleMapper.deleteUserRoleByUserId( userId );
|
||||
// 删除用户与岗位表
|
||||
userPostMapper.deleteUserPostByUserId( userId );
|
||||
return userMapper.deleteUserById( userId );
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除用户信息
|
||||
*
|
||||
* @param ids 需要删除的数据ID
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteUserByIds(String ids) throws Exception {
|
||||
Long[] userIds = Convert.toLongArray( ids );
|
||||
return userMapper.deleteUserByIds( userIds );
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增保存用户信息
|
||||
*
|
||||
* @param user 用户信息
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertUser(VipUser user) {
|
||||
// 新增用户信息
|
||||
int rows = userMapper.insertUser( user );
|
||||
return rows;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改保存用户信息
|
||||
*
|
||||
* @param user 用户信息
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateUser(VipUser user) {
|
||||
Long userId = user.getId();
|
||||
return userMapper.updateUser( user );
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改用户个人详细信息
|
||||
*
|
||||
* @param user 用户信息
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateUserInfo(VipUser user) {
|
||||
return userMapper.updateUser( user );
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改用户密码
|
||||
*
|
||||
* @param user 用户信息
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int resetUserPwd(VipUser user) {
|
||||
return updateUserInfo( user );
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验用户名称是否唯一
|
||||
*
|
||||
* @param loginName 用户名
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public String checkLoginNameUnique(String loginName) {
|
||||
int count = userMapper.checkLoginNameUnique( loginName );
|
||||
if (count > 0) {
|
||||
return UserConstants.USER_NAME_NOT_UNIQUE;
|
||||
}
|
||||
return UserConstants.USER_NAME_UNIQUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验用户名称是否唯一
|
||||
*
|
||||
* @param user 用户信息
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public String checkPhoneUnique(VipUser user) {
|
||||
Long userId = StringUtils.isNull( user.getId() ) ? -1L : user.getId();
|
||||
VipUser info = userMapper.checkPhoneUnique( user.getPhonenumber() );
|
||||
if (StringUtils.isNotNull( info ) && info.getId().longValue() != userId.longValue()) {
|
||||
return UserConstants.USER_PHONE_NOT_UNIQUE;
|
||||
}
|
||||
return UserConstants.USER_PHONE_UNIQUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验email是否唯一
|
||||
*
|
||||
* @param user 用户信息
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public String checkEmailUnique(VipUser user) {
|
||||
Long userId = StringUtils.isNull( user.getId() ) ? -1L : user.getId();
|
||||
VipUser info = userMapper.checkEmailUnique( user.getEmail() );
|
||||
if (StringUtils.isNotNull( info ) && info.getId().longValue() != userId.longValue()) {
|
||||
return UserConstants.USER_EMAIL_NOT_UNIQUE;
|
||||
}
|
||||
return UserConstants.USER_EMAIL_UNIQUE;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -1,96 +0,0 @@
|
|||
package com.ruoyi.vip.utils;
|
||||
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import com.ruoyi.common.utils.bean.BeanUtils;
|
||||
import com.ruoyi.framework.shiro.realm.UserRealm;
|
||||
import com.ruoyi.vip.domain.VipUser;
|
||||
import org.apache.shiro.SecurityUtils;
|
||||
import org.apache.shiro.crypto.SecureRandomNumberGenerator;
|
||||
import org.apache.shiro.mgt.RealmSecurityManager;
|
||||
import org.apache.shiro.session.Session;
|
||||
import org.apache.shiro.subject.PrincipalCollection;
|
||||
import org.apache.shiro.subject.SimplePrincipalCollection;
|
||||
import org.apache.shiro.subject.Subject;
|
||||
|
||||
/**
|
||||
* shiro 工具类
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
public class VipUserUtils
|
||||
{
|
||||
public static Subject getSubjct()
|
||||
{
|
||||
return SecurityUtils.getSubject();
|
||||
}
|
||||
|
||||
public static Session getSession()
|
||||
{
|
||||
return SecurityUtils.getSubject().getSession();
|
||||
}
|
||||
|
||||
public static void logout()
|
||||
{
|
||||
getSubjct().logout();
|
||||
}
|
||||
|
||||
public static VipUser getVipUser()
|
||||
{
|
||||
VipUser user = null;
|
||||
Object obj = getSubjct().getPrincipal();
|
||||
if (StringUtils.isNotNull(obj))
|
||||
{
|
||||
user = new VipUser();
|
||||
BeanUtils.copyBeanProp(user, obj);
|
||||
}
|
||||
return user;
|
||||
}
|
||||
|
||||
public static void setVipUser(VipUser user)
|
||||
{
|
||||
Subject subject = getSubjct();
|
||||
PrincipalCollection principalCollection = subject.getPrincipals();
|
||||
String realmName = principalCollection.getRealmNames().iterator().next();
|
||||
PrincipalCollection newPrincipalCollection = new SimplePrincipalCollection(user, realmName);
|
||||
// 重新加载Principal
|
||||
subject.runAs(newPrincipalCollection);
|
||||
}
|
||||
|
||||
public static void clearCachedAuthorizationInfo()
|
||||
{
|
||||
RealmSecurityManager rsm = (RealmSecurityManager) SecurityUtils.getSecurityManager();
|
||||
UserRealm realm = (UserRealm) rsm.getRealms().iterator().next();
|
||||
realm.clearCachedAuthorizationInfo();
|
||||
}
|
||||
|
||||
public static Long getUserId()
|
||||
{
|
||||
return getVipUser().getId().longValue();
|
||||
}
|
||||
|
||||
public static String getLoginName()
|
||||
{
|
||||
return getVipUser().getLoginName();
|
||||
}
|
||||
|
||||
public static String getIp()
|
||||
{
|
||||
return getSubjct().getSession().getHost();
|
||||
}
|
||||
|
||||
public static String getSessionId()
|
||||
{
|
||||
return String.valueOf(getSubjct().getSession().getId());
|
||||
}
|
||||
|
||||
/**
|
||||
* 生成随机盐
|
||||
*/
|
||||
public static String randomSalt()
|
||||
{
|
||||
// 一个Byte占两个字节,此处生成的3字节,字符串长度为6
|
||||
SecureRandomNumberGenerator secureRandom = new SecureRandomNumberGenerator();
|
||||
String hex = secureRandom.nextBytes(3).toHex();
|
||||
return hex;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,168 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.ruoyi.vip.mapper.VipUserMapper">
|
||||
|
||||
<resultMap type="VipUser" id="VipUserResult">
|
||||
<id property="id" column="id" />
|
||||
<result property="deptId" column="dept_id" />
|
||||
<result property="loginName" column="login_name" />
|
||||
<result property="userName" column="user_name" />
|
||||
<result property="email" column="email" />
|
||||
<result property="phonenumber" column="phonenumber" />
|
||||
<result property="sex" column="sex" />
|
||||
<result property="avatar" column="avatar" />
|
||||
<result property="password" column="password" />
|
||||
<result property="salt" column="salt" />
|
||||
<result property="status" column="status" />
|
||||
<result property="delFlag" column="del_flag" />
|
||||
<result property="loginIp" column="login_ip" />
|
||||
<result property="loginDate" column="login_date" />
|
||||
<result property="createBy" column="create_by" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="updateBy" column="update_by" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
<result property="remark" column="remark" />
|
||||
<association property="dept" column="dept_id" javaType="SysDept" resultMap="deptResult" />
|
||||
</resultMap>
|
||||
|
||||
<resultMap id="deptResult" type="SysDept">
|
||||
<id property="deptId" column="dept_id" />
|
||||
<result property="parentId" column="parent_id" />
|
||||
<result property="deptName" column="dept_name" />
|
||||
<result property="orderNum" column="order_num" />
|
||||
<result property="status" column="dept_status" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectUserVo">
|
||||
select u.id, u.dept_id, u.login_name, u.user_name, u.email, u.phonenumber, u.sex, u.avatar, u.password, u.salt, u.status, u.del_flag, u.login_ip, u.login_date, u.create_time, u.remark,
|
||||
d.dept_id, d.parent_id, d.dept_name, d.order_num, d.status as dept_status
|
||||
from vip_user u
|
||||
left join sys_dept d on u.dept_id = d.dept_id
|
||||
</sql>
|
||||
|
||||
<select id="selectUserList" parameterType="VipUser" resultMap="VipUserResult">
|
||||
select u.id, u.dept_id, u.login_name, u.user_name, u.email, u.phonenumber, u.password, u.sex, u.avatar, u.salt, u.status, u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark, d.dept_name from vip_user u
|
||||
left join sys_dept d on u.dept_id = d.dept_id
|
||||
where u.del_flag = '0'
|
||||
<if test="loginName != null and loginName != ''">
|
||||
AND u.login_name like concat('%', #{loginName}, '%')
|
||||
</if>
|
||||
<if test="status != null and status != ''">
|
||||
AND u.status = #{status}
|
||||
</if>
|
||||
<if test="phonenumber != null and phonenumber != ''">
|
||||
AND u.phonenumber like concat('%', #{phonenumber}, '%')
|
||||
</if>
|
||||
<if test="params.beginTime != null and params.beginTime != ''"><!-- 开始时间检索 -->
|
||||
AND date_format(u.create_time,'%y%m%d') >= date_format(#{params.beginTime},'%y%m%d')
|
||||
</if>
|
||||
<if test="params.endTime != null and params.endTime != ''"><!-- 结束时间检索 -->
|
||||
AND date_format(u.create_time,'%y%m%d') <= date_format(#{params.endTime},'%y%m%d')
|
||||
</if>
|
||||
<if test="deptId != null and deptId != 0">
|
||||
AND (u.dept_id = #{deptId} OR u.dept_id IN ( SELECT t.dept_id FROM sys_dept t WHERE FIND_IN_SET (#{deptId},ancestors) ))
|
||||
</if>
|
||||
<!-- 数据范围过滤 -->
|
||||
${params.dataScope}
|
||||
</select>
|
||||
|
||||
<select id="selectUserByLoginName" parameterType="String" resultMap="VipUserResult">
|
||||
<include refid="selectUserVo"/>
|
||||
where u.login_name = #{userName}
|
||||
</select>
|
||||
|
||||
<select id="selectUserByPhoneNumber" parameterType="String" resultMap="VipUserResult">
|
||||
<include refid="selectUserVo"/>
|
||||
where u.phonenumber = #{phonenumber}
|
||||
</select>
|
||||
|
||||
<select id="selectUserByEmail" parameterType="String" resultMap="VipUserResult">
|
||||
<include refid="selectUserVo"/>
|
||||
where u.email = #{email}
|
||||
</select>
|
||||
|
||||
<select id="checkLoginNameUnique" parameterType="String" resultType="int">
|
||||
select count(1) from vip_user where login_name=#{loginName}
|
||||
</select>
|
||||
|
||||
<select id="checkPhoneUnique" parameterType="String" resultMap="VipUserResult">
|
||||
select id, phonenumber from vip_user where phonenumber=#{phonenumber}
|
||||
</select>
|
||||
|
||||
<select id="checkEmailUnique" parameterType="String" resultMap="VipUserResult">
|
||||
select id, email from vip_user where email=#{email}
|
||||
</select>
|
||||
|
||||
<select id="selectUserById" parameterType="Long" resultMap="VipUserResult">
|
||||
<include refid="selectUserVo"/>
|
||||
where u.id = #{id}
|
||||
</select>
|
||||
|
||||
<delete id="deleteUserById" parameterType="Long">
|
||||
delete from vip_user where id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteUserByIds" parameterType="Long">
|
||||
update vip_user set del_flag = '2' where id in
|
||||
<foreach collection="array" item="id" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
<update id="updateUser" parameterType="VipUser">
|
||||
update vip_user
|
||||
<set>
|
||||
<if test="deptId != null and deptId != 0">dept_id = #{deptId},</if>
|
||||
<if test="loginName != null and loginName != ''">login_name = #{loginName},</if>
|
||||
<if test="userName != null and userName != ''">user_name = #{userName},</if>
|
||||
<if test="email != null and email != ''">email = #{email},</if>
|
||||
<if test="phonenumber != null and phonenumber != ''">phonenumber = #{phonenumber},</if>
|
||||
<if test="sex != null and sex != ''">sex = #{sex},</if>
|
||||
<if test="avatar != null and avatar != ''">avatar = #{avatar},</if>
|
||||
<if test="password != null and password != ''">password = #{password},</if>
|
||||
<if test="salt != null and salt != ''">salt = #{salt},</if>
|
||||
<if test="status != null and status != ''">status = #{status},</if>
|
||||
<if test="loginIp != null and loginIp != ''">login_ip = #{loginIp},</if>
|
||||
<if test="loginDate != null">login_date = #{loginDate},</if>
|
||||
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
|
||||
<if test="remark != null and remark != ''">remark = #{remark},</if>
|
||||
update_time = sysdate()
|
||||
</set>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<insert id="insertUser" parameterType="VipUser" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into vip_user(
|
||||
<if test="id != null and id != 0">id,</if>
|
||||
<if test="deptId != null and deptId != 0">dept_id,</if>
|
||||
<if test="loginName != null and loginName != ''">login_name,</if>
|
||||
<if test="userName != null and userName != ''">user_name,</if>
|
||||
<if test="email != null and email != ''">email,</if>
|
||||
<if test="phonenumber != null and phonenumber != ''">phonenumber,</if>
|
||||
<if test="sex != null and sex != ''">sex,</if>
|
||||
<if test="password != null and password != ''">password,</if>
|
||||
<if test="salt != null and salt != ''">salt,</if>
|
||||
<if test="status != null and status != ''">status,</if>
|
||||
<if test="createBy != null and createBy != ''">create_by,</if>
|
||||
<if test="remark != null and remark != ''">remark,</if>
|
||||
create_time
|
||||
)values(
|
||||
<if test="id != null and id != ''">#{id},</if>
|
||||
<if test="deptId != null and deptId != ''">#{deptId},</if>
|
||||
<if test="loginName != null and loginName != ''">#{loginName},</if>
|
||||
<if test="userName != null and userName != ''">#{userName},</if>
|
||||
<if test="email != null and email != ''">#{email},</if>
|
||||
<if test="phonenumber != null and phonenumber != ''">#{phonenumber},</if>
|
||||
<if test="sex != null and sex != ''">#{sex},</if>
|
||||
<if test="password != null and password != ''">#{password},</if>
|
||||
<if test="salt != null and salt != ''">#{salt},</if>
|
||||
<if test="status != null and status != ''">#{status},</if>
|
||||
<if test="createBy != null and createBy != ''">#{createBy},</if>
|
||||
<if test="remark != null and remark != ''">#{remark},</if>
|
||||
sysdate()
|
||||
)
|
||||
</insert>
|
||||
|
||||
</mapper>
|
||||
|
|
@ -91,7 +91,7 @@
|
|||
minlength: 2,
|
||||
maxlength: 20,
|
||||
remote: {
|
||||
url: ctx + "vip/user/checkLoginNameUnique",
|
||||
url: ctx + "system/user/checkLoginNameUnique",
|
||||
type: "post",
|
||||
dataType: "json",
|
||||
data: {
|
||||
|
|
@ -119,7 +119,7 @@
|
|||
required:true,
|
||||
email:true,
|
||||
remote: {
|
||||
url: ctx + "vip/user/checkEmailUnique",
|
||||
url: ctx + "system/user/checkEmailUnique",
|
||||
type: "post",
|
||||
dataType: "json",
|
||||
data: {
|
||||
|
|
@ -136,7 +136,7 @@
|
|||
required:true,
|
||||
isPhone:true,
|
||||
remote: {
|
||||
url: ctx + "vip/user/checkPhoneUnique",
|
||||
url: ctx + "system/user/checkPhoneUnique",
|
||||
type: "post",
|
||||
dataType: "json",
|
||||
data: {
|
||||
|
|
@ -184,7 +184,7 @@
|
|||
$.ajax({
|
||||
cache : true,
|
||||
type : "POST",
|
||||
url : ctx + "vip/user/add",
|
||||
url : ctx + "system/user/add",
|
||||
data : {
|
||||
"userId": userId,
|
||||
"deptId": deptId,
|
||||
|
|
@ -212,11 +212,11 @@
|
|||
function selectDeptTree() {
|
||||
var treeId = $("#treeId").val();
|
||||
var deptId = $.common.isEmpty(treeId) ? "100" : $("#treeId").val();
|
||||
var url = ctx + "vip/dept/selectDeptTree/" + deptId;
|
||||
var url = ctx + "system/dept/selectDeptTree/" + deptId;
|
||||
var options = {
|
||||
title: '选择部门',
|
||||
width: "380",
|
||||
url: ctx + "vip/dept/selectDeptTree/" + deptId,
|
||||
url: ctx + "system/dept/selectDeptTree/" + deptId,
|
||||
callBack: doSubmit
|
||||
};
|
||||
$.modal.openOptions(options);
|
||||
|
|
|
|||
|
|
@ -91,7 +91,7 @@
|
|||
required:true,
|
||||
email:true,
|
||||
remote: {
|
||||
url: ctx + "vip/user/checkEmailUnique",
|
||||
url: ctx + "system/user/checkEmailUnique",
|
||||
type: "post",
|
||||
dataType: "json",
|
||||
data: {
|
||||
|
|
@ -111,7 +111,7 @@
|
|||
required:true,
|
||||
isPhone:true,
|
||||
remote: {
|
||||
url: ctx + "vip/user/checkPhoneUnique",
|
||||
url: ctx + "system/user/checkPhoneUnique",
|
||||
type: "post",
|
||||
dataType: "json",
|
||||
data: {
|
||||
|
|
@ -160,7 +160,7 @@
|
|||
$.ajax({
|
||||
cache : true,
|
||||
type : "POST",
|
||||
url : ctx + "vip/user/edit",
|
||||
url : ctx + "system/user/edit",
|
||||
data : {
|
||||
"userId": userId,
|
||||
"deptId": deptId,
|
||||
|
|
@ -185,7 +185,7 @@
|
|||
/*用户管理-修改-选择部门树*/
|
||||
function selectDeptTree() {
|
||||
var deptId = $("#treeId").val();
|
||||
var url = ctx + "vip/dept/selectDeptTree/" + deptId;
|
||||
var url = ctx + "system/dept/selectDeptTree/" + deptId;
|
||||
var options = {
|
||||
title: '选择部门',
|
||||
width: "380",
|
||||
|
|
|
|||
|
|
@ -70,7 +70,7 @@ function submitHandler() {
|
|||
formdata.append("avatarfile", img);
|
||||
formdata.append("userId", $("#userId").val());
|
||||
$.ajax({
|
||||
url: ctx + "vip/user/profile/updateAvatar",
|
||||
url: ctx + "system/user/profile/updateAvatar",
|
||||
data: formdata,
|
||||
type: "post",
|
||||
processData: false,
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@
|
|||
required:true,
|
||||
email:true,
|
||||
remote: {
|
||||
url: ctx + "vip/user/checkEmailUnique",
|
||||
url: ctx + "system/user/checkEmailUnique",
|
||||
type: "post",
|
||||
dataType: "json",
|
||||
data: {
|
||||
|
|
@ -83,7 +83,7 @@
|
|||
required:true,
|
||||
isPhone:true,
|
||||
remote: {
|
||||
url: ctx + "vip/user/checkPhoneUnique",
|
||||
url: ctx + "system/user/checkPhoneUnique",
|
||||
type: "post",
|
||||
dataType: "json",
|
||||
data: {
|
||||
|
|
@ -112,7 +112,7 @@
|
|||
|
||||
function submitHandler() {
|
||||
if ($.validate.form()) {
|
||||
$.operate.save(ctx + "vip/user/profile/update", $('#form-user-edit').serialize());
|
||||
$.operate.save(ctx + "system/user/profile/update", $('#form-user-edit').serialize());
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
|
|
|||
|
|
@ -61,17 +61,17 @@
|
|||
var userId = [[${user.userId}]];
|
||||
/*用户信息-修改*/
|
||||
function edit() {
|
||||
var url = ctx + "vip/user/profile/edit/" + userId;
|
||||
var url = ctx + "system/user/profile/edit/" + userId;
|
||||
$.modal.open("修改用户", url);
|
||||
}
|
||||
/*用户管理-重置密码*/
|
||||
function resetPwd() {
|
||||
var url = ctx + 'vip/user/profile/resetPwd/' + userId;
|
||||
var url = ctx + 'system/user/profile/resetPwd/' + userId;
|
||||
$.modal.open("重置密码", url, '800', '500');
|
||||
}
|
||||
/*用户管理-头像*/
|
||||
function avatar() {
|
||||
var url = ctx + 'vip/user/profile/avatar/' + userId;
|
||||
var url = ctx + 'system/user/profile/avatar/' + userId;
|
||||
$.modal.open("修改头像", url);
|
||||
}
|
||||
</script>
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@
|
|||
oldPassword:{
|
||||
required:true,
|
||||
remote: {
|
||||
url: ctx + "vip/user/profile/checkPassword",
|
||||
url: ctx + "system/user/profile/checkPassword",
|
||||
type: "get",
|
||||
dataType: "json",
|
||||
data: {
|
||||
|
|
@ -81,7 +81,7 @@
|
|||
|
||||
function submitHandler() {
|
||||
if ($.validate.form()) {
|
||||
$.operate.save(ctx + "vip/user/profile/resetPwd", $('#form-user-resetPwd').serialize());
|
||||
$.operate.save(ctx + "system/user/profile/resetPwd", $('#form-user-resetPwd').serialize());
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@
|
|||
|
||||
function submitHandler() {
|
||||
if ($.validate.form()) {
|
||||
$.operate.save(ctx + "vip/user/resetPwd", $('#form-user-resetPwd').serialize());
|
||||
$.operate.save(ctx + "system/user/resetPwd", $('#form-user-resetPwd').serialize());
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
|
|
|||
|
|
@ -34,6 +34,7 @@
|
|||
<form id="user-form">
|
||||
<input type="hidden" id="deptId" name="deptId">
|
||||
<input type="hidden" id="parentId" name="parentId">
|
||||
<input type="hidden" id="userType" name="userType" value="10">
|
||||
<div class="select-list">
|
||||
<ul>
|
||||
<li>
|
||||
|
|
@ -43,7 +44,8 @@
|
|||
手机号码:<input type="text" name="phonenumber"/>
|
||||
</li>
|
||||
<li>
|
||||
用户状态:<select name="status" th:with="type=${@dict.getType('sys_normal_disable')}">
|
||||
用户状态:
|
||||
<select name="status" th:with="type=${@dict.getType('sys_normal_disable')}">
|
||||
<option value="">所有</option>
|
||||
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
|
||||
</select>
|
||||
|
|
@ -64,16 +66,16 @@
|
|||
</div>
|
||||
|
||||
<div class="btn-group-sm hidden-xs" id="toolbar" role="group">
|
||||
<a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="vip:user:add">
|
||||
<a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="system:user:add">
|
||||
<i class="fa fa-plus"></i> 新增
|
||||
</a>
|
||||
<a class="btn btn-primary btn-edit disabled" onclick="$.operate.edit()" shiro:hasPermission="vip:user:edit">
|
||||
<a class="btn btn-primary btn-edit disabled" onclick="$.operate.edit()" shiro:hasPermission="system:user:edit">
|
||||
<i class="fa fa-edit"></i> 修改
|
||||
</a>
|
||||
<a class="btn btn-danger btn-del disabled" onclick="$.operate.removeAll()" shiro:hasPermission="vip:user:remove">
|
||||
<a class="btn btn-danger btn-del disabled" onclick="$.operate.removeAll()" shiro:hasPermission="system:user:remove">
|
||||
<i class="fa fa-remove"></i> 删除
|
||||
</a>
|
||||
<a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="vip:user:export">
|
||||
<a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="system:user:export">
|
||||
<i class="fa fa-download"></i> 导出
|
||||
</a>
|
||||
</div>
|
||||
|
|
@ -87,11 +89,11 @@
|
|||
<script th:src="@{/ajax/libs/jquery-layout/jquery.layout-latest.js}"></script>
|
||||
<script th:src="@{/ajax/libs/jquery-ztree/3.5/js/jquery.ztree.all-3.5.js}"></script>
|
||||
<script th:inline="javascript">
|
||||
var editFlag = [[${@permission.hasPermi('vip:user:edit')}]];
|
||||
var removeFlag = [[${@permission.hasPermi('vip:user:remove')}]];
|
||||
var resetPwdFlag = [[${@permission.hasPermi('vip:user:resetPwd')}]];
|
||||
var editFlag = [[${@permission.hasPermi('system:user:edit')}]];
|
||||
var removeFlag = [[${@permission.hasPermi('system:user:remove')}]];
|
||||
var resetPwdFlag = [[${@permission.hasPermi('system:user:resetPwd')}]];
|
||||
var datas = [[${@dict.getType('sys_normal_disable')}]];
|
||||
var prefix = ctx + "vip/user";
|
||||
var prefix = ctx + "system/user";
|
||||
|
||||
$(function() {
|
||||
$('body').layout({ west__size: 185 });
|
||||
|
|
@ -203,7 +205,7 @@
|
|||
|
||||
/*用户管理-部门*/
|
||||
function dept() {
|
||||
var url = ctx + "vip/dept";
|
||||
var url = ctx + "system/dept";
|
||||
createMenuItem(url, "部门管理");
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue