Browse Source

修改用户与角色关联查询

shilin 4 years ago
parent
commit
8b6494e654

+ 2 - 0
src/main/java/com/gyee/frame/mapper/auto/GyeeuserMapper.java

@@ -97,4 +97,6 @@ public interface GyeeuserMapper {
     int updateByPrimaryKey(Gyeeuser record);
 
     String queryIdByUserNamePassWord(Gyeeuser gyeeuser);
+
+    List<Gyeeuser> selectUserList();
 }

+ 2 - 3
src/main/java/com/gyee/frame/service/GyeeuserService.java

@@ -151,9 +151,8 @@ public class GyeeuserService extends SocketToolService implements BaseService<Gy
 
 	public List<Gyeeuser> findUserlist(){
 
-		GyeeuserExample example=new GyeeuserExample();
-		example.setOrderByClause("id");
-		List<Gyeeuser> list= gyeeuserMapper.selectByExample(example);
+
+		List<Gyeeuser> list= gyeeuserMapper.selectUserList();
 
 		return  list;
 	}

+ 5 - 0
src/main/resources/mybatis/auto/GyeeuserMapper.xml

@@ -321,4 +321,9 @@
        select id from gyeeuser where username=#{username,jdbcType=VARCHAR} and password=#{password,jdbcType=VARCHAR}
  </select>
 
+  <select id="selectUserList"   resultMap="BaseResultMap">
+    select user.id,user.username,user.password,user.nickname,user.photo,user.remak1,role.name remak2,
+    user.remak3 from gyeeuser user,gyeerole role,gyeeuserrole ur where user.id=ur.userid
+    and ur.roleid=role.id order by user.id
+  </select>
 </mapper>