83911930 2020-03-23
现在公司数据访问层用的是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>