Commit 67b25290 by zhiwj

修改模块

parent 4242e9b8
package com.gic.cloud.constants;
/**
* @author zhiwj
* @Description:
* @date 2020-07-10 17:02
*/
public enum IndexTypeEnum {
INDEX(1, "指标"),
DIMENSION(2, "维度"),
NOTE(3, "说明");
private Integer code;
private String msg;
IndexTypeEnum(Integer code, String msg) {
this.code = code;
this.msg = msg;
}
public Integer getCode() {
return code;
}
public String getMsg() {
return msg;
}
public static String parse(Integer code) {
for (IndexTypeEnum value : values()) {
if (value.code.equals(code)) {
return value.msg;
}
}
return null;
}
}
......@@ -54,7 +54,7 @@ public class DataExplainDTO implements Serializable {
/**
* 模块id
*/
private Integer moduleId;
private String moduleId;
private Integer optUserId;
private String optUserName;
......@@ -122,11 +122,11 @@ public class DataExplainDTO implements Serializable {
this.status = status;
}
public Integer getModuleId() {
public String getModuleId() {
return moduleId;
}
public void setModuleId(Integer moduleId) {
public void setModuleId(String moduleId) {
this.moduleId = moduleId;
}
......
......@@ -4,6 +4,7 @@ import com.gic.api.base.commons.Page;
import com.gic.api.base.commons.ServiceResponse;
import com.gic.authcenter.security.core.dto.UserDetailsVO;
import com.gic.authcenter.security.core.util.UserUtils;
import com.gic.cloud.constants.IndexTypeEnum;
import com.gic.cloud.dto.IndexDTO;
import com.gic.cloud.dto.IndexLogDTO;
import com.gic.cloud.qo.IndexQO;
......@@ -43,6 +44,7 @@ public class IndexController {
return RestResponse.failure(ErrorCode.PARAMETER_ERROR.getCode(), ErrorCode.PARAMETER_ERROR.getMsg());
}
UserDetailsVO user = UserUtils.getUser();
indexDTO.setClassifyName(IndexTypeEnum.parse(indexDTO.getClassifyType()));
indexDTO.setOptUserId(user.getId());
indexDTO.setOptUserName(user.getRealName());
if (StringUtils.isNotBlank(relModuleIds)) {
......
......@@ -49,7 +49,7 @@ public class TabDataExplain {
/**
* 模块id
*/
private Integer moduleId;
private String moduleId;
public Integer getDataExplainId() {
return dataExplainId;
......@@ -115,11 +115,11 @@ public class TabDataExplain {
this.status = status;
}
public Integer getModuleId() {
public String getModuleId() {
return moduleId;
}
public void setModuleId(Integer moduleId) {
public void setModuleId(String moduleId) {
this.moduleId = moduleId;
}
}
\ No newline at end of file
......@@ -3,6 +3,7 @@ package com.gic.cloud.service.impl;
import com.gic.cloud.dao.mapper.TabIndexModuleRelMapper;
import com.gic.cloud.entity.TabIndexModuleRel;
import com.gic.cloud.service.IndexModuleRelService;
import org.apache.commons.collections.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
......@@ -23,20 +24,22 @@ public class IndexModuleRelServiceImpl implements IndexModuleRelService {
@Override
public void save(Integer businessId, List<String> moduleIdList, Integer type) {
// 把所有关联status设置为0
tabIndexModuleRelMapper.delByBusinessId(businessId, type);
// 插入不存在的关联
for (String moduleId : moduleIdList) {
TabIndexModuleRel rel = new TabIndexModuleRel();
rel.setType(type);
rel.setBusinessId(businessId);
rel.setModuleId(moduleId);
rel.setCreateTime(new Date());
rel.setStatus(1);
tabIndexModuleRelMapper.insertSelectiveByNotExist(rel);
if (CollectionUtils.isNotEmpty(moduleIdList)) {
// 把所有关联status设置为0
tabIndexModuleRelMapper.delByBusinessId(businessId, type);
// 插入不存在的关联
for (String moduleId : moduleIdList) {
TabIndexModuleRel rel = new TabIndexModuleRel();
rel.setType(type);
rel.setBusinessId(businessId);
rel.setModuleId(moduleId);
rel.setCreateTime(new Date());
rel.setStatus(1);
tabIndexModuleRelMapper.insertSelectiveByNotExist(rel);
}
// 把所有userId关联status都设置为1
tabIndexModuleRelMapper.updateStatusByBusinessIds(businessId, moduleIdList, type);
}
// 把所有userId关联status都设置为1
tabIndexModuleRelMapper.updateStatusByBusinessIds(businessId, moduleIdList, type);
}
@Override
......
......@@ -11,6 +11,7 @@ import com.github.pagehelper.PageHelper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.List;
/**
......@@ -43,6 +44,9 @@ public class IndexServiceImpl implements IndexService {
@Override
public Integer save(IndexDTO indexDTO) {
TabIndex tabIndex = EntityUtil.changeEntityByJSON(TabIndex.class, indexDTO);
tabIndex.setStatus(1);
tabIndex.setCreateTime(new Date());
tabIndex.setUpdateTime(new Date());
tabIndexMapper.insertSelective(tabIndex);
return tabIndex.getIndexId();
}
......
......@@ -10,7 +10,7 @@
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
<result column="status" jdbcType="INTEGER" property="status" />
<result column="module_id" jdbcType="INTEGER" property="moduleId" />
<result column="module_id" jdbcType="VARCHAR" property="moduleId" />
</resultMap>
<sql id="Base_Column_List">
data_explain_id, data_name, data_classify, index_remark, complement, create_time,
......@@ -33,7 +33,7 @@
)
values (#{dataExplainId,jdbcType=INTEGER}, #{dataName,jdbcType=VARCHAR}, #{dataClassify,jdbcType=VARCHAR},
#{indexRemark,jdbcType=VARCHAR}, #{complement,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP},
#{updateTime,jdbcType=TIMESTAMP}, #{status,jdbcType=INTEGER}, #{moduleId,jdbcType=INTEGER}
#{updateTime,jdbcType=TIMESTAMP}, #{status,jdbcType=INTEGER}, #{moduleId,jdbcType=VARCHAR}
)
</insert>
<insert id="insertSelective" parameterType="com.gic.cloud.entity.TabDataExplain">
......@@ -96,7 +96,7 @@
#{status,jdbcType=INTEGER},
</if>
<if test="moduleId != null">
#{moduleId,jdbcType=INTEGER},
#{moduleId,jdbcType=VARCHAR},
</if>
</trim>
</insert>
......@@ -125,7 +125,7 @@
status = #{status,jdbcType=INTEGER},
</if>
<if test="moduleId != null">
module_id = #{moduleId,jdbcType=INTEGER},
module_id = #{moduleId,jdbcType=VARCHAR},
</if>
</set>
where data_explain_id = #{dataExplainId,jdbcType=INTEGER}
......@@ -139,7 +139,7 @@
create_time = #{createTime,jdbcType=TIMESTAMP},
update_time = #{updateTime,jdbcType=TIMESTAMP},
status = #{status,jdbcType=INTEGER},
module_id = #{moduleId,jdbcType=INTEGER}
module_id = #{moduleId,jdbcType=VARCHAR}
where data_explain_id = #{dataExplainId,jdbcType=INTEGER}
</update>
<!-- getBySelective-->
......@@ -147,14 +147,11 @@
select
<include refid="Base_Column_List" />
from tab_data_explain where status = 1
<if test="data_name != null ">
and data_name = #{data_name}
<if test="dataName != null ">
and data_name = #{dataName}
</if>
<if test="null != ids and ids.size > 0">
and data_explain_id in
<foreach collection="ids" index="index" item="item" open="(" separator="," close=")">
#{item}
</foreach>
<if test="dataExplainId != null ">
and data_explain_id &lt;&gt; #{dataExplainId}
</if>
</select>
<select id="listDataExplain" resultMap="BaseResultMap">
......
......@@ -127,7 +127,7 @@
status
) SELECT
#{type},
#{busisessId},
#{businessId},
#{moduleId},
#{createTime},
#{updateTime},
......@@ -150,7 +150,7 @@
<update id="updateStatusByBusinessIds">
update tab_index_module_rel set status = 1 where business_id = #{businessId} and `type` = #{type}
<if test="null != ids and ids.size > 0">
and business_id in
and module_id in
<foreach collection="ids" index="index" item="item" open="(" separator="," close=")">
#{item}
</foreach>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment