zhaoyumao | 8dbb036 | 2025-06-08 23:43:41 +0800 | [diff] [blame] | 1 | <?xml version="1.0" encoding="UTF-8" ?> |
| 2 | <!DOCTYPE mapper |
| 3 | PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" |
| 4 | "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| 5 | <mapper namespace="com.ruoyi.web.mapper.planet.PlanetMapper"> |
| 6 | <resultMap id="PlanetResult" type="com.ruoyi.web.domain.planet.Planet"> |
| 7 | <id property="planetId" column="planet_id"/> |
| 8 | <result property="name" column="name"/> |
| 9 | <result property="filename" column="filename"/> |
| 10 | <result property="description" column="description"/> |
| 11 | <result property="createTime" column="create_time"/> |
| 12 | </resultMap> |
| 13 | <resultMap id="UserPlanetResult" type="com.ruoyi.web.domain.planet.UserPlanet"> |
| 14 | <id property="userId" column="user_id"/> |
| 15 | <result property="planetId" column="planet_id"/> |
| 16 | <result property="updateTime" column="update_time"/> |
| 17 | </resultMap> |
| 18 | <select id="selectPlanetList" parameterType="com.ruoyi.web.domain.planet.Planet" resultMap="PlanetResult"> |
| 19 | SELECT * FROM planets |
| 20 | <where> |
| 21 | <!-- 可选条件 --> |
| 22 | </where> |
| 23 | LIMIT #{pageSize} OFFSET #{offset} |
| 24 | </select> |
| 25 | <select id="selectPlanetById" parameterType="com.ruoyi.web.domain.planet.Planet" resultMap="PlanetResult"> |
| 26 | SELECT * FROM planets WHERE planet_id = #{id} |
| 27 | </select> |
| 28 | <insert id="insertPlanet"> |
| 29 | INSERT INTO planets (name, filename, description, create_time) |
| 30 | VALUES (#{name}, #{filename}, #{description}, #{createTime}) |
| 31 | </insert> |
| 32 | <update id="updatePlanet"> |
| 33 | UPDATE planets |
| 34 | SET name = #{name}, |
| 35 | filename = #{filename}, |
| 36 | description = #{description} |
| 37 | WHERE planet_id = #{planetId} |
| 38 | </update> |
| 39 | <update id="updateUserPlanet"> |
| 40 | UPDATE user_planet |
| 41 | SET planet_id = #{planetId} |
| 42 | WHERE user_id = #{userId} |
| 43 | </update> |
| 44 | <delete id="deletePlanetsByIds"> |
| 45 | DELETE FROM planets WHERE planet_id IN |
| 46 | <foreach item="id" collection="ids" open="(" separator="," close=")"> |
| 47 | #{id} |
| 48 | </foreach> |
| 49 | </delete> |
| 50 | <select id="selectUserPlanetByUserId" resultMap="UserPlanetResult"> |
| 51 | SELECT * FROM user_planet WHERE user_id = #{userId} |
| 52 | </select> |
| 53 | <select id="selectUserPlanetList" parameterType="com.ruoyi.web.domain.planet.UserPlanet" resultMap="UserPlanetResult"> |
| 54 | SELECT * FROM user_planet |
| 55 | </select> |
| 56 | </mapper> |