功能代码优化

yun-zuoyi
wei.peng 7 years ago
parent f31b8e659a
commit 26efe9a1e9

@ -53,8 +53,9 @@ public class SysOrganizeController extends CoreBaseController{
//新增初始化
ConvertBean.modelInitialize(organize, AuthUtil.getSessionUser());
if(organize.getParentId() == null || organize.getParentId() == 0){
if(organize.getParentId() == null || organize.getParentId() <= 0){
organize.setParentId(CommonEnumUtil.PARENT.DEFAULT.getValue());
organize.setParentNameRdd("顶级组织");
}
organize = organizeService.insertSysOrganize(organize);
@ -79,8 +80,9 @@ public class SysOrganizeController extends CoreBaseController{
.notNull("organizeType", organize.getOrganizeType());
ConvertBean.modelUpdate(organize, AuthUtil.getSessionUser());
if(organize.getParentId() == null || organize.getParentId() == 0){
if(organize.getParentId() == null || organize.getParentId() <= 0){
organize.setParentId(CommonEnumUtil.PARENT.DEFAULT.getValue());
organize.setParentNameRdd("顶级组织");
}
organizeService.updateSysOrganize(organize);

@ -54,8 +54,9 @@ public class SysPositionController extends CoreBaseController {
.notNull("positionCode",position.getPositionCode());
ConvertBean.modelInitialize(position,user);
if(position.getParentId() == null || position.getParentId() == 0){
if(position.getParentId() == null || position.getParentId() <= 0){
position.setParentId(CommonEnumUtil.PARENT.DEFAULT.getValue());
position.setParentNameRdd("顶级岗位");
}
SysPosition pos = positionService.insertSysPosition(position);
@ -85,8 +86,9 @@ public class SysPositionController extends CoreBaseController {
//修改初始化
ConvertBean.modelUpdate(position,user);
if(position.getParentId() == null || position.getParentId() == 0){
if(position.getParentId() == null || position.getParentId() <= 0){
position.setParentId(CommonEnumUtil.PARENT.DEFAULT.getValue());
position.setParentNameRdd("顶级岗位");
}
positionService.updateSysPosition(position);

@ -147,7 +147,10 @@ public class CoreTreeService implements ICoreTreeService {
@Override
public List<SysOrganize> findSysOrganizeTreeByParentId(long parentId) {
List<SysOrganize> result = organizeRDao.findByProperty("parentId", parentId);
StringBuffer orgHQL = new StringBuffer();
HqlPack.getNumEqualPack(parentId,"parentId",orgHQL);
HqlPack.getOrderByPack(new Object[]{CommonEnumUtil.ASC_OR_DESC.DESC.getValue()}, new String[]{"organizeSort"}, orgHQL);
List<SysOrganize> result = organizeRDao.findByHqlWhere(orgHQL.toString());
// 循环设置子集
if(result != null && result.size() > 0){
@ -174,7 +177,11 @@ public class CoreTreeService implements ICoreTreeService {
@Override
public void findSysOrganizeChildrenTreePack(SysOrganize parent, int step) {
++step;
List<SysOrganize> childList = organizeRDao.findByProperty("parentId", parent.getId());
StringBuffer orgHQL = new StringBuffer();
HqlPack.getNumEqualPack(parent.getId(),"parentId",orgHQL);
HqlPack.getOrderByPack(new Object[]{CommonEnumUtil.ASC_OR_DESC.DESC.getValue()}, new String[]{"organizeSort"}, orgHQL);
List<SysOrganize> childList = organizeRDao.findByHqlWhere(orgHQL.toString());
if (childList.size() > 0) { //说明有子集
for (SysOrganize child : childList) {
@ -403,7 +410,7 @@ public class CoreTreeService implements ICoreTreeService {
StringBuffer depHQL = new StringBuffer();
HqlPack.getNumEqualPack(department.getId(),"parentId",depHQL);
HqlPack.getOrderByPack(new Object[]{2}, new String[]{"departmentSort"}, depHQL);
HqlPack.getOrderByPack(new Object[]{CommonEnumUtil.ASC_OR_DESC.DESC.getValue()}, new String[]{"departmentSort"}, depHQL);
List<SysDepartment> departmentList = departmentRDao.findByHqlWhere(depHQL.toString());
if(departmentList != null && departmentList.size() > 0){

Loading…
Cancel
Save