关于 mysql json类型参数的查询过滤

直接贴代码了
重点是这行queryWrapper.eq("jump_params->'$.duid'", duid)

public Page<EpAtreusNotifyCenter> getNotifyListPage(Long merchantId, String duid, Integer notifyType, Integer pageNo, Integer pageSize) {
        System.out.println("duid is " + duid);
        QueryWrapper<EpAtreusNotifyCenter> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("jump_params->'$.duid'", duid)
                .orderByDesc("create_time");
        Page<EpAtreusNotifyCenter> page = new Page<>(pageNo, pageSize);
        return baseMapper.selectPage(page, wrapper);
    }

实体

public class EpAtreusNotifyCenter implements Serializable {


    private static final long serialVersionUID = -349680686133419135L;
    /**
     * id
     */
    @TableId(value = "id", type = IdType.AUTO)
    private Long id;

    /**
     * 1 告警通知, 2 定时充电通知
     */
    @TableField("notify_type")
    private Integer notifyType;

    /**
     * 消息标题
     */
    @TableField("notify_title")
    private String notifyTitle;

    /**
     * 消息内容
     */
    @TableField("notify_content")
    private String notifyContent;

    /**
     * 1 已读, 2 未读
     */
    @TableField("notify_state")
    private Integer notifyState;

    /**
     * 商户id
     */
    @TableField("merchant_id")
    private Long merchantId;

    /**
     * 聚合id
     */
    @TableField(value = "jump_params", typeHandler = FastjsonTypeHandler.class)
    private Map<String, Object> jumpParams;

    /**
     * 创建时间
     */
    @TableField("create_time")
    private LocalDateTime createTime;

    /**
     * 更新时间
     */
    @TableField("update_time")
    private LocalDateTime updateTime;

    /**
     * 创建人
     */
    private String creator;

    /**
     * 更新人
     */
    private String updater;


}

表结构

-- auto-generated definition
create table ep_atreus_notify_center
(
    merchant_id    bigint       default 0                 not null comment '商户id',
    notify_state   int          default 0                 not null comment '1 已读, 2 未读',
    notify_content varchar(255) default ''                not null comment '消息内容',
    notify_title   varchar(100) default ''                not null comment '消息标题',
    notify_type    int          default 0                 not null comment '1 告警通知, 2 定时充电通知',
    id             bigint auto_increment comment 'id'
        primary key,
    jump_params    json                                   null comment '参数',
    create_time    timestamp    default CURRENT_TIMESTAMP not null comment '创建时间',
    update_time    timestamp    default CURRENT_TIMESTAMP not null comment '更新时间',
    creator        varchar(20)  default ''                not null comment '创建人',
    updater        varchar(20)  default ''                not null comment '更新人'
)
    comment '通知中心';

https://dev.mysql.com/doc/refman/5.7/en/json.html 文档里有

原文地址:https://www.cnblogs.com/woooodlin/p/mybatis_plus_json.html