数据库 页面显示
1 Yes
0 No
1)在ActionForm中增加一个属性
以Building为例;
原有的属性:private String pblVisible;对应数据库表Building的列PBL_VISIBLE
增加的属性:private String isPublic;
2)在数据库映射文件中加入
<resultMap id="result" class="building">
......
......
<result property="isPublic" column="IS_PUBLIC"/>
</resultMap>
<select id="getAllBuilding" resultMap="result1">
select B.*,decode(B.PBL_VISIBLE,'1','Yes','No') as IS_PUBLIC,......
</select>
<%----%>
The syntax for the decode function is:
decode( expression , search , result [, search , result]... [, default] )
expression is the value to compare.
search is the value that is compared against expression.
result is the value returned, if expression is equal to search.
default is optional. If no matches are found, the decode will return default.
If default is omitted, then the decode statement will return null (if no matches are found).
1 Yes
0 No
1)在ActionForm中增加一个属性
以Building为例;
原有的属性:private String pblVisible;对应数据库表Building的列PBL_VISIBLE
增加的属性:private String isPublic;
2)在数据库映射文件中加入
<resultMap id="result" class="building">
......
......
<result property="isPublic" column="IS_PUBLIC"/>
</resultMap>
<select id="getAllBuilding" resultMap="result1">
select B.*,decode(B.PBL_VISIBLE,'1','Yes','No') as IS_PUBLIC,......
</select>
<%----%>
The syntax for the decode function is:
decode( expression , search , result [, search , result]... [, default] )
expression is the value to compare.
search is the value that is compared against expression.
result is the value returned, if expression is equal to search.
default is optional. If no matches are found, the decode will return default.
If default is omitted, then the decode statement will return null (if no matches are found).