mybatisplus中使用enum的显示问题

编程

从数据库中取出的必须是原值,否则无法正常显示名称

如:

```

<select id="getFreezerTypes" resultMap="freezerTypeVoMap">

select ifnull(freezer_type, "其它") as `type`, count(*) as `count` from prod_freezer

<where>

<if test="companyId != "" and companyId != null">

and company_id = #{companyId}

</if>

</where>

group by `type`

</select>

```

改为

```

<select id="getFreezerTypes" resultMap="freezerTypeVoMap">

select `type`, count(*) as `count` from prod_freezer

<where>

<if test="companyId != "" and companyId != null">

and company_id = #{companyId}

</if>

</where>

group by `type`

</select>

```

即可,type在表里不要为null,可以赋个默认值。

以上是 mybatisplus中使用enum的显示问题 的全部内容, 来源链接: utcz.com/z/512031.html

回到顶部