更新用户表的登录用户名的字段

This commit is contained in:
季圣华
2020-03-31 21:08:09 +08:00
parent e45e3b119e
commit f954061dba
16 changed files with 176 additions and 169 deletions

View File

@@ -1085,7 +1085,7 @@ DROP TABLE IF EXISTS `jsh_user`;
CREATE TABLE `jsh_user` (
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键',
`username` varchar(255) NOT NULL COMMENT '用户姓名--例如张三',
`loginame` varchar(255) DEFAULT NULL COMMENT '登录用户名--可能为空',
`login_name` varchar(255) NOT NULL COMMENT '登录用户名',
`password` varchar(50) DEFAULT NULL COMMENT '登陆密码',
`position` varchar(200) DEFAULT NULL COMMENT '职位',
`department` varchar(255) DEFAULT NULL COMMENT '所属部门',

View File

@@ -750,3 +750,10 @@ alter table jsh_depothead drop column AllocationProjectId;
alter table jsh_unit add basic_unit varchar(50) DEFAULT NULL COMMENT '基础单位' after UName;
alter table jsh_unit add other_unit varchar(50) DEFAULT NULL COMMENT '副单位' after basic_unit;
alter table jsh_unit add ratio INT DEFAULT NULL COMMENT '比例' after other_unit;
-- ----------------------------
-- 时间2020年03月31日
-- by jishenghua
-- 给用户表增加 登录用户名 字段
-- ----------------------------
alter table jsh_user change loginame login_name varchar(255) NOT NULL COMMENT '登录用户名';

View File

@@ -4,7 +4,7 @@
* @author jishenghua
* @version 2019-09-14
*/
$("#username, #password").on("focus blur", function () {
$("#loginName, #password").on("focus blur", function () {
var a = this;
setTimeout(function () {
var b = $(a).css("borderColor");
@@ -14,10 +14,10 @@ $("#username, #password").on("focus blur", function () {
}, 100)
}).blur();
var userName = localStorage.getItem("username");
var loginName = localStorage.getItem("loginName");
var password = localStorage.getItem("password");
if(userName){
$("#username").val(userName);
if(loginName){
$("#loginName").val(loginName);
setTimeout(function() {
$("#rememberUserCode").parent().addClass("checked");
},200);
@@ -36,8 +36,8 @@ $(document).keydown(function (event) {
var k = e.keyCode || e.which || e.charCode;
//兼容 IE,firefox 兼容
var obj = e.srcElement ? e.srcElement : e.target;
//绑定键盘事件为 username 和password的输入框才可以触发键盘事件 13键盘事件
if (k == "13" && (obj.id == "username" || obj.id == "password"))
//绑定键盘事件为 loginName 和password的输入框才可以触发键盘事件 13键盘事件
if (k == "13" && (obj.id == "loginName" || obj.id == "password"))
loginFun();
});
@@ -45,39 +45,38 @@ $(document).keydown(function (event) {
$('#btnSubmit').off("click").on("click", function () {
var rememberUserCode = $("#rememberUserCode").parent().hasClass("checked");
var rememberMe = $("#rememberMe").parent().hasClass("checked");
localStorage.removeItem("username");
localStorage.removeItem("loginName");
localStorage.removeItem("password");
if(rememberUserCode) {
localStorage.setItem("username",$("#username").val());
localStorage.setItem("loginName",$("#loginName").val());
}
if(rememberMe) {
localStorage.setItem("username",$("#username").val());
localStorage.setItem("loginName",$("#loginName").val());
localStorage.setItem("password",$("#password").val());
}
loginFun();
});
//检测用户输入数据
function loginFun() {
var username = $.trim($('#username').val());
var loginName = $.trim($('#loginName').val());
var password = $.trim($('#password').val());
if (null == username || 0 == username.length) {
$("#username").val("").focus();
if (null == loginName || 0 == loginName.length) {
$("#loginName").val("").focus();
return;
}
if (null == password || 0 == password.length) {
$("#password").val("").focus();
return;
}
if (username != null && username.length != 0
if (loginName != null && loginName.length != 0
&& password != null && password.length != 0) {
$("#username").focus();
$("#loginName").focus();
$.ajax({
type: "post",
url: "/user/login",
dataType: "json",
data: ({
loginName: username,
loginName: loginName,
password: hex_md5(password)
}),
success: function (res) {
@@ -85,7 +84,7 @@ function loginFun() {
var loginInfoTip = res.data.msgTip;
//用户名不存在,清空输入框并定位到用户名输入框
if (loginInfoTip.indexOf("user is not exist") != -1) {
$("#username").val("").focus();
$("#loginName").val("").focus();
$("#password").val("");
alert("用户名不存在");
return;
@@ -109,7 +108,7 @@ function loginFun() {
if(res.data.user) {
var user = res.data.user;
sessionStorage.setItem("userId", user.id);
sessionStorage.setItem("loginName", user.loginame);
sessionStorage.setItem("loginName", user.loginName);
top.location.href = "/index.html";
}
}

View File

@@ -40,7 +40,7 @@
<div class="login-box-body">
<div class="form-group has-feedback">
<span class="glyphicon glyphicon-user form-control-feedback" title="登录账号"></span>
<input type="text" id="username" name="username" class="form-control required"
<input type="text" id="loginName" name="loginName" class="form-control required"
data-msg-required="请填写登录账号." placeholder="登录账号"/>
</div>
<div class="form-group has-feedback">

View File

@@ -24,7 +24,7 @@
<div class="form-group">
<label class="control-label">登录名称:</label>
<div class="control-inline">
<input type="text" id="searchLoginame" name="searchLoginame" value="" maxlength="100" class="easyui-textbox width-90"/>
<input type="text" id="searchLoginName" name="searchLoginName" value="" maxlength="100" class="easyui-textbox width-90"/>
</div>
</div>
<div class="form-group">
@@ -51,24 +51,11 @@
<tr>
<td>登录名称</td>
<td style="padding:5px">
<input name="loginame" id="loginame" class="easyui-textbox"
<input name="loginName" id="loginName" class="easyui-textbox"
data-options="required:true,validType:'length[2,15]'" style="width: 120px;"/>
初始密码123456
</td>
</tr>
<tr>
<td>部门</td>
<td style="padding:5px">
<input name="orgAbr" id="orgAbr" class="easyui-textbox" style="width: 120px;"/>
<a href="javascript:void(0)" class="l-btn l-btn-plain" group="" id="lookForSelectOrganization">
<span class="l-btn-left"><span class="l-btn-text icon-search l-btn-icon-left" style="height:20px;"></span></span></a>
<input name="orgaId" id="orgaId" type="hidden"/>
<input name="selectType" id="selectType" type="hidden"/>
<input name="orgaUserRelId" id="orgaUserRelId" type="hidden"/>
<!--一个兼容input框没有实际用处但是必须存在-->
<input name="id" id="id" type="hidden"/>
</td>
</tr>
<tr>
<td>
用户姓名
@@ -78,6 +65,19 @@
data-options="required:true,validType:'length[2,30]'" style="width: 230px;"/>
</td>
</tr>
<tr>
<td>部门</td>
<td style="padding:5px">
<input name="orgAbr" id="orgAbr" class="easyui-textbox" readonly style="width: 120px;"/>
<a href="javascript:void(0)" class="l-btn l-btn-plain" group="" id="lookForSelectOrganization">
<span class="l-btn-left"><span class="l-btn-text icon-search l-btn-icon-left" style="height:20px;"></span></span></a>
<input name="orgaId" id="orgaId" type="hidden"/>
<input name="selectType" id="selectType" type="hidden"/>
<input name="orgaUserRelId" id="orgaUserRelId" type="hidden"/>
<!--一个兼容input框没有实际用处但是必须存在-->
<input name="id" id="id" type="hidden"/>
</td>
</tr>
<tr>
<td>
职位
@@ -186,7 +186,7 @@
return str;
}
},
{title: '登录名称', field: 'loginame', width: 80},
{title: '登录名称', field: 'loginName', width: 80},
{title: '用户姓名', field: 'username', width: 80, align: "center"},
{title: '职位', field: 'position', width: 115, align: "center"},
{title: '部门', field: 'orgAbr', width: 115, align: "center"},
@@ -237,7 +237,7 @@
}
//搜索按钮添加快捷键
if (k == "13" && (obj.id == "searchUsername" || obj.id == "searchLoginame" || obj.id == "searchPhonenum"
if (k == "13" && (obj.id == "searchUsername" || obj.id == "searchLoginName" || obj.id == "searchPhonenum"
|| obj.id == "searchPosition" || obj.id == "searchEmail" || obj.id == "searchDesc" || obj.id == "searchDept")) {
$("#searchBtn").click();
}
@@ -352,8 +352,6 @@
//增加用户
var url;
var userID = 0;
//保存编辑前的名称
var oldLoginName = "";
function addUser() {
if(checkPower()){
@@ -366,7 +364,6 @@
$('#usernameFM').form('load', row);
$("#username").focus();
$("#loginame").removeAttr("readonly");
oldLoginName = "";
userID = 0;
/**机构选择*/
$("#selectType").val("org");
@@ -401,40 +398,45 @@
//保存用户信息
$("#saveusername").off("click").on("click", function () {
/**
* 2019-03-12
* 此处用户名和登录名是否重复的校验在保存操作时处理
* */
var reg = /^([0-9])+$/;
var phonenum = $.trim($("#phonenum").val());
if (phonenum.length > 0 && !reg.test(phonenum)) {
$.messager.alert('提示', '电话号码只能是数字', 'info');
$("#phonenum").val("").focus();
if(!$('#usernameFM').form('validate')){
return;
}
$.ajax({
url: url,
type: "post",
dataType: "json",
data: {
info: JSON.stringify($("#usernameFM").serializeObject())
},
success: function(res) {
if(res && res.code != 200) {
$.messager.alert('提示', res.msg, 'error');
return;
}
$('#userDlg').dialog('close');
//加载完以后重新初始化
var opts = $("#tableData").datagrid('options');
showUserDetails(opts.pageNumber, opts.pageSize);
},
//此处添加错误处理
error: function () {
$.messager.alert('提示', '网络异常,请稍后再试!', 'error');
else {
/**
* 2019-03-12
* 此处用户名和登录名是否重复的校验在保存操作时处理
* */
var reg = /^([0-9])+$/;
var phonenum = $.trim($("#phonenum").val());
if (phonenum.length > 0 && !reg.test(phonenum)) {
$.messager.alert('提示', '电话号码只能是数字', 'info');
$("#phonenum").val("").focus();
return;
}
});
$.ajax({
url: url,
type: "post",
dataType: "json",
data: {
info: JSON.stringify($("#usernameFM").serializeObject())
},
success: function (res) {
if (res && res.code != 200) {
$.messager.alert('提示', res.msg, 'error');
return;
}
$('#userDlg').dialog('close');
//加载完以后重新初始化
var opts = $("#tableData").datagrid('options');
showUserDetails(opts.pageNumber, opts.pageSize);
},
//此处添加错误处理
error: function () {
$.messager.alert('提示', '网络异常,请稍后再试!', 'error');
return;
}
});
}
});
//编辑用户信息
@@ -442,7 +444,7 @@
var rowsdata = $("#tableData").datagrid("getRows")[index];
var row = {
username: rowsdata.username,
loginame: rowsdata.loginame,
loginName: rowsdata.loginName,
position: rowsdata.position,
email: rowsdata.email,
phonenum: rowsdata.phonenum,
@@ -452,14 +454,13 @@
orgaUserRelId: rowsdata.orgaUserRelId,
userBlngOrgaDsplSeq: rowsdata.userBlngOrgaDsplSeq
};
oldLoginName = rowsdata.username;
$('#userDlg').dialog('open').dialog('setTitle', '<img src="/js/easyui/themes/icons/pencil.png"/>&nbsp;编辑用户信息');
$(".window-mask").css({width: webW, height: webH});
$('#usernameFM').form('load', row);
userID = rowsdata.id;
//焦点在名称输入框==定焦在输入文字后面
$("#username").val("").focus().val(rowsdata.username);
$("#loginame").attr("readonly","readonly");
$("#loginName").attr("readonly","readonly");
/**机构选择*/
$("#selectType").val("org");
url = '/user/updateUser?id=' + rowsdata.id;
@@ -484,7 +485,7 @@
function showUserDetails(pageNo, pageSize) {
var userName = $.trim($("#searchUsername").val());
var loginName = $.trim($("#searchLoginame").val());
var loginName = $.trim($("#searchLoginName").val());
$.ajax({
type: "get",
url: "/user/getUserList",
@@ -516,7 +517,7 @@
$("#searchResetBtn").unbind().bind({
click: function () {
$("#searchUsername").textbox("setValue","");
$("#searchLoginame").textbox("setValue","");
$("#searchLoginName").textbox("setValue","");
$("#searchPhonenum").textbox("setValue","");
$("#searchPosition").textbox("setValue","");
$("#searchDept").textbox("setValue","");

View File

@@ -43,7 +43,7 @@
<div class="register-box-body">
<div class="form-group has-feedback">
<span class="glyphicon glyphicon-user form-control-feedback" title="登录账户"></span>
<input type="text" id="username" name="username" class="form-control required"
<input type="text" id="loginName" name="loginName" class="form-control required"
data-msg-required="请填写登录账号." placeholder="登录账户(请输入手机号码"/>
</div>
<div class="form-group has-feedback">
@@ -106,7 +106,7 @@
</body>
<script>
$("#username, #password, #confirmPassword").on("focus blur", function () {
$("#loginName, #password, #confirmPassword").on("focus blur", function () {
var a = this;
setTimeout(function () {
var b = $(a).css("borderColor");
@@ -121,10 +121,10 @@
if($("#validCode").val()) {
var res = verifyCode.validate($("#validCode").val());
if(res){
var userName = $("#username");
if(!userName.val()) {
var loginName = $("#loginName");
if(!loginName.val()) {
alert("登录账户不能为空!");
} else if(!isPhoneAvailable(userName)) {
} else if(!isPhoneAvailable(loginName)) {
alert("请输入正确的手机号码!");
} else if(!$("#password").val()) {
alert("登录密码不能为空!");
@@ -140,7 +140,7 @@
url: "/user/registerUser",
dataType: "json",
data: ({
loginame: $("#username").val(),
loginName: $("#loginName").val(),
password: $("#password").val()
}),
success: function (res) {

View File

@@ -55,7 +55,7 @@ public class TenantConfig {
Object userInfo = request.getSession().getAttribute("user");
if(userInfo != null) {
User user = (User) userInfo;
loginName = user.getLoginame();
loginName = user.getLoginName();
}
if(("admin").equals(loginName)) {
return true;

View File

@@ -149,7 +149,7 @@ public class FunctionsController {
Object userInfo = request.getSession().getAttribute("user");
if(userInfo != null) {
User user = (User) userInfo;
loginName = user.getLoginame();
loginName = user.getLoginName();
}
if(("admin").equals(loginName)) {
dataList.add(fun);

View File

@@ -67,7 +67,7 @@ public class UserController {
User user=null;
BaseResponseInfo res = new BaseResponseInfo();
try {
String username = loginName.trim();
loginName = loginName.trim();
password = password.trim();
//判断用户是否已经登录过,登录过不再处理
Object userInfo = request.getSession().getAttribute("user");
@@ -75,18 +75,18 @@ public class UserController {
if (userInfo != null) {
sessionUser = (User) userInfo;
}
if (sessionUser != null && username.equalsIgnoreCase(sessionUser.getLoginame())) {
logger.info("====用户 " + username + "已经登录过, login 方法调用结束====");
if (sessionUser != null && loginName.equalsIgnoreCase(sessionUser.getLoginName())) {
logger.info("====用户 " + loginName + "已经登录过, login 方法调用结束====");
msgTip = "user already login";
}
//获取用户状态
int userStatus = -1;
try {
request.getSession().removeAttribute("tenantId");
userStatus = userService.validateUser(username, password);
userStatus = userService.validateUser(loginName, password);
} catch (Exception e) {
e.printStackTrace();
logger.error(">>>>>>>>>>>>>用户 " + username + " 登录 login 方法 访问服务层异常====", e);
logger.error(">>>>>>>>>>>>>用户 " + loginName + " 登录 login 方法 访问服务层异常====", e);
msgTip = "access service exception";
}
switch (userStatus) {
@@ -106,7 +106,7 @@ public class UserController {
try {
msgTip = "user can login";
//验证通过 可以登录放入session记录登录日志
user = userService.getUserByUserName(username);
user = userService.getUserByLoginName(loginName);
request.getSession().setAttribute("user",user);
if(user.getTenantId()!=null) {
Tenant tenant = tenantService.getTenantByTenantId(user.getTenantId());
@@ -126,7 +126,7 @@ public class UserController {
((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
} catch (Exception e) {
e.printStackTrace();
logger.error(">>>>>>>>>>>>>>>查询用户名为:" + username + " ,用户信息异常", e);
logger.error(">>>>>>>>>>>>>>>查询用户名为:" + loginName + " ,用户信息异常", e);
}
break;
}
@@ -213,7 +213,7 @@ public class UserController {
String oldPassword = Tools.md5Encryp(oldpwd);
String md5Pwd = Tools.md5Encryp(password);
//必须和原始密码一致才可以更新密码
if(user.getLoginame().equals("jsh")){
if(user.getLoginName().equals("jsh")){
flag = 3; //管理员jsh不能修改密码
} else if (oldPassword.equalsIgnoreCase(user.getPassword())) {
user.setPassword(md5Pwd);
@@ -330,19 +330,19 @@ public class UserController {
/**
* 注册用户
* @param loginame
* @param loginName
* @param password
* @return
* @throws Exception
*/
@PostMapping(value = "/registerUser")
public Object registerUser(@RequestParam(value = "loginame", required = false) String loginame,
public Object registerUser(@RequestParam(value = "loginName", required = false) String loginName,
@RequestParam(value = "password", required = false) String password,
HttpServletRequest request)throws Exception{
JSONObject result = ExceptionConstants.standardSuccess();
UserEx ue= new UserEx();
ue.setUsername(loginame);
ue.setLoginame(loginame);
ue.setUsername(loginName);
ue.setLoginName(loginName);
ue.setPassword(password);
userService.checkUserNameAndLoginName(ue); //检查用户名和登录名
ue = userService.registerUser(ue,manageRoleId,request);

View File

@@ -5,7 +5,7 @@ public class User {
private String username;
private String loginame;
private String loginName;
private String password;
@@ -45,12 +45,12 @@ public class User {
this.username = username == null ? null : username.trim();
}
public String getLoginame() {
return loginame;
public String getLoginName() {
return loginName;
}
public void setLoginame(String loginame) {
this.loginame = loginame == null ? null : loginame.trim();
public void setLoginName(String loginName) {
this.loginName = loginName == null ? null : loginName.trim();
}
public String getPassword() {

View File

@@ -234,73 +234,73 @@ public class UserExample {
return (Criteria) this;
}
public Criteria andLoginameIsNull() {
addCriterion("loginame is null");
public Criteria andLoginNameIsNull() {
addCriterion("login_name is null");
return (Criteria) this;
}
public Criteria andLoginameIsNotNull() {
addCriterion("loginame is not null");
public Criteria andLoginNameIsNotNull() {
addCriterion("login_name is not null");
return (Criteria) this;
}
public Criteria andLoginameEqualTo(String value) {
addCriterion("loginame =", value, "loginame");
public Criteria andLoginNameEqualTo(String value) {
addCriterion("login_name =", value, "loginName");
return (Criteria) this;
}
public Criteria andLoginameNotEqualTo(String value) {
addCriterion("loginame <>", value, "loginame");
public Criteria andLoginNameNotEqualTo(String value) {
addCriterion("login_name <>", value, "loginName");
return (Criteria) this;
}
public Criteria andLoginameGreaterThan(String value) {
addCriterion("loginame >", value, "loginame");
public Criteria andLoginNameGreaterThan(String value) {
addCriterion("login_name >", value, "loginName");
return (Criteria) this;
}
public Criteria andLoginameGreaterThanOrEqualTo(String value) {
addCriterion("loginame >=", value, "loginame");
public Criteria andLoginNameGreaterThanOrEqualTo(String value) {
addCriterion("login_name >=", value, "loginName");
return (Criteria) this;
}
public Criteria andLoginameLessThan(String value) {
addCriterion("loginame <", value, "loginame");
public Criteria andLoginNameLessThan(String value) {
addCriterion("login_name <", value, "loginName");
return (Criteria) this;
}
public Criteria andLoginameLessThanOrEqualTo(String value) {
addCriterion("loginame <=", value, "loginame");
public Criteria andLoginNameLessThanOrEqualTo(String value) {
addCriterion("login_name <=", value, "loginName");
return (Criteria) this;
}
public Criteria andLoginameLike(String value) {
addCriterion("loginame like", value, "loginame");
public Criteria andLoginNameLike(String value) {
addCriterion("login_name like", value, "loginName");
return (Criteria) this;
}
public Criteria andLoginameNotLike(String value) {
addCriterion("loginame not like", value, "loginame");
public Criteria andLoginNameNotLike(String value) {
addCriterion("login_name not like", value, "loginName");
return (Criteria) this;
}
public Criteria andLoginameIn(List<String> values) {
addCriterion("loginame in", values, "loginame");
public Criteria andLoginNameIn(List<String> values) {
addCriterion("login_name in", values, "loginName");
return (Criteria) this;
}
public Criteria andLoginameNotIn(List<String> values) {
addCriterion("loginame not in", values, "loginame");
public Criteria andLoginNameNotIn(List<String> values) {
addCriterion("login_name not in", values, "loginName");
return (Criteria) this;
}
public Criteria andLoginameBetween(String value1, String value2) {
addCriterion("loginame between", value1, value2, "loginame");
public Criteria andLoginNameBetween(String value1, String value2) {
addCriterion("login_name between", value1, value2, "loginName");
return (Criteria) this;
}
public Criteria andLoginameNotBetween(String value1, String value2) {
addCriterion("loginame not between", value1, value2, "loginame");
public Criteria andLoginNameNotBetween(String value1, String value2) {
addCriterion("login_name not between", value1, value2, "loginName");
return (Criteria) this;
}

View File

@@ -26,7 +26,7 @@ public interface UserMapperEx {
List<UserEx> getUserList(Map<String, Object> parameterMap);
List<User> getUserListByUserNameOrLoginName(@Param("userName") String userName,
@Param("loginame") String loginame);
@Param("loginName") String loginName);
int batDeleteOrUpdateUser(@Param("ids") String ids[], @Param("status") byte status);

View File

@@ -155,8 +155,8 @@ public class MaterialExtendService {
materialExtend.setDeleteFlag(BusinessConstants.DELETE_FLAG_EXISTS);
materialExtend.setCreateTime(new Date());
materialExtend.setUpdateTime(new Date().getTime());
materialExtend.setCreateSerial(user.getLoginame());
materialExtend.setUpdateSerial(user.getLoginame());
materialExtend.setCreateSerial(user.getLoginName());
materialExtend.setUpdateSerial(user.getLoginName());
int result =0;
try{
result= materialExtendMapper.insertSelective(materialExtend);
@@ -170,7 +170,7 @@ public class MaterialExtendService {
public int updateMaterialExtend(MaterialExtend MaterialExtend, HttpServletRequest request) throws Exception{
User user = userService.getCurrentUser();
MaterialExtend.setUpdateTime(new Date().getTime());
MaterialExtend.setUpdateSerial(user.getLoginame());
MaterialExtend.setUpdateSerial(user.getLoginName());
int res =0;
try{
res= materialExtendMapper.updateByPrimaryKeySelective(MaterialExtend);
@@ -205,7 +205,7 @@ public class MaterialExtendService {
Object userInfo = request.getSession().getAttribute("user");
User user = (User)userInfo;
materialExtend.setUpdateTime(new Date().getTime());
materialExtend.setUpdateSerial(user.getLoginame());
materialExtend.setUpdateSerial(user.getLoginName());
try{
result= materialExtendMapper.updateByPrimaryKeySelective(materialExtend);
}catch(Exception e){

View File

@@ -224,12 +224,12 @@ public class UserService {
return result;
}
public int validateUser(String username, String password) throws Exception {
public int validateUser(String loginName, String password) throws Exception {
/**默认是可以登录的*/
List<User> list = null;
try {
UserExample example = new UserExample();
example.createCriteria().andLoginameEqualTo(username).andStatusEqualTo(BusinessConstants.USER_STATUS_NORMAL);
example.createCriteria().andLoginNameEqualTo(loginName).andStatusEqualTo(BusinessConstants.USER_STATUS_NORMAL);
list = userMapper.selectByExample(example);
} catch (Exception e) {
logger.error(">>>>>>>>访问验证用户姓名是否存在后台信息异常", e);
@@ -242,7 +242,7 @@ public class UserService {
try {
UserExample example = new UserExample();
example.createCriteria().andLoginameEqualTo(username).andPasswordEqualTo(password)
example.createCriteria().andLoginNameEqualTo(loginName).andPasswordEqualTo(password)
.andStatusEqualTo(BusinessConstants.USER_STATUS_NORMAL);
list = userMapper.selectByExample(example);
} catch (Exception e) {
@@ -256,9 +256,9 @@ public class UserService {
return ExceptionCodeConstants.UserExceptionCode.USER_CONDITION_FIT;
}
public User getUserByUserName(String username)throws Exception {
public User getUserByLoginName(String loginName)throws Exception {
UserExample example = new UserExample();
example.createCriteria().andLoginameEqualTo(username).andStatusEqualTo(BusinessConstants.USER_STATUS_NORMAL);
example.createCriteria().andLoginNameEqualTo(loginName).andStatusEqualTo(BusinessConstants.USER_STATUS_NORMAL);
List<User> list=null;
try{
list= userMapper.selectByExample(example);
@@ -277,7 +277,7 @@ public class UserService {
List <Byte> userStatus=new ArrayList<Byte>();
userStatus.add(BusinessConstants.USER_STATUS_DELETE);
userStatus.add(BusinessConstants.USER_STATUS_BANNED);
example.createCriteria().andIdNotEqualTo(id).andLoginameEqualTo(name).andStatusNotIn(userStatus);
example.createCriteria().andIdNotEqualTo(id).andLoginNameEqualTo(name).andStatusNotIn(userStatus);
List<User> list=null;
try{
list= userMapper.selectByExample(example);
@@ -317,7 +317,7 @@ public class UserService {
public Long getIdByLoginName(String loginName) {
Long userId = 0L;
UserExample example = new UserExample();
example.createCriteria().andLoginameEqualTo(loginName).andStatusEqualTo(BusinessConstants.USER_STATUS_NORMAL);
example.createCriteria().andLoginNameEqualTo(loginName).andStatusEqualTo(BusinessConstants.USER_STATUS_NORMAL);
List<User> list = userMapper.selectByExample(example);
if(list!=null) {
userId = list.get(0).getId();
@@ -327,7 +327,7 @@ public class UserService {
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
public void addUserAndOrgUserRel(UserEx ue) throws Exception{
if(BusinessConstants.DEFAULT_MANAGER.equals(ue.getLoginame())) {
if(BusinessConstants.DEFAULT_MANAGER.equals(ue.getLoginName())) {
throw new BusinessRunTimeException(ExceptionConstants.USER_NAME_LIMIT_USE_CODE,
ExceptionConstants.USER_NAME_LIMIT_USE_MSG);
} else {
@@ -353,7 +353,7 @@ public class UserService {
//机构id
oul.setOrgaId(ue.getOrgaId());
//用户id根据用户名查询id
Long userId = getIdByLoginName(ue.getLoginame());
Long userId = getIdByLoginName(ue.getLoginName());
oul.setUserId(userId);
//用户在机构中的排序
oul.setUserBlngOrgaDsplSeq(ue.getUserBlngOrgaDsplSeq());
@@ -403,7 +403,7 @@ public class UserService {
* description:
* 多次创建事务,事物之间无法协同,应该在入口处创建一个事务以做协调
*/
if(BusinessConstants.DEFAULT_MANAGER.equals(ue.getLoginame())) {
if(BusinessConstants.DEFAULT_MANAGER.equals(ue.getLoginName())) {
throw new BusinessRunTimeException(ExceptionConstants.USER_NAME_LIMIT_USE_CODE,
ExceptionConstants.USER_NAME_LIMIT_USE_MSG);
} else {
@@ -416,7 +416,7 @@ public class UserService {
int result=0;
try{
result= userMapper.insertSelective(ue);
Long userId = getIdByLoginName(ue.getLoginame());
Long userId = getIdByLoginName(ue.getLoginName());
ue.setId(userId);
}catch(Exception e){
JshException.writeFail(logger, e);
@@ -437,7 +437,7 @@ public class UserService {
//创建租户信息
JSONObject tenantObj = new JSONObject();
tenantObj.put("tenantId", ue.getId());
tenantObj.put("loginName",ue.getLoginame());
tenantObj.put("loginName",ue.getLoginName());
String param = tenantObj.toJSONString();
tenantService.insertTenant(param, request);
logger.info("===============创建租户信息完成===============");
@@ -461,7 +461,7 @@ public class UserService {
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
public void updateUserAndOrgUserRel(UserEx ue) throws Exception{
if(BusinessConstants.DEFAULT_MANAGER.equals(ue.getLoginame())) {
if(BusinessConstants.DEFAULT_MANAGER.equals(ue.getLoginName())) {
throw new BusinessRunTimeException(ExceptionConstants.USER_NAME_LIMIT_USE_CODE,
ExceptionConstants.USER_NAME_LIMIT_USE_MSG);
} else {
@@ -535,8 +535,8 @@ public class UserService {
}
Long userId=userEx.getId();
//检查登录名
if(!StringUtils.isEmpty(userEx.getLoginame())){
String loginName=userEx.getLoginame();
if(!StringUtils.isEmpty(userEx.getLoginName())){
String loginName=userEx.getLoginName();
list=this.getUserListByloginName(loginName);
if(list!=null&&list.size()>0){
if(list.size()>1){

View File

@@ -4,7 +4,7 @@
<resultMap id="BaseResultMap" type="com.jsh.erp.datasource.entities.User">
<id column="id" jdbcType="BIGINT" property="id" />
<result column="username" jdbcType="VARCHAR" property="username" />
<result column="loginame" jdbcType="VARCHAR" property="loginame" />
<result column="login_name" jdbcType="VARCHAR" property="loginName" />
<result column="password" jdbcType="VARCHAR" property="password" />
<result column="position" jdbcType="VARCHAR" property="position" />
<result column="department" jdbcType="VARCHAR" property="department" />
@@ -76,7 +76,7 @@
</where>
</sql>
<sql id="Base_Column_List">
id, username, loginame, password, position, department, email, phonenum, ismanager,
id, username, login_name, password, position, department, email, phonenum, ismanager,
isystem, Status, description, remark, tenant_id
</sql>
<select id="selectByExample" parameterType="com.jsh.erp.datasource.entities.UserExample" resultMap="BaseResultMap">
@@ -110,12 +110,12 @@
</if>
</delete>
<insert id="insert" parameterType="com.jsh.erp.datasource.entities.User">
insert into jsh_user (id, username, loginame,
insert into jsh_user (id, username, login_name,
password, position, department,
email, phonenum, ismanager,
isystem, Status, description,
remark, tenant_id)
values (#{id,jdbcType=BIGINT}, #{username,jdbcType=VARCHAR}, #{loginame,jdbcType=VARCHAR},
values (#{id,jdbcType=BIGINT}, #{username,jdbcType=VARCHAR}, #{loginName,jdbcType=VARCHAR},
#{password,jdbcType=VARCHAR}, #{position,jdbcType=VARCHAR}, #{department,jdbcType=VARCHAR},
#{email,jdbcType=VARCHAR}, #{phonenum,jdbcType=VARCHAR}, #{ismanager,jdbcType=TINYINT},
#{isystem,jdbcType=TINYINT}, #{status,jdbcType=TINYINT}, #{description,jdbcType=VARCHAR},
@@ -130,8 +130,8 @@
<if test="username != null">
username,
</if>
<if test="loginame != null">
loginame,
<if test="loginName != null">
login_name,
</if>
<if test="password != null">
password,
@@ -174,8 +174,8 @@
<if test="username != null">
#{username,jdbcType=VARCHAR},
</if>
<if test="loginame != null">
#{loginame,jdbcType=VARCHAR},
<if test="loginName != null">
#{loginName,jdbcType=VARCHAR},
</if>
<if test="password != null">
#{password,jdbcType=VARCHAR},
@@ -227,8 +227,8 @@
<if test="record.username != null">
username = #{record.username,jdbcType=VARCHAR},
</if>
<if test="record.loginame != null">
loginame = #{record.loginame,jdbcType=VARCHAR},
<if test="record.loginName != null">
login_name = #{record.loginName,jdbcType=VARCHAR},
</if>
<if test="record.password != null">
password = #{record.password,jdbcType=VARCHAR},
@@ -272,7 +272,7 @@
update jsh_user
set id = #{record.id,jdbcType=BIGINT},
username = #{record.username,jdbcType=VARCHAR},
loginame = #{record.loginame,jdbcType=VARCHAR},
login_name = #{record.loginName,jdbcType=VARCHAR},
password = #{record.password,jdbcType=VARCHAR},
position = #{record.position,jdbcType=VARCHAR},
department = #{record.department,jdbcType=VARCHAR},
@@ -294,8 +294,8 @@
<if test="username != null">
username = #{username,jdbcType=VARCHAR},
</if>
<if test="loginame != null">
loginame = #{loginame,jdbcType=VARCHAR},
<if test="loginName != null">
login_name = #{loginName,jdbcType=VARCHAR},
</if>
<if test="password != null">
password = #{password,jdbcType=VARCHAR},
@@ -336,7 +336,7 @@
<update id="updateByPrimaryKey" parameterType="com.jsh.erp.datasource.entities.User">
update jsh_user
set username = #{username,jdbcType=VARCHAR},
loginame = #{loginame,jdbcType=VARCHAR},
login_name = #{loginName,jdbcType=VARCHAR},
password = #{password,jdbcType=VARCHAR},
position = #{position,jdbcType=VARCHAR},
department = #{department,jdbcType=VARCHAR},

View File

@@ -16,7 +16,7 @@
and username like '%${userName}%'
</if>
<if test="loginName != null">
and loginame like '%${loginName}%'
and login_name like '%${loginName}%'
</if>
<if test="offset != null and rows != null">
limit #{offset},#{rows}
@@ -32,11 +32,11 @@
and username like '%${userName}%'
</if>
<if test="loginName != null">
and loginame like '%${loginName}%'
and login_name like '%${loginName}%'
</if>
</select>
<select id="getUserList" parameterType="java.util.Map" resultMap="ResultMapEx">
select user.id, user.username, user.loginame, user.position, user.email, user.phonenum,
select user.id, user.username, user.login_name, user.position, user.email, user.phonenum,
user.description, user.remark,user.isystem,org.id as orgaId,user.tenant_id,org.org_abr,rel.user_blng_orga_dspl_seq,
rel.id as orgaUserRelId
FROM jsh_user user
@@ -50,12 +50,12 @@
</if>
<if test="loginName != null and loginName != ''">
<bind name="loginName" value="'%' + _parameter.loginName + '%'" />
and user.loginame like #{loginName}
and user.login_name like #{loginName}
</if>
order by user.id desc
</select>
<select id="getUserListByUserNameOrLoginName" resultMap="com.jsh.erp.datasource.mappers.UserMapper.BaseResultMap">
select user.id, user.username, user.loginame, user.position, user.email, user.phonenum,
select user.id, user.username, user.login_name, user.position, user.email, user.phonenum,
user.description, user.remark,user.isystem
FROM jsh_user user
where 1=1
@@ -63,8 +63,8 @@
<if test="userName != null and userName != ''">
and user.userName = #{userName}
</if>
<if test="loginame != null and loginame != ''">
and user.loginame = #{loginame}
<if test="loginName != null and loginName != ''">
and user.login_name = #{loginName}
</if>
order by user.id desc
</select>