| | |
| | | |
| | | import com.whyc.pojo.UserInf; |
| | | |
| | | import java.util.List; |
| | | |
| | | public interface UserInfMapper extends CustomMapper<UserInf>{ |
| | | //查询密码 |
| | | String selectSnId(String uname); |
| | | //判断是否存在普通用户(uid>100),若无,初始为1001 |
| | | int judgeUname(); |
| | | } |
| | |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | @TableId(value = "uid", type = IdType.AUTO) |
| | | private int uid; |
| | | |
| | | @ApiModelProperty(value = "rsa加密密码") |
| | |
| | | //新添加用户信息 |
| | | public Response addUser(UserInf uinf) { |
| | | QueryWrapper wrapper=new QueryWrapper(); |
| | | //判断是否存在普通用户(uid>100),若无,初始为1001 |
| | | int judgecount=mapper.judgeUname(); |
| | | if(judgecount==0){ |
| | | uinf.setUid(1001); |
| | | } |
| | | String pwd= RSAUtil.encrypt("123456", RSAUtil.getPublicKey()); |
| | | uinf.setUsnid(pwd); |
| | | wrapper.eq("uname",uinf.getUname()); |
| | |
| | | |
| | | |
| | | <select id="selectSnId" resultType="java.lang.String"> |
| | | select usnid from tb_doc_user where uname=#{uname} limit 1 |
| | | select usnid from tb_user_inf where uname=#{uname} limit 1 |
| | | </select> |
| | | <select id="judgeUname" resultType="java.lang.Integer"> |
| | | select count(*) from tb_user_inf where uid>100 |
| | | </select> |
| | | </mapper> |