user-his-stock-mapper.xml
582 Bytes
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<!-- 用户历史最高持仓 @author tongxiaochuan -->
<mapper namespace="com.cjs.cms.dao.user.UserHisStockDao">
<insert id="insert" parameterType="map">
insert into user_his_stock(user_id, otc_code, high_amount, update_at)
select #{userId}, #{otcCode}, #{highAmount}, CURRENT_TIMESTAMP from dual
where not exists
(select * from user_his_stock where user_id = #{userId} and otc_code = #{otcCode})
</insert>
</mapper>