upd: 编码规范
This commit is contained in:
+3
-4
@@ -14,10 +14,9 @@ import java.util.Set;
|
|||||||
|
|
||||||
@Mapper
|
@Mapper
|
||||||
public interface DictDetailMapper extends BaseMapper<DictDetail> {
|
public interface DictDetailMapper extends BaseMapper<DictDetail> {
|
||||||
|
List<DictDetail> findDictDetailByDictName(@Param("name") String name);
|
||||||
|
|
||||||
List<DictDetail> selectByDictName(@Param("name") String name);
|
IPage<DictDetail> findDictDetail(@Param("criteria") DictDetailQueryCriteria criteria, Page<Object> page);
|
||||||
|
|
||||||
IPage<DictDetail> selectByPage(@Param("criteria") DictDetailQueryCriteria criteria, Page<Object> page);
|
void deleteDictDetailsByDictIds(@Param("dictIds") Set<Long> dictIds);
|
||||||
|
|
||||||
void deleteBatchByDictIds(@Param("dictIds") Set<Long> dictIds);
|
|
||||||
}
|
}
|
||||||
+2
-2
@@ -29,7 +29,7 @@ public class DictDetailServiceImpl extends ServiceImpl<DictDetailMapper, DictDet
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PageResult<DictDetail> queryAll(DictDetailQueryCriteria criteria, Page<Object> page) {
|
public PageResult<DictDetail> queryAll(DictDetailQueryCriteria criteria, Page<Object> page) {
|
||||||
return PageUtil.toPage(dictDetailMapper.selectByPage(criteria, page));
|
return PageUtil.toPage(dictDetailMapper.findDictDetail(criteria, page));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -57,7 +57,7 @@ public class DictDetailServiceImpl extends ServiceImpl<DictDetailMapper, DictDet
|
|||||||
String key = CacheKey.DICT_NAME + name;
|
String key = CacheKey.DICT_NAME + name;
|
||||||
List<DictDetail> dictDetails = redisUtil.getList(key, DictDetail.class);
|
List<DictDetail> dictDetails = redisUtil.getList(key, DictDetail.class);
|
||||||
if (CollUtil.isEmpty(dictDetails)) {
|
if (CollUtil.isEmpty(dictDetails)) {
|
||||||
dictDetails = dictDetailMapper.selectByDictName(name);
|
dictDetails = dictDetailMapper.findDictDetailByDictName(name);
|
||||||
redisUtil.set(key, dictDetails, 1, TimeUnit.DAYS);
|
redisUtil.set(key, dictDetails, 1, TimeUnit.DAYS);
|
||||||
}
|
}
|
||||||
return dictDetails;
|
return dictDetails;
|
||||||
|
|||||||
+2
-2
@@ -69,14 +69,14 @@ public class DictServiceImpl extends ServiceImpl<DictMapper, Dict> implements Di
|
|||||||
// 删除字典
|
// 删除字典
|
||||||
dictMapper.deleteBatchIds(ids);
|
dictMapper.deleteBatchIds(ids);
|
||||||
// 删除字典详情
|
// 删除字典详情
|
||||||
dictDetailMapper.deleteBatchByDictIds(ids);
|
dictDetailMapper.deleteDictDetailsByDictIds(ids);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void download(List<Dict> dicts, HttpServletResponse response) throws IOException {
|
public void download(List<Dict> dicts, HttpServletResponse response) throws IOException {
|
||||||
List<Map<String, Object>> list = new ArrayList<>();
|
List<Map<String, Object>> list = new ArrayList<>();
|
||||||
for (Dict dict : dicts) {
|
for (Dict dict : dicts) {
|
||||||
List<DictDetail> dictDetails = dictDetailMapper.selectByDictName(dict.getName());
|
List<DictDetail> dictDetails = dictDetailMapper.findDictDetailByDictName(dict.getName());
|
||||||
if (CollectionUtil.isNotEmpty(dictDetails)) {
|
if (CollectionUtil.isNotEmpty(dictDetails)) {
|
||||||
for (DictDetail dictDetail : dictDetails) {
|
for (DictDetail dictDetail : dictDetails) {
|
||||||
Map<String, Object> map = new LinkedHashMap<>();
|
Map<String, Object> map = new LinkedHashMap<>();
|
||||||
|
|||||||
@@ -17,7 +17,18 @@
|
|||||||
</association>
|
</association>
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<select id="selectByPage" resultMap="BaseResultMap">
|
<select id="findDictDetailByDictName" resultMap="BaseResultMap">
|
||||||
|
select
|
||||||
|
dd.id, dd.label, dd.`value`, dd.`dict_sort`, dd.create_by, dd.update_by, dd.create_time, dd.update_time,
|
||||||
|
d.id as dict_id, d.name
|
||||||
|
from sys_dict_detail dd, sys_dict d
|
||||||
|
where dd.dict_id = d.id
|
||||||
|
<if test="name != null and name != ''">
|
||||||
|
and d.name = #{name}
|
||||||
|
</if>
|
||||||
|
order by dd.dict_sort
|
||||||
|
</select>
|
||||||
|
<select id="findDictDetail" resultMap="BaseResultMap">
|
||||||
select
|
select
|
||||||
dd.id, dd.label, dd.`value`, dd.`dict_sort`, dd.create_by, dd.update_by, dd.create_time, dd.update_time,
|
dd.id, dd.label, dd.`value`, dd.`dict_sort`, dd.create_by, dd.update_by, dd.create_time, dd.update_time,
|
||||||
d.id as dict_id, d.name
|
d.id as dict_id, d.name
|
||||||
@@ -31,20 +42,7 @@
|
|||||||
</if>
|
</if>
|
||||||
order by dd.dict_sort, dd.dict_id desc
|
order by dd.dict_sort, dd.dict_id desc
|
||||||
</select>
|
</select>
|
||||||
|
<delete id="deleteDictDetailsByDictIds">
|
||||||
<select id="selectByDictName" resultMap="BaseResultMap">
|
|
||||||
select
|
|
||||||
dd.id, dd.label, dd.`value`, dd.`dict_sort`, dd.create_by, dd.update_by, dd.create_time, dd.update_time,
|
|
||||||
d.id as dict_id, d.name
|
|
||||||
from sys_dict_detail dd, sys_dict d
|
|
||||||
where dd.dict_id = d.id
|
|
||||||
<if test="name != null and name != ''">
|
|
||||||
and d.name = #{name}
|
|
||||||
</if>
|
|
||||||
order by dd.dict_sort
|
|
||||||
</select>
|
|
||||||
|
|
||||||
<delete id="deleteBatchByDictIds">
|
|
||||||
delete from sys_dict_detail
|
delete from sys_dict_detail
|
||||||
where dict_id in
|
where dict_id in
|
||||||
<foreach collection="dictIds" item="item" index="index" open="(" separator="," close=")">
|
<foreach collection="dictIds" item="item" index="index" open="(" separator="," close=")">
|
||||||
|
|||||||
Reference in New Issue
Block a user