select column_name, (case when (is_nullable = 'no' <![CDATA[ && ]]> column_key != 'PRI') then '1' else null end) as is_required, (case when column_key = 'PRI' then '1' else '0' end) as is_pk, ordinal_position as sort, column_comment, (case when extra = 'auto_increment' then '1' else '0' end) as is_increment, column_type
SELECT
from information_schema.columns where table_schema = (select database()) and table_name = (#{tableName})
cast(A.NAME as nvarchar) as column_name,
order by ordinal_position
cast(B.NAME as nvarchar) + (case when B.NAME ='numeric' then '('+cast(A.prec as nvarchar)+','+cast(A.scale as nvarchar)+')' else '' end) as column_type,
cast(G.[VALUE] as nvarchar) as column_comment,
(SELECT 1 FROM INFORMATION_SCHEMA.KEY_COLUMN_USAGE Z WHERE TABLE_NAME=D.NAME and A.NAME = Z.column_name ) as is_pk,
colorder as sort
FROM SYSCOLUMNS A
LEFT JOIN SYSTYPES B ON A.XTYPE=B.XUSERTYPE
INNER JOIN SYSOBJECTS D ON A.ID=D.ID AND D.XTYPE='U' AND D.NAME!='DTPROPERTIES'
LEFT JOIN SYS.EXTENDED_PROPERTIES G ON A.ID=G.MAJOR_ID AND A.COLID=G.MINOR_ID
LEFT JOIN SYS.EXTENDED_PROPERTIES F ON D.ID=F.MAJOR_ID AND F.MINOR_ID =0
select table_name, table_comment, create_time, update_time from information_schema.tables
select table_name, table_comment, create_time, update_time from information_schema.tables
where table_comment <![CDATA[ <> ]]> '' and table_schema = (select database())
where table_comment <![CDATA[ <> ]]> '' and table_schema = (Select Name From Master..SysDataBases Where DbId=(Select Dbid From Master..SysProcesses Where Spid = @@spid))
and table_name = #{tableName}
and table_name = #{tableName}
</select>
</select>
@ -151,7 +154,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<iftest="genPath != null and genPath != ''">#{genPath},</if>
<iftest="genPath != null and genPath != ''">#{genPath},</if>
<iftest="remark != null and remark != ''">#{remark},</if>
<iftest="remark != null and remark != ''">#{remark},</if>
<iftest="createBy != null and createBy != ''">#{createBy},</if>
<iftest="createBy != null and createBy != ''">#{createBy},</if>
sysdate()
GETDATE()
)
)
</insert>
</insert>
@ -174,7 +177,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<iftest="options != null and options != ''">options = #{options},</if>
<iftest="options != null and options != ''">options = #{options},</if>
<iftest="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
<iftest="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
@ -52,7 +52,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
#elseif($queryType == "LTE")
#elseif($queryType == "LTE")
<if test="$javaField != null #if($javaType == 'String' ) and $javaField.trim() != ''#end"> and $columnName <= #{$javaField}</if>
<if test="$javaField != null #if($javaType == 'String' ) and $javaField.trim() != ''#end"> and $columnName <= #{$javaField}</if>
#elseif($queryType == "LIKE")
#elseif($queryType == "LIKE")
<if test="$javaField != null #if($javaType == 'String' ) and $javaField.trim() != ''#end"> and $columnName like concat('%', #{$javaField}, '%')</if>
<if test="$javaField != null #if($javaType == 'String' ) and $javaField.trim() != ''#end"> and $columnName like ('%' + #{$javaField} + '%')</if>
#elseif($queryType == "BETWEEN")
#elseif($queryType == "BETWEEN")
<if test="params.begin$AttrName != null and params.begin$AttrName != '' and params.end$AttrName != null and params.end$AttrName != ''"> and $columnName between #{params.begin$AttrName} and #{params.end$AttrName}</if>
<if test="params.begin$AttrName != null and params.begin$AttrName != '' and params.end$AttrName != null and params.end$AttrName != ''"> and $columnName between #{params.begin$AttrName} and #{params.end$AttrName}</if>