前端框架选型是企业提升开发效率与用户体验的关键因素
836
2022-11-11
Spring mybatis 多表查询
mybatis - 略sql写在xml里
复杂的多表要自己写,默认的可以自动生成
3.map java
package com.decent.nvda.mapper;import com.decent.nvda.bean.AllVideoCard;import com.decent.nvda.bean.VideoCard;import org.apache.ibatis.annotations.Param;import java.util.Date;import java.util.List;public interface VideoCardMapper { int deleteByPrimaryKey(Integer id); int insert(VideoCard record); int insertSelective(VideoCard record); VideoCard selectByPrimaryKey(Integer id); List
bean
package com.decent.nvda.bean;public class VideoCard { private Integer id; private Integer videoCardDirectId; private String videoCardName; private Float videoCardPercent; private Integer videoCardType; private Float videoCardFinialPercent; public Integer getId() { return id; } public void setId(Integer id) { this.id = id; } public Integer getVideoCardDirectId() { return videoCardDirectId; } public void setVideoCardDirectId(Integer videoCardDirectId) { this.videoCardDirectId = videoCardDirectId; } public String getVideoCardName() { return videoCardName; } public void setVideoCardName(String videoCardName) { this.videoCardName = videoCardName == null ? null : videoCardName.trim(); } public Float getVideoCardPercent() { return videoCardPercent; } public void setVideoCardPercent(Float videoCardPercent) { this.videoCardPercent = videoCardPercent; } public Integer getVideoCardType() { return videoCardType; } public void setVideoCardType(Integer videoCardType) { this.videoCardType = videoCardType; } public Float getVideoCardFinialPercent() { return videoCardFinialPercent; } public void setVideoCardFinialPercent(Float videoCardFinialPercent) { this.videoCardFinialPercent = videoCardFinialPercent; }}
使用
package com.decent.nvda.task;import java.text.ParseException;import java.text.SimpleDateFormat;import java.util.Date;import java.util.List;import javax.annotation.Resource;import com.decent.nvda.bean.AllVideoCard;import com.decent.nvda.bean.VideoCard;import com.decent.nvda.mapper.VideoCardMapper;import org.junit.Test;import com.alibaba.fastjson.JSON;import com.yiqiniu.common.utils.DateUtils;public class TaskTest extends SimpleTest{ @Resource private VideoCardMapper videoCardMapper; @Test public void test() throws ParseException {// VideoCard videoCard = videoCardMapper.selectByPrimaryKey(43216); String stringStart = "2016-10-24 21:59:06"; String stringEnd = "2018-12-07 21:59:06"; SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); List
porm依赖
版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。
发表评论
暂时没有评论,来抢沙发吧~