添加字段分组表

pull/77/MERGE^2
dxfeng 3 years ago
parent eb0c55bc9e
commit 2ed79cc994

@ -126,6 +126,20 @@ CREATE TABLE JCL_FIELD_EXTENDGROUP (
CONSTRAINT JCL_FIELD_EXTENDGROUP_PK PRIMARY KEY (id)
);
-- JCL_FIELD_EXTENDTITLE
create table JCL_FIELD_EXTENDTITLE (
id int auto_increment not null,
group_id int null,
title varchar(100) null,
show_order int null,
is_show int null,
creator int null,
delete_type int null,
create_time date null,
update_time date null,
constraint JCL_FIELD_EXTENDTITLE_PK primary key (id)
);
-- JCL_FIELD_EXTENDINFO
CREATE TABLE JCL_FIELD_EXTENDINFO (
id int auto_increment NOT NULL,

@ -128,6 +128,20 @@ CREATE TABLE JCL_FIELD_EXTENDGROUP (
CONSTRAINT JCL_FIELD_EXTENDGROUP_PK PRIMARY KEY (ID)
);
-- JCL_FIELD_EXTENDTITLE
CREATE TABLE JCL_FIELD_EXTENDTITLE (
ID NUMBER NOT NULL,
GROUP_ID NUMBER NULL,
TITLE VARCHAR(100) NULL,
SHOW_ORDER NUMBER NULL,
IS_SHOW NUMBER NULL,
CREATOR NUMBER NULL,
DELETE_TYPE NUMBER NULL,
CREATE_TIME DATE NULL,
UPDATE_TIME DATE NULL,
CONSTRAINT JCL_FIELD_EXTENDTITLE_PK PRIMARY KEY (ID)
);
-- JCL_FIELD_EXTENDINFO
CREATE TABLE JCL_FIELD_EXTENDINFO (
ID NUMBER NOT NULL,

@ -126,6 +126,20 @@ CREATE TABLE JCL_FIELD_EXTENDGROUP (
CONSTRAINT JCL_FIELD_EXTENDGROUP_PK PRIMARY KEY (id)
);
-- JCL_FIELD_EXTENDTITLE
create table JCL_FIELD_EXTENDTITLE (
id int IDENTITY(1,1) NOT NULL,
group_id int null,
title varchar(100) COLLATE Chinese_PRC_CI_AS NULL,
show_order int null,
is_show int null,
creator int null,
delete_type int null,
create_time date null,
update_time date null,
CONSTRAINT JCL_FIELD_EXTENDTITLE_PK PRIMARY KEY (id)
);
-- JCL_FIELD_EXTENDINFO
CREATE TABLE JCL_FIELD_EXTENDINFO (
id int IDENTITY(1,1) NOT NULL,

@ -0,0 +1,49 @@
package com.engine.organization.entity.extend.po;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.Date;
/**
* @author:dxfeng
* @createTime: 2022/06/14
* @version: 1.0
*/
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class ExtendTitlePO {
/**
*
*/
private Long id;
/**
*
*/
private Long groupid;
/**
*
*/
private String title;
/**
*
*/
private Integer showOrder;
/**
*
*/
private Integer isShow;
private Integer creator;
private Integer deleteType;
private Date createTime;
private Date updateTime;
}

@ -0,0 +1,24 @@
package com.engine.organization.mapper.extend;
import com.engine.organization.entity.extend.po.ExtendTitlePO;
import org.apache.ibatis.annotations.Param;
import java.util.Collection;
import java.util.List;
/**
* @author:dxfeng
* @createTime: 2022/06/14
* @version: 1.0
*/
public interface ExtendTitleMapper {
/**
*
*
* @param groupId
* @return
*/
List<ExtendTitlePO> getTitlesByGroupID(@Param("groupId") String groupId);
List<ExtendTitlePO> getTitlesByIds(@Param("ids") Collection<Long> ids);
}

@ -0,0 +1,57 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<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="title" property="title"/>
<result column="show_order" property="showOrder"/>
<result column="is_show" property="isShow"/>
<result column="creator" property="creator"/>
<result column="delete_type" property="deleteType"/>
<result column="create_time" property="createTime"/>
<result column="update_time" property="updateTime"/>
</resultMap>
<!-- 表字段 -->
<sql id="baseColumns">
t
.
id
, t.group_id
, t.title
, show_order
, is_show
, t.creator
, t.delete_type
, t.create_time
, t.update_time
</sql>
<select id="getTitlesByGroupID" resultMap="BaseResultMap">
SELECT
<include refid="baseColumns"/>
FROM
jcl_field_extendtitle t
WHERE t.delete_type = 0
<if test=" groupId != null and groupId != '' ">
and group_id = #{groupId}
</if>
order by show_order
</select>
<select id="getTitlesByIds" resultMap="BaseResultMap">
SELECT
<include refid="baseColumns"/>
FROM
jcl_field_extendtitle t
WHERE t.delete_type = 0
AND id IN
<foreach collection="ids" open="(" item="id" separator="," close=")">
#{id}
</foreach>
order by show_order
</select>
</mapper>

@ -15,9 +15,9 @@ import com.engine.organization.entity.company.bo.CompBO;
import com.engine.organization.entity.company.dto.CompListDTO;
import com.engine.organization.entity.company.param.CompSearchParam;
import com.engine.organization.entity.company.po.CompPO;
import com.engine.organization.entity.extend.po.ExtendGroupPO;
import com.engine.organization.entity.extend.po.ExtendTitlePO;
import com.engine.organization.mapper.comp.CompMapper;
import com.engine.organization.mapper.extend.ExtendGroupMapper;
import com.engine.organization.mapper.extend.ExtendTitleMapper;
import com.engine.organization.service.CompService;
import com.engine.organization.service.ExtService;
import com.engine.organization.util.HasRightUtil;
@ -75,8 +75,8 @@ public class CompServiceImpl extends Service implements CompService {
return MapperProxyFactory.getProxy(CompMapper.class);
}
private ExtendGroupMapper getExtendGroupMapper() {
return MapperProxyFactory.getProxy(ExtendGroupMapper.class);
private ExtendTitleMapper getExtendTitleMapper() {
return MapperProxyFactory.getProxy(ExtendTitleMapper.class);
}
private ExtService getExtService(User user) {
@ -187,7 +187,6 @@ public class CompServiceImpl extends Service implements CompService {
SearchConditionItem compNameItem = OrganizationFormItemUtil.inputItem(user, 2, 16, 2, 50, "名称", "compName");
// 简称
SearchConditionItem compNameShortItem = OrganizationFormItemUtil.inputItem(user, 2, 16, 2, 50, "简称", "compNameShort");
// TODO
// 上级公司
SearchConditionItem compBrowserItem = OrganizationFormItemUtil.browserItem(user, 2, 16, 2, false, "上级公司", "161", "parentCompany", "compBrowser");
// 组织机构代码
@ -240,10 +239,11 @@ public class CompServiceImpl extends Service implements CompService {
if ("0".equals(groupId)) {
groupId = GROUP_ID.toString();
}
List<ExtendGroupPO> extendGroupPOS = getExtendGroupMapper().listGroupByPid(Long.parseLong(groupId));
if (CollectionUtils.isNotEmpty(extendGroupPOS)) {
for (ExtendGroupPO extendGroupPO : extendGroupPOS) {
addGroups.add(new SearchConditionGroup(extendGroupPO.getGroupName(), true, getExtService(user).getExtForm(user, EXTEND_TYPE + "", Integer.parseInt(groupId) >= 0 ? JCL_ORG_COMPEXT : JCL_ORG_COMP, viewAttr, id, extendGroupPO.getId().toString(), "comp_no")));
List<ExtendTitlePO> extendTitles = getExtendTitleMapper().getTitlesByGroupID(groupId);
if (CollectionUtils.isNotEmpty(extendTitles)) {
for (ExtendTitlePO extendTitle : extendTitles) {
addGroups.add(new SearchConditionGroup(extendTitle.getTitle(), true, getExtService(user).getExtForm(user, EXTEND_TYPE + "", Integer.parseInt(groupId) >= 0 ? JCL_ORG_COMPEXT : JCL_ORG_COMP, viewAttr, id, extendTitle.getId() + "", "comp_no")));
}
}
@ -268,10 +268,10 @@ public class CompServiceImpl extends Service implements CompService {
HasRightUtil.hasRight(user, RIGHT_NAME, false);
Map<String, Object> apiDatas = new HashMap<>();
List<SearchConditionGroup> addGroups = new ArrayList<>();
List<ExtendGroupPO> extendGroupPOS = getExtendGroupMapper().listGroupByPid(GROUP_ID);
if (CollectionUtils.isNotEmpty(extendGroupPOS)) {
for (ExtendGroupPO extendGroupPO : extendGroupPOS) {
addGroups.add(new SearchConditionGroup(extendGroupPO.getGroupName(), true, getExtService(user).getExtSaveForm(user, EXTEND_TYPE + "", JCL_ORG_COMP, 2, extendGroupPO.getId().toString(), "comp_no", RuleCodeType.SUBCOMPANY.getValue())));
List<ExtendTitlePO> extendTitles = getExtendTitleMapper().getTitlesByGroupID(GROUP_ID + "");
if (CollectionUtils.isNotEmpty(extendTitles)) {
for (ExtendTitlePO extendTitle : extendTitles) {
addGroups.add(new SearchConditionGroup(extendTitle.getTitle(), true, getExtService(user).getExtSaveForm(user, EXTEND_TYPE + "", JCL_ORG_COMP, 2, extendTitle.getId() + "", "comp_no", RuleCodeType.SUBCOMPANY.getValue())));
}
}
apiDatas.put("condition", addGroups);

@ -6,13 +6,10 @@ import com.engine.organization.entity.TopTab;
import com.engine.organization.entity.codesetting.po.CodeRulePO;
import com.engine.organization.entity.extend.ExtendInfoOperateType;
import com.engine.organization.entity.extend.bo.ExtendInfoBO;
import com.engine.organization.entity.extend.po.ExtendGroupPO;
import com.engine.organization.entity.extend.po.ExtendInfoPO;
import com.engine.organization.entity.extend.po.ExtendTitlePO;
import com.engine.organization.mapper.codesetting.CodeRuleMapper;
import com.engine.organization.mapper.extend.ExtDTMapper;
import com.engine.organization.mapper.extend.ExtMapper;
import com.engine.organization.mapper.extend.ExtendGroupMapper;
import com.engine.organization.mapper.extend.ExtendInfoMapper;
import com.engine.organization.mapper.extend.*;
import com.engine.organization.service.ExtService;
import com.engine.organization.util.OrganizationAssert;
import com.engine.organization.util.db.MapperProxyFactory;
@ -49,6 +46,10 @@ public class ExtServiceImpl extends Service implements ExtService {
return MapperProxyFactory.getProxy(ExtendGroupMapper.class);
}
private ExtendTitleMapper getExtendTitleMapper() {
return MapperProxyFactory.getProxy(ExtendTitleMapper.class);
}
private ExtDTMapper getExtDTMapper() {
return MapperProxyFactory.getProxy(ExtDTMapper.class);
}
@ -158,8 +159,9 @@ public class ExtServiceImpl extends Service implements ExtService {
List<ExtendInfoPO> infoPOList1 = getExtendInfoMapper().listFields(extendType, "", tableName.toLowerCase().replace("ext", ""), ExtendInfoOperateType.EDIT.getValue());
infoPOList.addAll(infoPOList1);
List<Long> ids = infoPOList.stream().map(ExtendInfoPO::getExtendGroupId).collect(Collectors.toList());
List<ExtendGroupPO> extendGroupPOS = getExtendGroupMapper().listGroupByIds(ids);
Set<Long> extendGroups = extendGroupPOS.stream().map(ExtendGroupPO::getPid).collect(Collectors.toSet());
List<ExtendTitlePO> extendTitles = getExtendTitleMapper().getTitlesByIds(ids);
Set<Long> extendGroups = extendTitles.stream().map(ExtendTitlePO::getGroupid).collect(Collectors.toSet());
// 拓展信息
if (CollectionUtils.isNotEmpty(extendGroups)) {
for (Long groupId : extendGroups) {

Loading…
Cancel
Save