新增权限管理相关接口

This commit is contained in:
macro
2020-03-07 17:04:02 +08:00
parent c6de75d6d8
commit 1c95f29e1b
92 changed files with 5854 additions and 1123 deletions

View File

@@ -1,7 +1,7 @@
package com.macro.mall.bo;
import com.macro.mall.model.UmsAdmin;
import com.macro.mall.model.UmsPermission;
import com.macro.mall.model.UmsResource;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.authority.SimpleGrantedAuthority;
import org.springframework.security.core.userdetails.UserDetails;
@@ -16,18 +16,17 @@ import java.util.stream.Collectors;
*/
public class AdminUserDetails implements UserDetails {
private UmsAdmin umsAdmin;
private List<UmsPermission> permissionList;
public AdminUserDetails(UmsAdmin umsAdmin,List<UmsPermission> permissionList) {
private List<UmsResource> resourceList;
public AdminUserDetails(UmsAdmin umsAdmin,List<UmsResource> resourceList) {
this.umsAdmin = umsAdmin;
this.permissionList = permissionList;
this.resourceList = resourceList;
}
@Override
public Collection<? extends GrantedAuthority> getAuthorities() {
//返回当前用户的权限
return permissionList.stream()
.filter(permission -> permission.getValue()!=null)
.map(permission ->new SimpleGrantedAuthority(permission.getValue()))
//返回当前用户的角色
return resourceList.stream()
.map(role ->new SimpleGrantedAuthority(role.getId()+":"+role.getName()))
.collect(Collectors.toList());
}

View File

@@ -1,29 +1,56 @@
package com.macro.mall.config;
import com.macro.mall.model.UmsResource;
import com.macro.mall.security.component.DynamicSecurityService;
import com.macro.mall.security.config.SecurityConfig;
import com.macro.mall.service.UmsAdminService;
import com.macro.mall.service.UmsResourceService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.access.ConfigAttribute;
import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.core.userdetails.UserDetailsService;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
/**
* mall-security模块相关配置
* Created by macro on 2019/11/5.
* Created by macro on 2019/11/9.
*/
@Configuration
@EnableWebSecurity
@EnableGlobalMethodSecurity(prePostEnabled=true)
@EnableGlobalMethodSecurity(prePostEnabled = true)
public class MallSecurityConfig extends SecurityConfig {
@Autowired
private UmsAdminService adminService;
@Autowired
private UmsResourceService resourceService;
@Bean
public UserDetailsService userDetailsService() {
//获取登录用户信息
return username -> adminService.loadUserByUsername(username);
}
@Bean
public DynamicSecurityService dynamicSecurityService() {
return new DynamicSecurityService() {
@Override
public Map<String, ConfigAttribute> loadDataSource() {
Map<String, ConfigAttribute> map = new ConcurrentHashMap<>();
List<UmsResource> resourceList = resourceService.listAll();
for (UmsResource resource : resourceList) {
map.put(resource.getUrl(), new org.springframework.security.access.SecurityConfig(resource.getId() + ":" + resource.getName()));
}
return map;
}
};
}
}

View File

@@ -8,7 +8,6 @@ import com.macro.mall.service.PmsBrandService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.stereotype.Controller;
import org.springframework.validation.BindingResult;
import org.springframework.validation.annotation.Validated;
@@ -30,7 +29,6 @@ public class PmsBrandController {
@ApiOperation(value = "获取全部品牌列表")
@RequestMapping(value = "/listAll", method = RequestMethod.GET)
@ResponseBody
@PreAuthorize("hasAuthority('pms:brand:read')")
public CommonResult<List<PmsBrand>> getList() {
return CommonResult.success(brandService.listAllBrand());
}
@@ -38,7 +36,6 @@ public class PmsBrandController {
@ApiOperation(value = "添加品牌")
@RequestMapping(value = "/create", method = RequestMethod.POST)
@ResponseBody
@PreAuthorize("hasAuthority('pms:brand:create')")
public CommonResult create(@Validated @RequestBody PmsBrandParam pmsBrand, BindingResult result) {
CommonResult commonResult;
int count = brandService.createBrand(pmsBrand);
@@ -53,7 +50,6 @@ public class PmsBrandController {
@ApiOperation(value = "更新品牌")
@RequestMapping(value = "/update/{id}", method = RequestMethod.POST)
@ResponseBody
@PreAuthorize("hasAuthority('pms:brand:update')")
public CommonResult update(@PathVariable("id") Long id,
@Validated @RequestBody PmsBrandParam pmsBrandParam,
BindingResult result) {
@@ -70,7 +66,6 @@ public class PmsBrandController {
@ApiOperation(value = "删除品牌")
@RequestMapping(value = "/delete/{id}", method = RequestMethod.GET)
@ResponseBody
@PreAuthorize("hasAuthority('pms:brand:delete')")
public CommonResult delete(@PathVariable("id") Long id) {
int count = brandService.deleteBrand(id);
if (count == 1) {
@@ -83,7 +78,6 @@ public class PmsBrandController {
@ApiOperation(value = "根据品牌名称分页获取品牌列表")
@RequestMapping(value = "/list", method = RequestMethod.GET)
@ResponseBody
@PreAuthorize("hasAuthority('pms:brand:read')")
public CommonResult<CommonPage<PmsBrand>> getList(@RequestParam(value = "keyword", required = false) String keyword,
@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
@RequestParam(value = "pageSize", defaultValue = "5") Integer pageSize) {
@@ -94,7 +88,6 @@ public class PmsBrandController {
@ApiOperation(value = "根据编号查询品牌信息")
@RequestMapping(value = "/{id}", method = RequestMethod.GET)
@ResponseBody
@PreAuthorize("hasAuthority('pms:brand:read')")
public CommonResult<PmsBrand> getItem(@PathVariable("id") Long id) {
return CommonResult.success(brandService.getBrand(id));
}
@@ -102,7 +95,6 @@ public class PmsBrandController {
@ApiOperation(value = "批量删除品牌")
@RequestMapping(value = "/delete/batch", method = RequestMethod.POST)
@ResponseBody
@PreAuthorize("hasAuthority('pms:brand:delete')")
public CommonResult deleteBatch(@RequestParam("ids") List<Long> ids) {
int count = brandService.deleteBrand(ids);
if (count > 0) {
@@ -115,7 +107,6 @@ public class PmsBrandController {
@ApiOperation(value = "批量更新显示状态")
@RequestMapping(value = "/update/showStatus", method = RequestMethod.POST)
@ResponseBody
@PreAuthorize("hasAuthority('pms:brand:update')")
public CommonResult updateShowStatus(@RequestParam("ids") List<Long> ids,
@RequestParam("showStatus") Integer showStatus) {
int count = brandService.updateShowStatus(ids, showStatus);
@@ -129,7 +120,6 @@ public class PmsBrandController {
@ApiOperation(value = "批量更新厂家制造商状态")
@RequestMapping(value = "/update/factoryStatus", method = RequestMethod.POST)
@ResponseBody
@PreAuthorize("hasAuthority('pms:brand:update')")
public CommonResult updateFactoryStatus(@RequestParam("ids") List<Long> ids,
@RequestParam("factoryStatus") Integer factoryStatus) {
int count = brandService.updateFactoryStatus(ids, factoryStatus);

View File

@@ -9,7 +9,6 @@ import com.macro.mall.service.PmsProductCategoryService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.stereotype.Controller;
import org.springframework.validation.BindingResult;
import org.springframework.validation.annotation.Validated;
@@ -31,7 +30,6 @@ public class PmsProductCategoryController {
@ApiOperation("添加产品分类")
@RequestMapping(value = "/create", method = RequestMethod.POST)
@ResponseBody
@PreAuthorize("hasAuthority('pms:productCategory:create')")
public CommonResult create(@Validated @RequestBody PmsProductCategoryParam productCategoryParam,
BindingResult result) {
int count = productCategoryService.create(productCategoryParam);
@@ -45,7 +43,6 @@ public class PmsProductCategoryController {
@ApiOperation("修改商品分类")
@RequestMapping(value = "/update/{id}", method = RequestMethod.POST)
@ResponseBody
@PreAuthorize("hasAuthority('pms:productCategory:update')")
public CommonResult update(@PathVariable Long id,
@Validated
@RequestBody PmsProductCategoryParam productCategoryParam,
@@ -61,7 +58,6 @@ public class PmsProductCategoryController {
@ApiOperation("分页查询商品分类")
@RequestMapping(value = "/list/{parentId}", method = RequestMethod.GET)
@ResponseBody
@PreAuthorize("hasAuthority('pms:productCategory:read')")
public CommonResult<CommonPage<PmsProductCategory>> getList(@PathVariable Long parentId,
@RequestParam(value = "pageSize", defaultValue = "5") Integer pageSize,
@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum) {
@@ -72,7 +68,6 @@ public class PmsProductCategoryController {
@ApiOperation("根据id获取商品分类")
@RequestMapping(value = "/{id}", method = RequestMethod.GET)
@ResponseBody
@PreAuthorize("hasAuthority('pms:productCategory:read')")
public CommonResult<PmsProductCategory> getItem(@PathVariable Long id) {
PmsProductCategory productCategory = productCategoryService.getItem(id);
return CommonResult.success(productCategory);
@@ -81,7 +76,6 @@ public class PmsProductCategoryController {
@ApiOperation("删除商品分类")
@RequestMapping(value = "/delete/{id}", method = RequestMethod.POST)
@ResponseBody
@PreAuthorize("hasAuthority('pms:productCategory:delete')")
public CommonResult delete(@PathVariable Long id) {
int count = productCategoryService.delete(id);
if (count > 0) {
@@ -94,7 +88,6 @@ public class PmsProductCategoryController {
@ApiOperation("修改导航栏显示状态")
@RequestMapping(value = "/update/navStatus", method = RequestMethod.POST)
@ResponseBody
@PreAuthorize("hasAuthority('pms:productCategory:update')")
public CommonResult updateNavStatus(@RequestParam("ids") List<Long> ids, @RequestParam("navStatus") Integer navStatus) {
int count = productCategoryService.updateNavStatus(ids, navStatus);
if (count > 0) {
@@ -107,7 +100,6 @@ public class PmsProductCategoryController {
@ApiOperation("修改显示状态")
@RequestMapping(value = "/update/showStatus", method = RequestMethod.POST)
@ResponseBody
@PreAuthorize("hasAuthority('pms:productCategory:update')")
public CommonResult updateShowStatus(@RequestParam("ids") List<Long> ids, @RequestParam("showStatus") Integer showStatus) {
int count = productCategoryService.updateShowStatus(ids, showStatus);
if (count > 0) {
@@ -120,7 +112,6 @@ public class PmsProductCategoryController {
@ApiOperation("查询所有一级分类及子分类")
@RequestMapping(value = "/list/withChildren", method = RequestMethod.GET)
@ResponseBody
@PreAuthorize("hasAuthority('pms:productCategory:read')")
public CommonResult<List<PmsProductCategoryWithChildrenItem>> listWithChildren() {
List<PmsProductCategoryWithChildrenItem> list = productCategoryService.listWithChildren();
return CommonResult.success(list);

View File

@@ -10,7 +10,6 @@ import com.macro.mall.service.PmsProductService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.stereotype.Controller;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.*;
@@ -31,7 +30,6 @@ public class PmsProductController {
@ApiOperation("创建商品")
@RequestMapping(value = "/create", method = RequestMethod.POST)
@ResponseBody
@PreAuthorize("hasAuthority('pms:product:create')")
public CommonResult create(@RequestBody PmsProductParam productParam, BindingResult bindingResult) {
int count = productService.create(productParam);
if (count > 0) {
@@ -44,7 +42,6 @@ public class PmsProductController {
@ApiOperation("根据商品id获取商品编辑信息")
@RequestMapping(value = "/updateInfo/{id}", method = RequestMethod.GET)
@ResponseBody
@PreAuthorize("hasAuthority('pms:product:read')")
public CommonResult<PmsProductResult> getUpdateInfo(@PathVariable Long id) {
PmsProductResult productResult = productService.getUpdateInfo(id);
return CommonResult.success(productResult);
@@ -53,7 +50,6 @@ public class PmsProductController {
@ApiOperation("更新商品")
@RequestMapping(value = "/update/{id}", method = RequestMethod.POST)
@ResponseBody
@PreAuthorize("hasAuthority('pms:product:update')")
public CommonResult update(@PathVariable Long id, @RequestBody PmsProductParam productParam, BindingResult bindingResult) {
int count = productService.update(id, productParam);
if (count > 0) {
@@ -66,7 +62,6 @@ public class PmsProductController {
@ApiOperation("查询商品")
@RequestMapping(value = "/list", method = RequestMethod.GET)
@ResponseBody
@PreAuthorize("hasAuthority('pms:product:read')")
public CommonResult<CommonPage<PmsProduct>> getList(PmsProductQueryParam productQueryParam,
@RequestParam(value = "pageSize", defaultValue = "5") Integer pageSize,
@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum) {
@@ -85,7 +80,6 @@ public class PmsProductController {
@ApiOperation("批量修改审核状态")
@RequestMapping(value = "/update/verifyStatus", method = RequestMethod.POST)
@ResponseBody
@PreAuthorize("hasAuthority('pms:product:update')")
public CommonResult updateVerifyStatus(@RequestParam("ids") List<Long> ids,
@RequestParam("verifyStatus") Integer verifyStatus,
@RequestParam("detail") String detail) {
@@ -100,7 +94,6 @@ public class PmsProductController {
@ApiOperation("批量上下架")
@RequestMapping(value = "/update/publishStatus", method = RequestMethod.POST)
@ResponseBody
@PreAuthorize("hasAuthority('pms:product:update')")
public CommonResult updatePublishStatus(@RequestParam("ids") List<Long> ids,
@RequestParam("publishStatus") Integer publishStatus) {
int count = productService.updatePublishStatus(ids, publishStatus);
@@ -114,7 +107,6 @@ public class PmsProductController {
@ApiOperation("批量推荐商品")
@RequestMapping(value = "/update/recommendStatus", method = RequestMethod.POST)
@ResponseBody
@PreAuthorize("hasAuthority('pms:product:update')")
public CommonResult updateRecommendStatus(@RequestParam("ids") List<Long> ids,
@RequestParam("recommendStatus") Integer recommendStatus) {
int count = productService.updateRecommendStatus(ids, recommendStatus);
@@ -128,7 +120,6 @@ public class PmsProductController {
@ApiOperation("批量设为新品")
@RequestMapping(value = "/update/newStatus", method = RequestMethod.POST)
@ResponseBody
@PreAuthorize("hasAuthority('pms:product:update')")
public CommonResult updateNewStatus(@RequestParam("ids") List<Long> ids,
@RequestParam("newStatus") Integer newStatus) {
int count = productService.updateNewStatus(ids, newStatus);
@@ -142,7 +133,6 @@ public class PmsProductController {
@ApiOperation("批量修改删除状态")
@RequestMapping(value = "/update/deleteStatus", method = RequestMethod.POST)
@ResponseBody
@PreAuthorize("hasAuthority('pms:product:delete')")
public CommonResult updateDeleteStatus(@RequestParam("ids") List<Long> ids,
@RequestParam("deleteStatus") Integer deleteStatus) {
int count = productService.updateDeleteStatus(ids, deleteStatus);

View File

@@ -4,10 +4,12 @@ import com.macro.mall.common.api.CommonPage;
import com.macro.mall.common.api.CommonResult;
import com.macro.mall.dto.UmsAdminLoginParam;
import com.macro.mall.dto.UmsAdminParam;
import com.macro.mall.dto.UpdateAdminPasswordParam;
import com.macro.mall.model.UmsAdmin;
import com.macro.mall.model.UmsPermission;
import com.macro.mall.model.UmsRole;
import com.macro.mall.service.UmsAdminService;
import com.macro.mall.service.UmsRoleService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
@@ -30,12 +32,14 @@ import java.util.Map;
@Api(tags = "UmsAdminController", description = "后台用户管理")
@RequestMapping("/admin")
public class UmsAdminController {
@Autowired
private UmsAdminService adminService;
@Value("${jwt.tokenHeader}")
private String tokenHeader;
@Value("${jwt.tokenHead}")
private String tokenHead;
@Autowired
private UmsAdminService adminService;
@Autowired
private UmsRoleService roleService;
@ApiOperation(value = "用户注册")
@RequestMapping(value = "/register", method = RequestMethod.POST)
@@ -81,11 +85,15 @@ public class UmsAdminController {
@RequestMapping(value = "/info", method = RequestMethod.GET)
@ResponseBody
public CommonResult getAdminInfo(Principal principal) {
if(principal==null){
return CommonResult.unauthorized(null);
}
String username = principal.getName();
UmsAdmin umsAdmin = adminService.getAdminByUsername(username);
Map<String, Object> data = new HashMap<>();
data.put("username", umsAdmin.getUsername());
data.put("roles", new String[]{"TEST"});
data.put("menus", roleService.getMenuList(umsAdmin.getId()));
data.put("icon", umsAdmin.getIcon());
return CommonResult.success(data);
}
@@ -100,10 +108,10 @@ public class UmsAdminController {
@ApiOperation("根据用户名或姓名分页获取用户列表")
@RequestMapping(value = "/list", method = RequestMethod.GET)
@ResponseBody
public CommonResult<CommonPage<UmsAdmin>> list(@RequestParam(value = "name", required = false) String name,
public CommonResult<CommonPage<UmsAdmin>> list(@RequestParam(value = "keyword", required = false) String keyword,
@RequestParam(value = "pageSize", defaultValue = "5") Integer pageSize,
@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum) {
List<UmsAdmin> adminList = adminService.list(name, pageSize, pageNum);
List<UmsAdmin> adminList = adminService.list(keyword, pageSize, pageNum);
return CommonResult.success(CommonPage.restPage(adminList));
}
@@ -126,6 +134,24 @@ public class UmsAdminController {
return CommonResult.failed();
}
@ApiOperation("修改指定用户密码")
@RequestMapping(value = "/updatePassword", method = RequestMethod.POST)
@ResponseBody
public CommonResult updatePassword(@RequestBody UpdateAdminPasswordParam updatePasswordParam) {
int status = adminService.updatePassword(updatePasswordParam);
if (status > 0) {
return CommonResult.success(status);
} else if (status == -1) {
return CommonResult.failed("提交参数不合法");
} else if (status == -2) {
return CommonResult.failed("找不到该用户");
} else if (status == -3) {
return CommonResult.failed("旧密码错误");
} else {
return CommonResult.failed();
}
}
@ApiOperation("删除指定用户信息")
@RequestMapping(value = "/delete/{id}", method = RequestMethod.POST)
@ResponseBody
@@ -137,6 +163,19 @@ public class UmsAdminController {
return CommonResult.failed();
}
@ApiOperation("修改帐号状态")
@RequestMapping(value = "/updateStatus/{id}", method = RequestMethod.POST)
@ResponseBody
public CommonResult updateStatus(@PathVariable Long id,@RequestParam(value = "status") Integer status) {
UmsAdmin umsAdmin = new UmsAdmin();
umsAdmin.setStatus(status);
int count = adminService.update(id,umsAdmin);
if (count > 0) {
return CommonResult.success(count);
}
return CommonResult.failed();
}
@ApiOperation("给用户分配角色")
@RequestMapping(value = "/role/update", method = RequestMethod.POST)
@ResponseBody

View File

@@ -0,0 +1,102 @@
package com.macro.mall.controller;
import com.macro.mall.common.api.CommonPage;
import com.macro.mall.common.api.CommonResult;
import com.macro.mall.dto.UmsMenuNode;
import com.macro.mall.model.UmsMenu;
import com.macro.mall.service.UmsMenuService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* 后台菜单管理Controller
* Created by macro on 2020/2/4.
*/
@Controller
@Api(tags = "UmsMenuController", description = "后台菜单管理")
@RequestMapping("/menu")
public class UmsMenuController {
@Autowired
private UmsMenuService menuService;
@ApiOperation("添加后台菜单")
@RequestMapping(value = "/create", method = RequestMethod.POST)
@ResponseBody
public CommonResult create(@RequestBody UmsMenu umsMenu) {
int count = menuService.create(umsMenu);
if (count > 0) {
return CommonResult.success(count);
} else {
return CommonResult.failed();
}
}
@ApiOperation("修改后台菜单")
@RequestMapping(value = "/update/{id}", method = RequestMethod.POST)
@ResponseBody
public CommonResult update(@PathVariable Long id,
@RequestBody UmsMenu umsMenu) {
int count = menuService.update(id, umsMenu);
if (count > 0) {
return CommonResult.success(count);
} else {
return CommonResult.failed();
}
}
@ApiOperation("根据ID获取菜单详情")
@RequestMapping(value = "/{id}", method = RequestMethod.GET)
@ResponseBody
public CommonResult<UmsMenu> getItem(@PathVariable Long id) {
UmsMenu umsMenu = menuService.getItem(id);
return CommonResult.success(umsMenu);
}
@ApiOperation("根据ID删除后台菜单")
@RequestMapping(value = "/delete/{id}", method = RequestMethod.POST)
@ResponseBody
public CommonResult delete(@PathVariable Long id) {
int count = menuService.delete(id);
if (count > 0) {
return CommonResult.success(count);
} else {
return CommonResult.failed();
}
}
@ApiOperation("分页查询后台菜单")
@RequestMapping(value = "/list/{parentId}", method = RequestMethod.GET)
@ResponseBody
public CommonResult<CommonPage<UmsMenu>> list(@PathVariable Long parentId,
@RequestParam(value = "pageSize", defaultValue = "5") Integer pageSize,
@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum) {
List<UmsMenu> menuList = menuService.list(parentId, pageSize, pageNum);
return CommonResult.success(CommonPage.restPage(menuList));
}
@ApiOperation("树形结构返回所有菜单列表")
@RequestMapping(value = "/treeList", method = RequestMethod.GET)
@ResponseBody
public CommonResult<List<UmsMenuNode>> treeList() {
List<UmsMenuNode> list = menuService.treeList();
return CommonResult.success(list);
}
@ApiOperation("修改菜单显示状态")
@RequestMapping(value = "/updateHidden/{id}", method = RequestMethod.POST)
@ResponseBody
public CommonResult updateHidden(@PathVariable Long id, @RequestParam("hidden") Integer hidden) {
int count = menuService.updateHidden(id, hidden);
if (count > 0) {
return CommonResult.success(count);
} else {
return CommonResult.failed();
}
}
}

View File

@@ -0,0 +1,69 @@
package com.macro.mall.controller;
import com.macro.mall.common.api.CommonResult;
import com.macro.mall.model.UmsResourceCategory;
import com.macro.mall.service.UmsResourceCategoryService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* 后台资源分类管理Controller
* Created by macro on 2020/2/5.
*/
@Controller
@Api(tags = "UmsResourceCategoryController", description = "后台资源分类管理")
@RequestMapping("/resourceCategory")
public class UmsResourceCategoryController {
@Autowired
private UmsResourceCategoryService resourceCategoryService;
@ApiOperation("查询所有后台资源分类")
@RequestMapping(value = "/listAll", method = RequestMethod.GET)
@ResponseBody
public CommonResult<List<UmsResourceCategory>> listAll() {
List<UmsResourceCategory> resourceList = resourceCategoryService.listAll();
return CommonResult.success(resourceList);
}
@ApiOperation("添加后台资源分类")
@RequestMapping(value = "/create", method = RequestMethod.POST)
@ResponseBody
public CommonResult create(@RequestBody UmsResourceCategory umsResourceCategory) {
int count = resourceCategoryService.create(umsResourceCategory);
if (count > 0) {
return CommonResult.success(count);
} else {
return CommonResult.failed();
}
}
@ApiOperation("修改后台资源分类")
@RequestMapping(value = "/update/{id}", method = RequestMethod.POST)
@ResponseBody
public CommonResult update(@PathVariable Long id,
@RequestBody UmsResourceCategory umsResourceCategory) {
int count = resourceCategoryService.update(id, umsResourceCategory);
if (count > 0) {
return CommonResult.success(count);
} else {
return CommonResult.failed();
}
}
@ApiOperation("根据ID删除后台资源")
@RequestMapping(value = "/delete/{id}", method = RequestMethod.POST)
@ResponseBody
public CommonResult delete(@PathVariable Long id) {
int count = resourceCategoryService.delete(id);
if (count > 0) {
return CommonResult.success(count);
} else {
return CommonResult.failed();
}
}
}

View File

@@ -0,0 +1,97 @@
package com.macro.mall.controller;
import com.macro.mall.common.api.CommonPage;
import com.macro.mall.common.api.CommonResult;
import com.macro.mall.model.UmsResource;
import com.macro.mall.security.component.DynamicSecurityMetadataSource;
import com.macro.mall.service.UmsResourceService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* 后台资源管理Controller
* Created by macro on 2020/2/4.
*/
@Controller
@Api(tags = "UmsResourceController", description = "后台资源管理")
@RequestMapping("/resource")
public class UmsResourceController {
@Autowired
private UmsResourceService resourceService;
@Autowired
private DynamicSecurityMetadataSource dynamicSecurityMetadataSource;
@ApiOperation("添加后台资源")
@RequestMapping(value = "/create", method = RequestMethod.POST)
@ResponseBody
public CommonResult create(@RequestBody UmsResource umsResource) {
int count = resourceService.create(umsResource);
dynamicSecurityMetadataSource.clearDataSource();
if (count > 0) {
return CommonResult.success(count);
} else {
return CommonResult.failed();
}
}
@ApiOperation("修改后台资源")
@RequestMapping(value = "/update/{id}", method = RequestMethod.POST)
@ResponseBody
public CommonResult update(@PathVariable Long id,
@RequestBody UmsResource umsResource) {
int count = resourceService.update(id, umsResource);
dynamicSecurityMetadataSource.clearDataSource();
if (count > 0) {
return CommonResult.success(count);
} else {
return CommonResult.failed();
}
}
@ApiOperation("根据ID获取资源详情")
@RequestMapping(value = "/{id}", method = RequestMethod.GET)
@ResponseBody
public CommonResult<UmsResource> getItem(@PathVariable Long id) {
UmsResource umsResource = resourceService.getItem(id);
return CommonResult.success(umsResource);
}
@ApiOperation("根据ID删除后台资源")
@RequestMapping(value = "/delete/{id}", method = RequestMethod.POST)
@ResponseBody
public CommonResult delete(@PathVariable Long id) {
int count = resourceService.delete(id);
dynamicSecurityMetadataSource.clearDataSource();
if (count > 0) {
return CommonResult.success(count);
} else {
return CommonResult.failed();
}
}
@ApiOperation("分页模糊查询后台资源")
@RequestMapping(value = "/list", method = RequestMethod.GET)
@ResponseBody
public CommonResult<CommonPage<UmsResource>> list(@RequestParam(required = false) Long categoryId,
@RequestParam(required = false) String nameKeyword,
@RequestParam(required = false) String urlKeyword,
@RequestParam(value = "pageSize", defaultValue = "5") Integer pageSize,
@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum) {
List<UmsResource> resourceList = resourceService.list(categoryId,nameKeyword, urlKeyword, pageSize, pageNum);
return CommonResult.success(CommonPage.restPage(resourceList));
}
@ApiOperation("查询所有后台资源")
@RequestMapping(value = "/listAll", method = RequestMethod.GET)
@ResponseBody
public CommonResult<List<UmsResource>> listAll() {
List<UmsResource> resourceList = resourceService.listAll();
return CommonResult.success(resourceList);
}
}

View File

@@ -1,8 +1,8 @@
package com.macro.mall.controller;
import com.macro.mall.common.api.CommonPage;
import com.macro.mall.common.api.CommonResult;
import com.macro.mall.model.UmsPermission;
import com.macro.mall.model.UmsRole;
import com.macro.mall.model.*;
import com.macro.mall.service.UmsRoleService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@@ -77,11 +77,66 @@ public class UmsRoleController {
}
@ApiOperation("获取所有角色")
@RequestMapping(value = "/list", method = RequestMethod.GET)
@RequestMapping(value = "/listAll", method = RequestMethod.GET)
@ResponseBody
public Object list() {
public CommonResult<List<UmsRole>> listAll() {
List<UmsRole> roleList = roleService.list();
return CommonResult.success(roleList);
}
@ApiOperation("根据角色名称分页获取角色列表")
@RequestMapping(value = "/list", method = RequestMethod.GET)
@ResponseBody
public CommonResult<CommonPage<UmsRole>> list(@RequestParam(value = "keyword", required = false) String keyword,
@RequestParam(value = "pageSize", defaultValue = "5") Integer pageSize,
@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum) {
List<UmsRole> roleList = roleService.list(keyword, pageSize, pageNum);
return CommonResult.success(CommonPage.restPage(roleList));
}
@ApiOperation("修改角色状态")
@RequestMapping(value = "/updateStatus/{id}", method = RequestMethod.POST)
@ResponseBody
public CommonResult updateStatus(@PathVariable Long id, @RequestParam(value = "status") Integer status) {
UmsRole umsRole = new UmsRole();
umsRole.setStatus(status);
int count = roleService.update(id, umsRole);
if (count > 0) {
return CommonResult.success(count);
}
return CommonResult.failed();
}
@ApiOperation("获取角色相关菜单")
@RequestMapping(value = "/listMenu/{roleId}", method = RequestMethod.GET)
@ResponseBody
public CommonResult<List<UmsMenu>> listMenu(@PathVariable Long roleId) {
List<UmsMenu> roleList = roleService.listMenu(roleId);
return CommonResult.success(roleList);
}
@ApiOperation("获取角色相关资源")
@RequestMapping(value = "/listResource/{roleId}", method = RequestMethod.GET)
@ResponseBody
public CommonResult<List<UmsResource>> listResource(@PathVariable Long roleId) {
List<UmsResource> roleList = roleService.listResource(roleId);
return CommonResult.success(roleList);
}
@ApiOperation("给角色分配菜单")
@RequestMapping(value = "/allocMenu", method = RequestMethod.POST)
@ResponseBody
public CommonResult allocMenu(@RequestParam Long roleId, @RequestParam List<Long> menuIds) {
int count = roleService.allocMenu(roleId, menuIds);
return CommonResult.success(count);
}
@ApiOperation("给角色分配资源")
@RequestMapping(value = "/allocResource", method = RequestMethod.POST)
@ResponseBody
public CommonResult allocResource(@RequestParam Long roleId, @RequestParam List<Long> resourceIds) {
int count = roleService.allocResource(roleId, resourceIds);
return CommonResult.success(count);
}
}

View File

@@ -10,5 +10,8 @@ import java.util.List;
* Created by macro on 2018/4/26.
*/
public interface CmsPrefrenceAreaProductRelationDao {
/**
* 批量创建
*/
int insertList(@Param("list") List<CmsPrefrenceAreaProductRelation> prefrenceAreaProductRelationList);
}

View File

@@ -10,5 +10,8 @@ import java.util.List;
* Created by macro on 2018/4/26.
*/
public interface CmsSubjectProductRelationDao {
/**
* 批量创建
*/
int insertList(@Param("list") List<CmsSubjectProductRelation> subjectProductRelationList);
}

View File

@@ -10,5 +10,8 @@ import java.util.List;
* Created by macro on 2018/10/12.
*/
public interface OmsOrderOperateHistoryDao {
/**
* 批量创建
*/
int insertList(@Param("list") List<OmsOrderOperateHistory> orderOperateHistoryList);
}

View File

@@ -10,5 +10,8 @@ import java.util.List;
* Created by macro on 2018/4/26.
*/
public interface PmsMemberPriceDao {
/**
* 批量创建
*/
int insertList(@Param("list") List<PmsMemberPrice> memberPriceList);
}

View File

@@ -2,6 +2,7 @@ package com.macro.mall.dao;
import com.macro.mall.model.UmsAdminRoleRelation;
import com.macro.mall.model.UmsPermission;
import com.macro.mall.model.UmsResource;
import com.macro.mall.model.UmsRole;
import org.apache.ibatis.annotations.Param;
@@ -31,4 +32,9 @@ public interface UmsAdminRoleRelationDao {
* 获取用户所有权限(包括+-权限)
*/
List<UmsPermission> getPermissionList(@Param("adminId") Long adminId);
/**
* 获取用户所有可访问资源
*/
List<UmsResource> getResourceList(@Param("adminId") Long adminId);
}

View File

@@ -0,0 +1,19 @@
package com.macro.mall.dao;
import com.macro.mall.model.UmsMenu;
import com.macro.mall.model.UmsResource;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 后台用户角色自定义Dao
* Created by macro on 2020/2/2.
*/
public interface UmsRoleDao {
List<UmsMenu> getMenuList(@Param("adminId") Long adminId);
List<UmsMenu> getMenuListByRoleId(@Param("roleId") Long roleId);
List<UmsResource> getResourceListByRoleId(@Param("roleId") Long roleId);
}

View File

@@ -0,0 +1,17 @@
package com.macro.mall.dto;
import com.macro.mall.model.UmsMenu;
import lombok.Getter;
import lombok.Setter;
import java.util.List;
/**
* 后台菜单节点封装
* Created by macro on 2020/2/4.
*/
@Getter
@Setter
public class UmsMenuNode extends UmsMenu {
private List<UmsMenuNode> children;
}

View File

@@ -7,6 +7,7 @@ import lombok.Setter;
import java.util.List;
/**
* 后台权限节点封装
* Created by macro on 2018/9/30.
*/
public class UmsPermissionNode extends UmsPermission {

View File

@@ -0,0 +1,25 @@
package com.macro.mall.dto;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;
import javax.validation.constraints.NotEmpty;
/**
* 修改用户名密码参数
* Created by macro on 2019/10/9.
*/
@Getter
@Setter
public class UpdateAdminPasswordParam {
@ApiModelProperty(value = "用户名", required = true)
@NotEmpty(message = "用户名不能为空")
private String username;
@ApiModelProperty(value = "旧密码", required = true)
@NotEmpty(message = "旧密码不能为空")
private String oldPassword;
@ApiModelProperty(value = "新密码", required = true)
@NotEmpty(message = "新密码不能为空")
private String newPassword;
}

View File

@@ -10,25 +10,49 @@ import org.springframework.transaction.annotation.Transactional;
import java.util.List;
/**
* 品分类Service
* 品分类Service
* Created by macro on 2018/4/26.
*/
public interface PmsProductCategoryService {
/**
* 创建商品分类
*/
@Transactional
int create(PmsProductCategoryParam pmsProductCategoryParam);
/**
* 修改商品分类
*/
@Transactional
int update(Long id, PmsProductCategoryParam pmsProductCategoryParam);
/**
* 分页获取商品分类
*/
List<PmsProductCategory> getList(Long parentId, Integer pageSize, Integer pageNum);
/**
* 删除商品分类
*/
int delete(Long id);
/**
* 根据ID获取商品分类
*/
PmsProductCategory getItem(Long id);
/**
* 批量修改导航状态
*/
int updateNavStatus(List<Long> ids, Integer navStatus);
/**
* 批量修改显示状态
*/
int updateShowStatus(List<Long> ids, Integer showStatus);
/**
* 以层级形式获取商品分类
*/
List<PmsProductCategoryWithChildrenItem> listWithChildren();
}

View File

@@ -1,8 +1,10 @@
package com.macro.mall.service;
import com.macro.mall.dto.UmsAdminParam;
import com.macro.mall.dto.UpdateAdminPasswordParam;
import com.macro.mall.model.UmsAdmin;
import com.macro.mall.model.UmsPermission;
import com.macro.mall.model.UmsResource;
import com.macro.mall.model.UmsRole;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.transaction.annotation.Transactional;
@@ -46,7 +48,7 @@ public interface UmsAdminService {
/**
* 根据用户名或昵称分页查询用户
*/
List<UmsAdmin> list(String name, Integer pageSize, Integer pageNum);
List<UmsAdmin> list(String keyword, Integer pageSize, Integer pageNum);
/**
* 修改指定用户信息
@@ -69,6 +71,11 @@ public interface UmsAdminService {
*/
List<UmsRole> getRoleList(Long adminId);
/**
* 获取指定用户的可访问资源
*/
List<UmsResource> getResourceList(Long adminId);
/**
* 修改用户的+-权限
*/
@@ -80,6 +87,11 @@ public interface UmsAdminService {
*/
List<UmsPermission> getPermissionList(Long adminId);
/**
* 修改密码
*/
int updatePassword(UpdateAdminPasswordParam updatePasswordParam);
/**
* 获取用户信息
*/

View File

@@ -0,0 +1,47 @@
package com.macro.mall.service;
import com.macro.mall.dto.UmsMenuNode;
import com.macro.mall.model.UmsMenu;
import java.util.List;
/**
* 后台菜单管理Service
* Created by macro on 2020/2/2.
*/
public interface UmsMenuService {
/**
* 创建后台菜单
*/
int create(UmsMenu umsMenu);
/**
* 修改后台菜单
*/
int update(Long id, UmsMenu umsMenu);
/**
* 根据ID获取菜单详情
*/
UmsMenu getItem(Long id);
/**
* 根据ID删除菜单
*/
int delete(Long id);
/**
* 分页查询后台菜单
*/
List<UmsMenu> list(Long parentId, Integer pageSize, Integer pageNum);
/**
* 树形结构返回所有菜单列表
*/
List<UmsMenuNode> treeList();
/**
* 修改菜单显示状态
*/
int updateHidden(Long id, Integer hidden);
}

View File

@@ -0,0 +1,32 @@
package com.macro.mall.service;
import com.macro.mall.model.UmsResourceCategory;
import java.util.List;
/**
* 后台资源分类管理Service
* Created by macro on 2020/2/5.
*/
public interface UmsResourceCategoryService {
/**
* 获取所有资源分类
*/
List<UmsResourceCategory> listAll();
/**
* 创建资源分类
*/
int create(UmsResourceCategory umsResourceCategory);
/**
* 修改资源分类
*/
int update(Long id, UmsResourceCategory umsResourceCategory);
/**
* 删除资源分类
*/
int delete(Long id);
}

View File

@@ -0,0 +1,41 @@
package com.macro.mall.service;
import com.macro.mall.model.UmsResource;
import java.util.List;
/**
* 后台资源管理Service
* Created by macro on 2020/2/2.
*/
public interface UmsResourceService {
/**
* 添加资源
*/
int create(UmsResource umsResource);
/**
* 修改资源
*/
int update(Long id, UmsResource umsResource);
/**
* 获取资源详情
*/
UmsResource getItem(Long id);
/**
* 删除资源
*/
int delete(Long id);
/**
* 分页查询资源
*/
List<UmsResource> list(Long categoryId, String nameKeyword, String urlKeyword, Integer pageSize, Integer pageNum);
/**
* 查询全部资源
*/
List<UmsResource> listAll();
}

View File

@@ -1,6 +1,8 @@
package com.macro.mall.service;
import com.macro.mall.model.UmsMenu;
import com.macro.mall.model.UmsPermission;
import com.macro.mall.model.UmsResource;
import com.macro.mall.model.UmsRole;
import org.springframework.transaction.annotation.Transactional;
@@ -38,7 +40,39 @@ public interface UmsRoleService {
int updatePermission(Long roleId, List<Long> permissionIds);
/**
* 获取角色列表
* 获取所有角色列表
*/
List<UmsRole> list();
/**
* 分页获取角色列表
*/
List<UmsRole> list(String keyword, Integer pageSize, Integer pageNum);
/**
* 根据管理员ID获取对应菜单
*/
List<UmsMenu> getMenuList(Long adminId);
/**
* 获取角色相关菜单
*/
List<UmsMenu> listMenu(Long roleId);
/**
* 获取角色相关资源
*/
List<UmsResource> listResource(Long roleId);
/**
* 给角色分配菜单
*/
@Transactional
int allocMenu(Long roleId, List<Long> menuIds);
/**
* 给角色分配资源
*/
@Transactional
int allocResource(Long roleId, List<Long> resourceIds);
}

View File

@@ -1,5 +1,6 @@
package com.macro.mall.service.impl;
import cn.hutool.core.collection.CollUtil;
import com.github.pagehelper.PageHelper;
import com.macro.mall.dao.*;
import com.macro.mall.dto.PmsProductParam;
@@ -8,7 +9,6 @@ import com.macro.mall.dto.PmsProductResult;
import com.macro.mall.mapper.*;
import com.macro.mall.model.*;
import com.macro.mall.service.PmsProductService;
import io.swagger.annotations.Example;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@@ -21,6 +21,7 @@ import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.stream.Collectors;
/**
* 商品管理Service实现类
@@ -71,7 +72,7 @@ public class PmsProductServiceImpl implements PmsProductService {
PmsProduct product = productParam;
product.setId(null);
productMapper.insertSelective(product);
//根据促销类型设置价格:、阶梯价格、满减价格
//根据促销类型设置价格:会员价格、阶梯价格、满减价格
Long productId = product.getId();
//会员价格
relateAndInsertList(memberPriceDao, productParam.getMemberPriceList(), productId);
@@ -139,11 +140,7 @@ public class PmsProductServiceImpl implements PmsProductService {
productFullReductionMapper.deleteByExample(fullReductionExample);
relateAndInsertList(productFullReductionDao, productParam.getProductFullReductionList(), id);
//修改sku库存信息
PmsSkuStockExample skuStockExample = new PmsSkuStockExample();
skuStockExample.createCriteria().andProductIdEqualTo(id);
skuStockMapper.deleteByExample(skuStockExample);
handleSkuStockCode(productParam.getSkuStockList(),id);
relateAndInsertList(skuStockDao, productParam.getSkuStockList(), id);
handleUpdateSkuStockList(id, productParam);
//修改商品参数,添加自定义商品规格
PmsProductAttributeValueExample productAttributeValueExample = new PmsProductAttributeValueExample();
productAttributeValueExample.createCriteria().andProductIdEqualTo(id);
@@ -163,6 +160,49 @@ public class PmsProductServiceImpl implements PmsProductService {
return count;
}
private void handleUpdateSkuStockList(Long id, PmsProductParam productParam) {
//当前的sku信息
List<PmsSkuStock> currSkuList = productParam.getSkuStockList();
//当前没有sku直接删除
if(CollUtil.isEmpty(currSkuList)){
PmsSkuStockExample skuStockExample = new PmsSkuStockExample();
skuStockExample.createCriteria().andProductIdEqualTo(id);
skuStockMapper.deleteByExample(skuStockExample);
return;
}
//获取初始sku信息
PmsSkuStockExample skuStockExample = new PmsSkuStockExample();
skuStockExample.createCriteria().andProductIdEqualTo(id);
List<PmsSkuStock> oriStuList = skuStockMapper.selectByExample(skuStockExample);
//获取新增sku信息
List<PmsSkuStock> insertSkuList = currSkuList.stream().filter(item->item.getId()==null).collect(Collectors.toList());
//获取需要更新的sku信息
List<PmsSkuStock> updateSkuList = currSkuList.stream().filter(item->item.getId()!=null).collect(Collectors.toList());
List<Long> updateSkuIds = updateSkuList.stream().map(PmsSkuStock::getId).collect(Collectors.toList());
//获取需要删除的sku信息
List<PmsSkuStock> removeSkuList = oriStuList.stream().filter(item-> !updateSkuIds.contains(item.getId())).collect(Collectors.toList());
handleSkuStockCode(insertSkuList,id);
handleSkuStockCode(updateSkuList,id);
//新增sku
if(CollUtil.isNotEmpty(insertSkuList)){
relateAndInsertList(skuStockDao, insertSkuList, id);
}
//删除sku
if(CollUtil.isNotEmpty(removeSkuList)){
List<Long> removeSkuIds = removeSkuList.stream().map(PmsSkuStock::getId).collect(Collectors.toList());
PmsSkuStockExample removeExample = new PmsSkuStockExample();
removeExample.createCriteria().andIdIn(removeSkuIds);
skuStockMapper.deleteByExample(removeExample);
}
//修改sku
if(CollUtil.isNotEmpty(updateSkuList)){
for (PmsSkuStock pmsSkuStock : updateSkuList) {
skuStockMapper.updateByPrimaryKeySelective(pmsSkuStock);
}
}
}
@Override
public List<PmsProduct> list(PmsProductQueryParam productQueryParam, Integer pageSize, Integer pageNum) {
PageHelper.startPage(pageNum, pageSize);
@@ -260,70 +300,6 @@ public class PmsProductServiceImpl implements PmsProductService {
return productMapper.selectByExample(productExample);
}
/**
* @deprecated 旧版创建
*/
public int createOld(PmsProductParam productParam) {
int count;
//创建商品
PmsProduct product = productParam;
product.setId(null);
productMapper.insertSelective(product);
//根据促销类型设置价格:、阶梯价格、满减价格
Long productId = product.getId();
//会员价格
List<PmsMemberPrice> memberPriceList = productParam.getMemberPriceList();
if (!CollectionUtils.isEmpty(memberPriceList)) {
for (PmsMemberPrice pmsMemberPrice : memberPriceList) {
pmsMemberPrice.setId(null);
pmsMemberPrice.setProductId(productId);
}
memberPriceDao.insertList(memberPriceList);
}
//阶梯价格
List<PmsProductLadder> productLadderList = productParam.getProductLadderList();
if (!CollectionUtils.isEmpty(productLadderList)) {
for (PmsProductLadder productLadder : productLadderList) {
productLadder.setId(null);
productLadder.setProductId(productId);
}
productLadderDao.insertList(productLadderList);
}
//满减价格
List<PmsProductFullReduction> productFullReductionList = productParam.getProductFullReductionList();
if (!CollectionUtils.isEmpty(productFullReductionList)) {
for (PmsProductFullReduction productFullReduction : productFullReductionList) {
productFullReduction.setId(null);
productFullReduction.setProductId(productId);
}
productFullReductionDao.insertList(productFullReductionList);
}
//添加sku库存信息
List<PmsSkuStock> skuStockList = productParam.getSkuStockList();
if (!CollectionUtils.isEmpty(skuStockList)) {
for (PmsSkuStock skuStock : skuStockList) {
skuStock.setId(null);
skuStock.setProductId(productId);
}
skuStockDao.insertList(skuStockList);
}
//添加商品参数,添加自定义商品规格
List<PmsProductAttributeValue> productAttributeValueList = productParam.getProductAttributeValueList();
if (!CollectionUtils.isEmpty(productAttributeValueList)) {
for (PmsProductAttributeValue productAttributeValue : productAttributeValueList) {
productAttributeValue.setId(null);
productAttributeValue.setProductId(productId);
}
productAttributeValueDao.insertList(productAttributeValueList);
}
//关联专题
relateAndInsertList(subjectProductRelationDao, productParam.getSubjectProductRelationList(), productId);
//关联优选
relateAndInsertList(prefrenceAreaProductRelationDao, productParam.getPrefrenceAreaProductRelationList(), productId);
count = 1;
return count;
}
/**
* 建立和插入关系表操作
*

View File

@@ -1,10 +1,13 @@
package com.macro.mall.service.impl;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.StrUtil;
import com.github.pagehelper.PageHelper;
import com.macro.mall.bo.AdminUserDetails;
import com.macro.mall.dao.UmsAdminPermissionRelationDao;
import com.macro.mall.dao.UmsAdminRoleRelationDao;
import com.macro.mall.dto.UmsAdminParam;
import com.macro.mall.dto.UpdateAdminPasswordParam;
import com.macro.mall.mapper.UmsAdminLoginLogMapper;
import com.macro.mall.mapper.UmsAdminMapper;
import com.macro.mall.mapper.UmsAdminPermissionRelationMapper;
@@ -147,13 +150,13 @@ public class UmsAdminServiceImpl implements UmsAdminService {
}
@Override
public List<UmsAdmin> list(String name, Integer pageSize, Integer pageNum) {
public List<UmsAdmin> list(String keyword, Integer pageSize, Integer pageNum) {
PageHelper.startPage(pageNum, pageSize);
UmsAdminExample example = new UmsAdminExample();
UmsAdminExample.Criteria criteria = example.createCriteria();
if (!StringUtils.isEmpty(name)) {
criteria.andUsernameLike("%" + name + "%");
example.or(example.createCriteria().andNickNameLike("%" + name + "%"));
if (!StringUtils.isEmpty(keyword)) {
criteria.andUsernameLike("%" + keyword + "%");
example.or(example.createCriteria().andNickNameLike("%" + keyword + "%"));
}
return adminMapper.selectByExample(example);
}
@@ -161,8 +164,18 @@ public class UmsAdminServiceImpl implements UmsAdminService {
@Override
public int update(Long id, UmsAdmin admin) {
admin.setId(id);
//密码已经加密处理,需要单独修改
admin.setPassword(null);
UmsAdmin rawAdmin = adminMapper.selectByPrimaryKey(id);
if(rawAdmin.getPassword().equals(admin.getPassword())){
//与原加密密码相同的不需要修改
admin.setPassword(null);
}else{
//与原加密密码不同的需要加密修改
if(StrUtil.isEmpty(admin.getPassword())){
admin.setPassword(null);
}else{
admin.setPassword(passwordEncoder.encode(admin.getPassword()));
}
}
return adminMapper.updateByPrimaryKeySelective(admin);
}
@@ -197,6 +210,11 @@ public class UmsAdminServiceImpl implements UmsAdminService {
return adminRoleRelationDao.getRoleList(adminId);
}
@Override
public List<UmsResource> getResourceList(Long adminId) {
return adminRoleRelationDao.getResourceList(adminId);
}
@Override
public int updatePermission(Long adminId, List<Long> permissionIds) {
//删除原所有权限关系
@@ -239,12 +257,35 @@ public class UmsAdminServiceImpl implements UmsAdminService {
return adminRoleRelationDao.getPermissionList(adminId);
}
@Override
public int updatePassword(UpdateAdminPasswordParam param) {
if(StrUtil.isEmpty(param.getUsername())
||StrUtil.isEmpty(param.getOldPassword())
||StrUtil.isEmpty(param.getNewPassword())){
return -1;
}
UmsAdminExample example = new UmsAdminExample();
example.createCriteria().andUsernameEqualTo(param.getUsername());
List<UmsAdmin> adminList = adminMapper.selectByExample(example);
if(CollUtil.isEmpty(adminList)){
return -2;
}
UmsAdmin umsAdmin = adminList.get(0);
if(!passwordEncoder.matches(param.getOldPassword(),umsAdmin.getPassword())){
return -3;
}
umsAdmin.setPassword(passwordEncoder.encode(param.getNewPassword()));
adminMapper.updateByPrimaryKey(umsAdmin);
return 1;
}
@Override
public UserDetails loadUserByUsername(String username){
//获取用户信息
UmsAdmin admin = getAdminByUsername(username);
if (admin != null) {
List<UmsPermission> permissionList = getPermissionList(admin.getId());
return new AdminUserDetails(admin,permissionList);
List<UmsResource> resourceList = getResourceList(admin.getId());
return new AdminUserDetails(admin,resourceList);
}
throw new UsernameNotFoundException("用户名或密码错误");
}

View File

@@ -0,0 +1,105 @@
package com.macro.mall.service.impl;
import com.github.pagehelper.PageHelper;
import com.macro.mall.dto.UmsMenuNode;
import com.macro.mall.mapper.UmsMenuMapper;
import com.macro.mall.model.*;
import com.macro.mall.service.UmsMenuService;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.List;
import java.util.stream.Collectors;
/**
* 后台菜单管理Service实现类
* Created by macro on 2020/2/2.
*/
@Service
public class UmsMenuServiceImpl implements UmsMenuService {
@Autowired
private UmsMenuMapper menuMapper;
@Override
public int create(UmsMenu umsMenu) {
umsMenu.setCreateTime(new Date());
updateLevel(umsMenu);
return menuMapper.insert(umsMenu);
}
/**
* 修改菜单层级
*/
private void updateLevel(UmsMenu umsMenu) {
if (umsMenu.getParentId() == 0) {
//没有父菜单时为一级菜单
umsMenu.setLevel(0);
} else {
//有父菜单时选择根据父菜单level设置
UmsMenu parentMenu = menuMapper.selectByPrimaryKey(umsMenu.getParentId());
if (parentMenu != null) {
umsMenu.setLevel(parentMenu.getLevel() + 1);
} else {
umsMenu.setLevel(0);
}
}
}
@Override
public int update(Long id, UmsMenu umsMenu) {
umsMenu.setId(id);
updateLevel(umsMenu);
return menuMapper.updateByPrimaryKeySelective(umsMenu);
}
@Override
public UmsMenu getItem(Long id) {
return menuMapper.selectByPrimaryKey(id);
}
@Override
public int delete(Long id) {
return menuMapper.deleteByPrimaryKey(id);
}
@Override
public List<UmsMenu> list(Long parentId, Integer pageSize, Integer pageNum) {
PageHelper.startPage(pageNum, pageSize);
UmsMenuExample example = new UmsMenuExample();
example.setOrderByClause("sort desc");
example.createCriteria().andParentIdEqualTo(parentId);
return menuMapper.selectByExample(example);
}
@Override
public List<UmsMenuNode> treeList() {
List<UmsMenu> menuList = menuMapper.selectByExample(new UmsMenuExample());
List<UmsMenuNode> result = menuList.stream()
.filter(menu -> menu.getParentId().equals(0L))
.map(menu -> covertMenuNode(menu, menuList)).collect(Collectors.toList());
return result;
}
@Override
public int updateHidden(Long id, Integer hidden) {
UmsMenu umsMenu = new UmsMenu();
umsMenu.setId(id);
umsMenu.setHidden(hidden);
return menuMapper.updateByPrimaryKeySelective(umsMenu);
}
/**
* 将UmsMenu转化为UmsMenuNode并设置children属性
*/
private UmsMenuNode covertMenuNode(UmsMenu menu, List<UmsMenu> menuList) {
UmsMenuNode node = new UmsMenuNode();
BeanUtils.copyProperties(menu, node);
List<UmsMenuNode> children = menuList.stream()
.filter(subMenu -> subMenu.getParentId().equals(menu.getId()))
.map(subMenu -> covertMenuNode(subMenu, menuList)).collect(Collectors.toList());
node.setChildren(children);
return node;
}
}

View File

@@ -0,0 +1,45 @@
package com.macro.mall.service.impl;
import com.macro.mall.mapper.UmsResourceCategoryMapper;
import com.macro.mall.model.UmsResourceCategory;
import com.macro.mall.model.UmsResourceCategoryExample;
import com.macro.mall.service.UmsResourceCategoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.List;
/**
* 后台资源分类管理Service实现类
* Created by macro on 2020/2/5.
*/
@Service
public class UmsResourceCategoryServiceImpl implements UmsResourceCategoryService {
@Autowired
private UmsResourceCategoryMapper resourceCategoryMapper;
@Override
public List<UmsResourceCategory> listAll() {
UmsResourceCategoryExample example = new UmsResourceCategoryExample();
example.setOrderByClause("sort desc");
return resourceCategoryMapper.selectByExample(example);
}
@Override
public int create(UmsResourceCategory umsResourceCategory) {
umsResourceCategory.setCreateTime(new Date());
return resourceCategoryMapper.insert(umsResourceCategory);
}
@Override
public int update(Long id, UmsResourceCategory umsResourceCategory) {
umsResourceCategory.setId(id);
return resourceCategoryMapper.updateByPrimaryKeySelective(umsResourceCategory);
}
@Override
public int delete(Long id) {
return resourceCategoryMapper.deleteByPrimaryKey(id);
}
}

View File

@@ -0,0 +1,66 @@
package com.macro.mall.service.impl;
import cn.hutool.core.util.StrUtil;
import com.github.pagehelper.PageHelper;
import com.macro.mall.mapper.UmsResourceMapper;
import com.macro.mall.model.UmsResource;
import com.macro.mall.model.UmsResourceExample;
import com.macro.mall.service.UmsResourceService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.List;
/**
* 后台资源管理Service实现类
* Created by macro on 2020/2/2.
*/
@Service
public class UmsResourceServiceImpl implements UmsResourceService {
@Autowired
private UmsResourceMapper resourceMapper;
@Override
public int create(UmsResource umsResource) {
umsResource.setCreateTime(new Date());
return resourceMapper.insert(umsResource);
}
@Override
public int update(Long id, UmsResource umsResource) {
umsResource.setId(id);
return resourceMapper.updateByPrimaryKeySelective(umsResource);
}
@Override
public UmsResource getItem(Long id) {
return resourceMapper.selectByPrimaryKey(id);
}
@Override
public int delete(Long id) {
return resourceMapper.deleteByPrimaryKey(id);
}
@Override
public List<UmsResource> list(Long categoryId, String nameKeyword, String urlKeyword, Integer pageSize, Integer pageNum) {
PageHelper.startPage(pageNum,pageSize);
UmsResourceExample example = new UmsResourceExample();
UmsResourceExample.Criteria criteria = example.createCriteria();
if(categoryId!=null){
criteria.andCategoryIdEqualTo(categoryId);
}
if(StrUtil.isNotEmpty(nameKeyword)){
criteria.andNameLike('%'+nameKeyword+'%');
}
if(StrUtil.isNotEmpty(urlKeyword)){
criteria.andUrlLike('%'+urlKeyword+'%');
}
return resourceMapper.selectByExample(example);
}
@Override
public List<UmsResource> listAll() {
return resourceMapper.selectByExample(new UmsResourceExample());
}
}

View File

@@ -1,12 +1,17 @@
package com.macro.mall.service.impl;
import com.github.pagehelper.PageHelper;
import com.macro.mall.dao.UmsRoleDao;
import com.macro.mall.dao.UmsRolePermissionRelationDao;
import com.macro.mall.mapper.UmsRoleMapper;
import com.macro.mall.mapper.UmsRoleMenuRelationMapper;
import com.macro.mall.mapper.UmsRolePermissionRelationMapper;
import com.macro.mall.mapper.UmsRoleResourceRelationMapper;
import com.macro.mall.model.*;
import com.macro.mall.service.UmsRoleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;
import java.util.ArrayList;
import java.util.Date;
@@ -23,11 +28,16 @@ public class UmsRoleServiceImpl implements UmsRoleService {
@Autowired
private UmsRolePermissionRelationMapper rolePermissionRelationMapper;
@Autowired
private UmsRoleMenuRelationMapper roleMenuRelationMapper;
@Autowired
private UmsRoleResourceRelationMapper roleResourceRelationMapper;
@Autowired
private UmsRolePermissionRelationDao rolePermissionRelationDao;
@Autowired
private UmsRoleDao roleDao;
@Override
public int create(UmsRole role) {
role.setCreateTime(new Date());
role.setStatus(1);
role.setAdminCount(0);
role.setSort(0);
return roleMapper.insert(role);
@@ -36,7 +46,7 @@ public class UmsRoleServiceImpl implements UmsRoleService {
@Override
public int update(Long id, UmsRole role) {
role.setId(id);
return roleMapper.updateByPrimaryKey(role);
return roleMapper.updateByPrimaryKeySelective(role);
}
@Override
@@ -72,4 +82,61 @@ public class UmsRoleServiceImpl implements UmsRoleService {
public List<UmsRole> list() {
return roleMapper.selectByExample(new UmsRoleExample());
}
@Override
public List<UmsRole> list(String keyword, Integer pageSize, Integer pageNum) {
PageHelper.startPage(pageNum, pageSize);
UmsRoleExample example = new UmsRoleExample();
if (!StringUtils.isEmpty(keyword)) {
example.createCriteria().andNameLike("%" + keyword + "%");
}
return roleMapper.selectByExample(example);
}
@Override
public List<UmsMenu> getMenuList(Long adminId) {
return roleDao.getMenuList(adminId);
}
@Override
public List<UmsMenu> listMenu(Long roleId) {
return roleDao.getMenuListByRoleId(roleId);
}
@Override
public List<UmsResource> listResource(Long roleId) {
return roleDao.getResourceListByRoleId(roleId);
}
@Override
public int allocMenu(Long roleId, List<Long> menuIds) {
//先删除原有关系
UmsRoleMenuRelationExample example=new UmsRoleMenuRelationExample();
example.createCriteria().andRoleIdEqualTo(roleId);
roleMenuRelationMapper.deleteByExample(example);
//批量插入新关系
for (Long menuId : menuIds) {
UmsRoleMenuRelation relation = new UmsRoleMenuRelation();
relation.setRoleId(roleId);
relation.setMenuId(menuId);
roleMenuRelationMapper.insert(relation);
}
return menuIds.size();
}
@Override
public int allocResource(Long roleId, List<Long> resourceIds) {
//先删除原有关系
UmsRoleResourceRelationExample example=new UmsRoleResourceRelationExample();
example.createCriteria().andRoleIdEqualTo(roleId);
roleResourceRelationMapper.deleteByExample(example);
//批量插入新关系
for (Long resourceId : resourceIds) {
UmsRoleResourceRelation relation = new UmsRoleResourceRelation();
relation.setRoleId(roleId);
relation.setResourceId(resourceId);
roleResourceRelationMapper.insert(relation);
}
return resourceIds.size();
}
}

View File

@@ -56,6 +56,8 @@ secure:
- /druid/**
- /admin/login
- /admin/register
- /admin/info
- /admin/logout
- /minio/upload
aliyun:
oss:

View File

@@ -74,9 +74,6 @@
oi.product_price item_product_price,
oi.product_quantity item_product_quantity,
oi.product_attr item_product_attr,
oi.sp1 item_sp1,
oi.sp2 item_sp2,
oi.sp3 item_sp3,
oh.id history_id,
oh.operate_man history_operate_man,
oh.create_time history_create_time,

View File

@@ -24,7 +24,7 @@
l.id ladder_id,l.product_id ladder_product_id,l.discount ladder_discount,l.count ladder_count,l.price ladder_price,
pf.id full_id,pf.product_id full_product_id,pf.full_price full_full_price,pf.reduce_price full_reduce_price,
m.id member_id,m.product_id member_product_id,m.member_level_id member_member_level_id,m.member_price member_member_price,m.member_level_name member_member_level_name,
s.id sku_id,s.product_id sku_product_id,s.price sku_price,s.low_stock sku_low_stock,s.pic sku_pic,s.sale sku_sale,s.sku_code sku_sku_code,s.sp1 sku_sp1,s.sp2 sku_sp2,s.sp3 sku_sp3,s.stock sku_stock,
s.id sku_id,s.product_id sku_product_id,s.price sku_price,s.low_stock sku_low_stock,s.pic sku_pic,s.sale sku_sale,s.sku_code sku_sku_code,s.stock sku_stock,s.sp_data sku_sp_data,
a.id attribute_id,a.product_id attribute_product_id,a.product_attribute_id attribute_product_attribute_id,a.value attribute_value
FROM pms_product p
LEFT JOIN pms_product_category pc on pc.id = p.product_category_id

View File

@@ -2,22 +2,20 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.macro.mall.dao.PmsSkuStockDao">
<insert id="insertList">
INSERT INTO pms_sku_stock (product_id, sku_code, price, stock, low_stock, sp1, sp2, sp3, pic, sale) VALUES
INSERT INTO pms_sku_stock (product_id, sku_code, price, stock, low_stock, pic, sale, sp_data) VALUES
<foreach collection="list" item="item" index="index" separator=",">
(#{item.productId,jdbcType=BIGINT},
#{item.skuCode,jdbcType=VARCHAR},
#{item.price,jdbcType=DECIMAL},
#{item.stock,jdbcType=INTEGER},
#{item.lowStock,jdbcType=INTEGER},
#{item.sp1,jdbcType=VARCHAR},
#{item.sp2,jdbcType=VARCHAR},
#{item.sp3,jdbcType=VARCHAR},
#{item.pic,jdbcType=VARCHAR},
#{item.sale,jdbcType=INTEGER})
#{item.sale,jdbcType=INTEGER},
#{item.spData,jdbcType=VARCHAR})
</foreach>
</insert>
<insert id="replaceList">
REPLACE INTO pms_sku_stock (id,product_id, sku_code, price, stock, low_stock, sp1, sp2, sp3, pic, sale) VALUES
REPLACE INTO pms_sku_stock (id,product_id, sku_code, price, stock, low_stock,pic, sale, sp_data) VALUES
<foreach collection="list" item="item" index="index" separator=",">
(#{item.id,jdbcType=BIGINT},
#{item.productId,jdbcType=BIGINT},
@@ -25,11 +23,9 @@
#{item.price,jdbcType=DECIMAL},
#{item.stock,jdbcType=INTEGER},
#{item.lowStock,jdbcType=INTEGER},
#{item.sp1,jdbcType=VARCHAR},
#{item.sp2,jdbcType=VARCHAR},
#{item.sp3,jdbcType=VARCHAR},
#{item.pic,jdbcType=VARCHAR},
#{item.sale,jdbcType=INTEGER})
#{item.sale,jdbcType=INTEGER},
#{item.spData,jdbcType=VARCHAR})
</foreach>
</insert>
</mapper>

View File

@@ -52,4 +52,23 @@
pr.type = 1
AND pr.admin_id = #{adminId}
</select>
<select id="getResourceList" resultType="com.macro.mall.model.UmsResource">
SELECT
ur.id id,
ur.create_time createTime,
ur.`name` `name`,
ur.url url,
ur.description description,
ur.category_id categoryId
FROM
ums_admin_role_relation ar
LEFT JOIN ums_role r ON ar.role_id = r.id
LEFT JOIN ums_role_resource_relation rrr ON r.id = rrr.role_id
LEFT JOIN ums_resource ur ON ur.id = rrr.resource_id
WHERE
ar.admin_id = #{adminId}
AND ur.id IS NOT NULL
GROUP BY
ur.id
</select>
</mapper>

View File

@@ -0,0 +1,64 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.macro.mall.dao.UmsRoleDao">
<select id="getMenuList" resultType="com.macro.mall.model.UmsMenu">
SELECT
m.id id,
m.parent_id parentId,
m.create_time createTime,
m.title title,
m.level level,
m.sort sort,
m.name name,
m.icon icon,
m.hidden hidden
FROM
ums_admin_role_relation arr
LEFT JOIN ums_role r ON arr.role_id = r.id
LEFT JOIN ums_role_menu_relation rmr ON r.id = rmr.role_id
LEFT JOIN ums_menu m ON rmr.menu_id = m.id
WHERE
arr.admin_id = #{adminId}
AND m.id IS NOT NULL
GROUP BY
m.id
</select>
<select id="getMenuListByRoleId" resultType="com.macro.mall.model.UmsMenu">
SELECT
m.id id,
m.parent_id parentId,
m.create_time createTime,
m.title title,
m.level level,
m.sort sort,
m.name name,
m.icon icon,
m.hidden hidden
FROM
ums_role_menu_relation rmr
LEFT JOIN ums_menu m ON rmr.menu_id = m.id
WHERE
rmr.role_id = #{roleId}
AND m.id IS NOT NULL
GROUP BY
m.id
</select>
<select id="getResourceListByRoleId" resultType="com.macro.mall.model.UmsResource">
SELECT
r.id id,
r.create_time createTime,
r.`name` `name`,
r.url url,
r.description description,
r.category_id categoryId
FROM
ums_role_resource_relation rrr
LEFT JOIN ums_resource r ON rrr.resource_id = r.id
WHERE
rrr.role_id = #{roleId}
AND r.id IS NOT NULL
GROUP BY
r.id
</select>
</mapper>

View File

@@ -22,6 +22,10 @@
<groupId>com.github.pagehelper</groupId>
<artifactId>pagehelper-spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>druid-spring-boot-starter</artifactId>

View File

@@ -45,6 +45,15 @@ public class CommonResult<T> {
return new CommonResult<T>(errorCode.getCode(), errorCode.getMessage(), null);
}
/**
* 失败返回结果
* @param errorCode 错误码
* @param message 错误信息
*/
public static <T> CommonResult<T> failed(IErrorCode errorCode,String message) {
return new CommonResult<T>(errorCode.getCode(), message, null);
}
/**
* 失败返回结果
* @param message 提示信息

View File

@@ -0,0 +1,32 @@
package com.macro.mall.common.exception;
import com.macro.mall.common.api.IErrorCode;
/**
* 自定义API异常
* Created by macro on 2020/2/27.
*/
public class ApiException extends RuntimeException {
private IErrorCode errorCode;
public ApiException(IErrorCode errorCode) {
super(errorCode.getMessage());
this.errorCode = errorCode;
}
public ApiException(String message) {
super(message);
}
public ApiException(Throwable cause) {
super(cause);
}
public ApiException(String message, Throwable cause) {
super(message, cause);
}
public IErrorCode getErrorCode() {
return errorCode;
}
}

View File

@@ -0,0 +1,17 @@
package com.macro.mall.common.exception;
import com.macro.mall.common.api.IErrorCode;
/**
* 断言处理类用于抛出各种API异常
* Created by macro on 2020/2/27.
*/
public class Asserts {
public static void fail(String message) {
throw new ApiException(message);
}
public static void fail(IErrorCode errorCode) {
throw new ApiException(errorCode);
}
}

View File

@@ -0,0 +1,23 @@
package com.macro.mall.common.exception;
import com.macro.mall.common.api.CommonResult;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;
/**
* 全局异常处理
* Created by macro on 2020/2/27.
*/
@ControllerAdvice
public class GlobalExceptionHandler {
@ResponseBody
@ExceptionHandler(value = ApiException.class)
public CommonResult handle(ApiException e) {
if (e.getErrorCode() != null) {
return CommonResult.failed(e.getErrorCode());
}
return CommonResult.failed(e.getMessage());
}
}

View File

@@ -0,0 +1,30 @@
package com.macro.mall.mapper;
import com.macro.mall.model.UmsMenu;
import com.macro.mall.model.UmsMenuExample;
import java.util.List;
import org.apache.ibatis.annotations.Param;
public interface UmsMenuMapper {
long countByExample(UmsMenuExample example);
int deleteByExample(UmsMenuExample example);
int deleteByPrimaryKey(Long id);
int insert(UmsMenu record);
int insertSelective(UmsMenu record);
List<UmsMenu> selectByExample(UmsMenuExample example);
UmsMenu selectByPrimaryKey(Long id);
int updateByExampleSelective(@Param("record") UmsMenu record, @Param("example") UmsMenuExample example);
int updateByExample(@Param("record") UmsMenu record, @Param("example") UmsMenuExample example);
int updateByPrimaryKeySelective(UmsMenu record);
int updateByPrimaryKey(UmsMenu record);
}

View File

@@ -0,0 +1,30 @@
package com.macro.mall.mapper;
import com.macro.mall.model.UmsResourceCategory;
import com.macro.mall.model.UmsResourceCategoryExample;
import java.util.List;
import org.apache.ibatis.annotations.Param;
public interface UmsResourceCategoryMapper {
long countByExample(UmsResourceCategoryExample example);
int deleteByExample(UmsResourceCategoryExample example);
int deleteByPrimaryKey(Long id);
int insert(UmsResourceCategory record);
int insertSelective(UmsResourceCategory record);
List<UmsResourceCategory> selectByExample(UmsResourceCategoryExample example);
UmsResourceCategory selectByPrimaryKey(Long id);
int updateByExampleSelective(@Param("record") UmsResourceCategory record, @Param("example") UmsResourceCategoryExample example);
int updateByExample(@Param("record") UmsResourceCategory record, @Param("example") UmsResourceCategoryExample example);
int updateByPrimaryKeySelective(UmsResourceCategory record);
int updateByPrimaryKey(UmsResourceCategory record);
}

View File

@@ -0,0 +1,30 @@
package com.macro.mall.mapper;
import com.macro.mall.model.UmsResource;
import com.macro.mall.model.UmsResourceExample;
import java.util.List;
import org.apache.ibatis.annotations.Param;
public interface UmsResourceMapper {
long countByExample(UmsResourceExample example);
int deleteByExample(UmsResourceExample example);
int deleteByPrimaryKey(Long id);
int insert(UmsResource record);
int insertSelective(UmsResource record);
List<UmsResource> selectByExample(UmsResourceExample example);
UmsResource selectByPrimaryKey(Long id);
int updateByExampleSelective(@Param("record") UmsResource record, @Param("example") UmsResourceExample example);
int updateByExample(@Param("record") UmsResource record, @Param("example") UmsResourceExample example);
int updateByPrimaryKeySelective(UmsResource record);
int updateByPrimaryKey(UmsResource record);
}

View File

@@ -0,0 +1,30 @@
package com.macro.mall.mapper;
import com.macro.mall.model.UmsRoleMenuRelation;
import com.macro.mall.model.UmsRoleMenuRelationExample;
import java.util.List;
import org.apache.ibatis.annotations.Param;
public interface UmsRoleMenuRelationMapper {
long countByExample(UmsRoleMenuRelationExample example);
int deleteByExample(UmsRoleMenuRelationExample example);
int deleteByPrimaryKey(Long id);
int insert(UmsRoleMenuRelation record);
int insertSelective(UmsRoleMenuRelation record);
List<UmsRoleMenuRelation> selectByExample(UmsRoleMenuRelationExample example);
UmsRoleMenuRelation selectByPrimaryKey(Long id);
int updateByExampleSelective(@Param("record") UmsRoleMenuRelation record, @Param("example") UmsRoleMenuRelationExample example);
int updateByExample(@Param("record") UmsRoleMenuRelation record, @Param("example") UmsRoleMenuRelationExample example);
int updateByPrimaryKeySelective(UmsRoleMenuRelation record);
int updateByPrimaryKey(UmsRoleMenuRelation record);
}

View File

@@ -0,0 +1,30 @@
package com.macro.mall.mapper;
import com.macro.mall.model.UmsRoleResourceRelation;
import com.macro.mall.model.UmsRoleResourceRelationExample;
import java.util.List;
import org.apache.ibatis.annotations.Param;
public interface UmsRoleResourceRelationMapper {
long countByExample(UmsRoleResourceRelationExample example);
int deleteByExample(UmsRoleResourceRelationExample example);
int deleteByPrimaryKey(Long id);
int insert(UmsRoleResourceRelation record);
int insertSelective(UmsRoleResourceRelation record);
List<UmsRoleResourceRelation> selectByExample(UmsRoleResourceRelationExample example);
UmsRoleResourceRelation selectByPrimaryKey(Long id);
int updateByExampleSelective(@Param("record") UmsRoleResourceRelation record, @Param("example") UmsRoleResourceRelationExample example);
int updateByExample(@Param("record") UmsRoleResourceRelation record, @Param("example") UmsRoleResourceRelationExample example);
int updateByPrimaryKeySelective(UmsRoleResourceRelation record);
int updateByPrimaryKey(UmsRoleResourceRelation record);
}

View File

@@ -20,15 +20,6 @@ public class OmsCartItem implements Serializable {
@ApiModelProperty(value = "添加到购物车的价格")
private BigDecimal price;
@ApiModelProperty(value = "销售属性1")
private String sp1;
@ApiModelProperty(value = "销售属性2")
private String sp2;
@ApiModelProperty(value = "销售属性3")
private String sp3;
@ApiModelProperty(value = "商品主图")
private String productPic;
@@ -113,30 +104,6 @@ public class OmsCartItem implements Serializable {
this.price = price;
}
public String getSp1() {
return sp1;
}
public void setSp1(String sp1) {
this.sp1 = sp1;
}
public String getSp2() {
return sp2;
}
public void setSp2(String sp2) {
this.sp2 = sp2;
}
public String getSp3() {
return sp3;
}
public void setSp3(String sp3) {
this.sp3 = sp3;
}
public String getProductPic() {
return productPic;
}
@@ -245,9 +212,6 @@ public class OmsCartItem implements Serializable {
sb.append(", memberId=").append(memberId);
sb.append(", quantity=").append(quantity);
sb.append(", price=").append(price);
sb.append(", sp1=").append(sp1);
sb.append(", sp2=").append(sp2);
sb.append(", sp3=").append(sp3);
sb.append(", productPic=").append(productPic);
sb.append(", productName=").append(productName);
sb.append(", productSubTitle=").append(productSubTitle);

View File

@@ -466,216 +466,6 @@ public class OmsCartItemExample {
return (Criteria) this;
}
public Criteria andSp1IsNull() {
addCriterion("sp1 is null");
return (Criteria) this;
}
public Criteria andSp1IsNotNull() {
addCriterion("sp1 is not null");
return (Criteria) this;
}
public Criteria andSp1EqualTo(String value) {
addCriterion("sp1 =", value, "sp1");
return (Criteria) this;
}
public Criteria andSp1NotEqualTo(String value) {
addCriterion("sp1 <>", value, "sp1");
return (Criteria) this;
}
public Criteria andSp1GreaterThan(String value) {
addCriterion("sp1 >", value, "sp1");
return (Criteria) this;
}
public Criteria andSp1GreaterThanOrEqualTo(String value) {
addCriterion("sp1 >=", value, "sp1");
return (Criteria) this;
}
public Criteria andSp1LessThan(String value) {
addCriterion("sp1 <", value, "sp1");
return (Criteria) this;
}
public Criteria andSp1LessThanOrEqualTo(String value) {
addCriterion("sp1 <=", value, "sp1");
return (Criteria) this;
}
public Criteria andSp1Like(String value) {
addCriterion("sp1 like", value, "sp1");
return (Criteria) this;
}
public Criteria andSp1NotLike(String value) {
addCriterion("sp1 not like", value, "sp1");
return (Criteria) this;
}
public Criteria andSp1In(List<String> values) {
addCriterion("sp1 in", values, "sp1");
return (Criteria) this;
}
public Criteria andSp1NotIn(List<String> values) {
addCriterion("sp1 not in", values, "sp1");
return (Criteria) this;
}
public Criteria andSp1Between(String value1, String value2) {
addCriterion("sp1 between", value1, value2, "sp1");
return (Criteria) this;
}
public Criteria andSp1NotBetween(String value1, String value2) {
addCriterion("sp1 not between", value1, value2, "sp1");
return (Criteria) this;
}
public Criteria andSp2IsNull() {
addCriterion("sp2 is null");
return (Criteria) this;
}
public Criteria andSp2IsNotNull() {
addCriterion("sp2 is not null");
return (Criteria) this;
}
public Criteria andSp2EqualTo(String value) {
addCriterion("sp2 =", value, "sp2");
return (Criteria) this;
}
public Criteria andSp2NotEqualTo(String value) {
addCriterion("sp2 <>", value, "sp2");
return (Criteria) this;
}
public Criteria andSp2GreaterThan(String value) {
addCriterion("sp2 >", value, "sp2");
return (Criteria) this;
}
public Criteria andSp2GreaterThanOrEqualTo(String value) {
addCriterion("sp2 >=", value, "sp2");
return (Criteria) this;
}
public Criteria andSp2LessThan(String value) {
addCriterion("sp2 <", value, "sp2");
return (Criteria) this;
}
public Criteria andSp2LessThanOrEqualTo(String value) {
addCriterion("sp2 <=", value, "sp2");
return (Criteria) this;
}
public Criteria andSp2Like(String value) {
addCriterion("sp2 like", value, "sp2");
return (Criteria) this;
}
public Criteria andSp2NotLike(String value) {
addCriterion("sp2 not like", value, "sp2");
return (Criteria) this;
}
public Criteria andSp2In(List<String> values) {
addCriterion("sp2 in", values, "sp2");
return (Criteria) this;
}
public Criteria andSp2NotIn(List<String> values) {
addCriterion("sp2 not in", values, "sp2");
return (Criteria) this;
}
public Criteria andSp2Between(String value1, String value2) {
addCriterion("sp2 between", value1, value2, "sp2");
return (Criteria) this;
}
public Criteria andSp2NotBetween(String value1, String value2) {
addCriterion("sp2 not between", value1, value2, "sp2");
return (Criteria) this;
}
public Criteria andSp3IsNull() {
addCriterion("sp3 is null");
return (Criteria) this;
}
public Criteria andSp3IsNotNull() {
addCriterion("sp3 is not null");
return (Criteria) this;
}
public Criteria andSp3EqualTo(String value) {
addCriterion("sp3 =", value, "sp3");
return (Criteria) this;
}
public Criteria andSp3NotEqualTo(String value) {
addCriterion("sp3 <>", value, "sp3");
return (Criteria) this;
}
public Criteria andSp3GreaterThan(String value) {
addCriterion("sp3 >", value, "sp3");
return (Criteria) this;
}
public Criteria andSp3GreaterThanOrEqualTo(String value) {
addCriterion("sp3 >=", value, "sp3");
return (Criteria) this;
}
public Criteria andSp3LessThan(String value) {
addCriterion("sp3 <", value, "sp3");
return (Criteria) this;
}
public Criteria andSp3LessThanOrEqualTo(String value) {
addCriterion("sp3 <=", value, "sp3");
return (Criteria) this;
}
public Criteria andSp3Like(String value) {
addCriterion("sp3 like", value, "sp3");
return (Criteria) this;
}
public Criteria andSp3NotLike(String value) {
addCriterion("sp3 not like", value, "sp3");
return (Criteria) this;
}
public Criteria andSp3In(List<String> values) {
addCriterion("sp3 in", values, "sp3");
return (Criteria) this;
}
public Criteria andSp3NotIn(List<String> values) {
addCriterion("sp3 not in", values, "sp3");
return (Criteria) this;
}
public Criteria andSp3Between(String value1, String value2) {
addCriterion("sp3 between", value1, value2, "sp3");
return (Criteria) this;
}
public Criteria andSp3NotBetween(String value1, String value2) {
addCriterion("sp3 not between", value1, value2, "sp3");
return (Criteria) this;
}
public Criteria andProductPicIsNull() {
addCriterion("product_pic is null");
return (Criteria) this;

View File

@@ -38,13 +38,6 @@ public class OmsOrderItem implements Serializable {
@ApiModelProperty(value = "商品分类id")
private Long productCategoryId;
@ApiModelProperty(value = "商品的销售属性")
private String sp1;
private String sp2;
private String sp3;
@ApiModelProperty(value = "商品促销名称")
private String promotionName;
@@ -173,30 +166,6 @@ public class OmsOrderItem implements Serializable {
this.productCategoryId = productCategoryId;
}
public String getSp1() {
return sp1;
}
public void setSp1(String sp1) {
this.sp1 = sp1;
}
public String getSp2() {
return sp2;
}
public void setSp2(String sp2) {
this.sp2 = sp2;
}
public String getSp3() {
return sp3;
}
public void setSp3(String sp3) {
this.sp3 = sp3;
}
public String getPromotionName() {
return promotionName;
}
@@ -280,9 +249,6 @@ public class OmsOrderItem implements Serializable {
sb.append(", productSkuId=").append(productSkuId);
sb.append(", productSkuCode=").append(productSkuCode);
sb.append(", productCategoryId=").append(productCategoryId);
sb.append(", sp1=").append(sp1);
sb.append(", sp2=").append(sp2);
sb.append(", sp3=").append(sp3);
sb.append(", promotionName=").append(promotionName);
sb.append(", promotionAmount=").append(promotionAmount);
sb.append(", couponAmount=").append(couponAmount);

View File

@@ -945,216 +945,6 @@ public class OmsOrderItemExample {
return (Criteria) this;
}
public Criteria andSp1IsNull() {
addCriterion("sp1 is null");
return (Criteria) this;
}
public Criteria andSp1IsNotNull() {
addCriterion("sp1 is not null");
return (Criteria) this;
}
public Criteria andSp1EqualTo(String value) {
addCriterion("sp1 =", value, "sp1");
return (Criteria) this;
}
public Criteria andSp1NotEqualTo(String value) {
addCriterion("sp1 <>", value, "sp1");
return (Criteria) this;
}
public Criteria andSp1GreaterThan(String value) {
addCriterion("sp1 >", value, "sp1");
return (Criteria) this;
}
public Criteria andSp1GreaterThanOrEqualTo(String value) {
addCriterion("sp1 >=", value, "sp1");
return (Criteria) this;
}
public Criteria andSp1LessThan(String value) {
addCriterion("sp1 <", value, "sp1");
return (Criteria) this;
}
public Criteria andSp1LessThanOrEqualTo(String value) {
addCriterion("sp1 <=", value, "sp1");
return (Criteria) this;
}
public Criteria andSp1Like(String value) {
addCriterion("sp1 like", value, "sp1");
return (Criteria) this;
}
public Criteria andSp1NotLike(String value) {
addCriterion("sp1 not like", value, "sp1");
return (Criteria) this;
}
public Criteria andSp1In(List<String> values) {
addCriterion("sp1 in", values, "sp1");
return (Criteria) this;
}
public Criteria andSp1NotIn(List<String> values) {
addCriterion("sp1 not in", values, "sp1");
return (Criteria) this;
}
public Criteria andSp1Between(String value1, String value2) {
addCriterion("sp1 between", value1, value2, "sp1");
return (Criteria) this;
}
public Criteria andSp1NotBetween(String value1, String value2) {
addCriterion("sp1 not between", value1, value2, "sp1");
return (Criteria) this;
}
public Criteria andSp2IsNull() {
addCriterion("sp2 is null");
return (Criteria) this;
}
public Criteria andSp2IsNotNull() {
addCriterion("sp2 is not null");
return (Criteria) this;
}
public Criteria andSp2EqualTo(String value) {
addCriterion("sp2 =", value, "sp2");
return (Criteria) this;
}
public Criteria andSp2NotEqualTo(String value) {
addCriterion("sp2 <>", value, "sp2");
return (Criteria) this;
}
public Criteria andSp2GreaterThan(String value) {
addCriterion("sp2 >", value, "sp2");
return (Criteria) this;
}
public Criteria andSp2GreaterThanOrEqualTo(String value) {
addCriterion("sp2 >=", value, "sp2");
return (Criteria) this;
}
public Criteria andSp2LessThan(String value) {
addCriterion("sp2 <", value, "sp2");
return (Criteria) this;
}
public Criteria andSp2LessThanOrEqualTo(String value) {
addCriterion("sp2 <=", value, "sp2");
return (Criteria) this;
}
public Criteria andSp2Like(String value) {
addCriterion("sp2 like", value, "sp2");
return (Criteria) this;
}
public Criteria andSp2NotLike(String value) {
addCriterion("sp2 not like", value, "sp2");
return (Criteria) this;
}
public Criteria andSp2In(List<String> values) {
addCriterion("sp2 in", values, "sp2");
return (Criteria) this;
}
public Criteria andSp2NotIn(List<String> values) {
addCriterion("sp2 not in", values, "sp2");
return (Criteria) this;
}
public Criteria andSp2Between(String value1, String value2) {
addCriterion("sp2 between", value1, value2, "sp2");
return (Criteria) this;
}
public Criteria andSp2NotBetween(String value1, String value2) {
addCriterion("sp2 not between", value1, value2, "sp2");
return (Criteria) this;
}
public Criteria andSp3IsNull() {
addCriterion("sp3 is null");
return (Criteria) this;
}
public Criteria andSp3IsNotNull() {
addCriterion("sp3 is not null");
return (Criteria) this;
}
public Criteria andSp3EqualTo(String value) {
addCriterion("sp3 =", value, "sp3");
return (Criteria) this;
}
public Criteria andSp3NotEqualTo(String value) {
addCriterion("sp3 <>", value, "sp3");
return (Criteria) this;
}
public Criteria andSp3GreaterThan(String value) {
addCriterion("sp3 >", value, "sp3");
return (Criteria) this;
}
public Criteria andSp3GreaterThanOrEqualTo(String value) {
addCriterion("sp3 >=", value, "sp3");
return (Criteria) this;
}
public Criteria andSp3LessThan(String value) {
addCriterion("sp3 <", value, "sp3");
return (Criteria) this;
}
public Criteria andSp3LessThanOrEqualTo(String value) {
addCriterion("sp3 <=", value, "sp3");
return (Criteria) this;
}
public Criteria andSp3Like(String value) {
addCriterion("sp3 like", value, "sp3");
return (Criteria) this;
}
public Criteria andSp3NotLike(String value) {
addCriterion("sp3 not like", value, "sp3");
return (Criteria) this;
}
public Criteria andSp3In(List<String> values) {
addCriterion("sp3 in", values, "sp3");
return (Criteria) this;
}
public Criteria andSp3NotIn(List<String> values) {
addCriterion("sp3 not in", values, "sp3");
return (Criteria) this;
}
public Criteria andSp3Between(String value1, String value2) {
addCriterion("sp3 between", value1, value2, "sp3");
return (Criteria) this;
}
public Criteria andSp3NotBetween(String value1, String value2) {
addCriterion("sp3 not between", value1, value2, "sp3");
return (Criteria) this;
}
public Criteria andPromotionNameIsNull() {
addCriterion("promotion_name is null");
return (Criteria) this;

View File

@@ -20,13 +20,6 @@ public class PmsSkuStock implements Serializable {
@ApiModelProperty(value = "预警库存")
private Integer lowStock;
@ApiModelProperty(value = "销售属性1")
private String sp1;
private String sp2;
private String sp3;
@ApiModelProperty(value = "展示图片")
private String pic;
@@ -39,6 +32,9 @@ public class PmsSkuStock implements Serializable {
@ApiModelProperty(value = "锁定库存")
private Integer lockStock;
@ApiModelProperty(value = "商品销售属性json格式")
private String spData;
private static final long serialVersionUID = 1L;
public Long getId() {
@@ -89,30 +85,6 @@ public class PmsSkuStock implements Serializable {
this.lowStock = lowStock;
}
public String getSp1() {
return sp1;
}
public void setSp1(String sp1) {
this.sp1 = sp1;
}
public String getSp2() {
return sp2;
}
public void setSp2(String sp2) {
this.sp2 = sp2;
}
public String getSp3() {
return sp3;
}
public void setSp3(String sp3) {
this.sp3 = sp3;
}
public String getPic() {
return pic;
}
@@ -145,6 +117,14 @@ public class PmsSkuStock implements Serializable {
this.lockStock = lockStock;
}
public String getSpData() {
return spData;
}
public void setSpData(String spData) {
this.spData = spData;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
@@ -157,13 +137,11 @@ public class PmsSkuStock implements Serializable {
sb.append(", price=").append(price);
sb.append(", stock=").append(stock);
sb.append(", lowStock=").append(lowStock);
sb.append(", sp1=").append(sp1);
sb.append(", sp2=").append(sp2);
sb.append(", sp3=").append(sp3);
sb.append(", pic=").append(pic);
sb.append(", sale=").append(sale);
sb.append(", promotionPrice=").append(promotionPrice);
sb.append(", lockStock=").append(lockStock);
sb.append(", spData=").append(spData);
sb.append(", serialVersionUID=").append(serialVersionUID);
sb.append("]");
return sb.toString();

View File

@@ -475,216 +475,6 @@ public class PmsSkuStockExample {
return (Criteria) this;
}
public Criteria andSp1IsNull() {
addCriterion("sp1 is null");
return (Criteria) this;
}
public Criteria andSp1IsNotNull() {
addCriterion("sp1 is not null");
return (Criteria) this;
}
public Criteria andSp1EqualTo(String value) {
addCriterion("sp1 =", value, "sp1");
return (Criteria) this;
}
public Criteria andSp1NotEqualTo(String value) {
addCriterion("sp1 <>", value, "sp1");
return (Criteria) this;
}
public Criteria andSp1GreaterThan(String value) {
addCriterion("sp1 >", value, "sp1");
return (Criteria) this;
}
public Criteria andSp1GreaterThanOrEqualTo(String value) {
addCriterion("sp1 >=", value, "sp1");
return (Criteria) this;
}
public Criteria andSp1LessThan(String value) {
addCriterion("sp1 <", value, "sp1");
return (Criteria) this;
}
public Criteria andSp1LessThanOrEqualTo(String value) {
addCriterion("sp1 <=", value, "sp1");
return (Criteria) this;
}
public Criteria andSp1Like(String value) {
addCriterion("sp1 like", value, "sp1");
return (Criteria) this;
}
public Criteria andSp1NotLike(String value) {
addCriterion("sp1 not like", value, "sp1");
return (Criteria) this;
}
public Criteria andSp1In(List<String> values) {
addCriterion("sp1 in", values, "sp1");
return (Criteria) this;
}
public Criteria andSp1NotIn(List<String> values) {
addCriterion("sp1 not in", values, "sp1");
return (Criteria) this;
}
public Criteria andSp1Between(String value1, String value2) {
addCriterion("sp1 between", value1, value2, "sp1");
return (Criteria) this;
}
public Criteria andSp1NotBetween(String value1, String value2) {
addCriterion("sp1 not between", value1, value2, "sp1");
return (Criteria) this;
}
public Criteria andSp2IsNull() {
addCriterion("sp2 is null");
return (Criteria) this;
}
public Criteria andSp2IsNotNull() {
addCriterion("sp2 is not null");
return (Criteria) this;
}
public Criteria andSp2EqualTo(String value) {
addCriterion("sp2 =", value, "sp2");
return (Criteria) this;
}
public Criteria andSp2NotEqualTo(String value) {
addCriterion("sp2 <>", value, "sp2");
return (Criteria) this;
}
public Criteria andSp2GreaterThan(String value) {
addCriterion("sp2 >", value, "sp2");
return (Criteria) this;
}
public Criteria andSp2GreaterThanOrEqualTo(String value) {
addCriterion("sp2 >=", value, "sp2");
return (Criteria) this;
}
public Criteria andSp2LessThan(String value) {
addCriterion("sp2 <", value, "sp2");
return (Criteria) this;
}
public Criteria andSp2LessThanOrEqualTo(String value) {
addCriterion("sp2 <=", value, "sp2");
return (Criteria) this;
}
public Criteria andSp2Like(String value) {
addCriterion("sp2 like", value, "sp2");
return (Criteria) this;
}
public Criteria andSp2NotLike(String value) {
addCriterion("sp2 not like", value, "sp2");
return (Criteria) this;
}
public Criteria andSp2In(List<String> values) {
addCriterion("sp2 in", values, "sp2");
return (Criteria) this;
}
public Criteria andSp2NotIn(List<String> values) {
addCriterion("sp2 not in", values, "sp2");
return (Criteria) this;
}
public Criteria andSp2Between(String value1, String value2) {
addCriterion("sp2 between", value1, value2, "sp2");
return (Criteria) this;
}
public Criteria andSp2NotBetween(String value1, String value2) {
addCriterion("sp2 not between", value1, value2, "sp2");
return (Criteria) this;
}
public Criteria andSp3IsNull() {
addCriterion("sp3 is null");
return (Criteria) this;
}
public Criteria andSp3IsNotNull() {
addCriterion("sp3 is not null");
return (Criteria) this;
}
public Criteria andSp3EqualTo(String value) {
addCriterion("sp3 =", value, "sp3");
return (Criteria) this;
}
public Criteria andSp3NotEqualTo(String value) {
addCriterion("sp3 <>", value, "sp3");
return (Criteria) this;
}
public Criteria andSp3GreaterThan(String value) {
addCriterion("sp3 >", value, "sp3");
return (Criteria) this;
}
public Criteria andSp3GreaterThanOrEqualTo(String value) {
addCriterion("sp3 >=", value, "sp3");
return (Criteria) this;
}
public Criteria andSp3LessThan(String value) {
addCriterion("sp3 <", value, "sp3");
return (Criteria) this;
}
public Criteria andSp3LessThanOrEqualTo(String value) {
addCriterion("sp3 <=", value, "sp3");
return (Criteria) this;
}
public Criteria andSp3Like(String value) {
addCriterion("sp3 like", value, "sp3");
return (Criteria) this;
}
public Criteria andSp3NotLike(String value) {
addCriterion("sp3 not like", value, "sp3");
return (Criteria) this;
}
public Criteria andSp3In(List<String> values) {
addCriterion("sp3 in", values, "sp3");
return (Criteria) this;
}
public Criteria andSp3NotIn(List<String> values) {
addCriterion("sp3 not in", values, "sp3");
return (Criteria) this;
}
public Criteria andSp3Between(String value1, String value2) {
addCriterion("sp3 between", value1, value2, "sp3");
return (Criteria) this;
}
public Criteria andSp3NotBetween(String value1, String value2) {
addCriterion("sp3 not between", value1, value2, "sp3");
return (Criteria) this;
}
public Criteria andPicIsNull() {
addCriterion("pic is null");
return (Criteria) this;
@@ -934,6 +724,76 @@ public class PmsSkuStockExample {
addCriterion("lock_stock not between", value1, value2, "lockStock");
return (Criteria) this;
}
public Criteria andSpDataIsNull() {
addCriterion("sp_data is null");
return (Criteria) this;
}
public Criteria andSpDataIsNotNull() {
addCriterion("sp_data is not null");
return (Criteria) this;
}
public Criteria andSpDataEqualTo(String value) {
addCriterion("sp_data =", value, "spData");
return (Criteria) this;
}
public Criteria andSpDataNotEqualTo(String value) {
addCriterion("sp_data <>", value, "spData");
return (Criteria) this;
}
public Criteria andSpDataGreaterThan(String value) {
addCriterion("sp_data >", value, "spData");
return (Criteria) this;
}
public Criteria andSpDataGreaterThanOrEqualTo(String value) {
addCriterion("sp_data >=", value, "spData");
return (Criteria) this;
}
public Criteria andSpDataLessThan(String value) {
addCriterion("sp_data <", value, "spData");
return (Criteria) this;
}
public Criteria andSpDataLessThanOrEqualTo(String value) {
addCriterion("sp_data <=", value, "spData");
return (Criteria) this;
}
public Criteria andSpDataLike(String value) {
addCriterion("sp_data like", value, "spData");
return (Criteria) this;
}
public Criteria andSpDataNotLike(String value) {
addCriterion("sp_data not like", value, "spData");
return (Criteria) this;
}
public Criteria andSpDataIn(List<String> values) {
addCriterion("sp_data in", values, "spData");
return (Criteria) this;
}
public Criteria andSpDataNotIn(List<String> values) {
addCriterion("sp_data not in", values, "spData");
return (Criteria) this;
}
public Criteria andSpDataBetween(String value1, String value2) {
addCriterion("sp_data between", value1, value2, "spData");
return (Criteria) this;
}
public Criteria andSpDataNotBetween(String value1, String value2) {
addCriterion("sp_data not between", value1, value2, "spData");
return (Criteria) this;
}
}
public static class Criteria extends GeneratedCriteria {

View File

@@ -0,0 +1,127 @@
package com.macro.mall.model;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;
import java.util.Date;
public class UmsMenu implements Serializable {
private Long id;
@ApiModelProperty(value = "父级ID")
private Long parentId;
@ApiModelProperty(value = "创建时间")
private Date createTime;
@ApiModelProperty(value = "菜单名称")
private String title;
@ApiModelProperty(value = "菜单级数")
private Integer level;
@ApiModelProperty(value = "菜单排序")
private Integer sort;
@ApiModelProperty(value = "前端名称")
private String name;
@ApiModelProperty(value = "前端图标")
private String icon;
@ApiModelProperty(value = "前端隐藏")
private Integer hidden;
private static final long serialVersionUID = 1L;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Long getParentId() {
return parentId;
}
public void setParentId(Long parentId) {
this.parentId = parentId;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public Integer getLevel() {
return level;
}
public void setLevel(Integer level) {
this.level = level;
}
public Integer getSort() {
return sort;
}
public void setSort(Integer sort) {
this.sort = sort;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getIcon() {
return icon;
}
public void setIcon(String icon) {
this.icon = icon;
}
public Integer getHidden() {
return hidden;
}
public void setHidden(Integer hidden) {
this.hidden = hidden;
}
@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(", parentId=").append(parentId);
sb.append(", createTime=").append(createTime);
sb.append(", title=").append(title);
sb.append(", level=").append(level);
sb.append(", sort=").append(sort);
sb.append(", name=").append(name);
sb.append(", icon=").append(icon);
sb.append(", hidden=").append(hidden);
sb.append(", serialVersionUID=").append(serialVersionUID);
sb.append("]");
return sb.toString();
}
}

View File

@@ -0,0 +1,771 @@
package com.macro.mall.model;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
public class UmsMenuExample {
protected String orderByClause;
protected boolean distinct;
protected List<Criteria> oredCriteria;
public UmsMenuExample() {
oredCriteria = new ArrayList<Criteria>();
}
public void setOrderByClause(String orderByClause) {
this.orderByClause = orderByClause;
}
public String getOrderByClause() {
return orderByClause;
}
public void setDistinct(boolean distinct) {
this.distinct = distinct;
}
public boolean isDistinct() {
return distinct;
}
public List<Criteria> getOredCriteria() {
return oredCriteria;
}
public void or(Criteria criteria) {
oredCriteria.add(criteria);
}
public Criteria or() {
Criteria criteria = createCriteriaInternal();
oredCriteria.add(criteria);
return criteria;
}
public Criteria createCriteria() {
Criteria criteria = createCriteriaInternal();
if (oredCriteria.size() == 0) {
oredCriteria.add(criteria);
}
return criteria;
}
protected Criteria createCriteriaInternal() {
Criteria criteria = new Criteria();
return criteria;
}
public void clear() {
oredCriteria.clear();
orderByClause = null;
distinct = false;
}
protected abstract static class GeneratedCriteria {
protected List<Criterion> criteria;
protected GeneratedCriteria() {
super();
criteria = new ArrayList<Criterion>();
}
public boolean isValid() {
return criteria.size() > 0;
}
public List<Criterion> getAllCriteria() {
return criteria;
}
public List<Criterion> getCriteria() {
return criteria;
}
protected void addCriterion(String condition) {
if (condition == null) {
throw new RuntimeException("Value for condition cannot be null");
}
criteria.add(new Criterion(condition));
}
protected void addCriterion(String condition, Object value, String property) {
if (value == null) {
throw new RuntimeException("Value for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value));
}
protected void addCriterion(String condition, Object value1, Object value2, String property) {
if (value1 == null || value2 == null) {
throw new RuntimeException("Between values for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value1, value2));
}
public Criteria andIdIsNull() {
addCriterion("id is null");
return (Criteria) this;
}
public Criteria andIdIsNotNull() {
addCriterion("id is not null");
return (Criteria) this;
}
public Criteria andIdEqualTo(Long value) {
addCriterion("id =", value, "id");
return (Criteria) this;
}
public Criteria andIdNotEqualTo(Long value) {
addCriterion("id <>", value, "id");
return (Criteria) this;
}
public Criteria andIdGreaterThan(Long value) {
addCriterion("id >", value, "id");
return (Criteria) this;
}
public Criteria andIdGreaterThanOrEqualTo(Long value) {
addCriterion("id >=", value, "id");
return (Criteria) this;
}
public Criteria andIdLessThan(Long value) {
addCriterion("id <", value, "id");
return (Criteria) this;
}
public Criteria andIdLessThanOrEqualTo(Long value) {
addCriterion("id <=", value, "id");
return (Criteria) this;
}
public Criteria andIdIn(List<Long> values) {
addCriterion("id in", values, "id");
return (Criteria) this;
}
public Criteria andIdNotIn(List<Long> values) {
addCriterion("id not in", values, "id");
return (Criteria) this;
}
public Criteria andIdBetween(Long value1, Long value2) {
addCriterion("id between", value1, value2, "id");
return (Criteria) this;
}
public Criteria andIdNotBetween(Long value1, Long value2) {
addCriterion("id not between", value1, value2, "id");
return (Criteria) this;
}
public Criteria andParentIdIsNull() {
addCriterion("parent_id is null");
return (Criteria) this;
}
public Criteria andParentIdIsNotNull() {
addCriterion("parent_id is not null");
return (Criteria) this;
}
public Criteria andParentIdEqualTo(Long value) {
addCriterion("parent_id =", value, "parentId");
return (Criteria) this;
}
public Criteria andParentIdNotEqualTo(Long value) {
addCriterion("parent_id <>", value, "parentId");
return (Criteria) this;
}
public Criteria andParentIdGreaterThan(Long value) {
addCriterion("parent_id >", value, "parentId");
return (Criteria) this;
}
public Criteria andParentIdGreaterThanOrEqualTo(Long value) {
addCriterion("parent_id >=", value, "parentId");
return (Criteria) this;
}
public Criteria andParentIdLessThan(Long value) {
addCriterion("parent_id <", value, "parentId");
return (Criteria) this;
}
public Criteria andParentIdLessThanOrEqualTo(Long value) {
addCriterion("parent_id <=", value, "parentId");
return (Criteria) this;
}
public Criteria andParentIdIn(List<Long> values) {
addCriterion("parent_id in", values, "parentId");
return (Criteria) this;
}
public Criteria andParentIdNotIn(List<Long> values) {
addCriterion("parent_id not in", values, "parentId");
return (Criteria) this;
}
public Criteria andParentIdBetween(Long value1, Long value2) {
addCriterion("parent_id between", value1, value2, "parentId");
return (Criteria) this;
}
public Criteria andParentIdNotBetween(Long value1, Long value2) {
addCriterion("parent_id not between", value1, value2, "parentId");
return (Criteria) this;
}
public Criteria andCreateTimeIsNull() {
addCriterion("create_time is null");
return (Criteria) this;
}
public Criteria andCreateTimeIsNotNull() {
addCriterion("create_time is not null");
return (Criteria) this;
}
public Criteria andCreateTimeEqualTo(Date value) {
addCriterion("create_time =", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeNotEqualTo(Date value) {
addCriterion("create_time <>", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeGreaterThan(Date value) {
addCriterion("create_time >", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeGreaterThanOrEqualTo(Date value) {
addCriterion("create_time >=", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeLessThan(Date value) {
addCriterion("create_time <", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeLessThanOrEqualTo(Date value) {
addCriterion("create_time <=", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeIn(List<Date> values) {
addCriterion("create_time in", values, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeNotIn(List<Date> values) {
addCriterion("create_time not in", values, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeBetween(Date value1, Date value2) {
addCriterion("create_time between", value1, value2, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeNotBetween(Date value1, Date value2) {
addCriterion("create_time not between", value1, value2, "createTime");
return (Criteria) this;
}
public Criteria andTitleIsNull() {
addCriterion("title is null");
return (Criteria) this;
}
public Criteria andTitleIsNotNull() {
addCriterion("title is not null");
return (Criteria) this;
}
public Criteria andTitleEqualTo(String value) {
addCriterion("title =", value, "title");
return (Criteria) this;
}
public Criteria andTitleNotEqualTo(String value) {
addCriterion("title <>", value, "title");
return (Criteria) this;
}
public Criteria andTitleGreaterThan(String value) {
addCriterion("title >", value, "title");
return (Criteria) this;
}
public Criteria andTitleGreaterThanOrEqualTo(String value) {
addCriterion("title >=", value, "title");
return (Criteria) this;
}
public Criteria andTitleLessThan(String value) {
addCriterion("title <", value, "title");
return (Criteria) this;
}
public Criteria andTitleLessThanOrEqualTo(String value) {
addCriterion("title <=", value, "title");
return (Criteria) this;
}
public Criteria andTitleLike(String value) {
addCriterion("title like", value, "title");
return (Criteria) this;
}
public Criteria andTitleNotLike(String value) {
addCriterion("title not like", value, "title");
return (Criteria) this;
}
public Criteria andTitleIn(List<String> values) {
addCriterion("title in", values, "title");
return (Criteria) this;
}
public Criteria andTitleNotIn(List<String> values) {
addCriterion("title not in", values, "title");
return (Criteria) this;
}
public Criteria andTitleBetween(String value1, String value2) {
addCriterion("title between", value1, value2, "title");
return (Criteria) this;
}
public Criteria andTitleNotBetween(String value1, String value2) {
addCriterion("title not between", value1, value2, "title");
return (Criteria) this;
}
public Criteria andLevelIsNull() {
addCriterion("level is null");
return (Criteria) this;
}
public Criteria andLevelIsNotNull() {
addCriterion("level is not null");
return (Criteria) this;
}
public Criteria andLevelEqualTo(Integer value) {
addCriterion("level =", value, "level");
return (Criteria) this;
}
public Criteria andLevelNotEqualTo(Integer value) {
addCriterion("level <>", value, "level");
return (Criteria) this;
}
public Criteria andLevelGreaterThan(Integer value) {
addCriterion("level >", value, "level");
return (Criteria) this;
}
public Criteria andLevelGreaterThanOrEqualTo(Integer value) {
addCriterion("level >=", value, "level");
return (Criteria) this;
}
public Criteria andLevelLessThan(Integer value) {
addCriterion("level <", value, "level");
return (Criteria) this;
}
public Criteria andLevelLessThanOrEqualTo(Integer value) {
addCriterion("level <=", value, "level");
return (Criteria) this;
}
public Criteria andLevelIn(List<Integer> values) {
addCriterion("level in", values, "level");
return (Criteria) this;
}
public Criteria andLevelNotIn(List<Integer> values) {
addCriterion("level not in", values, "level");
return (Criteria) this;
}
public Criteria andLevelBetween(Integer value1, Integer value2) {
addCriterion("level between", value1, value2, "level");
return (Criteria) this;
}
public Criteria andLevelNotBetween(Integer value1, Integer value2) {
addCriterion("level not between", value1, value2, "level");
return (Criteria) this;
}
public Criteria andSortIsNull() {
addCriterion("sort is null");
return (Criteria) this;
}
public Criteria andSortIsNotNull() {
addCriterion("sort is not null");
return (Criteria) this;
}
public Criteria andSortEqualTo(Integer value) {
addCriterion("sort =", value, "sort");
return (Criteria) this;
}
public Criteria andSortNotEqualTo(Integer value) {
addCriterion("sort <>", value, "sort");
return (Criteria) this;
}
public Criteria andSortGreaterThan(Integer value) {
addCriterion("sort >", value, "sort");
return (Criteria) this;
}
public Criteria andSortGreaterThanOrEqualTo(Integer value) {
addCriterion("sort >=", value, "sort");
return (Criteria) this;
}
public Criteria andSortLessThan(Integer value) {
addCriterion("sort <", value, "sort");
return (Criteria) this;
}
public Criteria andSortLessThanOrEqualTo(Integer value) {
addCriterion("sort <=", value, "sort");
return (Criteria) this;
}
public Criteria andSortIn(List<Integer> values) {
addCriterion("sort in", values, "sort");
return (Criteria) this;
}
public Criteria andSortNotIn(List<Integer> values) {
addCriterion("sort not in", values, "sort");
return (Criteria) this;
}
public Criteria andSortBetween(Integer value1, Integer value2) {
addCriterion("sort between", value1, value2, "sort");
return (Criteria) this;
}
public Criteria andSortNotBetween(Integer value1, Integer value2) {
addCriterion("sort not between", value1, value2, "sort");
return (Criteria) this;
}
public Criteria andNameIsNull() {
addCriterion("name is null");
return (Criteria) this;
}
public Criteria andNameIsNotNull() {
addCriterion("name is not null");
return (Criteria) this;
}
public Criteria andNameEqualTo(String value) {
addCriterion("name =", value, "name");
return (Criteria) this;
}
public Criteria andNameNotEqualTo(String value) {
addCriterion("name <>", value, "name");
return (Criteria) this;
}
public Criteria andNameGreaterThan(String value) {
addCriterion("name >", value, "name");
return (Criteria) this;
}
public Criteria andNameGreaterThanOrEqualTo(String value) {
addCriterion("name >=", value, "name");
return (Criteria) this;
}
public Criteria andNameLessThan(String value) {
addCriterion("name <", value, "name");
return (Criteria) this;
}
public Criteria andNameLessThanOrEqualTo(String value) {
addCriterion("name <=", value, "name");
return (Criteria) this;
}
public Criteria andNameLike(String value) {
addCriterion("name like", value, "name");
return (Criteria) this;
}
public Criteria andNameNotLike(String value) {
addCriterion("name not like", value, "name");
return (Criteria) this;
}
public Criteria andNameIn(List<String> values) {
addCriterion("name in", values, "name");
return (Criteria) this;
}
public Criteria andNameNotIn(List<String> values) {
addCriterion("name not in", values, "name");
return (Criteria) this;
}
public Criteria andNameBetween(String value1, String value2) {
addCriterion("name between", value1, value2, "name");
return (Criteria) this;
}
public Criteria andNameNotBetween(String value1, String value2) {
addCriterion("name not between", value1, value2, "name");
return (Criteria) this;
}
public Criteria andIconIsNull() {
addCriterion("icon is null");
return (Criteria) this;
}
public Criteria andIconIsNotNull() {
addCriterion("icon is not null");
return (Criteria) this;
}
public Criteria andIconEqualTo(String value) {
addCriterion("icon =", value, "icon");
return (Criteria) this;
}
public Criteria andIconNotEqualTo(String value) {
addCriterion("icon <>", value, "icon");
return (Criteria) this;
}
public Criteria andIconGreaterThan(String value) {
addCriterion("icon >", value, "icon");
return (Criteria) this;
}
public Criteria andIconGreaterThanOrEqualTo(String value) {
addCriterion("icon >=", value, "icon");
return (Criteria) this;
}
public Criteria andIconLessThan(String value) {
addCriterion("icon <", value, "icon");
return (Criteria) this;
}
public Criteria andIconLessThanOrEqualTo(String value) {
addCriterion("icon <=", value, "icon");
return (Criteria) this;
}
public Criteria andIconLike(String value) {
addCriterion("icon like", value, "icon");
return (Criteria) this;
}
public Criteria andIconNotLike(String value) {
addCriterion("icon not like", value, "icon");
return (Criteria) this;
}
public Criteria andIconIn(List<String> values) {
addCriterion("icon in", values, "icon");
return (Criteria) this;
}
public Criteria andIconNotIn(List<String> values) {
addCriterion("icon not in", values, "icon");
return (Criteria) this;
}
public Criteria andIconBetween(String value1, String value2) {
addCriterion("icon between", value1, value2, "icon");
return (Criteria) this;
}
public Criteria andIconNotBetween(String value1, String value2) {
addCriterion("icon not between", value1, value2, "icon");
return (Criteria) this;
}
public Criteria andHiddenIsNull() {
addCriterion("hidden is null");
return (Criteria) this;
}
public Criteria andHiddenIsNotNull() {
addCriterion("hidden is not null");
return (Criteria) this;
}
public Criteria andHiddenEqualTo(Integer value) {
addCriterion("hidden =", value, "hidden");
return (Criteria) this;
}
public Criteria andHiddenNotEqualTo(Integer value) {
addCriterion("hidden <>", value, "hidden");
return (Criteria) this;
}
public Criteria andHiddenGreaterThan(Integer value) {
addCriterion("hidden >", value, "hidden");
return (Criteria) this;
}
public Criteria andHiddenGreaterThanOrEqualTo(Integer value) {
addCriterion("hidden >=", value, "hidden");
return (Criteria) this;
}
public Criteria andHiddenLessThan(Integer value) {
addCriterion("hidden <", value, "hidden");
return (Criteria) this;
}
public Criteria andHiddenLessThanOrEqualTo(Integer value) {
addCriterion("hidden <=", value, "hidden");
return (Criteria) this;
}
public Criteria andHiddenIn(List<Integer> values) {
addCriterion("hidden in", values, "hidden");
return (Criteria) this;
}
public Criteria andHiddenNotIn(List<Integer> values) {
addCriterion("hidden not in", values, "hidden");
return (Criteria) this;
}
public Criteria andHiddenBetween(Integer value1, Integer value2) {
addCriterion("hidden between", value1, value2, "hidden");
return (Criteria) this;
}
public Criteria andHiddenNotBetween(Integer value1, Integer value2) {
addCriterion("hidden not between", value1, value2, "hidden");
return (Criteria) this;
}
}
public static class Criteria extends GeneratedCriteria {
protected Criteria() {
super();
}
}
public static class Criterion {
private String condition;
private Object value;
private Object secondValue;
private boolean noValue;
private boolean singleValue;
private boolean betweenValue;
private boolean listValue;
private String typeHandler;
public String getCondition() {
return condition;
}
public Object getValue() {
return value;
}
public Object getSecondValue() {
return secondValue;
}
public boolean isNoValue() {
return noValue;
}
public boolean isSingleValue() {
return singleValue;
}
public boolean isBetweenValue() {
return betweenValue;
}
public boolean isListValue() {
return listValue;
}
public String getTypeHandler() {
return typeHandler;
}
protected Criterion(String condition) {
super();
this.condition = condition;
this.typeHandler = null;
this.noValue = true;
}
protected Criterion(String condition, Object value, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.typeHandler = typeHandler;
if (value instanceof List<?>) {
this.listValue = true;
} else {
this.singleValue = true;
}
}
protected Criterion(String condition, Object value) {
this(condition, value, null);
}
protected Criterion(String condition, Object value, Object secondValue, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.secondValue = secondValue;
this.typeHandler = typeHandler;
this.betweenValue = true;
}
protected Criterion(String condition, Object value, Object secondValue) {
this(condition, value, secondValue, null);
}
}
}

View File

@@ -0,0 +1,91 @@
package com.macro.mall.model;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;
import java.util.Date;
public class UmsResource implements Serializable {
private Long id;
@ApiModelProperty(value = "创建时间")
private Date createTime;
@ApiModelProperty(value = "资源名称")
private String name;
@ApiModelProperty(value = "资源URL")
private String url;
@ApiModelProperty(value = "描述")
private String description;
@ApiModelProperty(value = "资源分类ID")
private Long categoryId;
private static final long serialVersionUID = 1L;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getUrl() {
return url;
}
public void setUrl(String url) {
this.url = url;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public Long getCategoryId() {
return categoryId;
}
public void setCategoryId(Long categoryId) {
this.categoryId = categoryId;
}
@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(", createTime=").append(createTime);
sb.append(", name=").append(name);
sb.append(", url=").append(url);
sb.append(", description=").append(description);
sb.append(", categoryId=").append(categoryId);
sb.append(", serialVersionUID=").append(serialVersionUID);
sb.append("]");
return sb.toString();
}
}

View File

@@ -0,0 +1,67 @@
package com.macro.mall.model;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;
import java.util.Date;
public class UmsResourceCategory implements Serializable {
private Long id;
@ApiModelProperty(value = "创建时间")
private Date createTime;
@ApiModelProperty(value = "分类名称")
private String name;
@ApiModelProperty(value = "排序")
private Integer sort;
private static final long serialVersionUID = 1L;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Integer getSort() {
return sort;
}
public void setSort(Integer sort) {
this.sort = sort;
}
@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(", createTime=").append(createTime);
sb.append(", name=").append(name);
sb.append(", sort=").append(sort);
sb.append(", serialVersionUID=").append(serialVersionUID);
sb.append("]");
return sb.toString();
}
}

View File

@@ -0,0 +1,451 @@
package com.macro.mall.model;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
public class UmsResourceCategoryExample {
protected String orderByClause;
protected boolean distinct;
protected List<Criteria> oredCriteria;
public UmsResourceCategoryExample() {
oredCriteria = new ArrayList<Criteria>();
}
public void setOrderByClause(String orderByClause) {
this.orderByClause = orderByClause;
}
public String getOrderByClause() {
return orderByClause;
}
public void setDistinct(boolean distinct) {
this.distinct = distinct;
}
public boolean isDistinct() {
return distinct;
}
public List<Criteria> getOredCriteria() {
return oredCriteria;
}
public void or(Criteria criteria) {
oredCriteria.add(criteria);
}
public Criteria or() {
Criteria criteria = createCriteriaInternal();
oredCriteria.add(criteria);
return criteria;
}
public Criteria createCriteria() {
Criteria criteria = createCriteriaInternal();
if (oredCriteria.size() == 0) {
oredCriteria.add(criteria);
}
return criteria;
}
protected Criteria createCriteriaInternal() {
Criteria criteria = new Criteria();
return criteria;
}
public void clear() {
oredCriteria.clear();
orderByClause = null;
distinct = false;
}
protected abstract static class GeneratedCriteria {
protected List<Criterion> criteria;
protected GeneratedCriteria() {
super();
criteria = new ArrayList<Criterion>();
}
public boolean isValid() {
return criteria.size() > 0;
}
public List<Criterion> getAllCriteria() {
return criteria;
}
public List<Criterion> getCriteria() {
return criteria;
}
protected void addCriterion(String condition) {
if (condition == null) {
throw new RuntimeException("Value for condition cannot be null");
}
criteria.add(new Criterion(condition));
}
protected void addCriterion(String condition, Object value, String property) {
if (value == null) {
throw new RuntimeException("Value for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value));
}
protected void addCriterion(String condition, Object value1, Object value2, String property) {
if (value1 == null || value2 == null) {
throw new RuntimeException("Between values for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value1, value2));
}
public Criteria andIdIsNull() {
addCriterion("id is null");
return (Criteria) this;
}
public Criteria andIdIsNotNull() {
addCriterion("id is not null");
return (Criteria) this;
}
public Criteria andIdEqualTo(Long value) {
addCriterion("id =", value, "id");
return (Criteria) this;
}
public Criteria andIdNotEqualTo(Long value) {
addCriterion("id <>", value, "id");
return (Criteria) this;
}
public Criteria andIdGreaterThan(Long value) {
addCriterion("id >", value, "id");
return (Criteria) this;
}
public Criteria andIdGreaterThanOrEqualTo(Long value) {
addCriterion("id >=", value, "id");
return (Criteria) this;
}
public Criteria andIdLessThan(Long value) {
addCriterion("id <", value, "id");
return (Criteria) this;
}
public Criteria andIdLessThanOrEqualTo(Long value) {
addCriterion("id <=", value, "id");
return (Criteria) this;
}
public Criteria andIdIn(List<Long> values) {
addCriterion("id in", values, "id");
return (Criteria) this;
}
public Criteria andIdNotIn(List<Long> values) {
addCriterion("id not in", values, "id");
return (Criteria) this;
}
public Criteria andIdBetween(Long value1, Long value2) {
addCriterion("id between", value1, value2, "id");
return (Criteria) this;
}
public Criteria andIdNotBetween(Long value1, Long value2) {
addCriterion("id not between", value1, value2, "id");
return (Criteria) this;
}
public Criteria andCreateTimeIsNull() {
addCriterion("create_time is null");
return (Criteria) this;
}
public Criteria andCreateTimeIsNotNull() {
addCriterion("create_time is not null");
return (Criteria) this;
}
public Criteria andCreateTimeEqualTo(Date value) {
addCriterion("create_time =", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeNotEqualTo(Date value) {
addCriterion("create_time <>", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeGreaterThan(Date value) {
addCriterion("create_time >", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeGreaterThanOrEqualTo(Date value) {
addCriterion("create_time >=", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeLessThan(Date value) {
addCriterion("create_time <", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeLessThanOrEqualTo(Date value) {
addCriterion("create_time <=", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeIn(List<Date> values) {
addCriterion("create_time in", values, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeNotIn(List<Date> values) {
addCriterion("create_time not in", values, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeBetween(Date value1, Date value2) {
addCriterion("create_time between", value1, value2, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeNotBetween(Date value1, Date value2) {
addCriterion("create_time not between", value1, value2, "createTime");
return (Criteria) this;
}
public Criteria andNameIsNull() {
addCriterion("name is null");
return (Criteria) this;
}
public Criteria andNameIsNotNull() {
addCriterion("name is not null");
return (Criteria) this;
}
public Criteria andNameEqualTo(String value) {
addCriterion("name =", value, "name");
return (Criteria) this;
}
public Criteria andNameNotEqualTo(String value) {
addCriterion("name <>", value, "name");
return (Criteria) this;
}
public Criteria andNameGreaterThan(String value) {
addCriterion("name >", value, "name");
return (Criteria) this;
}
public Criteria andNameGreaterThanOrEqualTo(String value) {
addCriterion("name >=", value, "name");
return (Criteria) this;
}
public Criteria andNameLessThan(String value) {
addCriterion("name <", value, "name");
return (Criteria) this;
}
public Criteria andNameLessThanOrEqualTo(String value) {
addCriterion("name <=", value, "name");
return (Criteria) this;
}
public Criteria andNameLike(String value) {
addCriterion("name like", value, "name");
return (Criteria) this;
}
public Criteria andNameNotLike(String value) {
addCriterion("name not like", value, "name");
return (Criteria) this;
}
public Criteria andNameIn(List<String> values) {
addCriterion("name in", values, "name");
return (Criteria) this;
}
public Criteria andNameNotIn(List<String> values) {
addCriterion("name not in", values, "name");
return (Criteria) this;
}
public Criteria andNameBetween(String value1, String value2) {
addCriterion("name between", value1, value2, "name");
return (Criteria) this;
}
public Criteria andNameNotBetween(String value1, String value2) {
addCriterion("name not between", value1, value2, "name");
return (Criteria) this;
}
public Criteria andSortIsNull() {
addCriterion("sort is null");
return (Criteria) this;
}
public Criteria andSortIsNotNull() {
addCriterion("sort is not null");
return (Criteria) this;
}
public Criteria andSortEqualTo(Integer value) {
addCriterion("sort =", value, "sort");
return (Criteria) this;
}
public Criteria andSortNotEqualTo(Integer value) {
addCriterion("sort <>", value, "sort");
return (Criteria) this;
}
public Criteria andSortGreaterThan(Integer value) {
addCriterion("sort >", value, "sort");
return (Criteria) this;
}
public Criteria andSortGreaterThanOrEqualTo(Integer value) {
addCriterion("sort >=", value, "sort");
return (Criteria) this;
}
public Criteria andSortLessThan(Integer value) {
addCriterion("sort <", value, "sort");
return (Criteria) this;
}
public Criteria andSortLessThanOrEqualTo(Integer value) {
addCriterion("sort <=", value, "sort");
return (Criteria) this;
}
public Criteria andSortIn(List<Integer> values) {
addCriterion("sort in", values, "sort");
return (Criteria) this;
}
public Criteria andSortNotIn(List<Integer> values) {
addCriterion("sort not in", values, "sort");
return (Criteria) this;
}
public Criteria andSortBetween(Integer value1, Integer value2) {
addCriterion("sort between", value1, value2, "sort");
return (Criteria) this;
}
public Criteria andSortNotBetween(Integer value1, Integer value2) {
addCriterion("sort not between", value1, value2, "sort");
return (Criteria) this;
}
}
public static class Criteria extends GeneratedCriteria {
protected Criteria() {
super();
}
}
public static class Criterion {
private String condition;
private Object value;
private Object secondValue;
private boolean noValue;
private boolean singleValue;
private boolean betweenValue;
private boolean listValue;
private String typeHandler;
public String getCondition() {
return condition;
}
public Object getValue() {
return value;
}
public Object getSecondValue() {
return secondValue;
}
public boolean isNoValue() {
return noValue;
}
public boolean isSingleValue() {
return singleValue;
}
public boolean isBetweenValue() {
return betweenValue;
}
public boolean isListValue() {
return listValue;
}
public String getTypeHandler() {
return typeHandler;
}
protected Criterion(String condition) {
super();
this.condition = condition;
this.typeHandler = null;
this.noValue = true;
}
protected Criterion(String condition, Object value, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.typeHandler = typeHandler;
if (value instanceof List<?>) {
this.listValue = true;
} else {
this.singleValue = true;
}
}
protected Criterion(String condition, Object value) {
this(condition, value, null);
}
protected Criterion(String condition, Object value, Object secondValue, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.secondValue = secondValue;
this.typeHandler = typeHandler;
this.betweenValue = true;
}
protected Criterion(String condition, Object value, Object secondValue) {
this(condition, value, secondValue, null);
}
}
}

View File

@@ -0,0 +1,591 @@
package com.macro.mall.model;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
public class UmsResourceExample {
protected String orderByClause;
protected boolean distinct;
protected List<Criteria> oredCriteria;
public UmsResourceExample() {
oredCriteria = new ArrayList<Criteria>();
}
public void setOrderByClause(String orderByClause) {
this.orderByClause = orderByClause;
}
public String getOrderByClause() {
return orderByClause;
}
public void setDistinct(boolean distinct) {
this.distinct = distinct;
}
public boolean isDistinct() {
return distinct;
}
public List<Criteria> getOredCriteria() {
return oredCriteria;
}
public void or(Criteria criteria) {
oredCriteria.add(criteria);
}
public Criteria or() {
Criteria criteria = createCriteriaInternal();
oredCriteria.add(criteria);
return criteria;
}
public Criteria createCriteria() {
Criteria criteria = createCriteriaInternal();
if (oredCriteria.size() == 0) {
oredCriteria.add(criteria);
}
return criteria;
}
protected Criteria createCriteriaInternal() {
Criteria criteria = new Criteria();
return criteria;
}
public void clear() {
oredCriteria.clear();
orderByClause = null;
distinct = false;
}
protected abstract static class GeneratedCriteria {
protected List<Criterion> criteria;
protected GeneratedCriteria() {
super();
criteria = new ArrayList<Criterion>();
}
public boolean isValid() {
return criteria.size() > 0;
}
public List<Criterion> getAllCriteria() {
return criteria;
}
public List<Criterion> getCriteria() {
return criteria;
}
protected void addCriterion(String condition) {
if (condition == null) {
throw new RuntimeException("Value for condition cannot be null");
}
criteria.add(new Criterion(condition));
}
protected void addCriterion(String condition, Object value, String property) {
if (value == null) {
throw new RuntimeException("Value for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value));
}
protected void addCriterion(String condition, Object value1, Object value2, String property) {
if (value1 == null || value2 == null) {
throw new RuntimeException("Between values for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value1, value2));
}
public Criteria andIdIsNull() {
addCriterion("id is null");
return (Criteria) this;
}
public Criteria andIdIsNotNull() {
addCriterion("id is not null");
return (Criteria) this;
}
public Criteria andIdEqualTo(Long value) {
addCriterion("id =", value, "id");
return (Criteria) this;
}
public Criteria andIdNotEqualTo(Long value) {
addCriterion("id <>", value, "id");
return (Criteria) this;
}
public Criteria andIdGreaterThan(Long value) {
addCriterion("id >", value, "id");
return (Criteria) this;
}
public Criteria andIdGreaterThanOrEqualTo(Long value) {
addCriterion("id >=", value, "id");
return (Criteria) this;
}
public Criteria andIdLessThan(Long value) {
addCriterion("id <", value, "id");
return (Criteria) this;
}
public Criteria andIdLessThanOrEqualTo(Long value) {
addCriterion("id <=", value, "id");
return (Criteria) this;
}
public Criteria andIdIn(List<Long> values) {
addCriterion("id in", values, "id");
return (Criteria) this;
}
public Criteria andIdNotIn(List<Long> values) {
addCriterion("id not in", values, "id");
return (Criteria) this;
}
public Criteria andIdBetween(Long value1, Long value2) {
addCriterion("id between", value1, value2, "id");
return (Criteria) this;
}
public Criteria andIdNotBetween(Long value1, Long value2) {
addCriterion("id not between", value1, value2, "id");
return (Criteria) this;
}
public Criteria andCreateTimeIsNull() {
addCriterion("create_time is null");
return (Criteria) this;
}
public Criteria andCreateTimeIsNotNull() {
addCriterion("create_time is not null");
return (Criteria) this;
}
public Criteria andCreateTimeEqualTo(Date value) {
addCriterion("create_time =", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeNotEqualTo(Date value) {
addCriterion("create_time <>", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeGreaterThan(Date value) {
addCriterion("create_time >", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeGreaterThanOrEqualTo(Date value) {
addCriterion("create_time >=", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeLessThan(Date value) {
addCriterion("create_time <", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeLessThanOrEqualTo(Date value) {
addCriterion("create_time <=", value, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeIn(List<Date> values) {
addCriterion("create_time in", values, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeNotIn(List<Date> values) {
addCriterion("create_time not in", values, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeBetween(Date value1, Date value2) {
addCriterion("create_time between", value1, value2, "createTime");
return (Criteria) this;
}
public Criteria andCreateTimeNotBetween(Date value1, Date value2) {
addCriterion("create_time not between", value1, value2, "createTime");
return (Criteria) this;
}
public Criteria andNameIsNull() {
addCriterion("name is null");
return (Criteria) this;
}
public Criteria andNameIsNotNull() {
addCriterion("name is not null");
return (Criteria) this;
}
public Criteria andNameEqualTo(String value) {
addCriterion("name =", value, "name");
return (Criteria) this;
}
public Criteria andNameNotEqualTo(String value) {
addCriterion("name <>", value, "name");
return (Criteria) this;
}
public Criteria andNameGreaterThan(String value) {
addCriterion("name >", value, "name");
return (Criteria) this;
}
public Criteria andNameGreaterThanOrEqualTo(String value) {
addCriterion("name >=", value, "name");
return (Criteria) this;
}
public Criteria andNameLessThan(String value) {
addCriterion("name <", value, "name");
return (Criteria) this;
}
public Criteria andNameLessThanOrEqualTo(String value) {
addCriterion("name <=", value, "name");
return (Criteria) this;
}
public Criteria andNameLike(String value) {
addCriterion("name like", value, "name");
return (Criteria) this;
}
public Criteria andNameNotLike(String value) {
addCriterion("name not like", value, "name");
return (Criteria) this;
}
public Criteria andNameIn(List<String> values) {
addCriterion("name in", values, "name");
return (Criteria) this;
}
public Criteria andNameNotIn(List<String> values) {
addCriterion("name not in", values, "name");
return (Criteria) this;
}
public Criteria andNameBetween(String value1, String value2) {
addCriterion("name between", value1, value2, "name");
return (Criteria) this;
}
public Criteria andNameNotBetween(String value1, String value2) {
addCriterion("name not between", value1, value2, "name");
return (Criteria) this;
}
public Criteria andUrlIsNull() {
addCriterion("url is null");
return (Criteria) this;
}
public Criteria andUrlIsNotNull() {
addCriterion("url is not null");
return (Criteria) this;
}
public Criteria andUrlEqualTo(String value) {
addCriterion("url =", value, "url");
return (Criteria) this;
}
public Criteria andUrlNotEqualTo(String value) {
addCriterion("url <>", value, "url");
return (Criteria) this;
}
public Criteria andUrlGreaterThan(String value) {
addCriterion("url >", value, "url");
return (Criteria) this;
}
public Criteria andUrlGreaterThanOrEqualTo(String value) {
addCriterion("url >=", value, "url");
return (Criteria) this;
}
public Criteria andUrlLessThan(String value) {
addCriterion("url <", value, "url");
return (Criteria) this;
}
public Criteria andUrlLessThanOrEqualTo(String value) {
addCriterion("url <=", value, "url");
return (Criteria) this;
}
public Criteria andUrlLike(String value) {
addCriterion("url like", value, "url");
return (Criteria) this;
}
public Criteria andUrlNotLike(String value) {
addCriterion("url not like", value, "url");
return (Criteria) this;
}
public Criteria andUrlIn(List<String> values) {
addCriterion("url in", values, "url");
return (Criteria) this;
}
public Criteria andUrlNotIn(List<String> values) {
addCriterion("url not in", values, "url");
return (Criteria) this;
}
public Criteria andUrlBetween(String value1, String value2) {
addCriterion("url between", value1, value2, "url");
return (Criteria) this;
}
public Criteria andUrlNotBetween(String value1, String value2) {
addCriterion("url not between", value1, value2, "url");
return (Criteria) this;
}
public Criteria andDescriptionIsNull() {
addCriterion("description is null");
return (Criteria) this;
}
public Criteria andDescriptionIsNotNull() {
addCriterion("description is not null");
return (Criteria) this;
}
public Criteria andDescriptionEqualTo(String value) {
addCriterion("description =", value, "description");
return (Criteria) this;
}
public Criteria andDescriptionNotEqualTo(String value) {
addCriterion("description <>", value, "description");
return (Criteria) this;
}
public Criteria andDescriptionGreaterThan(String value) {
addCriterion("description >", value, "description");
return (Criteria) this;
}
public Criteria andDescriptionGreaterThanOrEqualTo(String value) {
addCriterion("description >=", value, "description");
return (Criteria) this;
}
public Criteria andDescriptionLessThan(String value) {
addCriterion("description <", value, "description");
return (Criteria) this;
}
public Criteria andDescriptionLessThanOrEqualTo(String value) {
addCriterion("description <=", value, "description");
return (Criteria) this;
}
public Criteria andDescriptionLike(String value) {
addCriterion("description like", value, "description");
return (Criteria) this;
}
public Criteria andDescriptionNotLike(String value) {
addCriterion("description not like", value, "description");
return (Criteria) this;
}
public Criteria andDescriptionIn(List<String> values) {
addCriterion("description in", values, "description");
return (Criteria) this;
}
public Criteria andDescriptionNotIn(List<String> values) {
addCriterion("description not in", values, "description");
return (Criteria) this;
}
public Criteria andDescriptionBetween(String value1, String value2) {
addCriterion("description between", value1, value2, "description");
return (Criteria) this;
}
public Criteria andDescriptionNotBetween(String value1, String value2) {
addCriterion("description not between", value1, value2, "description");
return (Criteria) this;
}
public Criteria andCategoryIdIsNull() {
addCriterion("category_id is null");
return (Criteria) this;
}
public Criteria andCategoryIdIsNotNull() {
addCriterion("category_id is not null");
return (Criteria) this;
}
public Criteria andCategoryIdEqualTo(Long value) {
addCriterion("category_id =", value, "categoryId");
return (Criteria) this;
}
public Criteria andCategoryIdNotEqualTo(Long value) {
addCriterion("category_id <>", value, "categoryId");
return (Criteria) this;
}
public Criteria andCategoryIdGreaterThan(Long value) {
addCriterion("category_id >", value, "categoryId");
return (Criteria) this;
}
public Criteria andCategoryIdGreaterThanOrEqualTo(Long value) {
addCriterion("category_id >=", value, "categoryId");
return (Criteria) this;
}
public Criteria andCategoryIdLessThan(Long value) {
addCriterion("category_id <", value, "categoryId");
return (Criteria) this;
}
public Criteria andCategoryIdLessThanOrEqualTo(Long value) {
addCriterion("category_id <=", value, "categoryId");
return (Criteria) this;
}
public Criteria andCategoryIdIn(List<Long> values) {
addCriterion("category_id in", values, "categoryId");
return (Criteria) this;
}
public Criteria andCategoryIdNotIn(List<Long> values) {
addCriterion("category_id not in", values, "categoryId");
return (Criteria) this;
}
public Criteria andCategoryIdBetween(Long value1, Long value2) {
addCriterion("category_id between", value1, value2, "categoryId");
return (Criteria) this;
}
public Criteria andCategoryIdNotBetween(Long value1, Long value2) {
addCriterion("category_id not between", value1, value2, "categoryId");
return (Criteria) this;
}
}
public static class Criteria extends GeneratedCriteria {
protected Criteria() {
super();
}
}
public static class Criterion {
private String condition;
private Object value;
private Object secondValue;
private boolean noValue;
private boolean singleValue;
private boolean betweenValue;
private boolean listValue;
private String typeHandler;
public String getCondition() {
return condition;
}
public Object getValue() {
return value;
}
public Object getSecondValue() {
return secondValue;
}
public boolean isNoValue() {
return noValue;
}
public boolean isSingleValue() {
return singleValue;
}
public boolean isBetweenValue() {
return betweenValue;
}
public boolean isListValue() {
return listValue;
}
public String getTypeHandler() {
return typeHandler;
}
protected Criterion(String condition) {
super();
this.condition = condition;
this.typeHandler = null;
this.noValue = true;
}
protected Criterion(String condition, Object value, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.typeHandler = typeHandler;
if (value instanceof List<?>) {
this.listValue = true;
} else {
this.singleValue = true;
}
}
protected Criterion(String condition, Object value) {
this(condition, value, null);
}
protected Criterion(String condition, Object value, Object secondValue, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.secondValue = secondValue;
this.typeHandler = typeHandler;
this.betweenValue = true;
}
protected Criterion(String condition, Object value, Object secondValue) {
this(condition, value, secondValue, null);
}
}
}

View File

@@ -0,0 +1,54 @@
package com.macro.mall.model;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;
public class UmsRoleMenuRelation implements Serializable {
private Long id;
@ApiModelProperty(value = "角色ID")
private Long roleId;
@ApiModelProperty(value = "菜单ID")
private Long menuId;
private static final long serialVersionUID = 1L;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Long getRoleId() {
return roleId;
}
public void setRoleId(Long roleId) {
this.roleId = roleId;
}
public Long getMenuId() {
return menuId;
}
public void setMenuId(Long menuId) {
this.menuId = menuId;
}
@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(", menuId=").append(menuId);
sb.append(", serialVersionUID=").append(serialVersionUID);
sb.append("]");
return sb.toString();
}
}

View File

@@ -0,0 +1,380 @@
package com.macro.mall.model;
import java.util.ArrayList;
import java.util.List;
public class UmsRoleMenuRelationExample {
protected String orderByClause;
protected boolean distinct;
protected List<Criteria> oredCriteria;
public UmsRoleMenuRelationExample() {
oredCriteria = new ArrayList<Criteria>();
}
public void setOrderByClause(String orderByClause) {
this.orderByClause = orderByClause;
}
public String getOrderByClause() {
return orderByClause;
}
public void setDistinct(boolean distinct) {
this.distinct = distinct;
}
public boolean isDistinct() {
return distinct;
}
public List<Criteria> getOredCriteria() {
return oredCriteria;
}
public void or(Criteria criteria) {
oredCriteria.add(criteria);
}
public Criteria or() {
Criteria criteria = createCriteriaInternal();
oredCriteria.add(criteria);
return criteria;
}
public Criteria createCriteria() {
Criteria criteria = createCriteriaInternal();
if (oredCriteria.size() == 0) {
oredCriteria.add(criteria);
}
return criteria;
}
protected Criteria createCriteriaInternal() {
Criteria criteria = new Criteria();
return criteria;
}
public void clear() {
oredCriteria.clear();
orderByClause = null;
distinct = false;
}
protected abstract static class GeneratedCriteria {
protected List<Criterion> criteria;
protected GeneratedCriteria() {
super();
criteria = new ArrayList<Criterion>();
}
public boolean isValid() {
return criteria.size() > 0;
}
public List<Criterion> getAllCriteria() {
return criteria;
}
public List<Criterion> getCriteria() {
return criteria;
}
protected void addCriterion(String condition) {
if (condition == null) {
throw new RuntimeException("Value for condition cannot be null");
}
criteria.add(new Criterion(condition));
}
protected void addCriterion(String condition, Object value, String property) {
if (value == null) {
throw new RuntimeException("Value for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value));
}
protected void addCriterion(String condition, Object value1, Object value2, String property) {
if (value1 == null || value2 == null) {
throw new RuntimeException("Between values for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value1, value2));
}
public Criteria andIdIsNull() {
addCriterion("id is null");
return (Criteria) this;
}
public Criteria andIdIsNotNull() {
addCriterion("id is not null");
return (Criteria) this;
}
public Criteria andIdEqualTo(Long value) {
addCriterion("id =", value, "id");
return (Criteria) this;
}
public Criteria andIdNotEqualTo(Long value) {
addCriterion("id <>", value, "id");
return (Criteria) this;
}
public Criteria andIdGreaterThan(Long value) {
addCriterion("id >", value, "id");
return (Criteria) this;
}
public Criteria andIdGreaterThanOrEqualTo(Long value) {
addCriterion("id >=", value, "id");
return (Criteria) this;
}
public Criteria andIdLessThan(Long value) {
addCriterion("id <", value, "id");
return (Criteria) this;
}
public Criteria andIdLessThanOrEqualTo(Long value) {
addCriterion("id <=", value, "id");
return (Criteria) this;
}
public Criteria andIdIn(List<Long> values) {
addCriterion("id in", values, "id");
return (Criteria) this;
}
public Criteria andIdNotIn(List<Long> values) {
addCriterion("id not in", values, "id");
return (Criteria) this;
}
public Criteria andIdBetween(Long value1, Long value2) {
addCriterion("id between", value1, value2, "id");
return (Criteria) this;
}
public Criteria andIdNotBetween(Long value1, Long value2) {
addCriterion("id not between", value1, value2, "id");
return (Criteria) this;
}
public Criteria andRoleIdIsNull() {
addCriterion("role_id is null");
return (Criteria) this;
}
public Criteria andRoleIdIsNotNull() {
addCriterion("role_id is not null");
return (Criteria) this;
}
public Criteria andRoleIdEqualTo(Long value) {
addCriterion("role_id =", value, "roleId");
return (Criteria) this;
}
public Criteria andRoleIdNotEqualTo(Long value) {
addCriterion("role_id <>", value, "roleId");
return (Criteria) this;
}
public Criteria andRoleIdGreaterThan(Long value) {
addCriterion("role_id >", value, "roleId");
return (Criteria) this;
}
public Criteria andRoleIdGreaterThanOrEqualTo(Long value) {
addCriterion("role_id >=", value, "roleId");
return (Criteria) this;
}
public Criteria andRoleIdLessThan(Long value) {
addCriterion("role_id <", value, "roleId");
return (Criteria) this;
}
public Criteria andRoleIdLessThanOrEqualTo(Long value) {
addCriterion("role_id <=", value, "roleId");
return (Criteria) this;
}
public Criteria andRoleIdIn(List<Long> values) {
addCriterion("role_id in", values, "roleId");
return (Criteria) this;
}
public Criteria andRoleIdNotIn(List<Long> values) {
addCriterion("role_id not in", values, "roleId");
return (Criteria) this;
}
public Criteria andRoleIdBetween(Long value1, Long value2) {
addCriterion("role_id between", value1, value2, "roleId");
return (Criteria) this;
}
public Criteria andRoleIdNotBetween(Long value1, Long value2) {
addCriterion("role_id not between", value1, value2, "roleId");
return (Criteria) this;
}
public Criteria andMenuIdIsNull() {
addCriterion("menu_id is null");
return (Criteria) this;
}
public Criteria andMenuIdIsNotNull() {
addCriterion("menu_id is not null");
return (Criteria) this;
}
public Criteria andMenuIdEqualTo(Long value) {
addCriterion("menu_id =", value, "menuId");
return (Criteria) this;
}
public Criteria andMenuIdNotEqualTo(Long value) {
addCriterion("menu_id <>", value, "menuId");
return (Criteria) this;
}
public Criteria andMenuIdGreaterThan(Long value) {
addCriterion("menu_id >", value, "menuId");
return (Criteria) this;
}
public Criteria andMenuIdGreaterThanOrEqualTo(Long value) {
addCriterion("menu_id >=", value, "menuId");
return (Criteria) this;
}
public Criteria andMenuIdLessThan(Long value) {
addCriterion("menu_id <", value, "menuId");
return (Criteria) this;
}
public Criteria andMenuIdLessThanOrEqualTo(Long value) {
addCriterion("menu_id <=", value, "menuId");
return (Criteria) this;
}
public Criteria andMenuIdIn(List<Long> values) {
addCriterion("menu_id in", values, "menuId");
return (Criteria) this;
}
public Criteria andMenuIdNotIn(List<Long> values) {
addCriterion("menu_id not in", values, "menuId");
return (Criteria) this;
}
public Criteria andMenuIdBetween(Long value1, Long value2) {
addCriterion("menu_id between", value1, value2, "menuId");
return (Criteria) this;
}
public Criteria andMenuIdNotBetween(Long value1, Long value2) {
addCriterion("menu_id not between", value1, value2, "menuId");
return (Criteria) this;
}
}
public static class Criteria extends GeneratedCriteria {
protected Criteria() {
super();
}
}
public static class Criterion {
private String condition;
private Object value;
private Object secondValue;
private boolean noValue;
private boolean singleValue;
private boolean betweenValue;
private boolean listValue;
private String typeHandler;
public String getCondition() {
return condition;
}
public Object getValue() {
return value;
}
public Object getSecondValue() {
return secondValue;
}
public boolean isNoValue() {
return noValue;
}
public boolean isSingleValue() {
return singleValue;
}
public boolean isBetweenValue() {
return betweenValue;
}
public boolean isListValue() {
return listValue;
}
public String getTypeHandler() {
return typeHandler;
}
protected Criterion(String condition) {
super();
this.condition = condition;
this.typeHandler = null;
this.noValue = true;
}
protected Criterion(String condition, Object value, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.typeHandler = typeHandler;
if (value instanceof List<?>) {
this.listValue = true;
} else {
this.singleValue = true;
}
}
protected Criterion(String condition, Object value) {
this(condition, value, null);
}
protected Criterion(String condition, Object value, Object secondValue, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.secondValue = secondValue;
this.typeHandler = typeHandler;
this.betweenValue = true;
}
protected Criterion(String condition, Object value, Object secondValue) {
this(condition, value, secondValue, null);
}
}
}

View File

@@ -0,0 +1,54 @@
package com.macro.mall.model;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;
public class UmsRoleResourceRelation implements Serializable {
private Long id;
@ApiModelProperty(value = "角色ID")
private Long roleId;
@ApiModelProperty(value = "资源ID")
private Long resourceId;
private static final long serialVersionUID = 1L;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Long getRoleId() {
return roleId;
}
public void setRoleId(Long roleId) {
this.roleId = roleId;
}
public Long getResourceId() {
return resourceId;
}
public void setResourceId(Long resourceId) {
this.resourceId = resourceId;
}
@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(", resourceId=").append(resourceId);
sb.append(", serialVersionUID=").append(serialVersionUID);
sb.append("]");
return sb.toString();
}
}

View File

@@ -0,0 +1,380 @@
package com.macro.mall.model;
import java.util.ArrayList;
import java.util.List;
public class UmsRoleResourceRelationExample {
protected String orderByClause;
protected boolean distinct;
protected List<Criteria> oredCriteria;
public UmsRoleResourceRelationExample() {
oredCriteria = new ArrayList<Criteria>();
}
public void setOrderByClause(String orderByClause) {
this.orderByClause = orderByClause;
}
public String getOrderByClause() {
return orderByClause;
}
public void setDistinct(boolean distinct) {
this.distinct = distinct;
}
public boolean isDistinct() {
return distinct;
}
public List<Criteria> getOredCriteria() {
return oredCriteria;
}
public void or(Criteria criteria) {
oredCriteria.add(criteria);
}
public Criteria or() {
Criteria criteria = createCriteriaInternal();
oredCriteria.add(criteria);
return criteria;
}
public Criteria createCriteria() {
Criteria criteria = createCriteriaInternal();
if (oredCriteria.size() == 0) {
oredCriteria.add(criteria);
}
return criteria;
}
protected Criteria createCriteriaInternal() {
Criteria criteria = new Criteria();
return criteria;
}
public void clear() {
oredCriteria.clear();
orderByClause = null;
distinct = false;
}
protected abstract static class GeneratedCriteria {
protected List<Criterion> criteria;
protected GeneratedCriteria() {
super();
criteria = new ArrayList<Criterion>();
}
public boolean isValid() {
return criteria.size() > 0;
}
public List<Criterion> getAllCriteria() {
return criteria;
}
public List<Criterion> getCriteria() {
return criteria;
}
protected void addCriterion(String condition) {
if (condition == null) {
throw new RuntimeException("Value for condition cannot be null");
}
criteria.add(new Criterion(condition));
}
protected void addCriterion(String condition, Object value, String property) {
if (value == null) {
throw new RuntimeException("Value for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value));
}
protected void addCriterion(String condition, Object value1, Object value2, String property) {
if (value1 == null || value2 == null) {
throw new RuntimeException("Between values for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value1, value2));
}
public Criteria andIdIsNull() {
addCriterion("id is null");
return (Criteria) this;
}
public Criteria andIdIsNotNull() {
addCriterion("id is not null");
return (Criteria) this;
}
public Criteria andIdEqualTo(Long value) {
addCriterion("id =", value, "id");
return (Criteria) this;
}
public Criteria andIdNotEqualTo(Long value) {
addCriterion("id <>", value, "id");
return (Criteria) this;
}
public Criteria andIdGreaterThan(Long value) {
addCriterion("id >", value, "id");
return (Criteria) this;
}
public Criteria andIdGreaterThanOrEqualTo(Long value) {
addCriterion("id >=", value, "id");
return (Criteria) this;
}
public Criteria andIdLessThan(Long value) {
addCriterion("id <", value, "id");
return (Criteria) this;
}
public Criteria andIdLessThanOrEqualTo(Long value) {
addCriterion("id <=", value, "id");
return (Criteria) this;
}
public Criteria andIdIn(List<Long> values) {
addCriterion("id in", values, "id");
return (Criteria) this;
}
public Criteria andIdNotIn(List<Long> values) {
addCriterion("id not in", values, "id");
return (Criteria) this;
}
public Criteria andIdBetween(Long value1, Long value2) {
addCriterion("id between", value1, value2, "id");
return (Criteria) this;
}
public Criteria andIdNotBetween(Long value1, Long value2) {
addCriterion("id not between", value1, value2, "id");
return (Criteria) this;
}
public Criteria andRoleIdIsNull() {
addCriterion("role_id is null");
return (Criteria) this;
}
public Criteria andRoleIdIsNotNull() {
addCriterion("role_id is not null");
return (Criteria) this;
}
public Criteria andRoleIdEqualTo(Long value) {
addCriterion("role_id =", value, "roleId");
return (Criteria) this;
}
public Criteria andRoleIdNotEqualTo(Long value) {
addCriterion("role_id <>", value, "roleId");
return (Criteria) this;
}
public Criteria andRoleIdGreaterThan(Long value) {
addCriterion("role_id >", value, "roleId");
return (Criteria) this;
}
public Criteria andRoleIdGreaterThanOrEqualTo(Long value) {
addCriterion("role_id >=", value, "roleId");
return (Criteria) this;
}
public Criteria andRoleIdLessThan(Long value) {
addCriterion("role_id <", value, "roleId");
return (Criteria) this;
}
public Criteria andRoleIdLessThanOrEqualTo(Long value) {
addCriterion("role_id <=", value, "roleId");
return (Criteria) this;
}
public Criteria andRoleIdIn(List<Long> values) {
addCriterion("role_id in", values, "roleId");
return (Criteria) this;
}
public Criteria andRoleIdNotIn(List<Long> values) {
addCriterion("role_id not in", values, "roleId");
return (Criteria) this;
}
public Criteria andRoleIdBetween(Long value1, Long value2) {
addCriterion("role_id between", value1, value2, "roleId");
return (Criteria) this;
}
public Criteria andRoleIdNotBetween(Long value1, Long value2) {
addCriterion("role_id not between", value1, value2, "roleId");
return (Criteria) this;
}
public Criteria andResourceIdIsNull() {
addCriterion("resource_id is null");
return (Criteria) this;
}
public Criteria andResourceIdIsNotNull() {
addCriterion("resource_id is not null");
return (Criteria) this;
}
public Criteria andResourceIdEqualTo(Long value) {
addCriterion("resource_id =", value, "resourceId");
return (Criteria) this;
}
public Criteria andResourceIdNotEqualTo(Long value) {
addCriterion("resource_id <>", value, "resourceId");
return (Criteria) this;
}
public Criteria andResourceIdGreaterThan(Long value) {
addCriterion("resource_id >", value, "resourceId");
return (Criteria) this;
}
public Criteria andResourceIdGreaterThanOrEqualTo(Long value) {
addCriterion("resource_id >=", value, "resourceId");
return (Criteria) this;
}
public Criteria andResourceIdLessThan(Long value) {
addCriterion("resource_id <", value, "resourceId");
return (Criteria) this;
}
public Criteria andResourceIdLessThanOrEqualTo(Long value) {
addCriterion("resource_id <=", value, "resourceId");
return (Criteria) this;
}
public Criteria andResourceIdIn(List<Long> values) {
addCriterion("resource_id in", values, "resourceId");
return (Criteria) this;
}
public Criteria andResourceIdNotIn(List<Long> values) {
addCriterion("resource_id not in", values, "resourceId");
return (Criteria) this;
}
public Criteria andResourceIdBetween(Long value1, Long value2) {
addCriterion("resource_id between", value1, value2, "resourceId");
return (Criteria) this;
}
public Criteria andResourceIdNotBetween(Long value1, Long value2) {
addCriterion("resource_id not between", value1, value2, "resourceId");
return (Criteria) this;
}
}
public static class Criteria extends GeneratedCriteria {
protected Criteria() {
super();
}
}
public static class Criterion {
private String condition;
private Object value;
private Object secondValue;
private boolean noValue;
private boolean singleValue;
private boolean betweenValue;
private boolean listValue;
private String typeHandler;
public String getCondition() {
return condition;
}
public Object getValue() {
return value;
}
public Object getSecondValue() {
return secondValue;
}
public boolean isNoValue() {
return noValue;
}
public boolean isSingleValue() {
return singleValue;
}
public boolean isBetweenValue() {
return betweenValue;
}
public boolean isListValue() {
return listValue;
}
public String getTypeHandler() {
return typeHandler;
}
protected Criterion(String condition) {
super();
this.condition = condition;
this.typeHandler = null;
this.noValue = true;
}
protected Criterion(String condition, Object value, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.typeHandler = typeHandler;
if (value instanceof List<?>) {
this.listValue = true;
} else {
this.singleValue = true;
}
}
protected Criterion(String condition, Object value) {
this(condition, value, null);
}
protected Criterion(String condition, Object value, Object secondValue, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.secondValue = secondValue;
this.typeHandler = typeHandler;
this.betweenValue = true;
}
protected Criterion(String condition, Object value, Object secondValue) {
this(condition, value, secondValue, null);
}
}
}

View File

@@ -8,9 +8,6 @@
<result column="member_id" jdbcType="BIGINT" property="memberId" />
<result column="quantity" jdbcType="INTEGER" property="quantity" />
<result column="price" jdbcType="DECIMAL" property="price" />
<result column="sp1" jdbcType="VARCHAR" property="sp1" />
<result column="sp2" jdbcType="VARCHAR" property="sp2" />
<result column="sp3" jdbcType="VARCHAR" property="sp3" />
<result column="product_pic" jdbcType="VARCHAR" property="productPic" />
<result column="product_name" jdbcType="VARCHAR" property="productName" />
<result column="product_sub_title" jdbcType="VARCHAR" property="productSubTitle" />
@@ -83,9 +80,9 @@
</where>
</sql>
<sql id="Base_Column_List">
id, product_id, product_sku_id, member_id, quantity, price, sp1, sp2, sp3, product_pic,
product_name, product_sub_title, product_sku_code, member_nickname, create_date,
modify_date, delete_status, product_category_id, product_brand, product_sn, product_attr
id, product_id, product_sku_id, member_id, quantity, price, product_pic, product_name,
product_sub_title, product_sku_code, member_nickname, create_date, modify_date, delete_status,
product_category_id, product_brand, product_sn, product_attr
</sql>
<select id="selectByExample" parameterType="com.macro.mall.model.OmsCartItemExample" resultMap="BaseResultMap">
select
@@ -122,15 +119,13 @@
SELECT LAST_INSERT_ID()
</selectKey>
insert into oms_cart_item (product_id, product_sku_id, member_id,
quantity, price, sp1,
sp2, sp3, product_pic,
quantity, price, product_pic,
product_name, product_sub_title, product_sku_code,
member_nickname, create_date, modify_date,
delete_status, product_category_id, product_brand,
product_sn, product_attr)
values (#{productId,jdbcType=BIGINT}, #{productSkuId,jdbcType=BIGINT}, #{memberId,jdbcType=BIGINT},
#{quantity,jdbcType=INTEGER}, #{price,jdbcType=DECIMAL}, #{sp1,jdbcType=VARCHAR},
#{sp2,jdbcType=VARCHAR}, #{sp3,jdbcType=VARCHAR}, #{productPic,jdbcType=VARCHAR},
#{quantity,jdbcType=INTEGER}, #{price,jdbcType=DECIMAL}, #{productPic,jdbcType=VARCHAR},
#{productName,jdbcType=VARCHAR}, #{productSubTitle,jdbcType=VARCHAR}, #{productSkuCode,jdbcType=VARCHAR},
#{memberNickname,jdbcType=VARCHAR}, #{createDate,jdbcType=TIMESTAMP}, #{modifyDate,jdbcType=TIMESTAMP},
#{deleteStatus,jdbcType=INTEGER}, #{productCategoryId,jdbcType=BIGINT}, #{productBrand,jdbcType=VARCHAR},
@@ -157,15 +152,6 @@
<if test="price != null">
price,
</if>
<if test="sp1 != null">
sp1,
</if>
<if test="sp2 != null">
sp2,
</if>
<if test="sp3 != null">
sp3,
</if>
<if test="productPic != null">
product_pic,
</if>
@@ -219,15 +205,6 @@
<if test="price != null">
#{price,jdbcType=DECIMAL},
</if>
<if test="sp1 != null">
#{sp1,jdbcType=VARCHAR},
</if>
<if test="sp2 != null">
#{sp2,jdbcType=VARCHAR},
</if>
<if test="sp3 != null">
#{sp3,jdbcType=VARCHAR},
</if>
<if test="productPic != null">
#{productPic,jdbcType=VARCHAR},
</if>
@@ -293,15 +270,6 @@
<if test="record.price != null">
price = #{record.price,jdbcType=DECIMAL},
</if>
<if test="record.sp1 != null">
sp1 = #{record.sp1,jdbcType=VARCHAR},
</if>
<if test="record.sp2 != null">
sp2 = #{record.sp2,jdbcType=VARCHAR},
</if>
<if test="record.sp3 != null">
sp3 = #{record.sp3,jdbcType=VARCHAR},
</if>
<if test="record.productPic != null">
product_pic = #{record.productPic,jdbcType=VARCHAR},
</if>
@@ -351,9 +319,6 @@
member_id = #{record.memberId,jdbcType=BIGINT},
quantity = #{record.quantity,jdbcType=INTEGER},
price = #{record.price,jdbcType=DECIMAL},
sp1 = #{record.sp1,jdbcType=VARCHAR},
sp2 = #{record.sp2,jdbcType=VARCHAR},
sp3 = #{record.sp3,jdbcType=VARCHAR},
product_pic = #{record.productPic,jdbcType=VARCHAR},
product_name = #{record.productName,jdbcType=VARCHAR},
product_sub_title = #{record.productSubTitle,jdbcType=VARCHAR},
@@ -388,15 +353,6 @@
<if test="price != null">
price = #{price,jdbcType=DECIMAL},
</if>
<if test="sp1 != null">
sp1 = #{sp1,jdbcType=VARCHAR},
</if>
<if test="sp2 != null">
sp2 = #{sp2,jdbcType=VARCHAR},
</if>
<if test="sp3 != null">
sp3 = #{sp3,jdbcType=VARCHAR},
</if>
<if test="productPic != null">
product_pic = #{productPic,jdbcType=VARCHAR},
</if>
@@ -443,9 +399,6 @@
member_id = #{memberId,jdbcType=BIGINT},
quantity = #{quantity,jdbcType=INTEGER},
price = #{price,jdbcType=DECIMAL},
sp1 = #{sp1,jdbcType=VARCHAR},
sp2 = #{sp2,jdbcType=VARCHAR},
sp3 = #{sp3,jdbcType=VARCHAR},
product_pic = #{productPic,jdbcType=VARCHAR},
product_name = #{productName,jdbcType=VARCHAR},
product_sub_title = #{productSubTitle,jdbcType=VARCHAR},

View File

@@ -15,9 +15,6 @@
<result column="product_sku_id" jdbcType="BIGINT" property="productSkuId" />
<result column="product_sku_code" jdbcType="VARCHAR" property="productSkuCode" />
<result column="product_category_id" jdbcType="BIGINT" property="productCategoryId" />
<result column="sp1" jdbcType="VARCHAR" property="sp1" />
<result column="sp2" jdbcType="VARCHAR" property="sp2" />
<result column="sp3" jdbcType="VARCHAR" property="sp3" />
<result column="promotion_name" jdbcType="VARCHAR" property="promotionName" />
<result column="promotion_amount" jdbcType="DECIMAL" property="promotionAmount" />
<result column="coupon_amount" jdbcType="DECIMAL" property="couponAmount" />
@@ -88,8 +85,8 @@
<sql id="Base_Column_List">
id, order_id, order_sn, product_id, product_pic, product_name, product_brand, product_sn,
product_price, product_quantity, product_sku_id, product_sku_code, product_category_id,
sp1, sp2, sp3, promotion_name, promotion_amount, coupon_amount, integration_amount,
real_amount, gift_integration, gift_growth, product_attr
promotion_name, promotion_amount, coupon_amount, integration_amount, real_amount,
gift_integration, gift_growth, product_attr
</sql>
<select id="selectByExample" parameterType="com.macro.mall.model.OmsOrderItemExample" resultMap="BaseResultMap">
select
@@ -129,18 +126,16 @@
product_pic, product_name, product_brand,
product_sn, product_price, product_quantity,
product_sku_id, product_sku_code, product_category_id,
sp1, sp2, sp3, promotion_name,
promotion_amount, coupon_amount, integration_amount,
real_amount, gift_integration, gift_growth,
product_attr)
promotion_name, promotion_amount, coupon_amount,
integration_amount, real_amount, gift_integration,
gift_growth, product_attr)
values (#{orderId,jdbcType=BIGINT}, #{orderSn,jdbcType=VARCHAR}, #{productId,jdbcType=BIGINT},
#{productPic,jdbcType=VARCHAR}, #{productName,jdbcType=VARCHAR}, #{productBrand,jdbcType=VARCHAR},
#{productSn,jdbcType=VARCHAR}, #{productPrice,jdbcType=DECIMAL}, #{productQuantity,jdbcType=INTEGER},
#{productSkuId,jdbcType=BIGINT}, #{productSkuCode,jdbcType=VARCHAR}, #{productCategoryId,jdbcType=BIGINT},
#{sp1,jdbcType=VARCHAR}, #{sp2,jdbcType=VARCHAR}, #{sp3,jdbcType=VARCHAR}, #{promotionName,jdbcType=VARCHAR},
#{promotionAmount,jdbcType=DECIMAL}, #{couponAmount,jdbcType=DECIMAL}, #{integrationAmount,jdbcType=DECIMAL},
#{realAmount,jdbcType=DECIMAL}, #{giftIntegration,jdbcType=INTEGER}, #{giftGrowth,jdbcType=INTEGER},
#{productAttr,jdbcType=VARCHAR})
#{promotionName,jdbcType=VARCHAR}, #{promotionAmount,jdbcType=DECIMAL}, #{couponAmount,jdbcType=DECIMAL},
#{integrationAmount,jdbcType=DECIMAL}, #{realAmount,jdbcType=DECIMAL}, #{giftIntegration,jdbcType=INTEGER},
#{giftGrowth,jdbcType=INTEGER}, #{productAttr,jdbcType=VARCHAR})
</insert>
<insert id="insertSelective" parameterType="com.macro.mall.model.OmsOrderItem">
<selectKey keyProperty="id" order="AFTER" resultType="java.lang.Long">
@@ -184,15 +179,6 @@
<if test="productCategoryId != null">
product_category_id,
</if>
<if test="sp1 != null">
sp1,
</if>
<if test="sp2 != null">
sp2,
</if>
<if test="sp3 != null">
sp3,
</if>
<if test="promotionName != null">
promotion_name,
</if>
@@ -255,15 +241,6 @@
<if test="productCategoryId != null">
#{productCategoryId,jdbcType=BIGINT},
</if>
<if test="sp1 != null">
#{sp1,jdbcType=VARCHAR},
</if>
<if test="sp2 != null">
#{sp2,jdbcType=VARCHAR},
</if>
<if test="sp3 != null">
#{sp3,jdbcType=VARCHAR},
</if>
<if test="promotionName != null">
#{promotionName,jdbcType=VARCHAR},
</if>
@@ -338,15 +315,6 @@
<if test="record.productCategoryId != null">
product_category_id = #{record.productCategoryId,jdbcType=BIGINT},
</if>
<if test="record.sp1 != null">
sp1 = #{record.sp1,jdbcType=VARCHAR},
</if>
<if test="record.sp2 != null">
sp2 = #{record.sp2,jdbcType=VARCHAR},
</if>
<if test="record.sp3 != null">
sp3 = #{record.sp3,jdbcType=VARCHAR},
</if>
<if test="record.promotionName != null">
promotion_name = #{record.promotionName,jdbcType=VARCHAR},
</if>
@@ -391,9 +359,6 @@
product_sku_id = #{record.productSkuId,jdbcType=BIGINT},
product_sku_code = #{record.productSkuCode,jdbcType=VARCHAR},
product_category_id = #{record.productCategoryId,jdbcType=BIGINT},
sp1 = #{record.sp1,jdbcType=VARCHAR},
sp2 = #{record.sp2,jdbcType=VARCHAR},
sp3 = #{record.sp3,jdbcType=VARCHAR},
promotion_name = #{record.promotionName,jdbcType=VARCHAR},
promotion_amount = #{record.promotionAmount,jdbcType=DECIMAL},
coupon_amount = #{record.couponAmount,jdbcType=DECIMAL},
@@ -445,15 +410,6 @@
<if test="productCategoryId != null">
product_category_id = #{productCategoryId,jdbcType=BIGINT},
</if>
<if test="sp1 != null">
sp1 = #{sp1,jdbcType=VARCHAR},
</if>
<if test="sp2 != null">
sp2 = #{sp2,jdbcType=VARCHAR},
</if>
<if test="sp3 != null">
sp3 = #{sp3,jdbcType=VARCHAR},
</if>
<if test="promotionName != null">
promotion_name = #{promotionName,jdbcType=VARCHAR},
</if>
@@ -495,9 +451,6 @@
product_sku_id = #{productSkuId,jdbcType=BIGINT},
product_sku_code = #{productSkuCode,jdbcType=VARCHAR},
product_category_id = #{productCategoryId,jdbcType=BIGINT},
sp1 = #{sp1,jdbcType=VARCHAR},
sp2 = #{sp2,jdbcType=VARCHAR},
sp3 = #{sp3,jdbcType=VARCHAR},
promotion_name = #{promotionName,jdbcType=VARCHAR},
promotion_amount = #{promotionAmount,jdbcType=DECIMAL},
coupon_amount = #{couponAmount,jdbcType=DECIMAL},

View File

@@ -8,13 +8,11 @@
<result column="price" jdbcType="DECIMAL" property="price" />
<result column="stock" jdbcType="INTEGER" property="stock" />
<result column="low_stock" jdbcType="INTEGER" property="lowStock" />
<result column="sp1" jdbcType="VARCHAR" property="sp1" />
<result column="sp2" jdbcType="VARCHAR" property="sp2" />
<result column="sp3" jdbcType="VARCHAR" property="sp3" />
<result column="pic" jdbcType="VARCHAR" property="pic" />
<result column="sale" jdbcType="INTEGER" property="sale" />
<result column="promotion_price" jdbcType="DECIMAL" property="promotionPrice" />
<result column="lock_stock" jdbcType="INTEGER" property="lockStock" />
<result column="sp_data" jdbcType="VARCHAR" property="spData" />
</resultMap>
<sql id="Example_Where_Clause">
<where>
@@ -75,8 +73,8 @@
</where>
</sql>
<sql id="Base_Column_List">
id, product_id, sku_code, price, stock, low_stock, sp1, sp2, sp3, pic, sale, promotion_price,
lock_stock
id, product_id, sku_code, price, stock, low_stock, pic, sale, promotion_price, lock_stock,
sp_data
</sql>
<select id="selectByExample" parameterType="com.macro.mall.model.PmsSkuStockExample" resultMap="BaseResultMap">
select
@@ -113,13 +111,13 @@
SELECT LAST_INSERT_ID()
</selectKey>
insert into pms_sku_stock (product_id, sku_code, price,
stock, low_stock, sp1,
sp2, sp3, pic, sale,
promotion_price, lock_stock)
stock, low_stock, pic,
sale, promotion_price, lock_stock,
sp_data)
values (#{productId,jdbcType=BIGINT}, #{skuCode,jdbcType=VARCHAR}, #{price,jdbcType=DECIMAL},
#{stock,jdbcType=INTEGER}, #{lowStock,jdbcType=INTEGER}, #{sp1,jdbcType=VARCHAR},
#{sp2,jdbcType=VARCHAR}, #{sp3,jdbcType=VARCHAR}, #{pic,jdbcType=VARCHAR}, #{sale,jdbcType=INTEGER},
#{promotionPrice,jdbcType=DECIMAL}, #{lockStock,jdbcType=INTEGER})
#{stock,jdbcType=INTEGER}, #{lowStock,jdbcType=INTEGER}, #{pic,jdbcType=VARCHAR},
#{sale,jdbcType=INTEGER}, #{promotionPrice,jdbcType=DECIMAL}, #{lockStock,jdbcType=INTEGER},
#{spData,jdbcType=VARCHAR})
</insert>
<insert id="insertSelective" parameterType="com.macro.mall.model.PmsSkuStock">
<selectKey keyProperty="id" order="AFTER" resultType="java.lang.Long">
@@ -142,15 +140,6 @@
<if test="lowStock != null">
low_stock,
</if>
<if test="sp1 != null">
sp1,
</if>
<if test="sp2 != null">
sp2,
</if>
<if test="sp3 != null">
sp3,
</if>
<if test="pic != null">
pic,
</if>
@@ -163,6 +152,9 @@
<if test="lockStock != null">
lock_stock,
</if>
<if test="spData != null">
sp_data,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="productId != null">
@@ -180,15 +172,6 @@
<if test="lowStock != null">
#{lowStock,jdbcType=INTEGER},
</if>
<if test="sp1 != null">
#{sp1,jdbcType=VARCHAR},
</if>
<if test="sp2 != null">
#{sp2,jdbcType=VARCHAR},
</if>
<if test="sp3 != null">
#{sp3,jdbcType=VARCHAR},
</if>
<if test="pic != null">
#{pic,jdbcType=VARCHAR},
</if>
@@ -201,6 +184,9 @@
<if test="lockStock != null">
#{lockStock,jdbcType=INTEGER},
</if>
<if test="spData != null">
#{spData,jdbcType=VARCHAR},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="com.macro.mall.model.PmsSkuStockExample" resultType="java.lang.Long">
@@ -230,15 +216,6 @@
<if test="record.lowStock != null">
low_stock = #{record.lowStock,jdbcType=INTEGER},
</if>
<if test="record.sp1 != null">
sp1 = #{record.sp1,jdbcType=VARCHAR},
</if>
<if test="record.sp2 != null">
sp2 = #{record.sp2,jdbcType=VARCHAR},
</if>
<if test="record.sp3 != null">
sp3 = #{record.sp3,jdbcType=VARCHAR},
</if>
<if test="record.pic != null">
pic = #{record.pic,jdbcType=VARCHAR},
</if>
@@ -251,6 +228,9 @@
<if test="record.lockStock != null">
lock_stock = #{record.lockStock,jdbcType=INTEGER},
</if>
<if test="record.spData != null">
sp_data = #{record.spData,jdbcType=VARCHAR},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
@@ -264,13 +244,11 @@
price = #{record.price,jdbcType=DECIMAL},
stock = #{record.stock,jdbcType=INTEGER},
low_stock = #{record.lowStock,jdbcType=INTEGER},
sp1 = #{record.sp1,jdbcType=VARCHAR},
sp2 = #{record.sp2,jdbcType=VARCHAR},
sp3 = #{record.sp3,jdbcType=VARCHAR},
pic = #{record.pic,jdbcType=VARCHAR},
sale = #{record.sale,jdbcType=INTEGER},
promotion_price = #{record.promotionPrice,jdbcType=DECIMAL},
lock_stock = #{record.lockStock,jdbcType=INTEGER}
lock_stock = #{record.lockStock,jdbcType=INTEGER},
sp_data = #{record.spData,jdbcType=VARCHAR}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
@@ -293,15 +271,6 @@
<if test="lowStock != null">
low_stock = #{lowStock,jdbcType=INTEGER},
</if>
<if test="sp1 != null">
sp1 = #{sp1,jdbcType=VARCHAR},
</if>
<if test="sp2 != null">
sp2 = #{sp2,jdbcType=VARCHAR},
</if>
<if test="sp3 != null">
sp3 = #{sp3,jdbcType=VARCHAR},
</if>
<if test="pic != null">
pic = #{pic,jdbcType=VARCHAR},
</if>
@@ -314,6 +283,9 @@
<if test="lockStock != null">
lock_stock = #{lockStock,jdbcType=INTEGER},
</if>
<if test="spData != null">
sp_data = #{spData,jdbcType=VARCHAR},
</if>
</set>
where id = #{id,jdbcType=BIGINT}
</update>
@@ -324,13 +296,11 @@
price = #{price,jdbcType=DECIMAL},
stock = #{stock,jdbcType=INTEGER},
low_stock = #{lowStock,jdbcType=INTEGER},
sp1 = #{sp1,jdbcType=VARCHAR},
sp2 = #{sp2,jdbcType=VARCHAR},
sp3 = #{sp3,jdbcType=VARCHAR},
pic = #{pic,jdbcType=VARCHAR},
sale = #{sale,jdbcType=INTEGER},
promotion_price = #{promotionPrice,jdbcType=DECIMAL},
lock_stock = #{lockStock,jdbcType=INTEGER}
lock_stock = #{lockStock,jdbcType=INTEGER},
sp_data = #{spData,jdbcType=VARCHAR}
where id = #{id,jdbcType=BIGINT}
</update>
</mapper>

View File

@@ -0,0 +1,273 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.macro.mall.mapper.UmsMenuMapper">
<resultMap id="BaseResultMap" type="com.macro.mall.model.UmsMenu">
<id column="id" jdbcType="BIGINT" property="id" />
<result column="parent_id" jdbcType="BIGINT" property="parentId" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="title" jdbcType="VARCHAR" property="title" />
<result column="level" jdbcType="INTEGER" property="level" />
<result column="sort" jdbcType="INTEGER" property="sort" />
<result column="name" jdbcType="VARCHAR" property="name" />
<result column="icon" jdbcType="VARCHAR" property="icon" />
<result column="hidden" jdbcType="INTEGER" property="hidden" />
</resultMap>
<sql id="Example_Where_Clause">
<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">
<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">
id, parent_id, create_time, title, level, sort, name, icon, hidden
</sql>
<select id="selectByExample" parameterType="com.macro.mall.model.UmsMenuExample" resultMap="BaseResultMap">
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List" />
from ums_menu
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
<if test="orderByClause != null">
order by ${orderByClause}
</if>
</select>
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from ums_menu
where id = #{id,jdbcType=BIGINT}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
delete from ums_menu
where id = #{id,jdbcType=BIGINT}
</delete>
<delete id="deleteByExample" parameterType="com.macro.mall.model.UmsMenuExample">
delete from ums_menu
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</delete>
<insert id="insert" parameterType="com.macro.mall.model.UmsMenu">
<selectKey keyProperty="id" order="AFTER" resultType="java.lang.Long">
SELECT LAST_INSERT_ID()
</selectKey>
insert into ums_menu (parent_id, create_time, title,
level, sort, name,
icon, hidden)
values (#{parentId,jdbcType=BIGINT}, #{createTime,jdbcType=TIMESTAMP}, #{title,jdbcType=VARCHAR},
#{level,jdbcType=INTEGER}, #{sort,jdbcType=INTEGER}, #{name,jdbcType=VARCHAR},
#{icon,jdbcType=VARCHAR}, #{hidden,jdbcType=INTEGER})
</insert>
<insert id="insertSelective" parameterType="com.macro.mall.model.UmsMenu">
<selectKey keyProperty="id" order="AFTER" resultType="java.lang.Long">
SELECT LAST_INSERT_ID()
</selectKey>
insert into ums_menu
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="parentId != null">
parent_id,
</if>
<if test="createTime != null">
create_time,
</if>
<if test="title != null">
title,
</if>
<if test="level != null">
level,
</if>
<if test="sort != null">
sort,
</if>
<if test="name != null">
name,
</if>
<if test="icon != null">
icon,
</if>
<if test="hidden != null">
hidden,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="parentId != null">
#{parentId,jdbcType=BIGINT},
</if>
<if test="createTime != null">
#{createTime,jdbcType=TIMESTAMP},
</if>
<if test="title != null">
#{title,jdbcType=VARCHAR},
</if>
<if test="level != null">
#{level,jdbcType=INTEGER},
</if>
<if test="sort != null">
#{sort,jdbcType=INTEGER},
</if>
<if test="name != null">
#{name,jdbcType=VARCHAR},
</if>
<if test="icon != null">
#{icon,jdbcType=VARCHAR},
</if>
<if test="hidden != null">
#{hidden,jdbcType=INTEGER},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="com.macro.mall.model.UmsMenuExample" resultType="java.lang.Long">
select count(*) from ums_menu
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</select>
<update id="updateByExampleSelective" parameterType="map">
update ums_menu
<set>
<if test="record.id != null">
id = #{record.id,jdbcType=BIGINT},
</if>
<if test="record.parentId != null">
parent_id = #{record.parentId,jdbcType=BIGINT},
</if>
<if test="record.createTime != null">
create_time = #{record.createTime,jdbcType=TIMESTAMP},
</if>
<if test="record.title != null">
title = #{record.title,jdbcType=VARCHAR},
</if>
<if test="record.level != null">
level = #{record.level,jdbcType=INTEGER},
</if>
<if test="record.sort != null">
sort = #{record.sort,jdbcType=INTEGER},
</if>
<if test="record.name != null">
name = #{record.name,jdbcType=VARCHAR},
</if>
<if test="record.icon != null">
icon = #{record.icon,jdbcType=VARCHAR},
</if>
<if test="record.hidden != null">
hidden = #{record.hidden,jdbcType=INTEGER},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByExample" parameterType="map">
update ums_menu
set id = #{record.id,jdbcType=BIGINT},
parent_id = #{record.parentId,jdbcType=BIGINT},
create_time = #{record.createTime,jdbcType=TIMESTAMP},
title = #{record.title,jdbcType=VARCHAR},
level = #{record.level,jdbcType=INTEGER},
sort = #{record.sort,jdbcType=INTEGER},
name = #{record.name,jdbcType=VARCHAR},
icon = #{record.icon,jdbcType=VARCHAR},
hidden = #{record.hidden,jdbcType=INTEGER}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByPrimaryKeySelective" parameterType="com.macro.mall.model.UmsMenu">
update ums_menu
<set>
<if test="parentId != null">
parent_id = #{parentId,jdbcType=BIGINT},
</if>
<if test="createTime != null">
create_time = #{createTime,jdbcType=TIMESTAMP},
</if>
<if test="title != null">
title = #{title,jdbcType=VARCHAR},
</if>
<if test="level != null">
level = #{level,jdbcType=INTEGER},
</if>
<if test="sort != null">
sort = #{sort,jdbcType=INTEGER},
</if>
<if test="name != null">
name = #{name,jdbcType=VARCHAR},
</if>
<if test="icon != null">
icon = #{icon,jdbcType=VARCHAR},
</if>
<if test="hidden != null">
hidden = #{hidden,jdbcType=INTEGER},
</if>
</set>
where id = #{id,jdbcType=BIGINT}
</update>
<update id="updateByPrimaryKey" parameterType="com.macro.mall.model.UmsMenu">
update ums_menu
set parent_id = #{parentId,jdbcType=BIGINT},
create_time = #{createTime,jdbcType=TIMESTAMP},
title = #{title,jdbcType=VARCHAR},
level = #{level,jdbcType=INTEGER},
sort = #{sort,jdbcType=INTEGER},
name = #{name,jdbcType=VARCHAR},
icon = #{icon,jdbcType=VARCHAR},
hidden = #{hidden,jdbcType=INTEGER}
where id = #{id,jdbcType=BIGINT}
</update>
</mapper>

View File

@@ -0,0 +1,196 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.macro.mall.mapper.UmsResourceCategoryMapper">
<resultMap id="BaseResultMap" type="com.macro.mall.model.UmsResourceCategory">
<id column="id" jdbcType="BIGINT" property="id" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="name" jdbcType="VARCHAR" property="name" />
<result column="sort" jdbcType="INTEGER" property="sort" />
</resultMap>
<sql id="Example_Where_Clause">
<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">
<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">
id, create_time, name, sort
</sql>
<select id="selectByExample" parameterType="com.macro.mall.model.UmsResourceCategoryExample" resultMap="BaseResultMap">
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List" />
from ums_resource_category
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
<if test="orderByClause != null">
order by ${orderByClause}
</if>
</select>
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from ums_resource_category
where id = #{id,jdbcType=BIGINT}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
delete from ums_resource_category
where id = #{id,jdbcType=BIGINT}
</delete>
<delete id="deleteByExample" parameterType="com.macro.mall.model.UmsResourceCategoryExample">
delete from ums_resource_category
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</delete>
<insert id="insert" parameterType="com.macro.mall.model.UmsResourceCategory">
<selectKey keyProperty="id" order="AFTER" resultType="java.lang.Long">
SELECT LAST_INSERT_ID()
</selectKey>
insert into ums_resource_category (create_time, name, sort
)
values (#{createTime,jdbcType=TIMESTAMP}, #{name,jdbcType=VARCHAR}, #{sort,jdbcType=INTEGER}
)
</insert>
<insert id="insertSelective" parameterType="com.macro.mall.model.UmsResourceCategory">
<selectKey keyProperty="id" order="AFTER" resultType="java.lang.Long">
SELECT LAST_INSERT_ID()
</selectKey>
insert into ums_resource_category
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="createTime != null">
create_time,
</if>
<if test="name != null">
name,
</if>
<if test="sort != null">
sort,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="createTime != null">
#{createTime,jdbcType=TIMESTAMP},
</if>
<if test="name != null">
#{name,jdbcType=VARCHAR},
</if>
<if test="sort != null">
#{sort,jdbcType=INTEGER},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="com.macro.mall.model.UmsResourceCategoryExample" resultType="java.lang.Long">
select count(*) from ums_resource_category
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</select>
<update id="updateByExampleSelective" parameterType="map">
update ums_resource_category
<set>
<if test="record.id != null">
id = #{record.id,jdbcType=BIGINT},
</if>
<if test="record.createTime != null">
create_time = #{record.createTime,jdbcType=TIMESTAMP},
</if>
<if test="record.name != null">
name = #{record.name,jdbcType=VARCHAR},
</if>
<if test="record.sort != null">
sort = #{record.sort,jdbcType=INTEGER},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByExample" parameterType="map">
update ums_resource_category
set id = #{record.id,jdbcType=BIGINT},
create_time = #{record.createTime,jdbcType=TIMESTAMP},
name = #{record.name,jdbcType=VARCHAR},
sort = #{record.sort,jdbcType=INTEGER}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByPrimaryKeySelective" parameterType="com.macro.mall.model.UmsResourceCategory">
update ums_resource_category
<set>
<if test="createTime != null">
create_time = #{createTime,jdbcType=TIMESTAMP},
</if>
<if test="name != null">
name = #{name,jdbcType=VARCHAR},
</if>
<if test="sort != null">
sort = #{sort,jdbcType=INTEGER},
</if>
</set>
where id = #{id,jdbcType=BIGINT}
</update>
<update id="updateByPrimaryKey" parameterType="com.macro.mall.model.UmsResourceCategory">
update ums_resource_category
set create_time = #{createTime,jdbcType=TIMESTAMP},
name = #{name,jdbcType=VARCHAR},
sort = #{sort,jdbcType=INTEGER}
where id = #{id,jdbcType=BIGINT}
</update>
</mapper>

View File

@@ -0,0 +1,226 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.macro.mall.mapper.UmsResourceMapper">
<resultMap id="BaseResultMap" type="com.macro.mall.model.UmsResource">
<id column="id" jdbcType="BIGINT" property="id" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="name" jdbcType="VARCHAR" property="name" />
<result column="url" jdbcType="VARCHAR" property="url" />
<result column="description" jdbcType="VARCHAR" property="description" />
<result column="category_id" jdbcType="BIGINT" property="categoryId" />
</resultMap>
<sql id="Example_Where_Clause">
<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">
<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">
id, create_time, name, url, description, category_id
</sql>
<select id="selectByExample" parameterType="com.macro.mall.model.UmsResourceExample" resultMap="BaseResultMap">
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List" />
from ums_resource
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
<if test="orderByClause != null">
order by ${orderByClause}
</if>
</select>
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from ums_resource
where id = #{id,jdbcType=BIGINT}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
delete from ums_resource
where id = #{id,jdbcType=BIGINT}
</delete>
<delete id="deleteByExample" parameterType="com.macro.mall.model.UmsResourceExample">
delete from ums_resource
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</delete>
<insert id="insert" parameterType="com.macro.mall.model.UmsResource">
<selectKey keyProperty="id" order="AFTER" resultType="java.lang.Long">
SELECT LAST_INSERT_ID()
</selectKey>
insert into ums_resource (create_time, name, url,
description, category_id)
values (#{createTime,jdbcType=TIMESTAMP}, #{name,jdbcType=VARCHAR}, #{url,jdbcType=VARCHAR},
#{description,jdbcType=VARCHAR}, #{categoryId,jdbcType=BIGINT})
</insert>
<insert id="insertSelective" parameterType="com.macro.mall.model.UmsResource">
<selectKey keyProperty="id" order="AFTER" resultType="java.lang.Long">
SELECT LAST_INSERT_ID()
</selectKey>
insert into ums_resource
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="createTime != null">
create_time,
</if>
<if test="name != null">
name,
</if>
<if test="url != null">
url,
</if>
<if test="description != null">
description,
</if>
<if test="categoryId != null">
category_id,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="createTime != null">
#{createTime,jdbcType=TIMESTAMP},
</if>
<if test="name != null">
#{name,jdbcType=VARCHAR},
</if>
<if test="url != null">
#{url,jdbcType=VARCHAR},
</if>
<if test="description != null">
#{description,jdbcType=VARCHAR},
</if>
<if test="categoryId != null">
#{categoryId,jdbcType=BIGINT},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="com.macro.mall.model.UmsResourceExample" resultType="java.lang.Long">
select count(*) from ums_resource
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</select>
<update id="updateByExampleSelective" parameterType="map">
update ums_resource
<set>
<if test="record.id != null">
id = #{record.id,jdbcType=BIGINT},
</if>
<if test="record.createTime != null">
create_time = #{record.createTime,jdbcType=TIMESTAMP},
</if>
<if test="record.name != null">
name = #{record.name,jdbcType=VARCHAR},
</if>
<if test="record.url != null">
url = #{record.url,jdbcType=VARCHAR},
</if>
<if test="record.description != null">
description = #{record.description,jdbcType=VARCHAR},
</if>
<if test="record.categoryId != null">
category_id = #{record.categoryId,jdbcType=BIGINT},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByExample" parameterType="map">
update ums_resource
set id = #{record.id,jdbcType=BIGINT},
create_time = #{record.createTime,jdbcType=TIMESTAMP},
name = #{record.name,jdbcType=VARCHAR},
url = #{record.url,jdbcType=VARCHAR},
description = #{record.description,jdbcType=VARCHAR},
category_id = #{record.categoryId,jdbcType=BIGINT}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByPrimaryKeySelective" parameterType="com.macro.mall.model.UmsResource">
update ums_resource
<set>
<if test="createTime != null">
create_time = #{createTime,jdbcType=TIMESTAMP},
</if>
<if test="name != null">
name = #{name,jdbcType=VARCHAR},
</if>
<if test="url != null">
url = #{url,jdbcType=VARCHAR},
</if>
<if test="description != null">
description = #{description,jdbcType=VARCHAR},
</if>
<if test="categoryId != null">
category_id = #{categoryId,jdbcType=BIGINT},
</if>
</set>
where id = #{id,jdbcType=BIGINT}
</update>
<update id="updateByPrimaryKey" parameterType="com.macro.mall.model.UmsResource">
update ums_resource
set create_time = #{createTime,jdbcType=TIMESTAMP},
name = #{name,jdbcType=VARCHAR},
url = #{url,jdbcType=VARCHAR},
description = #{description,jdbcType=VARCHAR},
category_id = #{categoryId,jdbcType=BIGINT}
where id = #{id,jdbcType=BIGINT}
</update>
</mapper>

View File

@@ -0,0 +1,179 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.macro.mall.mapper.UmsRoleMenuRelationMapper">
<resultMap id="BaseResultMap" type="com.macro.mall.model.UmsRoleMenuRelation">
<id column="id" jdbcType="BIGINT" property="id" />
<result column="role_id" jdbcType="BIGINT" property="roleId" />
<result column="menu_id" jdbcType="BIGINT" property="menuId" />
</resultMap>
<sql id="Example_Where_Clause">
<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">
<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">
id, role_id, menu_id
</sql>
<select id="selectByExample" parameterType="com.macro.mall.model.UmsRoleMenuRelationExample" resultMap="BaseResultMap">
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List" />
from ums_role_menu_relation
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
<if test="orderByClause != null">
order by ${orderByClause}
</if>
</select>
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from ums_role_menu_relation
where id = #{id,jdbcType=BIGINT}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
delete from ums_role_menu_relation
where id = #{id,jdbcType=BIGINT}
</delete>
<delete id="deleteByExample" parameterType="com.macro.mall.model.UmsRoleMenuRelationExample">
delete from ums_role_menu_relation
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</delete>
<insert id="insert" parameterType="com.macro.mall.model.UmsRoleMenuRelation">
<selectKey keyProperty="id" order="AFTER" resultType="java.lang.Long">
SELECT LAST_INSERT_ID()
</selectKey>
insert into ums_role_menu_relation (role_id, menu_id)
values (#{roleId,jdbcType=BIGINT}, #{menuId,jdbcType=BIGINT})
</insert>
<insert id="insertSelective" parameterType="com.macro.mall.model.UmsRoleMenuRelation">
<selectKey keyProperty="id" order="AFTER" resultType="java.lang.Long">
SELECT LAST_INSERT_ID()
</selectKey>
insert into ums_role_menu_relation
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="roleId != null">
role_id,
</if>
<if test="menuId != null">
menu_id,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="roleId != null">
#{roleId,jdbcType=BIGINT},
</if>
<if test="menuId != null">
#{menuId,jdbcType=BIGINT},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="com.macro.mall.model.UmsRoleMenuRelationExample" resultType="java.lang.Long">
select count(*) from ums_role_menu_relation
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</select>
<update id="updateByExampleSelective" parameterType="map">
update ums_role_menu_relation
<set>
<if test="record.id != null">
id = #{record.id,jdbcType=BIGINT},
</if>
<if test="record.roleId != null">
role_id = #{record.roleId,jdbcType=BIGINT},
</if>
<if test="record.menuId != null">
menu_id = #{record.menuId,jdbcType=BIGINT},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByExample" parameterType="map">
update ums_role_menu_relation
set id = #{record.id,jdbcType=BIGINT},
role_id = #{record.roleId,jdbcType=BIGINT},
menu_id = #{record.menuId,jdbcType=BIGINT}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByPrimaryKeySelective" parameterType="com.macro.mall.model.UmsRoleMenuRelation">
update ums_role_menu_relation
<set>
<if test="roleId != null">
role_id = #{roleId,jdbcType=BIGINT},
</if>
<if test="menuId != null">
menu_id = #{menuId,jdbcType=BIGINT},
</if>
</set>
where id = #{id,jdbcType=BIGINT}
</update>
<update id="updateByPrimaryKey" parameterType="com.macro.mall.model.UmsRoleMenuRelation">
update ums_role_menu_relation
set role_id = #{roleId,jdbcType=BIGINT},
menu_id = #{menuId,jdbcType=BIGINT}
where id = #{id,jdbcType=BIGINT}
</update>
</mapper>

View File

@@ -0,0 +1,179 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.macro.mall.mapper.UmsRoleResourceRelationMapper">
<resultMap id="BaseResultMap" type="com.macro.mall.model.UmsRoleResourceRelation">
<id column="id" jdbcType="BIGINT" property="id" />
<result column="role_id" jdbcType="BIGINT" property="roleId" />
<result column="resource_id" jdbcType="BIGINT" property="resourceId" />
</resultMap>
<sql id="Example_Where_Clause">
<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">
<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">
id, role_id, resource_id
</sql>
<select id="selectByExample" parameterType="com.macro.mall.model.UmsRoleResourceRelationExample" resultMap="BaseResultMap">
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List" />
from ums_role_resource_relation
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
<if test="orderByClause != null">
order by ${orderByClause}
</if>
</select>
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from ums_role_resource_relation
where id = #{id,jdbcType=BIGINT}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
delete from ums_role_resource_relation
where id = #{id,jdbcType=BIGINT}
</delete>
<delete id="deleteByExample" parameterType="com.macro.mall.model.UmsRoleResourceRelationExample">
delete from ums_role_resource_relation
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</delete>
<insert id="insert" parameterType="com.macro.mall.model.UmsRoleResourceRelation">
<selectKey keyProperty="id" order="AFTER" resultType="java.lang.Long">
SELECT LAST_INSERT_ID()
</selectKey>
insert into ums_role_resource_relation (role_id, resource_id)
values (#{roleId,jdbcType=BIGINT}, #{resourceId,jdbcType=BIGINT})
</insert>
<insert id="insertSelective" parameterType="com.macro.mall.model.UmsRoleResourceRelation">
<selectKey keyProperty="id" order="AFTER" resultType="java.lang.Long">
SELECT LAST_INSERT_ID()
</selectKey>
insert into ums_role_resource_relation
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="roleId != null">
role_id,
</if>
<if test="resourceId != null">
resource_id,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="roleId != null">
#{roleId,jdbcType=BIGINT},
</if>
<if test="resourceId != null">
#{resourceId,jdbcType=BIGINT},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="com.macro.mall.model.UmsRoleResourceRelationExample" resultType="java.lang.Long">
select count(*) from ums_role_resource_relation
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</select>
<update id="updateByExampleSelective" parameterType="map">
update ums_role_resource_relation
<set>
<if test="record.id != null">
id = #{record.id,jdbcType=BIGINT},
</if>
<if test="record.roleId != null">
role_id = #{record.roleId,jdbcType=BIGINT},
</if>
<if test="record.resourceId != null">
resource_id = #{record.resourceId,jdbcType=BIGINT},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByExample" parameterType="map">
update ums_role_resource_relation
set id = #{record.id,jdbcType=BIGINT},
role_id = #{record.roleId,jdbcType=BIGINT},
resource_id = #{record.resourceId,jdbcType=BIGINT}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByPrimaryKeySelective" parameterType="com.macro.mall.model.UmsRoleResourceRelation">
update ums_role_resource_relation
<set>
<if test="roleId != null">
role_id = #{roleId,jdbcType=BIGINT},
</if>
<if test="resourceId != null">
resource_id = #{resourceId,jdbcType=BIGINT},
</if>
</set>
where id = #{id,jdbcType=BIGINT}
</update>
<update id="updateByPrimaryKey" parameterType="com.macro.mall.model.UmsRoleResourceRelation">
update ums_role_resource_relation
set role_id = #{roleId,jdbcType=BIGINT},
resource_id = #{resourceId,jdbcType=BIGINT}
where id = #{id,jdbcType=BIGINT}
</update>
</mapper>

View File

@@ -5,7 +5,7 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
@EnableDiscoveryClient
@SpringBootApplication
@SpringBootApplication(scanBasePackages = "com.macro.mall")
public class MallPortalApplication {
public static void main(String[] args) {

View File

@@ -1,6 +1,5 @@
package com.macro.mall.portal.component;
import com.macro.mall.common.api.CommonResult;
import com.macro.mall.portal.service.OmsPortalOrderService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -12,7 +11,7 @@ import org.springframework.stereotype.Component;
* Created by macro on 2018/8/24.
* 订单超时取消并解锁库存的定时器
*/
//@Component
@Component
public class OrderTimeOutCancelTask {
private Logger LOGGER =LoggerFactory.getLogger(OrderTimeOutCancelTask.class);
@Autowired
@@ -24,7 +23,7 @@ public class OrderTimeOutCancelTask {
*/
@Scheduled(cron = "0 0/10 * ? * ?")
private void cancelTimeOutOrder(){
CommonResult result = portalOrderService.cancelTimeOutOrder();
LOGGER.info("取消订单并根据sku编号释放锁定库存:{}",result);
Integer count = portalOrderService.cancelTimeOutOrder();
LOGGER.info("取消订单并根据sku编号释放锁定库存,取消订单数量:{}",count);
}
}

View File

@@ -1,21 +1,27 @@
package com.macro.mall.portal.config;
import com.macro.mall.portal.service.UmsMemberService;
import com.macro.mall.security.component.DynamicSecurityService;
import com.macro.mall.security.config.SecurityConfig;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.access.ConfigAttribute;
import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.core.userdetails.UserDetailsService;
import java.util.Collection;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
/**
* mall-security模块相关配置
* Created by macro on 2019/11/5.
*/
@Configuration
@EnableWebSecurity
@EnableGlobalMethodSecurity(prePostEnabled=true)
@EnableGlobalMethodSecurity(prePostEnabled = true)
public class MallSecurityConfig extends SecurityConfig {
@Autowired

View File

@@ -10,48 +10,55 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import java.util.Map;
/**
* 订单管理Controller
* Created by macro on 2018/8/30.
*/
@Controller
@Api(tags = "OmsPortalOrderController",description = "订单管理")
@Api(tags = "OmsPortalOrderController", description = "订单管理")
@RequestMapping("/order")
public class OmsPortalOrderController {
@Autowired
private OmsPortalOrderService portalOrderService;
@ApiOperation("根据购物车信息生成确认单信息")
@RequestMapping(value = "/generateConfirmOrder",method = RequestMethod.POST)
@RequestMapping(value = "/generateConfirmOrder", method = RequestMethod.POST)
@ResponseBody
public CommonResult<ConfirmOrderResult> generateConfirmOrder(){
public CommonResult<ConfirmOrderResult> generateConfirmOrder() {
ConfirmOrderResult confirmOrderResult = portalOrderService.generateConfirmOrder();
return CommonResult.success(confirmOrderResult);
}
@ApiOperation("根据购物车信息生成订单")
@RequestMapping(value = "/generateOrder",method = RequestMethod.POST)
@RequestMapping(value = "/generateOrder", method = RequestMethod.POST)
@ResponseBody
public Object generateOrder(@RequestBody OrderParam orderParam){
return portalOrderService.generateOrder(orderParam);
public CommonResult generateOrder(@RequestBody OrderParam orderParam) {
Map<String, Object> result = portalOrderService.generateOrder(orderParam);
return CommonResult.success(result, "下单成功");
}
@ApiOperation("支付成功的回调")
@RequestMapping(value = "/paySuccess",method = RequestMethod.POST)
@RequestMapping(value = "/paySuccess", method = RequestMethod.POST)
@ResponseBody
public Object paySuccess(@RequestParam Long orderId){
return portalOrderService.paySuccess(orderId);
public CommonResult paySuccess(@RequestParam Long orderId) {
Integer count = portalOrderService.paySuccess(orderId);
return CommonResult.success(count, "支付成功");
}
@ApiOperation("自动取消超时订单")
@RequestMapping(value = "/cancelTimeOutOrder",method = RequestMethod.POST)
@RequestMapping(value = "/cancelTimeOutOrder", method = RequestMethod.POST)
@ResponseBody
public Object cancelTimeOutOrder(){
return portalOrderService.cancelTimeOutOrder();
public CommonResult cancelTimeOutOrder() {
portalOrderService.cancelTimeOutOrder();
return CommonResult.success(null);
}
@ApiOperation("取消单个超时订单")
@RequestMapping(value = "/cancelOrder",method = RequestMethod.POST)
@RequestMapping(value = "/cancelOrder", method = RequestMethod.POST)
@ResponseBody
public CommonResult cancelOrder(Long orderId){
public CommonResult cancelOrder(Long orderId) {
portalOrderService.sendDelayMessageCancelOrder(orderId);
return CommonResult.success(null);
}

View File

@@ -38,7 +38,8 @@ public class UmsMemberController {
@RequestParam String password,
@RequestParam String telephone,
@RequestParam String authCode) {
return memberService.register(username, password, telephone, authCode);
memberService.register(username, password, telephone, authCode);
return CommonResult.success(null,"注册成功");
}
@ApiOperation("会员登录")
@@ -60,7 +61,8 @@ public class UmsMemberController {
@RequestMapping(value = "/getAuthCode", method = RequestMethod.GET)
@ResponseBody
public CommonResult getAuthCode(@RequestParam String telephone) {
return memberService.generateAuthCode(telephone);
String authCode = memberService.generateAuthCode(telephone);
return CommonResult.success(authCode,"获取验证码成功");
}
@ApiOperation("修改密码")
@@ -69,9 +71,11 @@ public class UmsMemberController {
public CommonResult updatePassword(@RequestParam String telephone,
@RequestParam String password,
@RequestParam String authCode) {
return memberService.updatePassword(telephone,password,authCode);
memberService.updatePassword(telephone,password,authCode);
return CommonResult.success(null,"密码修改成功");
}
@ApiOperation(value = "刷新token")
@RequestMapping(value = "/refreshToken", method = RequestMethod.GET)
@ResponseBody

View File

@@ -35,7 +35,8 @@ public class UmsMemberCouponController {
@RequestMapping(value = "/add/{couponId}", method = RequestMethod.POST)
@ResponseBody
public CommonResult add(@PathVariable Long couponId) {
return memberCouponService.add(couponId);
memberCouponService.add(couponId);
return CommonResult.success(null,"领取成功");
}
@ApiOperation("获取用户优惠券列表")

View File

@@ -1,10 +1,11 @@
package com.macro.mall.portal.service;
import com.macro.mall.common.api.CommonResult;
import com.macro.mall.portal.domain.ConfirmOrderResult;
import com.macro.mall.portal.domain.OrderParam;
import org.springframework.transaction.annotation.Transactional;
import java.util.Map;
/**
* 前台订单管理Service
* Created by macro on 2018/8/30.
@@ -19,19 +20,19 @@ public interface OmsPortalOrderService {
* 根据提交信息生成订单
*/
@Transactional
CommonResult generateOrder(OrderParam orderParam);
Map<String, Object> generateOrder(OrderParam orderParam);
/**
* 支付成功后的回调
*/
@Transactional
CommonResult paySuccess(Long orderId);
Integer paySuccess(Long orderId);
/**
* 自动取消超时订单
*/
@Transactional
CommonResult cancelTimeOutOrder();
Integer cancelTimeOutOrder();
/**
* 取消单个超时订单

View File

@@ -1,6 +1,5 @@
package com.macro.mall.portal.service;
import com.macro.mall.common.api.CommonResult;
import com.macro.mall.model.SmsCouponHistory;
import com.macro.mall.portal.domain.CartPromotionItem;
import com.macro.mall.portal.domain.SmsCouponHistoryDetail;
@@ -17,7 +16,7 @@ public interface UmsMemberCouponService {
* 会员添加优惠券
*/
@Transactional
CommonResult add(Long couponId);
void add(Long couponId);
/**
* 获取优惠券列表

View File

@@ -24,18 +24,18 @@ public interface UmsMemberService {
* 用户注册
*/
@Transactional
CommonResult register(String username, String password, String telephone, String authCode);
void register(String username, String password, String telephone, String authCode);
/**
* 生成验证码
*/
CommonResult generateAuthCode(String telephone);
String generateAuthCode(String telephone);
/**
* 修改密码
*/
@Transactional
CommonResult updatePassword(String telephone, String password, String authCode);
void updatePassword(String telephone, String password, String authCode);
/**
* 获取当前登录会员
@@ -47,6 +47,7 @@ public interface UmsMemberService {
*/
void updateIntegration(Long id,Integer integration);
/**
* 获取用户信息
*/

View File

@@ -60,14 +60,8 @@ public class OmsCartItemServiceImpl implements OmsCartItemService {
OmsCartItemExample example = new OmsCartItemExample();
OmsCartItemExample.Criteria criteria = example.createCriteria().andMemberIdEqualTo(cartItem.getMemberId())
.andProductIdEqualTo(cartItem.getProductId()).andDeleteStatusEqualTo(0);
if (!StringUtils.isEmpty(cartItem.getSp1())) {
criteria.andSp1EqualTo(cartItem.getSp1());
}
if (!StringUtils.isEmpty(cartItem.getSp2())) {
criteria.andSp2EqualTo(cartItem.getSp2());
}
if (!StringUtils.isEmpty(cartItem.getSp3())) {
criteria.andSp3EqualTo(cartItem.getSp3());
if (!StringUtils.isEmpty(cartItem.getProductSkuId())) {
criteria.andProductSkuIdEqualTo(cartItem.getProductSkuId());
}
List<OmsCartItem> cartItemList = cartItemMapper.selectByExample(example);
if (!CollectionUtils.isEmpty(cartItemList)) {

View File

@@ -1,6 +1,6 @@
package com.macro.mall.portal.service.impl;
import com.macro.mall.common.api.CommonResult;
import com.macro.mall.common.exception.Asserts;
import com.macro.mall.mapper.*;
import com.macro.mall.model.*;
import com.macro.mall.portal.component.CancelOrderSender;
@@ -83,7 +83,7 @@ public class OmsPortalOrderServiceImpl implements OmsPortalOrderService {
}
@Override
public CommonResult generateOrder(OrderParam orderParam) {
public Map<String, Object> generateOrder(OrderParam orderParam) {
List<OmsOrderItem> orderItemList = new ArrayList<>();
//获取购物车及优惠信息
UmsMember currentMember = memberService.getCurrentMember();
@@ -110,7 +110,7 @@ public class OmsPortalOrderServiceImpl implements OmsPortalOrderService {
}
//判断购物车中商品是否都有库存
if (!hasStock(cartPromotionItemList)) {
return CommonResult.failed("库存不足,无法下单");
Asserts.fail("库存不足,无法下单");
}
//判断使用使用了优惠券
if (orderParam.getCouponId() == null) {
@@ -122,7 +122,7 @@ public class OmsPortalOrderServiceImpl implements OmsPortalOrderService {
//使用优惠券
SmsCouponHistoryDetail couponHistoryDetail = getUseCoupon(cartPromotionItemList, orderParam.getCouponId());
if (couponHistoryDetail == null) {
return CommonResult.failed("该优惠券不可用");
Asserts.fail("该优惠券不可用");
}
//对下单商品的优惠券进行处理
handleCouponAmount(orderItemList, couponHistoryDetail);
@@ -138,7 +138,7 @@ public class OmsPortalOrderServiceImpl implements OmsPortalOrderService {
BigDecimal totalAmount = calcTotalAmount(orderItemList);
BigDecimal integrationAmount = getUseIntegrationAmount(orderParam.getUseIntegration(), totalAmount, currentMember, orderParam.getCouponId() != null);
if (integrationAmount.compareTo(new BigDecimal(0)) == 0) {
return CommonResult.failed("积分不可用");
Asserts.fail("积分不可用");
} else {
//可用情况下分摊到可用商品中
for (OmsOrderItem orderItem : orderItemList) {
@@ -226,11 +226,11 @@ public class OmsPortalOrderServiceImpl implements OmsPortalOrderService {
Map<String, Object> result = new HashMap<>();
result.put("order", order);
result.put("orderItemList", orderItemList);
return CommonResult.success(result, "下单成功");
return result;
}
@Override
public CommonResult paySuccess(Long orderId) {
public Integer paySuccess(Long orderId) {
//修改订单支付状态
OmsOrder order = new OmsOrder();
order.setId(orderId);
@@ -240,16 +240,17 @@ public class OmsPortalOrderServiceImpl implements OmsPortalOrderService {
//恢复所有下单商品的锁定库存,扣减真实库存
OmsOrderDetail orderDetail = portalOrderDao.getDetail(orderId);
int count = portalOrderDao.updateSkuStock(orderDetail.getOrderItemList());
return CommonResult.success(count,"支付成功");
return count;
}
@Override
public CommonResult cancelTimeOutOrder() {
public Integer cancelTimeOutOrder() {
Integer count=0;
OmsOrderSetting orderSetting = orderSettingMapper.selectByPrimaryKey(1L);
//查询超时、未支付的订单及订单详情
List<OmsOrderDetail> timeOutOrders = portalOrderDao.getTimeOutOrders(orderSetting.getNormalOrderOvertime());
if (CollectionUtils.isEmpty(timeOutOrders)) {
return CommonResult.failed("暂无超时订单");
return count;
}
//修改订单状态为交易取消
List<Long> ids = new ArrayList<>();
@@ -268,7 +269,7 @@ public class OmsPortalOrderServiceImpl implements OmsPortalOrderService {
memberService.updateIntegration(timeOutOrder.getMemberId(), member.getIntegration() + timeOutOrder.getUseIntegration());
}
}
return CommonResult.success(null);
return timeOutOrders.size();
}
@Override

View File

@@ -1,6 +1,6 @@
package com.macro.mall.portal.service.impl;
import com.macro.mall.common.api.CommonResult;
import com.macro.mall.common.exception.Asserts;
import com.macro.mall.mapper.SmsCouponHistoryMapper;
import com.macro.mall.mapper.SmsCouponMapper;
import com.macro.mall.model.*;
@@ -13,7 +13,10 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.math.BigDecimal;
import java.util.*;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Random;
/**
* 会员优惠券管理Service实现类
@@ -30,26 +33,26 @@ public class UmsMemberCouponServiceImpl implements UmsMemberCouponService {
@Autowired
private SmsCouponHistoryDao couponHistoryDao;
@Override
public CommonResult add(Long couponId) {
public void add(Long couponId) {
UmsMember currentMember = memberService.getCurrentMember();
//获取优惠券信息,判断数量
SmsCoupon coupon = couponMapper.selectByPrimaryKey(couponId);
if(coupon==null){
return CommonResult.failed("优惠券不存在");
Asserts.fail("优惠券不存在");
}
if(coupon.getCount()<=0){
return CommonResult.failed("优惠券已经领完了");
Asserts.fail("优惠券已经领完了");
}
Date now = new Date();
if(now.before(coupon.getEnableTime())){
return CommonResult.failed("优惠券还没到领取时间");
Asserts.fail("优惠券还没到领取时间");
}
//判断用户领取的优惠券数量是否超过限制
SmsCouponHistoryExample couponHistoryExample = new SmsCouponHistoryExample();
couponHistoryExample.createCriteria().andCouponIdEqualTo(couponId).andMemberIdEqualTo(currentMember.getId());
long count = couponHistoryMapper.countByExample(couponHistoryExample);
if(count>=coupon.getPerLimit()){
return CommonResult.failed("您已经领取过该优惠券");
Asserts.fail("您已经领取过该优惠券");
}
//生成领取优惠券历史
SmsCouponHistory couponHistory = new SmsCouponHistory();
@@ -67,7 +70,6 @@ public class UmsMemberCouponServiceImpl implements UmsMemberCouponService {
coupon.setCount(coupon.getCount()-1);
coupon.setReceiveCount(coupon.getReceiveCount()==null?1:coupon.getReceiveCount()+1);
couponMapper.updateByPrimaryKey(coupon);
return CommonResult.success(null,"领取成功");
}
/**

View File

@@ -1,6 +1,6 @@
package com.macro.mall.portal.service.impl;
import com.macro.mall.common.api.CommonResult;
import com.macro.mall.common.exception.Asserts;
import com.macro.mall.mapper.UmsMemberLevelMapper;
import com.macro.mall.mapper.UmsMemberMapper;
import com.macro.mall.model.UmsMember;
@@ -71,10 +71,10 @@ public class UmsMemberServiceImpl implements UmsMemberService {
}
@Override
public CommonResult register(String username, String password, String telephone, String authCode) {
public void register(String username, String password, String telephone, String authCode) {
//验证验证码
if(!verifyAuthCode(authCode,telephone)){
return CommonResult.failed("验证码错误");
Asserts.fail("验证码错误");
}
//查询是否已有该用户
UmsMemberExample example = new UmsMemberExample();
@@ -82,7 +82,7 @@ public class UmsMemberServiceImpl implements UmsMemberService {
example.or(example.createCriteria().andPhoneEqualTo(telephone));
List<UmsMember> umsMembers = memberMapper.selectByExample(example);
if (!CollectionUtils.isEmpty(umsMembers)) {
return CommonResult.failed("该用户已经存在");
Asserts.fail("该用户已经存在");
}
//没有该用户进行添加操作
UmsMember umsMember = new UmsMember();
@@ -100,11 +100,10 @@ public class UmsMemberServiceImpl implements UmsMemberService {
}
memberMapper.insert(umsMember);
umsMember.setPassword(null);
return CommonResult.success(null,"注册成功");
}
@Override
public CommonResult generateAuthCode(String telephone) {
public String generateAuthCode(String telephone) {
StringBuilder sb = new StringBuilder();
Random random = new Random();
for(int i=0;i<6;i++){
@@ -113,25 +112,24 @@ public class UmsMemberServiceImpl implements UmsMemberService {
//验证码绑定手机号并存储到redis
redisService.set(REDIS_KEY_PREFIX_AUTH_CODE+telephone,sb.toString());
redisService.expire(REDIS_KEY_PREFIX_AUTH_CODE+telephone,AUTH_CODE_EXPIRE_SECONDS);
return CommonResult.success(sb.toString(),"获取验证码成功");
return sb.toString();
}
@Override
public CommonResult updatePassword(String telephone, String password, String authCode) {
public void updatePassword(String telephone, String password, String authCode) {
UmsMemberExample example = new UmsMemberExample();
example.createCriteria().andPhoneEqualTo(telephone);
List<UmsMember> memberList = memberMapper.selectByExample(example);
if(CollectionUtils.isEmpty(memberList)){
return CommonResult.failed("该账号不存在");
Asserts.fail("该账号不存在");
}
//验证验证码
if(!verifyAuthCode(authCode,telephone)){
return CommonResult.failed("验证码错误");
Asserts.fail("验证码错误");
}
UmsMember umsMember = memberList.get(0);
umsMember.setPassword(passwordEncoder.encode(password));
memberMapper.updateByPrimaryKeySelective(umsMember);
return CommonResult.success(null,"密码修改成功");
}
@Override

View File

@@ -5,20 +5,18 @@
insert into oms_order_item (order_id, order_sn, product_id,
product_pic, product_name, product_brand,
product_sn, product_price, product_quantity,
product_sku_id, product_category_id, product_sku_code,
sp1, sp2, sp3, promotion_name,
product_sku_id, product_category_id, product_sku_code,promotion_name,
promotion_amount, coupon_amount, integration_amount,
real_amount) values
real_amount,product_attr) values
<foreach collection="list" item="item" separator="," index="index">
(#{item.orderId,jdbcType=BIGINT}, #{item.orderSn,jdbcType=VARCHAR}, #{item.productId,jdbcType=BIGINT},
#{item.productPic,jdbcType=VARCHAR}, #{item.productName,jdbcType=VARCHAR}, #{item.productBrand,jdbcType=VARCHAR},
#{item.productSn,jdbcType=VARCHAR}, #{item.productPrice,jdbcType=DECIMAL}, #{item.productQuantity,jdbcType=INTEGER},
#{item.productSkuId,jdbcType=BIGINT}, #{item.productCategoryId,jdbcType=BIGINT}, #{item.productSkuCode,jdbcType=VARCHAR},
#{item.sp1,jdbcType=VARCHAR}, #{item.sp2,jdbcType=VARCHAR}, #{item.sp3,jdbcType=VARCHAR},
#{item.promotionName,jdbcType=VARCHAR},
#{item.promotionAmount,jdbcType=DECIMAL}, #{item.couponAmount,jdbcType=DECIMAL},
#{item.integrationAmount,jdbcType=DECIMAL},
#{item.realAmount,jdbcType=DECIMAL})
#{item.realAmount,jdbcType=DECIMAL},#{item.productAttr,jdbcType=VARCHAR})
</foreach>
</insert>
</mapper>

View File

@@ -31,9 +31,6 @@
ps.id sku_id,
ps.sku_code sku_code,
ps.price sku_price,
ps.sp1 sku_sp1,
ps.sp2 sku_sp2,
ps.sp3 sku_sp3,
ps.stock sku_stock,
ps.pic sku_pic
FROM

View File

@@ -0,0 +1,51 @@
package com.macro.mall.security.component;
import cn.hutool.core.collection.CollUtil;
import org.springframework.security.access.AccessDecisionManager;
import org.springframework.security.access.AccessDeniedException;
import org.springframework.security.access.ConfigAttribute;
import org.springframework.security.authentication.InsufficientAuthenticationException;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.GrantedAuthority;
import java.util.Collection;
import java.util.Iterator;
/**
* 动态权限决策管理器,用于判断用户是否有访问权限
* Created by macro on 2020/2/7.
*/
public class DynamicAccessDecisionManager implements AccessDecisionManager {
@Override
public void decide(Authentication authentication, Object object,
Collection<ConfigAttribute> configAttributes) throws AccessDeniedException, InsufficientAuthenticationException {
// 当接口未被配置资源时直接放行
if (CollUtil.isEmpty(configAttributes)) {
return;
}
Iterator<ConfigAttribute> iterator = configAttributes.iterator();
while (iterator.hasNext()) {
ConfigAttribute configAttribute = iterator.next();
//将访问所需资源或用户拥有资源进行比对
String needAuthority = configAttribute.getAttribute();
for (GrantedAuthority grantedAuthority : authentication.getAuthorities()) {
if (needAuthority.trim().equals(grantedAuthority.getAuthority())) {
return;
}
}
}
throw new AccessDeniedException("抱歉,您没有访问权限");
}
@Override
public boolean supports(ConfigAttribute configAttribute) {
return true;
}
@Override
public boolean supports(Class<?> aClass) {
return true;
}
}

View File

@@ -0,0 +1,77 @@
package com.macro.mall.security.component;
import com.macro.mall.security.config.IgnoreUrlsConfig;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpMethod;
import org.springframework.security.access.SecurityMetadataSource;
import org.springframework.security.access.intercept.AbstractSecurityInterceptor;
import org.springframework.security.access.intercept.InterceptorStatusToken;
import org.springframework.security.web.FilterInvocation;
import org.springframework.util.AntPathMatcher;
import org.springframework.util.PathMatcher;
import javax.servlet.*;
import javax.servlet.http.HttpServletRequest;
import java.io.IOException;
/**
* 动态权限过滤器,用于实现基于路径的动态权限过滤
* Created by macro on 2020/2/7.
*/
public class DynamicSecurityFilter extends AbstractSecurityInterceptor implements Filter {
@Autowired
private DynamicSecurityMetadataSource dynamicSecurityMetadataSource;
@Autowired
private IgnoreUrlsConfig ignoreUrlsConfig;
@Autowired
public void setMyAccessDecisionManager(DynamicAccessDecisionManager dynamicAccessDecisionManager) {
super.setAccessDecisionManager(dynamicAccessDecisionManager);
}
@Override
public void init(FilterConfig filterConfig) throws ServletException {
}
@Override
public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {
HttpServletRequest request = (HttpServletRequest) servletRequest;
FilterInvocation fi = new FilterInvocation(servletRequest, servletResponse, filterChain);
//OPTIONS请求直接放行
if(request.getMethod().equals(HttpMethod.OPTIONS.toString())){
fi.getChain().doFilter(fi.getRequest(), fi.getResponse());
return;
}
//白名单请求直接放行
PathMatcher pathMatcher = new AntPathMatcher();
for (String path : ignoreUrlsConfig.getUrls()) {
if(pathMatcher.match(path,request.getRequestURI())){
fi.getChain().doFilter(fi.getRequest(), fi.getResponse());
return;
}
}
//此处会调用AccessDecisionManager中的decide方法进行鉴权操作
InterceptorStatusToken token = super.beforeInvocation(fi);
try {
fi.getChain().doFilter(fi.getRequest(), fi.getResponse());
} finally {
super.afterInvocation(token, null);
}
}
@Override
public void destroy() {
}
@Override
public Class<?> getSecureObjectClass() {
return FilterInvocation.class;
}
@Override
public SecurityMetadataSource obtainSecurityMetadataSource() {
return dynamicSecurityMetadataSource;
}
}

View File

@@ -0,0 +1,64 @@
package com.macro.mall.security.component;
import cn.hutool.core.util.URLUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.ConfigAttribute;
import org.springframework.security.web.FilterInvocation;
import org.springframework.security.web.access.intercept.FilterInvocationSecurityMetadataSource;
import org.springframework.util.AntPathMatcher;
import org.springframework.util.PathMatcher;
import javax.annotation.PostConstruct;
import java.util.*;
/**
* 动态权限数据源,用于获取动态权限规则
* Created by macro on 2020/2/7.
*/
public class DynamicSecurityMetadataSource implements FilterInvocationSecurityMetadataSource {
private static Map<String, ConfigAttribute> configAttributeMap = null;
@Autowired
private DynamicSecurityService dynamicSecurityService;
@PostConstruct
public void loadDataSource() {
configAttributeMap = dynamicSecurityService.loadDataSource();
}
public void clearDataSource() {
configAttributeMap.clear();
configAttributeMap = null;
}
@Override
public Collection<ConfigAttribute> getAttributes(Object o) throws IllegalArgumentException {
if (configAttributeMap == null) this.loadDataSource();
List<ConfigAttribute> configAttributes = new ArrayList<>();
//获取当前访问的路径
String url = ((FilterInvocation) o).getRequestUrl();
String path = URLUtil.getPath(url);
PathMatcher pathMatcher = new AntPathMatcher();
Iterator<String> iterator = configAttributeMap.keySet().iterator();
//获取访问该路径所需资源
while (iterator.hasNext()) {
String pattern = iterator.next();
if (pathMatcher.match(pattern, path)) {
configAttributes.add(configAttributeMap.get(pattern));
}
}
// 未设置操作请求权限,返回空集合
return configAttributes;
}
@Override
public Collection<ConfigAttribute> getAllConfigAttributes() {
return null;
}
@Override
public boolean supports(Class<?> aClass) {
return true;
}
}

View File

@@ -0,0 +1,16 @@
package com.macro.mall.security.component;
import org.springframework.security.access.ConfigAttribute;
import java.util.Map;
/**
* 动态权限相关业务类
* Created by macro on 2020/2/7.
*/
public interface DynamicSecurityService {
/**
* 加载资源ANT通配符和资源对应MAP
*/
Map<String, ConfigAttribute> loadDataSource();
}

View File

@@ -20,6 +20,8 @@ public class RestfulAccessDeniedHandler implements AccessDeniedHandler{
public void handle(HttpServletRequest request,
HttpServletResponse response,
AccessDeniedException e) throws IOException, ServletException {
response.setHeader("Access-Control-Allow-Origin", "*");
response.setHeader("Cache-Control","no-cache");
response.setCharacterEncoding("UTF-8");
response.setContentType("application/json");
response.getWriter().println(JSONUtil.parse(CommonResult.forbidden(e.getMessage())));

View File

@@ -1,9 +1,9 @@
package com.macro.mall.security.config;
import com.macro.mall.security.component.JwtAuthenticationTokenFilter;
import com.macro.mall.security.component.RestAuthenticationEntryPoint;
import com.macro.mall.security.component.RestfulAccessDeniedHandler;
import com.macro.mall.security.component.*;
import com.macro.mall.security.util.JwtTokenUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.context.annotation.Bean;
import org.springframework.http.HttpMethod;
import org.springframework.security.authentication.AuthenticationManager;
@@ -14,6 +14,7 @@ import org.springframework.security.config.annotation.web.configurers.Expression
import org.springframework.security.config.http.SessionCreationPolicy;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.security.web.access.intercept.FilterSecurityInterceptor;
import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter;
@@ -23,10 +24,14 @@ import org.springframework.security.web.authentication.UsernamePasswordAuthentic
*/
public class SecurityConfig extends WebSecurityConfigurerAdapter {
@Autowired(required = false)
private DynamicSecurityService dynamicSecurityService;
@Override
protected void configure(HttpSecurity httpSecurity) throws Exception {
ExpressionUrlAuthorizationConfigurer<HttpSecurity>.ExpressionInterceptUrlRegistry registry = httpSecurity
.authorizeRequests();
//不需要保护的资源路径允许访问
for (String url : ignoreUrlsConfig().getUrls()) {
registry.antMatchers(url).permitAll();
}
@@ -52,6 +57,10 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
// 自定义权限拦截器JWT过滤器
.and()
.addFilterBefore(jwtAuthenticationTokenFilter(), UsernamePasswordAuthenticationFilter.class);
//有动态权限配置时添加动态权限校验过滤器
if(dynamicSecurityService!=null){
registry.and().addFilterBefore(dynamicSecurityFilter(), FilterSecurityInterceptor.class);
}
}
@Override
@@ -96,4 +105,23 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
return new JwtTokenUtil();
}
@ConditionalOnBean(name = "dynamicSecurityService")
@Bean
public DynamicAccessDecisionManager dynamicAccessDecisionManager() {
return new DynamicAccessDecisionManager();
}
@ConditionalOnBean(name = "dynamicSecurityService")
@Bean
public DynamicSecurityFilter dynamicSecurityFilter() {
return new DynamicSecurityFilter();
}
@ConditionalOnBean(name = "dynamicSecurityService")
@Bean
public DynamicSecurityMetadataSource dynamicSecurityMetadataSource() {
return new DynamicSecurityMetadataSource();
}
}