Java Mybatis属性没有getter
我正在使用Mybatis批量插入数据,特别是我的parameterType是一个类,它有一个List属性,所以我使用foreach进行遍历。但是它不起作用,下面是调试和代码。谢谢。 以下是sql:Java Mybatis属性没有getter,java,foreach,mybatis,Java,Foreach,Mybatis,我正在使用Mybatis批量插入数据,特别是我的parameterType是一个类,它有一个List属性,所以我使用foreach进行遍历。但是它不起作用,下面是调试和代码。谢谢。 以下是sql: <insert id="batchInsertSn" parameterType="domain.collectSn.IbSnTransit"> insert into ib_sn_transit ( sn, inbound_no, container_no,
<insert id="batchInsertSn" parameterType="domain.collectSn.IbSnTransit">
insert into
ib_sn_transit (
sn, inbound_no, container_no,
goods_no,goods_name, owner_no,
owner_name,create_user,update_user,
create_time,update_time,yn,
org_no,org_name,distribute_no,
warehouse_no,receiving_no,supplier_no
,out_wave_no)
values
<foreach collection="snList" item="item" index="index" separator="," >
(
#{item.sn,jdbcType=VARCHAR}, #{inboundNo,jdbcType=VARCHAR}, #{containerNo,jdbcType=VARCHAR},
#{goodsNo,jdbcType=VARCHAR},#{goodsName,jdbcType=VARCHAR},#{ownerNo,jdbcType=VARCHAR},
#{ownerName,jdbcType=VARCHAR}, #{createUser,jdbcType=VARCHAR}, #{updateUser,jdbcType=VARCHAR},
now(),now(),#{yn,jdbcType=TINYINT},
#{orgNo,jdbcType=VARCHAR},#{orgName,jdbcType=VARCHAR},#{distributeNo,jdbcType=VARCHAR},
#{warehouseNo,jdbcType=VARCHAR},#{receivingNo,jdbcType=VARCHAR},#{supplierNo,jdbcType=VARCHAR}
,#{outWaveNo,jdbcType=VARCHAR}
)
</foreach>
</insert>
插入
ib\U sn\U运输(
序列号、入站编号、集装箱编号、,
货物编号、货物名称、货主编号、,
所有者名称、创建用户、更新用户、,
创建时间,更新时间,yn,
组织编号、组织名称、分发编号、,
仓库号、收货号、供应商号
,输出(波浪号)
价值观
(
#{item.sn,jdbcType=VARCHAR},#{inboundNo,jdbcType=VARCHAR},#{containerNo,jdbcType=VARCHAR},
#{goodsNo,jdbcType=VARCHAR},{goodsName,jdbcType=VARCHAR},{ownerNo,jdbcType=VARCHAR},
#{ownerName,jdbcType=VARCHAR},{createUser,jdbcType=VARCHAR},{updateUser,jdbcType=VARCHAR},
now(),now(),#{yn,jdbcType=TINYINT},
#{orgNo,jdbcType=VARCHAR},{orgName,jdbcType=VARCHAR},{distributeNo,jdbcType=VARCHAR},
#{warehouseNo,jdbcType=VARCHAR},{receivingNo,jdbcType=VARCHAR},{supplierNo,jdbcType=VARCHAR}
,#{outWaveNo,jdbcType=VARCHAR}
)
这是上课时间
public class IbSnTransit {
private String outWaveNo;
private String queryUser;
private String finishFlag;
private Integer id;
private String inboundNo;
private String sn;
private String snStart;
private String snEnd;
private String containerNo;
private String goodsNo;
private String goodsName;
private String ownerNo;
private String ownerName;
private String createUser;
private Date createTime;
private String updateUser;
private Date updateTime;
private Integer yn;
private String orgNo;
private String orgName;
private String distributeNo;
private String warehouseNo;
private String receivingNo;
private String supplierNo;
private List<String> snList;
public String getSupplierNo() {
return supplierNo;
}
public void setSupplierNo(String supplierNo) {
this.supplierNo = supplierNo;
}
public Integer getId() {
return id;
}
public void setId(Integer id){
this.id = id;
}
public String getOwnerName() {
return ownerName;
}
public void setOwnerName(String ownerName) {
this.ownerName = ownerName;
}
public String getOrgName() {
return orgName;
}
public void setOrgName(String orgName) {
this.orgName = orgName;
}
public String getSn() {
return sn;
}
public void setSn(String sn){
this.sn = sn;
}
public String getInboundNo() {
return inboundNo;
}
public void setInboundNo(String inboundNo) {
this.inboundNo = inboundNo;
}
public String getGoodsNo() {
return goodsNo;
}
public void setGoodsNo(String goodsNo) {
this.goodsNo = goodsNo;
}
public String getGoodsName() {
return goodsName;
}
public void setGoodsName(String goodsName) {
this.goodsName = goodsName;
}
public String getContainerNo() {
return containerNo;
}
public void setContainerNo(String containerNo) {
this.containerNo = containerNo;
}
public String getOwnerNo() {
return ownerNo;
}
public void setOwnerNo(String ownerNo) {
this.ownerNo = ownerNo;
}
public String getCreateUser() {
return createUser;
}
public void setCreateUser(String createUser) {
this.createUser = createUser;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public String getUpdateUser() {
return updateUser;
}
public void setUpdateUser(String updateUser) {
this.updateUser = updateUser;
}
public Date getUpdateTime() {
return updateTime;
}
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
public Integer getYn() {
return yn;
}
public void setYn(Integer yn) {
this.yn = yn;
}
public String getDistributeNo() {
return distributeNo;
}
public void setDistributeNo(String distributeNo) {
this.distributeNo = distributeNo;
}
public String getOrgNo() {
return orgNo;
}
public void setOrgNo(String orgNo) {
this.orgNo = orgNo;
}
public String getWarehouseNo() {
return warehouseNo;
}
public void setWarehouseNo(String warehouseNo) {
this.warehouseNo = warehouseNo;
}
public String getSnStart() {
return snStart;
}
public void setSnStart(String snStart) {
this.snStart = snStart;
}
public String getSnEnd() {
return snEnd;
}
public void setSnEnd(String snEnd) {
this.snEnd = snEnd;
}
public String getReceivingNo() {
return receivingNo;
}
public void setReceivingNo(String receivingNo) {
this.receivingNo = receivingNo;
}
public String getFinishFlag() {
return finishFlag;
}
public void setFinishFlag(String finishFlag) {
this.finishFlag = finishFlag;
}
public String getQueryUser() {
return queryUser;
}
public void setQueryUser(String queryUser) {
this.queryUser = queryUser;
}
public String getOutWaveNo() {
return outWaveNo;
}
public void setOutWaveNo(String outWaveNo) {
this.outWaveNo = outWaveNo;
}
public List<String> getSnList() {
return snList;
}
public void setSnList(List<String> snList) {
this.snList = snList;
}
}
公共类IbSnTransit{
私人字符串;
私有字符串查询器;
私有字符串finishFlag;
私有整数id;
私有字符串inboundNo;
私有字符串序列号;
私有字符串snStart;
私有字符串snEnd;
私有字符串containerNo;
私人字符串goodsNo;
私人字符串名称;
私有字符串所有者o;
私有字符串所有者名称;
私有字符串创建用户;
私人日期和时间;
私有字符串更新器;
私有日期更新时间;
私有整数yn;
私用字符串orgNo;
私有字符串orgName;
私有字符串分发器;
私人字符串仓库编号;
私有字符串接收编号;
私有字符串供应商号;
私人名单;
公共字符串getSupplierNo(){
返回供应商编号;
}
公共无效设置供应商编号(字符串供应商编号){
this.supplierNo=supplierNo;
}
公共整数getId(){
返回id;
}
公共无效集合id(整数id){
this.id=id;
}
公共字符串getOwnerName(){
返回所有者名称;
}
public void setOwnerName(字符串ownerName){
this.ownerName=ownerName;
}
公共字符串getOrgName(){
返回orgName;
}
public void setOrgName(字符串orgName){
this.orgName=orgName;
}
公共字符串getSn(){
返回序列号;
}
公共无效设置序号(字符串序号){
这个.sn=sn;
}
公共字符串getInboundNo(){
返回边界号;
}
public void setInboundNo(字符串inboundNo){
this.inboundNo=inboundNo;
}
公共字符串getGoodsNo(){
归还货物;
}
公共无效设置goodsNo(字符串goodsNo){
this.goodsNo=goodsNo;
}
公共字符串getGoodsName(){
返回goodsName;
}
公共无效设置goodsName(字符串goodsName){
this.goodsName=goodsName;
}
公共字符串getContainerNo(){
返回容器号;
}
public void setContainerNo(字符串containerNo){
this.containerNo=containerNo;
}
公共字符串getOwnerNo(){
返回所有者no;
}
public void setOwnerNo(字符串ownerNo){
this.ownerNo=ownerNo;
}
公共字符串getCreateUser(){
返回createUser;
}
公共void setCreateUser(字符串createUser){
this.createUser=createUser;
}
公共日期getCreateTime(){
返回创建时间;
}
public void setCreateTime(日期createTime){
this.createTime=createTime;
}
公共字符串getUpdateUser(){
返回更新器;
}
public void setUpdateUser(字符串updateUser){
this.updateUser=updateUser;
}
公共日期getUpdateTime(){
返回更新时间;
}
public void setUpdateTime(日期更新时间){
this.updateTime=updateTime;
}
公共整数getYn(){
返回yn;
}
公共void setYn(整数yn){
this.yn=yn;
}
公共字符串getDistributeNo(){
返回distributeNo;
}
public void setDistributeNo(字符串distributeNo){
this.distributeNo=distributeNo;
}
公共字符串getOrgNo(){
返回orgNo;
}
公共无效设置组织编号(字符串组织编号){
this.orgNo=orgNo;
}
公共字符串getWarehouseNo(){
退货仓库编号;
}
public void setWarehouseNo(字符串warehouseNo){
this.warehouseNo=warehouseNo;
}
公共字符串getSnStart(){
返回snStart;
}
公共void setnstart(字符串snStart){
this.snStart=snStart;
}
公共字符串getSnEnd(){
返回snEnd;
}
公共无效设置NEND(字符串snEnd){
this.snEnd=snEnd;
}
公共字符串getReceivingNo(){
返回接收编号;
}
public void setReceivingNo(字符串receivingNo){
this.receivingNo=receivingNo;
}
公共字符串getFinishFlag(){
返回finishFlag;
}
public void setFinishFlag(字符串finishFlag){
this.finishFlag=finishFlag;
}
公共字符串getQueryUser(){
返回查询器;
}
公共void setQueryUser(字符串queryUser){
this.queryUser=queryUser;
}
公共字符串getOutWaveNo(){
返回外瓦诺;
}
公共void setOutWaveNo(字符串outWaveNo){
this.outWaveNo=outWaveNo;
}
公共列表getSnList(){
返回snList;
}
公共作废设置列表(列表snList){
this.snList=snList;
}
}
结果
org.mybatis.spring.MyBatisSystemException:嵌套异常为org.apache.ibatis.reflection.ReflectionException:在“class java.lang.String”中没有名为“”的属性的getter。IbSnTransit.snList被声明为String.cl的列表