| <?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.web.mapper.planet.PlanetMapper"> |
| <resultMap id="PlanetResult" type="com.ruoyi.web.domain.planet.Planet"> |
| <id property="planetId" column="planet_id"/> |
| <result property="name" column="name"/> |
| <result property="filename" column="filename"/> |
| <result property="description" column="description"/> |
| <result property="createTime" column="create_time"/> |
| </resultMap> |
| <resultMap id="UserPlanetResult" type="com.ruoyi.web.domain.planet.UserPlanet"> |
| <id property="userId" column="user_id"/> |
| <result property="planetId" column="planet_id"/> |
| <result property="updateTime" column="update_time"/> |
| </resultMap> |
| <select id="selectPlanetList" parameterType="com.ruoyi.web.domain.planet.Planet" resultMap="PlanetResult"> |
| SELECT * FROM planets |
| <where> |
| <!-- 可选条件 --> |
| </where> |
| LIMIT #{pageSize} OFFSET #{offset} |
| </select> |
| <select id="selectPlanetById" parameterType="com.ruoyi.web.domain.planet.Planet" resultMap="PlanetResult"> |
| SELECT * FROM planets WHERE planet_id = #{id} |
| </select> |
| <insert id="insertPlanet"> |
| INSERT INTO planets (name, filename, description, create_time) |
| VALUES (#{name}, #{filename}, #{description}, #{createTime}) |
| </insert> |
| <update id="updatePlanet"> |
| UPDATE planets |
| SET name = #{name}, |
| filename = #{filename}, |
| description = #{description} |
| WHERE planet_id = #{planetId} |
| </update> |
| <update id="updateUserPlanet"> |
| UPDATE user_planet |
| SET planet_id = #{planetId} |
| WHERE user_id = #{userId} |
| </update> |
| <delete id="deletePlanetsByIds"> |
| DELETE FROM planets WHERE planet_id IN |
| <foreach item="id" collection="ids" open="(" separator="," close=")"> |
| #{id} |
| </foreach> |
| </delete> |
| <select id="selectUserPlanetByUserId" resultMap="UserPlanetResult"> |
| SELECT * FROM user_planet WHERE user_id = #{userId} |
| </select> |
| <select id="selectUserPlanetList" parameterType="com.ruoyi.web.domain.planet.UserPlanet" resultMap="UserPlanetResult"> |
| SELECT * FROM user_planet |
| </select> |
| </mapper> |