Files
cashier-client/src/main/resources/mapper/TbTokenMapper.xml
韩鹏辉 b96a251fd8 提交
2024-03-21 10:17:54 +08:00

144 lines
5.2 KiB
XML

<?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.chaozhanggui.system.cashierservice.dao.TbTokenMapper">
<resultMap id="BaseResultMap" type="com.chaozhanggui.system.cashierservice.entity.TbToken">
<id column="id" jdbcType="INTEGER" property="id" />
<result column="account_id" jdbcType="INTEGER" property="accountId" />
<result column="staff_id" jdbcType="INTEGER" property="staffId" />
<result column="client_type" jdbcType="VARCHAR" property="clientType" />
<result column="token" jdbcType="VARCHAR" property="token" />
<result column="ip" jdbcType="VARCHAR" property="ip" />
<result column="status" jdbcType="VARCHAR" property="status" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
</resultMap>
<sql id="Base_Column_List">
id, account_id, staff_id, client_type, token, ip, status, create_time, update_time
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from tb_token
where id = #{id,jdbcType=INTEGER}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
delete from tb_token
where id = #{id,jdbcType=INTEGER}
</delete>
<insert id="insert" parameterType="com.chaozhanggui.system.cashierservice.entity.TbToken">
insert into tb_token (id, account_id, staff_id,
client_type, token, ip,
status, create_time, update_time
)
values (#{id,jdbcType=INTEGER}, #{accountId,jdbcType=INTEGER}, #{staffId,jdbcType=INTEGER},
#{clientType,jdbcType=VARCHAR}, #{token,jdbcType=VARCHAR}, #{ip,jdbcType=VARCHAR},
#{status,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}
)
</insert>
<insert id="insertSelective" parameterType="com.chaozhanggui.system.cashierservice.entity.TbToken">
insert into tb_token
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
<if test="accountId != null">
account_id,
</if>
<if test="staffId != null">
staff_id,
</if>
<if test="clientType != null">
client_type,
</if>
<if test="token != null">
token,
</if>
<if test="ip != null">
ip,
</if>
<if test="status != null">
status,
</if>
<if test="createTime != null">
create_time,
</if>
<if test="updateTime != null">
update_time,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id,jdbcType=INTEGER},
</if>
<if test="accountId != null">
#{accountId,jdbcType=INTEGER},
</if>
<if test="staffId != null">
#{staffId,jdbcType=INTEGER},
</if>
<if test="clientType != null">
#{clientType,jdbcType=VARCHAR},
</if>
<if test="token != null">
#{token,jdbcType=VARCHAR},
</if>
<if test="ip != null">
#{ip,jdbcType=VARCHAR},
</if>
<if test="status != null">
#{status,jdbcType=VARCHAR},
</if>
<if test="createTime != null">
#{createTime,jdbcType=TIMESTAMP},
</if>
<if test="updateTime != null">
#{updateTime,jdbcType=TIMESTAMP},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.chaozhanggui.system.cashierservice.entity.TbToken">
update tb_token
<set>
<if test="accountId != null">
account_id = #{accountId,jdbcType=INTEGER},
</if>
<if test="staffId != null">
staff_id = #{staffId,jdbcType=INTEGER},
</if>
<if test="clientType != null">
client_type = #{clientType,jdbcType=VARCHAR},
</if>
<if test="token != null">
token = #{token,jdbcType=VARCHAR},
</if>
<if test="ip != null">
ip = #{ip,jdbcType=VARCHAR},
</if>
<if test="status != null">
status = #{status,jdbcType=VARCHAR},
</if>
<if test="createTime != null">
create_time = #{createTime,jdbcType=TIMESTAMP},
</if>
<if test="updateTime != null">
update_time = #{updateTime,jdbcType=TIMESTAMP},
</if>
</set>
where id = #{id,jdbcType=INTEGER}
</update>
<update id="updateByPrimaryKey" parameterType="com.chaozhanggui.system.cashierservice.entity.TbToken">
update tb_token
set account_id = #{accountId,jdbcType=INTEGER},
staff_id = #{staffId,jdbcType=INTEGER},
client_type = #{clientType,jdbcType=VARCHAR},
token = #{token,jdbcType=VARCHAR},
ip = #{ip,jdbcType=VARCHAR},
status = #{status,jdbcType=VARCHAR},
create_time = #{createTime,jdbcType=TIMESTAMP},
update_time = #{updateTime,jdbcType=TIMESTAMP}
where id = #{id,jdbcType=INTEGER}
</update>
<select id="selectByToken" resultMap="BaseResultMap">
select id, account_id, staff_id, token, ip, `status`, create_time, update_time from tb_token where token=#{token}
</select>
</mapper>