postgreSQL alter column data type to timestamp without time zone

现在公司数据访问层用的是mybatis框架,数据库用的pgsql,其中日期字段指定的是timestamp类型的。实体类是String类型的。

现在在执行更新操作的时候报这个错误:postgreSQL alter column data type to timestamp without time zone

以后要一定要多注意,报错的提示信息,其实上面就有交给你怎样进行修改,修改后的sql语句:

复制代码
<update id="updateProductService"  parameterType="com.picc.hmims.productInfo.dto.ProductServiceBo">
        update t_product_service
        <set>
            <if test="productId != null" >
                product_id=cast(#{productId} as NUMERIC ),
            </if>
            <if test="parentServiceId != null" >
                parent_service_id=cast(#{parentServiceId} as NUMERIC ),
            </if>
            <if test="serviceId != null" >
                service_id=cast(#{serviceId} as NUMERIC ),
            </if>
            <if test="exeOrder != null" >
                exe_order=cast(#{exeOrder} as NUMERIC ),
            </if>
            <if test="serviceCode != null" >
                service_code=#{serviceCode},
            </if>
            <if test="serviceName != null" >
                service_name=#{serviceName},
            </if>
            <if test="chargingWay != null" >
                charging_way=#{chargingWay},
            </if>
            <if test="availableAmount != null" >
                available_amount=cast(#{availableAmount} as NUMERIC ),
            </if>
            <if test="amountUnit != null" >
                amount_unit=#{amountUnit},
            </if>
            <if test="priceOption != null" >
                price_option=#{priceOption},
            </if>
            <if test="price != null" >
                price=cast(#{price} as NUMERIC ),
            </if>
            <if test="cost != null" >
                cost=cast(#{cost} as NUMERIC ),
            </if>
            <if test="probabilityCost != null" >
                probability_cost=cast(#{probabilityCost} as NUMERIC ),
            </if>
            <if test="limitType != null" >
                limit_type=#{limitType},
            </if>
            <if test="isWaitingPeriod != null" >
                is_waiting_period=#{isWaitingPeriod},
            </if>
            <if test="waitingPeriod != null" >
                waiting_period=cast(#{waitingPeriod} as NUMERIC ),
            </if>
            <if test="serviceOption != null" >
                service_option=#{serviceOption},
            </if>
            <if test="serviceAppoint != null" >
                service_appoint=#{serviceAppoint},
            </if>
            <if test="serviceNum != null" >
                service_num=cast(#{serviceNum} as NUMERIC ),
            </if>
            <if test="serviceType != null" >
                service_type=#{serviceType},
            </if>
            <if test="serviceWay != null" >
                service_way=#{serviceWay},
            </if>
            <if test="insertOper != null" >
                insert_oper=#{insertOper},
            </if>
            <if test="insertTime != null" >


                insert_time=TO_TIMESTAMP(#{insertTime}, 'yyyy-MM-ddTHH24:mm:ss.SSSZ'),
            </if>
            <if test="updateTime != null" >

                update_time=TO_TIMESTAMP(#{updateTime}, 'yyyy-MM-ddTHH24:mm:ss.SSSZ'),
            </if>
            <if test="updateOper != null" >
                update_oper=#{updateOper},
            </if>
            <if test="balanceType != null" >
                balance_type=#{balanceType},
            </if>
            <if test="servicePriceOption != null" >
                service_price_option=#{servicePriceOption}
            </if>
        </set>
        where product_service_id = cast(#{productServiceId} as NUMERIC )
    </update>
复制代码

 

posted on   ~码铃薯~  阅读(2083)  评论(0编辑  收藏  举报

编辑推荐:
· 开发者必知的日志记录最佳实践
· SQL Server 2025 AI相关能力初探
· Linux系列:如何用 C#调用 C方法造成内存泄露
· AI与.NET技术实操系列(二):开始使用ML.NET
· 记一次.NET内存居高不下排查解决与启示
阅读排行:
· 开源Multi-agent AI智能体框架aevatar.ai,欢迎大家贡献代码
· Manus重磅发布:全球首款通用AI代理技术深度解析与实战指南
· 被坑几百块钱后,我竟然真的恢复了删除的微信聊天记录!
· 没有Manus邀请码?试试免邀请码的MGX或者开源的OpenManus吧
· 园子的第一款AI主题卫衣上架——"HELLO! HOW CAN I ASSIST YOU TODAY

导航

< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5
点击右上角即可分享
微信分享提示