mybatis clob 存储




实体中字段: private String  issueDetail  ;


mapper中xml写法:

 <sql id="ppiwfIssueCenterColumns">
    a.id                        as "id",
    a.city_name                 as "cityName",
    a.county_name               as "countyName",
    a.power_supply_station_name as "powerSupplyStationName",
    a.tg_name                   as "tgName",
    a.tg_code                   as "tgCode",
    a.issue_content             as "issueContent",
    a.issue_type                as "issueType",
    a.issue_state               as "issueState",
    a.issue_create_date         as "issueCreateDate",
    a.issue_process_date        as "issueProcessDate",
    a.issue_executor            as "issueExecutor",
    a.issue_target_type         as "issueTargetType",
    a.issue_target_name_yx      as "issueTargetNameYx",
    a.issue_target_code_yx      as "issueTargetCodeYx",
    a.issue_target_name_sc      as "issueTargetNameSc",
    a.issue_target_code_sc      as "issueTargetCodeSc",
    a.county_code               as "countyCode",
    a.city_code                 as "cityCode",
    a.power_supply_station_code as "powerSupplyStationCode",
    a.parent_id                 as "parentId",
    a.issue_boundary_type       as "issueBoundaryType",
    a.issue_content2            as "issueContent2",
    a.issue_detail              as "issueDetail",
    <!-- a.oa_ppiwf_ext_cooperation_id as "oaPpiwfExtCooperationId", -->
    b.id        as "oaPpiwfExtCooperation.id",
    a.del_flag         AS "delFlag",
    a.remarks       as "remarks",
    a.receiver_name           as "receiverName",
    a.tg_id       as "tgId",
    a.org_no       as "orgNo",
    a.source_Table_Name     as "sourceTableName"
 </sql>

 </update>
  <update id="updateIssueDetail">
  update OA_PPIWF_ISSUE_CENTER set
   issue_detail=#{issueDetail,jdbcType=CLOB}
  <where>
   id=#{id}
  </where>
 </update>

java clob读取:

ppiwfIssueCenter.setId("CE19F7EF177242BEBE333D9EB916BAB4");
  String sql="select * from OA_PPIWF_ISSUE_CENTER where rownum<300";
  List<Map<String, Object>> temp_LM=oaSystemService.getSelectList(sql);
  JSONObject jo=pcService.sqlField2Json(sql);
  ppiwfIssueCenter.setIssueDetail(jo.toString());
  pcService.updateIssueDetail(ppiwfIssueCenter);
  //*********测试度clob**********************
  sql="select o.issue_detail from OA_PPIWF_ISSUE_CENTER o where o.id='CE19F7EF177242BEBE333D9EB916BAB4'";
  temp_LM=oaSystemService.getSelectList(sql);
  ClobProxyImpl  clob= (ClobProxyImpl)temp_LM.get(0).get("ISSUE_DETAIL");
  String content;
  try{
   BufferedReader in;
   in = new BufferedReader(clob.getCharacterStream());
   StringWriter out = new StringWriter();
   int c;
      while ((c = in.read()) != -1)
      {
       out.write(c);
      }
      content= out.toString();
  }
  catch (SQLException | IOException e) {
   // TODO Auto-generated catch block
    e.printStackTrace();
  }



评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值