Redis服务 6379 6380 6381
开启三个redis服务
cd /www/server/redis/src
./redis-server ../redis6379.conf
./redis-server ../redis6380.conf
./redis-server ../redis6381.conf
查看实例状态
ps aux | grep redis
Redis服务 6379 6380 6381
开启三个redis服务
cd /www/server/redis/src
./redis-server ../redis6379.conf
./redis-server ../redis6380.conf
./redis-server ../redis6381.conf
查看实例状态
ps aux | grep redis
希望的是将下面的对象数组:
[ {"id":"1001","name":"值1","value":"111"}, {"id":"1001","name":"值1","value":"11111"}, {"id":"1002","name":"值2","value":"25462"}, {"id":"1002","name":"值2","value":"23131"}, {"id":"1002","name":"值2","value":"2315432"}, {"id":"1003","name":"值3","value":"333333"} ]
根据相同id字段分组,转换成下面这种形式:
[ { "id": "1001", "name": "值1", "data": [ {"id": "1001", "name": "值1", "value": "111"}, { "id": "1001", "name": "值1", "value": "11111"} ] }, { "id": "1002", "name": "值2", "data": [ { "id": "1002", "name": "值2", "value": "25462" }, { "id": "1002", "name": "值2", "value": "23131"}, {"id": "1002", "name": "值2","value": "2315432" } ] }, { "id": "1003", "name": "值3", "data": [ {"id": "1003", "name": "值3", "value": "333333" } ] } ]
方法:
var arr = [ {"id":"1001","name":"值1","value":"111"}, {"id":"1001","name":"值1","value":"11111"}, {"id":"1002","name":"值2","value":"25462"}, {"id":"1002","name":"值2","value":"23131"}, {"id":"1002","name":"值2","value":"2315432"}, {"id":"1003","name":"值3","value":"333333"} ]; var map = {},dest = []; for(var i = 0; i < arr.length; i++){ var ai = arr[i]; if(!map[ai.id]){ dest.push({ id: ai.id, name: ai.name, data: [ai] }); map[ai.id] = ai; }else{ for(var j = 0; j < dest.length; j++){ var dj = dest[j]; if(dj.id == ai.id){ dj.data.push(ai); break; } } } } console.log(dest);
UPDATE zn_safe_manager_fire_equipment SET organization_id = 26 WHERE organization_id in (27,28,29) ;
2、登录数据库:mysql -u root -p
3、SSH登录:ssh root@地址
4、查看防火墙状态:sudo ufw status
5、查看相关进程:ps -ef|grep java
6、关闭进程:kill -9 进程号
首先需要进到自己springboot项目的根目录,然后执行如下linux命令 nohup java -jar 自己的springboot项目.jar >日志文件名.log 2>&1 & 命令详解: nohup:不挂断地运行命令,退出帐户之后继续运行相应的进程。 日志文件名.log:是nohup把command的输出重定向到当前目录的指定的“日志文件名.log”文件中,即输出内容不打印到屏幕上,而是输出到”日志文件名.log”文件中。不指定文件名会在当前目录创建nohup.out,如果当前目录的 nohup.out 文件不可写,输出重定向到 $HOME/nohup.out 文件中。如果没有文件能创建或打开以用于追加,那么 Command 参数指定的命令不可调用。 2>&1:2就是标准错误,1是标准输出,该命令相当于把标准错误重定向到标准输出么。这里&相当于标准错误等效于标准输出,即把标准错误和标准输出同时输出到指定的“日志文件名.log”文件中。 java -jar 自己的springboot项目.jar:执行springboot的项目,如果单单只执行该命令,linux只会短暂的运行该项目,当退出控制台后会自动关闭该项目。 最后的&:让改作业在后台运行。
1、安装好相关开发软件(IDEA或者WebStorm)。
3、添加hosts映射地址(0.0.0.0 account.jetbrains.com)。
4、打开软件获取激活码粘贴进去激活即可。
//模糊条件查询 @Query("select a.id from Room a where a.fullName like CONCAT('%',?1,'%')") @QueryHints({@QueryHint(name = "org.hibernate.cacheable", value = "true")}) Set<Long> findIdByFullName(String name); @Query("select a from Room a where a.name = ?1 and a.fullName like CONCAT('%',?2,'%')") @QueryHints({@QueryHint(name = "org.hibernate.cacheable", value = "true")}) List<Room> findByNameAndPName(String name, String fullName); //条件查询排序 @Query("select a from Room a where a.parentId = ?1 order by a.id") @QueryHints({@QueryHint(name = "org.hibernate.cacheable", value = "true")}) List<Room> findByPidOrderName(Long pid); //多数据更新 @Query("update GZFUser set pIdCard = ?2, holderName = ?3, type='other' where id in (?1)") @Modifying void updateOtherTypeByIds(Set<Long> ids, String pIdCard, String holderName); //根据日期查询当年当月数据按照部门分组统计 @Query("select a.organization.id,count (a) from Education a where month(a.dateCreated) = month(?1) and year(a.dateCreated) = year(?1) group by a.organization.id") List<Object[]> findHomeStateResult(String date); //按名称分组排序 @Query("select a.name,a.spec,a.munit,sum(a.number),a.month from FireEquipment a group by a.name") List<Object[]> findByNameAndMonth(); //删除 @Modifying @Query("delete from OtherDocumentState where organization.id in (?1)") int deleteIdIn(Long[] longs); @Modifying @Query("delete from OtherDocumentState where document.id=1") int deleteByOtherDocumentId(Long id); //简写方式 @QueryHints({@QueryHint(name = "org.hibernate.cacheable", value = "true")}) User findByUsername(String username); @QueryHints({@QueryHint(name = "org.hibernate.cacheable", value = "true")}) User findByEmail(String email); @QueryHints({@QueryHint(name = "org.hibernate.cacheable", value = "true")}) User findByUsernameAndIdIsNot(String username, Long id); @QueryHints({@QueryHint(name = "org.hibernate.cacheable", value = "true")}) User findByEmailAndIdIsNot(String username, Long id);
@Query(value = "SELECT a.id,a.user_name,a.room_type,a.rent_type,b.name,b.id AS room_id,b.cell,b.floor,b.type,b.sorter FROM gzf_room b LEFT JOIN gzf_rent_info a ON a.room_id = b.id WHERE b.parent_id = ?1", nativeQuery = true) @QueryHints({@QueryHint(name = "org.hibernate.cacheable", value = "true")}) List<Object[]> findByRoomHome(Long id);
1、向下取整的函数
Math.floor();
例如:Math.floor( 23.2222222); // 23
2、向上取整
Math.ceil();
例如: Math.ceil(23.333333); // 24
3、四舍五入
Math.round();
例如:Math.round(23.33333); // 23
4、四舍五入取n位小数,运算后得到的是字符串
().toFixed(n); // 取小数点后n位
例如:(36.36498524).toFixed(3); // 36.365
一:带[]的字符串如下处理
var str="[2,34,3.4]"; var strNew=eval(str); console.log(strNew[0]+"--"+strNew[1]+"--"+strNew[2]); //2--34--3.4
二:正常字符串如下处理
var str2="2,34,3.4"; var str2New=str2.split(","); console.log(str2New[0]+"++"+str2New[1]+"++"+str2New[2]); //2++34++3.4
三:带()字符串如下处理
var str="合适dsw(18701200120)"; var strNew =str.replace("(","").replace(")",""); var strNewIphone=strNew.substr(strNew.length-11); var strNewName=strNew.substring(0,strNew.length-11); console.log(strNewName+"---"+strNewIphone); //合适dsw---18701200120