Commit fbdaddfb authored by machengbo's avatar machengbo

no message

parent 460ae521
package com.jz.manage.admin.controller.sys;
import com.jz.manage.admin.controller.BaseController;
import org.springframework.web.bind.annotation.RestController;
@RestController
public class LoginController extends BaseController {
/*@ApiOperation("登录接口")
@RequestMapping(value = "/login", method = RequestMethod.POST)
public Result<JSONObject> login(@RequestBody SysUser sysUser, HttpServletRequest request) throws Exception {
Result<JSONObject> result = new Result<>();
String account = sysUser.getAccount();
String password = sysUser.getPassword();
Subject subject = SecurityUtils.getSubject(); //获取当前用户
//将用户输入的用户名写密码封装到一个UsernamePasswordToken对象中
UsernamePasswordToken token = new UsernamePasswordToken(account, password);
//用Subject对象执行登录方法,没有抛出任何异常说明登录成功
try {
//执行登录方法,如果没有异常,就OK
//login()方法会调用 Realm类中执行认证逻辑的方法,
//并将这个参数传递给doGetAuthenticationInfo()方法
subject.login(token);
result.setSuccess(true);
result.setCode(CommonConstant.SC_OK_200);
result.setMessage("登录成功!");
return result;
} catch (UnknownAccountException e) {
result.setSuccess(false);
result.setCode(CommonConstant.SC_INTERNAL_SERVER_ERROR_500);
result.setMessage("账号错误!");
return result;
} catch (IncorrectCredentialsException e) {
result.setSuccess(false);
result.setCode(CommonConstant.SC_INTERNAL_SERVER_ERROR_500);
result.setMessage("密码错误!");
return result;
}
}*/
}
package com.jz.manage.admin.controller.sys;
import com.jz.manage.admin.controller.BaseController;
import com.jz.manage.admin.service.SysMenuService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* 功能菜单(TSysMenu)表控制层
*
* @author makejava
* @since 2020-11-29 14:30:23
*/
@RestController
@RequestMapping("tSysMenu")
public class SysMenuController extends BaseController {
/**
* 服务对象
*/
@Autowired
private SysMenuService sysMenuService;
}
\ No newline at end of file
package com.jz.manage.admin.controller.sys;
import com.jz.manage.admin.controller.BaseController;
import com.jz.manage.admin.service.SysOrgService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* 组织机构表(SysOrg)表控制层
*
* @author makejava
* @since 2020-11-29 14:30:24
*/
@RestController
@RequestMapping("sysOrg")
public class SysOrgController extends BaseController {
/**
* 服务对象
*/
@Autowired
private SysOrgService sysOrgService;
}
\ No newline at end of file
package com.jz.manage.admin.controller.sys;
import com.jz.manage.admin.controller.BaseController;
import com.jz.manage.admin.service.SysRoleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* 角色表(TSysRole)表控制层
*
* @author makejava
* @since 2020-11-29 14:30:25
*/
@RestController
@RequestMapping("sysRole")
public class SysRoleController extends BaseController {
/**
* 服务对象
*/
@Autowired
private SysRoleService tSysRoleService;
}
\ No newline at end of file
package com.jz.manage.admin.controller.sys;
import com.jz.manage.admin.controller.BaseController;
import com.jz.manage.admin.service.SysRoleMenuService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* (TSysRoleMenu)表控制层
*
* @author makejava
* @since 2020-11-29 14:30:25
*/
@RestController
@RequestMapping("sysRoleMenu")
public class SysRoleMenuController extends BaseController {
/**
* 服务对象
*/
@Autowired
private SysRoleMenuService sysRoleMenuService;
}
\ No newline at end of file
package com.jz.manage.admin.controller.sys;
import com.jz.manage.admin.controller.BaseController;
import com.jz.manage.admin.service.SysUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
/**
* 平台系统用户表(TSysUser)表控制层
*
* @author makejava
* @since 2020-11-29 14:30:26
*/
@RestController
@RequestMapping("sysUser")
public class SysUserController extends BaseController {
/**
* 服务对象
*/
@Autowired
private SysUserService sysUserService;
}
\ No newline at end of file
package com.jz.manage.admin.controller.sys;
import com.jz.manage.admin.controller.BaseController;
import com.jz.manage.admin.service.SysUserRoleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* (SysUserRole)控制层
*
* @author makejava
* @since 2020-11-29 14:30:27
*/
@RestController
@RequestMapping("sysUserRole")
public class SysUserRoleController extends BaseController {
/**
* 服务对象
*/
@Autowired
private SysUserRoleService tSysUserRoleService;
}
\ No newline at end of file
package com.jz.manage.admin.dao;
import com.jz.common.base.BaseMapper;
import com.jz.manage.admin.entity.sys.SysMenu;
/**
* 功能菜单(SysMenu)表数据库访问层
*
* @author Bellamy
* @since 2020-11-29 14:30:23
*/
public interface SysMenuDao extends BaseMapper<SysMenu> {
}
\ No newline at end of file
package com.jz.manage.admin.dao;
import com.jz.common.base.BaseMapper;
import com.jz.manage.admin.entity.sys.SysOrg;
/**
* 组织机构表(SysOrg)表数据库访问层
*
* @author Bellamy
* @since 2020-11-29 14:30:24
*/
public interface SysOrgDao extends BaseMapper<SysOrg> {
}
\ No newline at end of file
package com.jz.manage.admin.dao;
import com.jz.common.base.BaseMapper;
import com.jz.manage.admin.entity.sys.SysRole;
/**
* 角色表(SysRole)表数据库访问层
*
* @author Bellamy
* @since 2020-11-29 14:30:24
*/
public interface SysRoleDao extends BaseMapper<SysRole> {
}
\ No newline at end of file
package com.jz.manage.admin.dao;
import com.jz.common.base.BaseMapper;
import com.jz.manage.admin.entity.sys.SysRoleMenu;
/**
* (SysRoleMenu)表数据库访问层
*
* @author Bellamy
* @since 2020-11-29 14:30:25
*/
public interface SysRoleMenuDao extends BaseMapper<SysRoleMenu> {
}
\ No newline at end of file
package com.jz.manage.admin.dao;
import com.jz.common.base.BaseMapper;
import com.jz.manage.admin.entity.sys.SysUser;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;
/**
* 平台系统用户表(SysUser)表数据库访问层
*
* @author Bellamy
* @since 2020-11-29 14:30:26
*/
public interface SysUserDao extends BaseMapper<SysUser> {
List<Map> getUserRoleByAccount(@Param("account") String account);
}
\ No newline at end of file
package com.jz.manage.admin.dao;
import com.jz.common.base.BaseMapper;
import com.jz.manage.admin.entity.sys.SysUserRole;
/**
* (SysUserRole)表数据库访问层
*
* @author Bellamy
* @since 2020-11-29 14:30:26
*/
public interface SysUserRoleDao extends BaseMapper<SysUserRole> {
}
\ No newline at end of file
package com.jz.manage.admin.dao;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.jz.common.base.BaseMapper;
import com.jz.manage.admin.entity.User;
import java.util.List;
import java.util.Map;
public interface TestMapper extends BaseMapper<Map> {
IPage<Map> queryListPage(Page<Map> userPage, User event);
}
package com.jz.manage.admin.entity.sys;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;
import java.util.Date;
/**
* 功能菜单(SysMenu)实体类
*
* @author Bellamy
* @since 2020-11-29 14:30:23
*/
@TableName("t_sys_menu")
@ApiModel
public class SysMenu implements Serializable {
private static final long serialVersionUID = 256732259347445947L;
/**
* 菜单ID
*/
@TableId(value = "menu_id",type = IdType.AUTO)
private Long menuId;
/**
* 菜单名称
*/
@ApiModelProperty(value = "菜单名称")
private String menuName;
/**
* 菜单路径
*/
@ApiModelProperty(value = "菜单路径url")
private String url;
/**
* 父级id
*/
@ApiModelProperty(value = "父级id")
private Long parentId;
/**
* 是否为子节点:Y是,N否
*/
@ApiModelProperty(value = "是否为子节点:Y是,N否")
private String ifChild;
/**
* 创建时间
*/
@ApiModelProperty(value = "创建时间")
private Date creTime;
/**
* 创建人
*/
@ApiModelProperty(value = "创建人")
private Long crePerson;
/**
* 删除标识:Y删除,N未删除
*/
@ApiModelProperty(value = "删除标识:Y删除,N未删除")
private String delFlag;
public Long getMenuId() {
return menuId;
}
public void setMenuId(Long menuId) {
this.menuId = menuId;
}
public String getMenuName() {
return menuName;
}
public void setMenuName(String menuName) {
this.menuName = menuName;
}
public String getUrl() {
return url;
}
public void setUrl(String url) {
this.url = url;
}
public Long getParentId() {
return parentId;
}
public void setParentId(Long parentId) {
this.parentId = parentId;
}
public String getIfChild() {
return ifChild;
}
public void setIfChild(String ifChild) {
this.ifChild = ifChild;
}
public Date getCreTime() {
return creTime;
}
public void setCreTime(Date creTime) {
this.creTime = creTime;
}
public Long getCrePerson() {
return crePerson;
}
public void setCrePerson(Long crePerson) {
this.crePerson = crePerson;
}
public String getDelFlag() {
return delFlag;
}
public void setDelFlag(String delFlag) {
this.delFlag = delFlag;
}
}
\ No newline at end of file
package com.jz.manage.admin.entity.sys;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;
import java.util.Date;
/**
* 组织机构表(TSysOrg)实体类
*
* @author Bellamy
* @since 2020-11-29 14:30:24
*/
@TableName("t_sys_org")
@ApiModel
public class SysOrg implements Serializable {
private static final long serialVersionUID = 289053694180114461L;
/**
* 组织机构id
*/
@TableId(value = "org_id",type = IdType.AUTO)
@ApiModelProperty(value = "组织机构id")
private Long orgId;
/**
* 组织名称
*/
@ApiModelProperty(value = "组织名称")
private String orgName;
/**
* 父组织id
*/
@ApiModelProperty(value = "父组织id")
private Long parentOrgId;
/**
* 是否子节点:Y是,N否
*/
@ApiModelProperty(value = "是否子节点:Y是,N否")
private String ifChild;
/**
* 创建时间
*/
@ApiModelProperty(value = "创建时间")
private Date creTime;
/**
* 创建人
*/
@ApiModelProperty(value = "创建人")
private String crePerson;
/**
* 更新人
*/
@ApiModelProperty(value = "更新人")
private String uptPerson;
/**
* 更新时间
*/
@ApiModelProperty(value = "更新时间")
private Date uptTime;
/**
* 删除标识:Y删除,N未删除
*/
@ApiModelProperty(value = "删除标识:Y删除,N未删除")
private String delFlag;
public Long getOrgId() {
return orgId;
}
public void setOrgId(Long orgId) {
this.orgId = orgId;
}
public String getOrgName() {
return orgName;
}
public void setOrgName(String orgName) {
this.orgName = orgName;
}
public Long getParentOrgId() {
return parentOrgId;
}
public void setParentOrgId(Long parentOrgId) {
this.parentOrgId = parentOrgId;
}
public String getIfChild() {
return ifChild;
}
public void setIfChild(String ifChild) {
this.ifChild = ifChild;
}
public Date getCreTime() {
return creTime;
}
public void setCreTime(Date creTime) {
this.creTime = creTime;
}
public String getCrePerson() {
return crePerson;
}
public void setCrePerson(String crePerson) {
this.crePerson = crePerson;
}
public String getUptPerson() {
return uptPerson;
}
public void setUptPerson(String uptPerson) {
this.uptPerson = uptPerson;
}
public Date getUptTime() {
return uptTime;
}
public void setUptTime(Date uptTime) {
this.uptTime = uptTime;
}
public String getDelFlag() {
return delFlag;
}
public void setDelFlag(String delFlag) {
this.delFlag = delFlag;
}
}
\ No newline at end of file
package com.jz.manage.admin.entity.sys;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;
import java.util.Date;
/**
* 角色表(TSysRole)实体类
*
* @author Bellamy
* @since 2020-11-29 14:30:24
*/
@TableName("t_sys_role")
@ApiModel
public class SysRole implements Serializable {
private static final long serialVersionUID = 805800518211894799L;
/**
* 角色id
*/
@TableId(value = "role_id",type = IdType.AUTO)
@ApiModelProperty(value = "角色id")
private Long roleId;
/**
* 角色名称
*/
@ApiModelProperty(value = "角色名称")
private String roleName;
/**
* 创建时间
*/
@ApiModelProperty(value = "创建时间")
private Date creTime;
/**
* 创建人
*/
@ApiModelProperty(value = "创建人")
private String crePerson;
/**
* 更新时间
*/
@ApiModelProperty(value = "更新时间")
private Date uptTime;
/**
* 更新人
*/
@ApiModelProperty(value = "更新人")
private String uptPerson;
/**
* 删除标识:Y删除,N未删除
*/
@ApiModelProperty(value = "删除标识:Y删除,N未删除")
private String delFlag;
public Long getRoleId() {
return roleId;
}
public void setRoleId(Long roleId) {
this.roleId = roleId;
}
public String getRoleName() {
return roleName;
}
public void setRoleName(String roleName) {
this.roleName = roleName;
}
public Date getCreTime() {
return creTime;
}
public void setCreTime(Date creTime) {
this.creTime = creTime;
}
public String getCrePerson() {
return crePerson;
}
public void setCrePerson(String crePerson) {
this.crePerson = crePerson;
}
public Date getUptTime() {
return uptTime;
}
public void setUptTime(Date uptTime) {
this.uptTime = uptTime;
}
public String getUptPerson() {
return uptPerson;
}
public void setUptPerson(String uptPerson) {
this.uptPerson = uptPerson;
}
public String getDelFlag() {
return delFlag;
}
public void setDelFlag(String delFlag) {
this.delFlag = delFlag;
}
}
\ No newline at end of file
package com.jz.manage.admin.entity.sys;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import java.io.Serializable;
/**
* (SysRoleMenu)实体类
*
* @author Bellamy
* @since 2020-11-29 14:30:25
*/
@TableName("t_sys_role_menu")
@ApiModel
public class SysRoleMenu implements Serializable {
private static final long serialVersionUID = -82724914905011429L;
/**
* 主键
*/
@TableId(value = "role_menu_id",type = IdType.AUTO)
private Long roleMenuId;
/**
* 角色id
*/
private Long roleId;
/**
* 菜单id
*/
private Long menuId;
public Long getRoleMenuId() {
return roleMenuId;
}
public void setRoleMenuId(Long roleMenuId) {
this.roleMenuId = roleMenuId;
}
public Long getRoleId() {
return roleId;
}
public void setRoleId(Long roleId) {
this.roleId = roleId;
}
public Long getMenuId() {
return menuId;
}
public void setMenuId(Long menuId) {
this.menuId = menuId;
}
}
\ No newline at end of file
package com.jz.manage.admin.entity.sys;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import java.io.Serializable;
import java.util.Date;
/**
* 平台系统用户表(SysUser)实体类
*
* @author Bellamy
* @since 2020-11-29 14:30:26
*/
@TableName("t_sys_user")
@ApiModel
public class SysUser implements Serializable {
private static final long serialVersionUID = 340254540407496782L;
/**
* 平台用户id
*/
@TableId(value = "user_id",type = IdType.AUTO)
private Long userId;
/**
* 组织机构id
*/
private Long orgId;
/**
* 用户姓名
*/
private String userName;
/**
* 账户
*/
private String account;
/**
* 密码
*/
private String password;
/**
* 供应商编号
*/
private String supplierCode;
/**
* 供应商名称(店铺名称)
*/
private String supplierName;
/**
* 电话
*/
private String telephone;
/**
* 创建时间
*/
private Date creTime;
/**
* 删除标识
*/
private String delFlag;
public Long getUserId() {
return userId;
}
public void setUserId(Long userId) {
this.userId = userId;
}
public Long getOrgId() {
return orgId;
}
public void setOrgId(Long orgId) {
this.orgId = orgId;
}
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
public String getAccount() {
return account;
}
public void setAccount(String account) {
this.account = account;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public String getSupplierCode() {
return supplierCode;
}
public void setSupplierCode(String supplierCode) {
this.supplierCode = supplierCode;
}
public String getSupplierName() {
return supplierName;
}
public void setSupplierName(String supplierName) {
this.supplierName = supplierName;
}
public String getTelephone() {
return telephone;
}
public void setTelephone(String telephone) {
this.telephone = telephone;
}
public Date getCreTime() {
return creTime;
}
public void setCreTime(Date creTime) {
this.creTime = creTime;
}
public String getDelFlag() {
return delFlag;
}
public void setDelFlag(String delFlag) {
this.delFlag = delFlag;
}
}
\ No newline at end of file
package com.jz.manage.admin.entity.sys;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import java.io.Serializable;
/**
* (TSysUserRole)实体类
*
* @author Bellamy
* @since 2020-11-29 14:30:26
*/
@TableName("t_sys_user_role")
@ApiModel
public class SysUserRole implements Serializable {
private static final long serialVersionUID = -55311533564196399L;
/**
* 主键
*/
@TableId(value = "user_role_id",type = IdType.AUTO)
private Long userRoleId;
/**
* 用户id
*/
private Long userId;
/**
* 角色id
*/
private Long roleId;
public Long getUserRoleId() {
return userRoleId;
}
public void setUserRoleId(Long userRoleId) {
this.userRoleId = userRoleId;
}
public Long getUserId() {
return userId;
}
public void setUserId(Long userId) {
this.userId = userId;
}
public Long getRoleId() {
return roleId;
}
public void setRoleId(Long roleId) {
this.roleId = roleId;
}
}
\ No newline at end of file
package com.jz.manage.admin.service;
/**
* 功能菜单(TSysMenu)表服务接口
*
* @author Bellamy
* @since 2020-11-29 14:30:23
*/
public interface SysMenuService {
}
\ No newline at end of file
package com.jz.manage.admin.service;
/**
* 组织机构表(TSysOrg)表服务接口
*
* @author Bellamy
* @since 2020-11-29 14:30:24
*/
public interface SysOrgService {
}
\ No newline at end of file
package com.jz.manage.admin.service;
/**
* (TSysRoleMenu)表服务接口
*
* @author Bellamy
* @since 2020-11-29 14:30:25
*/
public interface SysRoleMenuService {
}
\ No newline at end of file
package com.jz.manage.admin.service;
/**
* 角色表(TSysRole)表服务接口
*
* @author Bellamy
* @since 2020-11-29 14:30:25
*/
public interface SysRoleService {
}
\ No newline at end of file
package com.jz.manage.admin.service;
/**
* (SysUserRole)表服务接口
*
* @author Bellamy
* @since 2020-11-29 14:30:26
*/
public interface SysUserRoleService {
}
\ No newline at end of file
package com.jz.manage.admin.service;
import com.jz.manage.admin.entity.sys.SysUser;
import java.util.Map;
/**
* 平台系统用户表(SysUser)表服务接口
*
* @author Bellamy
* @since 2020-11-29 14:30:26
*/
public interface SysUserService {
/*
* 通过用户帐好进行查询
* */
SysUser selectByUsername(String account);
Map<String,Object> getUserRoleByAccount(String account);
}
\ No newline at end of file
package com.jz.manage.admin.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.jz.manage.admin.entity.User;
import java.util.List;
import java.util.Map;
public interface TestUserService {
List<Map> getTest();
IPage<User> queryPage(Page<User> userPage, User event);
IPage<Map> queryListPage(Page<Map> mapPage, User event);
}
package com.jz.manage.admin.service.impl;
import com.jz.manage.admin.dao.SysMenuDao;
import com.jz.manage.admin.service.SysMenuService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
/**
* 功能菜单(SysMenu)表服务实现类
*
* @author Bellamy
* @since 2020-11-29 14:30:23
*/
@Service("sysMenuService")
public class SysMenuServiceImpl implements SysMenuService {
@Resource
private SysMenuDao sysMenuDao;
}
\ No newline at end of file
package com.jz.manage.admin.service.impl;
import com.jz.manage.admin.dao.SysOrgDao;
import com.jz.manage.admin.service.SysOrgService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
* 组织机构表(SysOrg)表服务实现类
*
* @author Bellamy
* @since 2020-11-29 14:30:24
*/
@Service("sysOrgService")
public class SysOrgServiceImpl implements SysOrgService {
@Autowired
private SysOrgDao sysOrgDao;
}
\ No newline at end of file
package com.jz.manage.admin.service.impl;
import com.jz.manage.admin.dao.SysRoleMenuDao;
import com.jz.manage.admin.service.SysRoleMenuService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
* (SysRoleMenu)表服务实现类
*
* @author Bellamy
* @since 2020-11-29 14:30:25
*/
@Service("sysRoleMenuService")
public class SysRoleMenuServiceImpl implements SysRoleMenuService {
@Autowired
private SysRoleMenuDao sysRoleMenuDao;
}
\ No newline at end of file
package com.jz.manage.admin.service.impl;
import com.jz.manage.admin.dao.SysRoleDao;
import com.jz.manage.admin.service.SysRoleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
* 角色表(SysRole)表服务实现类
*
* @author Bellamy
* @since 2020-11-29 14:30:25
*/
@Service("sysRoleService")
public class SysRoleServiceImpl implements SysRoleService {
@Autowired
private SysRoleDao SysRoleDao;
}
\ No newline at end of file
package com.jz.manage.admin.service.impl;
import com.jz.manage.admin.dao.SysUserRoleDao;
import com.jz.manage.admin.service.SysUserRoleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
* (SysUserRole)表服务实现类
*
* @author makejava
* @since 2020-11-29 14:30:27
*/
@Service("sysUserRoleService")
public class SysUserRoleServiceImpl implements SysUserRoleService {
@Autowired
private SysUserRoleDao sysUserRoleDao;
}
\ No newline at end of file
package com.jz.manage.admin.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.jz.manage.admin.dao.SysUserDao;
import com.jz.manage.admin.entity.sys.SysUser;
import com.jz.manage.admin.service.SysUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.*;
/**
* 平台系统用户表(SysUser)表服务实现类
*
* @author Bellamy
* @since 2020-11-29 14:30:26
*/
@Service("sysUserService")
@Transactional
public class SysUserServiceImpl implements SysUserService {
@Autowired
private SysUserDao sysUserDao;
@Override
public SysUser selectByUsername(String account) {
QueryWrapper queryWrapper = new QueryWrapper();
queryWrapper.eq("account", account);
return sysUserDao.selectOne(queryWrapper);
}
@Override
public Map<String, Object> getUserRoleByAccount(String account) {
Set<String> roleSet = new HashSet<>();
Set<String> roleMenuSet = new HashSet<>();
//查询用户拥有的角色
List<Map> list = sysUserDao.getUserRoleByAccount(account);
if (list.size() > 0 && list != null) {
for (Map map : list) {
roleSet.add(map.get("roleName").toString());
roleSet.add(map.get("roleId").toString());
roleMenuSet.add(map.get("menuId").toString());
roleMenuSet.add(map.get("menuName").toString());
roleMenuSet.add(map.get("parentId").toString());
roleMenuSet.add(map.get("url").toString());
}
}
Map<String, Object> userInfo = new HashMap<>();
userInfo.put("roleSet", roleSet);
userInfo.put("roleMenuSet", roleMenuSet);
return userInfo;
}
}
\ No newline at end of file
/*
package com.ma.demo.config.shiroConfig;
import at.pollux.thymeleaf.shiro.dialect.ShiroDialect;
import org.apache.commons.lang3.StringUtils;
import org.apache.shiro.authc.credential.HashedCredentialsMatcher;
import org.apache.shiro.cache.MemoryConstrainedCacheManager;
import org.apache.shiro.codec.Base64;
import org.apache.shiro.session.mgt.eis.EnterpriseCacheSessionDAO;
import org.apache.shiro.spring.web.ShiroFilterFactoryBean;
import org.apache.shiro.web.mgt.CookieRememberMeManager;
import org.apache.shiro.web.mgt.DefaultWebSecurityManager;
import org.apache.shiro.web.servlet.SimpleCookie;
import org.apache.shiro.web.session.mgt.DefaultWebSessionManager;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.apache.shiro.mgt.SecurityManager;
import java.util.LinkedHashMap;
@Configuration
public class ShiroConfig {
*/
/**
* 部分配置文件,详细见application.yml
*//*
@Autowired
private ShiroProperties shiroProperties;
*/
/**
* shiro的拦截器
**//*
@Bean
public ShiroFilterFactoryBean shiroFilterFactoryBean(SecurityManager securityManager) {
ShiroFilterFactoryBean shiroFilterFactoryBean = new ShiroFilterFactoryBean();
// 设置 securityManager
shiroFilterFactoryBean.setSecurityManager(securityManager);
// 登录的 url
shiroFilterFactoryBean.setLoginUrl(shiroProperties.getLoginUrl());
// 登录成功后跳转的 url
shiroFilterFactoryBean.setSuccessUrl(shiroProperties.getSuccessUrl());
// 未授权 url
shiroFilterFactoryBean.setUnauthorizedUrl(shiroProperties.getUnauthorizedUrl());
// 这里配置授权链,跟mvc的xml配置一样
LinkedHashMap<String, String> filterChainDefinitionMap = new LinkedHashMap();
// 设置免认证 url
String[] anonUrls = StringUtils.splitByWholeSeparatorPreserveAllTokens(shiroProperties.getAnonUrl(), ",");
for (String url : anonUrls) {
filterChainDefinitionMap.put(url, "anon");
}
// 配置退出过滤器,其中具体的退出代码 Shiro已经替我们实现了
//filterChainDefinitionMap.put(shiroProperties.getLogoutUrl(), "logout");
// 除上以外所有 url都必须认证通过才可以访问,未通过认证自动访问 LoginUrl
filterChainDefinitionMap.put("/**", "authc");
shiroFilterFactoryBean.setFilterChainDefinitionMap(filterChainDefinitionMap);
return shiroFilterFactoryBean;
}
*/
/**
* 配置各种安全事务管理器
**//*
@Bean("securityManager")
public SecurityManager securityManager(@Qualifier("myShiroRealm") MyShiroRealm myShiroRealm) {
System.err.println("----------- shiro加载 -----------");
DefaultWebSecurityManager manager = new DefaultWebSecurityManager();
manager.setRealm(myShiroRealm);
return manager;
}
*/
/*
* 配置自定义的权限登录
* *//*
@Bean("myShiroRealm")
public MyShiroRealm myShiroRealm(@Qualifier("credentialsMatcher") CredentialMatcher matcher) {
MyShiroRealm authRealm = new MyShiroRealm();
authRealm.setCacheManager(new MemoryConstrainedCacheManager());
authRealm.setCredentialsMatcher(matcher);
return authRealm;
}
*/
/**
* 生成一个ShiroRedisCacheManager
**//*
*/
/* private ShiroRedisCacheManager cacheManager(RedisTemplate template){
return new ShiroRedisCacheManager(template);
}*//*
*/
/**
* 这是我自己的realm 我自定义了一个密码解析器
*//*
*/
/* @Bean
@DependsOn({"hashedCredentialsMatcher"})
public ShiroRealm shiroRealm(HashedCredentialsMatcher matcher, SysUserService userService) {
// 配置 Realm,需自己实现
return new ShiroRealm(matcher,userService);
}*//*
*/
/*
* 配置自定义的密码比较器
* *//*
@Bean(name = "credentialsMatcher")
public CredentialMatcher credentialsMatcher() {
return new CredentialMatcher();
}
*/
/**
* 密码解析器 有好几种,我这是MD5 1024次加密
* @return
*//*
@Bean
public HashedCredentialsMatcher createMatcher(){
HashedCredentialsMatcher matcher = new HashedCredentialsMatcher("MD5");
matcher.setHashIterations(2);//散列次数
return matcher;
}
*/
/**
* rememberMe cookie 效果是重开浏览器后无需重新登录
*//*
@Bean
public SimpleCookie rememberMeCookie() {
//这个参数是cookie的名称,对应前端的checkbox的name = rememberMe
// 这里的Cookie的默认名称是 CookieRememberMeManager.DEFAULT_REMEMBER_ME_COOKIE_NAME
SimpleCookie cookie = new SimpleCookie(CookieRememberMeManager.DEFAULT_REMEMBER_ME_COOKIE_NAME);
// 是否只在https情况下传输
cookie.setSecure(false);
// 设置 cookie 的过期时间,单位为秒,这里为一天
cookie.setMaxAge(shiroProperties.getCookieTimeout());
return cookie;
}
*/
/**
* cookie管理对象,;记住我功能
*//*
@Bean
public CookieRememberMeManager rememberMeManager() {
CookieRememberMeManager cookieRememberMeManager = new CookieRememberMeManager();
cookieRememberMeManager.setCookie(rememberMeCookie());
// cookieRememberMeManager.setCipherKey用来设置加密的Key,参数类型byte[],字节数组长度要求16
// rememberMe cookie 加密的密钥
cookieRememberMeManager.setCipherKey(Base64.decode("ZWvohmPdUsAWT3=KpPqda"));
return cookieRememberMeManager;
}
*/
/**
* 用于开启 Thymeleaf 中的 shiro 标签的使用
*//*
@Bean
public ShiroDialect shiroDialect() {
return new ShiroDialect();
}
*/
/**
* session 管理对象
*//*
@Bean(name = "sessionManager")
public DefaultWebSessionManager sessionManager() {
DefaultWebSessionManager sessionManager = new DefaultWebSessionManager();
// 设置session超时时间,单位为毫秒
sessionManager.setGlobalSessionTimeout(shiroProperties.getSessionTimeout());
sessionManager.setSessionIdCookie(new SimpleCookie(shiroProperties.getSessionIdName()));
// 网上各种说要自定义sessionDAO 其实完全不必要,shiro自己就自定义了一个,可以直接使用,还有其他的DAO,自行查看源码即可
sessionManager.setSessionDAO(new EnterpriseCacheSessionDAO());
return sessionManager;
}
}
*/
<?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.jz.manage.admin.dao.SysMenuDao">
<resultMap type="com.jz.manage.admin.entity.sys.SysMenu" id="SysMenuMap">
<result property="menuId" column="menu_id" jdbcType="INTEGER"/>
<result property="menuName" column="menu_name" jdbcType="VARCHAR"/>
<result property="url" column="url" jdbcType="VARCHAR"/>
<result property="parentId" column="parent_id" jdbcType="INTEGER"/>
<result property="ifChild" column="if_child" jdbcType="VARCHAR"/>
<result property="creTime" column="cre_time" jdbcType="TIMESTAMP"/>
<result property="crePerson" column="cre_person" jdbcType="INTEGER"/>
<result property="delFlag" column="del_flag" jdbcType="VARCHAR"/>
</resultMap>
<!--查询单个-->
<select id="queryById" resultMap="SysMenuMap">
select
menu_id, menu_name, url, parent_id, if_child, cre_time, cre_person, del_flag
from jz-dm-project.t_sys_menu
where menu_id = #{menuId}
</select>
<!--查询指定行数据-->
<select id="queryAllByLimit" resultMap="SysMenuMap">
select
menu_id, menu_name, url, parent_id, if_child, cre_time, cre_person, del_flag
from jz-dm-project.t_sys_menu
limit #{offset}, #{limit}
</select>
<!--通过实体作为筛选条件查询-->
<select id="queryAll" resultMap="SysMenuMap">
select
menu_id, menu_name, url, parent_id, if_child, cre_time, cre_person, del_flag
from jz-dm-project.t_sys_menu
<where>
<if test="menuId != null">
and menu_id = #{menuId}
</if>
<if test="menuName != null and menuName != ''">
and menu_name = #{menuName}
</if>
<if test="url != null and url != ''">
and url = #{url}
</if>
<if test="parentId != null">
and parent_id = #{parentId}
</if>
<if test="ifChild != null and ifChild != ''">
and if_child = #{ifChild}
</if>
<if test="creTime != null">
and cre_time = #{creTime}
</if>
<if test="crePerson != null">
and cre_person = #{crePerson}
</if>
<if test="delFlag != null and delFlag != ''">
and del_flag = #{delFlag}
</if>
</where>
</select>
<!--新增所有列-->
<insert id="insert" keyProperty="menuId" useGeneratedKeys="true">
insert into jz-dm-project.t_sys_menu(menu_name, url, parent_id, if_child, cre_time, cre_person, del_flag)
values (#{menuName}, #{url}, #{parentId}, #{ifChild}, #{creTime}, #{crePerson}, #{delFlag})
</insert>
<insert id="insertBatch" keyProperty="menuId" useGeneratedKeys="true">
insert into jz-dm-project.t_sys_menu(menu_name, url, parent_id, if_child, cre_time, cre_person, del_flag)
values
<foreach collection="entities" item="entity" separator=",">
(#{entity.menuName}, #{entity.url}, #{entity.parentId}, #{entity.ifChild}, #{entity.creTime},
#{entity.crePerson}, #{entity.delFlag})
</foreach>
</insert>
<!--通过主键修改数据-->
<update id="update">
update jz-dm-project.t_sys_menu
<set>
<if test="menuName != null and menuName != ''">
menu_name = #{menuName},
</if>
<if test="url != null and url != ''">
url = #{url},
</if>
<if test="parentId != null">
parent_id = #{parentId},
</if>
<if test="ifChild != null and ifChild != ''">
if_child = #{ifChild},
</if>
<if test="creTime != null">
cre_time = #{creTime},
</if>
<if test="crePerson != null">
cre_person = #{crePerson},
</if>
<if test="delFlag != null and delFlag != ''">
del_flag = #{delFlag},
</if>
</set>
where menu_id = #{menuId}
</update>
<!--通过主键删除-->
<delete id="deleteById">
delete from jz-dm-project.t_sys_menu where menu_id = #{menuId}
</delete>
</mapper>
\ No newline at end of file
<?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.jz.manage.admin.dao.SysOrgDao">
<resultMap type="com.jz.manage.admin.entity.sys.SysOrg" id="SysOrgMap">
<result property="orgId" column="org_id" jdbcType="INTEGER"/>
<result property="orgName" column="org_name" jdbcType="VARCHAR"/>
<result property="parentOrgId" column="parent_org_id" jdbcType="INTEGER"/>
<result property="ifChild" column="if_child" jdbcType="VARCHAR"/>
<result property="creTime" column="cre_time" jdbcType="TIMESTAMP"/>
<result property="crePerson" column="cre_person" jdbcType="VARCHAR"/>
<result property="uptPerson" column="upt_person" jdbcType="VARCHAR"/>
<result property="uptTime" column="upt_time" jdbcType="TIMESTAMP"/>
<result property="delFlag" column="del_flag" jdbcType="VARCHAR"/>
</resultMap>
<!--查询单个-->
<select id="queryById" resultMap="SysOrgMap">
select
org_id, org_name, parent_org_id, if_child, cre_time, cre_person, upt_person, upt_time, del_flag
from jz-dm-project.t_sys_org
where org_id = #{orgId}
</select>
<!--查询指定行数据-->
<select id="queryAllByLimit" resultMap="SysOrgMap">
select
org_id, org_name, parent_org_id, if_child, cre_time, cre_person, upt_person, upt_time, del_flag
from jz-dm-project.t_sys_org
limit #{offset}, #{limit}
</select>
<!--通过实体作为筛选条件查询-->
<select id="queryAll" resultMap="SysOrgMap">
select
org_id, org_name, parent_org_id, if_child, cre_time, cre_person, upt_person, upt_time, del_flag
from jz-dm-project.t_sys_org
<where>
<if test="orgId != null">
and org_id = #{orgId}
</if>
<if test="orgName != null and orgName != ''">
and org_name = #{orgName}
</if>
<if test="parentOrgId != null">
and parent_org_id = #{parentOrgId}
</if>
<if test="ifChild != null and ifChild != ''">
and if_child = #{ifChild}
</if>
<if test="creTime != null">
and cre_time = #{creTime}
</if>
<if test="crePerson != null and crePerson != ''">
and cre_person = #{crePerson}
</if>
<if test="uptPerson != null and uptPerson != ''">
and upt_person = #{uptPerson}
</if>
<if test="uptTime != null">
and upt_time = #{uptTime}
</if>
<if test="delFlag != null and delFlag != ''">
and del_flag = #{delFlag}
</if>
</where>
</select>
<!--新增所有列-->
<insert id="insert" keyProperty="orgId" useGeneratedKeys="true">
insert into jz-dm-project.t_sys_org(org_name, parent_org_id, if_child, cre_time, cre_person, upt_person, upt_time, del_flag)
values (#{orgName}, #{parentOrgId}, #{ifChild}, #{creTime}, #{crePerson}, #{uptPerson}, #{uptTime}, #{delFlag})
</insert>
<insert id="insertBatch" keyProperty="orgId" useGeneratedKeys="true">
insert into jz-dm-project.t_sys_org(org_name, parent_org_id, if_child, cre_time, cre_person, upt_person,
upt_time, del_flag)
values
<foreach collection="entities" item="entity" separator=",">
(#{entity.orgName}, #{entity.parentOrgId}, #{entity.ifChild}, #{entity.creTime}, #{entity.crePerson},
#{entity.uptPerson}, #{entity.uptTime}, #{entity.delFlag})
</foreach>
</insert>
<!--通过主键修改数据-->
<update id="update">
update jz-dm-project.t_sys_org
<set>
<if test="orgName != null and orgName != ''">
org_name = #{orgName},
</if>
<if test="parentOrgId != null">
parent_org_id = #{parentOrgId},
</if>
<if test="ifChild != null and ifChild != ''">
if_child = #{ifChild},
</if>
<if test="creTime != null">
cre_time = #{creTime},
</if>
<if test="crePerson != null and crePerson != ''">
cre_person = #{crePerson},
</if>
<if test="uptPerson != null and uptPerson != ''">
upt_person = #{uptPerson},
</if>
<if test="uptTime != null">
upt_time = #{uptTime},
</if>
<if test="delFlag != null and delFlag != ''">
del_flag = #{delFlag},
</if>
</set>
where org_id = #{orgId}
</update>
<!--通过主键删除-->
<delete id="deleteById">
delete from jz-dm-project.t_sys_org where org_id = #{orgId}
</delete>
</mapper>
\ No newline at end of file
<?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.jz.manage.admin.dao.SysRoleDao">
<resultMap type="com.jz.manage.admin.entity.sys.SysRole" id="SysRoleMap">
<result property="roleId" column="role_id" jdbcType="INTEGER"/>
<result property="roleName" column="role_name" jdbcType="VARCHAR"/>
<result property="creTime" column="cre_time" jdbcType="TIMESTAMP"/>
<result property="crePerson" column="cre_person" jdbcType="VARCHAR"/>
<result property="uptTime" column="upt_time" jdbcType="TIMESTAMP"/>
<result property="uptPerson" column="upt_person" jdbcType="VARCHAR"/>
<result property="delFlag" column="del_flag" jdbcType="VARCHAR"/>
</resultMap>
<!--查询单个-->
<select id="queryById" resultMap="SysRoleMap">
select
role_id, role_name, cre_time, cre_person, upt_time, upt_person, del_flag
from jz-dm-project.t_sys_role
where role_id = #{roleId}
</select>
<!--查询指定行数据-->
<select id="queryAllByLimit" resultMap="SysRoleMap">
select
role_id, role_name, cre_time, cre_person, upt_time, upt_person, del_flag
from jz-dm-project.t_sys_role
limit #{offset}, #{limit}
</select>
<!--通过实体作为筛选条件查询-->
<select id="queryAll" resultMap="SysRoleMap">
select
role_id, role_name, cre_time, cre_person, upt_time, upt_person, del_flag
from jz-dm-project.t_sys_role
<where>
<if test="roleId != null">
and role_id = #{roleId}
</if>
<if test="roleName != null and roleName != ''">
and role_name = #{roleName}
</if>
<if test="creTime != null">
and cre_time = #{creTime}
</if>
<if test="crePerson != null and crePerson != ''">
and cre_person = #{crePerson}
</if>
<if test="uptTime != null">
and upt_time = #{uptTime}
</if>
<if test="uptPerson != null and uptPerson != ''">
and upt_person = #{uptPerson}
</if>
<if test="delFlag != null and delFlag != ''">
and del_flag = #{delFlag}
</if>
</where>
</select>
<!--新增所有列-->
<insert id="insert" keyProperty="roleId" useGeneratedKeys="true">
insert into jz-dm-project.t_sys_role(role_name, cre_time, cre_person, upt_time, upt_person, del_flag)
values (#{roleName}, #{creTime}, #{crePerson}, #{uptTime}, #{uptPerson}, #{delFlag})
</insert>
<insert id="insertBatch" keyProperty="roleId" useGeneratedKeys="true">
insert into jz-dm-project.t_sys_role(role_name, cre_time, cre_person, upt_time, upt_person, del_flag)
values
<foreach collection="entities" item="entity" separator=",">
(#{entity.roleName}, #{entity.creTime}, #{entity.crePerson}, #{entity.uptTime}, #{entity.uptPerson},
#{entity.delFlag})
</foreach>
</insert>
<!--通过主键修改数据-->
<update id="update">
update jz-dm-project.t_sys_role
<set>
<if test="roleName != null and roleName != ''">
role_name = #{roleName},
</if>
<if test="creTime != null">
cre_time = #{creTime},
</if>
<if test="crePerson != null and crePerson != ''">
cre_person = #{crePerson},
</if>
<if test="uptTime != null">
upt_time = #{uptTime},
</if>
<if test="uptPerson != null and uptPerson != ''">
upt_person = #{uptPerson},
</if>
<if test="delFlag != null and delFlag != ''">
del_flag = #{delFlag},
</if>
</set>
where role_id = #{roleId}
</update>
<!--通过主键删除-->
<delete id="deleteById">
delete from jz-dm-project.t_sys_role where role_id = #{roleId}
</delete>
</mapper>
\ No newline at end of file
<?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.jz.manage.admin.dao.SysRoleMenuDao">
<resultMap type="com.jz.manage.admin.entity.sys.SysRoleMenu" id="SysRoleMenuMap">
<result property="roleMenuId" column="role_menu_id" jdbcType="INTEGER"/>
<result property="roleId" column="role_id" jdbcType="INTEGER"/>
<result property="menuId" column="menu_id" jdbcType="INTEGER"/>
</resultMap>
<!--查询单个-->
<select id="queryById" resultMap="SysRoleMenuMap">
select
role_menu_id, role_id, menu_id
from jz-dm-project.t_sys_role_menu
where role_menu_id = #{roleMenuId}
</select>
<!--查询指定行数据-->
<select id="queryAllByLimit" resultMap="SysRoleMenuMap">
select
role_menu_id, role_id, menu_id
from jz-dm-project.t_sys_role_menu
limit #{offset}, #{limit}
</select>
<!--通过实体作为筛选条件查询-->
<select id="queryAll" resultMap="SysRoleMenuMap">
select
role_menu_id, role_id, menu_id
from jz-dm-project.t_sys_role_menu
<where>
<if test="roleMenuId != null">
and role_menu_id = #{roleMenuId}
</if>
<if test="roleId != null">
and role_id = #{roleId}
</if>
<if test="menuId != null">
and menu_id = #{menuId}
</if>
</where>
</select>
<!--新增所有列-->
<insert id="insert" keyProperty="roleMenuId" useGeneratedKeys="true">
insert into jz-dm-project.t_sys_role_menu(role_id, menu_id)
values (#{roleId}, #{menuId})
</insert>
<insert id="insertBatch" keyProperty="roleMenuId" useGeneratedKeys="true">
insert into jz-dm-project.t_sys_role_menu(role_id, menu_id)
values
<foreach collection="entities" item="entity" separator=",">
(#{entity.roleId}, #{entity.menuId})
</foreach>
</insert>
<!--通过主键修改数据-->
<update id="update">
update jz-dm-project.t_sys_role_menu
<set>
<if test="roleId != null">
role_id = #{roleId},
</if>
<if test="menuId != null">
menu_id = #{menuId},
</if>
</set>
where role_menu_id = #{roleMenuId}
</update>
<!--通过主键删除-->
<delete id="deleteById">
delete from jz-dm-project.t_sys_role_menu where role_menu_id = #{roleMenuId}
</delete>
</mapper>
\ No newline at end of file
<?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.jz.manage.admin.dao.SysUserDao">
<resultMap type="com.jz.manage.admin.entity.sys.SysUser" id="SysUserMap">
<result property="userId" column="user_id" jdbcType="INTEGER"/>
<result property="orgId" column="org_id" jdbcType="INTEGER"/>
<result property="userName" column="user_name" jdbcType="VARCHAR"/>
<result property="account" column="account" jdbcType="VARCHAR"/>
<result property="password" column="password" jdbcType="VARCHAR"/>
<result property="supplierCode" column="supplier_code" jdbcType="VARCHAR"/>
<result property="supplierName" column="supplier_name" jdbcType="VARCHAR"/>
<result property="telephone" column="telephone" jdbcType="VARCHAR"/>
<result property="creTime" column="cre_time" jdbcType="TIMESTAMP"/>
<result property="delFlag" column="del_flag" jdbcType="VARCHAR"/>
</resultMap>
<!--查询单个-->
<select id="queryById" resultMap="SysUserMap">
select
user_id, org_id, user_name, account, password, supplier_code, supplier_name, telephone, cre_time, del_flag
from jz-dm-project.t_sys_user
where user_id = #{userId}
</select>
<!--查询指定行数据-->
<select id="queryAllByLimit" resultMap="SysUserMap">
select
user_id, org_id, user_name, account, password, supplier_code, supplier_name, telephone, cre_time, del_flag
from jz-dm-project.t_sys_user
limit #{offset}, #{limit}
</select>
<!--通过实体作为筛选条件查询-->
<select id="queryAll" resultMap="SysUserMap">
select
user_id, org_id, user_name, account, password, supplier_code, supplier_name, telephone, cre_time, del_flag
from jz-dm-project.t_sys_user
<where>
<if test="userId != null">
and user_id = #{userId}
</if>
<if test="orgId != null">
and org_id = #{orgId}
</if>
<if test="userName != null and userName != ''">
and user_name = #{userName}
</if>
<if test="account != null and account != ''">
and account = #{account}
</if>
<if test="password != null and password != ''">
and password = #{password}
</if>
<if test="supplierCode != null and supplierCode != ''">
and supplier_code = #{supplierCode}
</if>
<if test="supplierName != null and supplierName != ''">
and supplier_name = #{supplierName}
</if>
<if test="telephone != null and telephone != ''">
and telephone = #{telephone}
</if>
<if test="creTime != null">
and cre_time = #{creTime}
</if>
<if test="delFlag != null and delFlag != ''">
and del_flag = #{delFlag}
</if>
</where>
</select>
<!--新增所有列-->
<insert id="insert" keyProperty="userId" useGeneratedKeys="true">
insert into jz-dm-project.t_sys_user(org_id, user_name, account, password, supplier_code, supplier_name, telephone, cre_time, del_flag)
values (#{orgId}, #{userName}, #{account}, #{password}, #{supplierCode}, #{supplierName}, #{telephone}, #{creTime}, #{delFlag})
</insert>
<insert id="insertBatch" keyProperty="userId" useGeneratedKeys="true">
insert into jz-dm-project.t_sys_user(org_id, user_name, account, password, supplier_code, supplier_name,
telephone, cre_time, del_flag)
values
<foreach collection="entities" item="entity" separator=",">
(#{entity.orgId}, #{entity.userName}, #{entity.account}, #{entity.password}, #{entity.supplierCode},
#{entity.supplierName}, #{entity.telephone}, #{entity.creTime}, #{entity.delFlag})
</foreach>
</insert>
<!--通过主键修改数据-->
<update id="update">
update jz-dm-project.t_sys_user
<set>
<if test="orgId != null">
org_id = #{orgId},
</if>
<if test="userName != null and userName != ''">
user_name = #{userName},
</if>
<if test="account != null and account != ''">
account = #{account},
</if>
<if test="password != null and password != ''">
password = #{password},
</if>
<if test="supplierCode != null and supplierCode != ''">
supplier_code = #{supplierCode},
</if>
<if test="supplierName != null and supplierName != ''">
supplier_name = #{supplierName},
</if>
<if test="telephone != null and telephone != ''">
telephone = #{telephone},
</if>
<if test="creTime != null">
cre_time = #{creTime},
</if>
<if test="delFlag != null and delFlag != ''">
del_flag = #{delFlag},
</if>
</set>
where user_id = #{userId}
</update>
<!--通过主键删除-->
<delete id="deleteById">
delete from jz-dm-project.t_sys_user where user_id = #{userId}
</delete>
<select id="getUserRoleByAccount" resultType="map">
select
a.user_id as userId
,a.user_name as userName
,a.password
,a.account
,a.org_id as orgId
,a.telephone
,c.role_name as roleName
,c.role_id as roleId
,e.menu_id as menuId
,e.menu_name as menuName
,e.parent_id as parentId
,e.url
from t_sys_user a
inner join t_sys_user_role b on a.user_id=b.user_id
inner join t_sys_role c on c.role_id=b.role_id
inner join t_sys_role_menu d on d.role_id=c.role_id
inner join t_sys_menu e on e.menu_id=d.menu_id
where a.account=#{account}
</select>
</mapper>
\ No newline at end of file
<?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.jz.manage.admin.dao.SysUserRoleDao">
<resultMap type="com.jz.manage.admin.entity.sys.SysUserRole" id="SysUserRoleMap">
<result property="userRoleId" column="user_role_id" jdbcType="INTEGER"/>
<result property="userId" column="user_id" jdbcType="INTEGER"/>
<result property="roleId" column="role_id" jdbcType="INTEGER"/>
</resultMap>
<!--查询单个-->
<select id="queryById" resultMap="SysUserRoleMap">
select
user_role_id, user_id, role_id
from jz-dm-project.t_sys_user_role
where user_role_id = #{userRoleId}
</select>
<!--查询指定行数据-->
<select id="queryAllByLimit" resultMap="SysUserRoleMap">
select
user_role_id, user_id, role_id
from jz-dm-project.t_sys_user_role
limit #{offset}, #{limit}
</select>
<!--通过实体作为筛选条件查询-->
<select id="queryAll" resultMap="SysUserRoleMap">
select
user_role_id, user_id, role_id
from jz-dm-project.t_sys_user_role
<where>
<if test="userRoleId != null">
and user_role_id = #{userRoleId}
</if>
<if test="userId != null">
and user_id = #{userId}
</if>
<if test="roleId != null">
and role_id = #{roleId}
</if>
</where>
</select>
<!--新增所有列-->
<insert id="insert" keyProperty="userRoleId" useGeneratedKeys="true">
insert into jz-dm-project.t_sys_user_role(user_id, role_id)
values (#{userId}, #{roleId})
</insert>
<insert id="insertBatch" keyProperty="userRoleId" useGeneratedKeys="true">
insert into jz-dm-project.t_sys_user_role(user_id, role_id)
values
<foreach collection="entities" item="entity" separator=",">
(#{entity.userId}, #{entity.roleId})
</foreach>
</insert>
<!--通过主键修改数据-->
<update id="update">
update jz-dm-project.t_sys_user_role
<set>
<if test="userId != null">
user_id = #{userId},
</if>
<if test="roleId != null">
role_id = #{roleId},
</if>
</set>
where user_role_id = #{userRoleId}
</update>
<!--通过主键删除-->
<delete id="deleteById">
delete from jz-dm-project.t_sys_user_role where user_role_id = #{userRoleId}
</delete>
</mapper>
\ No newline at end of file
<?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.jz.manage.admin.dao.TestMapper" >
<select id="queryListPage" resultType="map">
select * from tb_user where 1=1
</select>
</mapper>
\ No newline at end of file
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