Compare commits
No commits in common. "2ab7a547748ce09bf3a62e9ef87f603917d8c121" and "1479666516e8249b4286186fbdd48f72f2c33fea" have entirely different histories.
2ab7a54774
...
1479666516
|
@ -53,10 +53,6 @@ public class SysDictData extends BaseEntity
|
||||||
@Excel(name = "状态", readConverterExp = "0=正常,1=停用")
|
@Excel(name = "状态", readConverterExp = "0=正常,1=停用")
|
||||||
private String status;
|
private String status;
|
||||||
|
|
||||||
/**
|
|
||||||
* 父级ID标志
|
|
||||||
*/
|
|
||||||
@Excel(name = "父级ID标志")
|
|
||||||
private Integer partId;
|
private Integer partId;
|
||||||
|
|
||||||
public Integer getPartId() {
|
public Integer getPartId() {
|
||||||
|
|
|
@ -31,13 +31,7 @@ public class DictInit implements ApplicationRunner {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run(ApplicationArguments args) throws Exception {
|
public void run(ApplicationArguments args) throws Exception {
|
||||||
this.dict();
|
|
||||||
}
|
|
||||||
|
|
||||||
//初始化防擦
|
|
||||||
public void dict(){
|
|
||||||
|
|
||||||
long startTime = System.currentTimeMillis(); // 记录开始时间
|
|
||||||
log.info("初始化字典数据...");
|
log.info("初始化字典数据...");
|
||||||
|
|
||||||
SysDictData dictData = new SysDictData();
|
SysDictData dictData = new SysDictData();
|
||||||
|
@ -59,8 +53,7 @@ public class DictInit implements ApplicationRunner {
|
||||||
));
|
));
|
||||||
dictCache.put(type, subMap);
|
dictCache.put(type, subMap);
|
||||||
});
|
});
|
||||||
long cost = System.currentTimeMillis() - startTime; // 计算耗时
|
log.info("字典数据初始化完成...");
|
||||||
log.info("字典数据初始化完成,耗时 {} 毫秒", cost); // 打印耗时
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1,14 +1,12 @@
|
||||||
package com.mcwl.system.service.impl;
|
package com.mcwl.system.service.impl;
|
||||||
|
|
||||||
import com.mcwl.common.core.domain.entity.SysDictData;
|
import java.util.List;
|
||||||
import com.mcwl.common.utils.DictUtils;
|
|
||||||
import com.mcwl.system.init.DictInit;
|
|
||||||
import com.mcwl.system.mapper.SysDictDataMapper;
|
|
||||||
import com.mcwl.system.service.ISysDictDataService;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
import com.mcwl.common.core.domain.entity.SysDictData;
|
||||||
import java.util.List;
|
import com.mcwl.common.utils.DictUtils;
|
||||||
|
import com.mcwl.system.mapper.SysDictDataMapper;
|
||||||
|
import com.mcwl.system.service.ISysDictDataService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 字典 业务层处理
|
* 字典 业务层处理
|
||||||
|
@ -21,9 +19,6 @@ public class SysDictDataServiceImpl implements ISysDictDataService
|
||||||
@Autowired
|
@Autowired
|
||||||
private SysDictDataMapper dictDataMapper;
|
private SysDictDataMapper dictDataMapper;
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private DictInit dictInit;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据条件分页查询字典数据
|
* 根据条件分页查询字典数据
|
||||||
*
|
*
|
||||||
|
@ -75,8 +70,6 @@ public class SysDictDataServiceImpl implements ISysDictDataService
|
||||||
dictDataMapper.deleteDictDataById(dictCode);
|
dictDataMapper.deleteDictDataById(dictCode);
|
||||||
List<SysDictData> dictDatas = dictDataMapper.selectDictDataByType(data.getDictType());
|
List<SysDictData> dictDatas = dictDataMapper.selectDictDataByType(data.getDictType());
|
||||||
DictUtils.setDictCache(data.getDictType(), dictDatas);
|
DictUtils.setDictCache(data.getDictType(), dictDatas);
|
||||||
//初始化字典
|
|
||||||
dictInit.dict();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -94,8 +87,6 @@ public class SysDictDataServiceImpl implements ISysDictDataService
|
||||||
{
|
{
|
||||||
List<SysDictData> dictDatas = dictDataMapper.selectDictDataByType(data.getDictType());
|
List<SysDictData> dictDatas = dictDataMapper.selectDictDataByType(data.getDictType());
|
||||||
DictUtils.setDictCache(data.getDictType(), dictDatas);
|
DictUtils.setDictCache(data.getDictType(), dictDatas);
|
||||||
//初始化字典
|
|
||||||
dictInit.dict();
|
|
||||||
}
|
}
|
||||||
return row;
|
return row;
|
||||||
}
|
}
|
||||||
|
@ -114,8 +105,6 @@ public class SysDictDataServiceImpl implements ISysDictDataService
|
||||||
{
|
{
|
||||||
List<SysDictData> dictDatas = dictDataMapper.selectDictDataByType(data.getDictType());
|
List<SysDictData> dictDatas = dictDataMapper.selectDictDataByType(data.getDictType());
|
||||||
DictUtils.setDictCache(data.getDictType(), dictDatas);
|
DictUtils.setDictCache(data.getDictType(), dictDatas);
|
||||||
//初始化字典表
|
|
||||||
dictInit.dict();
|
|
||||||
}
|
}
|
||||||
return row;
|
return row;
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,9 +32,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<if test="dictType != null and dictType != ''">
|
<if test="dictType != null and dictType != ''">
|
||||||
AND dict_type = #{dictType}
|
AND dict_type = #{dictType}
|
||||||
</if>
|
</if>
|
||||||
<if test="partId != null and partId != ''">
|
|
||||||
AND part_id = #{partId}
|
|
||||||
</if>
|
|
||||||
<if test="dictLabel != null and dictLabel != ''">
|
<if test="dictLabel != null and dictLabel != ''">
|
||||||
AND dict_label like concat('%', #{dictLabel}, '%')
|
AND dict_label like concat('%', #{dictLabel}, '%')
|
||||||
</if>
|
</if>
|
||||||
|
@ -109,7 +106,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<if test="status != null">status,</if>
|
<if test="status != null">status,</if>
|
||||||
<if test="remark != null and remark != ''">remark,</if>
|
<if test="remark != null and remark != ''">remark,</if>
|
||||||
<if test="createBy != null and createBy != ''">create_by,</if>
|
<if test="createBy != null and createBy != ''">create_by,</if>
|
||||||
<if test="partId != null and partId != ''">part_id,</if>
|
|
||||||
create_time
|
create_time
|
||||||
)values(
|
)values(
|
||||||
<if test="dictSort != null">#{dictSort},</if>
|
<if test="dictSort != null">#{dictSort},</if>
|
||||||
|
@ -122,7 +118,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<if test="status != null">#{status},</if>
|
<if test="status != null">#{status},</if>
|
||||||
<if test="remark != null and remark != ''">#{remark},</if>
|
<if test="remark != null and remark != ''">#{remark},</if>
|
||||||
<if test="createBy != null and createBy != ''">#{createBy},</if>
|
<if test="createBy != null and createBy != ''">#{createBy},</if>
|
||||||
<if test="partId != null and partId != ''">#{partId},</if>
|
|
||||||
sysdate()
|
sysdate()
|
||||||
)
|
)
|
||||||
</insert>
|
</insert>
|
||||||
|
|
Loading…
Reference in New Issue