<!--查询表结构信息-->
<select id="selectDimTabCols" parameterType="java.lang.String" resultType="com.table.column.pojo.DimTabCols">
select
<!--column_name结构名,colName属性名:字段名-->
column_name as colName,
<!--字段描述描述-->
column_comment as colDesc,
<!--字段类型-->
data_type as typeName,
<!--字段长度-->
character_maximum_length as colLength,
<!--精度-->
numeric_precision as colPrecision,
<!--可否为空-->
is_nullable as colNullable,
<!--索引类型-->
column_key as keyFlag,
<!--列顺序-->
ordinal_position as colSeq
from information_schema.columns
where table_name = #{tabName}
<!--批量更新表字段登记信息-->
</select>
<update id="updateTabCols">
update dim_tab_cols set col_name =
<foreach collection='tabColsList' item='item' index='index' separator=' ' open='case col_Id' close='end'>
when #{item.colId} then #{item.colName}
</foreach>
where col_id in
<foreach collection='colIds' item='item' index='index' separator=',' open='(' close=')'>
#{item}
</foreach>
</update>
//索引类型设置,未验证
for (int i = 0; i < tabColsList.size(); i++) {
if("NO".equals(tabColsList.get(i).getColNullable())){
createdColList.get(i).setIsNullable("0");
}else {
createdColList.get(i).setIsNullable("1");
if(null == tabColsList.get(i).getKeyFlag()){
createdColList.get(i).setColumnKey("0");
//createdColList.get(i).setColIndexFlag("n");
}else if("PRI".equals(tabColsList.get(i).getKeyFlag())){
createdColList.get(i).setColumnKey("1");
}else {
createdColList.get(i).setColumnKey("0");
//createdColList.get(i).setColIndexFlag("y");
}
}*/
}
点击查看更多内容
为 TA 点赞
评论
共同学习,写下你的评论
评论加载中...
作者其他优质文章
正在加载中
感谢您的支持,我会继续努力的~
扫码打赏,你说多少就多少
赞赏金额会直接到老师账户
支付方式
打开微信扫一扫,即可进行扫码打赏哦