一周总结

析构季风
• 阅读 1349

引言

各个项目接近尾声,收尾工作其实并不是一件简单的事情,在此对本周的一些小问题进行一下总结。

器具别名显示问题

后台加入软删除,在前台器具类别管理中删除器具别名时,因加入软删除删除时deleted字段改为true,但是查询时没有对其加入限制,所以全部显示

  1. 想法
    感觉没什么难度,后台使用我们强大的综合查询直接吧deleted字段set false就行了。
  2. 实现

      public Page<InstrumentCategory> getAll(String name, Long subjectCategoryId, Pageable pageable) {
    
            logger.debug("设置查询条件");
            InstrumentAlias instrumentAlias = new InstrumentAlias();
            InstrumentCategory instrumentCategory = new InstrumentCategory();
            CommonService.setAllFieldsToNull(instrumentCategory);
            CommonService.setAllFieldsToNull(instrumentAlias);
            instrumentCategory.setName(name);
            instrumentAlias.setDeleted(false);
            instrumentCategory.setInstrumentAliasList(Collections.singletonList(instrumentAlias));
            SubjectCategory subjectCategory = subjectCategoryRepository.findById(subjectCategoryId).orElse(null);
            instrumentCategory.setSubjectCategory(subjectCategory);
    
            return (Page<InstrumentCategory>) yunzhiService.page(instrumentCategoryRepository, instrumentCategory, pageable);
        }

    然而处于我综合查询知道的少之又少,只知道它查询快为好用,却不知道不支持一对多和多对多查询

    一周总结

  3. 只能在前台或者后台自己手动的去处理,实现如下:
 // 过滤InstrumentAlias,显示deleted字段为false的
    public filterInstrumentAlias() {
        this.instrumentCategoryList.content.forEach((instrumentCategory: InstrumentCategory) => {
            this.instrumentAliasList = instrumentCategory.instrumentAliasList.filter((instrumentAlias: InstrumentAlias) => {
                return instrumentAlias.deleted === false;
            });
            instrumentCategory.instrumentAliasList = this.instrumentAliasList;
        });
    }

    // 过滤InstrumentSpecification,显示deleted字段为false的
    public filterInstrumentSpecification() {
        this.instrumentCategoryList.content.forEach((instrumentCategory: InstrumentCategory) => {
            this.instrumentSpecificationList = instrumentCategory.instrumentSpecificationsList.filter((instrumentSpecification: InstrumentSpecification) => {
                return instrumentSpecification.deleted === false;
            });
            instrumentCategory.instrumentSpecificationsList = this.instrumentSpecificationList;
        });
    }

总结

虽然没什么问题,我觉得在对一件事,一个项目或者一个需求,你了解多少,你就可以少走多少弯路,甚至可以体现出你在其中的价值、地位。

实现只有正常状态才能发送申请

最初的实现:

    // 判断器具状态显示正常时才能发起申请
    public showVerificationApplication() {
        this.instrumentPage.content.forEach((instrument) => {
            if (instrument.state === this.defaultStatus) {
                this.show = true;
            } else {
                this.show = false;
            }
        });
    }

这样是有问题的,当没有器具的时候就不执行了,会存在问题
改进:

    // 判断器具状态显示正常时才能发起申请
    public showVerificationApplication() {
        if (this.params.state === this.defaultStatus) {
            this.show = true;
        } else {
            this.show = false;
        }
    }

在偶然间张喜硕组长的一句提示,让我觉的自身的不足(考虑为什么我当时没有想到);

总结

