com.fastchar.extjs.entity.ExtSystemNoticeEntity Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of fastchar-extjs Show documentation
Show all versions of fastchar-extjs Show documentation
FastChar-ExtJs is a Java Web framework that uses extjs libraries.
package com.fastchar.extjs.entity;
import com.fastchar.core.FastChar;
import com.fastchar.core.FastEntity;
import com.fastchar.database.FastPage;
import com.fastchar.database.info.FastSqlInfo;
import com.fastchar.extjs.entity.abstracts.AbstractExtSystemNoticeEntity;
import com.fastchar.utils.FastDateUtils;
import java.util.*;
import com.fastchar.utils.FastStringUtils;
public class ExtSystemNoticeEntity extends AbstractExtSystemNoticeEntity {
private static final long serialVersionUID = 1L;
public static ExtSystemNoticeEntity dao() {
return FastChar.getOverrides().singleInstance(ExtSystemNoticeEntity.class);
}
public static ExtSystemNoticeEntity newInstance() {
return FastChar.getOverrides().newInstance(ExtSystemNoticeEntity.class);
}
protected ExtSystemNoticeEntity() {
}
@Override
public String getTableName() {
return "ext_system_notice";
}
@Override
public String getTableDetails() {
return "系统待办";
}
@Override
public String getEntityCode() {
return this.getClass().getSimpleName();
}
@Override
public FastPage showList(int page, int pageSize) {
String sqlStr = "select t.*,a.managerName as a__managerName" +
" from ext_system_notice as t" +
" left join ext_manager as a on a.managerId=t.managerId " +
" order by noticeState asc , noticeDateTime desc ";
FastSqlInfo sqlInfo = toSelectSql(sqlStr);
return selectBySql(page, pageSize, sqlInfo.getSql(), sqlInfo.toParams());
}
@Override
public void setDefaultValue() {
set("managerId", 0);
set("noticeState", 0);
set("noticeDateTime", FastDateUtils.getDateString());
}
@Override
public void convertValue() {
super.convertValue();
Enum noticeState = getEnum("noticeState", ExtSystemNoticeStateEnum.class);
if (noticeState != null) {
put("noticeStateStr", noticeState.name());
}
}
public enum ExtSystemNoticeStateEnum {
待处理,
已处理
}
/**
* 获得数据详情
*/
public ExtSystemNoticeEntity getDetails(int noticeId) {
List linkColumns = new ArrayList<>();
linkColumns.addAll(ExtManagerEntity.dao().toSelectColumns("a"));
String sqlStr = "select t.*," + FastStringUtils.join(linkColumns, ",") + " from ext_system_notice as t" +
" left join ext_manager as a on a.managerId=t.managerId" +
" where t.noticeId = ? ";
ExtSystemNoticeEntity entity = selectFirstBySql(sqlStr, noticeId);
if (entity != null) {
ExtManagerEntity managerIdEntity = entity.toEntity("a", ExtManagerEntity.class);
entity.put("managerIdEntity", managerIdEntity);
}
return entity;
}
/**
* 根据managerId获得本实体集合
*
* @return 分页数据
*/
public FastPage getListByManagerId(int page, int managerId) {
List linkColumns = new ArrayList<>();
linkColumns.addAll(ExtManagerEntity.dao().toSelectColumns("a"));
String sqlStr = "select t.*," + FastStringUtils.join(linkColumns, ",") + " from ext_system_notice as t" +
" left join ext_manager as a on a.managerId=t.managerId" +
" where t.managerId=? ";
FastPage pageList = selectBySql(page, 10, sqlStr, managerId);
for (ExtSystemNoticeEntity entity : pageList.getList()) {
ExtManagerEntity managerIdEntity = entity.toEntity("a", ExtManagerEntity.class);
entity.put("managerIdEntity", managerIdEntity);
}
return pageList;
}
/**
* 根据managerIds批量查询数据,并整理成Map对应关系
*
* @return Map集合,key:managerId value: List
*/
public Map