技术标签: spring boot java intellij-idea
<!--查询某列的值是否在List中,在则返回-->
<sql id="BaseWhere">
<where>
<trim prefixOverrides="and">
<!--查询条件:判断某个值是否在传入的集合中-->
<if test="factoryList != null and factoryList.size != 0">
and factory_code in
<foreach collection="factoryList" item="factoryCode" open="(" separator="," close=")">
#{factoryCode}
</foreach>
</if>
<!--查询条件:日期在某个集合内的写法-->
<if test="lpmCreateDateStart != null and lpmCreateDateEnd != null">
and date_format(lpm_create_time,'%Y-%m-%d 00:00:00') <![CDATA[ >= ]]> date_format(#{lpmCreateDateStart,jdbcType=TIMESTAMP},'%Y-%m-%d 00:00:00')
and date_format(lpm_create_time,'%Y-%m-%d 00:00:00') <![CDATA[ <= ]]> date_format(#{lpmCreateDateEnd,jdbcType=TIMESTAMP},'%Y-%m-%d 00:00:00')
</if>
<!--查询条件:日期在某个集合内的写法-->
<if test="beginCreateTime != null and endCreateTime != null">
and date_format(continuity_risk.create_time,'%Y-%m-%d %H:%i:%s') >= date_format(#{beginCreateTime},'%Y-%m-%d %H:%i:%s')
and date_format(continuity_risk.create_time,'%Y-%m-%d %H:%i:%s') <= date_format(#{endCreateTime},'%Y-%m-%d %H:%i:%s')
</if>
</trim>
</where>
</sql>
<!--批量更新的实现方法:根据id更新:注意需要一个属性值写一个trim标签-->
<update id="batchUpdateById" parameterType="java.util.List">
update continuity_kitting_risk
<trim prefix="set" suffixOverrides=",">
<trim prefix="kit_risk_factory =case" suffix="end,">
<foreach collection="list" item="i" index="index">
<if test="i.kitRiskFactory!=null and i.kitRiskFactory!=''">
when kit_risk_id = #{i.kitRiskId,jdbcType=BIGINT} then #{i.kitRiskFactory,jdbcType=VARCHAR}
</if>
</foreach>
</trim>
<trim prefix="kit_risk_suppliers_product_num =case" suffix="end,">
<foreach collection="list" item="i" index="index">
<if test="i.kitRiskSuppliersProductNum!=null and i.kitRiskSuppliersProductNum!=''">
when kit_risk_id = #{i.kitRiskId,jdbcType=BIGINT} then #{i.kitRiskSuppliersProductNum,jdbcType=VARCHAR}
</if>
</foreach>
</trim>
</trim>
where
<foreach collection="list" separator="or" item="i" index="index">
kit_risk_id = #{i.kitRiskId,jdbcType=BIGINT}
</foreach>
</update>
MySQL查询在使用的表和正在进行的进程
show open tables where in_use>0;
show PROCESSLIST;
SELECT * FROM information_schema.INNODB_TRX;
show global variables like ‘wait_timeout’;
Tomcat修改启动名称:bin>catalina.bat if “%TITLE%” == set TITLE = 项目名称
注解 | 用途 |
---|---|
@Transactional(rollbackFor = Exception.class) | 异常回滚注解:遇到所有异常都会回滚 |
@Service(“stockInOutRecordService”) | service层注解,写在service层接口的实现类上 |
@Override | 用在实现接口功能的方法上 |
@Autowired | 用来引用其他类 |
@Resource | 用来引用其他类-按名匹配 |
@RestController | Controller层注解 |
@Controller | Controller层注解 |
@RequestMapping(“/continuance”) | 请求-用在类上 |
@PostMapping(“/addTargetValue”) | 请求-用在方法上 |
@GetMapping(“/breathDetailList”) | 请求-用在方法上-无参 |
@PathVariable(“targetId”) | 链接:/selectAllProduct/{targetId} 中 targetId 的值,用在接收参数前 |
@RequestBody | 用在接收参数前,参数一般为实体/已有直接用在接收方法上的情况 |
@RequestParam(“factoryCode”) | 链接:/base_data?factory=123&online_point_code=123; 中factory的值,用在接收参数前 |
@Param(“billsCode”) | 用在Mapper接口给Mapper.xml传的参数前 |
@Repository | 用在Mapper接口文件上 |
@Mapper | 用在Mapper接口文件上 |
@Component | 注解 |
@DateTimeFormat(pattern = “yyyy-MM-dd HH:mm:ss”) | 用于接收日期的格式-用于实体类的属性上 |
@JsonFormat(pattern = “yyyy-MM-dd”) | 用于传递日期的格式-用于实体类的属性上 |
//根据某一列的值是否一致分组
Map<Long,List<dataEntity>> entityGroupById=list.stream().collect(Collectors.groupingBy(dataEntity::getLpmId));
//根据某个值排序
List<LogisticsPlanMapDetail> dealList = entityGroupById.get(key).stream().sorted(Comparator.comparing(LogisticsPlanMapDetail::getLpmdType)).collect(Collectors.toList());
//list转Map Map的key取list实体的某个属性,需要保证唯一
Map<Integer,LogisticsPlanMapDetail> dealList = exit.stream().collect(Collectors.toMap(LogisticsPlanMapDetail::getLpmdType,o->o));
//得到list中满足某些或某个条件的数据的条数
double sumCount = (double) factoryMap.get(item).stream().filter(a -> a.getTargetCloseWarningValues().equals(num1)).count();
//取出list中某个属性的全部值(过滤空值)并去重
List<Long> ids= list.stream().filter(o->o.getId()!=null).map(Entity::getId).distinct().collect(Collectors.toList());
//toMap冲突处理-出现相同的key值用后边的覆盖前边的
Map<String, String> dataMap = dataList.stream().collect(Collectors.toMap(Entity::getCode, Entity::getName, (value1, value2) -> value2));
//list逆序
Collections.reverse(list);
//json中获取list的两种方式
List<Entity> list= userFactoryRe.getJSONArray("rows").toJavaList(Entity.class);
List<Entity> list= JSONObject.parseArray(jsonObject.getString("districts"), Entity.class);
//@RequestBody参数 MAP 转 JSON
ServiceClass service = SpringContextUtil.getBean(ServiceClass.class);
Map<String, Object> map = new HashMap<String, Object>();
map.put("levelNumber", 3);
map.put("nodeCode","A30");
map.put("beginDate","1645177800");
map.put("endDate","1645177860");
JSONObject jsonObject = JSONObject.parseObject(JSON.toJSONString(map));
JSONObject result = service.methodToGetData(jsonObject);
//此方法为处理实例中每个属性的值-为空则置为null
private void dealEmptyData(Object dealEntity) throws IllegalAccessException {
Field[] fields = dealEntity.getClass().getDeclaredFields();
for (Field field : fields) {
field.setAccessible(true);
if(field.get(dealEntity)!=null){
String value = field.get(dealEntity).toString();
if(StringUtils.isEmpty(value)){
field.set(dealEntity,null);
}
}
}
}
安卓项目gradle配置:distributionUrl=https://downloads.gradle-dn.com/distributions/gradle-6.7.1-all.zip
雷电模拟器连接AS:adb.exe connect 127.0.0.1:5555
遇到构建失败:
Cause: unable to find valid certification path to requested target
找到 build.gradle文件:
改为以下代码:
repositories {
maven { url ‘https://maven.aliyun.com/nexus/content/repositories/google’ }
maven { url ‘https://maven.aliyun.com/nexus/content/repositories/jcenter’}
}
取消npm的验证------------------: npm set strict-ssl false
强制清除npm缓存---------------: npm cache clear --force
降低版本---------------------------: npm install [email protected] -g
单独安装----------npm install [email protected] --ignore-scripts
报错find python 问题 管理员–: npm install --global --production windows-build-tools
遇到安装python卡住不动:
win+R 输入 %temp% 创建dd_client_.log文件,加入一行 Closing installer. Return code: 3010.
远程桌面:cmd > mstsc
本机ip地址、默认网关、子网掩码:cmd > ipconfig
服务器运行jar包: cmd> java –jar + 包名.jar
登录时遇到凭据不工作:(缺少域账户):corp\用户名
--MySQL查询在使用的表和正在进行的进程
show open tables where in_use>0;
show PROCESSLIST;
SELECT * FROM information_schema.INNODB_TRX;
show global variables like 'wait_timeout';
var code = “d2ac1b1f-179f-4cfb-9442-26bb656740c6”
在复制内存时检测到可能的 I/O 争用条件。默认情况下,I/O 包不是线程安全的。在多线程应用程序中,必须以线程安全方式(如 TextReader 或 TextWriter 的 Synchronized 方法返回的线程安全包装)访问流。这也适用于 StreamWriter 和 StreamReader 这样的类。public Form1(){InitializeCompo..._c# streamwriter 多线程
文章目录scala优点运行语法循环match函数数据类型和类基础类型String 插值变量数组tuple,set,map类与对象单例对象参考文献scalascalable language, 可伸缩语言。Scala是一门综合了面向对象和函数式编程概念的静态类型的编程语言。优点函数式编程(函数的地位是和整数、字符串等是相同的)高阶面向对象(每个值都是对象,每个操作都是方法调用)类型..._scala介绍
软件需求说明书 1 引言 1.1 编写目的:阐明编写需求说明书的目的,指明读者对象。 1.2 项目背景:应包括 ● 项目的委托单位、开心单位和主管部门; ● 该软件系统与其他系统的关系。 1.3 定义:列出文档中所用到的专门术语的定义和缩写词的愿文。 1.4 参考资料:可包括 ● 项目经核准的计划任务书、合同或上级机关的批文 ● 文档所引用的资料、规范等 ● 列出这些资料的
在Visual Studio11编译器的安全性增强-下一代Visual C++2012的新特性
park调用后一定会消耗掉permit,无论unpark操作先做还是后做。如果中断状态为true,那么park无法阻塞。unpark会使得permit为1,并唤醒处于阻塞的线程。interrupt()会使得中断状态为true,并调用unpark。sleep() / wait() / join()调用后一定会消耗掉中断状态,无论interrupt()操作先做还是后做。_intterupt后无法park、
ylbtech-杂项-数学软件:MathematicaMathematica是一款科学计算软件,很好地结合了数值和符号计算引擎、图形系统、编程语言、文本系统、和与其他应用程序的高级连接。很多功能在相应领域内处于世界领先地位,它也是使用最广泛的数学软件之一。Mathematica的发布标志着现代科技计算的开始。Mathematica是世界上通用计算系统中最强大的系统。自从..._mathematica数学软件
滚动栏只有细细的一条线,根本看不见, 这个问题不知道是怎么出现的,有帖子说是因为固定列造成的, 有帖子说是 列文字溢出造成的。插件,因为这个插件套的就是 element-table组件,不需要额外代码,原装使用。可是这些问题我都没有出现,一开始项目是有滚动栏的,不知道从什么时候开始就变没了。不然 当前页面样式无法穿透到 element表格源css。我使用的比较多的就是。
在H5页面中嵌入视频的情况是比较多件的,有时候会碰到需要自动播放的情况,之前根本觉得这不是问题,但是自己的项目中需要视频的时候就有点sb了,达不到老板的要求,那个急呀~~~ 各种查资料,找到一个方法,记录一下。核心是监听了canplaythrough事件,然后自己去让视频play()。 在这个过程中还发现,ios和安卓不一样,安卓上需要设置muted才能自动播放,ios没..._h5内嵌小程序安卓端无法自动播放视频
首先创建实体类entity@Entity@Table(name = "attachment")public class Attachment extends IdEntity { private String name; private String ext; private String fileName; private String path; ..._springboot easyui分页
编译Uboot时出错:错误信息如下:/bin/bash: arm-linux-gcc: command not founddirname: missing operandTry 'dirname --help' for more information.经查阅资料,找到如下解决办法:1. 32位 arm-linux-gnueabi-gcc/as/ld.. 在64位上面运行缺少必要的依赖。我找到的依..._uboot编译出现很多未引用问题
上篇文章介绍了:ClickHouse内核分析-MergeTree的存储结构和查询加速,其实MergeTree的思想跟LSM-Tree相同的。我就顺藤摸瓜,再来补补LSM-Tree,学习还..._clickhouse lsm
1、mysql默认情况下是否区分大小写,使用show Variables like '%table_names'查看lower_case_table_names的值,0代表区分,1代表不区分。2、mysql对于类型为varchar数据默认不区分大小写,但如果该字段以“*_bin”编码的话会使mysql对其区分大小写。3、mysql对于字段名的策略与varchar类型数据相同。即:默