自己的想法考虑的太不全面,有时候看问题只看到表面,一个小小的问题就可能困惑我,不能换个角度去思考,在想法和思想上还有待提高
点赞
收藏
评论区
推荐文章
Easter79 Easter79
3年前
sql语句_ 的三种去重方法
本文将介绍用distict、groupby和row\_number()over。注:这里的去重是指:查询的时候,不显示重复,并不是删除表中的重复项,关系删除表中重复数据的sql请参考一下链接:https://www.cnblogs.com/171207xiaohutu/p/11520763.html1\.distinct表u
Wesley13 Wesley13
3年前
javafx加入特效后无法删除
今天学习Canvas时候发现,如果加入effect效果,那么clearRect方法就删除不了了,不知道这个是不是bug~如果有知道如何解决,希望可以告诉我一下代码如下:        Canvas canvas  new Canvas(WSystem.WIDTH, WSystem.HEIGHT);GraphicsConte
Wesley13 Wesley13
3年前
jdk1.8之后,Collection中的removeIf()方法,可以对list和set 中符合条件的数据进行删除
以前我们对list中数据进行删除操作时基本都是使用迭代器,这种方式实现起来比较复杂,要写好几行代码才能做到,而且像我这种记性还经常忘记具体怎么写,还要百度,最近发现一种非常简单的方式。就是Collection中的removeIf()方法。他是在jdk1.8后加入的。看下它的源码。defaultbooleanremoveIf(Pred
虾米大王 虾米大王
2年前
java代码012
code012.jspInserttitlehere<%JSP内置对象1.request用于处理HTTP请求中的各项参数。如,删除可以通过request对象的getParameter()方法获取如,request.getParameter("id")在请求转发时,需要把一些数据传递到转发后的页面处理。就需要用到request的se
Easter79 Easter79
3年前
tidb使用坑记录
1、对硬盘要求很高,没上SSD硬盘的不建议使用2、不支持分区,删除数据是个大坑。解决方案:set@@session.tidb\_batch\_delete1; 3、插入数据太大也会报错解决方案:set@@session.tidb\_batch\_insert1; 4、删除表数据时不支持别名deletefrom表名表别名 
项目实战,动态增删form表单
前言Hi,大家好,我是麦叔。今天老大让我做一个需求,我们的这个表单以前只支持录入一个检查器具。现在要求改为可以动态添加,满足录入多个器具。作为前
Wesley13 Wesley13
3年前
@TableLogic表逻辑处理注解(逻辑删除)
在字段上加上这个注解再执行BaseMapper的删除方法时,删除方法会变成修改例:实体类:@TableLogicprivateIntegerdel;service层:调用BaseMapper的deleteById(id);执行是效果:加@TableLogic的情况下走Update
Easter79 Easter79
3年前
Spring集成Day3
一.删除功能1.拿到要删除的是哪条数据(没有选择,给出提示)2.如果有选择,给出确定选择(真的要删除嘛)3.传id到后台进行删除   删除成功刷新页面   删除失败给出提示后台回了一个:JsonResult(booleansuccess,Stringmsg)二.添加功能1准备弹出框Ed
Stella981 Stella981
3年前
PHP中unset,array_splice删除数组中元素的区别
php(https://www.oschina.net/p/php)中删除数组元素是非常的简单的,但有时删除数组需要对索引进行一些排序要求我们会使用到相关的函数,这里我们来介绍使用unset,array\_splice删除数组中的元素区别吧如果要在某个数组中删除一个元素,可以直接用的unset,但是数组的索引不会重排:?(https://ww
Stella981 Stella981
3年前
PostgreSQL的FSM分析记录
        近来由于工作原因对PG的FSM(FreeSpaceMap,空闲空间映射表)源码进行了学习。下面给大家简单讲述一下。        什么是FSM呢,这不得不说一下PG的存储机制了。PG的更新(更新是删除和插入的结合)和删除都是将元组(数据库对我们插入的每一行数据封装后称为元组)标记为无效,而后通过VACUUM进行物理删除。无效的元组被删
Stella981 Stella981
3年前
ES中删除索引的mapping字段时应该考虑的点
1.创建新索引2.新索引创建新mapping3.原索引导出数据到新索引4.新索引创建原索引一致的别名5.删除原索引针对于第四步:这个就要用到索引别名了,如果你最开始建索引的时候没有考虑设计索引别名,那就杯具了。你可以把索引的名称设置成name\_v1 别名设置为name,然后代码里面访问搜索的时候连接的其实是别名na