个人业务网站源码,来凡网站建设公司,番禺人才网官网入口,搜狗收录提交入口th:insert#xff1a;将被引用的模板片段插⼊到自己的标签体中 th:replace#xff1a;将被引用的模板片段替换掉自己 th:include#xff1a;类似于 th:insert#xff0c;⽽不是插⼊⽚段#xff0c;它只插⼊此⽚段的内容
!--1、比如抽取的公用代码片段如下--
…th:insert将被引用的模板片段插⼊到自己的标签体中 th:replace将被引用的模板片段替换掉自己 th:include类似于 th:insert⽽不是插⼊⽚段它只插⼊此⽚段的内容
!--1、比如抽取的公用代码片段如下--
footer th:fragmentcopycopy; 2011 The Good Thymes Virtual Grocery
/footer
!--2、采用如下三种方式进行引用--
div th:insertfooter :: copy/div
div th:replacefooter :: copy/div
div th:includefooter :: copy/div!--3、则三种引用方式的效果分别对应如下--
divfootercopy; 2011 The Good Thymes Virtual Grocery/footer
/divfootercopy; 2011 The Good Thymes Virtual Grocery
/footerdivcopy; 2011 The Good Thymes Virtual Grocery
/div后端数据校验 引入jar包 https://mvnrepository.com/artifact/org.hibernate.validator/hibernate-validator/6.0.23.Finalmaven仓库地址
!-- JSR303数据校验支持--
!-- https://mvnrepository.com/artifact/org.hibernate.validator/hibernate-validator --
dependencygroupIdorg.hibernate.validator/groupIdartifactIdhibernate-validator/artifactIdversion6.1.6.Final/version
/dependency
目前可用的对应的spring版本号
parentgroupIdorg.springframework.boot/groupIdartifactIdspring-boot-starter-parent/artifactIdversion2.3.5.RELEASE/versionrelativePath/ !-- lookup parent from repository --
/parent之后只需要在实体类或者传入的参数上加上注解类似null,notbleak,past… 另外需要在controller的类上加上Validated以及接受的实体或者参数上添加Valid的注解 mybatis plus中的 e w . s q l S e g m e n t {ew.sqlSegment} ew.sqlSegment{ew.sqlSelect} e w . c u s t o m S q l S e g m e n t , {ew.customSqlSegment}, ew.customSqlSegment,{ew.sqlSet}使用 ew是mapper方法里的Param(Constants.WRAPPER) Wrapper queryWrapper对象
首先判断ew.emptyOfWhere是否存在where条件有的话再拼接上去ew.customSqlSegment是WHERE sql语句 没有where的时候加上 false
使用${ew.sqlSegment} 如果是连表查询且查询条件是连表的字段则需在service层拼接查询条件时字段前指定别 名
例子 mapper.xml select idtableList resultTypejava.util.LinkedHashMapSELECT${ew.sqlSelect} // 这里拼接select后面的语句FROM${table_name} //如果是单表的话这里可以写死${ew.customSqlSegment}/selectMapper
IPageLinkedHashMapString,Object tableList(Param(table_name) String table_name,Page page,Param(Constants.WRAPPER) QueryWrapper queryWrapper);Test
String responseField *;
queryWrapper.select(responseField);
// 即 select * ...String responseField name;
queryWrapper.select(responseField);
// 即 select name ...例子2
Controllerpublic String saveAddress(HttpSession session) {UserVO user1 (UserVO)session.getAttribute(user);LambdaQueryWrapperUser lambdaQueryWrapper Wrappers.UserlambdaQuery().select(User::getNickName, User::getUserId) // 需要查询的列即 ${ew.sqlSelect}.eq(User::getUserId, user1.getUserId());// 条件User user this.userMapper.selectNickNameAndUserId(lambdaQueryWrapper);System.out.println(user);return null;}MapperUser selectNickNameAndUserId(Param(Constants.WRAPPER) WrapperUser queryWrapper);
mapper.xml
select idselectNickNameAndUserId resultTypecom.example.demo.entity.Userselectif testew ! null and ew.sqlSelect ! null and ew.sqlSelect ! ${ew.sqlSelect}/iffromuserwhere is_deleted ! 1if testew ! nullif testew.nonEmptyOfWhereAND/if${ew.sqlSegment}/if/selectselect idselectNickNameAndUserId resultTypecom.example.demo.entity.Userselectif testew ! null and ew.sqlSelect ! null and ew.sqlSelect ! ${ew.sqlSelect }/iffromuser${ew.customSqlSegment}/select使用${ew.sqlSegment} 如果是联表查询且查询条件是连表的字段则需在service层拼接查询条件时字段前指定别名而且不能用lambda的查询了 select idselectByRoleId resultTypecom.captain.crewer.mybatis.plus.dto.RolePermsDTOSELECT tp.id,tp.perm_name,tp.url,tr.role_id as roleId,tr.role_name as roleNameFROM tb_role trLEFT JOIN tb_perm_role tpr ON tr.role_id tpr.role_idLEFT JOIN tb_perm tp ON tpr.perm_id tp.id ${ew.customSqlSegment}/select
MapperListRolePermsDTO selectByRoleId(Param(Constants.WRAPPER) WrapperRolePermsDTO wrapper);
${ew.sqlSet}
LambdaUpdateWrapperUser wrapper Wrappers.UserlambdaUpdate().set(User::getNickName, 1).eq(User::getUserId, 1);this.userMapper.updateUser(wrapper);int updateUser(Param(Constants.WRAPPER) WrapperUser updateWrapper);update idupdateUserupdate userset ${ew.sqlSet}where ${ew.sqlSegment}/updateDateUtil时间工具的使用 暂时无法在郑煤机文档外展示此内容 spring中time-zoneGMT8无效主要原因是因为配置的拦截器中添加了EnableWebMvc会导致失效 需要实现 WebMvcConfigurer 或 继承WebMvcConfigurerAdapter
Configuration
EnableWebMvc
public class MvcConfig implements WebMvcConfigurer {//解决 spring.jackson.date-formatyyyy-MM-dd HH:mm:ss//spring.jackson.time-zoneGMT8 不生效的功能Overridepublic void extendMessageConverters(ListHttpMessageConverter? converters) {MappingJackson2HttpMessageConverter converter new MappingJackson2HttpMessageConverter();ObjectMapper objectMapper converter.getObjectMapper();SimpleModule simpleModule new SimpleModule();simpleModule.addSerializer(Long.class, ToStringSerializer.instance);simpleModule.addSerializer(Long.TYPE, ToStringSerializer.instance);objectMapper.registerModule(simpleModule);objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);objectMapper.setDateFormat(new SimpleDateFormat(yyyy-MM-dd HH:mm:ss));converter.setObjectMapper(objectMapper);converters.add(0, converter);}
}git绑定远程分支 //创建并切换到本地分支 git checkout -b dev //查看本地与远程分支 git branch -a //关联本地分支到远程分支 git branch --set-upstream-toorigin/jp jp
git branch --set-upstream-toorigin/zjp zjp
、//新的代码推送到仓库步骤 1.git init 2.git add . 3.git commit -m “描述信息” //添加远程仓库地址 4. git remote add origin https://github.com/ai-dengzy/c_server.git 5. git pull 6.git branch --set-upstream-toorigin/master 7.git pull 8.git push -u origin master 9. [图片] 再次推送 git push -u origin master
更改git仓库地址 2.先初始化git仓库 git init git remote -v 查询所在仓库 3.删除原仓库路径git remote rm origin git remote add origin ‘新的仓库地址’ 对于t’inyint类型 0 true 1 false maven打包 mvn clean package -DskipTests maven插件 mvn -U idea:idea 实体转换map对象 object…stream().collect(Collectors.toMap(Object::getField, Function.identity())) testWhileIdle is true, validationQuery not set解决办法 [图片] 字符串替换{} StrUtil.format(string,tihuan1,… 日志打印在对应类中 private static Logger logger LoggerFactory.getLogger(DriverXxlJob.class); mysql注意点 隐式转换where条件处类型一致需要部分字符串转整形可以但表为字符串查询值为整形会进行全表查询结果不对导致 mybatiespius隐藏细节更新语句不会进行空值处理需要在字段加上注解TableField(value “group_id”, fill FieldFill.UPDATE) LINUX常用命令 whereis java //寻找Java安装路径 修改文件权限chmod 777 xxx 防火墙配置 防火墙配置 安装服务 #安装firewalld yum install firewalld firewall-config
firewall-cmd --zonepublic --add-port80/tcp --permanent 关闭端口命令 systemctl restart firewalld.service 重启防火墙 systemctl start firewalld # 开启防火墙 firewall-cmd --list-all 查看防火墙所有开启的端口 systemctl status firewalld # 或者 firewall-cmd --state 查看防火墙状态 systemctl disable firewalld # 停止防火墙 systemctl stop firewalld # 禁用防火墙
端口管理 #打开443/TCP端口 firewall-cmd --add-port443/tcp
#永久打开3690/TCP端口 firewall-cmd --permanent --add-port3690/tcp# 查看防火墙添加的端口也可以看到 或者 firewall-cmd --list-all
数组转字符串用字符拼接 StringUtils.join(user, “,”);
注解使用 ApiParam(“设备变量”)接口参数注释
Redis redis获取哈希表的所有值 redisTemplate.opsForHash().values OPC问题总结 点采集不到问题检查是否配置了opc服务的映射 刷新host ipconfig /flushdns 判空断言 Assert.notEmpty(req.getStorageNumbers(), “料位编号不能为空”);