alive-admin/alive-server/target/classes/mapper/system/ActivityConfigMapper.xml

145 lines
8.4 KiB
XML
Raw Permalink Normal View History

2024-05-27 16:26:14 +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.ruoyi.system.mapper.ActivityConfigMapper">
<resultMap type="com.ruoyi.system.domain.ActivityConfig" id="ActivityConfigResult">
<result property="id" column="id" />
<result property="createTime" column="create_time" />
<result property="updateTime" column="update_time" />
<result property="flag" column="flag" />
<result property="title" column="title" />
<result property="titleContent" column="title_content" />
<result property="activityImg" column="activity_img" />
<result property="activityUrl" column="activity_url" />
<result property="state" column="state" />
<result property="amount" column="amount" />
<result property="superiorAmount" column="superior_amount" />
<result property="activityNumber" column="activity_number" />
<result property="category" column="category" />
<result property="type" column="type" />
<result property="mark" column="mark" />
</resultMap>
<sql id="selectActivityConfigVo">
select id, create_time, update_time, flag, title, title_content, activity_img, activity_url, state, amount, superior_amount, activity_number, category, type, mark from activity_config
</sql>
<select id="findActivityConfigCount" resultType="com.ruoyi.system.domain.ActivityConfig">
SELECT ac.title,ac.create_time as createTime,(SELECT COUNT(0) FROM activity_log WHERE type=1 and activity_config_id=ac.id) as number
FROM activity_config ac ORDER BY ac.id DESC
</select>
<select id="selectActivityConfigList" parameterType="com.ruoyi.system.domain.ActivityConfig" resultMap="ActivityConfigResult">
<include refid="selectActivityConfigVo"/>
<where>
<if test="id != null "> and id = #{id}</if>
<if test="flag != null and flag != ''"> and flag = #{flag}</if>
<if test="title != null and title != ''"> and title = #{title}</if>
<if test="titleContent != null and titleContent != ''"> and title_content = #{titleContent}</if>
<if test="activityImg != null and activityImg != ''"> and activity_img = #{activityImg}</if>
<if test="activityUrl != null and activityUrl != ''"> and activity_url = #{activityUrl}</if>
<if test="state != null "> and state = #{state}</if>
<if test="amount != null "> and amount = #{amount}</if>
<if test="superiorAmount != null "> and superior_amount = #{superiorAmount}</if>
<if test="activityNumber != null "> and activity_number = #{activityNumber}</if>
<if test="category != null "> and category = #{category}</if>
<if test="type != null "> and type = #{type}</if>
<if test="mark != null and mark != ''"> and mark = #{mark}</if>
<if test="params.beginTime != null and params.beginTime != '' and params.endTime != null and params.endTime != ''"> and create_time between #{params.beginTime} and #{params.endTime}</if>
</where>
order by id desc
</select>
<select id="findActivityConfig" parameterType="com.ruoyi.system.domain.ActivityConfig" resultMap="ActivityConfigResult">
<include refid="selectActivityConfigVo"/>
<where>
<if test="id != null "> and id = #{id}</if>
<if test="flag != null and flag != ''"> and flag = #{flag}</if>
<if test="title != null and title != ''"> and title = #{title}</if>
<if test="titleContent != null and titleContent != ''"> and title_content = #{titleContent}</if>
<if test="activityImg != null and activityImg != ''"> and activity_img = #{activityImg}</if>
<if test="activityUrl != null and activityUrl != ''"> and activity_url = #{activityUrl}</if>
<if test="state != null "> and state = #{state}</if>
<if test="amount != null "> and amount = #{amount}</if>
<if test="superiorAmount != null "> and superior_amount = #{superiorAmount}</if>
<if test="activityNumber != null "> and activity_number = #{activityNumber}</if>
<if test="category != null "> and category = #{category}</if>
<if test="type != null "> and type = #{type}</if>
<if test="mark != null and mark != ''"> and mark = #{mark}</if>
</where>
limit 1
</select>
<select id="selectActivityConfigById" parameterType="Integer" resultMap="ActivityConfigResult">
<include refid="selectActivityConfigVo"/>
where id = #{id}
</select>
<insert id="insertActivityConfig" parameterType="com.ruoyi.system.domain.ActivityConfig" useGeneratedKeys="true" keyProperty="id">
insert into activity_config
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="createTime != null">create_time,</if>
<if test="updateTime != null">update_time,</if>
<if test="flag != null and flag != ''">flag,</if>
<if test="title != null and title != ''">title,</if>
<if test="titleContent != null and titleContent != ''">title_content,</if>
<if test="activityImg != null and activityImg != ''">activity_img,</if>
<if test="activityUrl != null and activityUrl != ''">activity_url,</if>
<if test="state != null">state,</if>
<if test="amount != null">amount,</if>
<if test="superiorAmount != null">superior_amount,</if>
<if test="activityNumber != null">activity_number,</if>
<if test="category != null">category,</if>
<if test="type != null">type,</if>
<if test="mark != null and mark != ''">mark,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="createTime != null">#{createTime},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="flag != null and flag != ''">#{flag},</if>
<if test="title != null and title != ''">#{title},</if>
<if test="titleContent != null and titleContent != ''">#{titleContent},</if>
<if test="activityImg != null and activityImg != ''">#{activityImg},</if>
<if test="activityUrl != null and activityUrl != ''">#{activityUrl},</if>
<if test="state != null">#{state},</if>
<if test="amount != null">#{amount},</if>
<if test="superiorAmount != null">#{superiorAmount},</if>
<if test="activityNumber != null">#{activityNumber},</if>
<if test="category != null">#{category},</if>
<if test="type != null">#{type},</if>
<if test="mark != null and mark != ''">#{mark},</if>
</trim>
</insert>
<update id="updateActivityConfig" parameterType="com.ruoyi.system.domain.ActivityConfig">
update activity_config
<trim prefix="SET" suffixOverrides=",">
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="flag != null and flag != ''">flag = #{flag},</if>
<if test="title != null and title != ''">title = #{title},</if>
<if test="titleContent != null and titleContent != ''">title_content = #{titleContent},</if>
<if test="activityImg != null and activityImg != ''">activity_img = #{activityImg},</if>
<if test="activityUrl != null and activityUrl != ''">activity_url = #{activityUrl},</if>
<if test="state != null">state = #{state},</if>
<if test="amount != null">amount = #{amount},</if>
<if test="superiorAmount != null">superior_amount = #{superiorAmount},</if>
<if test="activityNumber != null">activity_number = #{activityNumber},</if>
<if test="category != null">category = #{category},</if>
<if test="type != null">type = #{type},</if>
<if test="mark != null and mark != ''">mark = #{mark},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteActivityConfigByIds" parameterType="String">
delete from activity_config where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>