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>
数据库中的表
分页