feat[litemall-admin, litemall-admin-api, litemall-db]: 支持权限管理
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
package org.linlinjava.litemall.admin.annotation;
|
||||
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
@Target({ElementType.TYPE, ElementType.METHOD})
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
public @interface RequiresPermissionsDesc {
|
||||
String[] menu();
|
||||
String button();
|
||||
}
|
||||
@@ -10,6 +10,8 @@ import org.apache.shiro.subject.PrincipalCollection;
|
||||
import org.linlinjava.litemall.core.util.bcrypt.BCryptPasswordEncoder;
|
||||
import org.linlinjava.litemall.db.domain.LitemallAdmin;
|
||||
import org.linlinjava.litemall.db.service.LitemallAdminService;
|
||||
import org.linlinjava.litemall.db.service.LitemallPermissionService;
|
||||
import org.linlinjava.litemall.db.service.LitemallRoleService;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -17,12 +19,17 @@ import org.springframework.util.Assert;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
public class AdminAuthorizingRealm extends AuthorizingRealm {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(AdminAuthorizingRealm.class);
|
||||
@Autowired
|
||||
private LitemallAdminService adminService;
|
||||
@Autowired
|
||||
private LitemallRoleService roleService;
|
||||
@Autowired
|
||||
private LitemallPermissionService permissionService;
|
||||
|
||||
@Override
|
||||
protected AuthorizationInfo doGetAuthorizationInfo(PrincipalCollection principals) {
|
||||
@@ -30,9 +37,13 @@ public class AdminAuthorizingRealm extends AuthorizingRealm {
|
||||
throw new AuthorizationException("PrincipalCollection method argument cannot be null.");
|
||||
}
|
||||
|
||||
LitemallAdmin admin = (LitemallAdmin) getAvailablePrincipal(principals);
|
||||
Integer[] roleIds = admin.getRoleIds();
|
||||
Set<String> roles = roleService.queryByIds(roleIds);
|
||||
Set<String> permissions = permissionService.queryByRoleIds(roleIds);
|
||||
SimpleAuthorizationInfo info = new SimpleAuthorizationInfo();
|
||||
info.addRole("admin");
|
||||
info.addStringPermission("*");
|
||||
info.setRoles(roles);
|
||||
info.setStringPermissions(permissions);
|
||||
return info;
|
||||
}
|
||||
|
||||
|
||||
@@ -17,5 +17,6 @@ public class AdminResponseCode {
|
||||
public static final Integer USER_INVALID_MOBILE = 632;
|
||||
public static final Integer USER_NAME_EXIST = 633;
|
||||
public static final Integer USER_MOBILE_EXIST = 634;
|
||||
|
||||
public static final Integer ROLE_NAME_EXIST = 640;
|
||||
public static final Integer ROLE_SUPER_SUPERMISSION = 641;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
package org.linlinjava.litemall.admin.util;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class PermVo {
|
||||
private String id;
|
||||
private String label;
|
||||
private List<PermVo> children;
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getLabel() {
|
||||
return label;
|
||||
}
|
||||
|
||||
public void setLabel(String label) {
|
||||
this.label = label;
|
||||
}
|
||||
|
||||
public List<PermVo> getChildren() {
|
||||
return children;
|
||||
}
|
||||
|
||||
public void setChildren(List<PermVo> children) {
|
||||
this.children = children;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,92 @@
|
||||
package org.linlinjava.litemall.admin.util;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.commons.lang3.reflect.MethodUtils;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.linlinjava.litemall.admin.annotation.RequiresPermissionsDesc;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.core.annotation.AnnotationUtils;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.util.ClassUtils;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class PermissionUtil {
|
||||
|
||||
public static Map<RequiresPermissions, RequiresPermissionsDesc> findPermissions(ApplicationContext context, String basicPackage) {
|
||||
Map<String, Object> map = context.getBeansWithAnnotation(Controller.class);
|
||||
Map<RequiresPermissions, RequiresPermissionsDesc> permissions = new HashMap<>();
|
||||
for(Map.Entry<String, Object> entry : map.entrySet()){
|
||||
Object bean = entry.getValue();
|
||||
if(!StringUtils.contains(ClassUtils.getPackageName(bean.getClass()), basicPackage)){
|
||||
continue;
|
||||
}
|
||||
|
||||
Class<?> clz = bean.getClass();
|
||||
Class controllerClz = clz.getSuperclass();
|
||||
List<Method> methods = MethodUtils.getMethodsListWithAnnotation(controllerClz, RequiresPermissions.class);
|
||||
for(Method method : methods){
|
||||
RequiresPermissions requiresPermissions = AnnotationUtils.getAnnotation(method, RequiresPermissions.class);
|
||||
RequiresPermissionsDesc requiresPermissionsDesc = AnnotationUtils.getAnnotation(method, RequiresPermissionsDesc.class);
|
||||
if(requiresPermissions == null || requiresPermissionsDesc == null){
|
||||
continue;
|
||||
}
|
||||
permissions.put(requiresPermissions, requiresPermissionsDesc);
|
||||
}
|
||||
}
|
||||
return permissions;
|
||||
}
|
||||
|
||||
public static List<PermVo> listPermissions(ApplicationContext context, String basicPackage) {
|
||||
List<PermVo> root = new ArrayList<>();
|
||||
Map<RequiresPermissions, RequiresPermissionsDesc> map = findPermissions(context, basicPackage);
|
||||
for(Map.Entry<RequiresPermissions, RequiresPermissionsDesc> entry : map.entrySet()) {
|
||||
RequiresPermissions requiresPermissions = entry.getKey();
|
||||
RequiresPermissionsDesc requiresPermissionsDesc = entry.getValue();
|
||||
|
||||
String[] menus = requiresPermissionsDesc.menu();
|
||||
if(menus.length != 2){
|
||||
throw new RuntimeException("目前只支持两级菜单");
|
||||
}
|
||||
String menu1 = menus[0];
|
||||
PermVo perm1 = null;
|
||||
for(PermVo permVo : root){
|
||||
if(permVo.getLabel().equals(menu1)){
|
||||
perm1 = permVo;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(perm1 == null){
|
||||
perm1 = new PermVo();
|
||||
perm1.setId(menu1);
|
||||
perm1.setLabel(menu1);
|
||||
perm1.setChildren(new ArrayList<>());
|
||||
root.add(perm1);
|
||||
}
|
||||
String menu2 = menus[1];
|
||||
PermVo perm2 = null;
|
||||
for(PermVo permVo : perm1.getChildren()){
|
||||
if(permVo.getLabel().equals(menu2)){
|
||||
perm2 = permVo;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(perm2 == null){
|
||||
perm2 = new PermVo();
|
||||
perm2.setId(menu2);
|
||||
perm2.setLabel(menu2);
|
||||
perm2.setChildren(new ArrayList<>());
|
||||
perm1.getChildren().add(perm2);
|
||||
}
|
||||
|
||||
PermVo leftPerm = new PermVo();
|
||||
leftPerm.setId(requiresPermissions.value()[0]);
|
||||
leftPerm.setLabel(requiresPermissionsDesc.button());
|
||||
|
||||
perm2.getChildren().add(leftPerm);
|
||||
}
|
||||
return root;
|
||||
}
|
||||
}
|
||||
@@ -3,6 +3,7 @@ package org.linlinjava.litemall.admin.web;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.linlinjava.litemall.admin.annotation.RequiresPermissionsDesc;
|
||||
import org.linlinjava.litemall.core.util.ResponseUtil;
|
||||
import org.linlinjava.litemall.core.validator.Order;
|
||||
import org.linlinjava.litemall.core.validator.Sort;
|
||||
@@ -28,6 +29,7 @@ public class AdminAdController {
|
||||
private LitemallAdService adService;
|
||||
|
||||
@RequiresPermissions("admin:ad:list")
|
||||
@RequiresPermissionsDesc(menu={"推广管理" , "广告管理"}, button="查询")
|
||||
@RequestMapping("/list")
|
||||
public Object list(String name, String content,
|
||||
@RequestParam(defaultValue = "1") Integer page,
|
||||
@@ -56,6 +58,7 @@ public class AdminAdController {
|
||||
}
|
||||
|
||||
@RequiresPermissions("admin:ad:create")
|
||||
@RequiresPermissionsDesc(menu={"推广管理" , "广告管理"}, button="添加")
|
||||
@PostMapping("/create")
|
||||
public Object create(@RequestBody LitemallAd ad) {
|
||||
Object error = validate(ad);
|
||||
@@ -67,6 +70,7 @@ public class AdminAdController {
|
||||
}
|
||||
|
||||
@RequiresPermissions("admin:ad:read")
|
||||
@RequiresPermissionsDesc(menu={"推广管理" , "广告管理"}, button="详情")
|
||||
@GetMapping("/read")
|
||||
public Object read(@NotNull Integer id) {
|
||||
LitemallAd brand = adService.findById(id);
|
||||
@@ -74,6 +78,7 @@ public class AdminAdController {
|
||||
}
|
||||
|
||||
@RequiresPermissions("admin:ad:update")
|
||||
@RequiresPermissionsDesc(menu={"推广管理" , "广告管理"}, button="编辑")
|
||||
@PostMapping("/update")
|
||||
public Object update(@RequestBody LitemallAd ad) {
|
||||
Object error = validate(ad);
|
||||
@@ -88,6 +93,7 @@ public class AdminAdController {
|
||||
}
|
||||
|
||||
@RequiresPermissions("admin:ad:delete")
|
||||
@RequiresPermissionsDesc(menu={"推广管理" , "广告管理"}, button="删除")
|
||||
@PostMapping("/delete")
|
||||
public Object delete(@RequestBody LitemallAd ad) {
|
||||
Integer id = ad.getId();
|
||||
|
||||
@@ -3,6 +3,7 @@ package org.linlinjava.litemall.admin.web;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.linlinjava.litemall.admin.annotation.RequiresPermissionsDesc;
|
||||
import org.linlinjava.litemall.core.util.RegexUtil;
|
||||
import org.linlinjava.litemall.core.util.ResponseUtil;
|
||||
import org.linlinjava.litemall.core.util.bcrypt.BCryptPasswordEncoder;
|
||||
@@ -32,6 +33,7 @@ public class AdminAdminController {
|
||||
private LitemallAdminService adminService;
|
||||
|
||||
@RequiresPermissions("admin:admin:list")
|
||||
@RequiresPermissionsDesc(menu={"系统管理" , "管理员管理"}, button="查询")
|
||||
@GetMapping("/list")
|
||||
public Object list(String username,
|
||||
@RequestParam(defaultValue = "1") Integer page,
|
||||
@@ -63,6 +65,7 @@ public class AdminAdminController {
|
||||
}
|
||||
|
||||
@RequiresPermissions("admin:admin:create")
|
||||
@RequiresPermissionsDesc(menu={"系统管理" , "管理员管理"}, button="添加")
|
||||
@PostMapping("/create")
|
||||
public Object create(@RequestBody LitemallAdmin admin) {
|
||||
Object error = validate(admin);
|
||||
@@ -85,6 +88,7 @@ public class AdminAdminController {
|
||||
}
|
||||
|
||||
@RequiresPermissions("admin:admin:read")
|
||||
@RequiresPermissionsDesc(menu={"系统管理" , "管理员管理"}, button="详情")
|
||||
@GetMapping("/read")
|
||||
public Object read(@NotNull Integer id) {
|
||||
LitemallAdmin admin = adminService.findById(id);
|
||||
@@ -92,6 +96,7 @@ public class AdminAdminController {
|
||||
}
|
||||
|
||||
@RequiresPermissions("admin:admin:update")
|
||||
@RequiresPermissionsDesc(menu={"系统管理" , "管理员管理"}, button="编辑")
|
||||
@PostMapping("/update")
|
||||
public Object update(@RequestBody LitemallAdmin admin) {
|
||||
Object error = validate(admin);
|
||||
@@ -117,6 +122,7 @@ public class AdminAdminController {
|
||||
}
|
||||
|
||||
@RequiresPermissions("admin:admin:delete")
|
||||
@RequiresPermissionsDesc(menu={"系统管理" , "管理员管理"}, button="删除")
|
||||
@PostMapping("/delete")
|
||||
public Object delete(@RequestBody LitemallAdmin admin) {
|
||||
Integer anotherAdminId = admin.getId();
|
||||
|
||||
@@ -13,15 +13,14 @@ import org.linlinjava.litemall.core.util.JacksonUtil;
|
||||
import org.linlinjava.litemall.core.util.ResponseUtil;
|
||||
import org.linlinjava.litemall.db.domain.LitemallAdmin;
|
||||
import org.linlinjava.litemall.db.service.LitemallAdminService;
|
||||
import org.linlinjava.litemall.db.service.LitemallPermissionService;
|
||||
import org.linlinjava.litemall.db.service.LitemallRoleService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.util.StringUtils;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
|
||||
import static org.linlinjava.litemall.admin.util.AdminResponseCode.ADMIN_INVALID_ACCOUNT;
|
||||
|
||||
@@ -33,6 +32,10 @@ public class AdminAuthController {
|
||||
|
||||
@Autowired
|
||||
private LitemallAdminService adminService;
|
||||
@Autowired
|
||||
private LitemallRoleService roleService;
|
||||
@Autowired
|
||||
private LitemallPermissionService permissionService;
|
||||
|
||||
/*
|
||||
* { username : value, password : value }
|
||||
@@ -82,12 +85,11 @@ public class AdminAuthController {
|
||||
data.put("name", admin.getUsername());
|
||||
data.put("avatar", admin.getAvatar());
|
||||
|
||||
// 目前roles不支持,这里简单设置admin
|
||||
List<String> roles = new ArrayList<>();
|
||||
roles.add("admin");
|
||||
Integer[] roleIds = admin.getRoleIds();
|
||||
Set<String> roles = roleService.queryByIds(roleIds);
|
||||
Set<String> permissions = permissionService.queryByRoleIds(roleIds);
|
||||
data.put("roles", roles);
|
||||
data.put("perms", "*");
|
||||
data.put("introduction", "admin introduction");
|
||||
data.put("perms", permissions);
|
||||
return ResponseUtil.ok(data);
|
||||
}
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@ package org.linlinjava.litemall.admin.web;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.linlinjava.litemall.admin.annotation.RequiresPermissionsDesc;
|
||||
import org.linlinjava.litemall.core.util.ResponseUtil;
|
||||
import org.linlinjava.litemall.core.validator.Order;
|
||||
import org.linlinjava.litemall.core.validator.Sort;
|
||||
@@ -29,6 +30,7 @@ public class AdminBrandController {
|
||||
private LitemallBrandService brandService;
|
||||
|
||||
@RequiresPermissions("admin:brand:list")
|
||||
@RequiresPermissionsDesc(menu={"商场管理" , "品牌管理"}, button="查询")
|
||||
@GetMapping("/list")
|
||||
public Object list(String id, String name,
|
||||
@RequestParam(defaultValue = "1") Integer page,
|
||||
@@ -63,6 +65,7 @@ public class AdminBrandController {
|
||||
}
|
||||
|
||||
@RequiresPermissions("admin:brand:create")
|
||||
@RequiresPermissionsDesc(menu={"商场管理" , "品牌管理"}, button="添加")
|
||||
@PostMapping("/create")
|
||||
public Object create(@RequestBody LitemallBrand brand) {
|
||||
Object error = validate(brand);
|
||||
@@ -74,6 +77,7 @@ public class AdminBrandController {
|
||||
}
|
||||
|
||||
@RequiresPermissions("admin:brand:read")
|
||||
@RequiresPermissionsDesc(menu={"商场管理" , "品牌管理"}, button="详情")
|
||||
@GetMapping("/read")
|
||||
public Object read(@NotNull Integer id) {
|
||||
LitemallBrand brand = brandService.findById(id);
|
||||
@@ -81,6 +85,7 @@ public class AdminBrandController {
|
||||
}
|
||||
|
||||
@RequiresPermissions("admin:brand:update")
|
||||
@RequiresPermissionsDesc(menu={"商场管理" , "品牌管理"}, button="编辑")
|
||||
@PostMapping("/update")
|
||||
public Object update(@RequestBody LitemallBrand brand) {
|
||||
Object error = validate(brand);
|
||||
@@ -94,6 +99,7 @@ public class AdminBrandController {
|
||||
}
|
||||
|
||||
@RequiresPermissions("admin:brand:delete")
|
||||
@RequiresPermissionsDesc(menu={"商场管理" , "品牌管理"}, button="删除")
|
||||
@PostMapping("/delete")
|
||||
public Object delete(@RequestBody LitemallBrand brand) {
|
||||
Integer id = brand.getId();
|
||||
|
||||
@@ -3,6 +3,7 @@ package org.linlinjava.litemall.admin.web;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.linlinjava.litemall.admin.annotation.RequiresPermissionsDesc;
|
||||
import org.linlinjava.litemall.core.util.ResponseUtil;
|
||||
import org.linlinjava.litemall.core.validator.Order;
|
||||
import org.linlinjava.litemall.core.validator.Sort;
|
||||
@@ -29,6 +30,7 @@ public class AdminCategoryController {
|
||||
private LitemallCategoryService categoryService;
|
||||
|
||||
@RequiresPermissions("admin:category:list")
|
||||
@RequiresPermissionsDesc(menu={"商场管理" , "类目管理"}, button="查询")
|
||||
@GetMapping("/list")
|
||||
public Object list(String id, String name,
|
||||
@RequestParam(defaultValue = "1") Integer page,
|
||||
@@ -67,6 +69,7 @@ public class AdminCategoryController {
|
||||
}
|
||||
|
||||
@RequiresPermissions("admin:category:create")
|
||||
@RequiresPermissionsDesc(menu={"商场管理" , "类目管理"}, button="添加")
|
||||
@PostMapping("/create")
|
||||
public Object create(@RequestBody LitemallCategory category) {
|
||||
Object error = validate(category);
|
||||
@@ -78,6 +81,7 @@ public class AdminCategoryController {
|
||||
}
|
||||
|
||||
@RequiresPermissions("admin:category:read")
|
||||
@RequiresPermissionsDesc(menu={"商场管理" , "类目管理"}, button="详情")
|
||||
@GetMapping("/read")
|
||||
public Object read(@NotNull Integer id) {
|
||||
LitemallCategory category = categoryService.findById(id);
|
||||
@@ -85,6 +89,7 @@ public class AdminCategoryController {
|
||||
}
|
||||
|
||||
@RequiresPermissions("admin:category:update")
|
||||
@RequiresPermissionsDesc(menu={"商场管理" , "类目管理"}, button="编辑")
|
||||
@PostMapping("/update")
|
||||
public Object update(@RequestBody LitemallCategory category) {
|
||||
Object error = validate(category);
|
||||
@@ -99,6 +104,7 @@ public class AdminCategoryController {
|
||||
}
|
||||
|
||||
@RequiresPermissions("admin:category:delete")
|
||||
@RequiresPermissionsDesc(menu={"商场管理" , "类目管理"}, button="删除")
|
||||
@PostMapping("/delete")
|
||||
public Object delete(@RequestBody LitemallCategory category) {
|
||||
Integer id = category.getId();
|
||||
|
||||
@@ -3,6 +3,7 @@ package org.linlinjava.litemall.admin.web;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.linlinjava.litemall.admin.annotation.RequiresPermissionsDesc;
|
||||
import org.linlinjava.litemall.core.util.ResponseUtil;
|
||||
import org.linlinjava.litemall.core.validator.Order;
|
||||
import org.linlinjava.litemall.core.validator.Sort;
|
||||
@@ -30,6 +31,7 @@ public class AdminCollectController {
|
||||
|
||||
|
||||
@RequiresPermissions("admin:collect:list")
|
||||
@RequiresPermissionsDesc(menu={"用户管理" , "用户收藏"}, button="查询")
|
||||
@GetMapping("/list")
|
||||
public Object list(String userId, String valueId,
|
||||
@RequestParam(defaultValue = "1") Integer page,
|
||||
|
||||
@@ -3,6 +3,7 @@ package org.linlinjava.litemall.admin.web;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.linlinjava.litemall.admin.annotation.RequiresPermissionsDesc;
|
||||
import org.linlinjava.litemall.core.util.ResponseUtil;
|
||||
import org.linlinjava.litemall.core.validator.Order;
|
||||
import org.linlinjava.litemall.core.validator.Sort;
|
||||
@@ -26,6 +27,7 @@ public class AdminCommentController {
|
||||
private LitemallCommentService commentService;
|
||||
|
||||
@RequiresPermissions("admin:comment:list")
|
||||
@RequiresPermissionsDesc(menu={"商品管理" , "评论管理"}, button="查询")
|
||||
@GetMapping("/list")
|
||||
public Object list(String userId, String valueId,
|
||||
@RequestParam(defaultValue = "1") Integer page,
|
||||
@@ -42,6 +44,7 @@ public class AdminCommentController {
|
||||
}
|
||||
|
||||
@RequiresPermissions("admin:comment:delete")
|
||||
@RequiresPermissionsDesc(menu={"商品管理" , "评论管理"}, button="删除")
|
||||
@PostMapping("/delete")
|
||||
public Object delete(@RequestBody LitemallComment comment) {
|
||||
Integer id = comment.getId();
|
||||
|
||||
@@ -3,6 +3,7 @@ package org.linlinjava.litemall.admin.web;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.linlinjava.litemall.admin.annotation.RequiresPermissionsDesc;
|
||||
import org.linlinjava.litemall.core.util.ResponseUtil;
|
||||
import org.linlinjava.litemall.core.validator.Order;
|
||||
import org.linlinjava.litemall.core.validator.Sort;
|
||||
@@ -33,6 +34,7 @@ public class AdminCouponController {
|
||||
private LitemallCouponUserService couponUserService;
|
||||
|
||||
@RequiresPermissions("admin:coupon:list")
|
||||
@RequiresPermissionsDesc(menu={"推广管理" , "优惠券管理"}, button="查询")
|
||||
@GetMapping("/list")
|
||||
public Object list(String name, Short type, Short status,
|
||||
@RequestParam(defaultValue = "1") Integer page,
|
||||
@@ -49,6 +51,7 @@ public class AdminCouponController {
|
||||
}
|
||||
|
||||
@RequiresPermissions("admin:coupon:list")
|
||||
@RequiresPermissionsDesc(menu={"推广管理" , "优惠券管理"}, button="查询")
|
||||
@GetMapping("/listuser")
|
||||
public Object listuser(Integer userId, Integer couponId, Short status,
|
||||
@RequestParam(defaultValue = "1") Integer page,
|
||||
@@ -73,6 +76,7 @@ public class AdminCouponController {
|
||||
}
|
||||
|
||||
@RequiresPermissions("admin:coupon:create")
|
||||
@RequiresPermissionsDesc(menu={"推广管理" , "优惠券管理"}, button="添加")
|
||||
@PostMapping("/create")
|
||||
public Object create(@RequestBody LitemallCoupon coupon) {
|
||||
Object error = validate(coupon);
|
||||
@@ -91,6 +95,7 @@ public class AdminCouponController {
|
||||
}
|
||||
|
||||
@RequiresPermissions("admin:coupon:read")
|
||||
@RequiresPermissionsDesc(menu={"推广管理" , "优惠券管理"}, button="详情")
|
||||
@GetMapping("/read")
|
||||
public Object read(@NotNull Integer id) {
|
||||
LitemallCoupon coupon = couponService.findById(id);
|
||||
@@ -98,6 +103,7 @@ public class AdminCouponController {
|
||||
}
|
||||
|
||||
@RequiresPermissions("admin:coupon:update")
|
||||
@RequiresPermissionsDesc(menu={"推广管理" , "优惠券管理"}, button="编辑")
|
||||
@PostMapping("/update")
|
||||
public Object update(@RequestBody LitemallCoupon coupon) {
|
||||
Object error = validate(coupon);
|
||||
@@ -111,6 +117,7 @@ public class AdminCouponController {
|
||||
}
|
||||
|
||||
@RequiresPermissions("admin:coupon:delete")
|
||||
@RequiresPermissionsDesc(menu={"推广管理" , "优惠券管理"}, button="删除")
|
||||
@PostMapping("/delete")
|
||||
public Object delete(@RequestBody LitemallCoupon coupon) {
|
||||
couponService.deleteById(coupon.getId());
|
||||
|
||||
@@ -2,7 +2,6 @@ package org.linlinjava.litemall.admin.web;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.linlinjava.litemall.core.util.ResponseUtil;
|
||||
import org.linlinjava.litemall.db.service.LitemallGoodsProductService;
|
||||
import org.linlinjava.litemall.db.service.LitemallGoodsService;
|
||||
@@ -32,7 +31,6 @@ public class AdminDashbordController {
|
||||
@Autowired
|
||||
private LitemallOrderService orderService;
|
||||
|
||||
@RequiresPermissions("admin:dashboard:info")
|
||||
@GetMapping("")
|
||||
public Object info() {
|
||||
int userTotal = userService.count();
|
||||
|
||||
@@ -3,6 +3,7 @@ package org.linlinjava.litemall.admin.web;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.linlinjava.litemall.admin.annotation.RequiresPermissionsDesc;
|
||||
import org.linlinjava.litemall.core.util.ResponseUtil;
|
||||
import org.linlinjava.litemall.core.validator.Order;
|
||||
import org.linlinjava.litemall.core.validator.Sort;
|
||||
@@ -33,6 +34,7 @@ public class AdminFeedbackController {
|
||||
private LitemallFeedbackService feedbackService;
|
||||
|
||||
@RequiresPermissions("admin:feedback:list")
|
||||
@RequiresPermissionsDesc(menu={"用户管理" , "意见反馈"}, button="查询")
|
||||
@GetMapping("/list")
|
||||
public Object list(Integer userId, String username,
|
||||
@RequestParam(defaultValue = "1") Integer page,
|
||||
|
||||
@@ -3,6 +3,7 @@ package org.linlinjava.litemall.admin.web;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.linlinjava.litemall.admin.annotation.RequiresPermissionsDesc;
|
||||
import org.linlinjava.litemall.core.util.ResponseUtil;
|
||||
import org.linlinjava.litemall.core.validator.Order;
|
||||
import org.linlinjava.litemall.core.validator.Sort;
|
||||
@@ -29,6 +30,7 @@ public class AdminFootprintController {
|
||||
private LitemallFootprintService footprintService;
|
||||
|
||||
@RequiresPermissions("admin:footprint:list")
|
||||
@RequiresPermissionsDesc(menu={"用户管理" , "用户足迹"}, button="查询")
|
||||
@GetMapping("/list")
|
||||
public Object list(String userId, String goodsId,
|
||||
@RequestParam(defaultValue = "1") Integer page,
|
||||
|
||||
@@ -3,6 +3,7 @@ package org.linlinjava.litemall.admin.web;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.linlinjava.litemall.admin.annotation.RequiresPermissionsDesc;
|
||||
import org.linlinjava.litemall.admin.dao.GoodsAllinone;
|
||||
import org.linlinjava.litemall.admin.util.CatVo;
|
||||
import org.linlinjava.litemall.core.qcode.QCodeService;
|
||||
@@ -60,6 +61,7 @@ public class AdminGoodsController {
|
||||
private QCodeService qCodeService;
|
||||
|
||||
@RequiresPermissions("admin:goods:list")
|
||||
@RequiresPermissionsDesc(menu={"商品管理" , "商品列表"}, button="查询")
|
||||
@GetMapping("/list")
|
||||
public Object list(String goodsSn, String name,
|
||||
@RequestParam(defaultValue = "1") Integer page,
|
||||
@@ -162,6 +164,7 @@ public class AdminGoodsController {
|
||||
* 所以这里可能需要重新设计。
|
||||
*/
|
||||
@RequiresPermissions("admin:goods:update")
|
||||
@RequiresPermissionsDesc(menu={"商品管理" , "商品列表"}, button="编辑")
|
||||
@PostMapping("/update")
|
||||
public Object update(@RequestBody GoodsAllinone goodsAllinone) {
|
||||
Object error = validate(goodsAllinone);
|
||||
@@ -234,6 +237,7 @@ public class AdminGoodsController {
|
||||
}
|
||||
|
||||
@RequiresPermissions("admin:goods:delete")
|
||||
@RequiresPermissionsDesc(menu={"商品管理" , "商品列表"}, button="删除")
|
||||
@PostMapping("/delete")
|
||||
public Object delete(@RequestBody LitemallGoods goods) {
|
||||
Integer id = goods.getId();
|
||||
@@ -262,6 +266,7 @@ public class AdminGoodsController {
|
||||
}
|
||||
|
||||
@RequiresPermissions("admin:goods:create")
|
||||
@RequiresPermissionsDesc(menu={"商品管理" , "商品上架"}, button="上架")
|
||||
@PostMapping("/create")
|
||||
public Object create(@RequestBody GoodsAllinone goodsAllinone) {
|
||||
Object error = validate(goodsAllinone);
|
||||
@@ -325,6 +330,7 @@ public class AdminGoodsController {
|
||||
}
|
||||
|
||||
@RequiresPermissions("admin:goods:list")
|
||||
@RequiresPermissionsDesc(menu={"商品管理" , "商品列表"}, button="查询")
|
||||
@GetMapping("/catAndBrand")
|
||||
public Object list2() {
|
||||
// http://element-cn.eleme.io/#/zh-CN/component/cascader
|
||||
@@ -368,6 +374,7 @@ public class AdminGoodsController {
|
||||
}
|
||||
|
||||
@RequiresPermissions("admin:goods:read")
|
||||
@RequiresPermissionsDesc(menu={"商品管理" , "商品列表"}, button="编辑")
|
||||
@GetMapping("/detail")
|
||||
public Object detail(@NotNull Integer id) {
|
||||
LitemallGoods goods = goodsService.findById(id);
|
||||
|
||||
@@ -3,6 +3,7 @@ package org.linlinjava.litemall.admin.web;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.linlinjava.litemall.admin.annotation.RequiresPermissionsDesc;
|
||||
import org.linlinjava.litemall.core.util.ResponseUtil;
|
||||
import org.linlinjava.litemall.core.validator.Order;
|
||||
import org.linlinjava.litemall.core.validator.Sort;
|
||||
@@ -37,6 +38,7 @@ public class AdminGrouponController {
|
||||
private LitemallGrouponService grouponService;
|
||||
|
||||
@RequiresPermissions("admin:groupon:read")
|
||||
@RequiresPermissionsDesc(menu={"推广管理" , "团购管理"}, button="查询")
|
||||
@GetMapping("/listRecord")
|
||||
public Object listRecord(String grouponId,
|
||||
@RequestParam(defaultValue = "1") Integer page,
|
||||
@@ -72,7 +74,8 @@ public class AdminGrouponController {
|
||||
return ResponseUtil.ok(data);
|
||||
}
|
||||
|
||||
@RequiresPermissions("admin:groupon:delete")
|
||||
@RequiresPermissions("admin:groupon:list")
|
||||
@RequiresPermissionsDesc(menu={"推广管理" , "团购管理"}, button="查询")
|
||||
@GetMapping("/list")
|
||||
public Object list(String goodsId,
|
||||
@RequestParam(defaultValue = "1") Integer page,
|
||||
@@ -110,6 +113,7 @@ public class AdminGrouponController {
|
||||
}
|
||||
|
||||
@RequiresPermissions("admin:groupon:update")
|
||||
@RequiresPermissionsDesc(menu={"推广管理" , "团购管理"}, button="编辑")
|
||||
@PostMapping("/update")
|
||||
public Object update(@RequestBody LitemallGrouponRules grouponRules) {
|
||||
Object error = validate(grouponRules);
|
||||
@@ -134,6 +138,7 @@ public class AdminGrouponController {
|
||||
}
|
||||
|
||||
@RequiresPermissions("admin:groupon:create")
|
||||
@RequiresPermissionsDesc(menu={"推广管理" , "团购管理"}, button="添加")
|
||||
@PostMapping("/create")
|
||||
public Object create(@RequestBody LitemallGrouponRules grouponRules) {
|
||||
Object error = validate(grouponRules);
|
||||
@@ -156,6 +161,7 @@ public class AdminGrouponController {
|
||||
}
|
||||
|
||||
@RequiresPermissions("admin:groupon:delete")
|
||||
@RequiresPermissionsDesc(menu={"推广管理" , "团购管理"}, button="删除")
|
||||
@PostMapping("/delete")
|
||||
public Object delete(@RequestBody LitemallGrouponRules grouponRules) {
|
||||
Integer id = grouponRules.getId();
|
||||
|
||||
@@ -3,6 +3,7 @@ package org.linlinjava.litemall.admin.web;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.linlinjava.litemall.admin.annotation.RequiresPermissionsDesc;
|
||||
import org.linlinjava.litemall.core.util.ResponseUtil;
|
||||
import org.linlinjava.litemall.core.validator.Order;
|
||||
import org.linlinjava.litemall.core.validator.Sort;
|
||||
@@ -27,6 +28,7 @@ public class AdminHistoryController {
|
||||
private LitemallSearchHistoryService searchHistoryService;
|
||||
|
||||
@RequiresPermissions("admin:history:list")
|
||||
@RequiresPermissionsDesc(menu={"用户管理" , "搜索历史"}, button="查询")
|
||||
@GetMapping("/list")
|
||||
public Object list(String userId, String keyword,
|
||||
@RequestParam(defaultValue = "1") Integer page,
|
||||
|
||||
@@ -3,6 +3,7 @@ package org.linlinjava.litemall.admin.web;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.apache.shiro.authz.annotation.*;
|
||||
import org.linlinjava.litemall.admin.annotation.RequiresPermissionsDesc;
|
||||
import org.linlinjava.litemall.core.util.ResponseUtil;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
@@ -48,12 +49,14 @@ public class AdminIndexController {
|
||||
}
|
||||
|
||||
@RequiresPermissions("index:permission:read")
|
||||
@RequiresPermissionsDesc(menu={"其他" , "权限测试"}, button="权限读")
|
||||
@RequestMapping("/read")
|
||||
public Object read() {
|
||||
return ResponseUtil.ok("hello world, this is admin service");
|
||||
}
|
||||
|
||||
@RequiresPermissions("index:permission:write")
|
||||
@RequiresPermissionsDesc(menu={"其他" , "权限测试"}, button="权限写")
|
||||
@RequestMapping("/write")
|
||||
public Object write() {
|
||||
return ResponseUtil.ok("hello world, this is admin service");
|
||||
|
||||
@@ -3,6 +3,7 @@ package org.linlinjava.litemall.admin.web;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.linlinjava.litemall.admin.annotation.RequiresPermissionsDesc;
|
||||
import org.linlinjava.litemall.core.util.ResponseUtil;
|
||||
import org.linlinjava.litemall.core.validator.Order;
|
||||
import org.linlinjava.litemall.core.validator.Sort;
|
||||
@@ -28,6 +29,7 @@ public class AdminIssueController {
|
||||
private LitemallIssueService issueService;
|
||||
|
||||
@RequiresPermissions("admin:issue:list")
|
||||
@RequiresPermissionsDesc(menu={"商城管理" , "通用问题"}, button="查询")
|
||||
@GetMapping("/list")
|
||||
public Object list(String question,
|
||||
@RequestParam(defaultValue = "1") Integer page,
|
||||
@@ -56,6 +58,7 @@ public class AdminIssueController {
|
||||
}
|
||||
|
||||
@RequiresPermissions("admin:issue:create")
|
||||
@RequiresPermissionsDesc(menu={"商城管理" , "通用问题"}, button="添加")
|
||||
@PostMapping("/create")
|
||||
public Object create(@RequestBody LitemallIssue issue) {
|
||||
Object error = validate(issue);
|
||||
@@ -74,6 +77,7 @@ public class AdminIssueController {
|
||||
}
|
||||
|
||||
@RequiresPermissions("admin:issue:update")
|
||||
@RequiresPermissionsDesc(menu={"商城管理" , "通用问题"}, button="编辑")
|
||||
@PostMapping("/update")
|
||||
public Object update(@RequestBody LitemallIssue issue) {
|
||||
Object error = validate(issue);
|
||||
@@ -88,6 +92,7 @@ public class AdminIssueController {
|
||||
}
|
||||
|
||||
@RequiresPermissions("admin:issue:delete")
|
||||
@RequiresPermissionsDesc(menu={"商城管理" , "通用问题"}, button="删除")
|
||||
@PostMapping("/delete")
|
||||
public Object delete(@RequestBody LitemallIssue issue) {
|
||||
Integer id = issue.getId();
|
||||
|
||||
@@ -3,6 +3,7 @@ package org.linlinjava.litemall.admin.web;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.linlinjava.litemall.admin.annotation.RequiresPermissionsDesc;
|
||||
import org.linlinjava.litemall.core.util.ResponseUtil;
|
||||
import org.linlinjava.litemall.core.validator.Order;
|
||||
import org.linlinjava.litemall.core.validator.Sort;
|
||||
@@ -28,6 +29,7 @@ public class AdminKeywordController {
|
||||
private LitemallKeywordService keywordService;
|
||||
|
||||
@RequiresPermissions("admin:keyword:list")
|
||||
@RequiresPermissionsDesc(menu={"商城管理" , "关键词"}, button="查询")
|
||||
@GetMapping("/list")
|
||||
public Object list(String keyword, String url,
|
||||
@RequestParam(defaultValue = "1") Integer page,
|
||||
@@ -56,6 +58,7 @@ public class AdminKeywordController {
|
||||
}
|
||||
|
||||
@RequiresPermissions("admin:keyword:create")
|
||||
@RequiresPermissionsDesc(menu={"商城管理" , "关键词"}, button="添加")
|
||||
@PostMapping("/create")
|
||||
public Object create(@RequestBody LitemallKeyword keywords) {
|
||||
Object error = validate(keywords);
|
||||
@@ -67,6 +70,7 @@ public class AdminKeywordController {
|
||||
}
|
||||
|
||||
@RequiresPermissions("admin:keyword:read")
|
||||
@RequiresPermissionsDesc(menu={"商城管理" , "关键词"}, button="详情")
|
||||
@GetMapping("/read")
|
||||
public Object read(@NotNull Integer id) {
|
||||
LitemallKeyword brand = keywordService.findById(id);
|
||||
@@ -74,6 +78,7 @@ public class AdminKeywordController {
|
||||
}
|
||||
|
||||
@RequiresPermissions("admin:keyword:update")
|
||||
@RequiresPermissionsDesc(menu={"商城管理" , "关键词"}, button="编辑")
|
||||
@PostMapping("/update")
|
||||
public Object update(@RequestBody LitemallKeyword keywords) {
|
||||
Object error = validate(keywords);
|
||||
@@ -87,6 +92,7 @@ public class AdminKeywordController {
|
||||
}
|
||||
|
||||
@RequiresPermissions("admin:keyword:delete")
|
||||
@RequiresPermissionsDesc(menu={"商城管理" , "关键词"}, button="删除")
|
||||
@PostMapping("/delete")
|
||||
public Object delete(@RequestBody LitemallKeyword keyword) {
|
||||
Integer id = keyword.getId();
|
||||
|
||||
@@ -7,6 +7,7 @@ import com.github.binarywang.wxpay.service.WxPayService;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.linlinjava.litemall.admin.annotation.RequiresPermissionsDesc;
|
||||
import org.linlinjava.litemall.core.notify.NotifyService;
|
||||
import org.linlinjava.litemall.core.notify.NotifyType;
|
||||
import org.linlinjava.litemall.core.util.JacksonUtil;
|
||||
@@ -62,6 +63,7 @@ public class AdminOrderController {
|
||||
private NotifyService notifyService;
|
||||
|
||||
@RequiresPermissions("admin:order:list")
|
||||
@RequiresPermissionsDesc(menu={"商城管理" , "订单管理"}, button="查询")
|
||||
@GetMapping("/list")
|
||||
public Object list(Integer userId, String orderSn,
|
||||
@RequestParam(required = false) List<Short> orderStatusArray,
|
||||
@@ -80,6 +82,7 @@ public class AdminOrderController {
|
||||
}
|
||||
|
||||
@RequiresPermissions("admin:order:read")
|
||||
@RequiresPermissionsDesc(menu={"商城管理" , "订单管理"}, button="详情")
|
||||
@GetMapping("/detail")
|
||||
public Object detail(@NotNull Integer id) {
|
||||
LitemallOrder order = orderService.findById(id);
|
||||
@@ -106,11 +109,11 @@ public class AdminOrderController {
|
||||
* 1. 管理员登录微信官方支付平台点击退款操作进行退款
|
||||
* 2. 管理员登录litemall管理后台点击退款操作进行订单状态修改和商品库存回库
|
||||
*
|
||||
* @param adminId 管理员ID
|
||||
* @param body 订单信息,{ orderId:xxx }
|
||||
* @return 订单退款操作结果
|
||||
*/
|
||||
@RequiresPermissions("admin:order:refund")
|
||||
@RequiresPermissionsDesc(menu={"商城管理" , "订单管理"}, button="订单退款")
|
||||
@PostMapping("refund")
|
||||
public Object refund(@RequestBody String body) {
|
||||
Integer orderId = JacksonUtil.parseInteger(body, "orderId");
|
||||
@@ -202,13 +205,13 @@ public class AdminOrderController {
|
||||
* 1. 检测当前订单是否能够发货
|
||||
* 2. 设置订单发货状态
|
||||
*
|
||||
* @param adminId 管理员ID
|
||||
* @param body 订单信息,{ orderId:xxx, shipSn: xxx, shipChannel: xxx }
|
||||
* @return 订单操作结果
|
||||
* 成功则 { errno: 0, errmsg: '成功' }
|
||||
* 失败则 { errno: XXX, errmsg: XXX }
|
||||
*/
|
||||
@RequiresPermissions("admin:order:ship")
|
||||
@RequiresPermissionsDesc(menu={"商城管理" , "订单管理"}, button="订单发货")
|
||||
@PostMapping("ship")
|
||||
public Object ship(@RequestBody String body) {
|
||||
Integer orderId = JacksonUtil.parseInteger(body, "orderId");
|
||||
@@ -248,13 +251,13 @@ public class AdminOrderController {
|
||||
/**
|
||||
* 回复订单商品
|
||||
*
|
||||
* @param adminId 管理员ID
|
||||
* @param body 订单信息,{ orderId:xxx }
|
||||
* @return 订单操作结果
|
||||
* 成功则 { errno: 0, errmsg: '成功' }
|
||||
* 失败则 { errno: XXX, errmsg: XXX }
|
||||
*/
|
||||
@RequiresPermissions("admin:order:reply")
|
||||
@RequiresPermissionsDesc(menu={"商城管理" , "订单管理"}, button="订单商品回复")
|
||||
@PostMapping("reply")
|
||||
public Object reply(@RequestBody String body) {
|
||||
Integer commentId = JacksonUtil.parseInteger(body, "commentId");
|
||||
|
||||
@@ -0,0 +1,223 @@
|
||||
package org.linlinjava.litemall.admin.web;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.apache.shiro.SecurityUtils;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.apache.shiro.subject.Subject;
|
||||
import org.linlinjava.litemall.admin.annotation.RequiresPermissionsDesc;
|
||||
import org.linlinjava.litemall.admin.util.AdminResponseCode;
|
||||
import org.linlinjava.litemall.admin.util.PermVo;
|
||||
import org.linlinjava.litemall.admin.util.PermissionUtil;
|
||||
import org.linlinjava.litemall.core.util.JacksonUtil;
|
||||
import org.linlinjava.litemall.core.util.ResponseUtil;
|
||||
import org.linlinjava.litemall.core.validator.Order;
|
||||
import org.linlinjava.litemall.core.validator.Sort;
|
||||
import org.linlinjava.litemall.db.domain.LitemallAdmin;
|
||||
import org.linlinjava.litemall.db.domain.LitemallBrand;
|
||||
import org.linlinjava.litemall.db.domain.LitemallPermission;
|
||||
import org.linlinjava.litemall.db.domain.LitemallRole;
|
||||
import org.linlinjava.litemall.db.service.LitemallPermissionService;
|
||||
import org.linlinjava.litemall.db.service.LitemallRoleService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.util.StringUtils;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.*;
|
||||
|
||||
import static org.linlinjava.litemall.admin.util.AdminResponseCode.ROLE_NAME_EXIST;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/admin/role")
|
||||
@Validated
|
||||
public class AdminRoleController {
|
||||
private final Log logger = LogFactory.getLog(AdminRoleController.class);
|
||||
|
||||
@Autowired
|
||||
private LitemallRoleService roleService;
|
||||
@Autowired
|
||||
private LitemallPermissionService permissionService;
|
||||
|
||||
@RequiresPermissions("admin:role:list")
|
||||
@RequiresPermissionsDesc(menu={"系统管理" , "角色管理"}, button="查询")
|
||||
@GetMapping("/list")
|
||||
public Object list(String name,
|
||||
@RequestParam(defaultValue = "1") Integer page,
|
||||
@RequestParam(defaultValue = "10") Integer limit,
|
||||
@Sort @RequestParam(defaultValue = "add_time") String sort,
|
||||
@Order @RequestParam(defaultValue = "desc") String order) {
|
||||
List<LitemallRole> roleList = roleService.querySelective(name, page, limit, sort, order);
|
||||
int total = roleService.countSelective(name, page, limit, sort, order);
|
||||
Map<String, Object> data = new HashMap<>();
|
||||
data.put("total", total);
|
||||
data.put("items", roleList);
|
||||
|
||||
return ResponseUtil.ok(data);
|
||||
}
|
||||
|
||||
@RequiresPermissions("admin:role:list")
|
||||
@RequiresPermissionsDesc(menu={"系统管理" , "角色管理"}, button="查询")
|
||||
@GetMapping("/options")
|
||||
public Object options(){
|
||||
List<LitemallRole> roleList = roleService.queryAll();
|
||||
|
||||
List<Map<String, Object>> options = new ArrayList<>(roleList.size());
|
||||
for (LitemallRole role : roleList) {
|
||||
Map<String, Object> option = new HashMap<>(2);
|
||||
option.put("value", role.getId());
|
||||
option.put("label", role.getName());
|
||||
options.add(option);
|
||||
}
|
||||
|
||||
return ResponseUtil.ok(options);
|
||||
}
|
||||
|
||||
@RequiresPermissions("admin:role:read")
|
||||
@RequiresPermissionsDesc(menu={"系统管理" , "角色管理"}, button="详情")
|
||||
@GetMapping("/read")
|
||||
public Object read(@NotNull Integer id) {
|
||||
LitemallRole role = roleService.findById(id);
|
||||
return ResponseUtil.ok(role);
|
||||
}
|
||||
|
||||
|
||||
private Object validate(LitemallRole role) {
|
||||
String name = role.getName();
|
||||
if (StringUtils.isEmpty(name)) {
|
||||
return ResponseUtil.badArgument();
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@RequiresPermissions("admin:role:create")
|
||||
@RequiresPermissionsDesc(menu={"系统管理" , "角色管理"}, button="添加")
|
||||
@PostMapping("/create")
|
||||
public Object create(@RequestBody LitemallRole role) {
|
||||
Object error = validate(role);
|
||||
if (error != null) {
|
||||
return error;
|
||||
}
|
||||
|
||||
if (roleService.checkExist(role.getName())){
|
||||
return ResponseUtil.fail(ROLE_NAME_EXIST, "角色已经存在");
|
||||
}
|
||||
|
||||
roleService.add(role);
|
||||
|
||||
return ResponseUtil.ok(role);
|
||||
}
|
||||
|
||||
@RequiresPermissions("admin:role:update")
|
||||
@RequiresPermissionsDesc(menu={"系统管理" , "角色管理"}, button="编辑")
|
||||
@PostMapping("/update")
|
||||
public Object update(@RequestBody LitemallRole role) {
|
||||
Object error = validate(role);
|
||||
if (error != null) {
|
||||
return error;
|
||||
}
|
||||
|
||||
roleService.updateById(role);
|
||||
return ResponseUtil.ok();
|
||||
}
|
||||
|
||||
@RequiresPermissions("admin:role:delete")
|
||||
@RequiresPermissionsDesc(menu={"系统管理" , "角色管理"}, button="删除")
|
||||
@PostMapping("/delete")
|
||||
public Object delete(@RequestBody LitemallRole role) {
|
||||
Integer id = role.getId();
|
||||
if (id == null) {
|
||||
return ResponseUtil.badArgument();
|
||||
}
|
||||
roleService.deleteById(id);
|
||||
return ResponseUtil.ok();
|
||||
}
|
||||
|
||||
|
||||
@Autowired
|
||||
private ApplicationContext context;
|
||||
private List<PermVo> systemPermissions = null;
|
||||
private List<PermVo> getSystemPermissions(){
|
||||
final String basicPackage = "org.linlinjava.litemall.admin";
|
||||
if(systemPermissions == null){
|
||||
systemPermissions = PermissionUtil.listPermissions(context, basicPackage);
|
||||
}
|
||||
return systemPermissions;
|
||||
}
|
||||
|
||||
private Set<String> getSystemPermissionsString(){
|
||||
getSystemPermissions();
|
||||
|
||||
Set<String> permissions = new HashSet<String>();
|
||||
for(PermVo permVo : systemPermissions){
|
||||
permissions.add(permVo.getId());
|
||||
}
|
||||
return permissions;
|
||||
}
|
||||
|
||||
private Set<String> getAssignedPermissions(Integer roleId){
|
||||
// 这里需要注意的是,如果存在超级权限*,那么这里需要转化成当前所有系统权限。
|
||||
// 之所以这么做,是因为前端不能识别超级权限,所以这里需要转换一下。
|
||||
Set<String> assignedPermissions = null;
|
||||
if(permissionService.checkSuperPermission(roleId)){
|
||||
assignedPermissions = getSystemPermissionsString();
|
||||
}
|
||||
else{
|
||||
assignedPermissions = permissionService.queryByRoleId(roleId);
|
||||
}
|
||||
|
||||
return assignedPermissions;
|
||||
}
|
||||
|
||||
/**
|
||||
* 管理员的权限情况
|
||||
*
|
||||
* @return 系统所有权限列表和管理员已分配权限
|
||||
*/
|
||||
@RequiresPermissions("admin:role:permission")
|
||||
@RequiresPermissionsDesc(menu={"系统管理" , "角色管理"}, button="授权")
|
||||
@GetMapping("/permissions")
|
||||
public Object getPermissions(Integer roleId) {
|
||||
List<PermVo> systemPermissions = getSystemPermissions();
|
||||
Set<String> assignedPermissions = getAssignedPermissions(roleId);
|
||||
|
||||
Map<String, Object> data = new HashMap<>();
|
||||
data.put("systemPermissions", systemPermissions);
|
||||
data.put("assignedPermissions", assignedPermissions);
|
||||
return ResponseUtil.ok(data);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 更新管理员的权限
|
||||
*
|
||||
* @param body
|
||||
* @return
|
||||
*/
|
||||
@RequiresPermissions("admin:role:permission")
|
||||
@RequiresPermissionsDesc(menu={"系统管理" , "角色管理"}, button="授权")
|
||||
@PostMapping("/permissions")
|
||||
public Object updatePermissions(@RequestBody String body) {
|
||||
Integer roleId = JacksonUtil.parseInteger(body, "roleId");
|
||||
List<String> permissions = JacksonUtil.parseStringList(body, "permissions");
|
||||
|
||||
// 如果修改的角色是超级权限,则拒绝修改。
|
||||
if(permissionService.checkSuperPermission(roleId)){
|
||||
return ResponseUtil.fail(AdminResponseCode.ROLE_SUPER_SUPERMISSION, "当前角色的超级权限不能变更");
|
||||
}
|
||||
|
||||
// 先删除旧的权限,再更新新的权限
|
||||
permissionService.deleteByRoleId(roleId);
|
||||
for(String permission : permissions){
|
||||
LitemallPermission litemallPermission = new LitemallPermission();
|
||||
litemallPermission.setRoleId(roleId);
|
||||
litemallPermission.setPermission(permission);
|
||||
permissionService.add(litemallPermission);
|
||||
}
|
||||
return ResponseUtil.ok();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -3,6 +3,7 @@ package org.linlinjava.litemall.admin.web;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.linlinjava.litemall.admin.annotation.RequiresPermissionsDesc;
|
||||
import org.linlinjava.litemall.admin.util.StatVo;
|
||||
import org.linlinjava.litemall.core.util.ResponseUtil;
|
||||
import org.linlinjava.litemall.db.service.StatService;
|
||||
@@ -25,6 +26,7 @@ public class AdminStatController {
|
||||
private StatService statService;
|
||||
|
||||
@RequiresPermissions("admin:stat:user")
|
||||
@RequiresPermissionsDesc(menu={"统计管理" , "用户统计"}, button="查询")
|
||||
@GetMapping("/user")
|
||||
public Object statUser() {
|
||||
List<Map> rows = statService.statUser();
|
||||
@@ -36,6 +38,7 @@ public class AdminStatController {
|
||||
}
|
||||
|
||||
@RequiresPermissions("admin:stat:order")
|
||||
@RequiresPermissionsDesc(menu={"统计管理" , "订单统计"}, button="查询")
|
||||
@GetMapping("/order")
|
||||
public Object statOrder() {
|
||||
List<Map> rows = statService.statOrder();
|
||||
@@ -48,6 +51,7 @@ public class AdminStatController {
|
||||
}
|
||||
|
||||
@RequiresPermissions("admin:stat:goods")
|
||||
@RequiresPermissionsDesc(menu={"统计管理" , "商品统计"}, button="查询")
|
||||
@GetMapping("/goods")
|
||||
public Object statGoods() {
|
||||
List<Map> rows = statService.statGoods();
|
||||
|
||||
@@ -3,6 +3,7 @@ package org.linlinjava.litemall.admin.web;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.linlinjava.litemall.admin.annotation.RequiresPermissionsDesc;
|
||||
import org.linlinjava.litemall.core.storage.StorageService;
|
||||
import org.linlinjava.litemall.core.util.ResponseUtil;
|
||||
import org.linlinjava.litemall.core.validator.Order;
|
||||
@@ -33,6 +34,7 @@ public class AdminStorageController {
|
||||
private LitemallStorageService litemallStorageService;
|
||||
|
||||
@RequiresPermissions("admin:storage:list")
|
||||
@RequiresPermissionsDesc(menu={"系统管理" , "对象存储"}, button="查询")
|
||||
@GetMapping("/list")
|
||||
public Object list(String key, String name,
|
||||
@RequestParam(defaultValue = "1") Integer page,
|
||||
@@ -49,6 +51,7 @@ public class AdminStorageController {
|
||||
}
|
||||
|
||||
@RequiresPermissions("admin:storage:create")
|
||||
@RequiresPermissionsDesc(menu={"系统管理" , "对象存储"}, button="上传")
|
||||
@PostMapping("/create")
|
||||
public Object create(@RequestParam("file") MultipartFile file) throws IOException {
|
||||
String originalFilename = file.getOriginalFilename();
|
||||
@@ -59,6 +62,7 @@ public class AdminStorageController {
|
||||
}
|
||||
|
||||
@RequiresPermissions("admin:storage:read")
|
||||
@RequiresPermissionsDesc(menu={"系统管理" , "对象存储"}, button="详情")
|
||||
@PostMapping("/read")
|
||||
public Object read(@NotNull Integer id) {
|
||||
LitemallStorage storageInfo = litemallStorageService.findById(id);
|
||||
@@ -68,7 +72,8 @@ public class AdminStorageController {
|
||||
return ResponseUtil.ok(storageInfo);
|
||||
}
|
||||
|
||||
@RequiresPermissions("admin:storage:delete")
|
||||
@RequiresPermissions("admin:storage:update")
|
||||
@RequiresPermissionsDesc(menu={"系统管理" , "对象存储"}, button="编辑")
|
||||
@PostMapping("/update")
|
||||
public Object update(@RequestBody LitemallStorage litemallStorage) {
|
||||
if (litemallStorageService.update(litemallStorage) == 0) {
|
||||
@@ -78,6 +83,7 @@ public class AdminStorageController {
|
||||
}
|
||||
|
||||
@RequiresPermissions("admin:storage:delete")
|
||||
@RequiresPermissionsDesc(menu={"系统管理" , "对象存储"}, button="删除")
|
||||
@PostMapping("/delete")
|
||||
public Object delete(@RequestBody LitemallStorage litemallStorage) {
|
||||
String key = litemallStorage.getKey();
|
||||
|
||||
@@ -3,6 +3,7 @@ package org.linlinjava.litemall.admin.web;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.linlinjava.litemall.admin.annotation.RequiresPermissionsDesc;
|
||||
import org.linlinjava.litemall.core.util.ResponseUtil;
|
||||
import org.linlinjava.litemall.core.validator.Order;
|
||||
import org.linlinjava.litemall.core.validator.Sort;
|
||||
@@ -29,6 +30,7 @@ public class AdminTopicController {
|
||||
private LitemallTopicService topicService;
|
||||
|
||||
@RequiresPermissions("admin:topic:list")
|
||||
@RequiresPermissionsDesc(menu={"推广管理" , "专题管理"}, button="查询")
|
||||
@GetMapping("/list")
|
||||
public Object list(String title, String subtitle,
|
||||
@RequestParam(defaultValue = "1") Integer page,
|
||||
@@ -61,6 +63,7 @@ public class AdminTopicController {
|
||||
}
|
||||
|
||||
@RequiresPermissions("admin:topic:create")
|
||||
@RequiresPermissionsDesc(menu={"推广管理" , "专题管理"}, button="添加")
|
||||
@PostMapping("/create")
|
||||
public Object create(@RequestBody LitemallTopic topic) {
|
||||
Object error = validate(topic);
|
||||
@@ -72,6 +75,7 @@ public class AdminTopicController {
|
||||
}
|
||||
|
||||
@RequiresPermissions("admin:topic:read")
|
||||
@RequiresPermissionsDesc(menu={"推广管理" , "专题管理"}, button="详情")
|
||||
@GetMapping("/read")
|
||||
public Object read(@NotNull Integer id) {
|
||||
LitemallTopic topic = topicService.findById(id);
|
||||
@@ -79,6 +83,7 @@ public class AdminTopicController {
|
||||
}
|
||||
|
||||
@RequiresPermissions("admin:topic:update")
|
||||
@RequiresPermissionsDesc(menu={"推广管理" , "专题管理"}, button="编辑")
|
||||
@PostMapping("/update")
|
||||
public Object update(@RequestBody LitemallTopic topic) {
|
||||
Object error = validate(topic);
|
||||
@@ -92,6 +97,7 @@ public class AdminTopicController {
|
||||
}
|
||||
|
||||
@RequiresPermissions("admin:topic:delete")
|
||||
@RequiresPermissionsDesc(menu={"推广管理" , "专题管理"}, button="删除")
|
||||
@PostMapping("/delete")
|
||||
public Object delete(@RequestBody LitemallTopic topic) {
|
||||
topicService.deleteById(topic.getId());
|
||||
|
||||
@@ -3,6 +3,7 @@ package org.linlinjava.litemall.admin.web;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.linlinjava.litemall.admin.annotation.RequiresPermissionsDesc;
|
||||
import org.linlinjava.litemall.core.util.RegexUtil;
|
||||
import org.linlinjava.litemall.core.util.ResponseUtil;
|
||||
import org.linlinjava.litemall.core.util.bcrypt.BCryptPasswordEncoder;
|
||||
@@ -32,6 +33,7 @@ public class AdminUserController {
|
||||
private LitemallUserService userService;
|
||||
|
||||
@RequiresPermissions("admin:user:list")
|
||||
@RequiresPermissionsDesc(menu={"用户管理" , "会员管理"}, button="查询")
|
||||
@GetMapping("/list")
|
||||
public Object list(String username, String mobile,
|
||||
@RequestParam(defaultValue = "1") Integer page,
|
||||
@@ -48,6 +50,7 @@ public class AdminUserController {
|
||||
}
|
||||
|
||||
@RequiresPermissions("admin:user:list")
|
||||
@RequiresPermissionsDesc(menu={"用户管理" , "会员管理"}, button="查询")
|
||||
@GetMapping("/username")
|
||||
public Object username(@NotEmpty String username) {
|
||||
int total = userService.countSeletive(username, null, null, null, null, null);
|
||||
@@ -80,6 +83,7 @@ public class AdminUserController {
|
||||
}
|
||||
|
||||
@RequiresPermissions("admin:user:create")
|
||||
@RequiresPermissionsDesc(menu={"用户管理" , "会员管理"}, button="添加")
|
||||
@PostMapping("/create")
|
||||
public Object create(@RequestBody LitemallUser user) {
|
||||
Object error = validate(user);
|
||||
@@ -110,6 +114,7 @@ public class AdminUserController {
|
||||
}
|
||||
|
||||
@RequiresPermissions("admin:user:update")
|
||||
@RequiresPermissionsDesc(menu={"用户管理" , "会员管理"}, button="编辑")
|
||||
@PostMapping("/update")
|
||||
public Object update(@RequestBody LitemallUser user) {
|
||||
Object error = validate(user);
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
package org.linlinjava.litemall.admin;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.linlinjava.litemall.admin.util.PermVo;
|
||||
import org.linlinjava.litemall.admin.util.PermissionUtil;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
import org.springframework.test.context.web.WebAppConfiguration;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@WebAppConfiguration
|
||||
@RunWith(SpringJUnit4ClassRunner.class)
|
||||
@SpringBootTest
|
||||
public class PermissionTest {
|
||||
|
||||
@Autowired
|
||||
private ApplicationContext context;
|
||||
|
||||
@Test
|
||||
public void test() {
|
||||
final String basicPackage = "org.linlinjava.litemall.admin";
|
||||
List<PermVo> permVoList = PermissionUtil.listPermissions(context, basicPackage);
|
||||
permVoList.stream().forEach(System.out::println);
|
||||
}
|
||||
}
|
||||
@@ -22,6 +22,7 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@tinymce/tinymce-vue": "1.1.0",
|
||||
"@riophae/vue-treeselect": "0.0.37",
|
||||
"v-charts": "1.19.0",
|
||||
"axios": "0.18.0",
|
||||
"clipboard": "1.7.1",
|
||||
|
||||
65
litemall-admin/src/api/role.js
Normal file
65
litemall-admin/src/api/role.js
Normal file
@@ -0,0 +1,65 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
export function listRole(query) {
|
||||
return request({
|
||||
url: '/role/list',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
export function createRole(data) {
|
||||
return request({
|
||||
url: '/role/create',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
export function readRole(data) {
|
||||
return request({
|
||||
url: '/role/read',
|
||||
method: 'get',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
export function updateRole(data) {
|
||||
return request({
|
||||
url: '/role/update',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
export function deleteRole(data) {
|
||||
return request({
|
||||
url: '/role/delete',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
export function getPermission(query) {
|
||||
return request({
|
||||
url: '/role/permissions',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
export function updatePermission(data) {
|
||||
return request({
|
||||
url: '/role/permissions',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
export function roleOptions(query) {
|
||||
return request({
|
||||
url: '/role/options',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
@@ -279,6 +279,12 @@ export const asyncRouterMap = [
|
||||
name: 'admin',
|
||||
meta: { title: '管理员', noCache: true }
|
||||
},
|
||||
{
|
||||
path: 'role',
|
||||
component: () => import('@/views/sys/role'),
|
||||
name: 'role',
|
||||
meta: { title: '角色管理', noCache: true }
|
||||
},
|
||||
{
|
||||
path: 'os',
|
||||
component: () => import('@/views/sys/os'),
|
||||
@@ -363,6 +369,12 @@ export const asyncRouterMap = [
|
||||
component: Layout,
|
||||
redirect: 'noredirect',
|
||||
children: [
|
||||
{
|
||||
path: 'my',
|
||||
component: () => import('@/views/profile/my'),
|
||||
name: 'my',
|
||||
meta: { title: '个人信息', noCache: true }
|
||||
},
|
||||
{
|
||||
path: 'password',
|
||||
component: () => import('@/views/profile/password'),
|
||||
|
||||
@@ -32,7 +32,7 @@ service.interceptors.response.use(
|
||||
const res = response.data
|
||||
|
||||
if (res.errno === 501) {
|
||||
MessageBox.alert('系统未登录,请重新登录', '未登录', {
|
||||
MessageBox.alert('系统未登录,请重新登录', '错误', {
|
||||
confirmButtonText: '确定',
|
||||
type: 'error'
|
||||
}).then(() => {
|
||||
@@ -53,6 +53,24 @@ service.interceptors.response.use(
|
||||
type: 'error'
|
||||
})
|
||||
return Promise.reject('error')
|
||||
} else if (res.errno === 504) {
|
||||
MessageBox.alert('更新数据已经失效,请刷新页面重新操作', '警告', {
|
||||
confirmButtonText: '确定',
|
||||
type: 'error'
|
||||
})
|
||||
return Promise.reject('error')
|
||||
} else if (res.errno === 505) {
|
||||
MessageBox.alert('更新失败,请再尝试一次', '警告', {
|
||||
confirmButtonText: '确定',
|
||||
type: 'error'
|
||||
})
|
||||
return Promise.reject('error')
|
||||
} else if (res.errno === 506) {
|
||||
MessageBox.alert('没有操作权限,请联系管理员授权', '错误', {
|
||||
confirmButtonText: '确定',
|
||||
type: 'error'
|
||||
})
|
||||
return Promise.reject('error')
|
||||
} else if (res.errno !== 0) {
|
||||
// 非5xx的错误属于业务错误,留给具体页面处理
|
||||
return Promise.reject(response)
|
||||
|
||||
@@ -21,6 +21,12 @@
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column align="center" label="管理员角色" prop="roleIds">
|
||||
<template slot-scope="scope">
|
||||
<el-tag v-for="roleId in scope.row.roleIds" :key="roleId" type="primary" style="margin-right: 20px;"> {{ formatRole(roleId) }} </el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column align="center" label="操作" class-name="small-padding fixed-width">
|
||||
<template slot-scope="scope">
|
||||
<el-button type="primary" size="mini" @click="handleUpdate(scope.row)">编辑</el-button>
|
||||
@@ -46,6 +52,15 @@
|
||||
<i v-else class="el-icon-plus avatar-uploader-icon"/>
|
||||
</el-upload>
|
||||
</el-form-item>
|
||||
<el-form-item label="管理员角色" prop="roleIds">
|
||||
<el-select v-model="dataForm.roleIds" multiple placeholder="请选择">
|
||||
<el-option
|
||||
v-for="item in roleOptions"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value"/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button @click="dialogFormVisible = false">取消</el-button>
|
||||
@@ -85,6 +100,7 @@
|
||||
|
||||
<script>
|
||||
import { listAdmin, createAdmin, updateAdmin, deleteAdmin } from '@/api/admin'
|
||||
import { roleOptions } from '@/api/role'
|
||||
import { uploadPath } from '@/api/storage'
|
||||
import { getToken } from '@/utils/auth'
|
||||
import Pagination from '@/components/Pagination' // Secondary package based on el-pagination
|
||||
@@ -97,6 +113,7 @@ export default {
|
||||
uploadPath,
|
||||
list: null,
|
||||
total: 0,
|
||||
roleOptions: null,
|
||||
listLoading: true,
|
||||
listQuery: {
|
||||
page: 1,
|
||||
@@ -109,7 +126,8 @@ export default {
|
||||
id: undefined,
|
||||
username: undefined,
|
||||
password: undefined,
|
||||
avatar: undefined
|
||||
avatar: undefined,
|
||||
roleIds: []
|
||||
},
|
||||
dialogFormVisible: false,
|
||||
dialogStatus: '',
|
||||
@@ -135,8 +153,21 @@ export default {
|
||||
},
|
||||
created() {
|
||||
this.getList()
|
||||
|
||||
roleOptions()
|
||||
.then(response => {
|
||||
this.roleOptions = response.data.data
|
||||
})
|
||||
},
|
||||
methods: {
|
||||
formatRole(roleId) {
|
||||
for (let i = 0; i < this.roleOptions.length; i++) {
|
||||
if (roleId === this.roleOptions[i].value) {
|
||||
return this.roleOptions[i].label
|
||||
}
|
||||
}
|
||||
return ''
|
||||
},
|
||||
getList() {
|
||||
this.listLoading = true
|
||||
listAdmin(this.listQuery)
|
||||
@@ -160,7 +191,8 @@ export default {
|
||||
id: undefined,
|
||||
username: undefined,
|
||||
password: undefined,
|
||||
avatar: undefined
|
||||
avatar: undefined,
|
||||
roleIds: []
|
||||
}
|
||||
},
|
||||
uploadAvatar: function(response) {
|
||||
|
||||
244
litemall-admin/src/views/sys/role.vue
Normal file
244
litemall-admin/src/views/sys/role.vue
Normal file
@@ -0,0 +1,244 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
|
||||
<!-- 查询和其他操作 -->
|
||||
<div class="filter-container">
|
||||
<el-input v-model="listQuery.rolename" clearable class="filter-item" style="width: 200px;" placeholder="请输入角色名称"/>
|
||||
<el-button class="filter-item" type="primary" icon="el-icon-search" @click="handleFilter">查找</el-button>
|
||||
<el-button class="filter-item" type="primary" icon="el-icon-edit" @click="handleCreate">添加</el-button>
|
||||
</div>
|
||||
|
||||
<!-- 查询结果 -->
|
||||
<el-table v-loading="listLoading" :data="list" size="small" element-loading-text="正在查询中。。。" border fit highlight-current-row>
|
||||
<el-table-column align="center" label="角色名称" prop="name" sortable/>
|
||||
|
||||
<el-table-column align="center" label="说明" prop="desc"/>
|
||||
|
||||
<el-table-column align="center" label="操作" class-name="small-padding fixed-width">
|
||||
<template slot-scope="scope">
|
||||
<el-button type="primary" size="mini" @click="handleUpdate(scope.row)">编辑</el-button>
|
||||
<el-button type="danger" size="mini" @click="handleDelete(scope.row)">删除</el-button>
|
||||
<el-button type="primary" size="mini" @click="handlePermission(scope.row)">授权</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<pagination v-show="total>0" :total="total" :page.sync="listQuery.page" :limit.sync="listQuery.limit" @pagination="getList" />
|
||||
|
||||
<!-- 添加或修改对话框 -->
|
||||
<el-dialog :title="textMap[dialogStatus]" :visible.sync="dialogFormVisible">
|
||||
<el-form ref="dataForm" :rules="rules" :model="dataForm" status-icon label-position="left" label-width="100px" style="width: 400px; margin-left:50px;">
|
||||
<el-form-item label="角色名称" prop="name">
|
||||
<el-input v-model="dataForm.name"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="说明" prop="desc">
|
||||
<el-input v-model="dataForm.desc"/>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button @click="dialogFormVisible = false">取消</el-button>
|
||||
<el-button v-if="dialogStatus=='create'" type="primary" @click="createData">确定</el-button>
|
||||
<el-button v-else type="primary" @click="updateData">确定</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
|
||||
<!-- 权限配置对话框 -->
|
||||
<el-dialog :visible.sync="permissionDialogFormVisible" title="权限配置">
|
||||
<el-tree
|
||||
ref="tree"
|
||||
:data="systemPermissions"
|
||||
:default-checked-keys="assignedPermissions"
|
||||
show-checkbox
|
||||
node-key="id"
|
||||
highlight-current/>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button @click="permissionDialogFormVisible = false">取消</el-button>
|
||||
<el-button type="primary" @click="updatePermission">确定</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { listRole, createRole, updateRole, deleteRole, getPermission, updatePermission } from '@/api/role'
|
||||
import Pagination from '@/components/Pagination'
|
||||
export default {
|
||||
name: 'Role',
|
||||
components: { Pagination },
|
||||
data() {
|
||||
return {
|
||||
list: null,
|
||||
total: 0,
|
||||
listLoading: true,
|
||||
listQuery: {
|
||||
page: 1,
|
||||
limit: 20,
|
||||
name: undefined,
|
||||
sort: 'add_time',
|
||||
order: 'desc'
|
||||
},
|
||||
dataForm: {
|
||||
id: undefined,
|
||||
name: undefined,
|
||||
desc: undefined
|
||||
},
|
||||
dialogFormVisible: false,
|
||||
dialogStatus: '',
|
||||
textMap: {
|
||||
update: '编辑',
|
||||
create: '创建'
|
||||
},
|
||||
rules: {
|
||||
name: [
|
||||
{ required: true, message: '角色名称不能为空', trigger: 'blur' }
|
||||
]
|
||||
},
|
||||
permissionDialogFormVisible: false,
|
||||
systemPermissions: null,
|
||||
assignedPermissions: null,
|
||||
permissionForm: {
|
||||
roleId: undefined,
|
||||
permissions: []
|
||||
}
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.getList()
|
||||
},
|
||||
methods: {
|
||||
getList() {
|
||||
this.listLoading = true
|
||||
listRole(this.listQuery)
|
||||
.then(response => {
|
||||
this.list = response.data.data.items
|
||||
this.total = response.data.data.total
|
||||
this.listLoading = false
|
||||
})
|
||||
.catch(() => {
|
||||
this.list = []
|
||||
this.total = 0
|
||||
this.listLoading = false
|
||||
})
|
||||
},
|
||||
handleFilter() {
|
||||
this.listQuery.page = 1
|
||||
this.getList()
|
||||
},
|
||||
resetForm() {
|
||||
this.dataForm = {
|
||||
id: undefined,
|
||||
name: undefined,
|
||||
desc: undefined
|
||||
}
|
||||
},
|
||||
handleCreate() {
|
||||
this.resetForm()
|
||||
this.dialogStatus = 'create'
|
||||
this.dialogFormVisible = true
|
||||
this.$nextTick(() => {
|
||||
this.$refs['dataForm'].clearValidate()
|
||||
})
|
||||
},
|
||||
createData() {
|
||||
this.$refs['dataForm'].validate(valid => {
|
||||
if (valid) {
|
||||
createRole(this.dataForm)
|
||||
.then(response => {
|
||||
this.list.unshift(response.data.data)
|
||||
this.dialogFormVisible = false
|
||||
this.$notify.success({
|
||||
title: '成功',
|
||||
message: '添加角色成功'
|
||||
})
|
||||
})
|
||||
.catch(response => {
|
||||
this.$notify.error({
|
||||
title: '失败',
|
||||
message: response.data.errmsg
|
||||
})
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
handleUpdate(row) {
|
||||
this.dataForm = Object.assign({}, row)
|
||||
this.dialogStatus = 'update'
|
||||
this.dialogFormVisible = true
|
||||
this.$nextTick(() => {
|
||||
this.$refs['dataForm'].clearValidate()
|
||||
})
|
||||
},
|
||||
updateData() {
|
||||
this.$refs['dataForm'].validate(valid => {
|
||||
if (valid) {
|
||||
updateRole(this.dataForm)
|
||||
.then(() => {
|
||||
for (const v of this.list) {
|
||||
if (v.id === this.dataForm.id) {
|
||||
const index = this.list.indexOf(v)
|
||||
this.list.splice(index, 1, this.dataForm)
|
||||
break
|
||||
}
|
||||
}
|
||||
this.dialogFormVisible = false
|
||||
this.$notify.success({
|
||||
title: '成功',
|
||||
message: '更新管理员成功'
|
||||
})
|
||||
})
|
||||
.catch(response => {
|
||||
this.$notify.error({
|
||||
title: '失败',
|
||||
message: response.data.errmsg
|
||||
})
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
handleDelete(row) {
|
||||
deleteRole(row)
|
||||
.then(response => {
|
||||
this.$notify.success({
|
||||
title: '成功',
|
||||
message: '删除管理员成功'
|
||||
})
|
||||
const index = this.list.indexOf(row)
|
||||
this.list.splice(index, 1)
|
||||
})
|
||||
.catch(response => {
|
||||
this.$notify.error({
|
||||
title: '失败',
|
||||
message: response.data.errmsg
|
||||
})
|
||||
})
|
||||
},
|
||||
handlePermission(row) {
|
||||
this.permissionDialogFormVisible = true
|
||||
this.permissionForm.roleId = row.id
|
||||
getPermission({ roleId: row.id })
|
||||
.then(response => {
|
||||
this.systemPermissions = response.data.data.systemPermissions
|
||||
this.assignedPermissions = response.data.data.assignedPermissions
|
||||
})
|
||||
},
|
||||
updatePermission() {
|
||||
this.permissionForm.permissions = this.$refs.tree.getCheckedKeys(true)
|
||||
updatePermission(this.permissionForm)
|
||||
.then(response => {
|
||||
this.permissionDialogFormVisible = false
|
||||
this.$notify.success({
|
||||
title: '成功',
|
||||
message: '授权成功'
|
||||
})
|
||||
})
|
||||
.catch(response => {
|
||||
this.$notify.error({
|
||||
title: '失败',
|
||||
message: response.data.errmsg
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -64,6 +64,8 @@
|
||||
</table>
|
||||
<table tableName="litemall_admin">
|
||||
<generatedKey column="id" sqlStatement="MySql" identity="true"/>
|
||||
<columnOverride column="role_ids" javaType="java.lang.Integer[]"
|
||||
typeHandler="org.linlinjava.litemall.db.mybatis.JsonIntegerArrayTypeHandler"/>
|
||||
</table>
|
||||
<table tableName="litemall_brand">
|
||||
<generatedKey column="id" sqlStatement="MySql" identity="true"/>
|
||||
@@ -166,5 +168,11 @@
|
||||
<table tableName="litemall_coupon_user">
|
||||
<generatedKey column="id" sqlStatement="MySql" identity="true"/>
|
||||
</table>
|
||||
<table tableName="litemall_role">
|
||||
<generatedKey column="id" sqlStatement="MySql" identity="true"/>
|
||||
</table>
|
||||
<table tableName="litemall_permission">
|
||||
<generatedKey column="id" sqlStatement="MySql" identity="true"/>
|
||||
</table>
|
||||
</context>
|
||||
</generatorConfiguration>
|
||||
@@ -0,0 +1,159 @@
|
||||
package org.linlinjava.litemall.db.dao;
|
||||
|
||||
import java.util.List;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.linlinjava.litemall.db.domain.LitemallPermission;
|
||||
import org.linlinjava.litemall.db.domain.LitemallPermissionExample;
|
||||
|
||||
public interface LitemallPermissionMapper {
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method corresponds to the database table litemall_permission
|
||||
*
|
||||
* @mbg.generated
|
||||
*/
|
||||
long countByExample(LitemallPermissionExample example);
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method corresponds to the database table litemall_permission
|
||||
*
|
||||
* @mbg.generated
|
||||
*/
|
||||
int deleteByExample(LitemallPermissionExample example);
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method corresponds to the database table litemall_permission
|
||||
*
|
||||
* @mbg.generated
|
||||
*/
|
||||
int deleteByPrimaryKey(Integer id);
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method corresponds to the database table litemall_permission
|
||||
*
|
||||
* @mbg.generated
|
||||
*/
|
||||
int insert(LitemallPermission record);
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method corresponds to the database table litemall_permission
|
||||
*
|
||||
* @mbg.generated
|
||||
*/
|
||||
int insertSelective(LitemallPermission record);
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method corresponds to the database table litemall_permission
|
||||
*
|
||||
* @mbg.generated
|
||||
* @project https://github.com/itfsw/mybatis-generator-plugin
|
||||
*/
|
||||
LitemallPermission selectOneByExample(LitemallPermissionExample example);
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method corresponds to the database table litemall_permission
|
||||
*
|
||||
* @mbg.generated
|
||||
* @project https://github.com/itfsw/mybatis-generator-plugin
|
||||
*/
|
||||
LitemallPermission selectOneByExampleSelective(@Param("example") LitemallPermissionExample example, @Param("selective") LitemallPermission.Column ... selective);
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method corresponds to the database table litemall_permission
|
||||
*
|
||||
* @mbg.generated
|
||||
* @project https://github.com/itfsw/mybatis-generator-plugin
|
||||
*/
|
||||
List<LitemallPermission> selectByExampleSelective(@Param("example") LitemallPermissionExample example, @Param("selective") LitemallPermission.Column ... selective);
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method corresponds to the database table litemall_permission
|
||||
*
|
||||
* @mbg.generated
|
||||
*/
|
||||
List<LitemallPermission> selectByExample(LitemallPermissionExample example);
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method corresponds to the database table litemall_permission
|
||||
*
|
||||
* @mbg.generated
|
||||
* @project https://github.com/itfsw/mybatis-generator-plugin
|
||||
*/
|
||||
LitemallPermission selectByPrimaryKeySelective(@Param("id") Integer id, @Param("selective") LitemallPermission.Column ... selective);
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method corresponds to the database table litemall_permission
|
||||
*
|
||||
* @mbg.generated
|
||||
*/
|
||||
LitemallPermission selectByPrimaryKey(Integer id);
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method corresponds to the database table litemall_permission
|
||||
*
|
||||
* @mbg.generated
|
||||
* @project https://github.com/itfsw/mybatis-generator-plugin
|
||||
*/
|
||||
LitemallPermission selectByPrimaryKeyWithLogicalDelete(@Param("id") Integer id, @Param("andLogicalDeleted") boolean andLogicalDeleted);
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method corresponds to the database table litemall_permission
|
||||
*
|
||||
* @mbg.generated
|
||||
*/
|
||||
int updateByExampleSelective(@Param("record") LitemallPermission record, @Param("example") LitemallPermissionExample example);
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method corresponds to the database table litemall_permission
|
||||
*
|
||||
* @mbg.generated
|
||||
*/
|
||||
int updateByExample(@Param("record") LitemallPermission record, @Param("example") LitemallPermissionExample example);
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method corresponds to the database table litemall_permission
|
||||
*
|
||||
* @mbg.generated
|
||||
*/
|
||||
int updateByPrimaryKeySelective(LitemallPermission record);
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method corresponds to the database table litemall_permission
|
||||
*
|
||||
* @mbg.generated
|
||||
*/
|
||||
int updateByPrimaryKey(LitemallPermission record);
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method corresponds to the database table litemall_permission
|
||||
*
|
||||
* @mbg.generated
|
||||
* @project https://github.com/itfsw/mybatis-generator-plugin
|
||||
*/
|
||||
int logicalDeleteByExample(@Param("example") LitemallPermissionExample example);
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method corresponds to the database table litemall_permission
|
||||
*
|
||||
* @mbg.generated
|
||||
* @project https://github.com/itfsw/mybatis-generator-plugin
|
||||
*/
|
||||
int logicalDeleteByPrimaryKey(Integer id);
|
||||
}
|
||||
@@ -0,0 +1,159 @@
|
||||
package org.linlinjava.litemall.db.dao;
|
||||
|
||||
import java.util.List;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.linlinjava.litemall.db.domain.LitemallRole;
|
||||
import org.linlinjava.litemall.db.domain.LitemallRoleExample;
|
||||
|
||||
public interface LitemallRoleMapper {
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method corresponds to the database table litemall_role
|
||||
*
|
||||
* @mbg.generated
|
||||
*/
|
||||
long countByExample(LitemallRoleExample example);
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method corresponds to the database table litemall_role
|
||||
*
|
||||
* @mbg.generated
|
||||
*/
|
||||
int deleteByExample(LitemallRoleExample example);
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method corresponds to the database table litemall_role
|
||||
*
|
||||
* @mbg.generated
|
||||
*/
|
||||
int deleteByPrimaryKey(Integer id);
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method corresponds to the database table litemall_role
|
||||
*
|
||||
* @mbg.generated
|
||||
*/
|
||||
int insert(LitemallRole record);
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method corresponds to the database table litemall_role
|
||||
*
|
||||
* @mbg.generated
|
||||
*/
|
||||
int insertSelective(LitemallRole record);
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method corresponds to the database table litemall_role
|
||||
*
|
||||
* @mbg.generated
|
||||
* @project https://github.com/itfsw/mybatis-generator-plugin
|
||||
*/
|
||||
LitemallRole selectOneByExample(LitemallRoleExample example);
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method corresponds to the database table litemall_role
|
||||
*
|
||||
* @mbg.generated
|
||||
* @project https://github.com/itfsw/mybatis-generator-plugin
|
||||
*/
|
||||
LitemallRole selectOneByExampleSelective(@Param("example") LitemallRoleExample example, @Param("selective") LitemallRole.Column ... selective);
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method corresponds to the database table litemall_role
|
||||
*
|
||||
* @mbg.generated
|
||||
* @project https://github.com/itfsw/mybatis-generator-plugin
|
||||
*/
|
||||
List<LitemallRole> selectByExampleSelective(@Param("example") LitemallRoleExample example, @Param("selective") LitemallRole.Column ... selective);
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method corresponds to the database table litemall_role
|
||||
*
|
||||
* @mbg.generated
|
||||
*/
|
||||
List<LitemallRole> selectByExample(LitemallRoleExample example);
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method corresponds to the database table litemall_role
|
||||
*
|
||||
* @mbg.generated
|
||||
* @project https://github.com/itfsw/mybatis-generator-plugin
|
||||
*/
|
||||
LitemallRole selectByPrimaryKeySelective(@Param("id") Integer id, @Param("selective") LitemallRole.Column ... selective);
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method corresponds to the database table litemall_role
|
||||
*
|
||||
* @mbg.generated
|
||||
*/
|
||||
LitemallRole selectByPrimaryKey(Integer id);
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method corresponds to the database table litemall_role
|
||||
*
|
||||
* @mbg.generated
|
||||
* @project https://github.com/itfsw/mybatis-generator-plugin
|
||||
*/
|
||||
LitemallRole selectByPrimaryKeyWithLogicalDelete(@Param("id") Integer id, @Param("andLogicalDeleted") boolean andLogicalDeleted);
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method corresponds to the database table litemall_role
|
||||
*
|
||||
* @mbg.generated
|
||||
*/
|
||||
int updateByExampleSelective(@Param("record") LitemallRole record, @Param("example") LitemallRoleExample example);
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method corresponds to the database table litemall_role
|
||||
*
|
||||
* @mbg.generated
|
||||
*/
|
||||
int updateByExample(@Param("record") LitemallRole record, @Param("example") LitemallRoleExample example);
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method corresponds to the database table litemall_role
|
||||
*
|
||||
* @mbg.generated
|
||||
*/
|
||||
int updateByPrimaryKeySelective(LitemallRole record);
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method corresponds to the database table litemall_role
|
||||
*
|
||||
* @mbg.generated
|
||||
*/
|
||||
int updateByPrimaryKey(LitemallRole record);
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method corresponds to the database table litemall_role
|
||||
*
|
||||
* @mbg.generated
|
||||
* @project https://github.com/itfsw/mybatis-generator-plugin
|
||||
*/
|
||||
int logicalDeleteByExample(@Param("example") LitemallRoleExample example);
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method corresponds to the database table litemall_role
|
||||
*
|
||||
* @mbg.generated
|
||||
* @project https://github.com/itfsw/mybatis-generator-plugin
|
||||
*/
|
||||
int logicalDeleteByPrimaryKey(Integer id);
|
||||
}
|
||||
@@ -104,6 +104,15 @@ public class LitemallAdmin {
|
||||
*/
|
||||
private Boolean deleted;
|
||||
|
||||
/**
|
||||
*
|
||||
* This field was generated by MyBatis Generator.
|
||||
* This field corresponds to the database column litemall_admin.role_ids
|
||||
*
|
||||
* @mbg.generated
|
||||
*/
|
||||
private Integer[] roleIds;
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method returns the value of the database column litemall_admin.id
|
||||
@@ -320,6 +329,30 @@ public class LitemallAdmin {
|
||||
this.deleted = deleted;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method returns the value of the database column litemall_admin.role_ids
|
||||
*
|
||||
* @return the value of litemall_admin.role_ids
|
||||
*
|
||||
* @mbg.generated
|
||||
*/
|
||||
public Integer[] getRoleIds() {
|
||||
return roleIds;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method sets the value of the database column litemall_admin.role_ids
|
||||
*
|
||||
* @param roleIds the value for litemall_admin.role_ids
|
||||
*
|
||||
* @mbg.generated
|
||||
*/
|
||||
public void setRoleIds(Integer[] roleIds) {
|
||||
this.roleIds = roleIds;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method corresponds to the database table litemall_admin
|
||||
@@ -341,6 +374,7 @@ public class LitemallAdmin {
|
||||
sb.append(", addTime=").append(addTime);
|
||||
sb.append(", updateTime=").append(updateTime);
|
||||
sb.append(", deleted=").append(deleted);
|
||||
sb.append(", roleIds=").append(roleIds);
|
||||
sb.append("]");
|
||||
return sb.toString();
|
||||
}
|
||||
@@ -371,7 +405,8 @@ public class LitemallAdmin {
|
||||
&& (this.getAvatar() == null ? other.getAvatar() == null : this.getAvatar().equals(other.getAvatar()))
|
||||
&& (this.getAddTime() == null ? other.getAddTime() == null : this.getAddTime().equals(other.getAddTime()))
|
||||
&& (this.getUpdateTime() == null ? other.getUpdateTime() == null : this.getUpdateTime().equals(other.getUpdateTime()))
|
||||
&& (this.getDeleted() == null ? other.getDeleted() == null : this.getDeleted().equals(other.getDeleted()));
|
||||
&& (this.getDeleted() == null ? other.getDeleted() == null : this.getDeleted().equals(other.getDeleted()))
|
||||
&& (Arrays.equals(this.getRoleIds(), other.getRoleIds()));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -393,6 +428,7 @@ public class LitemallAdmin {
|
||||
result = prime * result + ((getAddTime() == null) ? 0 : getAddTime().hashCode());
|
||||
result = prime * result + ((getUpdateTime() == null) ? 0 : getUpdateTime().hashCode());
|
||||
result = prime * result + ((getDeleted() == null) ? 0 : getDeleted().hashCode());
|
||||
result = prime * result + (Arrays.hashCode(getRoleIds()));
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -423,7 +459,8 @@ public class LitemallAdmin {
|
||||
avatar("avatar", "avatar", "VARCHAR", false),
|
||||
addTime("add_time", "addTime", "TIMESTAMP", false),
|
||||
updateTime("update_time", "updateTime", "TIMESTAMP", false),
|
||||
deleted("deleted", "deleted", "BIT", false);
|
||||
deleted("deleted", "deleted", "BIT", false),
|
||||
roleIds("role_ids", "roleIds", "VARCHAR", false);
|
||||
|
||||
/**
|
||||
* This field was generated by MyBatis Generator.
|
||||
|
||||
@@ -198,19 +198,50 @@ public class LitemallAdminExample {
|
||||
* @mbg.generated
|
||||
*/
|
||||
protected abstract static class GeneratedCriteria {
|
||||
protected List<Criterion> roleIdsCriteria;
|
||||
|
||||
protected List<Criterion> allCriteria;
|
||||
|
||||
protected List<Criterion> criteria;
|
||||
|
||||
protected GeneratedCriteria() {
|
||||
super();
|
||||
criteria = new ArrayList<Criterion>();
|
||||
roleIdsCriteria = new ArrayList<Criterion>();
|
||||
}
|
||||
|
||||
public List<Criterion> getRoleIdsCriteria() {
|
||||
return roleIdsCriteria;
|
||||
}
|
||||
|
||||
protected void addRoleIdsCriterion(String condition, Object value, String property) {
|
||||
if (value == null) {
|
||||
throw new RuntimeException("Value for " + property + " cannot be null");
|
||||
}
|
||||
roleIdsCriteria.add(new Criterion(condition, value, "org.linlinjava.litemall.db.mybatis.JsonIntegerArrayTypeHandler"));
|
||||
allCriteria = null;
|
||||
}
|
||||
|
||||
protected void addRoleIdsCriterion(String condition, Integer[] value1, Integer[] value2, String property) {
|
||||
if (value1 == null || value2 == null) {
|
||||
throw new RuntimeException("Between values for " + property + " cannot be null");
|
||||
}
|
||||
roleIdsCriteria.add(new Criterion(condition, value1, value2, "org.linlinjava.litemall.db.mybatis.JsonIntegerArrayTypeHandler"));
|
||||
allCriteria = null;
|
||||
}
|
||||
|
||||
public boolean isValid() {
|
||||
return criteria.size() > 0;
|
||||
return criteria.size() > 0
|
||||
|| roleIdsCriteria.size() > 0;
|
||||
}
|
||||
|
||||
public List<Criterion> getAllCriteria() {
|
||||
return criteria;
|
||||
if (allCriteria == null) {
|
||||
allCriteria = new ArrayList<Criterion>();
|
||||
allCriteria.addAll(criteria);
|
||||
allCriteria.addAll(roleIdsCriteria);
|
||||
}
|
||||
return allCriteria;
|
||||
}
|
||||
|
||||
public List<Criterion> getCriteria() {
|
||||
@@ -222,6 +253,7 @@ public class LitemallAdminExample {
|
||||
throw new RuntimeException("Value for condition cannot be null");
|
||||
}
|
||||
criteria.add(new Criterion(condition));
|
||||
allCriteria = null;
|
||||
}
|
||||
|
||||
protected void addCriterion(String condition, Object value, String property) {
|
||||
@@ -229,6 +261,7 @@ public class LitemallAdminExample {
|
||||
throw new RuntimeException("Value for " + property + " cannot be null");
|
||||
}
|
||||
criteria.add(new Criterion(condition, value));
|
||||
allCriteria = null;
|
||||
}
|
||||
|
||||
protected void addCriterion(String condition, Object value1, Object value2, String property) {
|
||||
@@ -236,6 +269,7 @@ public class LitemallAdminExample {
|
||||
throw new RuntimeException("Between values for " + property + " cannot be null");
|
||||
}
|
||||
criteria.add(new Criterion(condition, value1, value2));
|
||||
allCriteria = null;
|
||||
}
|
||||
|
||||
public Criteria andIdIsNull() {
|
||||
@@ -1465,6 +1499,148 @@ public class LitemallAdminExample {
|
||||
addCriterion("deleted not between", value1, value2, "deleted");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andRoleIdsIsNull() {
|
||||
addCriterion("role_ids is null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andRoleIdsIsNotNull() {
|
||||
addCriterion("role_ids is not null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andRoleIdsEqualTo(Integer[] value) {
|
||||
addRoleIdsCriterion("role_ids =", value, "roleIds");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method corresponds to the database table litemall_admin
|
||||
*
|
||||
* @mbg.generated
|
||||
* @project https://github.com/itfsw/mybatis-generator-plugin
|
||||
*/
|
||||
public Criteria andRoleIdsEqualToColumn(LitemallAdmin.Column column) {
|
||||
addCriterion(new StringBuilder("role_ids = ").append(column.getEscapedColumnName()).toString());
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andRoleIdsNotEqualTo(Integer[] value) {
|
||||
addRoleIdsCriterion("role_ids <>", value, "roleIds");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method corresponds to the database table litemall_admin
|
||||
*
|
||||
* @mbg.generated
|
||||
* @project https://github.com/itfsw/mybatis-generator-plugin
|
||||
*/
|
||||
public Criteria andRoleIdsNotEqualToColumn(LitemallAdmin.Column column) {
|
||||
addCriterion(new StringBuilder("role_ids <> ").append(column.getEscapedColumnName()).toString());
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andRoleIdsGreaterThan(Integer[] value) {
|
||||
addRoleIdsCriterion("role_ids >", value, "roleIds");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method corresponds to the database table litemall_admin
|
||||
*
|
||||
* @mbg.generated
|
||||
* @project https://github.com/itfsw/mybatis-generator-plugin
|
||||
*/
|
||||
public Criteria andRoleIdsGreaterThanColumn(LitemallAdmin.Column column) {
|
||||
addCriterion(new StringBuilder("role_ids > ").append(column.getEscapedColumnName()).toString());
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andRoleIdsGreaterThanOrEqualTo(Integer[] value) {
|
||||
addRoleIdsCriterion("role_ids >=", value, "roleIds");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method corresponds to the database table litemall_admin
|
||||
*
|
||||
* @mbg.generated
|
||||
* @project https://github.com/itfsw/mybatis-generator-plugin
|
||||
*/
|
||||
public Criteria andRoleIdsGreaterThanOrEqualToColumn(LitemallAdmin.Column column) {
|
||||
addCriterion(new StringBuilder("role_ids >= ").append(column.getEscapedColumnName()).toString());
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andRoleIdsLessThan(Integer[] value) {
|
||||
addRoleIdsCriterion("role_ids <", value, "roleIds");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method corresponds to the database table litemall_admin
|
||||
*
|
||||
* @mbg.generated
|
||||
* @project https://github.com/itfsw/mybatis-generator-plugin
|
||||
*/
|
||||
public Criteria andRoleIdsLessThanColumn(LitemallAdmin.Column column) {
|
||||
addCriterion(new StringBuilder("role_ids < ").append(column.getEscapedColumnName()).toString());
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andRoleIdsLessThanOrEqualTo(Integer[] value) {
|
||||
addRoleIdsCriterion("role_ids <=", value, "roleIds");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method corresponds to the database table litemall_admin
|
||||
*
|
||||
* @mbg.generated
|
||||
* @project https://github.com/itfsw/mybatis-generator-plugin
|
||||
*/
|
||||
public Criteria andRoleIdsLessThanOrEqualToColumn(LitemallAdmin.Column column) {
|
||||
addCriterion(new StringBuilder("role_ids <= ").append(column.getEscapedColumnName()).toString());
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andRoleIdsLike(Integer[] value) {
|
||||
addRoleIdsCriterion("role_ids like", value, "roleIds");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andRoleIdsNotLike(Integer[] value) {
|
||||
addRoleIdsCriterion("role_ids not like", value, "roleIds");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andRoleIdsIn(List<Integer[]> values) {
|
||||
addRoleIdsCriterion("role_ids in", values, "roleIds");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andRoleIdsNotIn(List<Integer[]> values) {
|
||||
addRoleIdsCriterion("role_ids not in", values, "roleIds");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andRoleIdsBetween(Integer[] value1, Integer[] value2) {
|
||||
addRoleIdsCriterion("role_ids between", value1, value2, "roleIds");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andRoleIdsNotBetween(Integer[] value1, Integer[] value2) {
|
||||
addRoleIdsCriterion("role_ids not between", value1, value2, "roleIds");
|
||||
return (Criteria) this;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -0,0 +1,481 @@
|
||||
package org.linlinjava.litemall.db.domain;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
|
||||
public class LitemallPermission {
|
||||
/**
|
||||
* This field was generated by MyBatis Generator.
|
||||
* This field corresponds to the database table litemall_permission
|
||||
*
|
||||
* @mbg.generated
|
||||
* @project https://github.com/itfsw/mybatis-generator-plugin
|
||||
*/
|
||||
public static final Boolean NOT_DELETED = false;
|
||||
|
||||
/**
|
||||
* This field was generated by MyBatis Generator.
|
||||
* This field corresponds to the database table litemall_permission
|
||||
*
|
||||
* @mbg.generated
|
||||
* @project https://github.com/itfsw/mybatis-generator-plugin
|
||||
*/
|
||||
public static final Boolean IS_DELETED = true;
|
||||
|
||||
/**
|
||||
*
|
||||
* This field was generated by MyBatis Generator.
|
||||
* This field corresponds to the database column litemall_permission.id
|
||||
*
|
||||
* @mbg.generated
|
||||
*/
|
||||
private Integer id;
|
||||
|
||||
/**
|
||||
*
|
||||
* This field was generated by MyBatis Generator.
|
||||
* This field corresponds to the database column litemall_permission.role_id
|
||||
*
|
||||
* @mbg.generated
|
||||
*/
|
||||
private Integer roleId;
|
||||
|
||||
/**
|
||||
*
|
||||
* This field was generated by MyBatis Generator.
|
||||
* This field corresponds to the database column litemall_permission.permission
|
||||
*
|
||||
* @mbg.generated
|
||||
*/
|
||||
private String permission;
|
||||
|
||||
/**
|
||||
*
|
||||
* This field was generated by MyBatis Generator.
|
||||
* This field corresponds to the database column litemall_permission.add_time
|
||||
*
|
||||
* @mbg.generated
|
||||
*/
|
||||
private LocalDateTime addTime;
|
||||
|
||||
/**
|
||||
*
|
||||
* This field was generated by MyBatis Generator.
|
||||
* This field corresponds to the database column litemall_permission.update_time
|
||||
*
|
||||
* @mbg.generated
|
||||
*/
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
/**
|
||||
*
|
||||
* This field was generated by MyBatis Generator.
|
||||
* This field corresponds to the database column litemall_permission.deleted
|
||||
*
|
||||
* @mbg.generated
|
||||
*/
|
||||
private Boolean deleted;
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method returns the value of the database column litemall_permission.id
|
||||
*
|
||||
* @return the value of litemall_permission.id
|
||||
*
|
||||
* @mbg.generated
|
||||
*/
|
||||
public Integer getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method sets the value of the database column litemall_permission.id
|
||||
*
|
||||
* @param id the value for litemall_permission.id
|
||||
*
|
||||
* @mbg.generated
|
||||
*/
|
||||
public void setId(Integer id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method returns the value of the database column litemall_permission.role_id
|
||||
*
|
||||
* @return the value of litemall_permission.role_id
|
||||
*
|
||||
* @mbg.generated
|
||||
*/
|
||||
public Integer getRoleId() {
|
||||
return roleId;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method sets the value of the database column litemall_permission.role_id
|
||||
*
|
||||
* @param roleId the value for litemall_permission.role_id
|
||||
*
|
||||
* @mbg.generated
|
||||
*/
|
||||
public void setRoleId(Integer roleId) {
|
||||
this.roleId = roleId;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method returns the value of the database column litemall_permission.permission
|
||||
*
|
||||
* @return the value of litemall_permission.permission
|
||||
*
|
||||
* @mbg.generated
|
||||
*/
|
||||
public String getPermission() {
|
||||
return permission;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method sets the value of the database column litemall_permission.permission
|
||||
*
|
||||
* @param permission the value for litemall_permission.permission
|
||||
*
|
||||
* @mbg.generated
|
||||
*/
|
||||
public void setPermission(String permission) {
|
||||
this.permission = permission;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method returns the value of the database column litemall_permission.add_time
|
||||
*
|
||||
* @return the value of litemall_permission.add_time
|
||||
*
|
||||
* @mbg.generated
|
||||
*/
|
||||
public LocalDateTime getAddTime() {
|
||||
return addTime;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method sets the value of the database column litemall_permission.add_time
|
||||
*
|
||||
* @param addTime the value for litemall_permission.add_time
|
||||
*
|
||||
* @mbg.generated
|
||||
*/
|
||||
public void setAddTime(LocalDateTime addTime) {
|
||||
this.addTime = addTime;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method returns the value of the database column litemall_permission.update_time
|
||||
*
|
||||
* @return the value of litemall_permission.update_time
|
||||
*
|
||||
* @mbg.generated
|
||||
*/
|
||||
public LocalDateTime getUpdateTime() {
|
||||
return updateTime;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method sets the value of the database column litemall_permission.update_time
|
||||
*
|
||||
* @param updateTime the value for litemall_permission.update_time
|
||||
*
|
||||
* @mbg.generated
|
||||
*/
|
||||
public void setUpdateTime(LocalDateTime updateTime) {
|
||||
this.updateTime = updateTime;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method returns the value of the database column litemall_permission.deleted
|
||||
*
|
||||
* @return the value of litemall_permission.deleted
|
||||
*
|
||||
* @mbg.generated
|
||||
*/
|
||||
public Boolean getDeleted() {
|
||||
return deleted;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method sets the value of the database column litemall_permission.deleted
|
||||
*
|
||||
* @param deleted the value for litemall_permission.deleted
|
||||
*
|
||||
* @mbg.generated
|
||||
*/
|
||||
public void setDeleted(Boolean deleted) {
|
||||
this.deleted = deleted;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method corresponds to the database table litemall_permission
|
||||
*
|
||||
* @mbg.generated
|
||||
*/
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append(getClass().getSimpleName());
|
||||
sb.append(" [");
|
||||
sb.append("Hash = ").append(hashCode());
|
||||
sb.append(", id=").append(id);
|
||||
sb.append(", roleId=").append(roleId);
|
||||
sb.append(", permission=").append(permission);
|
||||
sb.append(", addTime=").append(addTime);
|
||||
sb.append(", updateTime=").append(updateTime);
|
||||
sb.append(", deleted=").append(deleted);
|
||||
sb.append("]");
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method corresponds to the database table litemall_permission
|
||||
*
|
||||
* @mbg.generated
|
||||
*/
|
||||
@Override
|
||||
public boolean equals(Object that) {
|
||||
if (this == that) {
|
||||
return true;
|
||||
}
|
||||
if (that == null) {
|
||||
return false;
|
||||
}
|
||||
if (getClass() != that.getClass()) {
|
||||
return false;
|
||||
}
|
||||
LitemallPermission other = (LitemallPermission) that;
|
||||
return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
|
||||
&& (this.getRoleId() == null ? other.getRoleId() == null : this.getRoleId().equals(other.getRoleId()))
|
||||
&& (this.getPermission() == null ? other.getPermission() == null : this.getPermission().equals(other.getPermission()))
|
||||
&& (this.getAddTime() == null ? other.getAddTime() == null : this.getAddTime().equals(other.getAddTime()))
|
||||
&& (this.getUpdateTime() == null ? other.getUpdateTime() == null : this.getUpdateTime().equals(other.getUpdateTime()))
|
||||
&& (this.getDeleted() == null ? other.getDeleted() == null : this.getDeleted().equals(other.getDeleted()));
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method corresponds to the database table litemall_permission
|
||||
*
|
||||
* @mbg.generated
|
||||
*/
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
|
||||
result = prime * result + ((getRoleId() == null) ? 0 : getRoleId().hashCode());
|
||||
result = prime * result + ((getPermission() == null) ? 0 : getPermission().hashCode());
|
||||
result = prime * result + ((getAddTime() == null) ? 0 : getAddTime().hashCode());
|
||||
result = prime * result + ((getUpdateTime() == null) ? 0 : getUpdateTime().hashCode());
|
||||
result = prime * result + ((getDeleted() == null) ? 0 : getDeleted().hashCode());
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method corresponds to the database table litemall_permission
|
||||
*
|
||||
* @mbg.generated
|
||||
* @project https://github.com/itfsw/mybatis-generator-plugin
|
||||
*/
|
||||
public void andLogicalDeleted(boolean deleted) {
|
||||
setDeleted(deleted ? IS_DELETED : NOT_DELETED);
|
||||
}
|
||||
|
||||
/**
|
||||
* This enum was generated by MyBatis Generator.
|
||||
* This enum corresponds to the database table litemall_permission
|
||||
*
|
||||
* @mbg.generated
|
||||
* @project https://github.com/itfsw/mybatis-generator-plugin
|
||||
*/
|
||||
public enum Column {
|
||||
id("id", "id", "INTEGER", false),
|
||||
roleId("role_id", "roleId", "INTEGER", false),
|
||||
permission("permission", "permission", "VARCHAR", false),
|
||||
addTime("add_time", "addTime", "TIMESTAMP", false),
|
||||
updateTime("update_time", "updateTime", "TIMESTAMP", false),
|
||||
deleted("deleted", "deleted", "BIT", false);
|
||||
|
||||
/**
|
||||
* This field was generated by MyBatis Generator.
|
||||
* This field corresponds to the database table litemall_permission
|
||||
*
|
||||
* @mbg.generated
|
||||
* @project https://github.com/itfsw/mybatis-generator-plugin
|
||||
*/
|
||||
private static final String BEGINNING_DELIMITER = "`";
|
||||
|
||||
/**
|
||||
* This field was generated by MyBatis Generator.
|
||||
* This field corresponds to the database table litemall_permission
|
||||
*
|
||||
* @mbg.generated
|
||||
* @project https://github.com/itfsw/mybatis-generator-plugin
|
||||
*/
|
||||
private static final String ENDING_DELIMITER = "`";
|
||||
|
||||
/**
|
||||
* This field was generated by MyBatis Generator.
|
||||
* This field corresponds to the database table litemall_permission
|
||||
*
|
||||
* @mbg.generated
|
||||
* @project https://github.com/itfsw/mybatis-generator-plugin
|
||||
*/
|
||||
private final String column;
|
||||
|
||||
/**
|
||||
* This field was generated by MyBatis Generator.
|
||||
* This field corresponds to the database table litemall_permission
|
||||
*
|
||||
* @mbg.generated
|
||||
* @project https://github.com/itfsw/mybatis-generator-plugin
|
||||
*/
|
||||
private final boolean isColumnNameDelimited;
|
||||
|
||||
/**
|
||||
* This field was generated by MyBatis Generator.
|
||||
* This field corresponds to the database table litemall_permission
|
||||
*
|
||||
* @mbg.generated
|
||||
* @project https://github.com/itfsw/mybatis-generator-plugin
|
||||
*/
|
||||
private final String javaProperty;
|
||||
|
||||
/**
|
||||
* This field was generated by MyBatis Generator.
|
||||
* This field corresponds to the database table litemall_permission
|
||||
*
|
||||
* @mbg.generated
|
||||
* @project https://github.com/itfsw/mybatis-generator-plugin
|
||||
*/
|
||||
private final String jdbcType;
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method corresponds to the database table litemall_permission
|
||||
*
|
||||
* @mbg.generated
|
||||
* @project https://github.com/itfsw/mybatis-generator-plugin
|
||||
*/
|
||||
public String value() {
|
||||
return this.column;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method corresponds to the database table litemall_permission
|
||||
*
|
||||
* @mbg.generated
|
||||
* @project https://github.com/itfsw/mybatis-generator-plugin
|
||||
*/
|
||||
public String getValue() {
|
||||
return this.column;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method corresponds to the database table litemall_permission
|
||||
*
|
||||
* @mbg.generated
|
||||
* @project https://github.com/itfsw/mybatis-generator-plugin
|
||||
*/
|
||||
public String getJavaProperty() {
|
||||
return this.javaProperty;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method corresponds to the database table litemall_permission
|
||||
*
|
||||
* @mbg.generated
|
||||
* @project https://github.com/itfsw/mybatis-generator-plugin
|
||||
*/
|
||||
public String getJdbcType() {
|
||||
return this.jdbcType;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method corresponds to the database table litemall_permission
|
||||
*
|
||||
* @mbg.generated
|
||||
* @project https://github.com/itfsw/mybatis-generator-plugin
|
||||
*/
|
||||
Column(String column, String javaProperty, String jdbcType, boolean isColumnNameDelimited) {
|
||||
this.column = column;
|
||||
this.javaProperty = javaProperty;
|
||||
this.jdbcType = jdbcType;
|
||||
this.isColumnNameDelimited = isColumnNameDelimited;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method corresponds to the database table litemall_permission
|
||||
*
|
||||
* @mbg.generated
|
||||
* @project https://github.com/itfsw/mybatis-generator-plugin
|
||||
*/
|
||||
public String desc() {
|
||||
return this.getEscapedColumnName() + " DESC";
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method corresponds to the database table litemall_permission
|
||||
*
|
||||
* @mbg.generated
|
||||
* @project https://github.com/itfsw/mybatis-generator-plugin
|
||||
*/
|
||||
public String asc() {
|
||||
return this.getEscapedColumnName() + " ASC";
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method corresponds to the database table litemall_permission
|
||||
*
|
||||
* @mbg.generated
|
||||
* @project https://github.com/itfsw/mybatis-generator-plugin
|
||||
*/
|
||||
public static Column[] excludes(Column ... excludes) {
|
||||
ArrayList<Column> columns = new ArrayList<>(Arrays.asList(Column.values()));
|
||||
if (excludes != null && excludes.length > 0) {
|
||||
columns.removeAll(new ArrayList<>(Arrays.asList(excludes)));
|
||||
}
|
||||
return columns.toArray(new Column[]{});
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method corresponds to the database table litemall_permission
|
||||
*
|
||||
* @mbg.generated
|
||||
* @project https://github.com/itfsw/mybatis-generator-plugin
|
||||
*/
|
||||
public String getEscapedColumnName() {
|
||||
if (this.isColumnNameDelimited) {
|
||||
return new StringBuilder().append(BEGINNING_DELIMITER).append(this.column).append(ENDING_DELIMITER).toString();
|
||||
} else {
|
||||
return this.column;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,518 @@
|
||||
package org.linlinjava.litemall.db.domain;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
|
||||
public class LitemallRole {
|
||||
/**
|
||||
* This field was generated by MyBatis Generator.
|
||||
* This field corresponds to the database table litemall_role
|
||||
*
|
||||
* @mbg.generated
|
||||
* @project https://github.com/itfsw/mybatis-generator-plugin
|
||||
*/
|
||||
public static final Boolean NOT_DELETED = false;
|
||||
|
||||
/**
|
||||
* This field was generated by MyBatis Generator.
|
||||
* This field corresponds to the database table litemall_role
|
||||
*
|
||||
* @mbg.generated
|
||||
* @project https://github.com/itfsw/mybatis-generator-plugin
|
||||
*/
|
||||
public static final Boolean IS_DELETED = true;
|
||||
|
||||
/**
|
||||
*
|
||||
* This field was generated by MyBatis Generator.
|
||||
* This field corresponds to the database column litemall_role.id
|
||||
*
|
||||
* @mbg.generated
|
||||
*/
|
||||
private Integer id;
|
||||
|
||||
/**
|
||||
*
|
||||
* This field was generated by MyBatis Generator.
|
||||
* This field corresponds to the database column litemall_role.name
|
||||
*
|
||||
* @mbg.generated
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
*
|
||||
* This field was generated by MyBatis Generator.
|
||||
* This field corresponds to the database column litemall_role.desc
|
||||
*
|
||||
* @mbg.generated
|
||||
*/
|
||||
private String desc;
|
||||
|
||||
/**
|
||||
*
|
||||
* This field was generated by MyBatis Generator.
|
||||
* This field corresponds to the database column litemall_role.enabled
|
||||
*
|
||||
* @mbg.generated
|
||||
*/
|
||||
private Boolean enabled;
|
||||
|
||||
/**
|
||||
*
|
||||
* This field was generated by MyBatis Generator.
|
||||
* This field corresponds to the database column litemall_role.add_time
|
||||
*
|
||||
* @mbg.generated
|
||||
*/
|
||||
private LocalDateTime addTime;
|
||||
|
||||
/**
|
||||
*
|
||||
* This field was generated by MyBatis Generator.
|
||||
* This field corresponds to the database column litemall_role.update_time
|
||||
*
|
||||
* @mbg.generated
|
||||
*/
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
/**
|
||||
*
|
||||
* This field was generated by MyBatis Generator.
|
||||
* This field corresponds to the database column litemall_role.deleted
|
||||
*
|
||||
* @mbg.generated
|
||||
*/
|
||||
private Boolean deleted;
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method returns the value of the database column litemall_role.id
|
||||
*
|
||||
* @return the value of litemall_role.id
|
||||
*
|
||||
* @mbg.generated
|
||||
*/
|
||||
public Integer getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method sets the value of the database column litemall_role.id
|
||||
*
|
||||
* @param id the value for litemall_role.id
|
||||
*
|
||||
* @mbg.generated
|
||||
*/
|
||||
public void setId(Integer id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method returns the value of the database column litemall_role.name
|
||||
*
|
||||
* @return the value of litemall_role.name
|
||||
*
|
||||
* @mbg.generated
|
||||
*/
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method sets the value of the database column litemall_role.name
|
||||
*
|
||||
* @param name the value for litemall_role.name
|
||||
*
|
||||
* @mbg.generated
|
||||
*/
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method returns the value of the database column litemall_role.desc
|
||||
*
|
||||
* @return the value of litemall_role.desc
|
||||
*
|
||||
* @mbg.generated
|
||||
*/
|
||||
public String getDesc() {
|
||||
return desc;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method sets the value of the database column litemall_role.desc
|
||||
*
|
||||
* @param desc the value for litemall_role.desc
|
||||
*
|
||||
* @mbg.generated
|
||||
*/
|
||||
public void setDesc(String desc) {
|
||||
this.desc = desc;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method returns the value of the database column litemall_role.enabled
|
||||
*
|
||||
* @return the value of litemall_role.enabled
|
||||
*
|
||||
* @mbg.generated
|
||||
*/
|
||||
public Boolean getEnabled() {
|
||||
return enabled;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method sets the value of the database column litemall_role.enabled
|
||||
*
|
||||
* @param enabled the value for litemall_role.enabled
|
||||
*
|
||||
* @mbg.generated
|
||||
*/
|
||||
public void setEnabled(Boolean enabled) {
|
||||
this.enabled = enabled;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method returns the value of the database column litemall_role.add_time
|
||||
*
|
||||
* @return the value of litemall_role.add_time
|
||||
*
|
||||
* @mbg.generated
|
||||
*/
|
||||
public LocalDateTime getAddTime() {
|
||||
return addTime;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method sets the value of the database column litemall_role.add_time
|
||||
*
|
||||
* @param addTime the value for litemall_role.add_time
|
||||
*
|
||||
* @mbg.generated
|
||||
*/
|
||||
public void setAddTime(LocalDateTime addTime) {
|
||||
this.addTime = addTime;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method returns the value of the database column litemall_role.update_time
|
||||
*
|
||||
* @return the value of litemall_role.update_time
|
||||
*
|
||||
* @mbg.generated
|
||||
*/
|
||||
public LocalDateTime getUpdateTime() {
|
||||
return updateTime;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method sets the value of the database column litemall_role.update_time
|
||||
*
|
||||
* @param updateTime the value for litemall_role.update_time
|
||||
*
|
||||
* @mbg.generated
|
||||
*/
|
||||
public void setUpdateTime(LocalDateTime updateTime) {
|
||||
this.updateTime = updateTime;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method returns the value of the database column litemall_role.deleted
|
||||
*
|
||||
* @return the value of litemall_role.deleted
|
||||
*
|
||||
* @mbg.generated
|
||||
*/
|
||||
public Boolean getDeleted() {
|
||||
return deleted;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method sets the value of the database column litemall_role.deleted
|
||||
*
|
||||
* @param deleted the value for litemall_role.deleted
|
||||
*
|
||||
* @mbg.generated
|
||||
*/
|
||||
public void setDeleted(Boolean deleted) {
|
||||
this.deleted = deleted;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method corresponds to the database table litemall_role
|
||||
*
|
||||
* @mbg.generated
|
||||
*/
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append(getClass().getSimpleName());
|
||||
sb.append(" [");
|
||||
sb.append("Hash = ").append(hashCode());
|
||||
sb.append(", id=").append(id);
|
||||
sb.append(", name=").append(name);
|
||||
sb.append(", desc=").append(desc);
|
||||
sb.append(", enabled=").append(enabled);
|
||||
sb.append(", addTime=").append(addTime);
|
||||
sb.append(", updateTime=").append(updateTime);
|
||||
sb.append(", deleted=").append(deleted);
|
||||
sb.append("]");
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method corresponds to the database table litemall_role
|
||||
*
|
||||
* @mbg.generated
|
||||
*/
|
||||
@Override
|
||||
public boolean equals(Object that) {
|
||||
if (this == that) {
|
||||
return true;
|
||||
}
|
||||
if (that == null) {
|
||||
return false;
|
||||
}
|
||||
if (getClass() != that.getClass()) {
|
||||
return false;
|
||||
}
|
||||
LitemallRole other = (LitemallRole) that;
|
||||
return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
|
||||
&& (this.getName() == null ? other.getName() == null : this.getName().equals(other.getName()))
|
||||
&& (this.getDesc() == null ? other.getDesc() == null : this.getDesc().equals(other.getDesc()))
|
||||
&& (this.getEnabled() == null ? other.getEnabled() == null : this.getEnabled().equals(other.getEnabled()))
|
||||
&& (this.getAddTime() == null ? other.getAddTime() == null : this.getAddTime().equals(other.getAddTime()))
|
||||
&& (this.getUpdateTime() == null ? other.getUpdateTime() == null : this.getUpdateTime().equals(other.getUpdateTime()))
|
||||
&& (this.getDeleted() == null ? other.getDeleted() == null : this.getDeleted().equals(other.getDeleted()));
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method corresponds to the database table litemall_role
|
||||
*
|
||||
* @mbg.generated
|
||||
*/
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
|
||||
result = prime * result + ((getName() == null) ? 0 : getName().hashCode());
|
||||
result = prime * result + ((getDesc() == null) ? 0 : getDesc().hashCode());
|
||||
result = prime * result + ((getEnabled() == null) ? 0 : getEnabled().hashCode());
|
||||
result = prime * result + ((getAddTime() == null) ? 0 : getAddTime().hashCode());
|
||||
result = prime * result + ((getUpdateTime() == null) ? 0 : getUpdateTime().hashCode());
|
||||
result = prime * result + ((getDeleted() == null) ? 0 : getDeleted().hashCode());
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method corresponds to the database table litemall_role
|
||||
*
|
||||
* @mbg.generated
|
||||
* @project https://github.com/itfsw/mybatis-generator-plugin
|
||||
*/
|
||||
public void andLogicalDeleted(boolean deleted) {
|
||||
setDeleted(deleted ? IS_DELETED : NOT_DELETED);
|
||||
}
|
||||
|
||||
/**
|
||||
* This enum was generated by MyBatis Generator.
|
||||
* This enum corresponds to the database table litemall_role
|
||||
*
|
||||
* @mbg.generated
|
||||
* @project https://github.com/itfsw/mybatis-generator-plugin
|
||||
*/
|
||||
public enum Column {
|
||||
id("id", "id", "INTEGER", false),
|
||||
name("name", "name", "VARCHAR", true),
|
||||
desc("desc", "desc", "VARCHAR", true),
|
||||
enabled("enabled", "enabled", "BIT", false),
|
||||
addTime("add_time", "addTime", "TIMESTAMP", false),
|
||||
updateTime("update_time", "updateTime", "TIMESTAMP", false),
|
||||
deleted("deleted", "deleted", "BIT", false);
|
||||
|
||||
/**
|
||||
* This field was generated by MyBatis Generator.
|
||||
* This field corresponds to the database table litemall_role
|
||||
*
|
||||
* @mbg.generated
|
||||
* @project https://github.com/itfsw/mybatis-generator-plugin
|
||||
*/
|
||||
private static final String BEGINNING_DELIMITER = "`";
|
||||
|
||||
/**
|
||||
* This field was generated by MyBatis Generator.
|
||||
* This field corresponds to the database table litemall_role
|
||||
*
|
||||
* @mbg.generated
|
||||
* @project https://github.com/itfsw/mybatis-generator-plugin
|
||||
*/
|
||||
private static final String ENDING_DELIMITER = "`";
|
||||
|
||||
/**
|
||||
* This field was generated by MyBatis Generator.
|
||||
* This field corresponds to the database table litemall_role
|
||||
*
|
||||
* @mbg.generated
|
||||
* @project https://github.com/itfsw/mybatis-generator-plugin
|
||||
*/
|
||||
private final String column;
|
||||
|
||||
/**
|
||||
* This field was generated by MyBatis Generator.
|
||||
* This field corresponds to the database table litemall_role
|
||||
*
|
||||
* @mbg.generated
|
||||
* @project https://github.com/itfsw/mybatis-generator-plugin
|
||||
*/
|
||||
private final boolean isColumnNameDelimited;
|
||||
|
||||
/**
|
||||
* This field was generated by MyBatis Generator.
|
||||
* This field corresponds to the database table litemall_role
|
||||
*
|
||||
* @mbg.generated
|
||||
* @project https://github.com/itfsw/mybatis-generator-plugin
|
||||
*/
|
||||
private final String javaProperty;
|
||||
|
||||
/**
|
||||
* This field was generated by MyBatis Generator.
|
||||
* This field corresponds to the database table litemall_role
|
||||
*
|
||||
* @mbg.generated
|
||||
* @project https://github.com/itfsw/mybatis-generator-plugin
|
||||
*/
|
||||
private final String jdbcType;
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method corresponds to the database table litemall_role
|
||||
*
|
||||
* @mbg.generated
|
||||
* @project https://github.com/itfsw/mybatis-generator-plugin
|
||||
*/
|
||||
public String value() {
|
||||
return this.column;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method corresponds to the database table litemall_role
|
||||
*
|
||||
* @mbg.generated
|
||||
* @project https://github.com/itfsw/mybatis-generator-plugin
|
||||
*/
|
||||
public String getValue() {
|
||||
return this.column;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method corresponds to the database table litemall_role
|
||||
*
|
||||
* @mbg.generated
|
||||
* @project https://github.com/itfsw/mybatis-generator-plugin
|
||||
*/
|
||||
public String getJavaProperty() {
|
||||
return this.javaProperty;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method corresponds to the database table litemall_role
|
||||
*
|
||||
* @mbg.generated
|
||||
* @project https://github.com/itfsw/mybatis-generator-plugin
|
||||
*/
|
||||
public String getJdbcType() {
|
||||
return this.jdbcType;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method corresponds to the database table litemall_role
|
||||
*
|
||||
* @mbg.generated
|
||||
* @project https://github.com/itfsw/mybatis-generator-plugin
|
||||
*/
|
||||
Column(String column, String javaProperty, String jdbcType, boolean isColumnNameDelimited) {
|
||||
this.column = column;
|
||||
this.javaProperty = javaProperty;
|
||||
this.jdbcType = jdbcType;
|
||||
this.isColumnNameDelimited = isColumnNameDelimited;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method corresponds to the database table litemall_role
|
||||
*
|
||||
* @mbg.generated
|
||||
* @project https://github.com/itfsw/mybatis-generator-plugin
|
||||
*/
|
||||
public String desc() {
|
||||
return this.getEscapedColumnName() + " DESC";
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method corresponds to the database table litemall_role
|
||||
*
|
||||
* @mbg.generated
|
||||
* @project https://github.com/itfsw/mybatis-generator-plugin
|
||||
*/
|
||||
public String asc() {
|
||||
return this.getEscapedColumnName() + " ASC";
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method corresponds to the database table litemall_role
|
||||
*
|
||||
* @mbg.generated
|
||||
* @project https://github.com/itfsw/mybatis-generator-plugin
|
||||
*/
|
||||
public static Column[] excludes(Column ... excludes) {
|
||||
ArrayList<Column> columns = new ArrayList<>(Arrays.asList(Column.values()));
|
||||
if (excludes != null && excludes.length > 0) {
|
||||
columns.removeAll(new ArrayList<>(Arrays.asList(excludes)));
|
||||
}
|
||||
return columns.toArray(new Column[]{});
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method corresponds to the database table litemall_role
|
||||
*
|
||||
* @mbg.generated
|
||||
* @project https://github.com/itfsw/mybatis-generator-plugin
|
||||
*/
|
||||
public String getEscapedColumnName() {
|
||||
if (this.isColumnNameDelimited) {
|
||||
return new StringBuilder().append(BEGINNING_DELIMITER).append(this.column).append(ENDING_DELIMITER).toString();
|
||||
} else {
|
||||
return this.column;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -14,7 +14,7 @@ import java.util.List;
|
||||
|
||||
@Service
|
||||
public class LitemallAdminService {
|
||||
private final Column[] result = new Column[]{Column.id, Column.username, Column.avatar};
|
||||
private final Column[] result = new Column[]{Column.id, Column.username, Column.avatar, Column.roleIds};
|
||||
@Resource
|
||||
private LitemallAdminMapper adminMapper;
|
||||
|
||||
|
||||
@@ -0,0 +1,80 @@
|
||||
package org.linlinjava.litemall.db.service;
|
||||
|
||||
import org.linlinjava.litemall.db.dao.LitemallPermissionMapper;
|
||||
import org.linlinjava.litemall.db.dao.LitemallRoleMapper;
|
||||
import org.linlinjava.litemall.db.domain.LitemallPermission;
|
||||
import org.linlinjava.litemall.db.domain.LitemallPermissionExample;
|
||||
import org.linlinjava.litemall.db.domain.LitemallRole;
|
||||
import org.linlinjava.litemall.db.domain.LitemallRoleExample;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
@Service
|
||||
public class LitemallPermissionService {
|
||||
@Resource
|
||||
private LitemallPermissionMapper permissionMapper;
|
||||
|
||||
public Set<String> queryByRoleIds(Integer[] roleIds) {
|
||||
Set<String> permissions = new HashSet<String>();
|
||||
if(roleIds.length == 0){
|
||||
return permissions;
|
||||
}
|
||||
|
||||
LitemallPermissionExample example = new LitemallPermissionExample();
|
||||
example.or().andRoleIdIn(Arrays.asList(roleIds)).andDeletedEqualTo(false);
|
||||
List<LitemallPermission> permissionList = permissionMapper.selectByExample(example);
|
||||
|
||||
for(LitemallPermission permission : permissionList){
|
||||
permissions.add(permission.getPermission());
|
||||
}
|
||||
|
||||
return permissions;
|
||||
}
|
||||
|
||||
|
||||
public Set<String> queryByRoleId(Integer roleId) {
|
||||
Set<String> permissions = new HashSet<String>();
|
||||
if(roleId == null){
|
||||
return permissions;
|
||||
}
|
||||
|
||||
LitemallPermissionExample example = new LitemallPermissionExample();
|
||||
example.or().andRoleIdEqualTo(roleId).andDeletedEqualTo(false);
|
||||
List<LitemallPermission> permissionList = permissionMapper.selectByExample(example);
|
||||
|
||||
for(LitemallPermission permission : permissionList){
|
||||
permissions.add(permission.getPermission());
|
||||
}
|
||||
|
||||
return permissions;
|
||||
}
|
||||
|
||||
public boolean checkSuperPermission(Integer roleId) {
|
||||
Set<String> permissions = new HashSet<String>();
|
||||
if(roleId == null){
|
||||
return false;
|
||||
}
|
||||
|
||||
LitemallPermissionExample example = new LitemallPermissionExample();
|
||||
example.or().andRoleIdEqualTo(roleId).andPermissionEqualTo("*").andDeletedEqualTo(false);
|
||||
return permissionMapper.countByExample(example) != 0;
|
||||
}
|
||||
|
||||
public void deleteByRoleId(Integer roleId) {
|
||||
LitemallPermissionExample example = new LitemallPermissionExample();
|
||||
example.or().andRoleIdEqualTo(roleId).andDeletedEqualTo(false);
|
||||
permissionMapper.logicalDeleteByExample(example);
|
||||
}
|
||||
|
||||
public void add(LitemallPermission litemallPermission) {
|
||||
litemallPermission.setAddTime(LocalDateTime.now());
|
||||
litemallPermission.setUpdateTime(LocalDateTime.now());
|
||||
permissionMapper.insertSelective(litemallPermission);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,104 @@
|
||||
package org.linlinjava.litemall.db.service;
|
||||
|
||||
import com.alibaba.druid.util.StringUtils;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import org.linlinjava.litemall.db.dao.LitemallRoleMapper;
|
||||
import org.linlinjava.litemall.db.domain.LitemallRole;
|
||||
import org.linlinjava.litemall.db.domain.LitemallRoleExample;
|
||||
import org.springframework.stereotype.Service;
|
||||
import javax.annotation.Resource;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
@Service
|
||||
public class LitemallRoleService {
|
||||
@Resource
|
||||
private LitemallRoleMapper roleMapper;
|
||||
|
||||
|
||||
public Set<String> queryByIds(Integer[] roleIds) {
|
||||
Set<String> roles = new HashSet<String>();
|
||||
if(roleIds.length == 0){
|
||||
return roles;
|
||||
}
|
||||
|
||||
LitemallRoleExample example = new LitemallRoleExample();
|
||||
example.or().andIdIn(Arrays.asList(roleIds)).andEnabledEqualTo(true).andDeletedEqualTo(false);
|
||||
List<LitemallRole> roleList = roleMapper.selectByExample(example);
|
||||
|
||||
for(LitemallRole role : roleList){
|
||||
roles.add(role.getName());
|
||||
}
|
||||
|
||||
return roles;
|
||||
|
||||
}
|
||||
|
||||
public List<LitemallRole> querySelective(String roleName, Integer page, Integer size, String sort, String order) {
|
||||
LitemallRoleExample example = new LitemallRoleExample();
|
||||
LitemallRoleExample.Criteria criteria = example.createCriteria();
|
||||
|
||||
if (!StringUtils.isEmpty(roleName)) {
|
||||
criteria.andNameEqualTo("%" + roleName + "%");
|
||||
}
|
||||
criteria.andDeletedEqualTo(false);
|
||||
|
||||
if (!StringUtils.isEmpty(sort) && !StringUtils.isEmpty(order)) {
|
||||
example.setOrderByClause(sort + " " + order);
|
||||
}
|
||||
|
||||
PageHelper.startPage(page, size);
|
||||
return roleMapper.selectByExample(example);
|
||||
}
|
||||
|
||||
public int countSelective(String roleName, Integer page, Integer size, String sort, String order) {
|
||||
LitemallRoleExample example = new LitemallRoleExample();
|
||||
LitemallRoleExample.Criteria criteria = example.createCriteria();
|
||||
|
||||
if (!StringUtils.isEmpty(roleName)) {
|
||||
criteria.andNameEqualTo("%" + roleName + "%");
|
||||
}
|
||||
criteria.andDeletedEqualTo(false);
|
||||
|
||||
if (!StringUtils.isEmpty(sort) && !StringUtils.isEmpty(order)) {
|
||||
example.setOrderByClause(sort + " " + order);
|
||||
}
|
||||
|
||||
PageHelper.startPage(page, size);
|
||||
return (int)roleMapper.countByExample(example);
|
||||
}
|
||||
|
||||
public LitemallRole findById(Integer id) {
|
||||
return roleMapper.selectByPrimaryKey(id);
|
||||
}
|
||||
|
||||
public void add(LitemallRole role) {
|
||||
role.setAddTime(LocalDateTime.now());
|
||||
role.setUpdateTime(LocalDateTime.now());
|
||||
roleMapper.insertSelective(role);
|
||||
}
|
||||
|
||||
public void deleteById(Integer id) {
|
||||
roleMapper.logicalDeleteByPrimaryKey(id);
|
||||
}
|
||||
|
||||
public void updateById(LitemallRole role) {
|
||||
role.setUpdateTime(LocalDateTime.now());
|
||||
roleMapper.updateByPrimaryKeySelective(role);
|
||||
}
|
||||
|
||||
public boolean checkExist(String name) {
|
||||
LitemallRoleExample example = new LitemallRoleExample();
|
||||
example.or().andNameEqualTo(name).andDeletedEqualTo(false);
|
||||
return roleMapper.countByExample(example) != 0;
|
||||
}
|
||||
|
||||
public List<LitemallRole> queryAll() {
|
||||
LitemallRoleExample example = new LitemallRoleExample();
|
||||
example.or().andDeletedEqualTo(false);
|
||||
return roleMapper.selectByExample(example);
|
||||
}
|
||||
}
|
||||
@@ -15,6 +15,7 @@
|
||||
<result column="add_time" jdbcType="TIMESTAMP" property="addTime" />
|
||||
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
|
||||
<result column="deleted" jdbcType="BIT" property="deleted" />
|
||||
<result column="role_ids" jdbcType="VARCHAR" property="roleIds" typeHandler="org.linlinjava.litemall.db.mybatis.JsonIntegerArrayTypeHandler" />
|
||||
</resultMap>
|
||||
<sql id="Example_Where_Clause">
|
||||
<!--
|
||||
@@ -44,6 +45,25 @@
|
||||
</when>
|
||||
</choose>
|
||||
</foreach>
|
||||
<foreach collection="criteria.roleIdsCriteria" item="criterion">
|
||||
<choose>
|
||||
<when test="criterion.noValue">
|
||||
and ${criterion.condition}
|
||||
</when>
|
||||
<when test="criterion.singleValue">
|
||||
and ${criterion.condition} #{criterion.value,typeHandler=org.linlinjava.litemall.db.mybatis.JsonIntegerArrayTypeHandler}
|
||||
</when>
|
||||
<when test="criterion.betweenValue">
|
||||
and ${criterion.condition} #{criterion.value,typeHandler=org.linlinjava.litemall.db.mybatis.JsonIntegerArrayTypeHandler} and #{criterion.secondValue,typeHandler=org.linlinjava.litemall.db.mybatis.JsonIntegerArrayTypeHandler}
|
||||
</when>
|
||||
<when test="criterion.listValue">
|
||||
and ${criterion.condition}
|
||||
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
|
||||
#{listItem,typeHandler=org.linlinjava.litemall.db.mybatis.JsonIntegerArrayTypeHandler}
|
||||
</foreach>
|
||||
</when>
|
||||
</choose>
|
||||
</foreach>
|
||||
</trim>
|
||||
</if>
|
||||
</foreach>
|
||||
@@ -77,6 +97,25 @@
|
||||
</when>
|
||||
</choose>
|
||||
</foreach>
|
||||
<foreach collection="criteria.roleIdsCriteria" item="criterion">
|
||||
<choose>
|
||||
<when test="criterion.noValue">
|
||||
and ${criterion.condition}
|
||||
</when>
|
||||
<when test="criterion.singleValue">
|
||||
and ${criterion.condition} #{criterion.value,typeHandler=org.linlinjava.litemall.db.mybatis.JsonIntegerArrayTypeHandler}
|
||||
</when>
|
||||
<when test="criterion.betweenValue">
|
||||
and ${criterion.condition} #{criterion.value,typeHandler=org.linlinjava.litemall.db.mybatis.JsonIntegerArrayTypeHandler} and #{criterion.secondValue,typeHandler=org.linlinjava.litemall.db.mybatis.JsonIntegerArrayTypeHandler}
|
||||
</when>
|
||||
<when test="criterion.listValue">
|
||||
and ${criterion.condition}
|
||||
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
|
||||
#{listItem,typeHandler=org.linlinjava.litemall.db.mybatis.JsonIntegerArrayTypeHandler}
|
||||
</foreach>
|
||||
</when>
|
||||
</choose>
|
||||
</foreach>
|
||||
</trim>
|
||||
</if>
|
||||
</foreach>
|
||||
@@ -88,7 +127,7 @@
|
||||
This element is automatically generated by MyBatis Generator, do not modify.
|
||||
-->
|
||||
id, username, `password`, last_login_ip, last_login_time, avatar, add_time, update_time,
|
||||
deleted
|
||||
deleted, role_ids
|
||||
</sql>
|
||||
<select id="selectByExample" parameterType="org.linlinjava.litemall.db.domain.LitemallAdminExample" resultMap="BaseResultMap">
|
||||
<!--
|
||||
@@ -126,7 +165,7 @@
|
||||
</when>
|
||||
<otherwise>
|
||||
id, username, `password`, last_login_ip, last_login_time, avatar, add_time, update_time,
|
||||
deleted
|
||||
deleted, role_ids
|
||||
</otherwise>
|
||||
</choose>
|
||||
from litemall_admin
|
||||
@@ -186,7 +225,7 @@
|
||||
</when>
|
||||
<otherwise>
|
||||
id, username, `password`, last_login_ip, last_login_time, avatar, add_time, update_time,
|
||||
deleted
|
||||
deleted, role_ids
|
||||
</otherwise>
|
||||
</choose>
|
||||
from litemall_admin
|
||||
@@ -220,10 +259,12 @@
|
||||
</selectKey>
|
||||
insert into litemall_admin (username, `password`, last_login_ip,
|
||||
last_login_time, avatar, add_time,
|
||||
update_time, deleted)
|
||||
update_time, deleted, role_ids
|
||||
)
|
||||
values (#{username,jdbcType=VARCHAR}, #{password,jdbcType=VARCHAR}, #{lastLoginIp,jdbcType=VARCHAR},
|
||||
#{lastLoginTime,jdbcType=TIMESTAMP}, #{avatar,jdbcType=VARCHAR}, #{addTime,jdbcType=TIMESTAMP},
|
||||
#{updateTime,jdbcType=TIMESTAMP}, #{deleted,jdbcType=BIT})
|
||||
#{updateTime,jdbcType=TIMESTAMP}, #{deleted,jdbcType=BIT}, #{roleIds,jdbcType=VARCHAR,typeHandler=org.linlinjava.litemall.db.mybatis.JsonIntegerArrayTypeHandler}
|
||||
)
|
||||
</insert>
|
||||
<insert id="insertSelective" parameterType="org.linlinjava.litemall.db.domain.LitemallAdmin">
|
||||
<!--
|
||||
@@ -259,6 +300,9 @@
|
||||
<if test="deleted != null">
|
||||
deleted,
|
||||
</if>
|
||||
<if test="roleIds != null">
|
||||
role_ids,
|
||||
</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="username != null">
|
||||
@@ -285,6 +329,9 @@
|
||||
<if test="deleted != null">
|
||||
#{deleted,jdbcType=BIT},
|
||||
</if>
|
||||
<if test="roleIds != null">
|
||||
#{roleIds,jdbcType=VARCHAR,typeHandler=org.linlinjava.litemall.db.mybatis.JsonIntegerArrayTypeHandler},
|
||||
</if>
|
||||
</trim>
|
||||
</insert>
|
||||
<select id="countByExample" parameterType="org.linlinjava.litemall.db.domain.LitemallAdminExample" resultType="java.lang.Long">
|
||||
@@ -331,6 +378,9 @@
|
||||
<if test="record.deleted != null">
|
||||
deleted = #{record.deleted,jdbcType=BIT},
|
||||
</if>
|
||||
<if test="record.roleIds != null">
|
||||
role_ids = #{record.roleIds,jdbcType=VARCHAR,typeHandler=org.linlinjava.litemall.db.mybatis.JsonIntegerArrayTypeHandler},
|
||||
</if>
|
||||
</set>
|
||||
<if test="_parameter != null">
|
||||
<include refid="Update_By_Example_Where_Clause" />
|
||||
@@ -350,7 +400,8 @@
|
||||
avatar = #{record.avatar,jdbcType=VARCHAR},
|
||||
add_time = #{record.addTime,jdbcType=TIMESTAMP},
|
||||
update_time = #{record.updateTime,jdbcType=TIMESTAMP},
|
||||
deleted = #{record.deleted,jdbcType=BIT}
|
||||
deleted = #{record.deleted,jdbcType=BIT},
|
||||
role_ids = #{record.roleIds,jdbcType=VARCHAR,typeHandler=org.linlinjava.litemall.db.mybatis.JsonIntegerArrayTypeHandler}
|
||||
<if test="_parameter != null">
|
||||
<include refid="Update_By_Example_Where_Clause" />
|
||||
</if>
|
||||
@@ -386,6 +437,9 @@
|
||||
<if test="deleted != null">
|
||||
deleted = #{deleted,jdbcType=BIT},
|
||||
</if>
|
||||
<if test="roleIds != null">
|
||||
role_ids = #{roleIds,jdbcType=VARCHAR,typeHandler=org.linlinjava.litemall.db.mybatis.JsonIntegerArrayTypeHandler},
|
||||
</if>
|
||||
</set>
|
||||
where id = #{id,jdbcType=INTEGER}
|
||||
</update>
|
||||
@@ -402,7 +456,8 @@
|
||||
avatar = #{avatar,jdbcType=VARCHAR},
|
||||
add_time = #{addTime,jdbcType=TIMESTAMP},
|
||||
update_time = #{updateTime,jdbcType=TIMESTAMP},
|
||||
deleted = #{deleted,jdbcType=BIT}
|
||||
deleted = #{deleted,jdbcType=BIT},
|
||||
role_ids = #{roleIds,jdbcType=VARCHAR,typeHandler=org.linlinjava.litemall.db.mybatis.JsonIntegerArrayTypeHandler}
|
||||
where id = #{id,jdbcType=INTEGER}
|
||||
</update>
|
||||
<select id="selectOneByExample" parameterType="org.linlinjava.litemall.db.domain.LitemallAdminExample" resultMap="BaseResultMap">
|
||||
@@ -437,7 +492,7 @@
|
||||
</when>
|
||||
<otherwise>
|
||||
id, username, `password`, last_login_ip, last_login_time, avatar, add_time, update_time,
|
||||
deleted
|
||||
deleted, role_ids
|
||||
</otherwise>
|
||||
</choose>
|
||||
from litemall_admin
|
||||
|
||||
@@ -0,0 +1,421 @@
|
||||
<?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="org.linlinjava.litemall.db.dao.LitemallPermissionMapper">
|
||||
<resultMap id="BaseResultMap" type="org.linlinjava.litemall.db.domain.LitemallPermission">
|
||||
<!--
|
||||
WARNING - @mbg.generated
|
||||
This element is automatically generated by MyBatis Generator, do not modify.
|
||||
-->
|
||||
<id column="id" jdbcType="INTEGER" property="id" />
|
||||
<result column="role_id" jdbcType="INTEGER" property="roleId" />
|
||||
<result column="permission" jdbcType="VARCHAR" property="permission" />
|
||||
<result column="add_time" jdbcType="TIMESTAMP" property="addTime" />
|
||||
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
|
||||
<result column="deleted" jdbcType="BIT" property="deleted" />
|
||||
</resultMap>
|
||||
<sql id="Example_Where_Clause">
|
||||
<!--
|
||||
WARNING - @mbg.generated
|
||||
This element is automatically generated by MyBatis Generator, do not modify.
|
||||
-->
|
||||
<where>
|
||||
<foreach collection="oredCriteria" item="criteria" separator="or">
|
||||
<if test="criteria.valid">
|
||||
<trim prefix="(" prefixOverrides="and" suffix=")">
|
||||
<foreach collection="criteria.criteria" item="criterion">
|
||||
<choose>
|
||||
<when test="criterion.noValue">
|
||||
and ${criterion.condition}
|
||||
</when>
|
||||
<when test="criterion.singleValue">
|
||||
and ${criterion.condition} #{criterion.value}
|
||||
</when>
|
||||
<when test="criterion.betweenValue">
|
||||
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
|
||||
</when>
|
||||
<when test="criterion.listValue">
|
||||
and ${criterion.condition}
|
||||
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
|
||||
#{listItem}
|
||||
</foreach>
|
||||
</when>
|
||||
</choose>
|
||||
</foreach>
|
||||
</trim>
|
||||
</if>
|
||||
</foreach>
|
||||
</where>
|
||||
</sql>
|
||||
<sql id="Update_By_Example_Where_Clause">
|
||||
<!--
|
||||
WARNING - @mbg.generated
|
||||
This element is automatically generated by MyBatis Generator, do not modify.
|
||||
-->
|
||||
<where>
|
||||
<foreach collection="example.oredCriteria" item="criteria" separator="or">
|
||||
<if test="criteria.valid">
|
||||
<trim prefix="(" prefixOverrides="and" suffix=")">
|
||||
<foreach collection="criteria.criteria" item="criterion">
|
||||
<choose>
|
||||
<when test="criterion.noValue">
|
||||
and ${criterion.condition}
|
||||
</when>
|
||||
<when test="criterion.singleValue">
|
||||
and ${criterion.condition} #{criterion.value}
|
||||
</when>
|
||||
<when test="criterion.betweenValue">
|
||||
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
|
||||
</when>
|
||||
<when test="criterion.listValue">
|
||||
and ${criterion.condition}
|
||||
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
|
||||
#{listItem}
|
||||
</foreach>
|
||||
</when>
|
||||
</choose>
|
||||
</foreach>
|
||||
</trim>
|
||||
</if>
|
||||
</foreach>
|
||||
</where>
|
||||
</sql>
|
||||
<sql id="Base_Column_List">
|
||||
<!--
|
||||
WARNING - @mbg.generated
|
||||
This element is automatically generated by MyBatis Generator, do not modify.
|
||||
-->
|
||||
id, role_id, permission, add_time, update_time, deleted
|
||||
</sql>
|
||||
<select id="selectByExample" parameterType="org.linlinjava.litemall.db.domain.LitemallPermissionExample" resultMap="BaseResultMap">
|
||||
<!--
|
||||
WARNING - @mbg.generated
|
||||
This element is automatically generated by MyBatis Generator, do not modify.
|
||||
-->
|
||||
select
|
||||
<if test="distinct">
|
||||
distinct
|
||||
</if>
|
||||
<include refid="Base_Column_List" />
|
||||
from litemall_permission
|
||||
<if test="_parameter != null">
|
||||
<include refid="Example_Where_Clause" />
|
||||
</if>
|
||||
<if test="orderByClause != null">
|
||||
order by ${orderByClause}
|
||||
</if>
|
||||
</select>
|
||||
<select id="selectByExampleSelective" parameterType="map" resultMap="BaseResultMap">
|
||||
<!--
|
||||
WARNING - @mbg.generated
|
||||
This element is automatically generated by MyBatis Generator, do not modify.
|
||||
@project https://github.com/itfsw/mybatis-generator-plugin
|
||||
-->
|
||||
select
|
||||
<if test="example.distinct">
|
||||
distinct
|
||||
</if>
|
||||
<choose>
|
||||
<when test="selective != null and selective.length > 0">
|
||||
<foreach collection="selective" item="column" separator=",">
|
||||
${column.escapedColumnName}
|
||||
</foreach>
|
||||
</when>
|
||||
<otherwise>
|
||||
id, role_id, permission, add_time, update_time, deleted
|
||||
</otherwise>
|
||||
</choose>
|
||||
from litemall_permission
|
||||
<if test="_parameter != null">
|
||||
<include refid="Update_By_Example_Where_Clause" />
|
||||
</if>
|
||||
<if test="example.orderByClause != null">
|
||||
order by ${example.orderByClause}
|
||||
</if>
|
||||
</select>
|
||||
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
|
||||
<!--
|
||||
WARNING - @mbg.generated
|
||||
This element is automatically generated by MyBatis Generator, do not modify.
|
||||
-->
|
||||
select
|
||||
<include refid="Base_Column_List" />
|
||||
from litemall_permission
|
||||
where id = #{id,jdbcType=INTEGER}
|
||||
</select>
|
||||
<select id="selectByPrimaryKeyWithLogicalDelete" parameterType="map" resultMap="BaseResultMap">
|
||||
<!--
|
||||
WARNING - @mbg.generated
|
||||
This element is automatically generated by MyBatis Generator, do not modify.
|
||||
@project https://github.com/itfsw/mybatis-generator-plugin
|
||||
-->
|
||||
<!--
|
||||
WARNING - @mbg.generated
|
||||
This element is automatically generated by MyBatis Generator, do not modify.
|
||||
-->
|
||||
select
|
||||
<include refid="Base_Column_List" />
|
||||
from litemall_permission
|
||||
where id = #{id,jdbcType=INTEGER}
|
||||
and deleted =
|
||||
<choose>
|
||||
<when test="andLogicalDeleted">
|
||||
1
|
||||
</when>
|
||||
<otherwise>
|
||||
0
|
||||
</otherwise>
|
||||
</choose>
|
||||
</select>
|
||||
<select id="selectByPrimaryKeySelective" parameterType="map" resultMap="BaseResultMap">
|
||||
<!--
|
||||
WARNING - @mbg.generated
|
||||
This element is automatically generated by MyBatis Generator, do not modify.
|
||||
@project https://github.com/itfsw/mybatis-generator-plugin
|
||||
-->
|
||||
select
|
||||
<choose>
|
||||
<when test="selective != null and selective.length > 0">
|
||||
<foreach collection="selective" item="column" separator=",">
|
||||
${column.escapedColumnName}
|
||||
</foreach>
|
||||
</when>
|
||||
<otherwise>
|
||||
id, role_id, permission, add_time, update_time, deleted
|
||||
</otherwise>
|
||||
</choose>
|
||||
from litemall_permission
|
||||
where id = #{id,jdbcType=INTEGER}
|
||||
</select>
|
||||
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
|
||||
<!--
|
||||
WARNING - @mbg.generated
|
||||
This element is automatically generated by MyBatis Generator, do not modify.
|
||||
-->
|
||||
delete from litemall_permission
|
||||
where id = #{id,jdbcType=INTEGER}
|
||||
</delete>
|
||||
<delete id="deleteByExample" parameterType="org.linlinjava.litemall.db.domain.LitemallPermissionExample">
|
||||
<!--
|
||||
WARNING - @mbg.generated
|
||||
This element is automatically generated by MyBatis Generator, do not modify.
|
||||
-->
|
||||
delete from litemall_permission
|
||||
<if test="_parameter != null">
|
||||
<include refid="Example_Where_Clause" />
|
||||
</if>
|
||||
</delete>
|
||||
<insert id="insert" parameterType="org.linlinjava.litemall.db.domain.LitemallPermission">
|
||||
<!--
|
||||
WARNING - @mbg.generated
|
||||
This element is automatically generated by MyBatis Generator, do not modify.
|
||||
-->
|
||||
<selectKey keyProperty="id" order="AFTER" resultType="java.lang.Integer">
|
||||
SELECT LAST_INSERT_ID()
|
||||
</selectKey>
|
||||
insert into litemall_permission (role_id, permission, add_time,
|
||||
update_time, deleted)
|
||||
values (#{roleId,jdbcType=INTEGER}, #{permission,jdbcType=VARCHAR}, #{addTime,jdbcType=TIMESTAMP},
|
||||
#{updateTime,jdbcType=TIMESTAMP}, #{deleted,jdbcType=BIT})
|
||||
</insert>
|
||||
<insert id="insertSelective" parameterType="org.linlinjava.litemall.db.domain.LitemallPermission">
|
||||
<!--
|
||||
WARNING - @mbg.generated
|
||||
This element is automatically generated by MyBatis Generator, do not modify.
|
||||
-->
|
||||
<selectKey keyProperty="id" order="AFTER" resultType="java.lang.Integer">
|
||||
SELECT LAST_INSERT_ID()
|
||||
</selectKey>
|
||||
insert into litemall_permission
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="roleId != null">
|
||||
role_id,
|
||||
</if>
|
||||
<if test="permission != null">
|
||||
permission,
|
||||
</if>
|
||||
<if test="addTime != null">
|
||||
add_time,
|
||||
</if>
|
||||
<if test="updateTime != null">
|
||||
update_time,
|
||||
</if>
|
||||
<if test="deleted != null">
|
||||
deleted,
|
||||
</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="roleId != null">
|
||||
#{roleId,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="permission != null">
|
||||
#{permission,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="addTime != null">
|
||||
#{addTime,jdbcType=TIMESTAMP},
|
||||
</if>
|
||||
<if test="updateTime != null">
|
||||
#{updateTime,jdbcType=TIMESTAMP},
|
||||
</if>
|
||||
<if test="deleted != null">
|
||||
#{deleted,jdbcType=BIT},
|
||||
</if>
|
||||
</trim>
|
||||
</insert>
|
||||
<select id="countByExample" parameterType="org.linlinjava.litemall.db.domain.LitemallPermissionExample" resultType="java.lang.Long">
|
||||
<!--
|
||||
WARNING - @mbg.generated
|
||||
This element is automatically generated by MyBatis Generator, do not modify.
|
||||
-->
|
||||
select count(*) from litemall_permission
|
||||
<if test="_parameter != null">
|
||||
<include refid="Example_Where_Clause" />
|
||||
</if>
|
||||
</select>
|
||||
<update id="updateByExampleSelective" parameterType="map">
|
||||
<!--
|
||||
WARNING - @mbg.generated
|
||||
This element is automatically generated by MyBatis Generator, do not modify.
|
||||
-->
|
||||
update litemall_permission
|
||||
<set>
|
||||
<if test="record.id != null">
|
||||
id = #{record.id,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="record.roleId != null">
|
||||
role_id = #{record.roleId,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="record.permission != null">
|
||||
permission = #{record.permission,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="record.addTime != null">
|
||||
add_time = #{record.addTime,jdbcType=TIMESTAMP},
|
||||
</if>
|
||||
<if test="record.updateTime != null">
|
||||
update_time = #{record.updateTime,jdbcType=TIMESTAMP},
|
||||
</if>
|
||||
<if test="record.deleted != null">
|
||||
deleted = #{record.deleted,jdbcType=BIT},
|
||||
</if>
|
||||
</set>
|
||||
<if test="_parameter != null">
|
||||
<include refid="Update_By_Example_Where_Clause" />
|
||||
</if>
|
||||
</update>
|
||||
<update id="updateByExample" parameterType="map">
|
||||
<!--
|
||||
WARNING - @mbg.generated
|
||||
This element is automatically generated by MyBatis Generator, do not modify.
|
||||
-->
|
||||
update litemall_permission
|
||||
set id = #{record.id,jdbcType=INTEGER},
|
||||
role_id = #{record.roleId,jdbcType=INTEGER},
|
||||
permission = #{record.permission,jdbcType=VARCHAR},
|
||||
add_time = #{record.addTime,jdbcType=TIMESTAMP},
|
||||
update_time = #{record.updateTime,jdbcType=TIMESTAMP},
|
||||
deleted = #{record.deleted,jdbcType=BIT}
|
||||
<if test="_parameter != null">
|
||||
<include refid="Update_By_Example_Where_Clause" />
|
||||
</if>
|
||||
</update>
|
||||
<update id="updateByPrimaryKeySelective" parameterType="org.linlinjava.litemall.db.domain.LitemallPermission">
|
||||
<!--
|
||||
WARNING - @mbg.generated
|
||||
This element is automatically generated by MyBatis Generator, do not modify.
|
||||
-->
|
||||
update litemall_permission
|
||||
<set>
|
||||
<if test="roleId != null">
|
||||
role_id = #{roleId,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="permission != null">
|
||||
permission = #{permission,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="addTime != null">
|
||||
add_time = #{addTime,jdbcType=TIMESTAMP},
|
||||
</if>
|
||||
<if test="updateTime != null">
|
||||
update_time = #{updateTime,jdbcType=TIMESTAMP},
|
||||
</if>
|
||||
<if test="deleted != null">
|
||||
deleted = #{deleted,jdbcType=BIT},
|
||||
</if>
|
||||
</set>
|
||||
where id = #{id,jdbcType=INTEGER}
|
||||
</update>
|
||||
<update id="updateByPrimaryKey" parameterType="org.linlinjava.litemall.db.domain.LitemallPermission">
|
||||
<!--
|
||||
WARNING - @mbg.generated
|
||||
This element is automatically generated by MyBatis Generator, do not modify.
|
||||
-->
|
||||
update litemall_permission
|
||||
set role_id = #{roleId,jdbcType=INTEGER},
|
||||
permission = #{permission,jdbcType=VARCHAR},
|
||||
add_time = #{addTime,jdbcType=TIMESTAMP},
|
||||
update_time = #{updateTime,jdbcType=TIMESTAMP},
|
||||
deleted = #{deleted,jdbcType=BIT}
|
||||
where id = #{id,jdbcType=INTEGER}
|
||||
</update>
|
||||
<select id="selectOneByExample" parameterType="org.linlinjava.litemall.db.domain.LitemallPermissionExample" resultMap="BaseResultMap">
|
||||
<!--
|
||||
WARNING - @mbg.generated
|
||||
This element is automatically generated by MyBatis Generator, do not modify.
|
||||
@project https://github.com/itfsw/mybatis-generator-plugin
|
||||
-->
|
||||
select
|
||||
<include refid="Base_Column_List" />
|
||||
from litemall_permission
|
||||
<if test="_parameter != null">
|
||||
<include refid="Example_Where_Clause" />
|
||||
</if>
|
||||
<if test="orderByClause != null">
|
||||
order by ${orderByClause}
|
||||
</if>
|
||||
limit 1
|
||||
</select>
|
||||
<select id="selectOneByExampleSelective" parameterType="map" resultMap="BaseResultMap">
|
||||
<!--
|
||||
WARNING - @mbg.generated
|
||||
This element is automatically generated by MyBatis Generator, do not modify.
|
||||
@project https://github.com/itfsw/mybatis-generator-plugin
|
||||
-->
|
||||
select
|
||||
<choose>
|
||||
<when test="selective != null and selective.length > 0">
|
||||
<foreach collection="selective" item="column" separator=",">
|
||||
${column.escapedColumnName}
|
||||
</foreach>
|
||||
</when>
|
||||
<otherwise>
|
||||
id, role_id, permission, add_time, update_time, deleted
|
||||
</otherwise>
|
||||
</choose>
|
||||
from litemall_permission
|
||||
<if test="_parameter != null">
|
||||
<include refid="Update_By_Example_Where_Clause" />
|
||||
</if>
|
||||
<if test="example.orderByClause != null">
|
||||
order by ${example.orderByClause}
|
||||
</if>
|
||||
limit 1
|
||||
</select>
|
||||
<update id="logicalDeleteByExample" parameterType="map">
|
||||
<!--
|
||||
WARNING - @mbg.generated
|
||||
This element is automatically generated by MyBatis Generator, do not modify.
|
||||
@project https://github.com/itfsw/mybatis-generator-plugin
|
||||
-->
|
||||
update litemall_permission set deleted = 1
|
||||
<if test="_parameter != null">
|
||||
<include refid="Update_By_Example_Where_Clause" />
|
||||
</if>
|
||||
</update>
|
||||
<update id="logicalDeleteByPrimaryKey" parameterType="java.lang.Integer">
|
||||
<!--
|
||||
WARNING - @mbg.generated
|
||||
This element is automatically generated by MyBatis Generator, do not modify.
|
||||
@project https://github.com/itfsw/mybatis-generator-plugin
|
||||
-->
|
||||
update litemall_permission set deleted = 1
|
||||
where id = #{id,jdbcType=INTEGER}
|
||||
</update>
|
||||
</mapper>
|
||||
@@ -0,0 +1,438 @@
|
||||
<?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="org.linlinjava.litemall.db.dao.LitemallRoleMapper">
|
||||
<resultMap id="BaseResultMap" type="org.linlinjava.litemall.db.domain.LitemallRole">
|
||||
<!--
|
||||
WARNING - @mbg.generated
|
||||
This element is automatically generated by MyBatis Generator, do not modify.
|
||||
-->
|
||||
<id column="id" jdbcType="INTEGER" property="id" />
|
||||
<result column="name" jdbcType="VARCHAR" property="name" />
|
||||
<result column="desc" jdbcType="VARCHAR" property="desc" />
|
||||
<result column="enabled" jdbcType="BIT" property="enabled" />
|
||||
<result column="add_time" jdbcType="TIMESTAMP" property="addTime" />
|
||||
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
|
||||
<result column="deleted" jdbcType="BIT" property="deleted" />
|
||||
</resultMap>
|
||||
<sql id="Example_Where_Clause">
|
||||
<!--
|
||||
WARNING - @mbg.generated
|
||||
This element is automatically generated by MyBatis Generator, do not modify.
|
||||
-->
|
||||
<where>
|
||||
<foreach collection="oredCriteria" item="criteria" separator="or">
|
||||
<if test="criteria.valid">
|
||||
<trim prefix="(" prefixOverrides="and" suffix=")">
|
||||
<foreach collection="criteria.criteria" item="criterion">
|
||||
<choose>
|
||||
<when test="criterion.noValue">
|
||||
and ${criterion.condition}
|
||||
</when>
|
||||
<when test="criterion.singleValue">
|
||||
and ${criterion.condition} #{criterion.value}
|
||||
</when>
|
||||
<when test="criterion.betweenValue">
|
||||
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
|
||||
</when>
|
||||
<when test="criterion.listValue">
|
||||
and ${criterion.condition}
|
||||
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
|
||||
#{listItem}
|
||||
</foreach>
|
||||
</when>
|
||||
</choose>
|
||||
</foreach>
|
||||
</trim>
|
||||
</if>
|
||||
</foreach>
|
||||
</where>
|
||||
</sql>
|
||||
<sql id="Update_By_Example_Where_Clause">
|
||||
<!--
|
||||
WARNING - @mbg.generated
|
||||
This element is automatically generated by MyBatis Generator, do not modify.
|
||||
-->
|
||||
<where>
|
||||
<foreach collection="example.oredCriteria" item="criteria" separator="or">
|
||||
<if test="criteria.valid">
|
||||
<trim prefix="(" prefixOverrides="and" suffix=")">
|
||||
<foreach collection="criteria.criteria" item="criterion">
|
||||
<choose>
|
||||
<when test="criterion.noValue">
|
||||
and ${criterion.condition}
|
||||
</when>
|
||||
<when test="criterion.singleValue">
|
||||
and ${criterion.condition} #{criterion.value}
|
||||
</when>
|
||||
<when test="criterion.betweenValue">
|
||||
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
|
||||
</when>
|
||||
<when test="criterion.listValue">
|
||||
and ${criterion.condition}
|
||||
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
|
||||
#{listItem}
|
||||
</foreach>
|
||||
</when>
|
||||
</choose>
|
||||
</foreach>
|
||||
</trim>
|
||||
</if>
|
||||
</foreach>
|
||||
</where>
|
||||
</sql>
|
||||
<sql id="Base_Column_List">
|
||||
<!--
|
||||
WARNING - @mbg.generated
|
||||
This element is automatically generated by MyBatis Generator, do not modify.
|
||||
-->
|
||||
id, `name`, `desc`, enabled, add_time, update_time, deleted
|
||||
</sql>
|
||||
<select id="selectByExample" parameterType="org.linlinjava.litemall.db.domain.LitemallRoleExample" resultMap="BaseResultMap">
|
||||
<!--
|
||||
WARNING - @mbg.generated
|
||||
This element is automatically generated by MyBatis Generator, do not modify.
|
||||
-->
|
||||
select
|
||||
<if test="distinct">
|
||||
distinct
|
||||
</if>
|
||||
<include refid="Base_Column_List" />
|
||||
from litemall_role
|
||||
<if test="_parameter != null">
|
||||
<include refid="Example_Where_Clause" />
|
||||
</if>
|
||||
<if test="orderByClause != null">
|
||||
order by ${orderByClause}
|
||||
</if>
|
||||
</select>
|
||||
<select id="selectByExampleSelective" parameterType="map" resultMap="BaseResultMap">
|
||||
<!--
|
||||
WARNING - @mbg.generated
|
||||
This element is automatically generated by MyBatis Generator, do not modify.
|
||||
@project https://github.com/itfsw/mybatis-generator-plugin
|
||||
-->
|
||||
select
|
||||
<if test="example.distinct">
|
||||
distinct
|
||||
</if>
|
||||
<choose>
|
||||
<when test="selective != null and selective.length > 0">
|
||||
<foreach collection="selective" item="column" separator=",">
|
||||
${column.escapedColumnName}
|
||||
</foreach>
|
||||
</when>
|
||||
<otherwise>
|
||||
id, `name`, `desc`, enabled, add_time, update_time, deleted
|
||||
</otherwise>
|
||||
</choose>
|
||||
from litemall_role
|
||||
<if test="_parameter != null">
|
||||
<include refid="Update_By_Example_Where_Clause" />
|
||||
</if>
|
||||
<if test="example.orderByClause != null">
|
||||
order by ${example.orderByClause}
|
||||
</if>
|
||||
</select>
|
||||
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
|
||||
<!--
|
||||
WARNING - @mbg.generated
|
||||
This element is automatically generated by MyBatis Generator, do not modify.
|
||||
-->
|
||||
select
|
||||
<include refid="Base_Column_List" />
|
||||
from litemall_role
|
||||
where id = #{id,jdbcType=INTEGER}
|
||||
</select>
|
||||
<select id="selectByPrimaryKeyWithLogicalDelete" parameterType="map" resultMap="BaseResultMap">
|
||||
<!--
|
||||
WARNING - @mbg.generated
|
||||
This element is automatically generated by MyBatis Generator, do not modify.
|
||||
@project https://github.com/itfsw/mybatis-generator-plugin
|
||||
-->
|
||||
<!--
|
||||
WARNING - @mbg.generated
|
||||
This element is automatically generated by MyBatis Generator, do not modify.
|
||||
-->
|
||||
select
|
||||
<include refid="Base_Column_List" />
|
||||
from litemall_role
|
||||
where id = #{id,jdbcType=INTEGER}
|
||||
and deleted =
|
||||
<choose>
|
||||
<when test="andLogicalDeleted">
|
||||
1
|
||||
</when>
|
||||
<otherwise>
|
||||
0
|
||||
</otherwise>
|
||||
</choose>
|
||||
</select>
|
||||
<select id="selectByPrimaryKeySelective" parameterType="map" resultMap="BaseResultMap">
|
||||
<!--
|
||||
WARNING - @mbg.generated
|
||||
This element is automatically generated by MyBatis Generator, do not modify.
|
||||
@project https://github.com/itfsw/mybatis-generator-plugin
|
||||
-->
|
||||
select
|
||||
<choose>
|
||||
<when test="selective != null and selective.length > 0">
|
||||
<foreach collection="selective" item="column" separator=",">
|
||||
${column.escapedColumnName}
|
||||
</foreach>
|
||||
</when>
|
||||
<otherwise>
|
||||
id, `name`, `desc`, enabled, add_time, update_time, deleted
|
||||
</otherwise>
|
||||
</choose>
|
||||
from litemall_role
|
||||
where id = #{id,jdbcType=INTEGER}
|
||||
</select>
|
||||
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
|
||||
<!--
|
||||
WARNING - @mbg.generated
|
||||
This element is automatically generated by MyBatis Generator, do not modify.
|
||||
-->
|
||||
delete from litemall_role
|
||||
where id = #{id,jdbcType=INTEGER}
|
||||
</delete>
|
||||
<delete id="deleteByExample" parameterType="org.linlinjava.litemall.db.domain.LitemallRoleExample">
|
||||
<!--
|
||||
WARNING - @mbg.generated
|
||||
This element is automatically generated by MyBatis Generator, do not modify.
|
||||
-->
|
||||
delete from litemall_role
|
||||
<if test="_parameter != null">
|
||||
<include refid="Example_Where_Clause" />
|
||||
</if>
|
||||
</delete>
|
||||
<insert id="insert" parameterType="org.linlinjava.litemall.db.domain.LitemallRole">
|
||||
<!--
|
||||
WARNING - @mbg.generated
|
||||
This element is automatically generated by MyBatis Generator, do not modify.
|
||||
-->
|
||||
<selectKey keyProperty="id" order="AFTER" resultType="java.lang.Integer">
|
||||
SELECT LAST_INSERT_ID()
|
||||
</selectKey>
|
||||
insert into litemall_role (`name`, `desc`, enabled,
|
||||
add_time, update_time, deleted
|
||||
)
|
||||
values (#{name,jdbcType=VARCHAR}, #{desc,jdbcType=VARCHAR}, #{enabled,jdbcType=BIT},
|
||||
#{addTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}, #{deleted,jdbcType=BIT}
|
||||
)
|
||||
</insert>
|
||||
<insert id="insertSelective" parameterType="org.linlinjava.litemall.db.domain.LitemallRole">
|
||||
<!--
|
||||
WARNING - @mbg.generated
|
||||
This element is automatically generated by MyBatis Generator, do not modify.
|
||||
-->
|
||||
<selectKey keyProperty="id" order="AFTER" resultType="java.lang.Integer">
|
||||
SELECT LAST_INSERT_ID()
|
||||
</selectKey>
|
||||
insert into litemall_role
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="name != null">
|
||||
`name`,
|
||||
</if>
|
||||
<if test="desc != null">
|
||||
`desc`,
|
||||
</if>
|
||||
<if test="enabled != null">
|
||||
enabled,
|
||||
</if>
|
||||
<if test="addTime != null">
|
||||
add_time,
|
||||
</if>
|
||||
<if test="updateTime != null">
|
||||
update_time,
|
||||
</if>
|
||||
<if test="deleted != null">
|
||||
deleted,
|
||||
</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="name != null">
|
||||
#{name,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="desc != null">
|
||||
#{desc,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="enabled != null">
|
||||
#{enabled,jdbcType=BIT},
|
||||
</if>
|
||||
<if test="addTime != null">
|
||||
#{addTime,jdbcType=TIMESTAMP},
|
||||
</if>
|
||||
<if test="updateTime != null">
|
||||
#{updateTime,jdbcType=TIMESTAMP},
|
||||
</if>
|
||||
<if test="deleted != null">
|
||||
#{deleted,jdbcType=BIT},
|
||||
</if>
|
||||
</trim>
|
||||
</insert>
|
||||
<select id="countByExample" parameterType="org.linlinjava.litemall.db.domain.LitemallRoleExample" resultType="java.lang.Long">
|
||||
<!--
|
||||
WARNING - @mbg.generated
|
||||
This element is automatically generated by MyBatis Generator, do not modify.
|
||||
-->
|
||||
select count(*) from litemall_role
|
||||
<if test="_parameter != null">
|
||||
<include refid="Example_Where_Clause" />
|
||||
</if>
|
||||
</select>
|
||||
<update id="updateByExampleSelective" parameterType="map">
|
||||
<!--
|
||||
WARNING - @mbg.generated
|
||||
This element is automatically generated by MyBatis Generator, do not modify.
|
||||
-->
|
||||
update litemall_role
|
||||
<set>
|
||||
<if test="record.id != null">
|
||||
id = #{record.id,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="record.name != null">
|
||||
`name` = #{record.name,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="record.desc != null">
|
||||
`desc` = #{record.desc,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="record.enabled != null">
|
||||
enabled = #{record.enabled,jdbcType=BIT},
|
||||
</if>
|
||||
<if test="record.addTime != null">
|
||||
add_time = #{record.addTime,jdbcType=TIMESTAMP},
|
||||
</if>
|
||||
<if test="record.updateTime != null">
|
||||
update_time = #{record.updateTime,jdbcType=TIMESTAMP},
|
||||
</if>
|
||||
<if test="record.deleted != null">
|
||||
deleted = #{record.deleted,jdbcType=BIT},
|
||||
</if>
|
||||
</set>
|
||||
<if test="_parameter != null">
|
||||
<include refid="Update_By_Example_Where_Clause" />
|
||||
</if>
|
||||
</update>
|
||||
<update id="updateByExample" parameterType="map">
|
||||
<!--
|
||||
WARNING - @mbg.generated
|
||||
This element is automatically generated by MyBatis Generator, do not modify.
|
||||
-->
|
||||
update litemall_role
|
||||
set id = #{record.id,jdbcType=INTEGER},
|
||||
`name` = #{record.name,jdbcType=VARCHAR},
|
||||
`desc` = #{record.desc,jdbcType=VARCHAR},
|
||||
enabled = #{record.enabled,jdbcType=BIT},
|
||||
add_time = #{record.addTime,jdbcType=TIMESTAMP},
|
||||
update_time = #{record.updateTime,jdbcType=TIMESTAMP},
|
||||
deleted = #{record.deleted,jdbcType=BIT}
|
||||
<if test="_parameter != null">
|
||||
<include refid="Update_By_Example_Where_Clause" />
|
||||
</if>
|
||||
</update>
|
||||
<update id="updateByPrimaryKeySelective" parameterType="org.linlinjava.litemall.db.domain.LitemallRole">
|
||||
<!--
|
||||
WARNING - @mbg.generated
|
||||
This element is automatically generated by MyBatis Generator, do not modify.
|
||||
-->
|
||||
update litemall_role
|
||||
<set>
|
||||
<if test="name != null">
|
||||
`name` = #{name,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="desc != null">
|
||||
`desc` = #{desc,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="enabled != null">
|
||||
enabled = #{enabled,jdbcType=BIT},
|
||||
</if>
|
||||
<if test="addTime != null">
|
||||
add_time = #{addTime,jdbcType=TIMESTAMP},
|
||||
</if>
|
||||
<if test="updateTime != null">
|
||||
update_time = #{updateTime,jdbcType=TIMESTAMP},
|
||||
</if>
|
||||
<if test="deleted != null">
|
||||
deleted = #{deleted,jdbcType=BIT},
|
||||
</if>
|
||||
</set>
|
||||
where id = #{id,jdbcType=INTEGER}
|
||||
</update>
|
||||
<update id="updateByPrimaryKey" parameterType="org.linlinjava.litemall.db.domain.LitemallRole">
|
||||
<!--
|
||||
WARNING - @mbg.generated
|
||||
This element is automatically generated by MyBatis Generator, do not modify.
|
||||
-->
|
||||
update litemall_role
|
||||
set `name` = #{name,jdbcType=VARCHAR},
|
||||
`desc` = #{desc,jdbcType=VARCHAR},
|
||||
enabled = #{enabled,jdbcType=BIT},
|
||||
add_time = #{addTime,jdbcType=TIMESTAMP},
|
||||
update_time = #{updateTime,jdbcType=TIMESTAMP},
|
||||
deleted = #{deleted,jdbcType=BIT}
|
||||
where id = #{id,jdbcType=INTEGER}
|
||||
</update>
|
||||
<select id="selectOneByExample" parameterType="org.linlinjava.litemall.db.domain.LitemallRoleExample" resultMap="BaseResultMap">
|
||||
<!--
|
||||
WARNING - @mbg.generated
|
||||
This element is automatically generated by MyBatis Generator, do not modify.
|
||||
@project https://github.com/itfsw/mybatis-generator-plugin
|
||||
-->
|
||||
select
|
||||
<include refid="Base_Column_List" />
|
||||
from litemall_role
|
||||
<if test="_parameter != null">
|
||||
<include refid="Example_Where_Clause" />
|
||||
</if>
|
||||
<if test="orderByClause != null">
|
||||
order by ${orderByClause}
|
||||
</if>
|
||||
limit 1
|
||||
</select>
|
||||
<select id="selectOneByExampleSelective" parameterType="map" resultMap="BaseResultMap">
|
||||
<!--
|
||||
WARNING - @mbg.generated
|
||||
This element is automatically generated by MyBatis Generator, do not modify.
|
||||
@project https://github.com/itfsw/mybatis-generator-plugin
|
||||
-->
|
||||
select
|
||||
<choose>
|
||||
<when test="selective != null and selective.length > 0">
|
||||
<foreach collection="selective" item="column" separator=",">
|
||||
${column.escapedColumnName}
|
||||
</foreach>
|
||||
</when>
|
||||
<otherwise>
|
||||
id, `name`, `desc`, enabled, add_time, update_time, deleted
|
||||
</otherwise>
|
||||
</choose>
|
||||
from litemall_role
|
||||
<if test="_parameter != null">
|
||||
<include refid="Update_By_Example_Where_Clause" />
|
||||
</if>
|
||||
<if test="example.orderByClause != null">
|
||||
order by ${example.orderByClause}
|
||||
</if>
|
||||
limit 1
|
||||
</select>
|
||||
<update id="logicalDeleteByExample" parameterType="map">
|
||||
<!--
|
||||
WARNING - @mbg.generated
|
||||
This element is automatically generated by MyBatis Generator, do not modify.
|
||||
@project https://github.com/itfsw/mybatis-generator-plugin
|
||||
-->
|
||||
update litemall_role set deleted = 1
|
||||
<if test="_parameter != null">
|
||||
<include refid="Update_By_Example_Where_Clause" />
|
||||
</if>
|
||||
</update>
|
||||
<update id="logicalDeleteByPrimaryKey" parameterType="java.lang.Integer">
|
||||
<!--
|
||||
WARNING - @mbg.generated
|
||||
This element is automatically generated by MyBatis Generator, do not modify.
|
||||
@project https://github.com/itfsw/mybatis-generator-plugin
|
||||
-->
|
||||
update litemall_role set deleted = 1
|
||||
where id = #{id,jdbcType=INTEGER}
|
||||
</update>
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user