代码更新
This commit is contained in:
@@ -36,7 +36,7 @@ import org.springframework.web.bind.annotation.RestController;
|
||||
@EnableTransactionManagement
|
||||
@EnableMethodCache(basePackages = "org.nl")
|
||||
@EnableCreateCacheAnnotation
|
||||
@MapperScan("org.nl.*.service.*.dao.mapper")
|
||||
@MapperScan("org.nl.**.mapper")
|
||||
public class AppRun {
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
||||
@@ -15,15 +15,11 @@
|
||||
*/
|
||||
package org.nl.modules.system.rest;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.nl.modules.common.exception.BadRequestException;
|
||||
import org.nl.modules.logging.annotation.Log;
|
||||
import org.nl.modules.system.domain.Dict;
|
||||
import org.nl.modules.system.service.DictService;
|
||||
import org.nl.modules.system.service.DictService2;
|
||||
import org.nl.modules.system.service.dto.DictDto;
|
||||
import org.nl.modules.system.service.dto.DictQueryCriteria;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
@@ -43,30 +39,30 @@ import java.util.Set;
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@Api(tags = "系统:字典管理")
|
||||
@RequestMapping("/api/dict")
|
||||
public class DictController {
|
||||
//@RequestMapping("/api/dict")
|
||||
public class DictController2 {
|
||||
|
||||
private final DictService dictService;
|
||||
private final DictService2 dictService2;
|
||||
|
||||
@ApiOperation("导出字典数据")
|
||||
@GetMapping(value = "/download")
|
||||
// @SaCheckPermission("dict:list")
|
||||
public void download(HttpServletResponse response, DictQueryCriteria criteria) throws IOException {
|
||||
dictService.download(dictService.queryAll(criteria), response);
|
||||
dictService2.download(dictService2.queryAll(criteria), response);
|
||||
}
|
||||
|
||||
@ApiOperation("查询字典")
|
||||
@GetMapping(value = "/all")
|
||||
// @SaCheckPermission("dict:list")
|
||||
public ResponseEntity<Object> queryAll(){
|
||||
return new ResponseEntity<>(dictService.queryAll(new DictQueryCriteria()),HttpStatus.OK);
|
||||
return new ResponseEntity<>(dictService2.queryAll(new DictQueryCriteria()),HttpStatus.OK);
|
||||
}
|
||||
|
||||
@ApiOperation("查询字典")
|
||||
@GetMapping
|
||||
// @SaCheckPermission("dict:list")
|
||||
public ResponseEntity<Object> query(DictQueryCriteria resources, Pageable pageable){
|
||||
return new ResponseEntity<>(dictService.queryAll(resources,pageable),HttpStatus.OK);
|
||||
return new ResponseEntity<>(dictService2.queryAll(resources,pageable),HttpStatus.OK);
|
||||
}
|
||||
|
||||
@Log("新增字典")
|
||||
@@ -74,7 +70,7 @@ public class DictController {
|
||||
@PostMapping
|
||||
// @SaCheckPermission("dict:add")
|
||||
public ResponseEntity<Object> create(@RequestBody DictDto resources){
|
||||
dictService.create(resources);
|
||||
dictService2.create(resources);
|
||||
return new ResponseEntity<>(HttpStatus.CREATED);
|
||||
}
|
||||
|
||||
@@ -83,7 +79,7 @@ public class DictController {
|
||||
@ApiOperation("修改字典")
|
||||
//@SaCheckPermission("@el.check('dict:edit')")
|
||||
public ResponseEntity<Object> update(@Validated @RequestBody DictDto dto){
|
||||
dictService.update(dto);
|
||||
dictService2.update(dto);
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
|
||||
@@ -92,7 +88,7 @@ public class DictController {
|
||||
@DeleteMapping
|
||||
// @SaCheckPermission("dict:del")
|
||||
public ResponseEntity<Object> delete(@RequestBody Set<Long> ids){
|
||||
dictService.delete(ids);
|
||||
dictService2.delete(ids);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ import java.util.Map;
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@Api(tags = "系统参数管理")
|
||||
@RequestMapping("/api/param")
|
||||
@RequestMapping("/ssss")
|
||||
@Slf4j
|
||||
public class ParamController {
|
||||
|
||||
|
||||
@@ -15,8 +15,6 @@
|
||||
*/
|
||||
package org.nl.modules.system.service;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.nl.modules.system.domain.Dict;
|
||||
import org.nl.modules.system.service.dto.DictDto;
|
||||
import org.nl.modules.system.service.dto.DictQueryCriteria;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
@@ -31,7 +29,7 @@ import java.util.Set;
|
||||
* @author Zheng Jie
|
||||
* @date 2019-04-10
|
||||
*/
|
||||
public interface DictService {
|
||||
public interface DictService2 {
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
@@ -31,7 +31,6 @@ import org.nl.modules.system.service.dto.DictDto;
|
||||
import org.nl.modules.wql.WQL;
|
||||
import org.nl.modules.wql.core.bean.WQLObject;
|
||||
import org.nl.modules.wql.util.WqlUtil;
|
||||
import org.springframework.cache.annotation.CacheConfig;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
@@ -26,14 +26,12 @@ import org.nl.modules.common.exception.BadRequestException;
|
||||
import org.nl.modules.common.utils.FileUtil;
|
||||
import org.nl.modules.common.utils.RedisUtils;
|
||||
import org.nl.modules.common.utils.SecurityUtils;
|
||||
import org.nl.modules.system.service.DictService;
|
||||
import org.nl.modules.system.service.dto.DictDetailDto;
|
||||
import org.nl.modules.system.service.DictService2;
|
||||
import org.nl.modules.system.service.dto.DictDto;
|
||||
import org.nl.modules.system.service.dto.DictQueryCriteria;
|
||||
import org.nl.modules.wql.WQL;
|
||||
import org.nl.modules.wql.core.bean.WQLObject;
|
||||
import org.nl.modules.wql.util.WqlUtil;
|
||||
import org.springframework.cache.annotation.CacheConfig;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
@@ -48,7 +46,7 @@ import java.util.*;
|
||||
*/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class DictServiceImpl implements DictService {
|
||||
public class DictService2Impl implements DictService2 {
|
||||
|
||||
private final RedisUtils redisUtils;
|
||||
|
||||
@@ -0,0 +1,119 @@
|
||||
package org.nl.system.controller.dict;
|
||||
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
import org.nl.modules.logging.annotation.Log;
|
||||
import org.nl.system.service.dict.ISysDictService;
|
||||
import org.nl.system.service.dict.dao.Dict;
|
||||
import org.nl.system.service.dict.dto.DictQuery;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 字典表 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author generator
|
||||
* @since 2022-12-14
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/api/dict")
|
||||
public class SysDictController {
|
||||
|
||||
@Autowired
|
||||
private ISysDictService dictService;
|
||||
|
||||
@Log("查询字典")
|
||||
@GetMapping
|
||||
@ApiOperation("查询字典")
|
||||
// @SaCheckPermission("dict:list")
|
||||
public ResponseEntity<Object> query(@RequestParam Map whereJson, PageQuery pageable){
|
||||
return new ResponseEntity<>(dictService.queryAll(whereJson,pageable), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@Log("新增字典")
|
||||
@PostMapping
|
||||
@ApiOperation("新增字典")
|
||||
// @SaCheckPermission("dict:add")
|
||||
public ResponseEntity<Object> create(@RequestBody Dict dict){
|
||||
dictService.create(dict);
|
||||
return new ResponseEntity<>(HttpStatus.CREATED);
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@Log("修改字典")
|
||||
@ApiOperation("修改字典")
|
||||
//@SaCheckPermission("@el.check('dict:edit')")
|
||||
public ResponseEntity<Object> updateDict(@Validated @RequestBody Dict dto){
|
||||
dictService.updateDict(dto);
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
|
||||
@Log("删除字典")
|
||||
@ApiOperation("删除字典")
|
||||
@DeleteMapping
|
||||
// @SaCheckPermission("dict:del")
|
||||
public ResponseEntity<Object> delete(@RequestBody Set<Long> ids){
|
||||
dictService.deleteBatchByIds(ids);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@GetMapping("/dictDetail")
|
||||
@ApiOperation("查询字典详情")
|
||||
public ResponseEntity<Object> queryDetails(Map criteria, PageQuery pageable){
|
||||
DictQuery dictQuery = JSONObject.parseObject(JSONObject.toJSONString(criteria), DictQuery.class);
|
||||
return new ResponseEntity<>(dictService.queryAllDetail(dictQuery,pageable),HttpStatus.OK);
|
||||
}
|
||||
|
||||
@ApiOperation("查询多个字典详情")
|
||||
@GetMapping(value = "/dictDetail/map")
|
||||
public ResponseEntity<Object> getDictDetailMaps(@RequestParam String dictName){
|
||||
String[] names = dictName.split("[,,]");
|
||||
Map<String, List<Dict>> dictMap = new HashMap<>(16);
|
||||
for (String name : names) {
|
||||
dictMap.put(name, dictService.getDictByName(name));
|
||||
}
|
||||
return new ResponseEntity<>(dictMap, HttpStatus.OK);
|
||||
}
|
||||
|
||||
@Log("新增字典详情")
|
||||
@ApiOperation("新增字典详情")
|
||||
@PostMapping("/dictDetail")
|
||||
// @SaCheckPermission("dict:add")
|
||||
public ResponseEntity<Object> createDetail(@RequestBody Dict resources){
|
||||
dictService.createDetail(resources);
|
||||
return new ResponseEntity<>(HttpStatus.CREATED);
|
||||
}
|
||||
|
||||
@Log("修改字典详情")
|
||||
@ApiOperation("修改字典详情")
|
||||
@PutMapping("/dictDetail")
|
||||
// @SaCheckPermission("dict:edit")
|
||||
public ResponseEntity<Object> updateDetail(@RequestBody Dict resources){
|
||||
dictService.updateDetail(resources);
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
|
||||
@Log("删除字典详情")
|
||||
@ApiOperation("删除字典详情")
|
||||
@DeleteMapping(value = "/dictDetail/{id}")
|
||||
// @SaCheckPermission("dict:del")
|
||||
public ResponseEntity<Object> deleteDetail(@PathVariable Long id){
|
||||
dictService.deleteDetail(id);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,85 @@
|
||||
package org.nl.system.controller.param;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaIgnore;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
import org.nl.modules.logging.annotation.Log;
|
||||
import org.nl.system.service.param.ISysParamService;
|
||||
import org.nl.system.service.param.dao.Param;
|
||||
import org.nl.system.service.param.dto.ParamQuery;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 系统参数表 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author generator
|
||||
* @since 2022-12-14
|
||||
*/
|
||||
@Api(tags = "系统参数管理")
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/api/param")
|
||||
class SysParamController {
|
||||
|
||||
@Autowired
|
||||
private ISysParamService paramService;
|
||||
@GetMapping
|
||||
@Log("查询系统参数")
|
||||
@ApiOperation("查询系统参数")
|
||||
//@SaCheckPermission("param:list")
|
||||
public ResponseEntity<Object> query(@RequestParam Map whereJson, PageQuery page){
|
||||
return new ResponseEntity<>(paramService.queryAll(whereJson, page), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
@Log("新增系统参数")
|
||||
@ApiOperation("新增系统参数")
|
||||
//@SaCheckPermission("param:add")
|
||||
public ResponseEntity<Object> create(@Validated @RequestBody Param param){
|
||||
paramService.create(param);
|
||||
return new ResponseEntity<>(HttpStatus.CREATED);
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@Log("修改系统参数")
|
||||
@ApiOperation("修改系统参数")
|
||||
//@SaCheckPermission("param:edit")
|
||||
public ResponseEntity<Object> update(@Validated @RequestBody Param param){
|
||||
paramService.update(param);
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
|
||||
@Log("删除系统参数")
|
||||
@ApiOperation("删除系统参数")
|
||||
//@SaCheckPermission("param:del")
|
||||
@DeleteMapping
|
||||
public ResponseEntity<Object> delete(@RequestBody String[] ids) {
|
||||
List<String> Ids = Arrays.asList(ids);
|
||||
paramService.deleteByIds(Ids);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/getValueByCode")
|
||||
@Log("根据编码获取值")
|
||||
@ApiOperation("根据编码获取值")
|
||||
@SaIgnore
|
||||
public ResponseEntity<Object> getValueByCode(@RequestBody String code) {
|
||||
return new ResponseEntity<>(paramService.findByCode(code), HttpStatus.CREATED);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -3,18 +3,18 @@ package org.nl.system.controller.role;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import cn.hutool.core.map.MapUtil;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
import org.nl.modules.logging.annotation.Log;
|
||||
import org.nl.system.service.role.ISysRoleService;
|
||||
import org.nl.system.service.role.dao.SysRole;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@@ -27,25 +27,25 @@ import java.util.Map;
|
||||
* @since 2022-12-15
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/sysRole")
|
||||
@RequestMapping("/api/sysRole")
|
||||
@RequiredArgsConstructor
|
||||
public class SysRoleController {
|
||||
private final ISysRoleService baseService;
|
||||
private final ISysRoleService roleService;
|
||||
|
||||
@ApiOperation("分页查询角色")
|
||||
@GetMapping
|
||||
@SaCheckPermission("roles:list")
|
||||
public ResponseEntity<Object> pageQuery(Map param, PageQuery page) {
|
||||
/*QueryWrapper<SysRole> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.like("name", MapUtil.getStr(param, "name"));*/
|
||||
public ResponseEntity<Object> pageQuery(@RequestParam Map param, PageQuery page) {
|
||||
return new ResponseEntity<>(roleService.query(param, page), HttpStatus.OK);
|
||||
}
|
||||
|
||||
LambdaQueryWrapper<SysRole> queryWrapper= new LambdaQueryWrapper<SysRole>()
|
||||
.like(SysRole::getName, MapUtil.getStr(param, "name"));
|
||||
|
||||
|
||||
Page<SysRole> roleList = baseService.page(page.build());
|
||||
|
||||
return new ResponseEntity<>(baseService.page(page.build(), queryWrapper), HttpStatus.OK);
|
||||
@Log("新增角色")
|
||||
@ApiOperation("新增角色")
|
||||
@PostMapping
|
||||
// @SaCheckPermission("roles:add")
|
||||
public ResponseEntity<Object> create(@RequestBody JSONObject param) {
|
||||
roleService.create(param);
|
||||
return new ResponseEntity<>(HttpStatus.CREATED);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,82 @@
|
||||
package org.nl.system.service.dict;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
import org.nl.system.service.dict.dao.Dict;
|
||||
import org.nl.system.service.dict.dto.DictQuery;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 字典表 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author generator
|
||||
* @since 2022-12-14
|
||||
*/
|
||||
public interface ISysDictService extends IService<Dict> {
|
||||
|
||||
/**
|
||||
* 分页查找
|
||||
* @param whereJson
|
||||
* @param pageable
|
||||
* @return
|
||||
*/
|
||||
IPage<Dict> queryAll(Map whereJson, PageQuery pageable);
|
||||
|
||||
/**
|
||||
* 新增
|
||||
* @param dict
|
||||
*/
|
||||
void create(Dict dict);
|
||||
|
||||
/**
|
||||
* 修改字典数据
|
||||
* @param dto
|
||||
*/
|
||||
void updateDict(Dict dto);
|
||||
|
||||
/**
|
||||
* 通过id批量删除字典
|
||||
* @param ids
|
||||
*/
|
||||
void deleteBatchByIds(Set<Long> ids);
|
||||
|
||||
/**
|
||||
* 分页查询获取字典明细
|
||||
* @param criteria
|
||||
* @param pageable
|
||||
* @return
|
||||
*/
|
||||
IPage<Dict> queryAllDetail(DictQuery criteria, PageQuery pageable);
|
||||
|
||||
/**
|
||||
* 获取字典明细
|
||||
* @param name
|
||||
* @return
|
||||
*/
|
||||
List<Dict> getDictByName(String name);
|
||||
|
||||
/**
|
||||
* 添加字典明细
|
||||
* @param resources
|
||||
*/
|
||||
void createDetail(Dict resources);
|
||||
|
||||
/**
|
||||
* 更新字典明细
|
||||
* @param resources
|
||||
*/
|
||||
void updateDetail(Dict resources);
|
||||
|
||||
/**
|
||||
* 删除字典
|
||||
* @param id
|
||||
*/
|
||||
void deleteDetail(Long id);
|
||||
}
|
||||
@@ -0,0 +1,105 @@
|
||||
package org.nl.system.service.dict.dao;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import java.io.Serializable;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 字典表
|
||||
* </p>
|
||||
*
|
||||
* @author generator
|
||||
* @since 2022-12-14
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@TableName("sys_dict")
|
||||
public class Dict implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 字典标识
|
||||
*/
|
||||
private Long dictId;
|
||||
|
||||
/**
|
||||
* 编码
|
||||
*/
|
||||
private String code;
|
||||
|
||||
/**
|
||||
* 名称
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 字典标签
|
||||
*/
|
||||
private String label;
|
||||
|
||||
/**
|
||||
* 字典值
|
||||
*/
|
||||
private String value;
|
||||
|
||||
/**
|
||||
* 排序号
|
||||
*/
|
||||
private BigDecimal dictSort;
|
||||
|
||||
/**
|
||||
* 字典类型
|
||||
*/
|
||||
private String dictType;
|
||||
|
||||
/**
|
||||
* 参数1
|
||||
*/
|
||||
private String para1;
|
||||
|
||||
/**
|
||||
* 参数2
|
||||
*/
|
||||
private String para2;
|
||||
|
||||
/**
|
||||
* 参数3
|
||||
*/
|
||||
private String para3;
|
||||
|
||||
/**
|
||||
* 创建人
|
||||
*/
|
||||
private Long createId;
|
||||
|
||||
/**
|
||||
* 创建人
|
||||
*/
|
||||
private String createName;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private String createTime;
|
||||
|
||||
/**
|
||||
* 修改人
|
||||
*/
|
||||
private Long updateOptid;
|
||||
|
||||
/**
|
||||
* 修改人
|
||||
*/
|
||||
private String updateOptname;
|
||||
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
private String updateTime;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package org.nl.system.service.dict.dao.mapper;
|
||||
|
||||
import org.nl.system.service.dict.dao.Dict;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 字典表 Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author generator
|
||||
* @since 2022-12-14
|
||||
*/
|
||||
public interface SysDictMapper extends BaseMapper<Dict> {
|
||||
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
<?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="org.nl.system.service.menu.dao.mapper.SysMenuMapper">
|
||||
<mapper namespace="org.nl.system.service.dict.dao.mapper.SysDictMapper">
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,15 @@
|
||||
package org.nl.system.service.dict.dto;
|
||||
|
||||
import lombok.Data;
|
||||
import org.nl.common.domain.query.BaseQuery;
|
||||
import org.nl.system.service.dict.dao.Dict;
|
||||
|
||||
/**
|
||||
* @Author: lyd
|
||||
* @Description:
|
||||
* @Date: 2022/12/15
|
||||
*/
|
||||
@Data
|
||||
public class DictQuery extends BaseQuery<Dict> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,169 @@
|
||||
package org.nl.system.service.dict.impl;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
import org.nl.modules.common.exception.BadRequestException;
|
||||
import org.nl.modules.common.utils.SecurityUtils;
|
||||
import org.nl.system.service.dict.ISysDictService;
|
||||
import org.nl.system.service.dict.dao.Dict;
|
||||
import org.nl.system.service.dict.dao.mapper.SysDictMapper;
|
||||
import org.nl.system.service.dict.dto.DictQuery;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 字典表 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author generator
|
||||
* @since 2022-12-14
|
||||
*/
|
||||
@Service
|
||||
public class SysDictServiceImpl extends ServiceImpl<SysDictMapper, Dict> implements ISysDictService {
|
||||
|
||||
@Autowired
|
||||
private SysDictMapper sysDictMapper;
|
||||
|
||||
@Override
|
||||
public IPage<Dict> queryAll(Map whereJson, PageQuery page) {
|
||||
String blurry = null;
|
||||
if (ObjectUtil.isNotEmpty(whereJson.get("blurry"))) blurry = whereJson.get("blurry").toString();
|
||||
LambdaQueryWrapper<Dict> lam = new LambdaQueryWrapper<>();
|
||||
lam.like(ObjectUtil.isNotEmpty(blurry), Dict::getCode, blurry)
|
||||
.or(ObjectUtil.isNotEmpty(blurry))
|
||||
.like(ObjectUtil.isNotEmpty(blurry), Dict::getName, blurry);
|
||||
IPage<Dict> pages = new Page<>(page.getPage(), page.getSize());
|
||||
sysDictMapper.selectPage(pages, lam);
|
||||
return pages;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void create(Dict dict) {
|
||||
Long currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String nickName = SecurityUtils.getCurrentNickName();
|
||||
String date = DateUtil.now();
|
||||
Dict oldDict = sysDictMapper.selectOne(new LambdaQueryWrapper<Dict>()
|
||||
.eq(ObjectUtil.isNotEmpty(dict.getCode()), Dict::getCode, dict.getCode()));
|
||||
if (ObjectUtil.isNotEmpty(oldDict)) throw new BadRequestException("字典[" + dict.getCode() + "]已存在");
|
||||
dict.setDictId(IdUtil.getSnowflake(1, 1).nextId());
|
||||
dict.setCreateId(currentUserId);
|
||||
dict.setCreateName(nickName);
|
||||
dict.setCreateTime(date);
|
||||
dict.setUpdateOptid(currentUserId);
|
||||
dict.setUpdateOptname(nickName);
|
||||
dict.setUpdateTime(date);
|
||||
sysDictMapper.insert(dict);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void updateDict(Dict dto) {
|
||||
Dict dict1 = sysDictMapper.selectOne(new LambdaQueryWrapper<Dict>().eq(Dict::getCode, dto.getCode()));
|
||||
if (ObjectUtil.isNotEmpty(dict1)) throw new BadRequestException("字典[" + dict1.getCode() + "]已存在");
|
||||
Dict dict = sysDictMapper.selectById(dto.getDictId());
|
||||
Long currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String currentNickName = SecurityUtils.getCurrentNickName();
|
||||
// 根据code获取所有字典
|
||||
List<Dict> dicts = sysDictMapper.selectList(new LambdaQueryWrapper<Dict>().eq(Dict::getCode, dict.getCode()));
|
||||
dicts.forEach(di -> {
|
||||
di.setCode(dto.getCode());
|
||||
di.setName(dto.getName());
|
||||
di.setUpdateOptid(currentUserId);
|
||||
di.setUpdateOptname(currentNickName);
|
||||
di.setUpdateTime(DateUtil.now());
|
||||
sysDictMapper.updateById(di);
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void deleteBatchByIds(Set<Long> ids) {
|
||||
sysDictMapper.deleteBatchIds(ids);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IPage<Dict> queryAllDetail(DictQuery criteria, PageQuery pageable) {
|
||||
QueryWrapper<Dict> queryWrapper = criteria.build();
|
||||
Page<Dict> page = this.page(pageable.build(), queryWrapper);
|
||||
return page;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Dict> getDictByName(String name) {
|
||||
List<Dict> dictList = sysDictMapper.selectList(new LambdaQueryWrapper<Dict>().eq(Dict::getCode, name)
|
||||
.isNotNull(Dict::getLabel)
|
||||
.ne(Dict::getLabel, ""));
|
||||
return dictList;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void createDetail(Dict dict) {
|
||||
// 校验是否已经有标签
|
||||
Dict one = sysDictMapper.selectOne(new LambdaQueryWrapper<Dict>().eq(Dict::getLabel, dict.getLabel())
|
||||
.eq(Dict::getCode, dict.getCode()));
|
||||
if (ObjectUtil.isNotEmpty(one)) throw new BadRequestException("标签[" + dict.getLabel() + "]已存在");
|
||||
// 判断是否有空的值
|
||||
Dict selectOne = sysDictMapper.selectOne(new LambdaQueryWrapper<Dict>().eq(Dict::getCode, dict.getCode()));
|
||||
if (ObjectUtil.isEmpty(selectOne.getLabel())) {
|
||||
// 空就赋值
|
||||
selectOne.setLabel(dict.getLabel());
|
||||
selectOne.setValue(dict.getValue());
|
||||
selectOne.setDictSort(dict.getDictSort());
|
||||
selectOne.setDictType(dict.getDictType());
|
||||
selectOne.setPara1(dict.getPara1());
|
||||
selectOne.setPara2(dict.getPara2());
|
||||
selectOne.setPara3(dict.getPara3());
|
||||
sysDictMapper.updateById(selectOne);
|
||||
return;
|
||||
}
|
||||
// 插入新的数据
|
||||
dict.setDictId(IdUtil.getSnowflake(1, 1).nextId());
|
||||
dict.setCode(selectOne.getCode());
|
||||
dict.setName(selectOne.getName());
|
||||
dict.setCreateId(SecurityUtils.getCurrentUserId());
|
||||
dict.setCreateName(SecurityUtils.getCurrentNickName());
|
||||
dict.setCreateTime(DateUtil.now());
|
||||
dict.setUpdateOptid(SecurityUtils.getCurrentUserId());
|
||||
dict.setUpdateOptname(SecurityUtils.getCurrentNickName());
|
||||
dict.setUpdateTime(DateUtil.now());
|
||||
sysDictMapper.insert(dict);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void updateDetail(Dict resources) {
|
||||
Dict dict = sysDictMapper.selectById(resources.getDictId());
|
||||
if (ObjectUtil.isEmpty(dict)) throw new BadRequestException("被删除或无权限,操作失败!");
|
||||
// 校验是否已经有标签
|
||||
Dict one = sysDictMapper.selectOne(new LambdaQueryWrapper<Dict>().eq(Dict::getLabel, dict.getLabel())
|
||||
.eq(Dict::getCode, dict.getCode()));
|
||||
if (ObjectUtil.isNotEmpty(one)) throw new BadRequestException("标签[" + dict.getLabel() + "]已存在");
|
||||
resources.setUpdateOptid(SecurityUtils.getCurrentUserId());
|
||||
resources.setUpdateOptname(SecurityUtils.getCurrentNickName());
|
||||
resources.setUpdateTime(DateUtil.now());
|
||||
sysDictMapper.updateById(resources);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void deleteDetail(Long id) {
|
||||
sysDictMapper.deleteById(id);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
package org.nl.system.service.param;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
import org.nl.system.service.param.dao.Param;
|
||||
import org.nl.system.service.param.dto.ParamQuery;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 系统参数表 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author generator
|
||||
* @since 2022-12-14
|
||||
*/
|
||||
public interface ISysParamService extends IService<Param> {
|
||||
|
||||
/**
|
||||
* 分页查找
|
||||
* @param whereJson
|
||||
* @param page
|
||||
* @return
|
||||
*/
|
||||
IPage<Param> queryAll(Map whereJson, PageQuery page);
|
||||
|
||||
/**
|
||||
* 创建参数
|
||||
* @param param
|
||||
*/
|
||||
void create(Param param);
|
||||
|
||||
/**
|
||||
* 更新
|
||||
* @param param
|
||||
*/
|
||||
void update(Param param);
|
||||
|
||||
/**
|
||||
* 删除
|
||||
* @param ids
|
||||
*/
|
||||
void deleteByIds(List<String> ids);
|
||||
|
||||
/**
|
||||
* 根据编码查询
|
||||
* @param code code
|
||||
* @return Param
|
||||
*/
|
||||
Param findByCode(String code);
|
||||
}
|
||||
@@ -1,6 +1,5 @@
|
||||
package org.nl.system.service.role.dao;
|
||||
package org.nl.system.service.param.dao;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import java.io.Serializable;
|
||||
import lombok.Data;
|
||||
@@ -8,23 +7,28 @@ import lombok.EqualsAndHashCode;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 角色表
|
||||
* 系统参数表
|
||||
* </p>
|
||||
*
|
||||
* @author generator
|
||||
* @since 2022-12-15
|
||||
* @since 2022-12-14
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@TableName("sys_role")
|
||||
public class SysRole implements Serializable {
|
||||
@TableName("sys_param")
|
||||
public class Param implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* ID
|
||||
* 标识
|
||||
*/
|
||||
private Long roleId;
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 编码
|
||||
*/
|
||||
private String code;
|
||||
|
||||
/**
|
||||
* 名称
|
||||
@@ -32,14 +36,9 @@ public class SysRole implements Serializable {
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 角色级别
|
||||
* 值
|
||||
*/
|
||||
private BigDecimal level;
|
||||
|
||||
/**
|
||||
* 排序
|
||||
*/
|
||||
private BigDecimal orderSeq;
|
||||
private String value;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
@@ -49,7 +48,7 @@ public class SysRole implements Serializable {
|
||||
/**
|
||||
* 是否启用
|
||||
*/
|
||||
private String isUsed;
|
||||
private String isActive;
|
||||
|
||||
/**
|
||||
* 是否删除
|
||||
@@ -57,12 +56,12 @@ public class SysRole implements Serializable {
|
||||
private String isDelete;
|
||||
|
||||
/**
|
||||
* 创建人标识
|
||||
* 创建者ID
|
||||
*/
|
||||
private Long createId;
|
||||
|
||||
/**
|
||||
* 创建人
|
||||
* 创建者
|
||||
*/
|
||||
private String createName;
|
||||
|
||||
@@ -72,12 +71,12 @@ public class SysRole implements Serializable {
|
||||
private String createTime;
|
||||
|
||||
/**
|
||||
* 修改人标识
|
||||
* 修改者ID
|
||||
*/
|
||||
private Long updateOptid;
|
||||
|
||||
/**
|
||||
* 修改人
|
||||
* 修改者
|
||||
*/
|
||||
private String updateOptname;
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
package org.nl.system.service.param.dao.mapper;
|
||||
|
||||
import org.nl.system.service.param.dao.Param;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 系统参数表 Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author generator
|
||||
* @since 2022-12-14
|
||||
*/
|
||||
public interface SysParamMapper extends BaseMapper<Param> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
<?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="org.nl.system.service.param.dao.mapper.SysParamMapper">
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,15 @@
|
||||
package org.nl.system.service.param.dto;
|
||||
|
||||
import lombok.Data;
|
||||
import org.nl.common.domain.query.BaseQuery;
|
||||
import org.nl.system.service.param.dao.Param;
|
||||
|
||||
/**
|
||||
* @Author: lyd
|
||||
* @Description:
|
||||
* @Date: 2022/12/15
|
||||
*/
|
||||
@Data
|
||||
public class ParamQuery extends BaseQuery<Param> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,88 @@
|
||||
package org.nl.system.service.param.impl;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
import org.nl.modules.common.exception.BadRequestException;
|
||||
import org.nl.modules.common.utils.SecurityUtils;
|
||||
import org.nl.modules.tools.MapOf;
|
||||
import org.nl.system.service.param.ISysParamService;
|
||||
import org.nl.system.service.param.dao.Param;
|
||||
import org.nl.system.service.param.dao.mapper.SysParamMapper;
|
||||
import org.nl.system.service.param.dto.ParamQuery;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 系统参数表 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author generator
|
||||
* @since 2022-12-14
|
||||
*/
|
||||
@Service
|
||||
public class SysParamServiceImpl extends ServiceImpl<SysParamMapper, Param> implements ISysParamService {
|
||||
|
||||
@Autowired
|
||||
private SysParamMapper paramMapper;
|
||||
|
||||
@Override
|
||||
public IPage<Param> queryAll(Map whereJson, PageQuery page) {
|
||||
QueryWrapper<Param> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.orderBy(true, true, "create_time");
|
||||
IPage<Param> paramIPage = paramMapper.selectPage(page.build(), queryWrapper);
|
||||
return paramIPage;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void create(Param param) {
|
||||
List code = paramMapper.selectByMap(MapOf.of("code", param.getCode()));
|
||||
if (ObjectUtil.isNotEmpty(code)) throw new BadRequestException("编码不能一致");
|
||||
param.setId(IdUtil.getSnowflake(1,1).nextIdStr());
|
||||
Long currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String nickName = SecurityUtils.getCurrentNickName();
|
||||
String now = DateUtil.now();
|
||||
param.setCreateId(currentUserId);
|
||||
param.setCreateName(nickName);
|
||||
param.setCreateTime(now);
|
||||
param.setUpdateOptid(currentUserId);
|
||||
param.setUpdateOptname(nickName);
|
||||
param.setUpdateTime(now);
|
||||
paramMapper.insert(param);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void update(Param param) {
|
||||
Param paramObj = paramMapper.selectById(param.getId());
|
||||
if (ObjectUtil.isEmpty(paramObj)) throw new BadRequestException("被删除或无权限,操作失败!");
|
||||
param.setUpdateOptid(SecurityUtils.getCurrentUserId());
|
||||
param.setUpdateOptname(SecurityUtils.getCurrentNickName());
|
||||
param.setUpdateTime(DateUtil.now());
|
||||
paramMapper.updateById(param);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void deleteByIds(List<String> ids) {
|
||||
paramMapper.deleteBatchIds(ids);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Param findByCode(String code) {
|
||||
List<Param> paramList = paramMapper.selectByMap(MapOf.of("code", code));
|
||||
return paramList.get(0);
|
||||
}
|
||||
}
|
||||
@@ -1,8 +1,14 @@
|
||||
package org.nl.system.service.role;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
import org.nl.system.service.dict.dao.Dict;
|
||||
import org.nl.system.service.role.dao.SysRole;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 角色表 服务类
|
||||
@@ -13,4 +19,11 @@ import org.nl.system.service.role.dao.SysRole;
|
||||
*/
|
||||
public interface ISysRoleService extends IService<SysRole> {
|
||||
|
||||
IPage<SysRole> query(Map param, PageQuery page);
|
||||
|
||||
/**
|
||||
* 创建角色
|
||||
* @param param
|
||||
*/
|
||||
void create(JSONObject param);
|
||||
}
|
||||
|
||||
@@ -2,4 +2,7 @@
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="org.nl.system.service.role.dao.mapper.SysRoleMapper">
|
||||
|
||||
<select id="list" resultType="org.nl.system.service.role.dao.SysRole">
|
||||
SELECT * FROM sys_role
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
@@ -1,11 +1,28 @@
|
||||
package org.nl.system.service.role.impl;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
import org.nl.modules.common.exception.BadRequestException;
|
||||
import org.nl.modules.common.utils.SecurityUtils;
|
||||
import org.nl.modules.wql.core.bean.WQLObject;
|
||||
import org.nl.system.service.dict.dao.Dict;
|
||||
import org.nl.system.service.role.ISysRoleService;
|
||||
import org.nl.system.service.role.dao.SysRole;
|
||||
import org.nl.system.service.role.dao.mapper.SysRoleMapper;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 角色表 服务实现类
|
||||
@@ -17,4 +34,41 @@ import org.springframework.stereotype.Service;
|
||||
@Service
|
||||
public class SysRoleServiceImpl extends ServiceImpl<SysRoleMapper, SysRole> implements ISysRoleService {
|
||||
|
||||
@Autowired
|
||||
private SysRoleMapper roleMapper;
|
||||
|
||||
@Override
|
||||
public IPage<SysRole> query(Map param, PageQuery page) {
|
||||
String blurry = null;
|
||||
if (ObjectUtil.isNotEmpty(param.get("blurry"))) blurry = param.get("blurry").toString();
|
||||
LambdaQueryWrapper<SysRole> lam = new LambdaQueryWrapper<>();
|
||||
lam.like(ObjectUtil.isNotEmpty(blurry), SysRole::getName, blurry);
|
||||
IPage<SysRole> pages = new Page<>(page.getPage(), page.getSize());
|
||||
roleMapper.selectPage(pages, lam);
|
||||
return pages;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void create(JSONObject param) {
|
||||
//判断角色名字是否存在
|
||||
String name = param.getString("name");
|
||||
if (StrUtil.isEmpty(name)) throw new BadRequestException("角色名字不能为空!");
|
||||
SysRole sysRole = JSONObject.parseObject(JSONObject.toJSONString(param), SysRole.class);
|
||||
|
||||
//判断角色名字是否存在
|
||||
SysRole role = roleMapper.selectOne(new LambdaQueryWrapper<SysRole>().eq(SysRole::getName, sysRole.getName()));
|
||||
if (ObjectUtil.isNotEmpty(role)) throw new BadRequestException("角色【" + name + "】已存在!");
|
||||
Long userId = SecurityUtils.getCurrentUserId();
|
||||
String nickName = SecurityUtils.getCurrentNickName();
|
||||
String now = DateUtil.now();
|
||||
// 插入
|
||||
sysRole.setRoleId(IdUtil.getSnowflake(1,1).nextId());
|
||||
sysRole.setCreateId(userId);
|
||||
sysRole.setCreateName(nickName);
|
||||
sysRole.setCreateTime(now);
|
||||
sysRole.setUpdateOptid(userId);
|
||||
sysRole.setUpdateOptname(nickName);
|
||||
sysRole.setUpdateTime(now);
|
||||
roleMapper.insert(sysRole);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -52,12 +52,12 @@ spring:
|
||||
wall:
|
||||
config:
|
||||
multi-statement-allow: true
|
||||
redis:
|
||||
#数据库索引
|
||||
database: ${REDIS_DB:2}
|
||||
host: ${REDIS_HOST:127.0.0.1}
|
||||
port: ${REDIS_PORT:6379}
|
||||
password: ${REDIS_PWD:}
|
||||
redis:
|
||||
#数据库索引
|
||||
database: ${REDIS_DB:2}
|
||||
host: ${REDIS_HOST:127.0.0.1}
|
||||
port: ${REDIS_PORT:6379}
|
||||
password: ${REDIS_PWD:}
|
||||
|
||||
# 登录相关配置
|
||||
login:
|
||||
|
||||
@@ -85,7 +85,7 @@ mybatis-plus:
|
||||
map-underscore-to-camel-case: true
|
||||
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
|
||||
mapper-locations:
|
||||
- classpath:org.nl.*.service.*.dao.mapper/*.xml
|
||||
- classpath:**/*.xml
|
||||
global-config:
|
||||
db-config:
|
||||
id-type: INPUT
|
||||
|
||||
@@ -0,0 +1,56 @@
|
||||
package org.nl.sso;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.nl.AppRun;
|
||||
import org.nl.modules.tools.IdUtil;
|
||||
import org.nl.modules.tools.MapOf;
|
||||
import org.nl.system.service.param.ISysParamService;
|
||||
import org.nl.system.service.param.dao.Param;
|
||||
import org.nl.system.service.param.dao.mapper.SysParamMapper;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
/**
|
||||
* @Author: lyd
|
||||
* @Description:
|
||||
* @Date: 2022/12/14
|
||||
*/
|
||||
@SpringBootTest(classes = AppRun.class)
|
||||
public class ParamTest {
|
||||
|
||||
@Autowired
|
||||
ISysParamService paramService;
|
||||
@Autowired
|
||||
SysParamMapper paramMapper;
|
||||
|
||||
@Test
|
||||
public void createTest(){
|
||||
Param param = new Param();
|
||||
param.setId(IdUtil.getStringId());
|
||||
param.setCode("ccc");
|
||||
param.setName("测试code");
|
||||
param.setValue("1");
|
||||
param.setCreateId(1L);
|
||||
param.setCreateName("admin");
|
||||
param.setCreateTime(DateUtil.now());
|
||||
paramService.create(param);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void updateTest(){
|
||||
Param o = (Param) paramMapper.selectByMap(MapOf.of("code", "ccc")).get(0);
|
||||
o.setName("测试2");
|
||||
paramService.update(o);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void deleteTest(){
|
||||
Param o = (Param) paramMapper.selectByMap(MapOf.of("code", "codess")).get(0);
|
||||
String[] ids = new String[2];
|
||||
ids[0] = o.getId();
|
||||
paramService.removeByIds(Arrays.asList(ids));
|
||||
}
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
package org.nl.system.controller.menu;
|
||||
|
||||
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 菜单表 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author generator
|
||||
* @since 2022-12-15
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/sysMenu")
|
||||
public class SysMenuController {
|
||||
|
||||
}
|
||||
|
||||
@@ -1,21 +0,0 @@
|
||||
package org.nl.system.controller.role;
|
||||
|
||||
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 角色表 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author generator
|
||||
* @since 2022-12-15
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/sysRole")
|
||||
public class SysRoleController {
|
||||
|
||||
}
|
||||
|
||||
@@ -1,16 +0,0 @@
|
||||
package org.nl.system.service.menu;
|
||||
|
||||
import org.nl.system.service.menu.dao.SysMenu;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 菜单表 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author generator
|
||||
* @since 2022-12-15
|
||||
*/
|
||||
public interface ISysMenuService extends IService<SysMenu> {
|
||||
|
||||
}
|
||||
@@ -1,138 +0,0 @@
|
||||
package org.nl.system.service.menu.dao;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import java.io.Serializable;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 菜单表
|
||||
* </p>
|
||||
*
|
||||
* @author generator
|
||||
* @since 2022-12-15
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@TableName("sys_menu")
|
||||
public class SysMenu implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 菜单标识
|
||||
*/
|
||||
@TableId(value = "menu_id", type = IdType.AUTO)
|
||||
private Long menuId;
|
||||
|
||||
/**
|
||||
* 上级菜单ID
|
||||
*/
|
||||
private Long pid;
|
||||
|
||||
/**
|
||||
* 子菜单数目
|
||||
*/
|
||||
private BigDecimal subCount;
|
||||
|
||||
/**
|
||||
* 菜单类型
|
||||
*/
|
||||
private String type;
|
||||
|
||||
/**
|
||||
* 所属系统
|
||||
*/
|
||||
private String systemType;
|
||||
|
||||
/**
|
||||
* 菜单分类
|
||||
*/
|
||||
private String category;
|
||||
|
||||
/**
|
||||
* 菜单标题
|
||||
*/
|
||||
private String title;
|
||||
|
||||
/**
|
||||
* 组件名称
|
||||
*/
|
||||
private String componentName;
|
||||
|
||||
/**
|
||||
* 组件
|
||||
*/
|
||||
private String component;
|
||||
|
||||
/**
|
||||
* 排序
|
||||
*/
|
||||
private BigDecimal menuSort;
|
||||
|
||||
/**
|
||||
* 图标
|
||||
*/
|
||||
private String icon;
|
||||
|
||||
/**
|
||||
* 链接地址
|
||||
*/
|
||||
private String path;
|
||||
|
||||
/**
|
||||
* 是否外链
|
||||
*/
|
||||
private String iFrame;
|
||||
|
||||
/**
|
||||
* 是否缓存
|
||||
*/
|
||||
private String cache;
|
||||
|
||||
/**
|
||||
* 是否隐藏
|
||||
*/
|
||||
private String hidden;
|
||||
|
||||
/**
|
||||
* 权限
|
||||
*/
|
||||
private String permission;
|
||||
|
||||
/**
|
||||
* 创建人标识
|
||||
*/
|
||||
private Long createId;
|
||||
|
||||
/**
|
||||
* 创建人
|
||||
*/
|
||||
private String createName;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private String createTime;
|
||||
|
||||
/**
|
||||
* 修改人标识
|
||||
*/
|
||||
private Long updateOptid;
|
||||
|
||||
/**
|
||||
* 修改人
|
||||
*/
|
||||
private String updateOptname;
|
||||
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
private String updateTime;
|
||||
|
||||
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
package org.nl.system.service.menu.dao.mapper;
|
||||
|
||||
import org.nl.system.service.menu.dao.SysMenu;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 菜单表 Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author generator
|
||||
* @since 2022-12-15
|
||||
*/
|
||||
public interface SysMenuMapper extends BaseMapper<SysMenu> {
|
||||
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
package org.nl.system.service.menu.impl;
|
||||
|
||||
import org.nl.system.service.menu.dao.SysMenu;
|
||||
import org.nl.system.service.menu.dao.mapper.SysMenuMapper;
|
||||
import org.nl.system.service.menu.ISysMenuService;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 菜单表 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author generator
|
||||
* @since 2022-12-15
|
||||
*/
|
||||
@Service
|
||||
public class SysMenuServiceImpl extends ServiceImpl<SysMenuMapper, SysMenu> implements ISysMenuService {
|
||||
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
package org.nl.system.service.role;
|
||||
|
||||
import org.nl.system.service.role.dao.SysRole;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 角色表 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author generator
|
||||
* @since 2022-12-15
|
||||
*/
|
||||
public interface ISysRoleService extends IService<SysRole> {
|
||||
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
package org.nl.system.service.role.dao.mapper;
|
||||
|
||||
import org.nl.system.service.role.dao.SysRole;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 角色表 Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author generator
|
||||
* @since 2022-12-15
|
||||
*/
|
||||
public interface SysRoleMapper extends BaseMapper<SysRole> {
|
||||
|
||||
}
|
||||
@@ -1,8 +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="org.nl.system.service.role.dao.mapper.SysRoleMapper">
|
||||
|
||||
<select id="list" resultType="org.nl.system.service.role.dao.SysRole">
|
||||
SELECT * FROM sys_role as role
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -1,20 +0,0 @@
|
||||
package org.nl.system.service.role.impl;
|
||||
|
||||
import org.nl.system.service.role.dao.SysRole;
|
||||
import org.nl.system.service.role.dao.mapper.SysRoleMapper;
|
||||
import org.nl.system.service.role.ISysRoleService;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 角色表 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author generator
|
||||
* @since 2022-12-15
|
||||
*/
|
||||
@Service
|
||||
public class SysRoleServiceImpl extends ServiceImpl<SysRoleMapper, SysRole> implements ISysRoleService {
|
||||
|
||||
}
|
||||
@@ -3,14 +3,14 @@ import request from '@/utils/request'
|
||||
// 获取所有的Role
|
||||
export function getAll() {
|
||||
return request({
|
||||
url: 'api/roles/all',
|
||||
url: 'api/sysRole/all',
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
export function add(data) {
|
||||
return request({
|
||||
url: 'api/roles',
|
||||
url: 'api/sysRole',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
@@ -18,21 +18,21 @@ export function add(data) {
|
||||
|
||||
export function get(id) {
|
||||
return request({
|
||||
url: 'api/roles/' + id,
|
||||
url: 'api/sysRole/' + id,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
export function getLevel() {
|
||||
return request({
|
||||
url: 'api/roles/level',
|
||||
url: 'api/sysRole/level',
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
export function del(ids) {
|
||||
return request({
|
||||
url: 'api/roles',
|
||||
url: 'api/sysRole',
|
||||
method: 'delete',
|
||||
data: ids
|
||||
})
|
||||
@@ -40,7 +40,7 @@ export function del(ids) {
|
||||
|
||||
export function edit(data) {
|
||||
return request({
|
||||
url: 'api/roles',
|
||||
url: 'api/sysRole',
|
||||
method: 'put',
|
||||
data
|
||||
})
|
||||
@@ -48,7 +48,7 @@ export function edit(data) {
|
||||
|
||||
export function editMenu(data) {
|
||||
return request({
|
||||
url: 'api/roles/menu',
|
||||
url: 'api/sysRole/menu',
|
||||
method: 'put',
|
||||
data
|
||||
})
|
||||
|
||||
@@ -140,13 +140,14 @@ function CRUD(options) {
|
||||
crud.loading = true
|
||||
// 请求数据
|
||||
initData(crud.url, crud.getQueryParams()).then(data => {
|
||||
console.log(data)
|
||||
const table = crud.getTable()
|
||||
if (table && table.lazy) { // 懒加载子节点数据,清掉已加载的数据
|
||||
table.store.states.treeData = {}
|
||||
table.store.states.lazyTreeNodeMap = {}
|
||||
}
|
||||
crud.page.total = data.totalElements
|
||||
crud.data = data.content
|
||||
crud.page.total = data.total
|
||||
crud.data = data.records
|
||||
crud.resetDataStatus()
|
||||
// time 毫秒后显示表格
|
||||
setTimeout(() => {
|
||||
|
||||
@@ -75,11 +75,11 @@ const defaultForm = {
|
||||
name: null,
|
||||
value: null,
|
||||
remark: null,
|
||||
is_active: 1,
|
||||
create_name: null,
|
||||
create_time: null,
|
||||
update_optname: null,
|
||||
update_time: null
|
||||
isActive: 1,
|
||||
createName: null,
|
||||
createTime: null,
|
||||
updateOptname: null,
|
||||
updateTime: null
|
||||
}
|
||||
export default {
|
||||
name: 'Param',
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
<el-input v-model="form.name" style="width: 380px;"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="备注" prop="description">
|
||||
<el-input v-model="form.description" style="width: 380px;" rows="2" type="textarea"/>
|
||||
<el-input v-model="form.remark" style="width: 380px;" rows="2" type="textarea"/>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
@@ -57,7 +57,7 @@
|
||||
>
|
||||
<el-table-column type="selection" width="55"/>
|
||||
<el-table-column prop="name" label="名称" min-width="100" show-overflow-tooltip/>
|
||||
<el-table-column show-overflow-tooltip prop="description" label="描述"/>
|
||||
<el-table-column show-overflow-tooltip prop="remark" label="描述"/>
|
||||
<el-table-column show-overflow-tooltip width="135px" prop="createTime" label="创建日期">
|
||||
<template slot-scope="scope">
|
||||
<span>{{ parseTime(scope.row.createTime) }}</span>
|
||||
@@ -131,12 +131,12 @@ import crudOperation from '@crud/CRUD.operation'
|
||||
import udOperation from '@crud/UD.operation'
|
||||
import pagination from '@crud/Pagination'
|
||||
|
||||
const defaultForm = { role_id: null, name: null, description: null }
|
||||
const defaultForm = { roleId: null, name: null, remark: null }
|
||||
export default {
|
||||
name: 'Role',
|
||||
components: { pagination, crudOperation, rrOperation, udOperation, crudMenu },
|
||||
cruds() {
|
||||
return CRUD({ idField: 'role_id', title: '角色', url: 'api/roles', crudMethod: { ...crudRoles } })
|
||||
return CRUD({ idField: 'roleId', title: '角色', url: 'api/sysRole', crudMethod: { ...crudRoles } })
|
||||
},
|
||||
mixins: [presenter(), header(), form(defaultForm), crud()],
|
||||
data() {
|
||||
|
||||
Reference in New Issue
Block a user