对于poi导出时候的1转化为汉字,可以写判断,当然在sql里面写更好,如下:
/
/在查询的时候如果值为o导出来就变成不允许,值为1 就变成允许,否则其他都是为选择,如果我们还接着往后拼接2,3,4,只需要加 when 0 then '不允许' 这个即可;
"select
case is_redeem
when 0
then '不允许'
when 1
then '允许'
ELSE '未选择' END is_redeem2," +
"t.* FROM
bee_product t where 1=1"); //bee_product 为表名
//is_redeem 为字段名,当然我们要保证后面的字段名要同前面的字段名不一致,当我们在下面引用的时候要引用后面的字段名;
具体代码;
sql.append("select case is_virtual when 0 then '实际产品' when 1 then '虚拟产品'ELSE '未选择' END is_virtual2," +
"case is_soldout when 0 then '在售' when 1 then '已售' ELSE '未选择' END is_soldout2," +
"case is_show when 0 then '显示'when 1 then '不显示' when 2 then '待显示' ELSE '未选择' END is_show2," +
"case del_flag when 0 then '是' when 1 then '否' ELSE '未选择' END del_flag2," +
"case is_continue when 0 then '不支持续投' when 1 then '支持续投' ELSE '未选择' END is_continue2," +
"case is_continue_product when 0 then '不支持' when 1 then '支持' ELSE '未选择' END is_continue_product2," +
"case continue_status when 00 then '不支持续投' when 01 then '不续投' when 02 then '本金续投' when 03 then '本息续投' ELSE '未选择' END continue_status2," +
"case product_type when 0 then '优选'when 1 then '阶梯' when 2 then '红包' ELSE '未选择' END product_type2," +
"case is_redeem when 0 then '不允许' when 1 then '允许' ELSE '未选择' END is_redeem2," +
"t.* FROM bee_product t where 1=1");
//ider:外部传入一个表头、SQL语句、
String s[] = new String[] { "id", "company_id", "product_name",
"term", "term_status", "base_profit", "extra_profit1","extra_profit2","coupon_pools","is_soldout2","total_amount",
"current_amount","bought","min_investment","max_investment",
"is_virtual2","is_show2","del_flag2","start_date","end_date",
"is_continue2","is_continue_product2","continue_status2",
"wlc_product_id","product_code","product_tip","product_desc","xieyi_hylink",
"agreement_id","remark","product_type2","product_place","buy_hylink","group_relation",
"is_redeem2","borrow_page"};