pull/46/head
Chengliang 2 years ago
parent c2a1908c10
commit 4777e3d3dc

@ -570,10 +570,25 @@ create table JCL_ORG_CARDACCESS (
all_people int null,
superior int null,
all_superior int null,
custom text null ,
custom varchar(2000) null ,
delete_type int null,
creator int null,
create_time date null,
update_time date null,
constraint JCL_ORG_CARDACCESS_PK primary key (id)
);
-- JCL_ORG_CARDBUTTON
create table JCL_ORG_CARDBUTTON (
id BIGINT auto_increment not null,
name varchar(255) not null,
status int null,
url varchar(255) null,
role varchar(2000) null,
defaults int not null,
creator int null,
delete_type int null,
create_time date null,
update_time date null,
constraint JCL_ORG_CARDBUTTON_PK primary key (id)
);

@ -55,7 +55,7 @@ public class CardAccessVO {
@OrganizationTableColumn(text = "所有上级可见", width = "15%", column = "all_superior")
private Integer allSuperior;
@OrganizationTableColumn(text = "查看自定义", width = "15%", column = "custom",transmethod = "com.engine.organization.transmethod.ManagerDetachTransMethod.getRoleLevel")
@OrganizationTableColumn(text = "查看自定义", width = "15%", column = "custom",transmethod = "com.engine.organization.transmethod.SystemTransMethod.getRoleName")
private String custom;
}

@ -19,7 +19,7 @@ public interface CardAccessMapper {
int insertIgnoreNull(CardAccessPO cardAccessPO);
int saveCardAccess(@Param("dataList") List<HashMap<String, Object>> dataList);
int saveCardAccess(@Param("dataList") List<CardAccessPO> dataList);
int deleteByIds(@Param("ids") Collection<Long> ids);

@ -42,7 +42,7 @@
<if test="typeId != null ">
type_id,
</if>
<if test="typeName != null || typeName != ''">
<if test="typeName != null and typeName != ''">
type_name,
</if>
<if test="status != null ">
@ -77,7 +77,7 @@
<if test="typeId != null ">
#{typeId},
</if>
<if test="typeName != null || typeName != ''">
<if test="typeName != null and typeName != ''">
#{typeName},
</if>
<if test="status != null ">
@ -119,7 +119,7 @@
<if test="typeId != null ">
type_id,
</if>
<if test="typeName != null || typeName != ''">
<if test="typeName != null and typeName != ''">
type_name,
</if>
<if test="status != null ">
@ -154,7 +154,7 @@
<if test="typeId != null ">
#{typeId},
</if>
<if test="typeName != null || typeName != ''">
<if test="typeName != null and typeName != ''">
#{typeName},
</if>
<if test="status != null ">
@ -189,30 +189,53 @@
<update id="saveCardAccess">
<foreach collection="dataList" item="item" index="index" open="" close="" separator=";">
<update id="saveCardAccess" parameterType="java.util.List">
update jcl_org_cardaccess
<set>
<trim prefix="set" suffixOverrides=",">
<trim prefix="status =case" suffix="end,">
<foreach collection="dataList" item="item" index="index">
<if test="item.status != null">
status = #{item.status},
when id=#{item.id} then #{item.status}
</if>
</foreach>
</trim>
<trim prefix="all_people =case" suffix="end,">
<foreach collection="dataList" item="item" index="index">
<if test="item.allPeople != null">
all_people = #{item.allPeople},
when id=#{item.id} then #{item.allPeople}
</if>
</foreach>
</trim>
<trim prefix="superior =case" suffix="end,">
<foreach collection="dataList" item="item" index="index">
<if test="item.superior != null">
superior = #{item.superior},
when id=#{item.id} then #{item.superior}
</if>
</foreach>
</trim>
<trim prefix="all_superior =case" suffix="end,">
<foreach collection="dataList" item="item" index="index">
<if test="item.allSuperior != null">
all_superior = #{item.allSuperior},
</if>
<if test="item.custom != null">
custom = #{item.custom},
when id=#{item.id} then #{item.allSuperior}
</if>
</foreach>
</trim>
<trim prefix="custom =case" suffix="end,">
<foreach collection="dataList" item="item" index="index">
when id=#{item.id} then #{item.custom}
</foreach>
</trim>
<trim prefix="update_time =case" suffix="end,">
<foreach collection="dataList" item="item" index="index">
<if test="item.updateTime != null">
update_time = #{item.updateTime}
when id=#{item.id} then #{item.updateTime}
</if>
</set>
where id = #{item.id}
</foreach>
</trim>
</trim>
where
<foreach collection="dataList" separator="or" item="item" index="index" >
id=#{item.id}
</foreach>
</update>

@ -54,16 +54,17 @@ public class CardAccessServiceImpl extends Service implements CardAccessService
@Override
public int save(Map<String, Object> params) {
int rowNum = Util.getIntValue((String) params.get("rownum"));
List<HashMap<String, Object>> dataList = new ArrayList<>();
List<CardAccessPO> dataList = new ArrayList<>();
for (int i = 0; i < rowNum; i++) {
HashMap<String, Object> data = new HashMap<>();
data.put("id",params.get("id_"+i));
data.put("status",params.get("status_"+i));
data.put("allPeople",params.get("all_people_"+i));
data.put("superior",params.get("superior_"+i));
data.put("allSuperior",params.get("all_superior_"+i));
data.put("custom",params.get("custom"+i));
data.put("updateTime",new Date());
CardAccessPO data = CardAccessPO.builder()
.id(Util.getIntValue((String)params.get("id_"+i)))
.status(Util.getIntValue((String)params.get("status_"+i)))
.allPeople(Util.getIntValue((String)params.get("all_people_"+i)))
.superior(Util.getIntValue((String)params.get("superior_"+i)))
.allSuperior(Util.getIntValue((String)params.get("all_superior_"+i)))
.custom(Util.null2String(params.get("custom_"+i)))
.updateTime(new Date())
.build();
dataList.add(data);
}
return getCardAccessMapper().saveCardAccess(dataList);

@ -0,0 +1,28 @@
package com.engine.organization.transmethod;
import org.apache.commons.lang3.StringUtils;
import weaver.hrm.roles.RolesComInfo;
import java.util.ArrayList;
import java.util.List;
/**
* @Author weaver_cl
* @Description:
* @Date 2022/11/9
* @Version V1.0
**/
public class SystemTransMethod {
public static String getRoleName(String roleIds) {
RolesComInfo rolesComInfo = new RolesComInfo();
List<String> list = new ArrayList<>();
if (StringUtils.isNotBlank(roleIds)) {
for (String roleId : roleIds.split(",")) {
list.add(rolesComInfo.getRolesname(roleId));
}
}
return StringUtils.join(list,",");
}
}
Loading…
Cancel
Save