提交 3b74b945 编写于 作者: cxt104926's avatar cxt104926

优化

上级 3c1c3ed0
...@@ -9,6 +9,7 @@ import com.stu.stusystem.service.system.dto.UserManagerDTO; ...@@ -9,6 +9,7 @@ import com.stu.stusystem.service.system.dto.UserManagerDTO;
import com.stu.stusystem.service.system.dto.UserManagerQuery; import com.stu.stusystem.service.system.dto.UserManagerQuery;
import com.stu.stusystem.service.system.vo.StuUserVO; import com.stu.stusystem.service.system.vo.StuUserVO;
import com.stu.stusystem.util.CopyBeanUtil; import com.stu.stusystem.util.CopyBeanUtil;
import com.stu.stusystem.util.StrUtil;
import org.apache.shiro.SecurityUtils; import org.apache.shiro.SecurityUtils;
import org.apache.shiro.crypto.hash.Sha1Hash; import org.apache.shiro.crypto.hash.Sha1Hash;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -38,6 +39,10 @@ public class UserManagerService { ...@@ -38,6 +39,10 @@ public class UserManagerService {
public PageInfo<StuUserVO> getStuMangerPage(UserManagerQuery query) { public PageInfo<StuUserVO> getStuMangerPage(UserManagerQuery query) {
PageHelper.startPage(query.getPage(), query.getLimit()); PageHelper.startPage(query.getPage(), query.getLimit());
List<StuUserVO> stuMangerPage = this.stuMapper.getStuMangerPage(query); List<StuUserVO> stuMangerPage = this.stuMapper.getStuMangerPage(query);
for (StuUserVO vo : stuMangerPage) {
String s = StrUtil.hideSix(vo.getIdCard());
vo.setIdCard(s);
}
return new PageInfo<>(stuMangerPage); return new PageInfo<>(stuMangerPage);
} }
......
...@@ -21,6 +21,9 @@ public class StuUserVO { ...@@ -21,6 +21,9 @@ public class StuUserVO {
@ApiModelProperty("班级id") @ApiModelProperty("班级id")
private String classId; private String classId;
@ApiModelProperty("班级id")
private String className;
@ApiModelProperty("联系电话") @ApiModelProperty("联系电话")
private String phone; private String phone;
......
package com.stu.stusystem.util;
/**
* @author: cxt
* @time: 2021/6/29
* 简单的字符串工具类
*/
public class StrUtil {
/**
* 隐藏身份证号中间6位
*/
public static String hideSix(String str) {
if (str.equals("")) {
return "";
}
if (str.length() == 18){
return str.replaceAll("(\\d{6})\\d{6}(\\w{6})", "$1******$2");
}else {
return str.replaceAll("(\\d{5})\\d{5}(\\w{5})", "$1*****$2");
}
}
}
\ No newline at end of file
...@@ -2,24 +2,25 @@ ...@@ -2,24 +2,25 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.stu.stusystem.mapper.system.StuMapper"> <mapper namespace="com.stu.stusystem.mapper.system.StuMapper">
<select id="getStuMangerPage" resultType="com.stu.stusystem.service.system.vo.StuUserVO"> <select id="getStuMangerPage" resultType="com.stu.stusystem.service.system.vo.StuUserVO">
SELECT id, SELECT su.id,
name, su.name,
account, su.account,
class_id AS classId, su.class_id AS classId,
phone, su.phone,
id_card AS idCard su.id_card AS idCard,
FROM stu_user sc.name AS className
<where> FROM stu_user su
<if test="query.name != null and query.name != ''"> LEFT JOIN stu_class sc ON sc.id = su.class_id
name like concat('%', #{query.name}, '%') WHERE su.account != 'admin'
</if> <if test="query.name != null and query.name != ''">
<if test="param1.classId != null and param1.classId != ''"> AND su.name like concat('%', #{query.name}, '%')
AND class_id = #{query.classId} </if>
</if> <if test="param1.classId != null and param1.classId != ''">
<if test="query.phone != null and query.phone != ''"> AND su.class_id = #{query.classId}
AND phone = #{query.phone} </if>
</if> <if test="query.phone != null and query.phone != ''">
</where> AND su.phone = #{query.phone}
</if>
</select> </select>
<resultMap id="getWhole" type="java.util.Map"> <resultMap id="getWhole" type="java.util.Map">
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册