@@ -4,8 +4,6 @@ import cc.smtweb.framework.core.cache.AbstractCache; | |||||
import cc.smtweb.framework.core.cache.CacheManager; | import cc.smtweb.framework.core.cache.CacheManager; | ||||
import cc.smtweb.framework.core.common.R; | import cc.smtweb.framework.core.common.R; | ||||
import cc.smtweb.framework.core.common.SwEnum; | import cc.smtweb.framework.core.common.SwEnum; | ||||
import cc.smtweb.framework.core.exception.BizException; | |||||
import cc.smtweb.framework.core.exception.SwException; | |||||
import cc.smtweb.framework.core.db.DbEngine; | import cc.smtweb.framework.core.db.DbEngine; | ||||
import cc.smtweb.framework.core.db.EntityDao; | import cc.smtweb.framework.core.db.EntityDao; | ||||
import cc.smtweb.framework.core.db.EntityHelper; | import cc.smtweb.framework.core.db.EntityHelper; | ||||
@@ -13,6 +11,7 @@ import cc.smtweb.framework.core.db.cache.ModelTableCache; | |||||
import cc.smtweb.framework.core.db.impl.DefaultEntity; | import cc.smtweb.framework.core.db.impl.DefaultEntity; | ||||
import cc.smtweb.framework.core.db.jdbc.AbsDbWorker; | import cc.smtweb.framework.core.db.jdbc.AbsDbWorker; | ||||
import cc.smtweb.framework.core.db.vo.ModelTable; | import cc.smtweb.framework.core.db.vo.ModelTable; | ||||
import cc.smtweb.framework.core.exception.BizException; | |||||
import cc.smtweb.system.bpm.web.design.form.define.PageDataset; | import cc.smtweb.system.bpm.web.design.form.define.PageDataset; | ||||
import cc.smtweb.system.bpm.web.design.form.define.PageDatasetFilter; | import cc.smtweb.system.bpm.web.design.form.define.PageDatasetFilter; | ||||
import org.apache.commons.lang3.StringUtils; | import org.apache.commons.lang3.StringUtils; | ||||
@@ -47,6 +46,7 @@ public class DynPageDelHandler extends AbstractDynPageHandler { | |||||
if (table == null) throw new BizException("没有找到指定的的表定义:" + pageDataSet.name + "!"); | if (table == null) throw new BizException("没有找到指定的的表定义:" + pageDataSet.name + "!"); | ||||
EntityDao dao = DbEngine.getInstance().findDao(table.getName()); | EntityDao dao = DbEngine.getInstance().findDao(table.getName()); | ||||
dao.deleteEntity(id); | dao.deleteEntity(id); | ||||
localDel(id); | |||||
} | } | ||||
@Override | @Override | ||||
@@ -56,11 +56,20 @@ public class DynPageDelHandler extends AbstractDynPageHandler { | |||||
AbstractCache cache = CacheManager.getIntance().getCache(table.getName()); | AbstractCache cache = CacheManager.getIntance().getCache(table.getName()); | ||||
cache.remove(id); | cache.remove(id); | ||||
} | } | ||||
localDelSuccess(id); | |||||
} | } | ||||
}); | }); | ||||
return R.success(); | return R.success(); | ||||
} | } | ||||
protected void localDel(long id) { | |||||
} | |||||
protected void localDelSuccess(long id) { | |||||
} | |||||
public R delAll() { | public R delAll() { | ||||
long id = params.readLong("id"); | long id = params.readLong("id"); | ||||
if (id == 0) throw new BizException("没有收到待删除记录Id(" + id + ")!"); | if (id == 0) throw new BizException("没有收到待删除记录Id(" + id + ")!"); | ||||
@@ -0,0 +1,145 @@ | |||||
package cc.smtweb.system.bpm.web.sys.user.user; | |||||
import cc.smtweb.framework.core.annotation.SwTable; | |||||
import cc.smtweb.framework.core.common.SwMap; | |||||
import cc.smtweb.framework.core.db.impl.DefaultEntity; | |||||
/** | |||||
* Created by 1 at 2022-07-28 15:24:49 | |||||
* 实体【[用户账号](SYS_USER)】的Entity类 | |||||
*/ | |||||
@SwTable("SYS_USER") | |||||
public class User extends DefaultEntity { | |||||
public static final String ENTITY_NAME = "SYS_USER"; | |||||
public User() { | |||||
super(ENTITY_NAME); | |||||
} | |||||
/** 主键 */ | |||||
public long getId() { | |||||
return getLong("sur_id"); | |||||
} | |||||
/** 主键 */ | |||||
public void setId(long sur_id) { | |||||
put("sur_id", sur_id); | |||||
} | |||||
/** 编码 */ | |||||
public String getCode() { | |||||
return getStr("sur_code"); | |||||
} | |||||
/** 编码 */ | |||||
public void setCode(String sur_code) { | |||||
put("sur_code", sur_code); | |||||
} | |||||
/** 名称 */ | |||||
public String getName() { | |||||
return getStr("sur_name"); | |||||
} | |||||
/** 名称 */ | |||||
public void setName(String sur_name) { | |||||
put("sur_name", sur_name); | |||||
} | |||||
/** 登录帐号 */ | |||||
public String getNicky() { | |||||
return getStr("sur_nicky"); | |||||
} | |||||
/** 登录帐号 */ | |||||
public void setNicky(String sur_nicky) { | |||||
put("sur_nicky", sur_nicky); | |||||
} | |||||
/** 用户等级 */ | |||||
public long getLevel() { | |||||
return getLong("sur_level"); | |||||
} | |||||
/** 用户等级 */ | |||||
public void setLevel(long sur_level) { | |||||
put("sur_level", sur_level); | |||||
} | |||||
/** 状态 */ | |||||
public int getStatu() { | |||||
return getInt("sur_statu"); | |||||
} | |||||
/** 状态 */ | |||||
public void setStatu(int sur_statu) { | |||||
put("sur_statu", sur_statu); | |||||
} | |||||
/** 手机号 */ | |||||
public String getTel() { | |||||
return getStr("sur_tel"); | |||||
} | |||||
/** 手机号 */ | |||||
public void setTel(String sur_tel) { | |||||
put("sur_tel", sur_tel); | |||||
} | |||||
/** 邮箱 */ | |||||
public String getEmail() { | |||||
return getStr("sur_email"); | |||||
} | |||||
/** 邮箱 */ | |||||
public void setEmail(String sur_email) { | |||||
put("sur_email", sur_email); | |||||
} | |||||
/** 令牌 */ | |||||
public long getOpt() { | |||||
return getLong("sur_opt"); | |||||
} | |||||
/** 令牌 */ | |||||
public void setOpt(long sur_opt) { | |||||
put("sur_opt", sur_opt); | |||||
} | |||||
/** 密码 */ | |||||
public String getPwd() { | |||||
return getStr("sur_pwd"); | |||||
} | |||||
/** 密码 */ | |||||
public void setPwd(String sur_pwd) { | |||||
put("sur_pwd", sur_pwd); | |||||
} | |||||
/** 头像 */ | |||||
public long getHead() { | |||||
return getLong("sur_head"); | |||||
} | |||||
/** 头像 */ | |||||
public void setHead(long sur_head) { | |||||
put("sur_head", sur_head); | |||||
} | |||||
/** 个性签名 */ | |||||
public String getSign() { | |||||
return getStr("sur_sign"); | |||||
} | |||||
/** 个性签名 */ | |||||
public void setSign(String sur_sign) { | |||||
put("sur_sign", sur_sign); | |||||
} | |||||
/** 密码等级 */ | |||||
public int getPwdLevel() { | |||||
return getInt("sur_pwd_level"); | |||||
} | |||||
/** 密码等级 */ | |||||
public void setPwdLevel(int sur_pwd_level) { | |||||
put("sur_pwd_level", sur_pwd_level); | |||||
} | |||||
/** 备注 */ | |||||
public String getRemark() { | |||||
return getStr("sur_remark"); | |||||
} | |||||
/** 备注 */ | |||||
public void setRemark(String sur_remark) { | |||||
put("sur_remark", sur_remark); | |||||
} | |||||
} |
@@ -0,0 +1,50 @@ | |||||
package cc.smtweb.system.bpm.web.sys.user.user; | |||||
import cc.smtweb.framework.core.annotation.SwCache; | |||||
import cc.smtweb.framework.core.cache.AbstractEntityCache; | |||||
import cc.smtweb.framework.core.cache.CacheManager; | |||||
import java.util.ArrayList; | |||||
import java.util.Comparator; | |||||
import java.util.List; | |||||
import java.util.Set; | |||||
/** | |||||
* Created by 1 at 2022-07-28 15:24:49 | |||||
* 实体【[用户账号](SYS_USER)】的缓存类 | |||||
*/ | |||||
@SwCache(ident = "SYS_USER", title = "用户账号") | |||||
public class UserCache extends AbstractEntityCache<User> { | |||||
//缓存key:按居家号 | |||||
public final static String mk_code = "code"; | |||||
//缓存key:按登录账号 | |||||
public final static String mk_nicky = "nicky"; | |||||
//缓存key:按手机号 | |||||
public final static String mk_tel = "tel"; | |||||
public static UserCache getInstance() { | |||||
return CacheManager.getIntance().getCache(UserCache.class); | |||||
} | |||||
public UserCache() { | |||||
//缓存key:按居家号 | |||||
regMap(mk_code, "sur_code"); | |||||
//缓存key:按登录账号 | |||||
regMap(mk_nicky, "sur_nicky"); | |||||
//缓存key:按手机号 | |||||
regMap(mk_tel, "sur_tel"); | |||||
} | |||||
//缓存key:按居家号 | |||||
public final User getByCode(String key) { | |||||
return getByKey(mk_code, key); | |||||
} | |||||
//缓存key:按登录账号 | |||||
public final User getByNicky(String key) { | |||||
return getByKey(mk_nicky, key); | |||||
} | |||||
//缓存key:按手机号 | |||||
public final User getByTel(String key) { | |||||
return getByKey(mk_tel, key); | |||||
} | |||||
} |
@@ -0,0 +1,65 @@ | |||||
package cc.smtweb.system.bpm.web.sys.user.user; | |||||
import cc.smtweb.framework.core.common.SwMap; | |||||
import cc.smtweb.framework.core.db.DbEngine; | |||||
import cc.smtweb.framework.core.db.impl.DefaultEntity; | |||||
import cc.smtweb.system.bpm.web.design.form.define.PageDataset; | |||||
import cc.smtweb.system.bpm.web.engine.dynPage.DynPageDelHandler; | |||||
import cc.smtweb.system.bpm.web.engine.dynPage.DynPageListHandler; | |||||
import cc.smtweb.system.bpm.web.engine.dynPage.DynPageLoadHandler; | |||||
import cc.smtweb.system.bpm.web.engine.dynPage.DynPageSaveHandler; | |||||
/** | |||||
* Created by Akmm at 2022/7/1 15:47 | |||||
* 区划保存 | |||||
*/ | |||||
public class UserHandler { | |||||
static class UserSaveHandler extends DynPageSaveHandler { | |||||
private UserStatu userStatu; | |||||
@Override | |||||
protected void saveBean(DefaultEntity bean) { | |||||
super.saveBean(bean); | |||||
userStatu = UserStatuCache.getInstance().get(bean.getEntityId()); | |||||
if (userStatu == null || userStatu.isEmpty()) { | |||||
userStatu = new UserStatu(); | |||||
userStatu.init(); | |||||
userStatu.setEntityId(bean.getEntityId()); | |||||
DbEngine.getInstance().findDao(UserStatu.ENTITY_NAME).insertEntity(userStatu); | |||||
UserStatuCache.getInstance().put(userStatu); | |||||
} | |||||
} | |||||
} | |||||
static class UserDelHandler extends DynPageDelHandler { | |||||
@Override | |||||
protected void localDel(long id) { | |||||
super.localDel(id); | |||||
DbEngine.getInstance().findDao(UserStatu.ENTITY_NAME).deleteEntity(id); | |||||
} | |||||
@Override | |||||
protected void localDelSuccess(long id) { | |||||
UserStatuCache.getInstance().remove(id); | |||||
} | |||||
} | |||||
static class UserListHandler extends DynPageListHandler { | |||||
public UserListHandler(long pageId, SwMap filter, PageDataset pageDataSet) { | |||||
super(pageId, filter, pageDataSet); | |||||
} | |||||
} | |||||
static class UserLoadHandler extends DynPageLoadHandler { | |||||
@Override | |||||
public DynPageListHandler getListWorker(SwMap filter, PageDataset pageDataSet) { | |||||
UserListHandler listHandler = new UserListHandler(pageId, filter, pageDataSet); | |||||
listHandler.init(params, us); | |||||
return listHandler; | |||||
} | |||||
} | |||||
} |
@@ -0,0 +1,32 @@ | |||||
package cc.smtweb.system.bpm.web.sys.user.user; | |||||
import cc.smtweb.framework.core.annotation.SwBody; | |||||
import cc.smtweb.framework.core.annotation.SwService; | |||||
import cc.smtweb.framework.core.common.R; | |||||
import cc.smtweb.framework.core.common.SwMap; | |||||
import cc.smtweb.system.bpm.web.engine.dynPage.DynPageService; | |||||
import cc.smtweb.framework.core.mvc.service.AbstractHandler; | |||||
import cc.smtweb.framework.core.session.UserSession; | |||||
import cc.smtweb.system.bpm.web.sys.base.dict.DictHandler; | |||||
/** | |||||
* Created by 1 at 2022-07-28 15:24:49 | |||||
* 页面【[用户列表]的服务类 | |||||
*/ | |||||
@SwService | |||||
public class UserService extends DynPageService { | |||||
@Override | |||||
protected AbstractHandler createHandler(String type) { | |||||
switch (type) { | |||||
case TYPE_SAVE: | |||||
return new UserHandler.UserSaveHandler(); | |||||
case TYPE_DEL: | |||||
return new UserHandler.UserDelHandler(); | |||||
case TYPE_LOAD: | |||||
return new UserHandler.UserLoadHandler(); | |||||
} | |||||
return super.createHandler(type); | |||||
} | |||||
} |
@@ -0,0 +1,109 @@ | |||||
package cc.smtweb.system.bpm.web.sys.user.user; | |||||
import cc.smtweb.framework.core.annotation.SwTable; | |||||
import cc.smtweb.framework.core.common.SwMap; | |||||
import cc.smtweb.framework.core.db.impl.DefaultEntity; | |||||
/** | |||||
* Created by 1 at 2022-07-28 15:24:49 | |||||
* 实体【[用户状态](SYS_USER_STATU)】的Entity类 | |||||
*/ | |||||
@SwTable("SYS_USER_STATU") | |||||
public class UserStatu extends DefaultEntity { | |||||
public static final String ENTITY_NAME = "SYS_USER_STATU"; | |||||
public UserStatu() { | |||||
super(ENTITY_NAME); | |||||
} | |||||
/** 主键 */ | |||||
public long getId() { | |||||
return getLong("sus_id"); | |||||
} | |||||
/** 主键 */ | |||||
public void setId(long sus_id) { | |||||
put("sus_id", sus_id); | |||||
} | |||||
/** 积分 */ | |||||
public int getScore() { | |||||
return getInt("sus_score"); | |||||
} | |||||
/** 积分 */ | |||||
public void setScore(int sus_score) { | |||||
put("sus_score", sus_score); | |||||
} | |||||
/** 密码错误次数 */ | |||||
public int getErrCount() { | |||||
return getInt("sus_err_count"); | |||||
} | |||||
/** 密码错误次数 */ | |||||
public void setErrCount(int sus_err_count) { | |||||
put("sus_err_count", sus_err_count); | |||||
} | |||||
/** 开始锁定时间 */ | |||||
public long getLockTime() { | |||||
return getLong("sus_lock_time"); | |||||
} | |||||
/** 开始锁定时间 */ | |||||
public void setLockTime(long sus_lock_time) { | |||||
put("sus_lock_time", sus_lock_time); | |||||
} | |||||
/** 登录时间 */ | |||||
public long getLoginTime() { | |||||
return getLong("sus_login_time"); | |||||
} | |||||
/** 登录时间 */ | |||||
public void setLoginTime(long sus_login_time) { | |||||
put("sus_login_time", sus_login_time); | |||||
} | |||||
/** 登录IP */ | |||||
public String getLoginIp() { | |||||
return getStr("sus_login_ip"); | |||||
} | |||||
/** 登录IP */ | |||||
public void setLoginIp(String sus_login_ip) { | |||||
put("sus_login_ip", sus_login_ip); | |||||
} | |||||
/** 登录信息 */ | |||||
public String getLoginInfo() { | |||||
return getStr("sus_login_info"); | |||||
} | |||||
/** 登录信息 */ | |||||
public void setLoginInfo(String sus_login_info) { | |||||
put("sus_login_info", sus_login_info); | |||||
} | |||||
/** 登录来源 */ | |||||
public int getLoginType() { | |||||
return getInt("sus_login_type"); | |||||
} | |||||
/** 登录来源 */ | |||||
public void setLoginType(int sus_login_type) { | |||||
put("sus_login_type", sus_login_type); | |||||
} | |||||
/** 退出时间 */ | |||||
public long getLogoutTime() { | |||||
return getLong("sus_logout_time"); | |||||
} | |||||
/** 退出时间 */ | |||||
public void setLogoutTime(long sus_logout_time) { | |||||
put("sus_logout_time", sus_logout_time); | |||||
} | |||||
/** 在线状态 */ | |||||
public boolean isStatu() { | |||||
return getBool("sus_statu"); | |||||
} | |||||
/** 在线状态 */ | |||||
public void set(boolean sus_statu) { | |||||
setBool("sus_statu", sus_statu); | |||||
} | |||||
} |
@@ -0,0 +1,26 @@ | |||||
package cc.smtweb.system.bpm.web.sys.user.user; | |||||
import cc.smtweb.framework.core.annotation.SwCache; | |||||
import cc.smtweb.framework.core.cache.AbstractEntityCache; | |||||
import cc.smtweb.framework.core.cache.CacheManager; | |||||
import java.util.ArrayList; | |||||
import java.util.Comparator; | |||||
import java.util.List; | |||||
import java.util.Set; | |||||
/** | |||||
* Created by 1 at 2022-07-28 15:24:49 | |||||
* 实体【[用户状态](SYS_USER_STATU)】的缓存类 | |||||
*/ | |||||
@SwCache(ident = "SYS_USER_STATU", title = "用户状态") | |||||
public class UserStatuCache extends AbstractEntityCache<UserStatu> { | |||||
public static UserStatuCache getInstance() { | |||||
return CacheManager.getIntance().getCache(UserStatuCache.class); | |||||
} | |||||
public UserStatuCache() { | |||||
} | |||||
} |
@@ -0,0 +1,18 @@ | |||||
/** | |||||
* Created by 1 at 2022-07-28 15:24:52 | |||||
* 注册事件类【用户列表】,参看event.defaultEvent.js | |||||
*/ | |||||
window.$swEvent.setup("bpm.sys.user.user.userList", { | |||||
setup(page){ | |||||
const { $params,$refs, $widgets, $model, $utils, $tabRouter, $api } = page || {}; | |||||
const { $$message, $$http } = $utils || {}; | |||||
// 示例 | |||||
const demoFunc = () => { | |||||
}; | |||||
return { | |||||
demoFunc, | |||||
} | |||||
} | |||||
}); |