2022-04-06 17:25:43 +08:00
<?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">
<mapper namespace= "com.xhpc.activity.mapper.XhpcActivityFormulaMapper" >
<resultMap id= "BaseResultMap" type= "com.xhpc.activity.domain.XhpcActivityFormulaDomain" >
<id column= "activity_formula_id" jdbcType= "BIGINT" property= "activityFormulaId" />
<result column= "activity_id" jdbcType= "INTEGER" property= "activityId" />
<result column= "start_time" property= "startTime" />
<result column= "end_time" property= "endTime" />
<result column= "service_price" javaType= "DECIMAL" property= "servicePrice" />
<result column= "compute_formula" jdbcType= "VARCHAR" property= "computeFormula" />
<result column= "create_time" jdbcType= "TIMESTAMP" property= "createTime" />
<result column= "create_by" jdbcType= "VARCHAR" property= "createBy" />
<result column= "update_time" jdbcType= "TIMESTAMP" property= "updateTime" />
<result column= "update_by" jdbcType= "VARCHAR" property= "updateBy" />
</resultMap>
<sql id= "Base_Column_List" >
activity_formula_id
, activity_id, start_time, end_time, service_price, compute_formula, create_time,
create_by, update_time, update_by
</sql>
<select id= "selectByActivityId" parameterType= "java.lang.Integer" resultMap= "BaseResultMap" >
select
<include refid= "Base_Column_List" />
from xhpc_activity_formula
where activity_id = #{activityId}
</select>
<delete id= "deleteByActivityId" >
delete
from xhpc_activity_formula
where activity_id = #{activityId}
</delete>
<select id= "selectByPrimaryKey" parameterType= "java.lang.Long" resultMap= "BaseResultMap" >
select
<include refid= "Base_Column_List" />
from xhpc_activity_formula
where activity_formula_id = #{activityFormulaId,jdbcType=BIGINT}
</select>
<delete id= "deleteByPrimaryKey" parameterType= "java.lang.Long" >
delete
from xhpc_activity_formula
where activity_formula_id = #{activityFormulaId,jdbcType=BIGINT}
</delete>
<insert id= "insert" keyColumn= "activity_formula_id" keyProperty= "activityFormulaId"
parameterType="com.xhpc.activity.domain.XhpcActivityFormulaDomain" useGeneratedKeys="true">
insert into xhpc_activity_formula (activity_id, start_time, end_time,
service_price, compute_formula, create_time, create_by,
update_time, update_by)
values (#{activityId,jdbcType=INTEGER}, #{startTime}, #{endTime},
#{servicePrice}, #{computeFormula,jdbcType=VARCHAR}, sysdate(), #{createBy,jdbcType=VARCHAR},
sysdate(), #{updateBy,jdbcType=VARCHAR})
</insert>
2022-04-08 14:04:54 +08:00
<insert id= "insertBatch" >
insert into xhpc_activity_formula (activity_id, start_time, end_time,
service_price, compute_formula, create_time, create_by,
update_time, update_by) values
<foreach collection= "domainList" separator= "," item= "domain" index= "index" >
(#{domain.activityId}, #{domain.startTime}, #{domain.endTime},
#{domain.servicePrice}, #{domain.computeFormula}, sysdate(), #{domain.createBy},
sysdate(), #{domain.updateBy})
</foreach>
</insert>
2022-04-06 17:25:43 +08:00
<update id= "updateByPrimaryKey" parameterType= "com.xhpc.activity.domain.XhpcActivityFormulaDomain" >
update xhpc_activity_formula
set activity_id = #{activityId,jdbcType=INTEGER},
start_time = #{startTime},
end_time = #{endTime},
service_price = #{servicePrice},
compute_formula = #{computeFormula,jdbcType=VARCHAR},
update_time = sysdate(),
update_by = #{updateBy,jdbcType=VARCHAR}
where activity_formula_id = #{activityComputeId,jdbcType=BIGINT}
</update>
2022-04-12 09:46:31 +08:00
<select id= "getActivityFormulaTime" resultMap= "BaseResultMap" >
select
<include refid= "Base_Column_List" />
from xhpc_activity_formula
where
activity_id = #{activityId}
and activity_formula_id > = (SELECT activity_formula_id FROM xhpc_activity_formula WHERE start_time < = #{startTime} AND end_time > = #{startTime})
and activity_formula_id < = (SELECT activity_formula_id FROM xhpc_activity_formula WHERE start_time < = #{endTime} AND end_time > = #{endTime})
</select>
2022-04-06 17:25:43 +08:00
</mapper>