[修改] 查询全部用户

This commit is contained in:
bupengxiang
2023-05-17 15:37:35 +08:00
parent e6379e6ae7
commit be5c2ff02c
6 changed files with 51 additions and 24 deletions
@@ -4,7 +4,6 @@ import com.adc.da.sys.entity.OrgEO;
import com.adc.da.sys.entity.UserEO;
import com.adc.da.sys.vo.UserVO;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@@ -22,7 +21,9 @@ import java.util.Map;
*/
public interface UserEODao extends BaseMapper<UserEO> {
IPage<Map<String, Object>> list(IPage page, @Param("account") String account, @Param("roleName") String roleName);
List<Map<String, Object>> list(@Param("current")int current ,@Param("size") int size ,
@Param("account") String account,
@Param("roleName") String roleName);
/**
* 查询用户及用户所对应的角色
@@ -47,4 +48,6 @@ public interface UserEODao extends BaseMapper<UserEO> {
UserVO selectUserByIdNodel(String userId);
List<UserEO> getOwnLeader(@Param("Vo") List<OrgEO> orgEOList);
long listCount(@Param("account") String account, @Param("roleName") String roleName);
}
@@ -203,10 +203,15 @@ public class UserEOServiceImpl implements IUserEoService {
@Override
public IPage<Map<String, Object>> list(int pageNo, int pageSize, String account, String roleName) {
IPage page = new Page();
int i = pageNo - 1 ;
int current = i == 0 ? 0 : i * pageSize;
page.setCurrent(pageNo);
page.setSize(pageSize);
IPage<Map<String, Object>> list = dao.list(page, account, roleName);
return list;
List<Map<String, Object>> list = dao.list(current, pageSize, account, roleName);
long count = dao.listCount(account,roleName);
page.setTotal(count);
page.setRecords(list);
return page;
}
@Override
@@ -5,7 +5,7 @@
<!-- 查询条件 -->
<sql id="Base_Where_Clause">
<if test="pageVO.departmentCode != null and pageVO.DepartmentCode !=''">
and DEPARTMENT_CODE = #{pageVO.departmentCode}
and DEPARTMENT_CODE LIKE CONCAT(CONCAT('%',#{pageVO.departmentCode}),'%')
</if>
<if test="pageVO.longName != null and pageVO.longName != ''">
and LONG_NAME LIKE CONCAT(CONCAT('%',#{pageVO.longName}) ,'%')
@@ -7,25 +7,40 @@
date_format(t1.UPDATE_TIME,'%Y-%m-%d %H:%i:%S')CREATEDATE,
GROUP_CONCAT( DISTINCT org.ID ) as ORGID,
GROUP_CONCAT( DISTINCT org.LONG_NAME )as ORGNAME
from TS_USER t1
from
(
select * from TS_USER
where del_flag = 0
<if test="account !='' and account !=null">
and ACCOUNT like CONCAT('%',CONCAT(#{account},'%'))
</if>
<if test="roleName !='' and roleName !=null">
and NAME like CONCAT('%',CONCAT(#{roleName},'%'))
</if>
ORDER BY UPDATE_TIME DESC
LIMIT #{current},#{size}
) t1
left join TR_USER_ROLE t2 on t1.USID=t2.USER_ID
left JOIN TS_ROLE t3 on t2.ROLE_ID=t3.ID
left JOIN tr_user_org uo on t1.usid= uo.user_id
left JOIN ts_org org on uo.org_id = org.id
where t1.del_flag='0'
<if test="account !='' and account !=null">
and t1.ACCOUNT like "%"#{account}"%"
</if>
<if test="roleName !='' and roleName !=null">
and t3.NAME like "%"#{roleName}"%"
</if>
GROUP BY t1.USID
ORDER BY t1.UPDATE_TIME DESC
)tt
</select>
<select id="listCount" resultType="java.lang.Long">
select count(1) from TS_USER
where del_flag = 0
<if test="account !='' and account !=null">
and ACCOUNT like CONCAT('%',CONCAT(#{account},'%'))
</if>
<if test="roleName !='' and roleName !=null">
and NAME like CONCAT('%',CONCAT(#{roleName},'%'))
</if>
</select>
<select id="getUserCount" resultType="java.lang.Long">
select count(*) from TS_USER t1
where t1.del_flag='0'
@@ -53,6 +68,7 @@
<resultMap id="UserRoleMap" extends="BaseResultMap" type="com.adc.da.sys.entity.UserEO">
<result column="usname" property="usname"/>
<result column="LEVEL_ID" property="levelId"/>
<result column="EMPLOYEE_TYPE_ID" property="employeeTypeId"/>
<collection property = "roleIdList" ofType="string">
<id column="id" />
</collection>