| | |
| | | ], |
| | | }} |
| | | request={(params, sorter, filter) => |
| | | Http.doPostPromise('/api/user/page', { ...params, ...searchParam }, (res) => { |
| | | Http.doPostPromise('/api/user/page1', { ...params, ...searchParam }, (res) => { |
| | | return { |
| | | data: res.data.records, |
| | | total: res.data.total, |
| | |
| | | return queryWrapper; |
| | | } |
| | | |
| | | public Map<String, Object> pickOutMap() { |
| | | return where.getMap(); |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.zy.asrs.wcs.common.domain; |
| | | |
| | | import lombok.Data; |
| | | |
| | | import java.io.Serializable; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author vincent |
| | | * @since 2017-06-10 10:10:02 |
| | | */ |
| | | @Data |
| | | public class PageResult<T> implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | private List<T> records; |
| | | |
| | | private Long total; |
| | | |
| | | public PageResult() { |
| | | } |
| | | |
| | | public PageResult(List<T> records) { |
| | | this(records, null); |
| | | } |
| | | |
| | | public PageResult(List<T> records, Long total) { |
| | | this.records = records; |
| | | this.total = total; |
| | | } |
| | | |
| | | } |
| | |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('system:user:list')") |
| | | @PostMapping("/user/page1") |
| | | public R page1(@RequestBody Map<String, Object> map) { |
| | | BaseParam baseParam = buildParam(map, BaseParam.class); |
| | | PageParam<User, BaseParam> pageParam = new PageParam<>(baseParam, User.class); |
| | | return R.ok().add(userService.pageRel(pageParam)); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('system:user:list')") |
| | | @PostMapping("/user/list") |
| | | public R list(@RequestBody Map<String, Object> map) { |
| | | return R.ok().add(userService.list()); |
| | |
| | | package com.zy.asrs.wcs.system.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.InterceptorIgnore; |
| | | import com.zy.asrs.wcs.system.entity.User; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.zy.asrs.wcs.system.entity.User; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | import org.springframework.stereotype.Repository; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | @Mapper |
| | | @Repository |
| | | public interface UserMapper extends BaseMapper<User> { |
| | | |
| | | List<User> selectPageRel(@Param("page") IPage<User> page, @Param("param") Map<String, Object> param); |
| | | |
| | | @InterceptorIgnore(tenantLine = "true") |
| | | User selectByUsername(@Param("username") String username, @Param("hostId") Long hostId); |
| | | |
| | |
| | | package com.zy.asrs.wcs.system.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.zy.asrs.wcs.common.domain.BaseParam; |
| | | import com.zy.asrs.wcs.common.domain.PageParam; |
| | | import com.zy.asrs.wcs.common.domain.PageResult; |
| | | import com.zy.asrs.wcs.system.entity.User; |
| | | |
| | | public interface UserService extends IService<User> { |
| | | |
| | | PageResult<User> pageRel(PageParam<User, BaseParam> pageParam); |
| | | |
| | | User getByUsername(String username, Long hostId); |
| | | |
| | | User getByIdRel(Long userId); |
| | |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.zy.asrs.framework.common.Cools; |
| | | import com.zy.asrs.wcs.common.domain.BaseParam; |
| | | import com.zy.asrs.wcs.common.domain.PageParam; |
| | | import com.zy.asrs.wcs.common.domain.PageResult; |
| | | import com.zy.asrs.wcs.system.entity.User; |
| | | import com.zy.asrs.wcs.system.mapper.UserMapper; |
| | | import com.zy.asrs.wcs.system.service.RoleMenuService; |
| | |
| | | private BCryptPasswordEncoder bCryptPasswordEncoder; |
| | | |
| | | @Override |
| | | public PageResult<User> pageRel(PageParam<User, BaseParam> pageParam) { |
| | | return new PageResult<>(this.baseMapper.selectPageRel(pageParam, pageParam.pickOutMap()), pageParam.getTotal()); |
| | | } |
| | | |
| | | @Override |
| | | public User getByUsername(String username, Long hostId) { |
| | | if (Cools.isEmpty(username)) { |
| | | return null; |
| | |
| | | </if> |
| | | </select> |
| | | |
| | | <select id="selectPageRel" resultType="com.zy.asrs.wcs.system.entity.User"> |
| | | select |
| | | su.* |
| | | from sys_user su |
| | | left join sys_dept sd on su.dept_id = sd.id |
| | | where 1=1 |
| | | <if test="param.deptId != null"> |
| | | and (FIND_IN_SET(#{param.deptId}, sd.`path`) OR sd.`id` = #{param.deptId}) |
| | | </if> |
| | | order by su.create_time desc |
| | | </select> |
| | | |
| | | </mapper> |