从源更新

This commit is contained in:
qiankunpingtai
2019-06-10 10:48:04 +08:00
parent 71c7f20360
commit d90841a665
22 changed files with 242 additions and 83 deletions

View File

@@ -1939,6 +1939,14 @@ function bindEvent(){
function showDepotHeadDetails(pageNo,pageSize){ function showDepotHeadDetails(pageNo,pageSize){
var materialParam = $.trim($("#searchMaterial").val()); var materialParam = $.trim($("#searchMaterial").val());
var beginTime = $.trim($("#searchBeginTime").val());
var endTime = $.trim($("#searchEndTime").val());
if(beginTime) {
beginTime = beginTime + ' 00:00:00';
}
if(endTime) {
endTime = endTime + ' 23:59:59';
}
$.ajax({ $.ajax({
type: "get", type: "get",
url: "/depotHead/list", url: "/depotHead/list",
@@ -1949,8 +1957,8 @@ function showDepotHeadDetails(pageNo,pageSize){
subType: listSubType, subType: listSubType,
state: $.trim($("#searchState").val()), state: $.trim($("#searchState").val()),
number: $.trim($("#searchNumber").val()), number: $.trim($("#searchNumber").val()),
beginTime: $("#searchBeginTime").val(), beginTime: beginTime,
endTime: $("#searchEndTime").val(), endTime: endTime,
materialParam: materialParam, materialParam: materialParam,
depotIds: depotString depotIds: depotString
}), }),

View File

@@ -1937,6 +1937,14 @@ function bindEvent(){
function showDepotHeadDetails(pageNo,pageSize){ function showDepotHeadDetails(pageNo,pageSize){
var materialParam = $.trim($("#searchMaterial").val()); var materialParam = $.trim($("#searchMaterial").val());
var beginTime = $.trim($("#searchBeginTime").val());
var endTime = $.trim($("#searchEndTime").val());
if(beginTime) {
beginTime = beginTime + ' 00:00:00';
}
if(endTime) {
endTime = endTime + ' 23:59:59';
}
$.ajax({ $.ajax({
type: "get", type: "get",
url: "/depotHead/list", url: "/depotHead/list",
@@ -1947,8 +1955,8 @@ function showDepotHeadDetails(pageNo,pageSize){
subType: listSubType, subType: listSubType,
state: $.trim($("#searchState").val()), state: $.trim($("#searchState").val()),
number: $.trim($("#searchNumber").val()), number: $.trim($("#searchNumber").val()),
beginTime: $("#searchBeginTime").val(), beginTime: beginTime,
endTime: $("#searchEndTime").val(), endTime: endTime,
materialParam: materialParam, materialParam: materialParam,
depotIds: depotString depotIds: depotString
}), }),

View File

@@ -1941,6 +1941,14 @@ function bindEvent(){
function showDepotHeadDetails(pageNo,pageSize){ function showDepotHeadDetails(pageNo,pageSize){
var materialParam = $.trim($("#searchMaterial").val()); var materialParam = $.trim($("#searchMaterial").val());
var beginTime = $.trim($("#searchBeginTime").val());
var endTime = $.trim($("#searchEndTime").val());
if(beginTime) {
beginTime = beginTime + ' 00:00:00';
}
if(endTime) {
endTime = endTime + ' 23:59:59';
}
$.ajax({ $.ajax({
type: "get", type: "get",
url: "/depotHead/list", url: "/depotHead/list",
@@ -1951,8 +1959,8 @@ function showDepotHeadDetails(pageNo,pageSize){
subType: listSubType, subType: listSubType,
state: $.trim($("#searchState").val()), state: $.trim($("#searchState").val()),
number: $.trim($("#searchNumber").val()), number: $.trim($("#searchNumber").val()),
beginTime: $("#searchBeginTime").val(), beginTime: beginTime,
endTime: $("#searchEndTime").val(), endTime: endTime,
materialParam: materialParam, materialParam: materialParam,
depotIds: depotString depotIds: depotString
}), }),

View File

@@ -2025,6 +2025,14 @@ function bindEvent(){
function showDepotHeadDetails(pageNo,pageSize){ function showDepotHeadDetails(pageNo,pageSize){
var materialParam = $.trim($("#searchMaterial").val()); var materialParam = $.trim($("#searchMaterial").val());
var beginTime = $.trim($("#searchBeginTime").val());
var endTime = $.trim($("#searchEndTime").val());
if(beginTime) {
beginTime = beginTime + ' 00:00:00';
}
if(endTime) {
endTime = endTime + ' 23:59:59';
}
$.ajax({ $.ajax({
type: "get", type: "get",
url: "/depotHead/list", url: "/depotHead/list",
@@ -2035,8 +2043,8 @@ function showDepotHeadDetails(pageNo,pageSize){
subType: listSubType, subType: listSubType,
state: $.trim($("#searchState").val()), state: $.trim($("#searchState").val()),
number: $.trim($("#searchNumber").val()), number: $.trim($("#searchNumber").val()),
beginTime: $("#searchBeginTime").val(), beginTime: beginTime,
endTime: $("#searchEndTime").val(), endTime: endTime,
materialParam: materialParam, materialParam: materialParam,
depotIds: depotString depotIds: depotString
}), }),

View File

@@ -1935,6 +1935,14 @@ function bindEvent(){
function showDepotHeadDetails(pageNo,pageSize){ function showDepotHeadDetails(pageNo,pageSize){
var materialParam = $.trim($("#searchMaterial").val()); var materialParam = $.trim($("#searchMaterial").val());
var beginTime = $.trim($("#searchBeginTime").val());
var endTime = $.trim($("#searchEndTime").val());
if(beginTime) {
beginTime = beginTime + ' 00:00:00';
}
if(endTime) {
endTime = endTime + ' 23:59:59';
}
$.ajax({ $.ajax({
type: "get", type: "get",
url: "/depotHead/list", url: "/depotHead/list",
@@ -1945,8 +1953,8 @@ function showDepotHeadDetails(pageNo,pageSize){
subType: listSubType, subType: listSubType,
state: $.trim($("#searchState").val()), state: $.trim($("#searchState").val()),
number: $.trim($("#searchNumber").val()), number: $.trim($("#searchNumber").val()),
beginTime: $("#searchBeginTime").val(), beginTime: beginTime,
endTime: $("#searchEndTime").val(), endTime: endTime,
materialParam: materialParam, materialParam: materialParam,
depotIds: depotString depotIds: depotString
}), }),

View File

@@ -1975,6 +1975,14 @@ function bindEvent(){
function showDepotHeadDetails(pageNo,pageSize){ function showDepotHeadDetails(pageNo,pageSize){
var materialParam = $.trim($("#searchMaterial").val()); var materialParam = $.trim($("#searchMaterial").val());
var beginTime = $.trim($("#searchBeginTime").val());
var endTime = $.trim($("#searchEndTime").val());
if(beginTime) {
beginTime = beginTime + ' 00:00:00';
}
if(endTime) {
endTime = endTime + ' 23:59:59';
}
$.ajax({ $.ajax({
type: "get", type: "get",
url: "/depotHead/list", url: "/depotHead/list",
@@ -1985,8 +1993,8 @@ function showDepotHeadDetails(pageNo,pageSize){
subType: listSubType, subType: listSubType,
state: $.trim($("#searchState").val()), state: $.trim($("#searchState").val()),
number: $.trim($("#searchNumber").val()), number: $.trim($("#searchNumber").val()),
beginTime: $("#searchBeginTime").val(), beginTime: beginTime,
endTime: $("#searchEndTime").val(), endTime: endTime,
materialParam: materialParam, materialParam: materialParam,
depotIds: depotString depotIds: depotString
}), }),

View File

@@ -2051,6 +2051,14 @@ function bindEvent(){
function showDepotHeadDetails(pageNo,pageSize){ function showDepotHeadDetails(pageNo,pageSize){
var materialParam = $.trim($("#searchMaterial").val()); var materialParam = $.trim($("#searchMaterial").val());
var beginTime = $.trim($("#searchBeginTime").val());
var endTime = $.trim($("#searchEndTime").val());
if(beginTime) {
beginTime = beginTime + ' 00:00:00';
}
if(endTime) {
endTime = endTime + ' 23:59:59';
}
$.ajax({ $.ajax({
type: "get", type: "get",
url: "/depotHead/list", url: "/depotHead/list",
@@ -2061,8 +2069,8 @@ function showDepotHeadDetails(pageNo,pageSize){
subType: listSubType, subType: listSubType,
state: $.trim($("#searchState").val()), state: $.trim($("#searchState").val()),
number: $.trim($("#searchNumber").val()), number: $.trim($("#searchNumber").val()),
beginTime: $("#searchBeginTime").val(), beginTime: beginTime,
endTime: $("#searchEndTime").val(), endTime: endTime,
materialParam: materialParam, materialParam: materialParam,
depotIds: depotString depotIds: depotString
}), }),

View File

@@ -2047,6 +2047,14 @@ function bindEvent(){
function showDepotHeadDetails(pageNo,pageSize){ function showDepotHeadDetails(pageNo,pageSize){
var materialParam = $.trim($("#searchMaterial").val()); var materialParam = $.trim($("#searchMaterial").val());
var beginTime = $.trim($("#searchBeginTime").val());
var endTime = $.trim($("#searchEndTime").val());
if(beginTime) {
beginTime = beginTime + ' 00:00:00';
}
if(endTime) {
endTime = endTime + ' 23:59:59';
}
$.ajax({ $.ajax({
type: "get", type: "get",
url: "/depotHead/list", url: "/depotHead/list",
@@ -2057,8 +2065,8 @@ function showDepotHeadDetails(pageNo,pageSize){
subType: listSubType, subType: listSubType,
state: $.trim($("#searchState").val()), state: $.trim($("#searchState").val()),
number: $.trim($("#searchNumber").val()), number: $.trim($("#searchNumber").val()),
beginTime: $("#searchBeginTime").val(), beginTime: beginTime,
endTime: $("#searchEndTime").val(), endTime: endTime,
materialParam: materialParam, materialParam: materialParam,
depotIds: depotString depotIds: depotString
}), }),

View File

@@ -2059,6 +2059,14 @@ function bindEvent(){
function showDepotHeadDetails(pageNo,pageSize){ function showDepotHeadDetails(pageNo,pageSize){
var materialParam = $.trim($("#searchMaterial").val()); var materialParam = $.trim($("#searchMaterial").val());
var beginTime = $.trim($("#searchBeginTime").val());
var endTime = $.trim($("#searchEndTime").val());
if(beginTime) {
beginTime = beginTime + ' 00:00:00';
}
if(endTime) {
endTime = endTime + ' 23:59:59';
}
$.ajax({ $.ajax({
type: "get", type: "get",
url: "/depotHead/list", url: "/depotHead/list",
@@ -2069,8 +2077,8 @@ function showDepotHeadDetails(pageNo,pageSize){
subType: listSubType, subType: listSubType,
state: $.trim($("#searchState").val()), state: $.trim($("#searchState").val()),
number: $.trim($("#searchNumber").val()), number: $.trim($("#searchNumber").val()),
beginTime: $("#searchBeginTime").val(), beginTime: beginTime,
endTime: $("#searchEndTime").val(), endTime: endTime,
materialParam: materialParam, materialParam: materialParam,
depotIds: depotString depotIds: depotString
}), }),

View File

@@ -2165,6 +2165,14 @@ function bindEvent(){
function showDepotHeadDetails(pageNo,pageSize){ function showDepotHeadDetails(pageNo,pageSize){
var materialParam = $.trim($("#searchMaterial").val()); var materialParam = $.trim($("#searchMaterial").val());
var beginTime = $.trim($("#searchBeginTime").val());
var endTime = $.trim($("#searchEndTime").val());
if(beginTime) {
beginTime = beginTime + ' 00:00:00';
}
if(endTime) {
endTime = endTime + ' 23:59:59';
}
$.ajax({ $.ajax({
type: "get", type: "get",
url: "/depotHead/list", url: "/depotHead/list",
@@ -2175,8 +2183,8 @@ function showDepotHeadDetails(pageNo,pageSize){
subType: listSubType, subType: listSubType,
state: $.trim($("#searchState").val()), state: $.trim($("#searchState").val()),
number: $.trim($("#searchNumber").val()), number: $.trim($("#searchNumber").val()),
beginTime: $("#searchBeginTime").val(), beginTime: beginTime,
endTime: $("#searchEndTime").val(), endTime: endTime,
materialParam: materialParam, materialParam: materialParam,
depotIds: depotString depotIds: depotString
}), }),

View File

@@ -2027,6 +2027,14 @@ function bindEvent(){
function showDepotHeadDetails(pageNo,pageSize){ function showDepotHeadDetails(pageNo,pageSize){
var materialParam = $.trim($("#searchMaterial").val()); var materialParam = $.trim($("#searchMaterial").val());
var beginTime = $.trim($("#searchBeginTime").val());
var endTime = $.trim($("#searchEndTime").val());
if(beginTime) {
beginTime = beginTime + ' 00:00:00';
}
if(endTime) {
endTime = endTime + ' 23:59:59';
}
$.ajax({ $.ajax({
type: "get", type: "get",
url: "/depotHead/list", url: "/depotHead/list",
@@ -2037,8 +2045,8 @@ function showDepotHeadDetails(pageNo,pageSize){
subType: listSubType, subType: listSubType,
state: $.trim($("#searchState").val()), state: $.trim($("#searchState").val()),
number: $.trim($("#searchNumber").val()), number: $.trim($("#searchNumber").val()),
beginTime: $("#searchBeginTime").val(), beginTime: beginTime,
endTime: $("#searchEndTime").val(), endTime: endTime,
materialParam: materialParam, materialParam: materialParam,
depotIds: depotString depotIds: depotString
}), }),

View File

@@ -2044,6 +2044,14 @@ function bindEvent(){
function showDepotHeadDetails(pageNo,pageSize){ function showDepotHeadDetails(pageNo,pageSize){
var materialParam = $.trim($("#searchMaterial").val()); var materialParam = $.trim($("#searchMaterial").val());
var beginTime = $.trim($("#searchBeginTime").val());
var endTime = $.trim($("#searchEndTime").val());
if(beginTime) {
beginTime = beginTime + ' 00:00:00';
}
if(endTime) {
endTime = endTime + ' 23:59:59';
}
$.ajax({ $.ajax({
type: "get", type: "get",
url: "/depotHead/list", url: "/depotHead/list",
@@ -2054,8 +2062,8 @@ function showDepotHeadDetails(pageNo,pageSize){
subType: listSubType, subType: listSubType,
state: $.trim($("#searchState").val()), state: $.trim($("#searchState").val()),
number: $.trim($("#searchNumber").val()), number: $.trim($("#searchNumber").val()),
beginTime: $("#searchBeginTime").val(), beginTime: beginTime,
endTime: $("#searchEndTime").val(), endTime: endTime,
materialParam: materialParam, materialParam: materialParam,
depotIds: depotString depotIds: depotString
}), }),

View File

@@ -2098,6 +2098,14 @@ function bindEvent(){
function showDepotHeadDetails(pageNo,pageSize){ function showDepotHeadDetails(pageNo,pageSize){
var materialParam = $.trim($("#searchMaterial").val()); var materialParam = $.trim($("#searchMaterial").val());
var beginTime = $.trim($("#searchBeginTime").val());
var endTime = $.trim($("#searchEndTime").val());
if(beginTime) {
beginTime = beginTime + ' 00:00:00';
}
if(endTime) {
endTime = endTime + ' 23:59:59';
}
$.ajax({ $.ajax({
type: "get", type: "get",
url: "/depotHead/list", url: "/depotHead/list",
@@ -2108,8 +2116,8 @@ function showDepotHeadDetails(pageNo,pageSize){
subType: listSubType, subType: listSubType,
state: $.trim($("#searchState").val()), state: $.trim($("#searchState").val()),
number: $.trim($("#searchNumber").val()), number: $.trim($("#searchNumber").val()),
beginTime: $("#searchBeginTime").val(), beginTime: beginTime,
endTime: $("#searchEndTime").val(), endTime: endTime,
materialParam: materialParam, materialParam: materialParam,
depotIds: depotString depotIds: depotString
}), }),

View File

@@ -1728,4 +1728,39 @@ where Id = 5;
update jsh_app SET Number = '02' where name='个人信息'; update jsh_app SET Number = '02' where name='个人信息';
insert into `jsh_functions`(`Number`, `Name`, `PNumber`, `URL`, `State`, `Sort`, `Enabled`, `Type`, `PushBtn`) insert into `jsh_functions`(`Number`, `Name`, `PNumber`, `URL`, `State`, `Sort`, `Enabled`, `Type`, `PushBtn`)
select '02', '个人信息', '0', '', b'1', '0005', b'1', '电脑版', '' from dual where not exists select '02', '个人信息', '0', '', b'1', '0005', b'1', '电脑版', '' from dual where not exists
(select * from jsh_functions where Number='02' and PNumber='0'); (select * from jsh_functions where Number='02' and PNumber='0');
-- ----------------------------
-- 时间2019年6月4日
-- version1.0.15
-- 此次更新
-- 更新无租户数据的租户id为-1以保证无租户和有租户数据能够共存
-- 特别提醒之后的sql都是在之前基础上迭代可以对已存在的系统进行数据保留更新
-- ----------------------------
update databasechangelog set tenant_id=-1 where tenant_id is null;
update databasechangeloglock set tenant_id=-1 where tenant_id is null;
update jsh_account set tenant_id=-1 where tenant_id is null;
update jsh_accounthead set tenant_id=-1 where tenant_id is null;
update jsh_accountitem set tenant_id=-1 where tenant_id is null;
update jsh_app set tenant_id=-1 where tenant_id is null;
update jsh_asset set tenant_id=-1 where tenant_id is null;
update jsh_assetcategory set tenant_id=-1 where tenant_id is null;
update jsh_assetname set tenant_id=-1 where tenant_id is null;
update jsh_depot set tenant_id=-1 where tenant_id is null;
update jsh_depothead set tenant_id=-1 where tenant_id is null;
update jsh_depotitem set tenant_id=-1 where tenant_id is null;
update jsh_functions set tenant_id=-1 where tenant_id is null;
update jsh_inoutitem set tenant_id=-1 where tenant_id is null;
update jsh_log set tenant_id=-1 where tenant_id is null;
update jsh_material set tenant_id=-1 where tenant_id is null;
update jsh_materialcategory set tenant_id=-1 where tenant_id is null;
update jsh_materialproperty set tenant_id=-1 where tenant_id is null;
update jsh_orga_user_rel set tenant_id=-1 where tenant_id is null;
update jsh_organization set tenant_id=-1 where tenant_id is null;
update jsh_person set tenant_id=-1 where tenant_id is null;
update jsh_role set tenant_id=-1 where tenant_id is null;
update jsh_serial_number set tenant_id=-1 where tenant_id is null;
update jsh_supplier set tenant_id=-1 where tenant_id is null;
update jsh_systemconfig set tenant_id=-1 where tenant_id is null;
update jsh_unit set tenant_id=-1 where tenant_id is null;
update jsh_user set tenant_id=-1 where tenant_id is null;
update jsh_userbusiness set tenant_id=-1 where tenant_id is null;

View File

@@ -28,8 +28,7 @@ public class TenantConfig {
* description: * description:
* 实现多租户和无租户模式数据可以兼容在一个数据库中 * 实现多租户和无租户模式数据可以兼容在一个数据库中
* 多租户模式根据tenant_id=租户id来筛选个人数据 * 多租户模式根据tenant_id=租户id来筛选个人数据
* 无租户模式根据tenant_id is null来筛选数据 * 无租户模式根据tenant_id=-1来筛选数据
* mybatis-plus不支持多租户租户同时id为null的情况
*/ */
@Bean @Bean
public PaginationInterceptor paginationInterceptor(HttpServletRequest request) { public PaginationInterceptor paginationInterceptor(HttpServletRequest request) {
@@ -45,8 +44,8 @@ public class TenantConfig {
//多租户模式租户id从当前用户获取 //多租户模式租户id从当前用户获取
return new LongValue(Long.parseLong(tenantId.toString())); return new LongValue(Long.parseLong(tenantId.toString()));
} else { } else {
//租户模式租户id为null //租户模式租户id为-1
return null; return new LongValue(Long.valueOf(-1));
} }
} }
@@ -57,19 +56,11 @@ public class TenantConfig {
@Override @Override
public boolean doTableFilter(String tableName) { public boolean doTableFilter(String tableName) {
//获取开启状态 // 这里可以判断是否过滤表
Object mybatisPlusStatus = request.getSession().getAttribute("mybatisPlusStatus"); if ("tbl_sequence".equals(tableName) || "dual".equals(tableName)) {
if(mybatisPlusStatus !=null && mybatisPlusStatus.toString().equals("open")) {
//从session中获取租户id
// 这里可以判断是否过滤表
if ("tbl_sequence".equals(tableName) || "dual".equals(tableName)) {
return true;
} else {
return false;
}
} else {
//无租户模式
return true; return true;
} else {
return false;
} }
} }
}); });
@@ -80,19 +71,14 @@ public class TenantConfig {
@Override @Override
public boolean doFilter(MetaObject metaObject) { public boolean doFilter(MetaObject metaObject) {
MappedStatement ms = SqlParserHelper.getMappedStatement(metaObject); MappedStatement ms = SqlParserHelper.getMappedStatement(metaObject);
//获取开启状态 // 过滤自定义查询此处跳过指定id的查询不追加租户id过滤条件
Object mybatisPlusStatus = request.getSession().getAttribute("mybatisPlusStatus"); if ("com.jsh.erp.datasource.mappers.UserMapperEx.getUserListByLoginName".equals(ms.getId())||
if(mybatisPlusStatus !=null && mybatisPlusStatus.toString().equals("open")) { "com.jsh.erp.datasource.mappers.UserMapperEx.getUserListByloginNameAndPassword".equals(ms.getId())||
//多租户模式 "com.jsh.erp.datasource.mappers.DepotItemMapperEx.getCurrentRepByMaterialIdAndDepotId".equals(ms.getId())) {
// 过滤自定义查询此处跳过指定id的查询不追加租户id过滤条件
if ("com.jsh.erp.datasource.mappers.UserMapperEx.getUserListByUserNameOrLoginName".equals(ms.getId())) {
return true;
}
return false;
} else {
//无租户模式
return true; return true;
} }
return false;
} }
}); });
return paginationInterceptor; return paginationInterceptor;

View File

@@ -101,7 +101,7 @@ public class UserController {
default: default:
try { try {
//验证通过 可以登录放入session记录登录日志 //验证通过 可以登录放入session记录登录日志
user = userService.getUserByUserName(username); user = userService.getUserListByloginNameAndPassword(username,password);
// logService.create(new Logdetails(user, "登录系统", model.getClientIp(), // logService.create(new Logdetails(user, "登录系统", model.getClientIp(),
// new Timestamp(System.currentTimeMillis()), (short) 0, "管理用户:" + username + " 登录系统", username + " 登录系统")); // new Timestamp(System.currentTimeMillis()), (short) 0, "管理用户:" + username + " 登录系统", username + " 登录系统"));
msgTip = "user can login"; msgTip = "user can login";

View File

@@ -32,9 +32,7 @@ public interface UserMapperEx {
/** /**
* 这个查询不添加租户id保证登录名全局唯一 * 这个查询不添加租户id保证登录名全局唯一
* */ * */
@SqlParser(filter = true) List<User> getUserListByLoginName(@Param("loginame") String loginame);
List<User> getUserListByUserNameOrLoginName(@Param("userName") String userName,
@Param("loginame") String loginame);
int batDeleteOrUpdateUser(@Param("ids") String ids[], @Param("status") byte status); int batDeleteOrUpdateUser(@Param("ids") String ids[], @Param("status") byte status);
@@ -44,4 +42,5 @@ public interface UserMapperEx {
List<User> getUserListByUserNameAndTenantId(@Param("userName")String userName, @Param("tenantId")Long tenantId); List<User> getUserListByUserNameAndTenantId(@Param("userName")String userName, @Param("tenantId")Long tenantId);
String addRegisterUserNotInclueUser(@Param("userId") Long userId,@Param("tenantId") Long tenantId,@Param("roleId") Long roleId); String addRegisterUserNotInclueUser(@Param("userId") Long userId,@Param("tenantId") Long tenantId,@Param("roleId") Long roleId);
List<User> getUserListByloginNameAndPassword(@Param("loginame")String loginame, @Param("password")String password);
} }

View File

@@ -252,12 +252,10 @@ public class UserService {
/**默认是可以登录的*/ /**默认是可以登录的*/
List<User> list = null; List<User> list = null;
try { try {
UserExample example = new UserExample(); list=this.getUserListByloginName(username);
example.createCriteria().andLoginameEqualTo(username);
list = userMapper.selectByExample(example);
} catch (Exception e) { } catch (Exception e) {
logger.error("异常码[{}],异常提示[{}],异常[{}]", logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e); ExceptionConstants.DATA_READ_FAIL_CODE, ExceptionConstants.DATA_READ_FAIL_MSG,e);
logger.error(">>>>>>>>访问验证用户姓名是否存在后台信息异常", e); logger.error(">>>>>>>>访问验证用户姓名是否存在后台信息异常", e);
return ExceptionCodeConstants.UserExceptionCode.USER_ACCESS_EXCEPTION; return ExceptionCodeConstants.UserExceptionCode.USER_ACCESS_EXCEPTION;
} }
@@ -265,17 +263,15 @@ public class UserService {
if (null != list && list.size() == 0) { if (null != list && list.size() == 0) {
return ExceptionCodeConstants.UserExceptionCode.USER_NOT_EXIST; return ExceptionCodeConstants.UserExceptionCode.USER_NOT_EXIST;
} }
User user=null;
try { try {
UserExample example = new UserExample(); user = this.getUserListByloginNameAndPassword(username,password);
example.createCriteria().andLoginameEqualTo(username).andPasswordEqualTo(password);
list = userMapper.selectByExample(example);
} catch (Exception e) { } catch (Exception e) {
logger.error(">>>>>>>>>>访问验证用户密码后台信息异常", e); logger.error(">>>>>>>>>>访问验证用户密码后台信息异常", e);
return ExceptionCodeConstants.UserExceptionCode.USER_ACCESS_EXCEPTION; return ExceptionCodeConstants.UserExceptionCode.USER_ACCESS_EXCEPTION;
} }
if (null != list && list.size() == 0) { if (null == user ) {
return ExceptionCodeConstants.UserExceptionCode.USER_PASSWORD_ERROR; return ExceptionCodeConstants.UserExceptionCode.USER_PASSWORD_ERROR;
} }
return ExceptionCodeConstants.UserExceptionCode.USER_CONDITION_FIT; return ExceptionCodeConstants.UserExceptionCode.USER_CONDITION_FIT;
@@ -663,15 +659,33 @@ public class UserService {
public List<User> getUserListByloginName(String loginName){ public List<User> getUserListByloginName(String loginName){
List<User> list =null; List<User> list =null;
try{ try{
list=userMapperEx.getUserListByUserNameOrLoginName(null,loginName); list=userMapperEx.getUserListByLoginName(loginName);
}catch(Exception e){ }catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]", logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_READ_FAIL_CODE,ExceptionConstants.DATA_READ_FAIL_MSG,e); ExceptionConstants.DATA_READ_FAIL_CODE, ExceptionConstants.DATA_READ_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE, throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
ExceptionConstants.DATA_READ_FAIL_MSG); ExceptionConstants.DATA_READ_FAIL_MSG);
} }
return list; return list;
} }
/**
* 通过登录名和密码获取用户列表
* */
public User getUserListByloginNameAndPassword(String loginName,String password){
List<User> list =null;
try{
list=userMapperEx.getUserListByloginNameAndPassword(loginName,password);
}catch(Exception e){
logger.error("异常码[{}],异常提示[{}],异常[{}]",
ExceptionConstants.DATA_READ_FAIL_CODE, ExceptionConstants.DATA_READ_FAIL_MSG,e);
throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
ExceptionConstants.DATA_READ_FAIL_MSG);
}
if(list!=null&&list.size()>0){
return list.get(0);
}
return null;
}
/** /**
* 批量删除用户 * 批量删除用户
* */ * */

View File

@@ -49,6 +49,8 @@
left join jsh_person p on dh.HandsPersonId=p.id and ifnull(p.delete_Flag,'0') !='1' left join jsh_person p on dh.HandsPersonId=p.id and ifnull(p.delete_Flag,'0') !='1'
left join jsh_account a on dh.AccountId=a.id and ifnull(a.delete_Flag,'0') !='1' left join jsh_account a on dh.AccountId=a.id and ifnull(a.delete_Flag,'0') !='1'
left join jsh_depot dd on dh.AllocationProjectId=dd.id and ifnull(dd.delete_Flag,'0') !='1' left join jsh_depot dd on dh.AllocationProjectId=dd.id and ifnull(dd.delete_Flag,'0') !='1'
inner join jsh_depotitem di on dh.Id = di.HeaderId and ifnull(di.delete_Flag,'0') !='1'
inner join jsh_material m on di.MaterialId = m.Id and ifnull(m.delete_Flag,'0') !='1'
where 1=1 where 1=1
<if test="type != null and type != ''"> <if test="type != null and type != ''">
and dh.Type=#{type} and dh.Type=#{type}
@@ -66,6 +68,12 @@
<if test="endTime != null and endTime != ''"> <if test="endTime != null and endTime != ''">
and dh.OperTime &lt;= #{endTime} and dh.OperTime &lt;= #{endTime}
</if> </if>
<if test="materialParam != null">
and (m.`Name` like '%${materialParam}%' or m.Model like '%${materialParam}%')
</if>
<if test="depotIds != null">
and di.DepotId in (${depotIds})
</if>
and ifnull(dh.delete_Flag,'0') !='1' and ifnull(dh.delete_Flag,'0') !='1'
order by dh.Id desc order by dh.Id desc
<if test="offset != null and rows != null"> <if test="offset != null and rows != null">
@@ -74,24 +82,26 @@
</select> </select>
<select id="countsByDepotHead" resultType="java.lang.Long"> <select id="countsByDepotHead" resultType="java.lang.Long">
SELECT SELECT
COUNT(id) COUNT(dh.id)
FROM jsh_depothead FROM jsh_depothead dh
inner join jsh_depotitem di on dh.Id = di.HeaderId and ifnull(di.delete_Flag,'0') !='1'
inner join jsh_material m on di.MaterialId = m.Id and ifnull(m.delete_Flag,'0') !='1'
WHERE 1=1 WHERE 1=1
<if test="type != null and type != ''"> <if test="type != null and type != ''">
and Type=#{type} and dh.Type=#{type}
</if> </if>
<if test="subType != null and subType != ''"> <if test="subType != null and subType != ''">
and SubType=#{subType} and dh.SubType=#{subType}
</if> </if>
<if test="number != null and number != ''"> <if test="number != null and number != ''">
<bind name="number" value="'%' + _parameter.number + '%'"/> <bind name="number" value="'%' + _parameter.number + '%'"/>
and Number like #{number} and dh.Number like #{number}
</if> </if>
<if test="beginTime != null and beginTime != ''"> <if test="beginTime != null and beginTime != ''">
and OperTime >= #{beginTime} and dh.OperTime >= #{beginTime}
</if> </if>
<if test="endTime != null and endTime != ''"> <if test="endTime != null and endTime != ''">
and OperTime &lt;= #{endTime} and dh.OperTime &lt;= #{endTime}
</if> </if>
<if test="materialParam != null"> <if test="materialParam != null">
and (m.`Name` like '%${materialParam}%' or m.Model like '%${materialParam}%') and (m.`Name` like '%${materialParam}%' or m.Model like '%${materialParam}%')
@@ -99,7 +109,7 @@
<if test="depotIds != null"> <if test="depotIds != null">
and di.DepotId in (${depotIds}) and di.DepotId in (${depotIds})
</if> </if>
and ifnull(jsh_depothead.delete_Flag,'0') !='1' and ifnull(dh.delete_Flag,'0') !='1'
</select> </select>

View File

@@ -606,7 +606,7 @@
and dh.id=di.HeaderId and dh.id=di.HeaderId
and di.MaterialId=#{materialId} and di.MaterialId=#{materialId}
and ifnull(dh.delete_Flag,'0') !='1' and ifnull(dh.delete_Flag,'0') !='1'
and ifnull(di.delete_Flag,'0') !='1') curep and ifnull(di.delete_Flag,'0') !='1') curep
</select> </select>
</mapper> </mapper>

View File

@@ -116,15 +116,12 @@
</set> </set>
where id = #{id,jdbcType=BIGINT} where id = #{id,jdbcType=BIGINT}
</update> </update>
<select id="getUserListByUserNameOrLoginName" resultMap="com.jsh.erp.datasource.mappers.UserMapper.BaseResultMap"> <select id="getUserListByLoginName" 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.loginame, user.position, user.email, user.phonenum,
user.description, user.remark,user.isystem user.description, user.remark,user.isystem,user.tenant_id
FROM jsh_user user FROM jsh_user user
where 1=1 where 1=1
and ifnull(user.status,'0') not in('1','2') and ifnull(user.status,'0') not in('1','2')
<if test="userName != null and userName != ''">
and user.userName = #{userName}
</if>
<if test="loginame != null and loginame != ''"> <if test="loginame != null and loginame != ''">
and user.loginame = #{loginame} and user.loginame = #{loginame}
</if> </if>
@@ -213,6 +210,20 @@
<select id="addRegisterUserNotInclueUser" resultType="java.lang.String"> <select id="addRegisterUserNotInclueUser" resultType="java.lang.String">
select registerUserTemplate(#{userId},#{tenantId},#{roleId}) from dual; select registerUserTemplate(#{userId},#{tenantId},#{roleId}) from dual;
</select> </select>
<select id="getUserListByloginNameAndPassword" resultMap="com.jsh.erp.datasource.mappers.UserMapper.BaseResultMap">
select user.id, user.username, user.loginame, user.position, user.email, user.phonenum,
user.description, user.remark,user.isystem,user.tenant_id
FROM jsh_user user
where 1=1
and ifnull(user.status,'0') not in('1','2')
<if test="loginame != null and loginame != ''">
and user.loginame = #{loginame}
</if>
<if test="password != null and password != ''">
and user.password = #{password}
</if>
order by user.id desc
</select>
</mapper> </mapper>