Vue项目报错No 'Access-Control-Allow-Origin'

Access to XMLHttpRequest at 'http://192.168.188.63:5005/api/getMenuListByRoleId' from origin 'http://192.168.188.63:3002' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.

拷贝老的Vue项目框架,搭建新的项目报错。没有去登录页面直接访问服务端API,获取权限。

去清除登录缓存即可!!!



EF Core 查询结果是-1还存储过程执行结果不一样为什么?

原来的代码

      public bool IsHasGroupRight(int id,int curid)
        {
            MySqlParameter[] paras = new MySqlParameter[] {
        ……

                    
                

mysql创建函数报错:This function has none of DETERMINISTIC, NO SQL, or READS SQL DATA

ERROR 1418: This function has none of DETERMINISTIC, NO SQL, or READS SQL DATA in its declaration and binary logging is enabled (you *might* want to use the less safe log_bin_trust_function_creators&n……

                    
                

如何创建mysql中一模一样的数据库且数据也一样?

如何创建mysql中一模一样的数据库且数据也一样?
第一步:把源数据库中的数据和模版导出sql文件

QQ20240913-094303.png
第二步:找到.sql文件并把内容复制,粘贴在mysql里面
2.png
3.png……

使用Vue Admin Work中的封装的axios导出Excel文件乱码

使用Vue Admin Work中的封装的axios导出Excel文件乱码
微信截图_20240402150744.png
解决方法:页面文件示例
post({
        url: ExportGroup,
        data: () => {
 &n……

                    
                

mysql建立函数是报错Error 1418: This function has none of DETERMINISTIC, NO SQL, or READS SQL DATA

在mysql建立函数时报错:
Error 1418: This function has none of DETERMINISTIC, NO SQL, or READS SQL DATA in its declaration and binary logging is enabled
解决办法:

SET @@global.log_bin_trust_function_creators='ON';
SHOW VARIABLES LIKE 'log_bin_trust_function_creators';



在mysql中执行,然后重新建立函数




MySQL通过自定义函数实现根据父级PID递归查询所有子级ID集合

CREATE FUNCTION `getGroupCID`(pid varchar(5000)) RETURNS VARCHAR(5000)
DETERMINISTIC
BEGIN
  DECLARE children VARCHAR(5000);
  SELECT group_concat(id) INTO children FROM group_info WHERE FIND_IN_SET(group_info.pid, pid);
  IF children ……

                    
                

MySQL通过自定义函数实现根据子类ID递归查询父级PID集合

DELIMITER $$
 
CREATE FUNCTION `getParent`(n INT) RETURNS VARCHAR(255)
BEGIN
  DECLARE parent VARCHAR(2555);
  SELECT parent_id INTO parent FROM your_table WHERE id = n;
  IF parent IS NOT NULL THEN
 ……

                    
                

EF Core DBFirst 如何使用

QQ截图20240313152102.png
1、MySQL数据库的使用
Scaffold-DbContext “Name=ConnectionStrings:DB”Pomelo.EntityFrameworkCore.MySql -ContextDir DAL -OutputDir Entities -Force
Scaffold-DbContext  "Server=192.168.……

                    
                

EFCore基础方法(增,删,查,改,分页),基础泛型类

public class EfDbGet<TEntity> : FilterFunction<TEntity> where TEntity : class
{
public PmsContext _context;
public EfDbGet(PmsContext context)
{
_context = context;
}
//获取所有数据
public virtual List<TEntity> GetListAll()
{
IQueryable<TEntity>&n……

                    
                


© 2016-2024 阿尔佛 aerfo.com | 豫ICP备17044542号 | 豫公网安备 41010602000172