main
parent
3ee7f2748f
commit
de20d2b661
@ -1,8 +1,13 @@
|
||||
package com.tamguo.modules.sys.dao;
|
||||
|
||||
import java.util.List;
|
||||
import com.baomidou.mybatisplus.plugins.Page;
|
||||
import com.tamguo.config.dao.SuperMapper;
|
||||
import com.tamguo.modules.sys.model.SysRoleEntity;
|
||||
import com.tamguo.modules.sys.model.condition.SysRoleCondition;
|
||||
|
||||
public interface SysRoleMapper extends SuperMapper<SysRoleEntity>{
|
||||
|
||||
List<SysRoleEntity> listData(SysRoleCondition condition, Page<SysRoleEntity> page);
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,21 @@
|
||||
package com.tamguo.modules.sys.model.condition;
|
||||
|
||||
public class SysRoleCondition {
|
||||
|
||||
private Integer pageNo;
|
||||
private Integer pageSize;
|
||||
|
||||
public Integer getPageNo() {
|
||||
return pageNo;
|
||||
}
|
||||
public void setPageNo(Integer pageNo) {
|
||||
this.pageNo = pageNo;
|
||||
}
|
||||
public Integer getPageSize() {
|
||||
return pageSize;
|
||||
}
|
||||
public void setPageSize(Integer pageSize) {
|
||||
this.pageSize = pageSize;
|
||||
}
|
||||
|
||||
}
|
@ -1,5 +1,11 @@
|
||||
package com.tamguo.modules.sys.service;
|
||||
|
||||
import com.baomidou.mybatisplus.plugins.Page;
|
||||
import com.tamguo.modules.sys.model.SysRoleEntity;
|
||||
import com.tamguo.modules.sys.model.condition.SysRoleCondition;
|
||||
|
||||
public interface ISysRoleService {
|
||||
|
||||
Page<SysRoleEntity> listData(SysRoleCondition condition);
|
||||
|
||||
}
|
||||
|
@ -1,10 +1,26 @@
|
||||
package com.tamguo.modules.sys.service.impl;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import com.baomidou.mybatisplus.plugins.Page;
|
||||
import com.tamguo.modules.sys.dao.SysRoleMapper;
|
||||
import com.tamguo.modules.sys.model.SysRoleEntity;
|
||||
import com.tamguo.modules.sys.model.condition.SysRoleCondition;
|
||||
import com.tamguo.modules.sys.service.ISysRoleService;
|
||||
|
||||
@Service
|
||||
public class SysRoleServiceImpl implements ISysRoleService{
|
||||
|
||||
@Autowired
|
||||
private SysRoleMapper sysRoleMapper;
|
||||
|
||||
@Transactional(readOnly=true)
|
||||
@Override
|
||||
public Page<SysRoleEntity> listData(SysRoleCondition condition) {
|
||||
Page<SysRoleEntity> page = new Page<>(condition.getPageNo(), condition.getPageSize());
|
||||
return page.setRecords(sysRoleMapper.listData(condition , page));
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,17 +1,38 @@
|
||||
package com.tamguo.modules.sys.web;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
|
||||
import com.baomidou.mybatisplus.plugins.Page;
|
||||
import com.tamguo.modules.sys.model.SysRoleEntity;
|
||||
import com.tamguo.modules.sys.model.condition.SysRoleCondition;
|
||||
import com.tamguo.modules.sys.service.ISysRoleService;
|
||||
import com.tamguo.modules.sys.utils.Result;
|
||||
|
||||
@Controller
|
||||
@RequestMapping(path="sys/role")
|
||||
public class SysRoleController {
|
||||
|
||||
private final String ROLE_INDEX_PAGE = "modules/sys/role/index";
|
||||
|
||||
@Autowired
|
||||
private ISysRoleService iSysRoleService;
|
||||
|
||||
@RequestMapping(path="index")
|
||||
public String index() {
|
||||
return ROLE_INDEX_PAGE;
|
||||
}
|
||||
|
||||
@RequestMapping(path="listData",method=RequestMethod.POST)
|
||||
@ResponseBody
|
||||
public Map<String, Object> listData(SysRoleCondition condition) {
|
||||
Page<SysRoleEntity> page = iSysRoleService.listData(condition);
|
||||
return Result.jqGridResult(page.getRecords(), page.getTotal(), page.getSize(), page.getCurrent(), page.getPages());
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,25 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.tamguo.modules.sys.dao.SysRoleMapper">
|
||||
|
||||
<select id="listData" resultType="SysRoleEntity">
|
||||
SELECT
|
||||
r.role_code,
|
||||
r.role_name,
|
||||
r.role_type,
|
||||
r.role_sort,
|
||||
r.is_sys,
|
||||
r.user_type,
|
||||
r.data_scope,
|
||||
r.`status`,
|
||||
r.create_by,
|
||||
r.create_date,
|
||||
r.update_by,
|
||||
r.update_date,
|
||||
r.remarks,
|
||||
r.corp_code,
|
||||
r.corp_name
|
||||
FROM
|
||||
sys_role r
|
||||
</select>
|
||||
</mapper>
|
Loading…
Reference in new issue