Commit 95bcf7b0 authored by wangyihao's avatar wangyihao

修改接口

parent d13b6506
package cn.com.fqy.controller.mgt;
import java.util.ArrayList;
import java.util.List;
import javax.annotation.Resource;
......@@ -82,12 +83,23 @@ public class AdministratorsController extends BaseController{
@ResponseBody
public ResultInfo<List<Administrators>> getAdministrators(){
ResultInfo<List<Administrators>> result = new ResultInfo<>();
List<Administrators> admListQuery = new ArrayList<>();
Administrators administrators = new Administrators();
administrators.setIsDeleted(0);
List<Administrators> administratorsList = administratorsService.getAdministratorsList(new Query(administrators));
if (administratorsList.size()>0) {
for(Administrators list:administratorsList) {
if(list.getSystemId() == null || "".equals(list.getSystemId())) {
admListQuery.add(list);
}
}
if(admListQuery.size()>0) {
result.setCode("1");
result.setData(administratorsList);
result.setData(admListQuery);
}else {
result.setCode("0");
result.setMsg("暂无可用店铺管理员数据");
}
}else {
result.setCode("0");
result.setMsg("暂无店铺管理员数据");
......
......@@ -54,6 +54,8 @@ public class SysUser extends Entity<String> {
private String flag;
//店铺管理员编号
private String administratorsId;
//店铺管理员名称
private String administratorsName;
/*Auto generated properties end*/
......@@ -66,6 +68,14 @@ public class SysUser extends Entity<String> {
/*Auto generated methods start*/
public String getAdministratorsName() {
return administratorsName;
}
public void setAdministratorsName(String administratorsName) {
this.administratorsName = administratorsName;
}
@Override
public String getPK(){
return userId;
......@@ -258,7 +268,7 @@ public class SysUser extends Entity<String> {
+ ", createTimeStart=" + createTimeStart + ", createTimeEnd=" + createTimeEnd + ", updateTime="
+ updateTime + ", updateTimeStart=" + updateTimeStart + ", updateTimeEnd=" + updateTimeEnd
+ ", operatorType=" + operatorType + ", operatorId=" + operatorId + ", sysRole=" + sysRole + ", flag="
+ flag + ", administratorsId=" + administratorsId + "]";
+ flag + ", administratorsId=" + administratorsId + ", administratorsName=" + administratorsName + "]";
}
}
......@@ -16,8 +16,10 @@ import cn.com.fqy.common.ResultInfo;
import cn.com.fqy.common.constants.Constant;
import cn.com.fqy.common.util.ECMd5Utils;
import cn.com.fqy.core.common.PageFinder;
import cn.com.fqy.core.dao.AdministratorsDao;
import cn.com.fqy.core.dao.SysUserDao;
import cn.com.fqy.core.dao.SysUserRoleRelDao;
import cn.com.fqy.core.model.Administrators;
import cn.com.fqy.core.model.Query;
import cn.com.fqy.core.model.SysRole;
import cn.com.fqy.core.model.SysUser;
......@@ -35,6 +37,8 @@ public class SysUserServiceImpl implements SysUserService {
@Resource
private SysUserRoleRelDao sysUserRoleRelDao;
@Resource
private AdministratorsDao administratorsDao;
private ResultInfo<SysUser> resultInfo = new ResultInfo<SysUser>();
......@@ -78,7 +82,13 @@ public class SysUserServiceImpl implements SysUserService {
sysUser.setIsDeleted(0);
sysUser.setCreateTime(now);
sysUser.setUpdateTime(now);
sysUserDao.add(sysUser);
int count1 = sysUserDao.add(sysUser);
if(count1>0) {
Administrators administrators = new Administrators();
administrators.setAdministratorsId(sysUser.getAdministratorsId());
administrators.setSystemId(sysUser.getUserId());
administratorsDao.update(administrators);
}
for (int i = 0; i < sysUser.getSysRole().size(); i++) {
SysRole sysRole = sysUser.getSysRole().get(i);
......@@ -106,7 +116,13 @@ public class SysUserServiceImpl implements SysUserService {
sysUserRoleRel.setCreateTime(now);
}
sysUser.setUpdateTime(now);
sysUserDao.update(sysUser);
int count1=sysUserDao.update(sysUser);
if(count1>0) {
Administrators administrators = new Administrators();
administrators.setAdministratorsId(sysUser.getAdministratorsId());
administrators.setSystemId(sysUser.getUserId());
administratorsDao.update(administrators);
}
}
} else {
resultInfo.setCode(Constant.FAIL);
......
......@@ -19,6 +19,7 @@
<result column="OPERATOR_ID" property="operatorId" javaType="java.lang.String" jdbcType="VARCHAR"/>
<result column="FLAG" property="flag" javaType="java.lang.String" jdbcType="VARCHAR"/>
<result column="ADMINISTRATORS_ID" property="administratorsId" javaType="java.lang.String" jdbcType="VARCHAR"/>
<result column="ADMINISTRATORS_NAME" property="administratorsName" javaType="java.lang.String" jdbcType="VARCHAR"/>
</resultMap>
<resultMap type="SysUser" id="SysUserAss" extends="SysUser">
<association property="sysRole" column="USER_ID"
......@@ -163,7 +164,11 @@
</select>
<select id="count2" parameterType="Query" resultType="Long">
select count(*) from T_SYS_USER
select
count(*)
FROM
t_sys_user u
LEFT JOIN t_administrators a ON u.ADMINISTRATORS_ID = a.ADMINISTRATORS_ID
<where>
<include refid="listCommonWhere2"/>
</where>
......@@ -185,7 +190,12 @@
</select>
<select id="pageList2" parameterType="Query" resultMap="SysUserAss">
select * from T_SYS_USER
SELECT
u.*,
a.ADMINISTRATORS_NAME
FROM
t_sys_user u
LEFT JOIN t_administrators a ON u.ADMINISTRATORS_ID = a.ADMINISTRATORS_ID
<where>
<include refid="listCommonWhere2"/>
</where>
......@@ -278,7 +288,7 @@
AND IS_AVAILABLE=#{q.isAvailable}
</if>
<if test="q.isDeleted!=null ">
AND IS_DELETED=#{q.isDeleted}
AND u.IS_DELETED=#{q.isDeleted}
</if>
<if test="q.createTime!=null ">
AND CREATE_TIME=#{q.createTime}
......
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 to comment