Files
fateback/ruoyi-system/src/main/resources/mapper/system/FateCharacterMapper.xml

161 lines
9.6 KiB
XML
Raw Normal View History

2026-01-18 21:30:49 +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.FateCharacterMapper">
<resultMap type="FateCharacter" id="FateCharacterResult">
<result property="characterId" column="character_id" />
<result property="name" column="name" />
<result property="rarity" column="rarity" />
<result property="baseHpMin" column="base_hp_min" />
<result property="baseHpMax" column="base_hp_max" />
<result property="baseAtkMin" column="base_atk_min" />
<result property="baseAtkMax" column="base_atk_max" />
<result property="baseDefMin" column="base_def_min" />
<result property="baseDefMax" column="base_def_max" />
<result property="baseResMin" column="base_res_min" />
<result property="baseResMax" column="base_res_max" />
<result property="baseSpdMin" column="base_spd_min" />
<result property="baseSpdMax" column="base_spd_max" />
<result property="growthHp" column="growth_hp" />
<result property="growthAtk" column="growth_atk" />
<result property="growthDef" column="growth_def" />
<result property="growthRes" column="growth_res" />
<result property="growthSpd" column="growth_spd" />
<result property="moveType" column="move_type" />
<result property="weaponType" column="weapon_type" />
<result property="description" column="description" />
<result property="avatarUrl" column="avatar_url" />
<result property="createdAt" column="created_at" />
</resultMap>
<sql id="selectFateCharacterVo">
select character_id, name, rarity, base_hp_min, base_hp_max, base_atk_min, base_atk_max, base_def_min, base_def_max, base_res_min, base_res_max, base_spd_min, base_spd_max, growth_hp, growth_atk, growth_def, growth_res, growth_spd, move_type, weapon_type, description, avatar_url, created_at from fate_character
</sql>
<select id="selectFateCharacterList" parameterType="FateCharacter" resultMap="FateCharacterResult">
<include refid="selectFateCharacterVo"/>
<where>
<if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
<if test="rarity != null "> and rarity = #{rarity}</if>
<if test="baseHpMin != null "> and base_hp_min = #{baseHpMin}</if>
<if test="baseHpMax != null "> and base_hp_max = #{baseHpMax}</if>
<if test="baseAtkMin != null "> and base_atk_min = #{baseAtkMin}</if>
<if test="baseAtkMax != null "> and base_atk_max = #{baseAtkMax}</if>
<if test="baseDefMin != null "> and base_def_min = #{baseDefMin}</if>
<if test="baseDefMax != null "> and base_def_max = #{baseDefMax}</if>
<if test="baseResMin != null "> and base_res_min = #{baseResMin}</if>
<if test="baseResMax != null "> and base_res_max = #{baseResMax}</if>
<if test="baseSpdMin != null "> and base_spd_min = #{baseSpdMin}</if>
<if test="baseSpdMax != null "> and base_spd_max = #{baseSpdMax}</if>
<if test="growthHp != null "> and growth_hp = #{growthHp}</if>
<if test="growthAtk != null "> and growth_atk = #{growthAtk}</if>
<if test="growthDef != null "> and growth_def = #{growthDef}</if>
<if test="growthRes != null "> and growth_res = #{growthRes}</if>
<if test="growthSpd != null "> and growth_spd = #{growthSpd}</if>
<if test="moveType != null and moveType != ''"> and move_type = #{moveType}</if>
<if test="weaponType != null and weaponType != ''"> and weapon_type = #{weaponType}</if>
<if test="description != null and description != ''"> and description = #{description}</if>
<if test="avatarUrl != null and avatarUrl != ''"> and avatar_url = #{avatarUrl}</if>
<if test="createdAt != null "> and created_at = #{createdAt}</if>
</where>
</select>
<select id="selectFateCharacterByCharacterId" parameterType="Long" resultMap="FateCharacterResult">
<include refid="selectFateCharacterVo"/>
where character_id = #{characterId}
</select>
<insert id="insertFateCharacter" parameterType="FateCharacter" useGeneratedKeys="true" keyProperty="characterId">
insert into fate_character
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="name != null and name != ''">name,</if>
<if test="rarity != null">rarity,</if>
<if test="baseHpMin != null">base_hp_min,</if>
<if test="baseHpMax != null">base_hp_max,</if>
<if test="baseAtkMin != null">base_atk_min,</if>
<if test="baseAtkMax != null">base_atk_max,</if>
<if test="baseDefMin != null">base_def_min,</if>
<if test="baseDefMax != null">base_def_max,</if>
<if test="baseResMin != null">base_res_min,</if>
<if test="baseResMax != null">base_res_max,</if>
<if test="baseSpdMin != null">base_spd_min,</if>
<if test="baseSpdMax != null">base_spd_max,</if>
<if test="growthHp != null">growth_hp,</if>
<if test="growthAtk != null">growth_atk,</if>
<if test="growthDef != null">growth_def,</if>
<if test="growthRes != null">growth_res,</if>
<if test="growthSpd != null">growth_spd,</if>
<if test="moveType != null">move_type,</if>
<if test="weaponType != null and weaponType != ''">weapon_type,</if>
<if test="description != null">description,</if>
<if test="avatarUrl != null">avatar_url,</if>
<if test="createdAt != null">created_at,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="name != null and name != ''">#{name},</if>
<if test="rarity != null">#{rarity},</if>
<if test="baseHpMin != null">#{baseHpMin},</if>
<if test="baseHpMax != null">#{baseHpMax},</if>
<if test="baseAtkMin != null">#{baseAtkMin},</if>
<if test="baseAtkMax != null">#{baseAtkMax},</if>
<if test="baseDefMin != null">#{baseDefMin},</if>
<if test="baseDefMax != null">#{baseDefMax},</if>
<if test="baseResMin != null">#{baseResMin},</if>
<if test="baseResMax != null">#{baseResMax},</if>
<if test="baseSpdMin != null">#{baseSpdMin},</if>
<if test="baseSpdMax != null">#{baseSpdMax},</if>
<if test="growthHp != null">#{growthHp},</if>
<if test="growthAtk != null">#{growthAtk},</if>
<if test="growthDef != null">#{growthDef},</if>
<if test="growthRes != null">#{growthRes},</if>
<if test="growthSpd != null">#{growthSpd},</if>
<if test="moveType != null">#{moveType},</if>
<if test="weaponType != null and weaponType != ''">#{weaponType},</if>
<if test="description != null">#{description},</if>
<if test="avatarUrl != null">#{avatarUrl},</if>
<if test="createdAt != null">#{createdAt},</if>
</trim>
</insert>
<update id="updateFateCharacter" parameterType="FateCharacter">
update fate_character
<trim prefix="SET" suffixOverrides=",">
<if test="name != null and name != ''">name = #{name},</if>
<if test="rarity != null">rarity = #{rarity},</if>
<if test="baseHpMin != null">base_hp_min = #{baseHpMin},</if>
<if test="baseHpMax != null">base_hp_max = #{baseHpMax},</if>
<if test="baseAtkMin != null">base_atk_min = #{baseAtkMin},</if>
<if test="baseAtkMax != null">base_atk_max = #{baseAtkMax},</if>
<if test="baseDefMin != null">base_def_min = #{baseDefMin},</if>
<if test="baseDefMax != null">base_def_max = #{baseDefMax},</if>
<if test="baseResMin != null">base_res_min = #{baseResMin},</if>
<if test="baseResMax != null">base_res_max = #{baseResMax},</if>
<if test="baseSpdMin != null">base_spd_min = #{baseSpdMin},</if>
<if test="baseSpdMax != null">base_spd_max = #{baseSpdMax},</if>
<if test="growthHp != null">growth_hp = #{growthHp},</if>
<if test="growthAtk != null">growth_atk = #{growthAtk},</if>
<if test="growthDef != null">growth_def = #{growthDef},</if>
<if test="growthRes != null">growth_res = #{growthRes},</if>
<if test="growthSpd != null">growth_spd = #{growthSpd},</if>
<if test="moveType != null">move_type = #{moveType},</if>
<if test="weaponType != null and weaponType != ''">weapon_type = #{weaponType},</if>
<if test="description != null">description = #{description},</if>
<if test="avatarUrl != null">avatar_url = #{avatarUrl},</if>
<if test="createdAt != null">created_at = #{createdAt},</if>
</trim>
where character_id = #{characterId}
</update>
<delete id="deleteFateCharacterByCharacterId" parameterType="Long">
delete from fate_character where character_id = #{characterId}
</delete>
<delete id="deleteFateCharacterByCharacterIds" parameterType="String">
delete from fate_character where character_id in
<foreach item="characterId" collection="array" open="(" separator="," close=")">
#{characterId}
</foreach>
</delete>
</mapper>