lizijie
2021-08-24 7f809646f280f92ddcecad909606a1e5f08959d5
页面布局修改
4 files modified
62 ■■■■■ changed files
screen-manage/src/main/java/com/moral/api/controller/OrganizationLayoutController.java 3 ●●●● patch | view | raw | blame | history
screen-manage/src/main/java/com/moral/api/entity/OrganizationLayout.java 5 ●●●●● patch | view | raw | blame | history
screen-manage/src/main/java/com/moral/api/service/OrganizationLayoutService.java 3 ●●●●● patch | view | raw | blame | history
screen-manage/src/main/java/com/moral/api/service/impl/OrganizationLayoutServiceImpl.java 51 ●●●●● patch | view | raw | blame | history
screen-manage/src/main/java/com/moral/api/controller/OrganizationLayoutController.java
@@ -52,9 +52,8 @@
        Map<String, Integer> map = new HashMap<>();
        map.put("organization_id",organization_id);
        map.put("version_id",version_id);
        organizationLayoutService.delete(map);
        List<OrganizationLayout> organizationLayouts = organizationLayoutSetUp.getOrganizationLayouts();
        organizationLayoutService.insertList(organizationLayouts);
        organizationLayoutService.setUp(map,organizationLayouts);
        return ResultMessage.ok();
    }
}
screen-manage/src/main/java/com/moral/api/entity/OrganizationLayout.java
@@ -59,6 +59,11 @@
     */
    private Date createTime;
    /**
     * 逻辑删除,0:不删除;1:删除
     */
    private String isDelete;
    @Override
    protected Serializable pkVal() {
screen-manage/src/main/java/com/moral/api/service/OrganizationLayoutService.java
@@ -25,4 +25,7 @@
    @Transactional
    void insertList(List<OrganizationLayout> list);
    @Transactional
    void setUp(Map map,List<OrganizationLayout> list);
}
screen-manage/src/main/java/com/moral/api/service/impl/OrganizationLayoutServiceImpl.java
@@ -1,14 +1,20 @@
package com.moral.api.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
import com.moral.api.entity.OrganizationLayout;
import com.moral.api.mapper.OrganizationLayoutMapper;
import com.moral.api.service.OrganizationLayoutService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.moral.api.util.LogUtils;
import com.moral.constant.Constants;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import javax.servlet.http.HttpServletRequest;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
@@ -27,6 +33,9 @@
    @Autowired(required = false)
    private OrganizationLayoutMapper organizationLayoutMapper;
    @Autowired
    private LogUtils logUtils;
    @Override
    public List<Map<String, Object>> getData(Map map) {
        int organization_id = Integer.parseInt(map.get("organization_id").toString());
@@ -34,6 +43,7 @@
        QueryWrapper<OrganizationLayout> wrapper_organizationLayout = new QueryWrapper<>();
        wrapper_organizationLayout.eq("organization_id",organization_id);
        wrapper_organizationLayout.eq("version_id",version_id);
        wrapper_organizationLayout.eq("is_delete",Constants.NOT_DELETE);
        List<Map<String,Object>> organizationLayouts = new ArrayList<>();
        organizationLayouts = organizationLayoutMapper.selectMaps(wrapper_organizationLayout);
        return organizationLayouts;
@@ -55,4 +65,45 @@
    public void insertList(List<OrganizationLayout> list) {
        organizationLayoutMapper.insertList(list);
    }
    @Transactional
    @Override
    public void setUp(Map map, List<OrganizationLayout> list) {
        int organization_id = Integer.parseInt(map.get("organization_id").toString());
        int version_id = Integer.parseInt(map.get("version_id").toString());
        QueryWrapper<OrganizationLayout> wrapper_organizationLayout = new QueryWrapper<>();
        wrapper_organizationLayout.eq("organization_id",organization_id);
        wrapper_organizationLayout.eq("version_id",version_id);
        wrapper_organizationLayout.eq("is_delete",Constants.NOT_DELETE);
        List<OrganizationLayout> organizationLayouts = organizationLayoutMapper.selectList(wrapper_organizationLayout);
        //int delCount = organizationLayoutMapper.delete(wrapper_organizationLayout);
        OrganizationLayout organizationLayout_update = new OrganizationLayout();
        organizationLayout_update.setIsDelete(Constants.DELETE);
        int delCount = organizationLayoutMapper.update(organizationLayout_update,wrapper_organizationLayout);
        if (delCount>0){
            //操作插入日志
            HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
            String content = "页面布局表删除了组织id:"+organization_id+"、型号id:"+version_id+";"+"id:";
            for (OrganizationLayout organizationLayout:organizationLayouts) {
                content = content +organizationLayout.getId()+" ";
            }
            content = content+";";
            logUtils.saveOperationForManage(request,content,Constants.INSERT_OPERATE_TYPE);
        }
        if (!ObjectUtils.isEmpty(list) && list.size()>0){
            organizationLayoutMapper.insertList(list);
            QueryWrapper<OrganizationLayout> wrapper_organizationLayoutIns = new QueryWrapper<>();
            wrapper_organizationLayoutIns.eq("organization_id",organization_id);
            wrapper_organizationLayoutIns.eq("version_id",version_id);
            List<OrganizationLayout> organizationLayoutList = organizationLayoutMapper.selectList(wrapper_organizationLayout);
            //操作插入日志
            HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
            String contentInsert = "页面布局表插入了组织id:"+organization_id+"、型号id:"+version_id+";"+"id:";
            for (OrganizationLayout organizationLayout:organizationLayoutList) {
                contentInsert = contentInsert + organizationLayout.getId()+" ";
            }
            contentInsert = contentInsert+";";
            logUtils.saveOperationForManage(request,contentInsert,Constants.INSERT_OPERATE_TYPE);
        }
    }
}