Commit ec4d2565 by fengshuonan

适配oracle的wrapper

parent 82dd6279
package cn.stylefeng.guns.core.util;
import java.math.BigDecimal;
import java.math.BigInteger;
/**
* decimal变量获取
*
* @author fengshuonan
* @date 2019-04-04-17:06
*/
public class DecimalUtil {
/**
* 获取object的值
*
* @author fengshuonan
* @Date 2019-04-04 17:07
*/
public static Long getLong(Object object) {
if (object == null) {
return null;
}
if (object instanceof BigDecimal) {
return ((BigDecimal) object).longValue();
}
if (object instanceof BigInteger) {
return ((BigInteger) object).longValue();
}
if (object instanceof Long) {
return ((Long) object);
}
return null;
}
}
......@@ -16,6 +16,7 @@
package cn.stylefeng.guns.modular.system.warpper;
import cn.stylefeng.guns.core.common.constant.factory.ConstantFactory;
import cn.stylefeng.guns.core.util.DecimalUtil;
import cn.stylefeng.roses.core.base.warpper.BaseControllerWrapper;
import cn.stylefeng.roses.core.util.ToolUtil;
import cn.stylefeng.roses.kernel.model.page.PageResult;
......@@ -50,9 +51,9 @@ public class DeptWrapper extends BaseControllerWrapper {
@Override
protected void wrapTheMap(Map<String, Object> map) {
Long pid = (Long) map.get("pid");
Long pid = DecimalUtil.getLong(map.get("pid"));
if (ToolUtil.isEmpty(pid) || pid.equals(0)) {
if (ToolUtil.isEmpty(pid) || pid.equals(0L)) {
map.put("pName", "--");
} else {
map.put("pName", ConstantFactory.me().getDeptName(pid));
......
......@@ -17,6 +17,7 @@ package cn.stylefeng.guns.modular.system.warpper;
import cn.stylefeng.guns.core.common.constant.factory.ConstantFactory;
import cn.stylefeng.guns.core.util.Contrast;
import cn.stylefeng.guns.core.util.DecimalUtil;
import cn.stylefeng.roses.core.base.warpper.BaseControllerWrapper;
import cn.stylefeng.roses.core.util.ToolUtil;
......@@ -43,7 +44,7 @@ public class LogWrapper extends BaseControllerWrapper {
protected void wrapTheMap(Map<String, Object> map) {
String message = (String) map.get("message");
Long userid = (Long) map.get("userId");
Long userid = DecimalUtil.getLong(map.get("userId"));
map.put("userName", ConstantFactory.me().getUserNameById(userid));
//如果信息过长,则只截取前100位字符串
......
......@@ -16,6 +16,7 @@
package cn.stylefeng.guns.modular.system.warpper;
import cn.stylefeng.guns.core.common.constant.factory.ConstantFactory;
import cn.stylefeng.guns.core.util.DecimalUtil;
import cn.stylefeng.roses.core.base.warpper.BaseControllerWrapper;
import cn.stylefeng.roses.kernel.model.page.PageResult;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
......@@ -49,7 +50,7 @@ public class NoticeWrapper extends BaseControllerWrapper {
@Override
protected void wrapTheMap(Map<String, Object> map) {
Long creater = (Long) map.get("createUser");
Long creater = DecimalUtil.getLong(map.get("createUser"));
map.put("createrName", ConstantFactory.me().getUserNameById(creater));
}
}
......@@ -16,6 +16,7 @@
package cn.stylefeng.guns.modular.system.warpper;
import cn.stylefeng.guns.core.common.constant.factory.ConstantFactory;
import cn.stylefeng.guns.core.util.DecimalUtil;
import cn.stylefeng.roses.core.base.warpper.BaseControllerWrapper;
import cn.stylefeng.roses.kernel.model.page.PageResult;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
......@@ -49,8 +50,8 @@ public class RoleWrapper extends BaseControllerWrapper {
@Override
protected void wrapTheMap(Map<String, Object> map) {
map.put("pName", ConstantFactory.me().getSingleRoleName((Long) map.get("pid")));
map.put("deptName", ConstantFactory.me().getDeptName((Long) map.get("deptId")));
map.put("pName", ConstantFactory.me().getSingleRoleName(DecimalUtil.getLong(map.get("pid"))));
map.put("deptName", ConstantFactory.me().getDeptName(DecimalUtil.getLong(map.get("deptId"))));
}
}
......@@ -16,6 +16,7 @@
package cn.stylefeng.guns.modular.system.warpper;
import cn.stylefeng.guns.core.common.constant.factory.ConstantFactory;
import cn.stylefeng.guns.core.util.DecimalUtil;
import cn.stylefeng.roses.core.base.warpper.BaseControllerWrapper;
import cn.stylefeng.roses.kernel.model.page.PageResult;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
......@@ -51,7 +52,7 @@ public class UserWrapper extends BaseControllerWrapper {
protected void wrapTheMap(Map<String, Object> map) {
map.put("sexName", ConstantFactory.me().getSexName((String) map.get("sex")));
map.put("roleName", ConstantFactory.me().getRoleName((String) map.get("roleId")));
map.put("deptName", ConstantFactory.me().getDeptName((Long) map.get("deptId")));
map.put("deptName", ConstantFactory.me().getDeptName(DecimalUtil.getLong(map.get("deptId"))));
map.put("statusName", ConstantFactory.me().getStatusName((String) map.get("status")));
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment