You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
93 lines
2.8 KiB
93 lines
2.8 KiB
/* |
|
* Copyright (C), 2018-2021 |
|
* Project: starter |
|
* FileName: WechatTableData |
|
* Author: fr.open |
|
* Date: 2021/12/8 16:55 |
|
*/ |
|
package com.fr.plugin.icjb.data; |
|
|
|
import com.fanruan.api.conf.HolderKit; |
|
import com.fanruan.api.data.open.BaseTableData; |
|
import com.fanruan.api.util.AssistKit; |
|
import com.fanruan.api.util.GeneralKit; |
|
import com.fr.base.TableData; |
|
import com.fr.config.Identifier; |
|
import com.fr.config.holder.Conf; |
|
import com.fr.general.ComparatorUtils; |
|
import com.fr.general.data.DataModel; |
|
import com.fr.script.Calculator; |
|
import com.fr.stable.xml.XMLPrintWriter; |
|
import com.fr.stable.xml.XMLableReader; |
|
|
|
/** |
|
* <Function Description><br> |
|
* <UsersTableData> |
|
* |
|
* @author fr.open |
|
* @since 1.0.0 |
|
*/ |
|
public class UsersTableData extends BaseTableData { |
|
private static final long serialVersionUID = -7456007025209900779L; |
|
@Identifier("searchType") |
|
private Conf<Integer> searchType = HolderKit.simple(0); |
|
|
|
@Override |
|
public DataModel createDataModel(Calculator calculator) { |
|
return createDataModel(calculator, TableData.RESULT_ALL); |
|
} |
|
|
|
@Override |
|
public DataModel createDataModel(Calculator calculator, int rowCount) { |
|
if (ComparatorUtils.equals(this.getSearchType(), 1)) { |
|
return new DeptTableDataModel(Calculator.processParameters(calculator, super.getParameters(calculator))); |
|
} else { |
|
return new UsersTableDataModel(Calculator.processParameters(calculator, super.getParameters(calculator))); |
|
} |
|
} |
|
|
|
@Override |
|
public void readXML(XMLableReader reader) { |
|
super.readXML(reader); |
|
if (reader.isChildNode()) { |
|
String tmpName = reader.getTagName(); |
|
if ("Attributes".equals(tmpName)) { |
|
this.setSearchType(reader.getAttrAsInt("searchType", 0)); |
|
} |
|
} |
|
} |
|
|
|
@Override |
|
public void writeXML(XMLPrintWriter writer) { |
|
super.writeXML(writer); |
|
writer.startTAG("Attributes"); |
|
writer.attr("searchType", GeneralKit.objectToString(this.getSearchType())); |
|
writer.end(); |
|
} |
|
|
|
@Override |
|
public Object clone() throws CloneNotSupportedException { |
|
UsersTableData cloned = (UsersTableData) super.clone(); |
|
cloned.searchType = (Conf<Integer>) searchType.clone(); |
|
return cloned; |
|
} |
|
|
|
@Override |
|
public boolean equals(Object obj) { |
|
return obj instanceof UsersTableData |
|
&& AssistKit.equals(this.searchType, ((UsersTableData) obj).searchType); |
|
} |
|
|
|
@Override |
|
public int hashCode() { |
|
return AssistKit.hashCode(this.searchType.get()); |
|
} |
|
|
|
public int getSearchType() { |
|
return this.searchType.get(); |
|
} |
|
|
|
public void setSearchType(int searchType) { |
|
this.searchType.set(searchType); |
|
} |
|
} |