自定义字段 getTabInfo
This commit is contained in:
parent
5b0864d503
commit
9259596e54
|
|
@ -25,7 +25,7 @@ public class ExtendTitlePO {
|
|||
/**
|
||||
* 分组标识
|
||||
*/
|
||||
private Long groupid;
|
||||
private Long groupId;
|
||||
|
||||
/**
|
||||
* 分组名称
|
||||
|
|
@ -39,7 +39,7 @@ public class ExtendTitlePO {
|
|||
/**
|
||||
* 是否展示
|
||||
*/
|
||||
private Integer isShow;
|
||||
private String isShow;
|
||||
|
||||
|
||||
private Integer creator;
|
||||
|
|
|
|||
|
|
@ -21,4 +21,6 @@ public interface ExtendInfoMapper {
|
|||
* @return
|
||||
*/
|
||||
List<ExtendInfoPO> listFields(@Param("extendType") String extendType, @Param("extendGroupId") String extendGroupId, @Param("tableName") String tableName,@Param("operateType")String operateType);
|
||||
|
||||
int countFieldsByGroupId(@Param("groupId") Long groupId);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -75,6 +75,12 @@
|
|||
</if>
|
||||
order by show_order
|
||||
</select>
|
||||
<select id="countFieldsByGroupId" resultType="java.lang.Integer">
|
||||
select count(1)
|
||||
from jcl_field_extendinfo t
|
||||
where t.delete_type = 0
|
||||
and extend_group_id = #{groupId}
|
||||
</select>
|
||||
|
||||
|
||||
</mapper>
|
||||
|
|
@ -3,7 +3,7 @@
|
|||
<mapper namespace="com.engine.organization.mapper.extend.ExtendTitleMapper">
|
||||
<resultMap id="BaseResultMap" type="com.engine.organization.entity.extend.po.ExtendTitlePO">
|
||||
<result column="id" property="id"/>
|
||||
<result column="group_id" property="groupid"/>
|
||||
<result column="group_id" property="groupId"/>
|
||||
<result column="title" property="title"/>
|
||||
<result column="show_order" property="showOrder"/>
|
||||
<result column="is_show" property="isShow"/>
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ package com.engine.organization.service;
|
|||
import com.engine.organization.entity.fieldset.TypeTreeDTO;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @Author weaver_cl
|
||||
|
|
@ -12,7 +13,15 @@ import java.util.List;
|
|||
**/
|
||||
public interface FieldDefinedService {
|
||||
|
||||
|
||||
|
||||
List<TypeTreeDTO> getTree(String moduleName);
|
||||
|
||||
/**
|
||||
* 获取标题分组
|
||||
*
|
||||
* @param groupType
|
||||
* @return
|
||||
*/
|
||||
Map<String, Object> getTabInfo(String groupType);
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -160,7 +160,7 @@ public class ExtServiceImpl extends Service implements ExtService {
|
|||
infoPOList.addAll(infoPOList1);
|
||||
List<Long> ids = infoPOList.stream().map(ExtendInfoPO::getExtendGroupId).collect(Collectors.toList());
|
||||
List<ExtendTitlePO> extendTitles = getExtendTitleMapper().getTitlesByIds(ids);
|
||||
Set<Long> extendGroups = extendTitles.stream().map(ExtendTitlePO::getGroupid).collect(Collectors.toSet());
|
||||
Set<Long> extendGroups = extendTitles.stream().map(ExtendTitlePO::getGroupId).collect(Collectors.toSet());
|
||||
|
||||
// 拓展信息
|
||||
if (CollectionUtils.isNotEmpty(extendGroups)) {
|
||||
|
|
|
|||
|
|
@ -1,11 +1,18 @@
|
|||
package com.engine.organization.service.impl;
|
||||
|
||||
import com.engine.core.impl.Service;
|
||||
import com.engine.organization.entity.extend.po.ExtendTitlePO;
|
||||
import com.engine.organization.entity.fieldset.TypeTreeDTO;
|
||||
import com.engine.organization.mapper.extend.ExtendInfoMapper;
|
||||
import com.engine.organization.mapper.extend.ExtendTitleMapper;
|
||||
import com.engine.organization.service.FieldDefinedService;
|
||||
import com.engine.organization.util.OrganizationAssert;
|
||||
import com.engine.organization.util.db.MapperProxyFactory;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @Author weaver_cl
|
||||
|
|
@ -14,6 +21,13 @@ import java.util.List;
|
|||
* @Version V1.0
|
||||
**/
|
||||
public class FieldDefinedServiceImpl extends Service implements FieldDefinedService {
|
||||
private ExtendTitleMapper getExtendTitleMapper() {
|
||||
return MapperProxyFactory.getProxy(ExtendTitleMapper.class);
|
||||
}
|
||||
|
||||
private ExtendInfoMapper getExtendInfoMapper() {
|
||||
return MapperProxyFactory.getProxy(ExtendInfoMapper.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<TypeTreeDTO> getTree(String moduleName) {
|
||||
|
|
@ -21,4 +35,37 @@ public class FieldDefinedServiceImpl extends Service implements FieldDefinedServ
|
|||
//int extendType =
|
||||
return typeTreeDTOS;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> getTabInfo(String groupType) {
|
||||
OrganizationAssert.notBlank(groupType, "分组信息有误,请确认");
|
||||
Map<String, Object> datas = new HashMap<>();
|
||||
Long groupId = Long.parseLong(groupType);
|
||||
List<ExtendTitlePO> extendTitleList = getExtendTitleMapper().getTitlesByGroupID(groupId);
|
||||
List<Map<String, Object>> tabs = new ArrayList<>();
|
||||
int idx = 1;
|
||||
for (ExtendTitlePO extendTitle : extendTitleList) {
|
||||
Map<String, Object> tab = new HashMap<>();
|
||||
tab.put("tabkey", idx++);
|
||||
tab.put("title", extendTitle.getTitle());
|
||||
tab.put("isShow", extendTitle.getIsShow());
|
||||
tab.put("groupid", extendTitle.getGroupId());
|
||||
tab.put("viewAttr", extendTitle.getGroupId() < 0 ? 1 : 2);
|
||||
tab.put("editable", editTable(extendTitle.getId()));
|
||||
tabs.add(tab);
|
||||
}
|
||||
datas.put("status", "1");
|
||||
datas.put("tabs", tabs);
|
||||
return datas;
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断该分组下是否有字段
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
private boolean editTable(Long id) {
|
||||
return getExtendInfoMapper().countFieldsByGroupId(id) > 0;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
package com.engine.organization.web;
|
||||
|
||||
import com.engine.common.util.ParamUtil;
|
||||
import com.engine.common.util.ServiceUtil;
|
||||
import com.engine.organization.util.response.ReturnResult;
|
||||
import com.engine.organization.wrapper.FieldDefinedWrapper;
|
||||
|
|
@ -14,6 +15,7 @@ import javax.ws.rs.PathParam;
|
|||
import javax.ws.rs.Produces;
|
||||
import javax.ws.rs.core.Context;
|
||||
import javax.ws.rs.core.MediaType;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @Author weaver_cl
|
||||
|
|
@ -24,7 +26,7 @@ import javax.ws.rs.core.MediaType;
|
|||
public class FieldDefinedController {
|
||||
|
||||
private FieldDefinedWrapper getFieldDefinedWrapper(User user) {
|
||||
return ServiceUtil.getService(FieldDefinedWrapper.class,user);
|
||||
return ServiceUtil.getService(FieldDefinedWrapper.class, user);
|
||||
}
|
||||
|
||||
@GET
|
||||
|
|
@ -39,4 +41,18 @@ public class FieldDefinedController {
|
|||
return ReturnResult.exceptionHandle(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@GET
|
||||
@Path("/getTabInfo")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public ReturnResult getTabInfo(@Context HttpServletRequest request, @Context HttpServletResponse response) {
|
||||
try {
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
Map<String, Object> map = ParamUtil.request2Map(request);
|
||||
String groupType = (String) map.get("groupType");
|
||||
return ReturnResult.successed(getFieldDefinedWrapper(user).getTabInfo(groupType));
|
||||
} catch (Exception e) {
|
||||
return ReturnResult.exceptionHandle(e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ import com.engine.organization.util.response.ReturnResult;
|
|||
import weaver.hrm.User;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @Author weaver_cl
|
||||
|
|
@ -19,7 +20,7 @@ import java.util.List;
|
|||
public class FieldDefinedWrapper extends Service {
|
||||
|
||||
private FieldDefinedService getFieldDefinedService(User user) {
|
||||
return ServiceUtil.getService(FieldDefinedServiceImpl.class,user);
|
||||
return ServiceUtil.getService(FieldDefinedServiceImpl.class, user);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -27,4 +28,14 @@ public class FieldDefinedWrapper extends Service {
|
|||
List<TypeTreeDTO> treeDTOS = getFieldDefinedService(user).getTree(moduleName);
|
||||
return ReturnResult.successed();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取标题分组
|
||||
*
|
||||
* @param groupType
|
||||
* @return
|
||||
*/
|
||||
public Map<String, Object> getTabInfo(String groupType) {
|
||||
return getFieldDefinedService(user).getTabInfo(groupType);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue