0
点赞
收藏
分享

微信扫一扫

Ps下载安装(专业图像处理软件Ps安装包下载2024【Windows版】)

蓝哆啦呀 2024-05-16 阅读 11
数据库vue

mysql数据库中文模糊查询时出现异常

 @Select("select f.* from fundDetails f" +
            " where (case when #{keyword} is not null then f.operateTime like concat('%',#{keyword},'%') else 1=1 end)" +
            " or (case when #{keyword} is not null then f.fundName like concat('%',#{keyword},'%') else 1=1 end)" +
            " or (case when #{keyword} is not null then f.operateType like concat('%',#{keyword},'%') else 1=1 end)" +
            " or (case when #{keyword} is not null then f.operateMoney like concat('%',#{keyword},'%') else 1=1 end)" +
            " order by f.id desc")
    List<OperateEntity> getFundListByKeyword(String keyword);

因为字符集排序方式不一样

解决

在 like 后面加上 binary

    @Select("select f.* from fundDetails f" +
            " where (case when #{keyword} is not null then f.operateTime like binary concat('%',#{keyword},'%') else 1=1 end)" +
            " or (case when #{keyword} is not null then f.fundName like binary concat('%',#{keyword},'%') else 1=1 end)" +
            " or (case when #{keyword} is not null then f.operateType like binary concat('%',#{keyword},'%') else 1=1 end)" +
            " or (case when #{keyword} is not null then f.operateMoney like binary concat('%',#{keyword},'%') else 1=1 end)" +
            " order by f.id desc")
    List<OperateEntity> getFundListByKeyword(String keyword);

点击编辑按钮,修改数字后,会影响表格中的数据

在Vue中,当你直接修改表格数据显示的数据源(通常是tableData)时,这些更改会立即反映到界面上,因为Vue使用的是响应式数据绑定。为了解决这个问题,你需要创建一个副本数据用于编辑,这样就不会直接影响到表格数据。以下是一种解决方案:

解决

解释了updateForm.value = row和updateForm.value = { ...row }两种赋值的区别。

const handleEdit = (row: updateFormInterface) => {
    // 打开对话框
    updateInfoVisible.value = true;
    /**
     * updateForm.value = row 这意味着updateForm.value 和 row 指向的是内存中的同一个对象
     * updateForm.value = { ...row } 实际上是创建了一个row对象的浅拷贝
     * updateForm.value 引用了与row相同的属性,但不是同一个对象。
     */
    updateForm.value = { ...row };
}

参考资料:

探索数据库,中文字段排序,到底是什么_数据库 字典排序 中文规则-CSDN博客

关于GB 2312 编码细则的研究_gb.2312为什么不按照笔画来编码-CSDN博客

MySQL Illegal mix of collations for operation 'like'_idea中执行查询操作出现illegal mix of collations for operati-CSDN博客

举报

相关推荐

0 条评论