https://mybatis.plus/guide/generator.html
DAO层 使用 MyBatis-Plus
/**
* 通过父菜单ID查询子菜单
* @param parentId
* @return
*/
public List
/**
* 根据用户查询用户权限
*/
public List
/**
* 修改菜单状态字段: 是否子节点
*/
@Update("update sys_permission set is_leaf=#{leaf} where id = #{id}")
public int setMenuLeaf(@Param("id") String id,@Param("leaf") int leaf);
Service层
public interface ISysPermissionService extends IService
public List
@Override
public List
return sysPermissionMapper.queryListByParentId(parentId);
}
Controller 层
/**
* 异步加载数据节点
*
* @return
*/
@RequestMapping(value = "/queryListAsync", method = RequestMethod.GET)
public Result> queryAsync(@RequestParam(name = "pid", required = false) String parentId) {
Result> result = new Result<>();
try {
List
if (list == null || list.size() <= 0) {
result.error500("未找到角色信息");
} else {
result.setResult(list);
result.setSuccess(true);
}
} catch (Exception e) {
log.error(e.getMessage(), e);
}
return result;
}
DAO层
/**
* 通过文件名字获取HashID
* @param fileName
* @return
*/
public String getHashIdByName(@Param("fileName") String fileName);
Service
@Autowired
private MwChainFileMapper mwChainFileMapper;
// // 获取区块链Md5 值
String hashId= mwChainFileMapper.getHashIdByName(fileName);
@GetMapping(value = "/list")
public Result queryPageList(MwChainFile mwChainFile,
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
HttpServletRequest req) {
QueryWrapper
LoginUser sysUser = sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
String userName = sysUser.getUsername();
queryWrapper.eq("upload_id", userName);
Page
IPage
return Result.ok(pageList);
}
获取登录用户信息
LoginUser sysUser = sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();