|
|
|
@ -9,6 +9,7 @@ import com.engine.organization.component.OrganizationWeaTable;
|
|
|
|
|
import com.engine.organization.entity.DeleteParam;
|
|
|
|
|
import com.engine.organization.entity.TreeData;
|
|
|
|
|
import com.engine.organization.entity.fieldset.vo.TypeTreeVO;
|
|
|
|
|
import com.engine.organization.entity.hrmresource.po.ResourceItemClassPO;
|
|
|
|
|
import com.engine.organization.entity.hrmresource.po.ResourceItemPO;
|
|
|
|
|
import com.engine.organization.entity.hrmresource.vo.ResourceBasicInfoVO;
|
|
|
|
|
import com.engine.organization.mapper.hrmresource.ResourceBasicInfoMapper;
|
|
|
|
@ -18,6 +19,7 @@ import com.engine.organization.util.OrganizationAssert;
|
|
|
|
|
import com.engine.organization.util.OrganizationFormItemUtil;
|
|
|
|
|
import com.engine.organization.util.db.DBType;
|
|
|
|
|
import com.engine.organization.util.db.MapperProxyFactory;
|
|
|
|
|
import org.apache.commons.collections.CollectionUtils;
|
|
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
|
|
import weaver.conn.RecordSet;
|
|
|
|
|
import weaver.general.Util;
|
|
|
|
@ -42,13 +44,13 @@ public class ResourceBasicInfoServiceImpl extends Service implements ResourceBas
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public Map<String, Object> listPage(Map<String, Object> params) {
|
|
|
|
|
Map<String,Object> resultMap = new HashMap<>();
|
|
|
|
|
Map<String, Object> resultMap = new HashMap<>();
|
|
|
|
|
boolean hasRight = HasRightUtil.hasRight(user, RIGHT_NAME, true);
|
|
|
|
|
resultMap.put("hasRight", hasRight);
|
|
|
|
|
if (!hasRight) {
|
|
|
|
|
return resultMap;
|
|
|
|
|
}
|
|
|
|
|
OrganizationWeaTable<ResourceBasicInfoVO> table = new OrganizationWeaTable<>(user,ResourceBasicInfoVO.class);
|
|
|
|
|
OrganizationWeaTable<ResourceBasicInfoVO> table = new OrganizationWeaTable<>(user, ResourceBasicInfoVO.class);
|
|
|
|
|
String sqlWhere = buildSqlWhere(params);
|
|
|
|
|
table.setSqlwhere(sqlWhere);
|
|
|
|
|
WeaResultMsg result = new WeaResultMsg(false);
|
|
|
|
@ -99,9 +101,9 @@ public class ResourceBasicInfoServiceImpl extends Service implements ResourceBas
|
|
|
|
|
fName.setRules("required|string");
|
|
|
|
|
SearchConditionItem fMemo = OrganizationFormItemUtil.textareaItem(user, 2, 17, true, 2, 60, "说明", "fmemo");
|
|
|
|
|
|
|
|
|
|
if(StringUtils.isNotBlank(id)) {
|
|
|
|
|
if (StringUtils.isNotBlank(id)) {
|
|
|
|
|
ResourceItemPO resourceItemPO = getResourceBasicInfoMapper().getResourceItemByFid(Integer.parseInt(id));
|
|
|
|
|
OrganizationAssert.notNull(resourceItemPO,"选择的数据不存在");
|
|
|
|
|
OrganizationAssert.notNull(resourceItemPO, "选择的数据不存在");
|
|
|
|
|
BrowserBean browserBean = resourceTypeItem.getBrowserConditionParam();
|
|
|
|
|
List<Map<String, Object>> maps = getResourceBasicInfoMapper().browserDatas(DeleteParam.builder().ids(resourceItemPO.getFid().toString()).build().getIds());
|
|
|
|
|
browserBean.setReplaceDatas(maps);
|
|
|
|
@ -135,8 +137,8 @@ public class ResourceBasicInfoServiceImpl extends Service implements ResourceBas
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public int save(ResourceItemPO resourceItemPO) {
|
|
|
|
|
List<ResourceItemPO> list = getResourceBasicInfoMapper().selectItemByFNo(resourceItemPO.getFno(),resourceItemPO.getFclassid());
|
|
|
|
|
OrganizationAssert.isEmpty(list,"编号不允许重复");
|
|
|
|
|
List<ResourceItemPO> list = getResourceBasicInfoMapper().selectItemByFNo(resourceItemPO.getFno(), resourceItemPO.getFclassid());
|
|
|
|
|
OrganizationAssert.isEmpty(list, "编号不允许重复");
|
|
|
|
|
return getResourceBasicInfoMapper().insertIgnoreNull(resourceItemPO);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -150,6 +152,56 @@ public class ResourceBasicInfoServiceImpl extends Service implements ResourceBas
|
|
|
|
|
return getResourceBasicInfoMapper().update(resourceItemPO);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public List<SearchConditionGroup> getItemClassForm(Map<String, Object> params) {
|
|
|
|
|
String id = Util.null2String(params.get("fid"));
|
|
|
|
|
List<SearchConditionItem> selectItems = new ArrayList<>();
|
|
|
|
|
List<SearchConditionGroup> addGroups = new ArrayList<>();
|
|
|
|
|
SearchConditionItem fNo = OrganizationFormItemUtil.inputItem(user, 2, 17, 3, 50, "编号", "fno");
|
|
|
|
|
fNo.setRules("required|string");
|
|
|
|
|
SearchConditionItem fName = OrganizationFormItemUtil.inputItem(user, 2, 17, 3, 50, "名称", "fname");
|
|
|
|
|
fName.setRules("required|string");
|
|
|
|
|
SearchConditionItem fMemo = OrganizationFormItemUtil.textareaItem(user, 2, 17, true, 2, 60, "说明", "fmemo");
|
|
|
|
|
|
|
|
|
|
if (StringUtils.isNotBlank(id)) {
|
|
|
|
|
ResourceItemClassPO resourceItemClassPO = getResourceBasicInfoMapper().getResourceItemClassByFid(Integer.parseInt(id));
|
|
|
|
|
OrganizationAssert.notNull(resourceItemClassPO, "选择的数据不存在");
|
|
|
|
|
fNo.setValue(resourceItemClassPO.getFno());
|
|
|
|
|
fNo.setViewAttr(1);
|
|
|
|
|
fName.setValue(resourceItemClassPO.getFname());
|
|
|
|
|
fMemo.setValue(resourceItemClassPO.getFmemo());
|
|
|
|
|
}
|
|
|
|
|
selectItems.add(fNo);
|
|
|
|
|
selectItems.add(fName);
|
|
|
|
|
selectItems.add(fMemo);
|
|
|
|
|
addGroups.add(new SearchConditionGroup("基本信息", true, selectItems));
|
|
|
|
|
return addGroups;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public int saveResourceItemClass(ResourceItemClassPO itemClassPO) {
|
|
|
|
|
List<ResourceItemClassPO> list = getResourceBasicInfoMapper().selectItemClassByFNo(itemClassPO.getFno(), null);
|
|
|
|
|
OrganizationAssert.isEmpty(list, "编号不允许重复");
|
|
|
|
|
itemClassPO.setCreator((long) user.getUID());
|
|
|
|
|
itemClassPO.setCreateTime(new Date());
|
|
|
|
|
return getResourceBasicInfoMapper().saveResourceItemClass(itemClassPO);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public int updateResourceItemClass(ResourceItemClassPO itemClassPO) {
|
|
|
|
|
itemClassPO.setUpdateTime(new Date());
|
|
|
|
|
return getResourceBasicInfoMapper().updateResourceItemClass(itemClassPO);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public int deleteResourceItemClass(Integer fid) {
|
|
|
|
|
OrganizationAssert.notNull(fid, "选择的数据不存在");
|
|
|
|
|
// 判断该分类下是否有数据
|
|
|
|
|
List<ResourceItemPO> itemByClassId = getResourceBasicInfoMapper().getItemByClassId(fid);
|
|
|
|
|
OrganizationAssert.isTrue(CollectionUtils.isEmpty(itemByClassId), "当前分类已被禁用,无法删除");
|
|
|
|
|
return getResourceBasicInfoMapper().deleteResourceItemClass(fid);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private String buildSqlWhere(Map<String, Object> params) {
|
|
|
|
|
DBType dbType = DBType.get(new RecordSet().getDBType());
|
|
|
|
|
String sqlWhere = " where 1 = 1 ";
|
|
|
|
|