1 BeanUtil.copyProperties();
import cn.hutool.core.bean.BeanUtil;
BeanUtil.copyProperties(valuation,subFundValuation);
2 注解转换日期格式出参
@DateTimeFormat(pattern = "yyyy-MM-dd")
@ApiModelProperty(value = "成立日")
private Date dateSetup;
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
@ApiModelProperty(value = "估值日期")
private Date createTime;
3 字符串转换成long型
Long aLong = Long.valueOf(String);
4 拆分字符串放入数组
String req = "1,2,2,3,4,5,5,5,56,7567,5";
String[] id = req.getIds().split(",");
5 MyBatisPuls XML中写 sql 传参
InstitutionFundSizeHistoryListRes queryInfo(@Param(value = "institutionName") String institutionName, @Param(value = "format") String format);
6 MyBatisPlus 的 sql 里面 if 语句的使用
<select id="getSubFundValuationList" resultType="com.open.capacity.base.pojo.res.SubFundValuationListRes">
SELECT
a.valuation_id valuationId,
a.file_id fileId,
a.valuation_name valuationName,
a.valuation_date valuationDate,
a.update_time updateTime
FROM sub_fund_valuation a
WHERE a.del = 0
AND a.entity_code =
<if test="valuationDate != null">
AND a.valuation_date =
</if>
ORDER BY a.update_time DESC
</select>
7 BigDecimal 跟数字比较大小
BigDecimal ostProbabilityOfWin = req.getOstProbabilityOfWin();
if (ostProbabilityOfWin.compareTo(new BigDecimal("0.75"))>=0){
}
8 MyBatisPlus中 concat 函数的用法
SELECT * FROM sys_user a WHERE login_name like concat('%',
9 模糊显示数据库中的表名
show tables like '%sys%';
show tables like 'performance_%';
10 创建JSON对象和JSONArray对象
import net.sf.json.JSONObject;
JSONObject listInfo = new JSONObject();
JSONArray jsonArray = new JSONArray();
10 sql截取字段的部分
select substrb(b.objId,7)from student b where b.objId like 'CJP%';
11 判断集合是否为空
org.apache.commons:commons-collections4:4.4
CollectionUtils.isNotEmpty();
12 转换成JSON格式
JSONObject.toJSONString(beans);