Skip to content

Commit

Permalink
20200802规范代码
Browse files Browse the repository at this point in the history
  • Loading branch information
Aizhuxueliang committed Aug 2, 2020
1 parent e327ee8 commit edbb104
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 134 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package com.example.controller;

import java.util.HashMap;
import java.util.List;
import java.util.Random;

Expand Down
12 changes: 0 additions & 12 deletions ssm_project/src/main/java/com/example/mapper/UserMapper.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package com.example.mapper;

import java.util.HashMap;
import java.util.List;

import com.example.pojo.User;
Expand Down Expand Up @@ -52,15 +51,4 @@ public interface UserMapper {
*/
Integer updateUserById(User user);

int deleteByPrimaryKey(Integer id);

int insert(User record);

int insertSelective(User record);

User selectByPrimaryKey(Integer id);

int updateByPrimaryKeySelective(User record);

int updateByPrimaryKey(User record);
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package com.example.service;

import java.util.HashMap;
import java.util.List;

import com.example.pojo.User;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package com.example.service.impl;

import java.util.HashMap;
import java.util.List;

import com.example.pojo.User;
Expand Down
59 changes: 1 addition & 58 deletions ssm_project/src/main/resources/mapper/UserMapper.xml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@

<!--查询用户个数-->
<select id="getRowCount" resultType="java.lang.Integer">
select count(*) from USER
select count(*) from user
<where>
<if test="userName != null and userName !=''">
and user_name like concat('%', #{userName}, '%')
Expand All @@ -66,63 +66,6 @@
where user_id = #{userId,jdbcType=VARCHAR}
</delete>

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

<insert id="insertSelective" parameterType="com.example.pojo.User" >
insert into user
<trim prefix="(" suffix=")" suffixOverrides="," >
<if test="userId != null" >
user_id,
</if>
<if test="cardNo != null" >
card_no,
</if>
<if test="cardType != null" >
card_type,
</if>
<if test="userName != null" >
user_name,
</if>
<if test="userSex != null" >
user_sex,
</if>
<if test="userAge != null" >
user_age,
</if>
<if test="userRole != null" >
user_role,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides="," >
<if test="userId != null" >
user_id = #{userId,jdbcType=VARCHAR},
</if>
<if test="cardNo != null" >
card_no = #{cardType,jdbcType=VARCHAR},
</if>
<if test="cardType != null" >
card_type = #{cardType,jdbcType=VARCHAR},
</if>
<if test="userName != null" >
user_name = #{userName,jdbcType=VARCHAR},
</if>
<if test="userSex != null" >
user_sex = #{userSex,jdbcType=VARCHAR},
</if>
<if test="userAge != null" >
user_age = #{userAge,jdbcType=VARCHAR},
</if>
<if test="userRole != null" >
user_role = #{userRole,jdbcType=VARCHAR}
</if>
</trim>
</insert>

<!--根据 user_id 更新用户信息-->
<update id="updateUserById" parameterType="com.example.pojo.User" >
update user
Expand Down
59 changes: 1 addition & 58 deletions ssm_project/target/classes/mapper/UserMapper.xml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@

<!--查询用户个数-->
<select id="getRowCount" resultType="java.lang.Integer">
select count(*) from USER
select count(*) from user
<where>
<if test="userName != null and userName !=''">
and user_name like concat('%', #{userName}, '%')
Expand All @@ -66,63 +66,6 @@
where user_id = #{userId,jdbcType=VARCHAR}
</delete>

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

<insert id="insertSelective" parameterType="com.example.pojo.User" >
insert into user
<trim prefix="(" suffix=")" suffixOverrides="," >
<if test="userId != null" >
user_id,
</if>
<if test="cardNo != null" >
card_no,
</if>
<if test="cardType != null" >
card_type,
</if>
<if test="userName != null" >
user_name,
</if>
<if test="userSex != null" >
user_sex,
</if>
<if test="userAge != null" >
user_age,
</if>
<if test="userRole != null" >
user_role,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides="," >
<if test="userId != null" >
user_id = #{userId,jdbcType=VARCHAR},
</if>
<if test="cardNo != null" >
card_no = #{cardType,jdbcType=VARCHAR},
</if>
<if test="cardType != null" >
card_type = #{cardType,jdbcType=VARCHAR},
</if>
<if test="userName != null" >
user_name = #{userName,jdbcType=VARCHAR},
</if>
<if test="userSex != null" >
user_sex = #{userSex,jdbcType=VARCHAR},
</if>
<if test="userAge != null" >
user_age = #{userAge,jdbcType=VARCHAR},
</if>
<if test="userRole != null" >
user_role = #{userRole,jdbcType=VARCHAR}
</if>
</trim>
</insert>

<!--根据 user_id 更新用户信息-->
<update id="updateUserById" parameterType="com.example.pojo.User" >
update user
Expand Down
17 changes: 14 additions & 3 deletions vue_project/src/components/UserHome.vue
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,16 @@
</el-form>

<el-table
ref="multipleTable"
:data="tableData"
border="true"
border
highlight-current-row
style="width: 100%">
style="width: 100%"
@selection-change="handleSelectionDelete">
<el-table-column
type="selection"
width="55">
</el-table-column>
<el-table-column
label="用户编号">
<template slot-scope="scope">
Expand Down Expand Up @@ -236,7 +242,8 @@
pageSize: 5,
currentPage: 1,
total: 0,
disablePage: false
disablePage: false,
multipleSelection: []
};
},
Expand Down Expand Up @@ -379,6 +386,10 @@
.catch(_ => {});
},
handleSelectionDelete(val) {
this.multipleSelection = val;
},
/**
* 清空绑定数据
*/
Expand Down

0 comments on commit edbb104

Please sign in to comment.