Commit 94440daf by Huang Linyu

后台 - 会服 - 绑定管理员 增加可以绑定第二个管理员

parent a9e91b5a
...@@ -30,10 +30,11 @@ public class CommuneAdmDao extends GenericHibernateDao<CommuneAdm, Integer>{ ...@@ -30,10 +30,11 @@ public class CommuneAdmDao extends GenericHibernateDao<CommuneAdm, Integer>{
public PagedEntityBean<CommuneAdmBean> queryAdmBeanList(Object obj) { public PagedEntityBean<CommuneAdmBean> queryAdmBeanList(Object obj) {
CommuneAdmQuery query = (CommuneAdmQuery) obj; CommuneAdmQuery query = (CommuneAdmQuery) obj;
StringBuffer sb = new StringBuffer(); StringBuffer sb = new StringBuffer();
sb.append("SELECT sql_calc_found_rows a.id,a.uid,a.id as communeExtId,a.drawer,a.mobilePhone,a.userName,a.birthday,c.vipGrade,c.communeAgainTime,d.nickName AS bindedAdm,b.bindTime,b.labels,a.customerRegion ,a.checkedRegion "); sb.append("SELECT sql_calc_found_rows a.id,a.uid,a.id as communeExtId,a.drawer,a.mobilePhone,a.userName,a.birthday,c.vipGrade,c.communeAgainTime,d.nickName AS bindedAdm,b.bindTime,b.labels,a.customerRegion ,a.checkedRegion, e.nickName AS bindedAdm2,b.bindTime2 ");
sb.append(" FROM usr_commune_ext a LEFT JOIN usr_commune_adm b ON a.id = b.communeExtId"); sb.append(" FROM usr_commune_ext a LEFT JOIN usr_commune_adm b ON a.id = b.communeExtId");
sb.append(" LEFT JOIN bsc_userext c ON a.uid = c.uid"); sb.append(" LEFT JOIN bsc_userext c ON a.uid = c.uid");
sb.append(" LEFT JOIN adm_users d ON b.admUserId = d.id"); sb.append(" LEFT JOIN adm_users d ON b.admUserId = d.id");
sb.append(" LEFT JOIN adm_users e ON b.admUserId2 = e.id");
sb.append(" WHERE 1=1"); sb.append(" WHERE 1=1");
if (StringUtils.isNotBlank(query.getUserName())) { if (StringUtils.isNotBlank(query.getUserName())) {
...@@ -55,6 +56,13 @@ public class CommuneAdmDao extends GenericHibernateDao<CommuneAdm, Integer>{ ...@@ -55,6 +56,13 @@ public class CommuneAdmDao extends GenericHibernateDao<CommuneAdm, Integer>{
}else if (StringUtils.isNotBlank(query.getBindedAdm())) { }else if (StringUtils.isNotBlank(query.getBindedAdm())) {
sb.append(" AND d.username LIKE '%"+query.getBindedAdm()+"%'"); sb.append(" AND d.username LIKE '%"+query.getBindedAdm()+"%'");
} }
if ("0".equals(query.getBindedAdm2())) {
sb.append(" AND e.username is null");
}else if ("1".equals(query.getBindedAdm2())) {
sb.append(" AND e.username is not null");
}else if (StringUtils.isNotBlank(query.getBindedAdm2())) {
sb.append(" AND e.username LIKE '%"+query.getBindedAdm2()+"%'");
}
if (query.getCheckedRegion() != null && query.getCheckedRegion() != 0) { if (query.getCheckedRegion() != null && query.getCheckedRegion() != 0) {
...@@ -147,8 +155,14 @@ public class CommuneAdmDao extends GenericHibernateDao<CommuneAdm, Integer>{ ...@@ -147,8 +155,14 @@ public class CommuneAdmDao extends GenericHibernateDao<CommuneAdm, Integer>{
* @param communeExtId * @param communeExtId
* @return * @return
*/ */
public int deleteByCommuneExtId(int communeExtId) { public int deleteByCommuneExtId(int communeExtId, Integer rids) {
String sql = " update usr_commune_adm set unbindFlag=1,admUserId=NULL WHERE communeExtId="+communeExtId; String sql ="";
if(rids == 1){
sql = " update usr_commune_adm set admUserId=NULL WHERE communeExtId="+communeExtId;
}
if(rids == 2){
sql = " update usr_commune_adm set admUserId2=NULL WHERE communeExtId="+communeExtId;
}
int rlt = this.getSession().createSQLQuery(sql).executeUpdate(); int rlt = this.getSession().createSQLQuery(sql).executeUpdate();
return rlt; return rlt;
} }
...@@ -170,6 +184,17 @@ public class CommuneAdmDao extends GenericHibernateDao<CommuneAdm, Integer>{ ...@@ -170,6 +184,17 @@ public class CommuneAdmDao extends GenericHibernateDao<CommuneAdm, Integer>{
return this.getSession().createSQLQuery(sql).executeUpdate(); return this.getSession().createSQLQuery(sql).executeUpdate();
} }
/**
* 重新绑定第二个会服
* @param tmp_communeExtId
* @param admUserId
* @return
*/
public int rebind2(Integer tmp_communeExtId, int admUserId) {
String sql = "update usr_commune_adm set admUserId2 = "+admUserId+",bindTime2=now() where communeExtId = "+tmp_communeExtId ;
return this.getSession().createSQLQuery(sql).executeUpdate();
}
public int updateLabelsByCommuneExtId(Integer communeExtId, String labels) { public int updateLabelsByCommuneExtId(Integer communeExtId, String labels) {
String sql = "update usr_commune_adm set labels = '"+labels+"' where communeExtId = "+communeExtId ; String sql = "update usr_commune_adm set labels = '"+labels+"' where communeExtId = "+communeExtId ;
return this.getSession().createSQLQuery(sql).executeUpdate(); return this.getSession().createSQLQuery(sql).executeUpdate();
......
...@@ -64,6 +64,20 @@ public class CommuneAdm implements java.io.Serializable { ...@@ -64,6 +64,20 @@ public class CommuneAdm implements java.io.Serializable {
private Date bindTime; private Date bindTime;
/** /**
* 绑定的会服id
*/
@Column(name = "admUserId2")
private Integer admUserId2;
/**
* 绑定时间
*/
@Temporal(TemporalType.TIMESTAMP)
@Column(name = "bindTime2", length = 20)
private Date bindTime2;
/**
* 微信备注 * 微信备注
*/ */
@Column(name = "wechatRemark") @Column(name = "wechatRemark")
...@@ -160,5 +174,21 @@ public class CommuneAdm implements java.io.Serializable { ...@@ -160,5 +174,21 @@ public class CommuneAdm implements java.io.Serializable {
this.unbindFlag = unbindFlag; this.unbindFlag = unbindFlag;
} }
public Integer getAdmUserId2() {
return admUserId2;
}
public void setAdmUserId2(Integer admUserId2) {
this.admUserId2 = admUserId2;
}
public Date getBindTime2() {
return bindTime2;
}
public void setBindTime2(Date bindTime2) {
this.bindTime2 = bindTime2;
}
} }
...@@ -102,17 +102,27 @@ public class CommuneAdmService { ...@@ -102,17 +102,27 @@ public class CommuneAdmService {
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public int batchBind(Map<String,Object> map){ public int batchBind(Map<String,Object> map){
List<Object> communeExtIds = (ArrayList<Object>) map.get("communeExtIds"); List<Object> communeExtIds = (ArrayList<Object>) map.get("communeExtIds");
Integer rids = (Integer)map.get("rids");
int returnNum = 0; int returnNum = 0;
for(Object communeExtId : communeExtIds){ for(Object communeExtId : communeExtIds){
Integer tmp_communeExtId = Integer.parseInt((String) communeExtId); Integer tmp_communeExtId = Integer.parseInt((String) communeExtId);
CommuneAdm communeAdmed = communeAdmDao.findByCommuneExtId(tmp_communeExtId); CommuneAdm communeAdmed = communeAdmDao.findByCommuneExtId(tmp_communeExtId);
if(communeAdmed!=null){ if(communeAdmed!=null){
if(rids == 1)
returnNum += communeAdmDao.rebind(tmp_communeExtId,(int) map.get("admUserId")); returnNum += communeAdmDao.rebind(tmp_communeExtId,(int) map.get("admUserId"));
else if(rids == 2)
returnNum += communeAdmDao.rebind2(tmp_communeExtId,(int) map.get("admUserId"));
}else{ }else{
CommuneAdm communeAdm = new CommuneAdm(); CommuneAdm communeAdm = new CommuneAdm();
communeAdm.setCommuneExtId(tmp_communeExtId); communeAdm.setCommuneExtId(tmp_communeExtId);
communeAdm.setBindTime(new Date()); if(rids == 1){
communeAdm.setAdmUserId((int) map.get("admUserId")); communeAdm.setAdmUserId((int) map.get("admUserId"));
communeAdm.setBindTime(new Date());
}else if(rids == 2){
communeAdm.setAdmUserId2((int) map.get("admUserId"));
communeAdm.setBindTime2(new Date());
}
returnNum += communeAdmDao.save(communeAdm); returnNum += communeAdmDao.save(communeAdm);
} }
} }
...@@ -130,9 +140,10 @@ public class CommuneAdmService { ...@@ -130,9 +140,10 @@ public class CommuneAdmService {
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public int batchUnbind(Map<String,Object> map){ public int batchUnbind(Map<String,Object> map){
List<Object> communeExtIds = (ArrayList<Object>) map.get("communeExtIds"); List<Object> communeExtIds = (ArrayList<Object>) map.get("communeExtIds");
Integer rids = (Integer)map.get("rids");
int returnNum = 0; int returnNum = 0;
for(Object communeExtId : communeExtIds){ for(Object communeExtId : communeExtIds){
returnNum += communeAdmDao.deleteByCommuneExtId(Integer.parseInt((String) communeExtId)); returnNum += communeAdmDao.deleteByCommuneExtId(Integer.parseInt((String) communeExtId), rids);
} }
return returnNum; return returnNum;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment