| | |
| | | |
| | | import java.util.List; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.validation.annotation.Validated; |
| | |
| | | |
| | | /** |
| | | * 角色信息 |
| | | * |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/system/role") |
| | | public class SysRoleController extends BaseController |
| | | { |
| | | public class SysRoleController extends BaseController { |
| | | @Autowired |
| | | private ISysRoleService roleService; |
| | | |
| | | @Autowired |
| | | private TokenService tokenService; |
| | | |
| | | |
| | | @Autowired |
| | | private SysPermissionService permissionService; |
| | | |
| | | |
| | | @Autowired |
| | | private ISysUserService userService; |
| | | |
| | | @PreAuthorize("@ss.hasPermi('system:role:list')") |
| | | @GetMapping("/list") |
| | | public TableDataInfo list(SysRole role) |
| | | { |
| | | public TableDataInfo list(SysRole role) { |
| | | startPage(); |
| | | List<SysRole> list = roleService.selectRoleList(role); |
| | | return getDataTable(list); |
| | |
| | | @Log(title = "角色管理", businessType = BusinessType.EXPORT) |
| | | @PreAuthorize("@ss.hasPermi('system:role:export')") |
| | | @PostMapping("/export") |
| | | public void export(HttpServletResponse response, SysRole role) |
| | | { |
| | | public void export(HttpServletResponse response, SysRole role) { |
| | | List<SysRole> list = roleService.selectRoleList(role); |
| | | ExcelUtil<SysRole> util = new ExcelUtil<SysRole>(SysRole.class); |
| | | util.exportExcel(response, list, "角色数据"); |
| | |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:role:query')") |
| | | @GetMapping(value = "/{roleId}") |
| | | public AjaxResult getInfo(@PathVariable Long roleId) |
| | | { |
| | | public AjaxResult getInfo(@PathVariable Long roleId) { |
| | | roleService.checkRoleDataScope(roleId); |
| | | return AjaxResult.success(roleService.selectRoleById(roleId)); |
| | | } |
| | |
| | | @PreAuthorize("@ss.hasPermi('system:role:add')") |
| | | @Log(title = "角色管理", businessType = BusinessType.INSERT) |
| | | @PostMapping |
| | | public AjaxResult add(@Validated @RequestBody SysRole role) |
| | | { |
| | | if (UserConstants.NOT_UNIQUE.equals(roleService.checkRoleNameUnique(role))) |
| | | { |
| | | public AjaxResult add(@Validated @RequestBody SysRole role) { |
| | | if (UserConstants.NOT_UNIQUE.equals(roleService.checkRoleNameUnique(role))) { |
| | | return AjaxResult.error("新增角色'" + role.getRoleName() + "'失败,角色名称已存在"); |
| | | } |
| | | else if (UserConstants.NOT_UNIQUE.equals(roleService.checkRoleKeyUnique(role))) |
| | | { |
| | | } else if (UserConstants.NOT_UNIQUE.equals(roleService.checkRoleKeyUnique(role))) { |
| | | return AjaxResult.error("新增角色'" + role.getRoleName() + "'失败,角色权限已存在"); |
| | | } |
| | | role.setCreateBy(getUsername()); |
| | |
| | | @PreAuthorize("@ss.hasPermi('system:role:edit')") |
| | | @Log(title = "角色管理", businessType = BusinessType.UPDATE) |
| | | @PutMapping |
| | | public AjaxResult edit(@Validated @RequestBody SysRole role) |
| | | { |
| | | public AjaxResult edit(@Validated @RequestBody SysRole role) { |
| | | roleService.checkRoleAllowed(role); |
| | | if (UserConstants.NOT_UNIQUE.equals(roleService.checkRoleNameUnique(role))) |
| | | { |
| | | if (UserConstants.NOT_UNIQUE.equals(roleService.checkRoleNameUnique(role))) { |
| | | return AjaxResult.error("修改角色'" + role.getRoleName() + "'失败,角色名称已存在"); |
| | | } |
| | | else if (UserConstants.NOT_UNIQUE.equals(roleService.checkRoleKeyUnique(role))) |
| | | { |
| | | } else if (UserConstants.NOT_UNIQUE.equals(roleService.checkRoleKeyUnique(role))) { |
| | | return AjaxResult.error("修改角色'" + role.getRoleName() + "'失败,角色权限已存在"); |
| | | } |
| | | role.setUpdateBy(getUsername()); |
| | | |
| | | if (roleService.updateRole(role) > 0) |
| | | { |
| | | |
| | | if (roleService.updateRole(role) > 0) { |
| | | // 更新缓存用户权限 |
| | | LoginUser loginUser = getLoginUser(); |
| | | if (StringUtils.isNotNull(loginUser.getUser()) && !loginUser.getUser().isAdmin()) |
| | | { |
| | | if (StringUtils.isNotNull(loginUser.getUser()) && !loginUser.getUser().isAdmin()) { |
| | | loginUser.setPermissions(permissionService.getMenuPermission(loginUser.getUser())); |
| | | loginUser.setUser(userService.selectUserByUserName(loginUser.getUser().getUserName())); |
| | | tokenService.setLoginUser(loginUser); |
| | |
| | | @PreAuthorize("@ss.hasPermi('system:role:edit')") |
| | | @Log(title = "角色管理", businessType = BusinessType.UPDATE) |
| | | @PutMapping("/dataScope") |
| | | public AjaxResult dataScope(@RequestBody SysRole role) |
| | | { |
| | | public AjaxResult dataScope(@RequestBody SysRole role) { |
| | | roleService.checkRoleAllowed(role); |
| | | return toAjax(roleService.authDataScope(role)); |
| | | } |
| | |
| | | @PreAuthorize("@ss.hasPermi('system:role:edit')") |
| | | @Log(title = "角色管理", businessType = BusinessType.UPDATE) |
| | | @PutMapping("/changeStatus") |
| | | public AjaxResult changeStatus(@RequestBody SysRole role) |
| | | { |
| | | public AjaxResult changeStatus(@RequestBody SysRole role) { |
| | | roleService.checkRoleAllowed(role); |
| | | role.setUpdateBy(getUsername()); |
| | | return toAjax(roleService.updateRoleStatus(role)); |
| | |
| | | @PreAuthorize("@ss.hasPermi('system:role:remove')") |
| | | @Log(title = "角色管理", businessType = BusinessType.DELETE) |
| | | @DeleteMapping("/{roleIds}") |
| | | public AjaxResult remove(@PathVariable Long[] roleIds) |
| | | { |
| | | public AjaxResult remove(@PathVariable Long[] roleIds) { |
| | | return toAjax(roleService.deleteRoleByIds(roleIds)); |
| | | } |
| | | |
| | |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:role:query')") |
| | | @GetMapping("/optionselect") |
| | | public AjaxResult optionselect() |
| | | { |
| | | public AjaxResult optionselect() { |
| | | return AjaxResult.success(roleService.selectRoleAll()); |
| | | } |
| | | |
| | |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:role:list')") |
| | | @GetMapping("/authUser/allocatedList") |
| | | public TableDataInfo allocatedList(SysUser user) |
| | | { |
| | | public TableDataInfo allocatedList(SysUser user) { |
| | | startPage(); |
| | | List<SysUser> list = userService.selectAllocatedList(user); |
| | | return getDataTable(list); |
| | |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:role:list')") |
| | | @GetMapping("/authUser/unallocatedList") |
| | | public TableDataInfo unallocatedList(SysUser user) |
| | | { |
| | | public TableDataInfo unallocatedList(SysUser user) { |
| | | startPage(); |
| | | List<SysUser> list = userService.selectUnallocatedList(user); |
| | | return getDataTable(list); |
| | |
| | | @PreAuthorize("@ss.hasPermi('system:role:edit')") |
| | | @Log(title = "角色管理", businessType = BusinessType.GRANT) |
| | | @PutMapping("/authUser/cancel") |
| | | public AjaxResult cancelAuthUser(@RequestBody SysUserRole userRole) |
| | | { |
| | | public AjaxResult cancelAuthUser(@RequestBody SysUserRole userRole) { |
| | | return toAjax(roleService.deleteAuthUser(userRole)); |
| | | } |
| | | |
| | |
| | | @PreAuthorize("@ss.hasPermi('system:role:edit')") |
| | | @Log(title = "角色管理", businessType = BusinessType.GRANT) |
| | | @PutMapping("/authUser/cancelAll") |
| | | public AjaxResult cancelAuthUserAll(Long roleId, Long[] userIds) |
| | | { |
| | | public AjaxResult cancelAuthUserAll(Long roleId, Long[] userIds) { |
| | | return toAjax(roleService.deleteAuthUsers(roleId, userIds)); |
| | | } |
| | | |
| | |
| | | @PreAuthorize("@ss.hasPermi('system:role:edit')") |
| | | @Log(title = "角色管理", businessType = BusinessType.GRANT) |
| | | @PutMapping("/authUser/selectAll") |
| | | public AjaxResult selectAuthUserAll(Long roleId, Long[] userIds) |
| | | { |
| | | public AjaxResult selectAuthUserAll(Long roleId, Long[] userIds) { |
| | | return toAjax(roleService.insertAuthUsers(roleId, userIds)); |
| | | } |
| | | } |
| | |
| | | package com.ruoyi.common.core.domain; |
| | | |
| | | import java.util.HashMap; |
| | | |
| | | import com.ruoyi.common.constant.HttpStatus; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | |
| | | /** |
| | | * 操作消息提醒 |
| | | * |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | public class AjaxResult extends HashMap<String, Object> |
| | | { |
| | | public class AjaxResult extends HashMap<String, Object> { |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** 状态码 */ |
| | | /** |
| | | * 状态码 |
| | | */ |
| | | public static final String CODE_TAG = "code"; |
| | | |
| | | /** 返回内容 */ |
| | | /** |
| | | * 返回内容 |
| | | */ |
| | | public static final String MSG_TAG = "msg"; |
| | | |
| | | /** 数据对象 */ |
| | | /** |
| | | * 数据对象 |
| | | */ |
| | | public static final String DATA_TAG = "data"; |
| | | |
| | | /** |
| | | * 初始化一个新创建的 AjaxResult 对象,使其表示一个空消息。 |
| | | */ |
| | | public AjaxResult() |
| | | { |
| | | public AjaxResult() { |
| | | } |
| | | |
| | | /** |
| | | * 初始化一个新创建的 AjaxResult 对象 |
| | | * |
| | | * |
| | | * @param code 状态码 |
| | | * @param msg 返回内容 |
| | | * @param msg 返回内容 |
| | | */ |
| | | public AjaxResult(int code, String msg) |
| | | { |
| | | public AjaxResult(int code, String msg) { |
| | | super.put(CODE_TAG, code); |
| | | super.put(MSG_TAG, msg); |
| | | } |
| | | |
| | | /** |
| | | * 初始化一个新创建的 AjaxResult 对象 |
| | | * |
| | | * |
| | | * @param code 状态码 |
| | | * @param msg 返回内容 |
| | | * @param msg 返回内容 |
| | | * @param data 数据对象 |
| | | */ |
| | | public AjaxResult(int code, String msg, Object data) |
| | | { |
| | | public AjaxResult(int code, String msg, Object data) { |
| | | super.put(CODE_TAG, code); |
| | | super.put(MSG_TAG, msg); |
| | | if (StringUtils.isNotNull(data)) |
| | | { |
| | | if (StringUtils.isNotNull(data)) { |
| | | super.put(DATA_TAG, data); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 返回成功消息 |
| | | * |
| | | * |
| | | * @return 成功消息 |
| | | */ |
| | | public static AjaxResult success() |
| | | { |
| | | public static AjaxResult success() { |
| | | return AjaxResult.success("操作成功"); |
| | | } |
| | | |
| | | /** |
| | | * 返回成功数据 |
| | | * |
| | | * |
| | | * @return 成功消息 |
| | | */ |
| | | public static AjaxResult success(Object data) |
| | | { |
| | | public static AjaxResult success(Object data) { |
| | | return AjaxResult.success("操作成功", data); |
| | | } |
| | | |
| | | /** |
| | | * 返回成功消息 |
| | | * |
| | | * |
| | | * @param msg 返回内容 |
| | | * @return 成功消息 |
| | | */ |
| | | public static AjaxResult success(String msg) |
| | | { |
| | | public static AjaxResult success(String msg) { |
| | | return AjaxResult.success(msg, null); |
| | | } |
| | | |
| | | /** |
| | | * 返回成功消息 |
| | | * |
| | | * @param msg 返回内容 |
| | | * |
| | | * @param msg 返回内容 |
| | | * @param data 数据对象 |
| | | * @return 成功消息 |
| | | */ |
| | | public static AjaxResult success(String msg, Object data) |
| | | { |
| | | public static AjaxResult success(String msg, Object data) { |
| | | return new AjaxResult(HttpStatus.SUCCESS, msg, data); |
| | | } |
| | | |
| | | /** |
| | | * 返回错误消息 |
| | | * |
| | | * |
| | | * @return |
| | | */ |
| | | public static AjaxResult error() |
| | | { |
| | | public static AjaxResult error() { |
| | | return AjaxResult.error("操作失败"); |
| | | } |
| | | |
| | | /** |
| | | * 返回错误消息 |
| | | * |
| | | * |
| | | * @param msg 返回内容 |
| | | * @return 警告消息 |
| | | */ |
| | | public static AjaxResult error(String msg) |
| | | { |
| | | public static AjaxResult error(String msg) { |
| | | return AjaxResult.error(msg, null); |
| | | } |
| | | |
| | | /** |
| | | * 返回错误消息 |
| | | * |
| | | * @param msg 返回内容 |
| | | * |
| | | * @param msg 返回内容 |
| | | * @param data 数据对象 |
| | | * @return 警告消息 |
| | | */ |
| | | public static AjaxResult error(String msg, Object data) |
| | | { |
| | | public static AjaxResult error(String msg, Object data) { |
| | | return new AjaxResult(HttpStatus.ERROR, msg, data); |
| | | } |
| | | |
| | | /** |
| | | * 返回错误消息 |
| | | * |
| | | * |
| | | * @param code 状态码 |
| | | * @param msg 返回内容 |
| | | * @param msg 返回内容 |
| | | * @return 警告消息 |
| | | */ |
| | | public static AjaxResult error(int code, String msg) |
| | | { |
| | | public static AjaxResult error(int code, String msg) { |
| | | return new AjaxResult(code, msg, null); |
| | | } |
| | | |
| | | /** |
| | | * 方便链式调用 |
| | | * |
| | | * @param key 键 |
| | | * @param key 键 |
| | | * @param value 值 |
| | | * @return 数据对象 |
| | | */ |
| | | @Override |
| | | public AjaxResult put(String key, Object value) |
| | | { |
| | | public AjaxResult put(String key, Object value) { |
| | | super.put(key, value); |
| | | return this; |
| | | } |
| | |
| | | |
| | | /** |
| | | * 产品分类Controller |
| | | * |
| | | * |
| | | * @author kerwincui |
| | | * @date 2021-12-16 |
| | | */ |
| | | @Api(tags = "产品分类") |
| | | @RestController |
| | | @RequestMapping("/iot/category") |
| | | public class CategoryController extends BaseController |
| | | { |
| | | public class CategoryController extends BaseController { |
| | | @Autowired |
| | | private ICategoryService categoryService; |
| | | |
| | |
| | | @PreAuthorize("@ss.hasPermi('iot:category:list')") |
| | | @GetMapping("/list") |
| | | @ApiOperation("分类分页列表") |
| | | public TableDataInfo list(Category category) |
| | | { |
| | | public TableDataInfo list(Category category) { |
| | | startPage(); |
| | | return getDataTable(categoryService.selectCategoryList(category)); |
| | | } |
| | |
| | | @PreAuthorize("@ss.hasPermi('iot:category:list')") |
| | | @GetMapping("/shortlist") |
| | | @ApiOperation("分类简短列表") |
| | | public AjaxResult shortlist() |
| | | { |
| | | public AjaxResult shortlist() { |
| | | return AjaxResult.success(categoryService.selectCategoryShortList()); |
| | | } |
| | | |
| | |
| | | @Log(title = "产品分类", businessType = BusinessType.EXPORT) |
| | | @PostMapping("/export") |
| | | @ApiOperation("导出分类") |
| | | public void export(HttpServletResponse response, Category category) |
| | | { |
| | | public void export(HttpServletResponse response, Category category) { |
| | | List<Category> list = categoryService.selectCategoryList(category); |
| | | ExcelUtil<Category> util = new ExcelUtil<Category>(Category.class); |
| | | util.exportExcel(response, list, "产品分类数据"); |
| | |
| | | @ApiOperation("获取分类详情") |
| | | @PreAuthorize("@ss.hasPermi('iot:category:query')") |
| | | @GetMapping(value = "/{categoryId}") |
| | | public AjaxResult getInfo(@PathVariable("categoryId") Long categoryId) |
| | | { |
| | | public AjaxResult getInfo(@PathVariable("categoryId") Long categoryId) { |
| | | return AjaxResult.success(categoryService.selectCategoryByCategoryId(categoryId)); |
| | | } |
| | | |
| | |
| | | @Log(title = "产品分类", businessType = BusinessType.INSERT) |
| | | @PostMapping |
| | | @ApiOperation("添加分类") |
| | | public AjaxResult add(@RequestBody Category category) |
| | | { |
| | | public AjaxResult add(@RequestBody Category category) { |
| | | return toAjax(categoryService.insertCategory(category)); |
| | | } |
| | | |
| | |
| | | @Log(title = "产品分类", businessType = BusinessType.UPDATE) |
| | | @PutMapping |
| | | @ApiOperation("修改分类") |
| | | public AjaxResult edit(@RequestBody Category category) |
| | | { |
| | | public AjaxResult edit(@RequestBody Category category) { |
| | | return toAjax(categoryService.updateCategory(category)); |
| | | } |
| | | |
| | |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('iot:category:remove')") |
| | | @Log(title = "产品分类", businessType = BusinessType.DELETE) |
| | | @DeleteMapping("/{categoryIds}") |
| | | @DeleteMapping("/{categoryIds}") |
| | | @ApiOperation("批量删除分类") |
| | | public AjaxResult remove(@PathVariable Long[] categoryIds) |
| | | { |
| | | public AjaxResult remove(@PathVariable Long[] categoryIds) { |
| | | return categoryService.deleteCategoryByCategoryIds(categoryIds); |
| | | } |
| | | } |
| New file |
| | |
| | | package com.ruoyi.iot.controller; |
| | | |
| | | import com.ruoyi.common.annotation.Log; |
| | | import com.ruoyi.common.constant.UserConstants; |
| | | import com.ruoyi.common.core.controller.BaseController; |
| | | import com.ruoyi.common.core.domain.AjaxResult; |
| | | import com.ruoyi.common.core.domain.entity.SysUser; |
| | | import com.ruoyi.common.core.page.TableDataInfo; |
| | | import com.ruoyi.common.enums.BusinessType; |
| | | import com.ruoyi.iot.domain.DeviceOrder; |
| | | import com.ruoyi.iot.service.IDeviceOrderService; |
| | | import com.ruoyi.system.service.ISysUserService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.thymeleaf.util.ArrayUtils; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author wmz |
| | | * @version v1.0 |
| | | * @ClassName DeviceOrderController |
| | | * @description 设备安装controller |
| | | * @createTime 2023/11/13 0:27 |
| | | */ |
| | | @Api(tags = "设备安装信息") |
| | | @RestController |
| | | @RequestMapping("/iot/deviceOrder") |
| | | public class DeviceOrderController extends BaseController { |
| | | |
| | | @Resource |
| | | private IDeviceOrderService iDeviceOrderService; |
| | | @Resource |
| | | private ISysUserService userService; |
| | | |
| | | /** |
| | | * 查询全部设备订单信息 |
| | | * |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | @PreAuthorize("@ss.hasAnyPermi('iot:deviceOrder:list')") |
| | | @GetMapping("/list") |
| | | @ApiOperation(value = "获取设备订单分页列表") |
| | | public TableDataInfo list(DeviceOrder deviceOrder) throws Exception { |
| | | startPage(); |
| | | if (deviceOrder.getState() == -1) { |
| | | List<DeviceOrder> list1 = iDeviceOrderService.selectDeviceOrderAll(); |
| | | return getDataTable(list1); |
| | | } |
| | | List<DeviceOrder> list = iDeviceOrderService.selectDeviceOrderList(deviceOrder); |
| | | return getDataTable(list); |
| | | } |
| | | |
| | | /** |
| | | * 添加安装设备订单信息 |
| | | * |
| | | * @param deviceOrder |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | @ApiOperation("添加安装单") |
| | | @PreAuthorize("@ss.hasPermi('iot:device:add')") |
| | | @Log(title = "添加安装单信息", businessType = BusinessType.INSERT) |
| | | @PostMapping |
| | | public AjaxResult add(@Validated @RequestBody DeviceOrder deviceOrder) throws Exception { |
| | | deviceOrder.setState(0); |
| | | return AjaxResult.success(iDeviceOrderService.insertDeviceOrder(deviceOrder)); |
| | | } |
| | | |
| | | /** |
| | | * 修改设备订单信息 |
| | | * |
| | | * @param deviceOrder |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | @ApiOperation(value = "修改设备订单信息") |
| | | @PreAuthorize("@ss.hasPermi('iot:device:edit')") |
| | | @Log(title = "修改设备订单信息", businessType = BusinessType.UPDATE) |
| | | @PutMapping |
| | | public AjaxResult edit(@RequestBody DeviceOrder deviceOrder) throws Exception { |
| | | return AjaxResult.success(iDeviceOrderService.updateDeviceOrder(deviceOrder)); |
| | | } |
| | | |
| | | /** |
| | | * 删除设备订单信息 |
| | | * |
| | | * @param deviceId |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('iot:device:list')") |
| | | @Log(title = "修改设备订单信息", businessType = BusinessType.DELETE) |
| | | @DeleteMapping("/{deviceId}") |
| | | @ApiOperation("删除订单信息") |
| | | public AjaxResult remove(@PathVariable("deviceId") Integer deviceId) throws Exception { |
| | | return AjaxResult.success(iDeviceOrderService.deleteDeviceOrderById(deviceId)); |
| | | } |
| | | } |
| | |
| | | package com.ruoyi.iot.domain; |
| | | |
| | | import com.alibaba.fastjson.annotation.JSONField; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.ruoyi.common.annotation.Excel; |
| | | import com.ruoyi.common.core.domain.BaseEntity; |
| | | import com.ruoyi.common.core.domain.entity.SysUser; |
| | | import org.apache.commons.lang3.builder.ToStringBuilder; |
| | | import org.apache.commons.lang3.builder.ToStringStyle; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | | import java.io.Serializable; |
| | | import java.util.Date; |
| | | |
| | | /** |
| | |
| | | * @description 设备订单表 |
| | | * @createTime 2023/11/10 0:25 |
| | | */ |
| | | public class DeviceOrder extends BaseEntity { |
| | | public class DeviceOrder extends BaseEntity implements Serializable { |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | |
| | | */ |
| | | private Integer userId; |
| | | |
| | | /** |
| | | * 安装工名称 |
| | | */ |
| | | @Excel(name = "安装工名称") |
| | | private String erectoName; |
| | | /** |
| | | * 用户姓名 |
| | | */ |
| | |
| | | * 预约时间 |
| | | */ |
| | | @Excel(name = "预约时间") |
| | | @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @JSONField(format = "yyyy-MM-dd HH:mm:ss") |
| | | private Date appointmentTime; |
| | | |
| | | /** |
| | |
| | | */ |
| | | private SysUser suser; |
| | | |
| | | /** |
| | | * 设备表 |
| | | */ |
| | | private Device devic; |
| | | |
| | | public Device getDevic() { |
| | | return devic; |
| | | } |
| | | |
| | | public void setDevic(Device devic) { |
| | | this.devic = devic; |
| | | } |
| | | |
| | | public DeviceOrder() { |
| | | } |
| | | |
| | |
| | | |
| | | public void setUserId(Integer userId) { |
| | | this.userId = userId; |
| | | } |
| | | |
| | | public String getErectoName() { |
| | | return erectoName; |
| | | } |
| | | |
| | | public void setErectoName(String erectoName) { |
| | | this.erectoName = erectoName; |
| | | } |
| | | |
| | | public String getUserName() { |
| | |
| | | this.suser = suser; |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public String toString() { |
| | | return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE) |
| | |
| | | .append("erectoId", getErectoId()) |
| | | .append("deviceId", getDeviceId()) |
| | | .append("userId", getUserId()) |
| | | .append("erectoName", getErectoName()) |
| | | .append("userName", getUserName()) |
| | | .append("userPhone", getUserPhone()) |
| | | .append("address", getAddress()) |
| | |
| | | .append("receiveTime", getReceiveTime()) |
| | | .append("finshTime", getFinshTime()) |
| | | .append("state", getState()) |
| | | .append("suser",getSuser()) |
| | | .append("suser", getSuser()) |
| | | .append("devic", getDevic()) |
| | | .toString(); |
| | | } |
| | | } |
| New file |
| | |
| | | package com.ruoyi.iot.mapper; |
| | | |
| | | import com.ruoyi.iot.domain.Device; |
| | | import com.ruoyi.iot.domain.DeviceOrder; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author wmz |
| | | * @version v1.0 |
| | | * @ClassName DeviceOrderMapper |
| | | * @description |
| | | * @createTime 2023/11/12 23:10 |
| | | */ |
| | | |
| | | public interface DeviceOrderMapper { |
| | | |
| | | |
| | | |
| | | /** |
| | | * 查询设全部备订单分页查询信息 |
| | | * |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | public List<DeviceOrder> selectDeviceOrderAll() throws Exception; |
| | | |
| | | |
| | | /** |
| | | * 查询设备订单分页查询信息 |
| | | * |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | public List<DeviceOrder> selectDeviceOrderList(DeviceOrder deviceOrder) throws Exception; |
| | | |
| | | /** |
| | | * 添加 |
| | | * |
| | | * @param deviceOrder |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | public int insertDeviceOrder(DeviceOrder deviceOrder) throws Exception; |
| | | |
| | | /** |
| | | * 修改 |
| | | * |
| | | * @param order |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | public int updateDeviceOrder(DeviceOrder order) throws Exception; |
| | | |
| | | /** |
| | | * 删除设备订单安装信息 |
| | | * |
| | | * @param id |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | public int deleteDeviceOrderById(Integer id) throws Exception; |
| | | |
| | | /** |
| | | * 批量删除设备订单安装信息 |
| | | * |
| | | * @param ids |
| | | * @return |
| | | */ |
| | | public int deleteDeviceOrder(Integer[] ids); |
| | | |
| | | } |
| New file |
| | |
| | | package com.ruoyi.iot.service; |
| | | |
| | | import com.ruoyi.iot.domain.DeviceOrder; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author wmz |
| | | * @version v1.0 |
| | | * @ClassName IDeviceOrderService |
| | | * @description TODO |
| | | * @createTime 2023/11/13 0:24 |
| | | */ |
| | | |
| | | public interface IDeviceOrderService { |
| | | |
| | | /** |
| | | * 查询设全部备订单分页查询信息 |
| | | * |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | public List<DeviceOrder> selectDeviceOrderAll() throws Exception; |
| | | |
| | | /** |
| | | * 根据条件分页查询设备安装信息 |
| | | * @param deviceOrder |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | public List<DeviceOrder> selectDeviceOrderList(DeviceOrder deviceOrder) throws Exception; |
| | | |
| | | |
| | | /** |
| | | * 添加 |
| | | * |
| | | * @param deviceOrder |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | public int insertDeviceOrder(DeviceOrder deviceOrder) throws Exception; |
| | | |
| | | /** |
| | | * 修改 |
| | | * |
| | | * @param order |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | public int updateDeviceOrder(DeviceOrder order) throws Exception; |
| | | |
| | | /** |
| | | * 删除 |
| | | * |
| | | * @param id |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | public int deleteDeviceOrderById(Integer id) throws Exception; |
| | | |
| | | /** |
| | | * 批量删除设备订单安装信息 |
| | | * |
| | | * @param ids |
| | | * @return |
| | | */ |
| | | public int deleteDeviceOrder(Integer[] ids); |
| | | |
| | | } |
| New file |
| | |
| | | package com.ruoyi.iot.service.impl; |
| | | |
| | | import com.ruoyi.common.core.domain.entity.SysUser; |
| | | import com.ruoyi.iot.domain.DeviceOrder; |
| | | import com.ruoyi.iot.mapper.DeviceOrderMapper; |
| | | import com.ruoyi.iot.service.IDeviceOrderService; |
| | | import com.ruoyi.system.service.ISysUserService; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author wmz |
| | | * @version v1.0 |
| | | * @ClassName DeviceOrderServiceImpl |
| | | * @description TODO |
| | | * @createTime 2023/11/13 0:25 |
| | | */ |
| | | @Service |
| | | public class DeviceOrderServiceImpl implements IDeviceOrderService { |
| | | |
| | | @Resource |
| | | private DeviceOrderMapper deviceOrderMapper; |
| | | @Resource |
| | | private ISysUserService sysUserService; |
| | | |
| | | |
| | | @Override |
| | | public List<DeviceOrder> selectDeviceOrderAll() throws Exception { |
| | | return deviceOrderMapper.selectDeviceOrderAll(); |
| | | } |
| | | |
| | | @Override |
| | | public List<DeviceOrder> selectDeviceOrderList(DeviceOrder deviceOrder) throws Exception { |
| | | return deviceOrderMapper.selectDeviceOrderList(deviceOrder); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional |
| | | public int insertDeviceOrder(DeviceOrder deviceOrder) throws Exception { |
| | | int rows = deviceOrderMapper.insertDeviceOrder(deviceOrder); |
| | | return rows; |
| | | } |
| | | |
| | | @Override |
| | | @Transactional |
| | | public int updateDeviceOrder(DeviceOrder order) throws Exception { |
| | | return deviceOrderMapper.updateDeviceOrder(order); |
| | | } |
| | | |
| | | @Override |
| | | public int deleteDeviceOrderById(Integer id) throws Exception { |
| | | return deviceOrderMapper.deleteDeviceOrderById(id); |
| | | } |
| | | |
| | | @Override |
| | | public int deleteDeviceOrder(Integer[] ids) { |
| | | return deviceOrderMapper.deleteDeviceOrder(ids); |
| | | } |
| | | } |
| | |
| | | erecto_id, |
| | | device_id, |
| | | user_id, |
| | | erecto_name, |
| | | user_name, |
| | | user_phone, |
| | | address, |
| | |
| | | <result property="erectoId" column="erecto_id"/> |
| | | <result property="deviceId" column="device_id"/> |
| | | <result property="userId" column="user_id"/> |
| | | <result property="erectoName" column="erecto_name"/> |
| | | <result property="userName" column="user_name"/> |
| | | <result property="userPhone" column="user_phone"/> |
| | | <result property="address" column="address"/> |
| | |
| | | <result property="receiveTime" column="receive_time"/> |
| | | <result property="finshTime" column="finsh_time"/> |
| | | <result property="state" column="state"/> |
| | | <!-- <collection property="suser" column="" javaType="" resultMap=""--> |
| | | <association property="devic" javaType="Device" resultMap="DeviceResult"/> |
| | | <collection property="suser" ofType="sysUser" resultMap="UserResult"/> |
| | | </resultMap> |
| | | |
| | | <resultMap id="UserResult" type="sysUser"> |
| | | <id property="userId" column="u.user_id"/> |
| | | <result property="userName" column="u.user_name"/> |
| | | <result property="isAuthentication" column="u.is_authentication"/> |
| | | </resultMap> |
| | | <resultMap id="DeviceResult" type="Device"> |
| | | <id property="deviceId" column="de.device_id"/> |
| | | <result property="deviceName" column="de.device_name"/> |
| | | </resultMap> |
| | | <!--id = 所需重写的接口抽象方法,resultType = 查询后所需返回的对象类型--> |
| | | <select id="selectDeviceOrderList" resultMap="DeviceOrderResult"> |
| | | select |
| | | d.id, |
| | | select d.id, |
| | | d.user_id, |
| | | d.erecto_id, |
| | | d.erecto_name, |
| | | d.user_name, |
| | | d.user_phone, |
| | | d.address, |
| | | d.order_type, |
| | | d.appointment_time, |
| | | d.evaluate, |
| | | d.device_id, |
| | | d.remark, |
| | | u.address, |
| | | u.user_id, |
| | | u.user_name, |
| | | d.user_phone, |
| | | u.is_authentication, |
| | | d.score, |
| | | d.state |
| | | from iot_device_order d, |
| | | sys_user u |
| | | d.state, |
| | | de.device_id, |
| | | de.device_name |
| | | from iot_device_order as d, |
| | | sys_user as u,iot_device as de |
| | | where d.erecto_id = u.user_id |
| | | <if test=" state!=null and state != ''"> |
| | | <if test="state!=null"> |
| | | and d.state = #{state} |
| | | </if> |
| | | and d.order_type = 1 and d.device_id = de.device_id |
| | | ${params.dataScope} |
| | | </select> |
| | | <select id="selectDeviceOrderAll" resultMap="DeviceOrderResult"> |
| | | select d.id, |
| | | d.user_id, |
| | | d.erecto_id, |
| | | d.erecto_name, |
| | | d.user_name, |
| | | d.user_phone, |
| | | d.address, |
| | | d.order_type, |
| | | d.erecto_name, |
| | | d.appointment_time, |
| | | d.evaluate, |
| | | d.remark, |
| | | u.user_id, |
| | | u.user_name, |
| | | u.is_authentication, |
| | | d.score, |
| | | d.state, |
| | | de.device_id, |
| | | de.device_name |
| | | from iot_device_order d, |
| | | sys_user u, |
| | | iot_device de |
| | | where d.erecto_id = u.user_id |
| | | and d.order_type = 1 |
| | | and d.device_id = de.device_id |
| | | </select> |
| | | <insert id="insertDeviceOrder" parameterType="DeviceOrder" useGeneratedKeys="true" keyProperty="id"> |
| | | insert into iot_device_order( |
| | |
| | | <if test="erectoId != null and erectoId != 0">erecto_id,</if> |
| | | <if test="deviceId != null and deviceId != 0">device_id,</if> |
| | | <if test="userId != null and userId != 0">user_id,</if> |
| | | <if test="erectoName != null and erectoName != ''">erecto_name,</if> |
| | | <if test="userName != null and userName != ''">user_name,</if> |
| | | <if test="userPhone != null and userPhone != ''">user_phone,</if> |
| | | <if test="address != null and address != ''">address,</if> |
| | | <if test="orderType != null and orderType != ''">order_type,</if> |
| | | <if test="remark != null and remark != ''">remark,</if> |
| | | <if test="appointmentTime != null and appointmentTime != ''">user_name,</if> |
| | | <if test="appointmentTime != null">appointment_time,</if> |
| | | <if test="score != null and score != ''">score,</if> |
| | | <if test="evaluate != null and evaluate != ''">evaluate,</if> |
| | | <if test="receiveTime != null and receiveTime != ''">receive_time,</if> |
| | | <if test="finshTime != null and finshTime != ''">finsh_time,</if> |
| | | <if test="receiveTime != null">receive_time,</if> |
| | | <if test="finshTime != null">finsh_time,</if> |
| | | <if test="state != null and state != ''">state,</if> |
| | | create_time) |
| | | values ( |
| | | <if test="id != null and id != ''">#{id},</if> |
| | | <if test="erectoId != null and erectoId != ''">#{erectoId},</if> |
| | | <if test="deviceId != null and deviceId != ''">#{deviceId},</if> |
| | | <if test="userId != null and userId != ''">#{userId},</if> |
| | | <if test="userName != null and userName != ''">#{userName},</if> |
| | | <if test="userPhone != null and userPhone != ''">#{userPhone},</if> |
| | | <if test="userId != null">#{userId},</if> |
| | | <if test="erectoName!=null">#{erectoName},</if> |
| | | <if test="userName != null">#{userName},</if> |
| | | <if test="userPhone != null">#{userPhone},</if> |
| | | <if test="address != null">#{address},</if> |
| | | <if test="orderType != null and orderType != ''">#{orderType},</if> |
| | | <if test="remark != null and remark != ''">#{remark},</if> |
| | | <if test="appointmentTime != null and appointmentTime != ''">#{appointmentTime},</if> |
| | | <if test="appointmentTime != null">#{appointmentTime},</if> |
| | | <if test="score != null and score != ''">#{score},</if> |
| | | <if test="evaluate != null and evaluate != ''">#{evaluate},</if> |
| | | <if test="receiveTime != null and receiveTime != ''">#{receiveTime},</if> |
| | | <if test="finshTime != null and finshTime != ''">#{finshTime},</if> |
| | | <if test="receiveTime != null">#{receiveTime},</if> |
| | | <if test="finshTime != null">#{finshTime},</if> |
| | | <if test="state != null and state != ''">#{state},</if> |
| | | sysdate()) |
| | | </insert> |
| | |
| | | update iot_device_order |
| | | <set> |
| | | <if test="id != null and id != 0">id = #{id},</if> |
| | | <if test="erecto_id != null and id != 0">erecto_id = #{erectoId},</if> |
| | | <if test="device_id != null and device_id != 0">device_id = #{deviceId},</if> |
| | | <if test="user_id != null and user_id != 0">user_id = #{userId},</if> |
| | | <if test="user_name != null and user_name != ''">user_name = #{userName},</if> |
| | | <if test="user_phone != null and user_phone != ''">user_phone = #{userPhone},</if> |
| | | <if test=" erectoId!= null and erectoId != 0">erecto_id = #{erectoId},</if> |
| | | <if test="deviceId != null and deviceId != 0">device_id = #{deviceId},</if> |
| | | <if test="userId != null and userId != 0">user_id = #{userId},</if> |
| | | <if test="erectoName!=null and erectoName != ''">erectoName = #{erectoName},</if> |
| | | <if test="userName != null and userName != ''">user_name = #{userName},</if> |
| | | <if test="userPhone != null and userPhone != ''">user_phone = #{userPhone},</if> |
| | | <if test="address != null and address != ''">address = #{address},</if> |
| | | <if test="order_type != null and order_type != ''">order_type = #{orderType},</if> |
| | | <if test="orderType != null and orderType != ''">order_type = #{orderType},</if> |
| | | <if test="remark != null and remark != ''">remark = #{remark},</if> |
| | | <if test="appointment_time != null and appointment_time != ''">appointment_time = #{appointmentTime},</if> |
| | | <if test="appointmentTime != null">appointment_time = #{appointmentTime},</if> |
| | | <if test="score != null and score != ''">score = #{score},</if> |
| | | <if test="evaluate != null and evaluate != ''">evaluate = #{evaluate},</if> |
| | | <if test="receive_time != null and receive_time != ''">receive_time = #{receiveTime},</if> |
| | | <if test="finsh_time != null and finsh_time != ''">finsh_time = #{finshTime},</if> |
| | | <if test="state != null and state != ''">state</if> |
| | | <if test="evaluate != null">evaluate = #{evaluate},</if> |
| | | <if test="receiveTime != null">receive_time = #{receiveTime},</if> |
| | | <if test="finshTime != null">finsh_time = #{finshTime},</if> |
| | | <if test="state != null and state != ''">state = #{state}</if> |
| | | </set> |
| | | where id = #{id} |
| | | </update> |
| | | <delete id="deleteDeviceOrderById"> |
| | | update iot_device_order |
| | | set state = '3' |
| | | where erecto_id = #{erecto_id} |
| | | delete |
| | | from iot_device_order |
| | | where id = #{id} |
| | | </delete> |
| | | <delete id="deleteDeviceOrder"> |
| | | update iot_device_order set state = '3' where erecto_id in |
| | |
| | | package com.ruoyi.system.mapper; |
| | | |
| | | import java.util.List; |
| | | |
| | | import com.ruoyi.common.core.domain.entity.SysRole; |
| | | |
| | | /** |
| | | * 角色表 数据层 |
| | | * |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | public interface SysRoleMapper |
| | | { |
| | | public interface SysRoleMapper { |
| | | /** |
| | | * 根据条件分页查询角色数据 |
| | | * |
| | | * |
| | | * @param role 角色信息 |
| | | * @return 角色数据集合信息 |
| | | */ |
| | |
| | | |
| | | /** |
| | | * 根据用户ID查询角色 |
| | | * |
| | | * |
| | | * @param userId 用户ID |
| | | * @return 角色列表 |
| | | */ |
| | |
| | | |
| | | /** |
| | | * 查询所有角色 |
| | | * |
| | | * |
| | | * @return 角色列表 |
| | | */ |
| | | public List<SysRole> selectRoleAll(); |
| | | |
| | | /** |
| | | * 根据用户ID获取角色选择框列表 |
| | | * |
| | | * |
| | | * @param userId 用户ID |
| | | * @return 选中角色ID列表 |
| | | */ |
| | |
| | | |
| | | /** |
| | | * 通过角色ID查询角色 |
| | | * |
| | | * |
| | | * @param roleId 角色ID |
| | | * @return 角色对象信息 |
| | | */ |
| | |
| | | |
| | | /** |
| | | * 根据用户ID查询角色 |
| | | * |
| | | * |
| | | * @param userName 用户名 |
| | | * @return 角色列表 |
| | | */ |
| | |
| | | |
| | | /** |
| | | * 校验角色名称是否唯一 |
| | | * |
| | | * |
| | | * @param roleName 角色名称 |
| | | * @return 角色信息 |
| | | */ |
| | |
| | | |
| | | /** |
| | | * 校验角色权限是否唯一 |
| | | * |
| | | * |
| | | * @param roleKey 角色权限 |
| | | * @return 角色信息 |
| | | */ |
| | |
| | | |
| | | /** |
| | | * 修改角色信息 |
| | | * |
| | | * |
| | | * @param role 角色信息 |
| | | * @return 结果 |
| | | */ |
| | |
| | | |
| | | /** |
| | | * 新增角色信息 |
| | | * |
| | | * |
| | | * @param role 角色信息 |
| | | * @return 结果 |
| | | */ |
| | |
| | | |
| | | /** |
| | | * 通过角色ID删除角色 |
| | | * |
| | | * |
| | | * @param roleId 角色ID |
| | | * @return 结果 |
| | | */ |
| | |
| | | |
| | | /** |
| | | * 批量删除角色信息 |
| | | * |
| | | * |
| | | * @param roleIds 需要删除的角色ID |
| | | * @return 结果 |
| | | */ |
| | |
| | | */ |
| | | public List<SysUser> selectUserList(SysUser user); |
| | | |
| | | |
| | | |
| | | |
| | | public List<SysUser> selectUserListByRoleKey(String roleKey); |
| | | |
| | | /** |
| | |
| | | import java.util.HashSet; |
| | | import java.util.List; |
| | | import java.util.Set; |
| | | |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | |
| | | |
| | | /** |
| | | * 角色 业务层处理 |
| | | * |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @Service |
| | | public class SysRoleServiceImpl implements ISysRoleService |
| | | { |
| | | public class SysRoleServiceImpl implements ISysRoleService { |
| | | @Autowired |
| | | private SysRoleMapper roleMapper; |
| | | |
| | |
| | | |
| | | /** |
| | | * 根据条件分页查询角色数据 |
| | | * |
| | | * |
| | | * @param role 角色信息 |
| | | * @return 角色数据集合信息 |
| | | */ |
| | | @Override |
| | | @DataScope(deptAlias = "d") |
| | | public List<SysRole> selectRoleList(SysRole role) |
| | | { |
| | | public List<SysRole> selectRoleList(SysRole role) { |
| | | return roleMapper.selectRoleList(role); |
| | | } |
| | | |
| | | /** |
| | | * 根据用户ID查询角色 |
| | | * |
| | | * |
| | | * @param userId 用户ID |
| | | * @return 角色列表 |
| | | */ |
| | | @Override |
| | | public List<SysRole> selectRolesByUserId(Long userId) |
| | | { |
| | | public List<SysRole> selectRolesByUserId(Long userId) { |
| | | List<SysRole> userRoles = roleMapper.selectRolePermissionByUserId(userId); |
| | | List<SysRole> roles = selectRoleAll(); |
| | | for (SysRole role : roles) |
| | | { |
| | | for (SysRole userRole : userRoles) |
| | | { |
| | | if (role.getRoleId().longValue() == userRole.getRoleId().longValue()) |
| | | { |
| | | for (SysRole role : roles) { |
| | | for (SysRole userRole : userRoles) { |
| | | if (role.getRoleId().longValue() == userRole.getRoleId().longValue()) { |
| | | role.setFlag(true); |
| | | break; |
| | | } |
| | |
| | | |
| | | /** |
| | | * 根据用户ID查询权限 |
| | | * |
| | | * |
| | | * @param userId 用户ID |
| | | * @return 权限列表 |
| | | */ |
| | | @Override |
| | | public Set<String> selectRolePermissionByUserId(Long userId) |
| | | { |
| | | public Set<String> selectRolePermissionByUserId(Long userId) { |
| | | List<SysRole> perms = roleMapper.selectRolePermissionByUserId(userId); |
| | | Set<String> permsSet = new HashSet<>(); |
| | | for (SysRole perm : perms) |
| | | { |
| | | if (StringUtils.isNotNull(perm)) |
| | | { |
| | | for (SysRole perm : perms) { |
| | | if (StringUtils.isNotNull(perm)) { |
| | | permsSet.addAll(Arrays.asList(perm.getRoleKey().trim().split(","))); |
| | | } |
| | | } |
| | |
| | | |
| | | /** |
| | | * 查询所有角色 |
| | | * |
| | | * |
| | | * @return 角色列表 |
| | | */ |
| | | @Override |
| | | public List<SysRole> selectRoleAll() |
| | | { |
| | | public List<SysRole> selectRoleAll() { |
| | | return SpringUtils.getAopProxy(this).selectRoleList(new SysRole()); |
| | | } |
| | | |
| | | /** |
| | | * 根据用户ID获取角色选择框列表 |
| | | * |
| | | * |
| | | * @param userId 用户ID |
| | | * @return 选中角色ID列表 |
| | | */ |
| | | @Override |
| | | public List<Long> selectRoleListByUserId(Long userId) |
| | | { |
| | | public List<Long> selectRoleListByUserId(Long userId) { |
| | | return roleMapper.selectRoleListByUserId(userId); |
| | | } |
| | | |
| | | /** |
| | | * 通过角色ID查询角色 |
| | | * |
| | | * |
| | | * @param roleId 角色ID |
| | | * @return 角色对象信息 |
| | | */ |
| | | @Override |
| | | public SysRole selectRoleById(Long roleId) |
| | | { |
| | | public SysRole selectRoleById(Long roleId) { |
| | | return roleMapper.selectRoleById(roleId); |
| | | } |
| | | |
| | | /** |
| | | * 校验角色名称是否唯一 |
| | | * |
| | | * |
| | | * @param role 角色信息 |
| | | * @return 结果 |
| | | */ |
| | | @Override |
| | | public String checkRoleNameUnique(SysRole role) |
| | | { |
| | | public String checkRoleNameUnique(SysRole role) { |
| | | Long roleId = StringUtils.isNull(role.getRoleId()) ? -1L : role.getRoleId(); |
| | | SysRole info = roleMapper.checkRoleNameUnique(role.getRoleName()); |
| | | if (StringUtils.isNotNull(info) && info.getRoleId().longValue() != roleId.longValue()) |
| | | { |
| | | if (StringUtils.isNotNull(info) && info.getRoleId().longValue() != roleId.longValue()) { |
| | | return UserConstants.NOT_UNIQUE; |
| | | } |
| | | return UserConstants.UNIQUE; |
| | |
| | | |
| | | /** |
| | | * 校验角色权限是否唯一 |
| | | * |
| | | * |
| | | * @param role 角色信息 |
| | | * @return 结果 |
| | | */ |
| | | @Override |
| | | public String checkRoleKeyUnique(SysRole role) |
| | | { |
| | | public String checkRoleKeyUnique(SysRole role) { |
| | | Long roleId = StringUtils.isNull(role.getRoleId()) ? -1L : role.getRoleId(); |
| | | SysRole info = roleMapper.checkRoleKeyUnique(role.getRoleKey()); |
| | | if (StringUtils.isNotNull(info) && info.getRoleId().longValue() != roleId.longValue()) |
| | | { |
| | | if (StringUtils.isNotNull(info) && info.getRoleId().longValue() != roleId.longValue()) { |
| | | return UserConstants.NOT_UNIQUE; |
| | | } |
| | | return UserConstants.UNIQUE; |
| | |
| | | |
| | | /** |
| | | * 校验角色是否允许操作 |
| | | * |
| | | * |
| | | * @param role 角色信息 |
| | | */ |
| | | @Override |
| | | public void checkRoleAllowed(SysRole role) |
| | | { |
| | | if (StringUtils.isNotNull(role.getRoleId()) && role.isAdmin()) |
| | | { |
| | | public void checkRoleAllowed(SysRole role) { |
| | | if (StringUtils.isNotNull(role.getRoleId()) && role.isAdmin()) { |
| | | throw new ServiceException("不允许操作超级管理员角色"); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 校验角色是否有数据权限 |
| | | * |
| | | * |
| | | * @param roleId 角色id |
| | | */ |
| | | @Override |
| | | public void checkRoleDataScope(Long roleId) |
| | | { |
| | | if (!SysUser.isAdmin(SecurityUtils.getUserId())) |
| | | { |
| | | public void checkRoleDataScope(Long roleId) { |
| | | if (!SysUser.isAdmin(SecurityUtils.getUserId())) { |
| | | SysRole role = new SysRole(); |
| | | role.setRoleId(roleId); |
| | | List<SysRole> roles = SpringUtils.getAopProxy(this).selectRoleList(role); |
| | | if (StringUtils.isEmpty(roles)) |
| | | { |
| | | if (StringUtils.isEmpty(roles)) { |
| | | throw new ServiceException("没有权限访问角色数据!"); |
| | | } |
| | | } |
| | |
| | | |
| | | /** |
| | | * 通过角色ID查询角色使用数量 |
| | | * |
| | | * |
| | | * @param roleId 角色ID |
| | | * @return 结果 |
| | | */ |
| | | @Override |
| | | public int countUserRoleByRoleId(Long roleId) |
| | | { |
| | | public int countUserRoleByRoleId(Long roleId) { |
| | | return userRoleMapper.countUserRoleByRoleId(roleId); |
| | | } |
| | | |
| | | /** |
| | | * 新增保存角色信息 |
| | | * |
| | | * |
| | | * @param role 角色信息 |
| | | * @return 结果 |
| | | */ |
| | | @Override |
| | | @Transactional |
| | | public int insertRole(SysRole role) |
| | | { |
| | | public int insertRole(SysRole role) { |
| | | // 新增角色信息 |
| | | roleMapper.insertRole(role); |
| | | return insertRoleMenu(role); |
| | |
| | | |
| | | /** |
| | | * 修改保存角色信息 |
| | | * |
| | | * |
| | | * @param role 角色信息 |
| | | * @return 结果 |
| | | */ |
| | | @Override |
| | | @Transactional |
| | | public int updateRole(SysRole role) |
| | | { |
| | | public int updateRole(SysRole role) { |
| | | // 修改角色信息 |
| | | roleMapper.updateRole(role); |
| | | // 删除角色与菜单关联 |
| | |
| | | |
| | | /** |
| | | * 修改角色状态 |
| | | * |
| | | * |
| | | * @param role 角色信息 |
| | | * @return 结果 |
| | | */ |
| | | @Override |
| | | public int updateRoleStatus(SysRole role) |
| | | { |
| | | public int updateRoleStatus(SysRole role) { |
| | | return roleMapper.updateRole(role); |
| | | } |
| | | |
| | | /** |
| | | * 修改数据权限信息 |
| | | * |
| | | * |
| | | * @param role 角色信息 |
| | | * @return 结果 |
| | | */ |
| | | @Override |
| | | @Transactional |
| | | public int authDataScope(SysRole role) |
| | | { |
| | | public int authDataScope(SysRole role) { |
| | | // 修改角色信息 |
| | | roleMapper.updateRole(role); |
| | | // 删除角色与部门关联 |
| | |
| | | |
| | | /** |
| | | * 新增角色菜单信息 |
| | | * |
| | | * |
| | | * @param role 角色对象 |
| | | */ |
| | | public int insertRoleMenu(SysRole role) |
| | | { |
| | | public int insertRoleMenu(SysRole role) { |
| | | int rows = 1; |
| | | // 新增用户与角色管理 |
| | | List<SysRoleMenu> list = new ArrayList<SysRoleMenu>(); |
| | | for (Long menuId : role.getMenuIds()) |
| | | { |
| | | for (Long menuId : role.getMenuIds()) { |
| | | SysRoleMenu rm = new SysRoleMenu(); |
| | | rm.setRoleId(role.getRoleId()); |
| | | rm.setMenuId(menuId); |
| | | list.add(rm); |
| | | } |
| | | if (list.size() > 0) |
| | | { |
| | | if (list.size() > 0) { |
| | | rows = roleMenuMapper.batchRoleMenu(list); |
| | | } |
| | | return rows; |
| | |
| | | * |
| | | * @param role 角色对象 |
| | | */ |
| | | public int insertRoleDept(SysRole role) |
| | | { |
| | | public int insertRoleDept(SysRole role) { |
| | | int rows = 1; |
| | | // 新增角色与部门(数据权限)管理 |
| | | List<SysRoleDept> list = new ArrayList<SysRoleDept>(); |
| | | for (Long deptId : role.getDeptIds()) |
| | | { |
| | | for (Long deptId : role.getDeptIds()) { |
| | | SysRoleDept rd = new SysRoleDept(); |
| | | rd.setRoleId(role.getRoleId()); |
| | | rd.setDeptId(deptId); |
| | | list.add(rd); |
| | | } |
| | | if (list.size() > 0) |
| | | { |
| | | if (list.size() > 0) { |
| | | rows = roleDeptMapper.batchRoleDept(list); |
| | | } |
| | | return rows; |
| | |
| | | |
| | | /** |
| | | * 通过角色ID删除角色 |
| | | * |
| | | * |
| | | * @param roleId 角色ID |
| | | * @return 结果 |
| | | */ |
| | | @Override |
| | | @Transactional |
| | | public int deleteRoleById(Long roleId) |
| | | { |
| | | public int deleteRoleById(Long roleId) { |
| | | // 删除角色与菜单关联 |
| | | roleMenuMapper.deleteRoleMenuByRoleId(roleId); |
| | | // 删除角色与部门关联 |
| | |
| | | |
| | | /** |
| | | * 批量删除角色信息 |
| | | * |
| | | * |
| | | * @param roleIds 需要删除的角色ID |
| | | * @return 结果 |
| | | */ |
| | | @Override |
| | | @Transactional |
| | | public int deleteRoleByIds(Long[] roleIds) |
| | | { |
| | | for (Long roleId : roleIds) |
| | | { |
| | | public int deleteRoleByIds(Long[] roleIds) { |
| | | for (Long roleId : roleIds) { |
| | | checkRoleAllowed(new SysRole(roleId)); |
| | | SysRole role = selectRoleById(roleId); |
| | | if (countUserRoleByRoleId(roleId) > 0) |
| | | { |
| | | if (countUserRoleByRoleId(roleId) > 0) { |
| | | throw new ServiceException(String.format("%1$s已分配,不能删除", role.getRoleName())); |
| | | } |
| | | } |
| | |
| | | |
| | | /** |
| | | * 取消授权用户角色 |
| | | * |
| | | * |
| | | * @param userRole 用户和角色关联信息 |
| | | * @return 结果 |
| | | */ |
| | | @Override |
| | | public int deleteAuthUser(SysUserRole userRole) |
| | | { |
| | | public int deleteAuthUser(SysUserRole userRole) { |
| | | return userRoleMapper.deleteUserRoleInfo(userRole); |
| | | } |
| | | |
| | | /** |
| | | * 批量取消授权用户角色 |
| | | * |
| | | * @param roleId 角色ID |
| | | * |
| | | * @param roleId 角色ID |
| | | * @param userIds 需要取消授权的用户数据ID |
| | | * @return 结果 |
| | | */ |
| | | @Override |
| | | public int deleteAuthUsers(Long roleId, Long[] userIds) |
| | | { |
| | | public int deleteAuthUsers(Long roleId, Long[] userIds) { |
| | | return userRoleMapper.deleteUserRoleInfos(roleId, userIds); |
| | | } |
| | | |
| | | /** |
| | | * 批量选择授权用户角色 |
| | | * |
| | | * @param roleId 角色ID |
| | | * |
| | | * @param roleId 角色ID |
| | | * @param userIds 需要删除的用户数据ID |
| | | * @return 结果 |
| | | */ |
| | | @Override |
| | | public int insertAuthUsers(Long roleId, Long[] userIds) |
| | | { |
| | | public int insertAuthUsers(Long roleId, Long[] userIds) { |
| | | // 新增用户与角色管理 |
| | | List<SysUserRole> list = new ArrayList<SysUserRole>(); |
| | | for (Long userId : userIds) |
| | | { |
| | | for (Long userId : userIds) { |
| | | SysUserRole ur = new SysUserRole(); |
| | | ur.setUserId(userId); |
| | | ur.setRoleId(roleId); |
| | |
| | | <?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"> |
| | | PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" |
| | | "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.ruoyi.system.mapper.SysRoleMapper"> |
| | | |
| | | <resultMap type="SysRole" id="SysRoleResult"> |
| | | <id property="roleId" column="role_id" /> |
| | | <result property="roleName" column="role_name" /> |
| | | <result property="roleKey" column="role_key" /> |
| | | <result property="roleSort" column="role_sort" /> |
| | | <result property="dataScope" column="data_scope" /> |
| | | <result property="menuCheckStrictly" column="menu_check_strictly" /> |
| | | <result property="deptCheckStrictly" column="dept_check_strictly" /> |
| | | <result property="status" column="status" /> |
| | | <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="selectRoleVo"> |
| | | select distinct r.role_id, r.role_name, r.role_key, r.role_sort, r.data_scope, r.menu_check_strictly, r.dept_check_strictly, |
| | | r.status, r.del_flag, r.create_time, r.remark |
| | | <resultMap type="SysRole" id="SysRoleResult"> |
| | | <id property="roleId" column="role_id"/> |
| | | <result property="roleName" column="role_name"/> |
| | | <result property="roleKey" column="role_key"/> |
| | | <result property="roleSort" column="role_sort"/> |
| | | <result property="dataScope" column="data_scope"/> |
| | | <result property="menuCheckStrictly" column="menu_check_strictly"/> |
| | | <result property="deptCheckStrictly" column="dept_check_strictly"/> |
| | | <result property="status" column="status"/> |
| | | <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="selectRoleVo"> |
| | | select distinct r.role_id, |
| | | r.role_name, |
| | | r.role_key, |
| | | r.role_sort, |
| | | r.data_scope, |
| | | r.menu_check_strictly, |
| | | r.dept_check_strictly, |
| | | r.status, |
| | | r.del_flag, |
| | | r.create_time, |
| | | r.remark |
| | | from sys_role r |
| | | left join sys_user_role ur on ur.role_id = r.role_id |
| | | left join sys_user u on u.user_id = ur.user_id |
| | | left join sys_dept d on u.dept_id = d.dept_id |
| | | left join sys_user_role ur on ur.role_id = r.role_id |
| | | left join sys_user u on u.user_id = ur.user_id |
| | | left join sys_dept d on u.dept_id = d.dept_id |
| | | </sql> |
| | | |
| | | |
| | | <select id="selectRoleList" parameterType="SysRole" resultMap="SysRoleResult"> |
| | | <include refid="selectRoleVo"/> |
| | | where r.del_flag = '0' |
| | | <if test="roleId != null and roleId != 0"> |
| | | AND r.role_id = #{roleId} |
| | | </if> |
| | | <if test="roleName != null and roleName != ''"> |
| | | AND r.role_name like concat('%', #{roleName}, '%') |
| | | </if> |
| | | <if test="status != null and status != ''"> |
| | | AND r.status = #{status} |
| | | </if> |
| | | <if test="roleKey != null and roleKey != ''"> |
| | | AND r.role_key like concat('%', #{roleKey}, '%') |
| | | </if> |
| | | <if test="params.beginTime != null and params.beginTime != ''"><!-- 开始时间检索 --> |
| | | and date_format(r.create_time,'%y%m%d') >= date_format(#{params.beginTime},'%y%m%d') |
| | | </if> |
| | | <if test="params.endTime != null and params.endTime != ''"><!-- 结束时间检索 --> |
| | | and date_format(r.create_time,'%y%m%d') <= date_format(#{params.endTime},'%y%m%d') |
| | | </if> |
| | | <!-- 数据范围过滤 --> |
| | | ${params.dataScope} |
| | | order by r.role_sort |
| | | </select> |
| | | |
| | | <select id="selectRolePermissionByUserId" parameterType="Long" resultMap="SysRoleResult"> |
| | | <include refid="selectRoleVo"/> |
| | | WHERE r.del_flag = '0' and ur.user_id = #{userId} |
| | | </select> |
| | | |
| | | <select id="selectRoleAll" resultMap="SysRoleResult"> |
| | | <include refid="selectRoleVo"/> |
| | | </select> |
| | | |
| | | <select id="selectRoleListByUserId" parameterType="Long" resultType="Long"> |
| | | select r.role_id |
| | | <include refid="selectRoleVo"/> |
| | | where r.del_flag = '0' |
| | | <if test="roleId != null and roleId != 0"> |
| | | AND r.role_id = #{roleId} |
| | | </if> |
| | | <if test="roleName != null and roleName != ''"> |
| | | AND r.role_name like concat('%', #{roleName}, '%') |
| | | </if> |
| | | <if test="status != null and status != ''"> |
| | | AND r.status = #{status} |
| | | </if> |
| | | <if test="roleKey != null and roleKey != ''"> |
| | | AND r.role_key like concat('%', #{roleKey}, '%') |
| | | </if> |
| | | <if test="params.beginTime != null and params.beginTime != ''"><!-- 开始时间检索 --> |
| | | and date_format(r.create_time,'%y%m%d') >= date_format(#{params.beginTime},'%y%m%d') |
| | | </if> |
| | | <if test="params.endTime != null and params.endTime != ''"><!-- 结束时间检索 --> |
| | | and date_format(r.create_time,'%y%m%d') <= date_format(#{params.endTime},'%y%m%d') |
| | | </if> |
| | | <!-- 数据范围过滤 --> |
| | | ${params.dataScope} |
| | | order by r.role_sort |
| | | </select> |
| | | |
| | | <select id="selectRolePermissionByUserId" parameterType="Long" resultMap="SysRoleResult"> |
| | | <include refid="selectRoleVo"/> |
| | | WHERE r.del_flag = '0' and ur.user_id = #{userId} |
| | | </select> |
| | | |
| | | <select id="selectRoleAll" resultMap="SysRoleResult"> |
| | | <include refid="selectRoleVo"/> |
| | | </select> |
| | | |
| | | <select id="selectRoleListByUserId" parameterType="Long" resultType="Long"> |
| | | select r.role_id |
| | | from sys_role r |
| | | left join sys_user_role ur on ur.role_id = r.role_id |
| | | left join sys_user u on u.user_id = ur.user_id |
| | | where u.user_id = #{userId} |
| | | </select> |
| | | |
| | | <select id="selectRoleById" parameterType="Long" resultMap="SysRoleResult"> |
| | | <include refid="selectRoleVo"/> |
| | | where r.role_id = #{roleId} |
| | | </select> |
| | | |
| | | <select id="selectRolesByUserName" parameterType="String" resultMap="SysRoleResult"> |
| | | <include refid="selectRoleVo"/> |
| | | WHERE r.del_flag = '0' and u.user_name = #{userName} |
| | | </select> |
| | | |
| | | <select id="checkRoleNameUnique" parameterType="String" resultMap="SysRoleResult"> |
| | | <include refid="selectRoleVo"/> |
| | | where r.role_name=#{roleName} limit 1 |
| | | </select> |
| | | |
| | | <select id="checkRoleKeyUnique" parameterType="String" resultMap="SysRoleResult"> |
| | | <include refid="selectRoleVo"/> |
| | | where r.role_key=#{roleKey} limit 1 |
| | | </select> |
| | | |
| | | <insert id="insertRole" parameterType="SysRole" useGeneratedKeys="true" keyProperty="roleId"> |
| | | insert into sys_role( |
| | | <if test="roleId != null and roleId != 0">role_id,</if> |
| | | <if test="roleName != null and roleName != ''">role_name,</if> |
| | | <if test="roleKey != null and roleKey != ''">role_key,</if> |
| | | <if test="roleSort != null and roleSort != ''">role_sort,</if> |
| | | <if test="dataScope != null and dataScope != ''">data_scope,</if> |
| | | <if test="menuCheckStrictly != null">menu_check_strictly,</if> |
| | | <if test="deptCheckStrictly != null">dept_check_strictly,</if> |
| | | <if test="status != null and status != ''">status,</if> |
| | | <if test="remark != null and remark != ''">remark,</if> |
| | | <if test="createBy != null and createBy != ''">create_by,</if> |
| | | create_time |
| | | )values( |
| | | <if test="roleId != null and roleId != 0">#{roleId},</if> |
| | | <if test="roleName != null and roleName != ''">#{roleName},</if> |
| | | <if test="roleKey != null and roleKey != ''">#{roleKey},</if> |
| | | <if test="roleSort != null and roleSort != ''">#{roleSort},</if> |
| | | <if test="dataScope != null and dataScope != ''">#{dataScope},</if> |
| | | <if test="menuCheckStrictly != null">#{menuCheckStrictly},</if> |
| | | <if test="deptCheckStrictly != null">#{deptCheckStrictly},</if> |
| | | <if test="status != null and status != ''">#{status},</if> |
| | | <if test="remark != null and remark != ''">#{remark},</if> |
| | | <if test="createBy != null and createBy != ''">#{createBy},</if> |
| | | sysdate() |
| | | ) |
| | | </insert> |
| | | |
| | | <update id="updateRole" parameterType="SysRole"> |
| | | update sys_role |
| | | <set> |
| | | <if test="roleName != null and roleName != ''">role_name = #{roleName},</if> |
| | | <if test="roleKey != null and roleKey != ''">role_key = #{roleKey},</if> |
| | | <if test="roleSort != null and roleSort != ''">role_sort = #{roleSort},</if> |
| | | <if test="dataScope != null and dataScope != ''">data_scope = #{dataScope},</if> |
| | | <if test="menuCheckStrictly != null">menu_check_strictly = #{menuCheckStrictly},</if> |
| | | <if test="deptCheckStrictly != null">dept_check_strictly = #{deptCheckStrictly},</if> |
| | | <if test="status != null and status != ''">status = #{status},</if> |
| | | <if test="remark != null">remark = #{remark},</if> |
| | | <if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if> |
| | | update_time = sysdate() |
| | | </set> |
| | | where role_id = #{roleId} |
| | | </update> |
| | | |
| | | <delete id="deleteRoleById" parameterType="Long"> |
| | | update sys_role set del_flag = '2' where role_id = #{roleId} |
| | | </delete> |
| | | |
| | | <delete id="deleteRoleByIds" parameterType="Long"> |
| | | update sys_role set del_flag = '2' where role_id in |
| | | <foreach collection="array" item="roleId" open="(" separator="," close=")"> |
| | | #{roleId} |
| | | </foreach> |
| | | </delete> |
| | | |
| | | left join sys_user_role ur on ur.role_id = r.role_id |
| | | left join sys_user u on u.user_id = ur.user_id |
| | | where u.user_id = #{userId} |
| | | </select> |
| | | |
| | | <select id="selectRoleById" parameterType="Long" resultMap="SysRoleResult"> |
| | | <include refid="selectRoleVo"/> |
| | | where r.role_id = #{roleId} |
| | | </select> |
| | | |
| | | <select id="selectRolesByUserName" parameterType="String" resultMap="SysRoleResult"> |
| | | <include refid="selectRoleVo"/> |
| | | WHERE r.del_flag = '0' and u.user_name = #{userName} |
| | | </select> |
| | | |
| | | <select id="checkRoleNameUnique" parameterType="String" resultMap="SysRoleResult"> |
| | | <include refid="selectRoleVo"/> |
| | | where r.role_name=#{roleName} limit 1 |
| | | </select> |
| | | |
| | | <select id="checkRoleKeyUnique" parameterType="String" resultMap="SysRoleResult"> |
| | | <include refid="selectRoleVo"/> |
| | | where r.role_key=#{roleKey} limit 1 |
| | | </select> |
| | | |
| | | <insert id="insertRole" parameterType="SysRole" useGeneratedKeys="true" keyProperty="roleId"> |
| | | insert into sys_role( |
| | | <if test="roleId != null and roleId != 0">role_id,</if> |
| | | <if test="roleName != null and roleName != ''">role_name,</if> |
| | | <if test="roleKey != null and roleKey != ''">role_key,</if> |
| | | <if test="roleSort != null and roleSort != ''">role_sort,</if> |
| | | <if test="dataScope != null and dataScope != ''">data_scope,</if> |
| | | <if test="menuCheckStrictly != null">menu_check_strictly,</if> |
| | | <if test="deptCheckStrictly != null">dept_check_strictly,</if> |
| | | <if test="status != null and status != ''">status,</if> |
| | | <if test="remark != null and remark != ''">remark,</if> |
| | | <if test="createBy != null and createBy != ''">create_by,</if> |
| | | create_time |
| | | )values( |
| | | <if test="roleId != null and roleId != 0">#{roleId},</if> |
| | | <if test="roleName != null and roleName != ''">#{roleName},</if> |
| | | <if test="roleKey != null and roleKey != ''">#{roleKey},</if> |
| | | <if test="roleSort != null and roleSort != ''">#{roleSort},</if> |
| | | <if test="dataScope != null and dataScope != ''">#{dataScope},</if> |
| | | <if test="menuCheckStrictly != null">#{menuCheckStrictly},</if> |
| | | <if test="deptCheckStrictly != null">#{deptCheckStrictly},</if> |
| | | <if test="status != null and status != ''">#{status},</if> |
| | | <if test="remark != null and remark != ''">#{remark},</if> |
| | | <if test="createBy != null and createBy != ''">#{createBy},</if> |
| | | sysdate() |
| | | ) |
| | | </insert> |
| | | |
| | | <update id="updateRole" parameterType="SysRole"> |
| | | update sys_role |
| | | <set> |
| | | <if test="roleName != null and roleName != ''">role_name = #{roleName},</if> |
| | | <if test="roleKey != null and roleKey != ''">role_key = #{roleKey},</if> |
| | | <if test="roleSort != null and roleSort != ''">role_sort = #{roleSort},</if> |
| | | <if test="dataScope != null and dataScope != ''">data_scope = #{dataScope},</if> |
| | | <if test="menuCheckStrictly != null">menu_check_strictly = #{menuCheckStrictly},</if> |
| | | <if test="deptCheckStrictly != null">dept_check_strictly = #{deptCheckStrictly},</if> |
| | | <if test="status != null and status != ''">status = #{status},</if> |
| | | <if test="remark != null">remark = #{remark},</if> |
| | | <if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if> |
| | | update_time = sysdate() |
| | | </set> |
| | | where role_id = #{roleId} |
| | | </update> |
| | | |
| | | <delete id="deleteRoleById" parameterType="Long"> |
| | | update sys_role |
| | | set del_flag = '2' |
| | | where role_id = #{roleId} |
| | | </delete> |
| | | |
| | | <delete id="deleteRoleByIds" parameterType="Long"> |
| | | update sys_role set del_flag = '2' where role_id in |
| | | <foreach collection="array" item="roleId" open="(" separator="," close=")"> |
| | | #{roleId} |
| | | </foreach> |
| | | </delete> |
| | | |
| | | </mapper> |
| | |
| | | </select> |
| | | |
| | | <select id="selectUnallocatedList" parameterType="SysUser" resultMap="SysUserResult"> |
| | | select distinct u.user_id, u.dept_id, u.user_name, u.nick_name, u.email, u.phonenumber, u.status, u.create_time,u.is_authentication |
| | | select distinct u.user_id, u.dept_id, u.user_name, u.nick_name, u.email, u.phonenumber, u.status, |
| | | u.create_time,u.is_authentication |
| | | from sys_user u |
| | | left join sys_dept d on u.dept_id = d.dept_id |
| | | left join sys_user_role ur on u.user_id = ur.user_id |
| | |
| | | <el-table :data="tableData" style="width: 100%" @selection-change="handleSelectionChange"> |
| | | <el-table-column type="selection" fixed width="55"> |
| | | </el-table-column> |
| | | <el-table-column label="基本信息"> |
| | | <!-- <el-table-column label="基本信息"> --> |
| | | <el-table-column prop="id" label="编号" width="120"> |
| | | </el-table-column> |
| | | <el-table-column prop="address" label="地址"> |
| | | </el-table-column> |
| | | </el-table-column> |
| | | |
| | | <!-- </el-table-column> --> |
| | | <el-table-column label="安装信息"> |
| | | <el-table-column prop="appointmentTime" label="预约时间" width="120"> |
| | | <el-table-column prop="appointmentTime" label="预约时间" width="150"> |
| | | <template slot-scope="scope"> |
| | | <div> |
| | | {{ scope.row.appointmentTime ? scope.row.appointmentTime : '--' }} |
| | | </div> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="remark" label="备注" width="120"> |
| | | <el-table-column prop="remark" label="备注" > |
| | | <template slot-scope="scope"> |
| | | <div> |
| | | {{ scope.row.remark ? scope.row.remark : '--' }} |
| | | </div> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="erectoId" label="安装工" width="120"> |
| | | <el-table-column prop="erectoName" label="安装工" width="120"> |
| | | </el-table-column> |
| | | </el-table-column> |
| | | <el-table-column label="用户信息"> |
| | | <el-table-column prop="userid" label="联系人" width="120"> |
| | | <el-table-column prop="userName" label="联系人" width="120"> |
| | | </el-table-column> |
| | | <el-table-column prop="userPhone" label="联系电话" width="120"> |
| | | </el-table-column> |
| | | <el-table-column prop="address" label="地址"> |
| | | </el-table-column> |
| | | </el-table-column> |
| | | <!-- <el-table-column label="评价信息"> |
| | |
| | | </el-table-column> --> |
| | | <el-table-column label="状态" prop="state" width="120"> |
| | | <template slot-scope="scope"> |
| | | <div v-if="scope.row == 0"> |
| | | <div v-if="scope.row.state == 0"> |
| | | 未派单 |
| | | </div> |
| | | <div v-if="scope.row.state == 1"> |
| | |
| | | </div> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="操作" width="120" fixed="right"> |
| | | <el-table-column label="操作" fixed="right" align="center" class-name="small-padding fixed-width" width="150"> |
| | | <template slot-scope="scope"> |
| | | <el-button @click="editModal(scope.row)" type="text" size="small">编辑</el-button> |
| | | <el-button @click="delModal(scope.row)" type="text" size="small">删除</el-button> |
| | | <!-- <el-button @click="editModal(scope.row)" type="text" size="small">编辑</el-button> |
| | | <el-button @click="delModal(scope.row)" type="text" size="small">删除</el-button> --> |
| | | <el-button size="small" type="primary" style="padding:5px;" icon="el-icon-edit" |
| | | @click="editModal(scope.row)" >修改</el-button> |
| | | <el-button size=" small" type="danger" style="padding:5px;" icon="el-icon-delete" |
| | | @click="delModal(scope.row)">删除</el-button> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | |
| | | </el-form-item> |
| | | <el-form-item label="安装工" :label-width="formLabelWidth" prop="erectoId"> |
| | | <el-select v-model="form.erectoId" placeholder="请选择"> |
| | | <el-option label="未指派" value="shanghai"></el-option> |
| | | <el-option label="安装工1号" value="beijing"></el-option> |
| | | <el-option v-for="item in erectoList" :label="item.nickName" :value="item.userId"></el-option> |
| | | <!-- <el-option label="未指派" value="shanghai"></el-option> |
| | | <el-option label="安装工1号" value="beijing"></el-option> --> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="用户姓名" :label-width="formLabelWidth" prop="userid"> |
| | | <el-input v-model="form.userid" autocomplete="off"></el-input> |
| | | <el-form-item label="用户姓名" :label-width="formLabelWidth" prop="userName"> |
| | | <el-input v-model="form.userName" autocomplete="off"></el-input> |
| | | </el-form-item> |
| | | <el-form-item label="手机号" :label-width="formLabelWidth" prop="userPhone"> |
| | | <el-input v-model="form.userPhone" autocomplete="off"></el-input> |
| | |
| | | <el-input v-model="form.address" autocomplete="off"></el-input> |
| | | </el-form-item> |
| | | <el-form-item label="预约时间" :label-width="formLabelWidth"> |
| | | <el-date-picker v-model="form.appointmentTime" type="datetime" placeholder="选择日期时间"> |
| | | <el-date-picker v-model="form.appointmentTime" type="datetime" placeholder="选择日期时间" value-format="yyyy-MM-dd HH:mm:ss"> |
| | | </el-date-picker> |
| | | </el-form-item> |
| | | <el-form-item label="备注" :label-width="formLabelWidth"> |
| | |
| | | <span>是否删除该条数据</span> |
| | | <span slot="footer" class="dialog-footer"> |
| | | <el-button @click="deleteModal = false">取 消</el-button> |
| | | <el-button type="primary" @click="deleteModal = false">确 定</el-button> |
| | | <el-button type="primary" @click="delDate">确 定</el-button> |
| | | </span> |
| | | </el-dialog> |
| | | |
| | |
| | | erectoId: [ |
| | | { required: true, message: "请选择安装工", trigger: "change" } |
| | | ], |
| | | userid: [ |
| | | userName: [ |
| | | { required: true, message: "用户姓名不能为空", trigger: "blur" } |
| | | ], |
| | | userPhone: [ |
| | |
| | | "evaluate": "服务的态度的是好的", |
| | | "receiveTime": null, |
| | | "finshTime": null, |
| | | "state": 2 |
| | | "state": 2, |
| | | // erectoName:'' |
| | | } |
| | | ], |
| | | formLabelWidth: '120px', |
| | | AZModal: false, |
| | | deviceList: [], |
| | | state: -1, |
| | | id: 0 |
| | | id: 0, |
| | | erectoList:[] |
| | | } |
| | | }, |
| | | |
| | |
| | | }, |
| | | mounted() { |
| | | this.getList(); |
| | | this.getErectoList() |
| | | this.getDeviceList(); |
| | | }, |
| | | methods: { |
| | | getErectoList(){ |
| | | let data = { |
| | | pageNum:1, |
| | | pageSize:10000, |
| | | deptId: localStorage.getItem('deptId'), |
| | | isAuthentication:1 |
| | | } |
| | | request({ |
| | | url: '/system/user/list', |
| | | method: "get", |
| | | params: data |
| | | }).then((res) => { |
| | | console.log(res); |
| | | if (res.code == 200) { |
| | | this.erectoList = res.rows |
| | | this.erectoList.unshift({ |
| | | nickName:'未指派', |
| | | userId:0 |
| | | }) |
| | | } else { |
| | | this.erectoList = [] |
| | | } |
| | | }).catch((res) => { |
| | | this.erectoList = [] |
| | | }) |
| | | |
| | | }, |
| | | // 获取设备列表 |
| | | getDeviceList() { |
| | | let data = { |
| | |
| | | address: '',//地址 |
| | | appointmentTime: '',//预约时间 |
| | | remark: '',//备注 |
| | | erectoId: '',//安装工 |
| | | userid: '', //用户信息,联系人 |
| | | erectoId: 0,//安装工 |
| | | userName: '', //用户信息,联系人 |
| | | userPhone: '',//用户信息联系电话 |
| | | erectoName:'未指派' |
| | | } |
| | | this.title = '创建安装单' |
| | | this.AZModal = true |
| | |
| | | }); |
| | | }, |
| | | add() { |
| | | for (let i = 0; i < this.erectoList.length; i++) { |
| | | if(this.form.erectoId==this.erectoList[i].userId){ |
| | | this.form.erectoName=this.erectoList[i].nickName |
| | | } |
| | | } |
| | | let data = { |
| | | deviceId: this.form.deviceId, |
| | | erectoId: 1, |
| | | userName: this.form.userid, |
| | | erectoId: this.form.erectoId, |
| | | erectoName: this.form.erectoName, |
| | | userName: this.form.userName, |
| | | userPhone: this.form.userPhone, |
| | | address: this.form.address, |
| | | appointmentTime: this.form.appointmentTime, |
| | | remark: this.form.remark, |
| | | } |
| | | console.log(data); |
| | | if (this.title == '编辑安装单') { |
| | | data.id = this.id |
| | | request({ |
| | | url: '/iot/deviceOrder', |
| | | method: "put", |
| | | params: data |
| | | data: data |
| | | }).then((res) => { |
| | | console.log(res); |
| | | if (res.code == 200) { |
| | | that.pageIndex = 1 |
| | | this.state=-1 |
| | | this.pageIndex = 1 |
| | | this.getList() |
| | | this.AZModal = false |
| | | |
| | | } else { |
| | | that.pageIndex = 1 |
| | | this.state=-1 |
| | | this.pageIndex = 1 |
| | | this.getList() |
| | | this.AZModal = false |
| | | } |
| | | }).catch((res) => { |
| | | that.pageIndex = 1 |
| | | this.state=-1 |
| | | this.pageIndex = 1 |
| | | this.getList() |
| | | this.AZModal = false |
| | | }) |
| | |
| | | data: data |
| | | }).then((res) => { |
| | | if (res.code == 200) { |
| | | that.pageIndex = 1 |
| | | this.state=-1 |
| | | this.pageIndex = 1 |
| | | this.getList() |
| | | this.AZModal = false |
| | | |
| | | } else { |
| | | that.pageIndex = 1 |
| | | this.state=-1 |
| | | this.pageIndex = 1 |
| | | this.getList() |
| | | this.AZModal = false |
| | | } |
| | | }).catch((res) => { |
| | | that.pageIndex = 1 |
| | | this.state=-1 |
| | | this.pageIndex = 1 |
| | | this.getList() |
| | | this.AZModal = false |
| | | }) |
| | |
| | | id: this.id |
| | | } |
| | | request({ |
| | | url: '/iot/deviceOrder/id', |
| | | url: `/iot/deviceOrder/${this.id}`, |
| | | method: "DELETE", |
| | | params: data |
| | | // params: data |
| | | }).then((res) => { |
| | | if (res.code == 200) { |
| | | that.pageIndex = 1 |