json数据条件查询,json数据sql查询中文乱码

json 解析  分页  条件查询

从数据库中查询出来的json数据乱码可以使用

json_extract(json字段,'$') json字段  

这个是json数据的条件查询

<sql id="Base_Column_List">
    id, company_id, tenant_id, created_by, creator_id, created_at, updated_by, modifier_id, 
    updated_at, dr,json_extract(prod_info_json,'$') prod_info_json
  </sql>

 <select id="findList" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List"/>
        from pc_company_product_info_json
        where dr = 0 and company_id = #{param.companyId}
        <if test="param.registNo != null and param.registNo!=''">
            prod_info_json -> '$.registInfo.registNo' like concat('%',#{param.registNo},'%')
        </if>
        <if test="param.productName != null and param.productName!=''">
            and prod_info_json -> '$.chName' like concat('%',#{param.productName},'%')
        </if>
        <if test="param.bigType != null">
            and prod_info_json -> '$.bigType' like concat('%',#{param.bigType},'%')
        </if>
        <if test="param.customCode != null and param.customCode!=''">
            and prod_info_json -> '$.code' like concat('%',#{param.customCode},'%')
        </if>
        <if test="param.platCode != null and param.platCode!=''">
            and prod_info_json -> '$.platCode' like concat('%',#{param.platCode},'%')
        </if>
        <if test="param.companyName != null and param.companyName!=''">
            and prod_info_json -> '$.manufacturerName' like concat('%',#{param.companyName},'%')
        </if>
        <if test="param.hasRelatedBarcode != null and param.hasRelatedBarcode == 0">
            and prod_info_json -> '$.pcItemBarcodes' is null
        </if>
        <if test="param.hasRelatedBarcode != null and param.hasRelatedBarcode == 1">
            and prod_info_json -> '$.pcItemBarcodes' is not null
        </if>
        <if test="param.specification != null and param.specification != ''">
            and prod_info_json -> '$.spec' like concat('%',#{param.specification},'%')
        </if>
        <if test="param.manageType != null ">
            and prod_info_json -> '$.manageType' like concat('%',#{param.manageType},'%')
        </if>
        <if test="param.upEnterPriseId != null and param.upEnterPriseId != '' ">
            and prod_info_json -> '$.upEnterPriseId' like concat('%',#{param.upEnterPriseId},'%')
        </if>
        order by created_at desc
    </select>

 数据库中的表

 

分页

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值