Commit 95bcf7b0 authored by wangyihao's avatar wangyihao

修改接口

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