解决后控制台打印结果:
[ classid = 611, code = userStatus,name = 用户状态, memo = 用户状态,oid = null, status = 1,parclassid = 610, path = 1.352.610.611.,isnode = 1 ]
[ dictid = 612, classid = 611,code = 1, name = 正常, zjm = ZC, memo = 正常,oid = 1,status = 1]
[ dictid = 613, classid = 611,code = 2, name = 挂起, zjm = GQ, memo = 挂起,oid = 2,status = 1]
[ dictid = 614, classid = 611,code = 3, name = 注销, zjm = ZX, memo = 注销,oid = 3,status = 1]
[ dictid = 615, classid = 611,code = 4, name = 锁定, zjm = SD, memo = 锁定,oid = 4,status = 1]
[ dictid = 681, classid = 611,code = 5, name = 未缴费, zjm = WJF, memo = null,oid = 5,status = 1]
BASE_DICTIONARY_KIND表里的主键是BASE_DICTIONARY_INFO表的外键。一对多关系。
下边上代码!
实体类BaseDictionaryKind
package xyhsoft.dictionary.demo.Entity;
import java.math.BigDecimal;
import java.util.List;
public class BaseDictionaryKind {
private Long classid;
private String code;
private String name;
private String memo;
private BigDecimal oid;
private String status;
private Long parclassid;
private String path;
private String isnode;
private List baseDictionaryInfo;
public String toString(){
return "[ classid = " + classid + ", code = " + code + ",name = " + name + ", memo = " + memo + ",oid = " + oid + ", status = " + status + ",parclassid = " + parclassid + ", path = " + path + ",isnode = " + isnode + "]";
}
public Long getClassid() {
return classid;
}
public void setClassid(Long classid) {
this.classid = classid;
}
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code == null ? null : code.trim();
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name == null ? null : name.trim();
}
public String getMemo() {
return memo;
}
public void setMemo(String memo) {
this.memo = memo == null ? null : memo.trim();
}
public BigDecimal getOid() {
return oid;
}
public void setOid(BigDecimal oid) {
this.oid = oid;
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status == null ? null : status.trim();
}
public Long getParclassid() {
return parclassid;
}
public void setParclassid(Long parclassid) {
this.parclassid = parclassid;
}
public String getPath() {
return path;
}
public void setPath(String path) {
this.path = path == null ? null : path.trim();
}
public String getIsnode() {
return isnode;
}
public void setIsnode(String isnode) {
this.isnode = isnode == null ? null : isnode.trim();
}
public List getBaseDictionaryInfo() {
return baseDictionaryInfo;
}
public void setBaseDictionaryInfo(List baseDictionaryInfo) {
this.baseDictionaryInfo = baseDictionaryInfo;
}
}
实体类BaseDictionaryInfo
package xyhsoft.dictionary.demo.Entity;
public class BaseDictionaryInfo {
private Long infodictid;
private Long infoclassid;
private String infocode;
private String infoname;
private String infozjm;
private String infomemo;
private Short infooid;
private String infostatus;
public String toString(){
return "[ dictid = " + infodictid + ", classid = " + infoclassid + ",code = " + infocode + ", name = " + infoname + ",zjm = " + infozjm + ", memo = " + infomemo + ",oid = " + infooid + ", status = " + infostatus + "]";
}
public Long getInfodictid() {
return infodictid;
}
public void setInfodictid(Long infodictid) {
this.infodictid = infodictid;
}
public Long getInfoclassid() {
return infoclassid;
}
public void setInfoclassid(Long infoclassid) {
this.infoclassid = infoclassid;
}
public String getInfocode() {
return infocode;
}
public void setInfocode(String infocode) {
this.infocode = infocode;
}
public String getInfoname() {
return infoname;
}
public void setInfoname(String infoname) {
this.infoname = infoname;
}
public String getInfozjm() {
return infozjm;
}
public void setInfozjm(String infozjm) {
this.infozjm = infozjm;
}
public String getInfomemo() {
return infomemo;
}
public void setInfomemo(String infomemo) {
this.infomemo = infomemo;
}
public Short getInfooid() {
return infooid;
}
public void setInfooid(Short infooid) {
this.infooid = infooid;
}
public String getInfostatus() {
return infostatus;
}
public void setInfostatus(String infostatus) {
this.infostatus = infostatus;
}
}
映射xml文件
BaseDictionaryKindMapper.xml
and ${criterion.condition}
and ${criterion.condition} #{criterion.value}
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
and ${criterion.condition}
#{listItem}
and ${criterion.condition}
and ${criterion.condition} #{criterion.value}
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
and ${criterion.condition}
#{listItem}
CLASSID, CODE, NAME, MEMO, OID, STATUS, PARCLASSID, PATH, ISNODE
delete from BASE_DICTIONARY_KIND
where CLASSID = #{classid,jdbcType=DECIMAL}
delete from BASE_DICTIONARY_KIND
insert into BASE_DICTIONARY_KIND (CLASSID, CODE, NAME,
MEMO, OID, STATUS, PARCLASSID,
PATH, ISNODE)
values (#{classid,jdbcType=DECIMAL}, #{code,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR},
#{memo,jdbcType=VARCHAR}, #{oid,jdbcType=DECIMAL}, #{status,jdbcType=CHAR}, #{parclassid,jdbcType=DECIMAL},
#{path,jdbcType=VARCHAR}, #{isnode,jdbcType=CHAR})
insert into BASE_DICTIONARY_KIND
CLASSID,
CODE,
NAME,
MEMO,
OID,
STATUS,
PARCLASSID,
PATH,
ISNODE,
#{classid,jdbcType=DECIMAL},
#{code,jdbcType=VARCHAR},
#{name,jdbcType=VARCHAR},
#{memo,jdbcType=VARCHAR},
#{oid,jdbcType=DECIMAL},
#{status,jdbcType=CHAR},
#{parclassid,jdbcType=DECIMAL},
#{path,jdbcType=VARCHAR},
#{isnode,jdbcType=CHAR},
update BASE_DICTIONARY_KIND
CLASSID = #{record.classid,jdbcType=DECIMAL},
CODE = #{record.code,jdbcType=VARCHAR},
NAME = #{record.name,jdbcType=VARCHAR},
MEMO = #{record.memo,jdbcType=VARCHAR},
OID = #{record.oid,jdbcType=DECIMAL},
STATUS = #{record.status,jdbcType=CHAR},
PARCLASSID = #{record.parclassid,jdbcType=DECIMAL},
PATH = #{record.path,jdbcType=VARCHAR},
ISNODE = #{record.isnode,jdbcType=CHAR},
update BASE_DICTIONARY_KIND
set CLASSID = #{record.classid,jdbcType=DECIMAL},
CODE = #{record.code,jdbcType=VARCHAR},
NAME = #{record.name,jdbcType=VARCHAR},
MEMO = #{record.memo,jdbcType=VARCHAR},
OID = #{record.oid,jdbcType=DECIMAL},
STATUS = #{record.status,jdbcType=CHAR},
PARCLASSID = #{record.parclassid,jdbcType=DECIMAL},
PATH = #{record.path,jdbcType=VARCHAR},
ISNODE = #{record.isnode,jdbcType=CHAR}
update BASE_DICTIONARY_KIND
CODE = #{code,jdbcType=VARCHAR},
NAME = #{name,jdbcType=VARCHAR},
MEMO = #{memo,jdbcType=VARCHAR},
OID = #{oid,jdbcType=DECIMAL},
STATUS = #{status,jdbcType=CHAR},
PARCLASSID = #{parclassid,jdbcType=DECIMAL},
PATH = #{path,jdbcType=VARCHAR},
ISNODE = #{isnode,jdbcType=CHAR},
where CLASSID = #{classid,jdbcType=DECIMAL}
update BASE_DICTIONARY_KIND
set CODE = #{code,jdbcType=VARCHAR},
NAME = #{name,jdbcType=VARCHAR},
MEMO = #{memo,jdbcType=VARCHAR},
OID = #{oid,jdbcType=DECIMAL},
STATUS = #{status,jdbcType=CHAR},
PARCLASSID = #{parclassid,jdbcType=DECIMAL},
PATH = #{path,jdbcType=VARCHAR},
ISNODE = #{isnode,jdbcType=CHAR}
where CLASSID = #{classid,jdbcType=DECIMAL}
BaseDictionaryInfoMapper.xml
and ${criterion.condition}
and ${criterion.condition} #{criterion.value}
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
and ${criterion.condition}
#{listItem}
and ${criterion.condition}
and ${criterion.condition} #{criterion.value}
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
and ${criterion.condition}
#{listItem}
DICTID, CLASSID, CODE, NAME, ZJM, MEMO, OID, STATUS
delete from BASE_DICTIONARY_INFO
where DICTID = #{infodictid,jdbcType=DECIMAL}
delete from BASE_DICTIONARY_INFO
insert into BASE_DICTIONARY_INFO (DICTID, CLASSID, CODE,
NAME, ZJM, MEMO, OID,
STATUS)
values (#{infodictid,jdbcType=DECIMAL}, #{infoclassid,jdbcType=DECIMAL}, #{infocode,jdbcType=VARCHAR},
#{infoname,jdbcType=VARCHAR}, #{infozjm,jdbcType=VARCHAR}, #{infomemo,jdbcType=VARCHAR}, #{infooid,jdbcType=DECIMAL},
#{infostatus,jdbcType=CHAR})
insert into BASE_DICTIONARY_INFO
DICTID,
CLASSID,
CODE,
NAME,
ZJM,
MEMO,
OID,
STATUS,
#{infodictid,jdbcType=DECIMAL},
#{infoclassid,jdbcType=DECIMAL},
#{infocode,jdbcType=VARCHAR},
#{infoname,jdbcType=VARCHAR},
#{infozjm,jdbcType=VARCHAR},
#{infomemo,jdbcType=VARCHAR},
#{infooid,jdbcType=DECIMAL},
#{infostatus,jdbcType=CHAR},
update BASE_DICTIONARY_INFO
DICTID = #{record.infodictid,jdbcType=DECIMAL},
CLASSID = #{record.infoclassid,jdbcType=DECIMAL},
CODE = #{record.infocode,jdbcType=VARCHAR},
NAME = #{record.infoname,jdbcType=VARCHAR},
ZJM = #{record.infozjm,jdbcType=VARCHAR},
MEMO = #{record.infomemo,jdbcType=VARCHAR},
OID = #{record.infooid,jdbcType=DECIMAL},
STATUS = #{record.infostatus,jdbcType=CHAR},
update BASE_DICTIONARY_INFO
set DICTID = #{record.infodictid,jdbcType=DECIMAL},
CLASSID = #{record.infoclassid,jdbcType=DECIMAL},
CODE = #{record.infocode,jdbcType=VARCHAR},
NAME = #{record.infoname,jdbcType=VARCHAR},
ZJM = #{record.infozjm,jdbcType=VARCHAR},
MEMO = #{record.infomemo,jdbcType=VARCHAR},
OID = #{record.infooid,jdbcType=DECIMAL},
STATUS = #{record.infostatus,jdbcType=CHAR}
update BASE_DICTIONARY_INFO
CLASSID = #{infoclassid,jdbcType=DECIMAL},
CODE = #{infocode,jdbcType=VARCHAR},
NAME = #{infoname,jdbcType=VARCHAR},
ZJM = #{infozjm,jdbcType=VARCHAR},
MEMO = #{infomemo,jdbcType=VARCHAR},
OID = #{infooid,jdbcType=DECIMAL},
STATUS = #{infostatus,jdbcType=CHAR},
where DICTID = #{infodictid,jdbcType=DECIMAL}
update BASE_DICTIONARY_INFO
set CLASSID = #{infoclassid,jdbcType=DECIMAL},
CODE = #{infocode,jdbcType=VARCHAR},
NAME = #{infoname,jdbcType=VARCHAR},
ZJM = #{infozjm,jdbcType=VARCHAR},
MEMO = #{infomemo,jdbcType=VARCHAR},
OID = #{infooid,jdbcType=DECIMAL},
STATUS = #{infostatus,jdbcType=CHAR}
where DICTID = #{infodictid,jdbcType=DECIMAL}