|
@@ -0,0 +1,243 @@
|
|
|
+<?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.idea.my.mapper.MyMenuMapper">
|
|
|
+ <resultMap id="BaseResultMap" type="com.idea.my.model.MyMenu">
|
|
|
+ <id column="id" jdbcType="VARCHAR" property="id" />
|
|
|
+ <result column="user_id" jdbcType="VARCHAR" property="userId" />
|
|
|
+ <result column="menu_id" jdbcType="VARCHAR" property="menuId" />
|
|
|
+ <result column="created_by" jdbcType="VARCHAR" property="createdBy" />
|
|
|
+ <result column="created_at" jdbcType="TIMESTAMP" property="createdAt" />
|
|
|
+ <result column="updated_by" jdbcType="VARCHAR" property="updatedBy" />
|
|
|
+ <result column="updated_at" jdbcType="TIMESTAMP" property="updatedAt" />
|
|
|
+ </resultMap>
|
|
|
+ <sql id="Example_Where_Clause">
|
|
|
+ <where>
|
|
|
+ <foreach collection="oredCriteria" item="criteria" separator="or">
|
|
|
+ <if test="criteria.valid">
|
|
|
+ <trim prefix="(" prefixOverrides="and" suffix=")">
|
|
|
+ <foreach collection="criteria.criteria" item="criterion">
|
|
|
+ <choose>
|
|
|
+ <when test="criterion.noValue">
|
|
|
+ and ${criterion.condition}
|
|
|
+ </when>
|
|
|
+ <when test="criterion.singleValue">
|
|
|
+ and ${criterion.condition} #{criterion.value}
|
|
|
+ </when>
|
|
|
+ <when test="criterion.betweenValue">
|
|
|
+ and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
|
|
|
+ </when>
|
|
|
+ <when test="criterion.listValue">
|
|
|
+ and ${criterion.condition}
|
|
|
+ <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
|
|
|
+ #{listItem}
|
|
|
+ </foreach>
|
|
|
+ </when>
|
|
|
+ </choose>
|
|
|
+ </foreach>
|
|
|
+ </trim>
|
|
|
+ </if>
|
|
|
+ </foreach>
|
|
|
+ </where>
|
|
|
+ </sql>
|
|
|
+ <sql id="Update_By_Example_Where_Clause">
|
|
|
+ <where>
|
|
|
+ <foreach collection="example.oredCriteria" item="criteria" separator="or">
|
|
|
+ <if test="criteria.valid">
|
|
|
+ <trim prefix="(" prefixOverrides="and" suffix=")">
|
|
|
+ <foreach collection="criteria.criteria" item="criterion">
|
|
|
+ <choose>
|
|
|
+ <when test="criterion.noValue">
|
|
|
+ and ${criterion.condition}
|
|
|
+ </when>
|
|
|
+ <when test="criterion.singleValue">
|
|
|
+ and ${criterion.condition} #{criterion.value}
|
|
|
+ </when>
|
|
|
+ <when test="criterion.betweenValue">
|
|
|
+ and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
|
|
|
+ </when>
|
|
|
+ <when test="criterion.listValue">
|
|
|
+ and ${criterion.condition}
|
|
|
+ <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
|
|
|
+ #{listItem}
|
|
|
+ </foreach>
|
|
|
+ </when>
|
|
|
+ </choose>
|
|
|
+ </foreach>
|
|
|
+ </trim>
|
|
|
+ </if>
|
|
|
+ </foreach>
|
|
|
+ </where>
|
|
|
+ </sql>
|
|
|
+ <sql id="Base_Column_List">
|
|
|
+ id, user_id, menu_id, created_by, created_at, updated_by, updated_at
|
|
|
+ </sql>
|
|
|
+ <select id="selectByExample" parameterType="com.idea.my.model.MyMenuExample" resultMap="BaseResultMap">
|
|
|
+ select
|
|
|
+ <if test="distinct">
|
|
|
+ distinct
|
|
|
+ </if>
|
|
|
+ <include refid="Base_Column_List" />
|
|
|
+ from sys_my_menu
|
|
|
+ <if test="_parameter != null">
|
|
|
+ <include refid="Example_Where_Clause" />
|
|
|
+ </if>
|
|
|
+ <if test="orderByClause != null">
|
|
|
+ order by ${orderByClause}
|
|
|
+ </if>
|
|
|
+ </select>
|
|
|
+ <select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
|
|
|
+ select
|
|
|
+ <include refid="Base_Column_List" />
|
|
|
+ from sys_my_menu
|
|
|
+ where id = #{id,jdbcType=VARCHAR}
|
|
|
+ </select>
|
|
|
+ <delete id="deleteByPrimaryKey" parameterType="java.lang.String">
|
|
|
+ delete from sys_my_menu
|
|
|
+ where id = #{id,jdbcType=VARCHAR}
|
|
|
+ </delete>
|
|
|
+ <delete id="deleteByExample" parameterType="com.idea.my.model.MyMenuExample">
|
|
|
+ delete from sys_my_menu
|
|
|
+ <if test="_parameter != null">
|
|
|
+ <include refid="Example_Where_Clause" />
|
|
|
+ </if>
|
|
|
+ </delete>
|
|
|
+ <insert id="insert" parameterType="com.idea.my.model.MyMenu">
|
|
|
+ <selectKey keyProperty="id" order="AFTER" resultType="java.lang.String">
|
|
|
+ SELECT LAST_INSERT_ID()
|
|
|
+ </selectKey>
|
|
|
+ insert into sys_my_menu (id,user_id, menu_id, created_by,
|
|
|
+ created_at, updated_by, updated_at
|
|
|
+ )
|
|
|
+ values (#{id,jdbcType=VARCHAR},#{userId,jdbcType=VARCHAR}, #{menuId,jdbcType=VARCHAR}, #{createdBy,jdbcType=VARCHAR},
|
|
|
+ #{createdAt,jdbcType=TIMESTAMP}, #{updatedBy,jdbcType=VARCHAR}, #{updatedAt,jdbcType=TIMESTAMP}
|
|
|
+ )
|
|
|
+ </insert>
|
|
|
+ <insert id="insertSelective" parameterType="com.idea.my.model.MyMenu">
|
|
|
+ <selectKey keyProperty="id" order="AFTER" resultType="java.lang.String">
|
|
|
+ SELECT LAST_INSERT_ID()
|
|
|
+ </selectKey>
|
|
|
+ insert into sys_my_menu
|
|
|
+ <trim prefix="(" suffix=")" suffixOverrides=",">
|
|
|
+ <if test="userId != null">
|
|
|
+ user_id,
|
|
|
+ </if>
|
|
|
+ <if test="menuId != null">
|
|
|
+ menu_id,
|
|
|
+ </if>
|
|
|
+ <if test="createdBy != null">
|
|
|
+ created_by,
|
|
|
+ </if>
|
|
|
+ <if test="createdAt != null">
|
|
|
+ created_at,
|
|
|
+ </if>
|
|
|
+ <if test="updatedBy != null">
|
|
|
+ updated_by,
|
|
|
+ </if>
|
|
|
+ <if test="updatedAt != null">
|
|
|
+ updated_at,
|
|
|
+ </if>
|
|
|
+ </trim>
|
|
|
+ <trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
|
+ <if test="userId != null">
|
|
|
+ #{userId,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="menuId != null">
|
|
|
+ #{menuId,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="createdBy != null">
|
|
|
+ #{createdBy,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="createdAt != null">
|
|
|
+ #{createdAt,jdbcType=TIMESTAMP},
|
|
|
+ </if>
|
|
|
+ <if test="updatedBy != null">
|
|
|
+ #{updatedBy,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="updatedAt != null">
|
|
|
+ #{updatedAt,jdbcType=TIMESTAMP},
|
|
|
+ </if>
|
|
|
+ </trim>
|
|
|
+ </insert>
|
|
|
+ <select id="countByExample" parameterType="com.idea.my.model.MyMenuExample" resultType="java.lang.Long">
|
|
|
+ select count(*) from sys_my_menu
|
|
|
+ <if test="_parameter != null">
|
|
|
+ <include refid="Example_Where_Clause" />
|
|
|
+ </if>
|
|
|
+ </select>
|
|
|
+ <update id="updateByExampleSelective" parameterType="map">
|
|
|
+ update sys_my_menu
|
|
|
+ <set>
|
|
|
+ <if test="record.id != null">
|
|
|
+ id = #{record.id,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="record.userId != null">
|
|
|
+ user_id = #{record.userId,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="record.menuId != null">
|
|
|
+ menu_id = #{record.menuId,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="record.createdBy != null">
|
|
|
+ created_by = #{record.createdBy,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="record.createdAt != null">
|
|
|
+ created_at = #{record.createdAt,jdbcType=TIMESTAMP},
|
|
|
+ </if>
|
|
|
+ <if test="record.updatedBy != null">
|
|
|
+ updated_by = #{record.updatedBy,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="record.updatedAt != null">
|
|
|
+ updated_at = #{record.updatedAt,jdbcType=TIMESTAMP},
|
|
|
+ </if>
|
|
|
+ </set>
|
|
|
+ <if test="_parameter != null">
|
|
|
+ <include refid="Update_By_Example_Where_Clause" />
|
|
|
+ </if>
|
|
|
+ </update>
|
|
|
+ <update id="updateByExample" parameterType="map">
|
|
|
+ update sys_my_menu
|
|
|
+ set id = #{record.id,jdbcType=VARCHAR},
|
|
|
+ user_id = #{record.userId,jdbcType=VARCHAR},
|
|
|
+ menu_id = #{record.menuId,jdbcType=VARCHAR},
|
|
|
+ created_by = #{record.createdBy,jdbcType=VARCHAR},
|
|
|
+ created_at = #{record.createdAt,jdbcType=TIMESTAMP},
|
|
|
+ updated_by = #{record.updatedBy,jdbcType=VARCHAR},
|
|
|
+ updated_at = #{record.updatedAt,jdbcType=TIMESTAMP}
|
|
|
+ <if test="_parameter != null">
|
|
|
+ <include refid="Update_By_Example_Where_Clause" />
|
|
|
+ </if>
|
|
|
+ </update>
|
|
|
+ <update id="updateByPrimaryKeySelective" parameterType="com.idea.my.model.MyMenu">
|
|
|
+ update sys_my_menu
|
|
|
+ <set>
|
|
|
+ <if test="userId != null">
|
|
|
+ user_id = #{userId,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="menuId != null">
|
|
|
+ menu_id = #{menuId,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="createdBy != null">
|
|
|
+ created_by = #{createdBy,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="createdAt != null">
|
|
|
+ created_at = #{createdAt,jdbcType=TIMESTAMP},
|
|
|
+ </if>
|
|
|
+ <if test="updatedBy != null">
|
|
|
+ updated_by = #{updatedBy,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="updatedAt != null">
|
|
|
+ updated_at = #{updatedAt,jdbcType=TIMESTAMP},
|
|
|
+ </if>
|
|
|
+ </set>
|
|
|
+ where id = #{id,jdbcType=VARCHAR}
|
|
|
+ </update>
|
|
|
+ <update id="updateByPrimaryKey" parameterType="com.idea.my.model.MyMenu">
|
|
|
+ update sys_my_menu
|
|
|
+ set user_id = #{userId,jdbcType=VARCHAR},
|
|
|
+ menu_id = #{menuId,jdbcType=VARCHAR},
|
|
|
+ created_by = #{createdBy,jdbcType=VARCHAR},
|
|
|
+ created_at = #{createdAt,jdbcType=TIMESTAMP},
|
|
|
+ updated_by = #{updatedBy,jdbcType=VARCHAR},
|
|
|
+ updated_at = #{updatedAt,jdbcType=TIMESTAMP}
|
|
|
+ where id = #{id,jdbcType=VARCHAR}
|
|
|
+ </update>
|
|
|
+</mapper>
|