From c9d04bc519b73f7fc4841c34e2f15fca9db7aad2 Mon Sep 17 00:00:00 2001
From: xiangpei <xiangpei@timesnew.cn>
Date: 星期五, 31 五月 2024 14:08:30 +0800
Subject: [PATCH] 重构:service、mapper plus化,xml删除多余sql

---
 src/main/resources/mapper/UserTokenMapper.xml |  145 +++++++-----------------------------------------
 1 files changed, 21 insertions(+), 124 deletions(-)

diff --git a/src/main/resources/mapper/UserTokenMapper.xml b/src/main/resources/mapper/UserTokenMapper.xml
index 3d7b9be..232e4cf 100644
--- a/src/main/resources/mapper/UserTokenMapper.xml
+++ b/src/main/resources/mapper/UserTokenMapper.xml
@@ -1,132 +1,29 @@
 <?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.ycl.jxkg.mapper.UserTokenMapper">
-  <resultMap id="BaseResultMap" type="com.ycl.jxkg.domain.UserToken">
-    <id column="id" jdbcType="INTEGER" property="id" />
-    <result column="token" jdbcType="VARCHAR" property="token" />
-    <result column="user_id" jdbcType="INTEGER" property="userId" />
-    <result column="wx_open_id" jdbcType="VARCHAR" property="wxOpenId" />
-    <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
-    <result column="end_time" jdbcType="TIMESTAMP" property="endTime" />
-    <result column="user_name" jdbcType="VARCHAR" property="userName" />
-  </resultMap>
-  <sql id="Base_Column_List">
-    id, token, user_id, wx_open_id, create_time, end_time, user_name
-  </sql>
-  <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
-    select
-    <include refid="Base_Column_List" />
-    from t_user_token
-    where id = #{id,jdbcType=INTEGER}
-  </select>
-  <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
-    delete from t_user_token
-    where id = #{id,jdbcType=INTEGER}
-  </delete>
-  <insert id="insert" parameterType="com.ycl.jxkg.domain.UserToken" useGeneratedKeys="true" keyProperty="id">
-    insert into t_user_token (id, token, user_id,
-      wx_open_id, create_time, end_time,
-      user_name)
-    values (#{id,jdbcType=INTEGER}, #{token,jdbcType=VARCHAR}, #{userId,jdbcType=INTEGER},
-      #{wxOpenId,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, #{endTime,jdbcType=TIMESTAMP},
-      #{userName,jdbcType=VARCHAR})
-  </insert>
-  <insert id="insertSelective" parameterType="com.ycl.jxkg.domain.UserToken" useGeneratedKeys="true" keyProperty="id">
-    insert into t_user_token
-    <trim prefix="(" suffix=")" suffixOverrides=",">
-      <if test="id != null">
-        id,
-      </if>
-      <if test="token != null">
-        token,
-      </if>
-      <if test="userId != null">
-        user_id,
-      </if>
-      <if test="wxOpenId != null">
-        wx_open_id,
-      </if>
-      <if test="createTime != null">
-        create_time,
-      </if>
-      <if test="endTime != null">
-        end_time,
-      </if>
-      <if test="userName != null">
-        user_name,
-      </if>
-    </trim>
-    <trim prefix="values (" suffix=")" suffixOverrides=",">
-      <if test="id != null">
-        #{id,jdbcType=INTEGER},
-      </if>
-      <if test="token != null">
-        #{token,jdbcType=VARCHAR},
-      </if>
-      <if test="userId != null">
-        #{userId,jdbcType=INTEGER},
-      </if>
-      <if test="wxOpenId != null">
-        #{wxOpenId,jdbcType=VARCHAR},
-      </if>
-      <if test="createTime != null">
-        #{createTime,jdbcType=TIMESTAMP},
-      </if>
-      <if test="endTime != null">
-        #{endTime,jdbcType=TIMESTAMP},
-      </if>
-      <if test="userName != null">
-        #{userName,jdbcType=VARCHAR},
-      </if>
-    </trim>
-  </insert>
-  <update id="updateByPrimaryKeySelective" parameterType="com.ycl.jxkg.domain.UserToken">
-    update t_user_token
-    <set>
-      <if test="token != null">
-        token = #{token,jdbcType=VARCHAR},
-      </if>
-      <if test="userId != null">
-        user_id = #{userId,jdbcType=INTEGER},
-      </if>
-      <if test="wxOpenId != null">
-        wx_open_id = #{wxOpenId,jdbcType=VARCHAR},
-      </if>
-      <if test="createTime != null">
-        create_time = #{createTime,jdbcType=TIMESTAMP},
-      </if>
-      <if test="endTime != null">
-        end_time = #{endTime,jdbcType=TIMESTAMP},
-      </if>
-      <if test="userName != null">
-        user_name = #{userName,jdbcType=VARCHAR},
-      </if>
-    </set>
-    where id = #{id,jdbcType=INTEGER}
-  </update>
-  <update id="updateByPrimaryKey" parameterType="com.ycl.jxkg.domain.UserToken">
-    update t_user_token
-    set token = #{token,jdbcType=VARCHAR},
-      user_id = #{userId,jdbcType=INTEGER},
-      wx_open_id = #{wxOpenId,jdbcType=VARCHAR},
-      create_time = #{createTime,jdbcType=TIMESTAMP},
-      end_time = #{endTime,jdbcType=TIMESTAMP},
-      user_name = #{userName,jdbcType=VARCHAR}
-    where id = #{id,jdbcType=INTEGER}
-  </update>
+    <resultMap id="BaseResultMap" type="com.ycl.jxkg.domain.UserToken">
+        <id column="id" jdbcType="INTEGER" property="id"/>
+        <result column="token" jdbcType="VARCHAR" property="token"/>
+        <result column="user_id" jdbcType="INTEGER" property="userId"/>
+        <result column="wx_open_id" jdbcType="VARCHAR" property="wxOpenId"/>
+        <result column="create_time" jdbcType="TIMESTAMP" property="createTime"/>
+        <result column="end_time" jdbcType="TIMESTAMP" property="endTime"/>
+        <result column="user_name" jdbcType="VARCHAR" property="userName"/>
+    </resultMap>
+    <sql id="Base_Column_List">
+        id
+        , token, user_id, wx_open_id, create_time, end_time, user_name
+    </sql>
 
 
-
-
-
-  <select id="getToken" parameterType="java.lang.String" resultMap="BaseResultMap">
-    select
-    <include refid="Base_Column_List" />
-    from t_user_token
-    where token = #{token,jdbcType=VARCHAR}
-    order by id desc
-    limit 1
-  </select>
+    <select id="getToken" parameterType="java.lang.String" resultMap="BaseResultMap">
+        select
+        <include refid="Base_Column_List"/>
+        from t_user_token
+        where token = #{token,jdbcType=VARCHAR}
+        order by id desc
+        limit 1
+    </select>
 
 
 </mapper>

--
Gitblit v1.8.0