wenwj
2025-04-09 877c9a7d2ee34ebf1a1e4c19cd7c1f8560709b0d
aps-modules/aps-gen/src/main/resources/mapper/generator/GenTableColumnMapper.xml
@@ -33,16 +33,15 @@
        select column_id, table_id, column_name, column_comment, column_type, java_type, java_field, is_pk, is_increment, is_required, is_insert, is_edit, is_list, is_query, query_type, html_type, dict_type, sort, create_by, create_time, update_by, update_time from gen_table_column
    </sql>
    <select id="selectGenTableColumnListByTableId" parameterType="GenTableColumn" resultMap="GenTableColumnResult">
    <select id="selectGenTableColumnListByTableId" parameterType="Long" resultMap="GenTableColumnResult">
        <include refid="selectGenTableColumnVo"/>
        where table_id = #{tableId}
        where table_id::bigint = #{tableId}
        order by sort
    </select>
    <select id="selectDbTableColumnsByName" parameterType="String" resultMap="GenTableColumnResult">
      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
      from information_schema.columns where table_schema = (select database()) and table_name = (#{tableName})
      order by ordinal_position
        select column_name, is_required, is_pk, sort, column_comment, is_increment, column_type
        from list_column where table_name = (#{tableName})
   </select>
    <insert id="insertGenTableColumn" parameterType="GenTableColumn" useGeneratedKeys="true" keyProperty="columnId">
@@ -85,7 +84,7 @@
         <if test="dictType != null and dictType != ''">#{dictType},</if>
         <if test="sort != null">#{sort},</if>
         <if test="createBy != null and createBy != ''">#{createBy},</if>
         now()
        current_timestamp
         )
    </insert>
@@ -105,23 +104,22 @@
            <if test="dictType != null">dict_type = #{dictType},</if>
            <if test="sort != null">sort = #{sort},</if>
            <if test="updateBy != null">update_by = #{updateBy},</if>
            update_time = now()
            update_time = current_timestamp
        </set>
        where column_id = #{columnId}
    </update>
    <delete id="deleteGenTableColumnByIds" parameterType="Long">
        delete from gen_table_column where table_id in
        delete from gen_table_column where table_id::bigint in
        <foreach collection="array" item="tableId" open="(" separator="," close=")">
            #{tableId}
        </foreach>
    </delete>
    
    <delete id="deleteGenTableColumns">
        delete from gen_table_column where column_id in
        delete from gen_table_column where column_id::bigint in
        <foreach collection="list" item="item" open="(" separator="," close=")">
            #{item.columnId}
        </foreach>
    </delete>
</mapper>