Browse Source

模块排序+模块类型新增

feature/syp_points
songyunpeng 5 years ago
parent
commit
5614a7d312
  1. 8
      esua-epdc/epdc-module/epdc-events/epdc-events-server/src/main/java/com/elink/esua/epdc/modules/category/entity/CategoryEntity.java
  2. 37
      esua-epdc/epdc-module/epdc-news/epdc-news-server/src/main/java/com/elink/esua/epdc/service/impl/NoticeServiceImpl.java
  3. 6
      esua-epdc/epdc-module/epdc-news/epdc-news-server/src/main/resources/mapper/ModuleCategoryDao.xml

8
esua-epdc/epdc-module/epdc-events/epdc-events-server/src/main/java/com/elink/esua/epdc/modules/category/entity/CategoryEntity.java

@ -17,13 +17,14 @@
package com.elink.esua.epdc.modules.category.entity;
import com.baomidou.mybatisplus.annotation.*;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableName;
import com.elink.esua.epdc.commons.mybatis.entity.BaseEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.io.Serializable;
import java.util.Date;
/**
@ -73,6 +74,7 @@ public class CategoryEntity extends BaseEntity {
* 删除标识 0未删除 1删除
*/
@TableField(fill = FieldFill.INSERT)
@TableLogic
private Integer delFlag;
/**

37
esua-epdc/epdc-module/epdc-news/epdc-news-server/src/main/java/com/elink/esua/epdc/service/impl/NoticeServiceImpl.java

@ -29,6 +29,7 @@ import com.elink.esua.epdc.commons.tools.security.user.SecurityUser;
import com.elink.esua.epdc.commons.tools.security.user.UserDetail;
import com.elink.esua.epdc.commons.tools.utils.ConvertUtils;
import com.elink.esua.epdc.commons.tools.utils.Result;
import com.elink.esua.epdc.dao.ModuleCategoryDao;
import com.elink.esua.epdc.dao.NoticeDao;
import com.elink.esua.epdc.dto.NoticeDTO;
import com.elink.esua.epdc.dto.ParentAndAllDeptDTO;
@ -38,6 +39,7 @@ import com.elink.esua.epdc.dto.epdc.form.EpdcNoticeListFormDTO;
import com.elink.esua.epdc.dto.epdc.form.v2.EpdcNoticeListV2FormDTO;
import com.elink.esua.epdc.dto.epdc.result.EpdcNoticeDetailResultDTO;
import com.elink.esua.epdc.dto.epdc.result.EpdcNoticeListResultDTO;
import com.elink.esua.epdc.entity.ModuleCategoryEntity;
import com.elink.esua.epdc.entity.NoticeEntity;
import com.elink.esua.epdc.feign.AdminFeignClient;
import com.elink.esua.epdc.redis.NoticeRedis;
@ -74,6 +76,9 @@ public class NoticeServiceImpl extends BaseServiceImpl<NoticeDao, NoticeEntity>
@Autowired
private ModuleCategoryService moduleCategoryService;
@Autowired
private ModuleCategoryDao moduleCategoryDao;
@Override
public PageData<NoticeDTO> page(Map<String, Object> params) {
String noticeTitle = (String) params.get("noticeTitle");
@ -224,6 +229,36 @@ public class NoticeServiceImpl extends BaseServiceImpl<NoticeDao, NoticeEntity>
this.noticeDepartmentService.save(entity.getId(), noticeGridList);
}
/**
* @Description 更新通知模块的更新时间
* @Author songyunpeng
* @Date 2020/11/18
* @Param [noticeCategory]
* @return void
**/
private void updateModuleCategoryUpdateTime(String noticeId) {
try {
NoticeEntity noticeEntity = baseDao.selectById(noticeId);
Map<String,Object> param = new HashMap<>();
param.put("CATEGORY_CODE",noticeEntity.getNoticeCategory());
List<ModuleCategoryEntity> moduleCategoryEntities = moduleCategoryDao.selectByMap(param);
if(moduleCategoryEntities!=null && moduleCategoryEntities.size()>0){
ModuleCategoryEntity moduleCategoryEntity = moduleCategoryEntities.get(0);
//获取第二层模块
String[] pIds = moduleCategoryEntity.getPids().split(",");
//长度大于等于2代表处于大于或等于三级模块,此时只更新二级模块顺序
if(pIds.length>=2){
ModuleCategoryEntity secModuleCategory = moduleCategoryDao.selectById(pIds[1]);
if(secModuleCategory!=null){
secModuleCategory.setSort(0);
moduleCategoryDao.updateById(secModuleCategory);
}
}
}
}catch (Exception e){
e.printStackTrace();
}
}
@Override
@Transactional(rollbackFor = Exception.class)
@ -242,6 +277,8 @@ public class NoticeServiceImpl extends BaseServiceImpl<NoticeDao, NoticeEntity>
entity.setNoticeReleaseState(YesOrNoEnum.YES.value());
entity.setReleaseTime(new Date());
this.updateById(entity);
//更新通知模块的更新时间
updateModuleCategoryUpdateTime(noticeId);
}
@Override

6
esua-epdc/epdc-module/epdc-news/epdc-news-server/src/main/resources/mapper/ModuleCategoryDao.xml

@ -26,12 +26,12 @@
<select id="getList" resultType="com.elink.esua.epdc.entity.ModuleCategoryEntity">
select t1.*,t1.id as value,t1.category_name as label,(select t2.category_name from epdc_module_category t2 where t2.id=t1.pid)parentName from epdc_module_category t1
where t1.del_flag = '0'
order by t1.sort asc
order by t1.UPDATED_TIME desc,t1.sort
</select>
<select id="getListToShow" resultType="com.elink.esua.epdc.entity.ModuleCategoryEntity">
select t1.*,t1.id as value,t1.category_name as label,(select t2.category_name from epdc_module_category t2 where t2.id=t1.pid)parentName from epdc_module_category t1
where t1.del_flag = '0' and t1.ENABLE_FLAG = '1'
where t1.del_flag = '0' and t1.ENABLE_FLAG = '1' and CATEGORY_TYPE != 'module_category_type_button'
order by t1.sort asc
</select>
<select id="selectListCategoryTreeDTO" resultType="com.elink.esua.epdc.dto.ModuleCategoryTreeDTO">
@ -65,7 +65,7 @@
SORT
from epdc_module_category
where DEL_FLAG='0' and ENABLE_FLAG ='1' and PID = #{pid}
order by sort
order by updatedTime desc,sort
LIMIT #{pageIndex},#{pageSize}
</select>
<select id="getModuleCategoryIdsHierarchy" resultType="java.lang.String">

Loading…
Cancel
Save