|
|
|
package com.engine.organization.service.impl;
|
|
|
|
|
|
|
|
import com.api.browser.bean.SearchConditionGroup;
|
|
|
|
import com.api.browser.bean.SearchConditionItem;
|
|
|
|
import com.engine.core.impl.Service;
|
|
|
|
import com.engine.organization.entity.TopTab;
|
|
|
|
import com.engine.organization.service.GroupService;
|
|
|
|
import com.engine.organization.util.MenuBtn;
|
|
|
|
import com.engine.organization.util.OrganizationAssert;
|
|
|
|
import com.engine.organization.util.OrganizationFormItemUtil;
|
|
|
|
import weaver.conn.RecordSet;
|
|
|
|
import weaver.general.StringUtil;
|
|
|
|
import weaver.general.Util;
|
|
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
import java.util.HashMap;
|
|
|
|
import java.util.List;
|
|
|
|
import java.util.Map;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @description: TODO
|
|
|
|
* @author:dxfeng
|
|
|
|
* @createTime: 2022/05/16
|
|
|
|
* @version: 1.0
|
|
|
|
*/
|
|
|
|
public class GroupServiceImpl extends Service implements GroupService {
|
|
|
|
@Override
|
|
|
|
public Map<String, Object> getGroupFormField(Map<String, Object> params) {
|
|
|
|
Map<String, Object> apiDatas = new HashMap<>();
|
|
|
|
List<SearchConditionItem> selectItems = new ArrayList<>();
|
|
|
|
List<SearchConditionGroup> addGroups = new ArrayList<>();
|
|
|
|
SearchConditionItem companyNameItem = OrganizationFormItemUtil.inputItem(user, 2, 16, 1, 50, "总部名称", "companyname");
|
|
|
|
SearchConditionItem companyDescItem = OrganizationFormItemUtil.inputItem(user, 2, 16, 1, 50, "总部全称", "companydesc");
|
|
|
|
companyDescItem.setRules("required|string");
|
|
|
|
SearchConditionItem companyWebItem = OrganizationFormItemUtil.textareaItem(user, 2, 16, true, 1, 60, "公司网站", "companyweb");
|
|
|
|
|
|
|
|
// 赋值
|
|
|
|
String id = Util.null2String(params.get("id"));
|
|
|
|
if (!StringUtil.isEmpty(id)) {
|
|
|
|
RecordSet rs = new RecordSet();
|
|
|
|
String sql = "select * from HrmCompany where id in(" + id + ")";
|
|
|
|
rs.executeQuery(sql);
|
|
|
|
int colcount = rs.getColCounts();
|
|
|
|
while (rs.next()) {
|
|
|
|
Map<String, Object> row = new HashMap<String, Object>();
|
|
|
|
for (int i = 1; i <= colcount; i++) {
|
|
|
|
row.put(rs.getColumnName(i).toLowerCase(), Util.null2String(rs.getString(i)));
|
|
|
|
}
|
|
|
|
// 赋值
|
|
|
|
companyNameItem.setValue(row.get("companyname"));
|
|
|
|
companyDescItem.setValue(row.get("companydesc"));
|
|
|
|
companyWebItem.setValue(row.get("companyweb"));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 设置编辑属性
|
|
|
|
if (!StringUtil.isEmpty(Util.null2String(params.get("viewattr")))) {
|
|
|
|
int viewAttr = Integer.parseInt(params.get("viewattr").toString());
|
|
|
|
companyNameItem.setViewAttr(viewAttr);
|
|
|
|
companyDescItem.setViewAttr(viewAttr);
|
|
|
|
companyWebItem.setViewAttr(viewAttr);
|
|
|
|
}
|
|
|
|
|
|
|
|
selectItems.add(companyNameItem);
|
|
|
|
selectItems.add(companyDescItem);
|
|
|
|
selectItems.add(companyWebItem);
|
|
|
|
addGroups.add(new SearchConditionGroup("基本信息", true, selectItems));
|
|
|
|
apiDatas.put("condition", addGroups);
|
|
|
|
return apiDatas;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public boolean updateGroup(Map<String, Object> params) {
|
|
|
|
String id = Util.null2String(params.get("id"));
|
|
|
|
OrganizationAssert.notNull(id, "数据有误");
|
|
|
|
String companyname = (String) params.get("companyname");
|
|
|
|
String companydesc = (String) params.get("companydesc");
|
|
|
|
String companyweb = (String) params.get("companyweb");
|
|
|
|
RecordSet rs = new RecordSet();
|
|
|
|
return rs.executeUpdate("update HrmCompany set COMPANYNAME = ?,COMPANYDESC=?,COMPANYWEB=? where id = ?", companyname, companydesc, companyweb, id);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public Map<String, Object> getHasRight() {
|
|
|
|
Map<String, Object> btnDatas = new HashMap<>();
|
|
|
|
ArrayList<MenuBtn> topMenuList = new ArrayList<>();
|
|
|
|
ArrayList<MenuBtn> rightMenuList = new ArrayList<>();
|
|
|
|
// 编辑
|
|
|
|
topMenuList.add(MenuBtn.builder().isTop("1").menuFun("doEdit").menuIcon("icon-coms-edit").menuName("编辑").type("BTN_EDIT").build());
|
|
|
|
btnDatas.put("topMenu", topMenuList);
|
|
|
|
// 编辑
|
|
|
|
rightMenuList.add(MenuBtn.builder().isTop("1").menuFun("doEdit").menuIcon("icon-coms-edit").menuName("编辑").type("BTN_EDIT").build());
|
|
|
|
btnDatas.put("rightMenu", rightMenuList);
|
|
|
|
return btnDatas;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public Map<String, Object> getTabInfo() {
|
|
|
|
Map<String, Object> apiDatas = new HashMap<>();
|
|
|
|
List<TopTab> topTabs = new ArrayList<>();
|
|
|
|
topTabs.add(TopTab.builder().title("总部信息").viewCondition("1").build());
|
|
|
|
apiDatas.put("topTabs", topTabs);
|
|
|
|
|
|
|
|
return apiDatas;
|
|
|
|
}
|
|
|
|
}
|