Skip to content

Commit

Permalink
6.10 沉住气 认真修订
Browse files Browse the repository at this point in the history
  • Loading branch information
zzzzzzzzyt committed Jun 10, 2022
1 parent bb2d74b commit 2819599
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 74 deletions.
12 changes: 0 additions & 12 deletions music-server/src/main/java/com/example/yin/mapper/AdminMapper.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,5 @@

@Repository
public interface AdminMapper extends BaseMapper<Admin> {
int deleteByPrimaryKey(Integer id);

int insert(Admin record);

int insertSelective(Admin record);

Admin selectByPrimaryKey(Integer id);

int updateByPrimaryKeySelective(Admin record);

int updateByPrimaryKey(Admin record);

int verifyPassword(String username, String password);
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.example.yin.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.example.yin.common.R;
import com.example.yin.mapper.AdminMapper;
Expand All @@ -19,7 +20,10 @@ public class AdminServiceImpl extends ServiceImpl<AdminMapper, Admin> implements

@Override
public R verityPasswd(AdminRequest adminRequest, HttpSession session) {
if (adminMapper.verifyPassword(adminRequest.getUsername(), adminRequest.getPassword()) > 0) {
QueryWrapper<Admin> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("name",adminRequest.getUsername());
queryWrapper.eq("password",adminRequest.getPassword());
if (adminMapper.selectCount(queryWrapper) > 0) {
session.setAttribute("name", adminRequest.getUsername());
return R.success("登录成功");
} else {
Expand Down
61 changes: 0 additions & 61 deletions music-server/src/main/resources/mapper/AdminMapper.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,65 +10,4 @@
id, name, password
</sql>

<select id="verifyPassword" resultType="java.lang.Integer">
SELECT count(*) FROM admin where name = #{0} and password = #{1} ;
</select>

<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from admin
where id = #{id,jdbcType=INTEGER}
</select>

<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
delete from admin
where id = #{id,jdbcType=INTEGER}
</delete>

<insert id="insert" parameterType="com.example.yin.model.domain.Admin">
insert into admin (id, name, password)
values (#{id,jdbcType=INTEGER}, #{name,jdbcType=VARCHAR}, #{password,jdbcType=VARCHAR})
</insert>
<insert id="insertSelective" parameterType="com.example.yin.model.domain.Admin">
insert into admin
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
<if test="name != null">
name,
</if>
<if test="password != null">
password,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null"> #{id,jdbcType=INTEGER},
</if>
<if test="name != null"> #{name,jdbcType=VARCHAR},
</if>
<if test="password != null"> #{password,jdbcType=VARCHAR},
</if>
</trim>
</insert>

<update id="updateByPrimaryKeySelective" parameterType="com.example.yin.model.domain.Admin">
update admin
<set>
<if test="name != null">
name = #{name,jdbcType=VARCHAR},
</if>
<if test="password != null">
password = #{password,jdbcType=VARCHAR},
</if>
</set>
where id = #{id,jdbcType=INTEGER}
</update>
<update id="updateByPrimaryKey" parameterType="com.example.yin.model.domain.Admin">
update admin
set name = #{name,jdbcType=VARCHAR},
password = #{password,jdbcType=VARCHAR}
where id = #{id,jdbcType=INTEGER}
</update>
</mapper>

0 comments on commit 2819599

Please sign in to comment.