| @@ -19,7 +19,7 @@ import org.springframework.beans.factory.annotation.Value; | |||
| import org.springframework.context.annotation.Bean; | |||
| import org.springframework.context.annotation.Configuration; | |||
| import com.simple.service.SysPermissionService; | |||
| import com.simple.service.MallPermissionService; | |||
| import com.simple.shiro.MyShiroRealm; | |||
| /** | |||
| @@ -28,7 +28,7 @@ import com.simple.shiro.MyShiroRealm; | |||
| @Configuration | |||
| public class ShiroConfig { | |||
| @Autowired(required = false) | |||
| private SysPermissionService resourcesService; | |||
| private MallPermissionService resourcesService; | |||
| @Value("${spring.redis.host}") | |||
| private String host; | |||
| @@ -17,11 +17,11 @@ import org.springframework.web.bind.annotation.RestController; | |||
| import com.simple.common.ErrorCode; | |||
| import com.simple.common.Result; | |||
| import com.simple.common.ResultData; | |||
| import com.simple.domain.po.SysPermission; | |||
| import com.simple.domain.po.SysRole; | |||
| import com.simple.domain.po.UserInfo; | |||
| import com.simple.service.SysPermissionService; | |||
| import com.simple.service.SysRoleService; | |||
| import com.simple.domain.po.MallPermission; | |||
| import com.simple.domain.po.MallRole; | |||
| import com.simple.domain.po.MallUserInfo; | |||
| import com.simple.service.MallPermissionService; | |||
| import com.simple.service.MallRoleService; | |||
| import com.simple.shiro.UserSession; | |||
| import io.swagger.annotations.Api; | |||
| @@ -33,10 +33,10 @@ import io.swagger.annotations.ApiOperation; | |||
| public class HomeController { | |||
| @Autowired | |||
| private SysRoleService sysRoleService; | |||
| private MallRoleService sysRoleService; | |||
| @Autowired | |||
| private SysPermissionService sysPermissionService; | |||
| private MallPermissionService sysPermissionService; | |||
| @GetMapping("login") | |||
| public ResultData login() { | |||
| @@ -45,7 +45,7 @@ public class HomeController { | |||
| @ApiOperation("登录") | |||
| @PostMapping("/doLogin") | |||
| public ResultData login(@RequestBody UserInfo user) { | |||
| public ResultData login(@RequestBody MallUserInfo user) { | |||
| ResultData data = new ResultData(); | |||
| if (StringUtils.isEmpty(user.getUsername()) || StringUtils.isEmpty(user.getPassword())) { | |||
| // throw new SystemException(ErrorCode.LOGIN_USER_OR_PWD_ERROR); | |||
| @@ -55,14 +55,14 @@ public class HomeController { | |||
| Subject subject = SecurityUtils.getSubject(); | |||
| UsernamePasswordToken token = new UsernamePasswordToken(user.getUsername(), user.getPassword()); | |||
| subject.login(token); | |||
| List<SysRole> roleList = sysRoleService.findRoleByUserId(user.getId()); | |||
| List<MallRole> roleList = sysRoleService.findRoleByUserId(user.getId()); | |||
| if (null != roleList && roleList.size() > 0) { | |||
| List<SysPermission> permissionList = sysPermissionService | |||
| .findPermissionByRoleIds(roleList.stream().map(SysRole::getId).collect(Collectors.toList())); | |||
| List<MallPermission> permissionList = sysPermissionService | |||
| .findPermissionByRoleIds(roleList.stream().map(MallRole::getId).collect(Collectors.toList())); | |||
| user.setRole(roleList); | |||
| user.setPermission(permissionList); | |||
| } | |||
| UserInfo info =(UserInfo) SecurityUtils.getSubject().getSession().getAttribute(UserSession.userInfo); | |||
| MallUserInfo info =(MallUserInfo) SecurityUtils.getSubject().getSession().getAttribute(UserSession.userInfo); | |||
| info.setPassword("保密"); | |||
| System.out.println("id:"+ SecurityUtils.getSubject().getSession().getId()); | |||
| data.data=info; | |||
| @@ -1,5 +1,8 @@ | |||
| package com.simple.controller; | |||
| import com.simple.domain.po.MallRole; | |||
| import com.simple.service.MallRoleService; | |||
| import com.simple.service.MallUserRolePermissionService; | |||
| import io.swagger.annotations.Api; | |||
| import org.apache.log4j.Logger; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| @@ -12,9 +15,7 @@ import org.springframework.web.bind.annotation.RestController; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.simple.common.Result; | |||
| import com.simple.common.ResultData; | |||
| import com.simple.domain.po.SysRole; | |||
| import com.simple.service.SysRolePermissionService; | |||
| import com.simple.service.SysRoleService; | |||
| @RestController | |||
| @RequestMapping("role") | |||
| @@ -22,21 +23,21 @@ import com.simple.service.SysRoleService; | |||
| public class RoleController { | |||
| @Autowired | |||
| private SysRoleService sysRoleService; | |||
| private MallRoleService sysRoleService; | |||
| @Autowired | |||
| private SysRolePermissionService SysRolePermissionService; | |||
| private MallUserRolePermissionService SysRolePermissionService; | |||
| private Logger logger = Logger.getLogger(RoleController.class); | |||
| @GetMapping("list") | |||
| public ResultData list(SysRole sysRole,Integer pageNum, Integer pageSize) { | |||
| final PageInfo<SysRole> page = sysRoleService.listAsPage(sysRole, pageNum, pageSize); | |||
| public ResultData list(MallRole sysRole, Integer pageNum, Integer pageSize) { | |||
| final PageInfo<MallRole> page = sysRoleService.listAsPage(sysRole, pageNum, pageSize); | |||
| return new ResultData(page); | |||
| } | |||
| @PostMapping("add") | |||
| public ResultData add(SysRole sysRole) { | |||
| public ResultData add(MallRole sysRole) { | |||
| Assert.notNull(sysRole.getName(), "角色名不能为空"); | |||
| Assert.isTrue(!checkUnique(sysRole.getName(), null), "重复的角色名"); | |||
| sysRoleService.saveOrUpdate(sysRole); | |||
| @@ -44,7 +45,7 @@ public class RoleController { | |||
| } | |||
| @PostMapping("update") | |||
| public ResultData update(SysRole sysRole) { | |||
| public ResultData update(MallRole sysRole) { | |||
| if (sysRole.getName() != null) { | |||
| System.out.println(checkUnique(sysRole.getName(), sysRole.getId())); | |||
| Assert.isTrue(!checkUnique(sysRole.getName(), sysRole.getId()), "角色名已存在"); | |||
| @@ -55,21 +56,22 @@ public class RoleController { | |||
| } | |||
| @GetMapping("/del") | |||
| public ResultData delete(String id) { | |||
| public ResultData delete(Long id) { | |||
| sysRoleService.deleteById(id); | |||
| return new ResultData(Result.SUCCESS, "删除成功", null); | |||
| } | |||
| @GetMapping("setPermission") | |||
| public ResultData setPermission(String roleId, String perId) { | |||
| public ResultData setPermission(Long roleId, String perId) { | |||
| Assert.notNull(perId,"请选择权限"); | |||
| String[] perIds = perId.split(","); | |||
| SysRolePermissionService.savePermissions(roleId, perIds); | |||
| /*String[] perIds = perId.split(","); | |||
| SysRolePermissionService.savePermissions(roleId, perIds);*/ | |||
| //TODO | |||
| return new ResultData(Result.SUCCESS, "设置角色权限成功", null); | |||
| } | |||
| private boolean checkUnique(String name, String id) { | |||
| private boolean checkUnique(String name, Long id) { | |||
| return sysRoleService.countByName(name, id) > 0 ? true : false; | |||
| } | |||
| @@ -10,8 +10,8 @@ import org.springframework.web.bind.annotation.RestController; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.simple.common.Result; | |||
| import com.simple.common.ResultData; | |||
| import com.simple.domain.po.SysPermission; | |||
| import com.simple.service.SysPermissionService; | |||
| import com.simple.domain.po.MallPermission; | |||
| import com.simple.service.MallPermissionService; | |||
| /** | |||
| * @author chenkx | |||
| @@ -22,32 +22,32 @@ import com.simple.service.SysPermissionService; | |||
| public class SysPermissionController { | |||
| @Autowired | |||
| SysPermissionService sysPermissionService; | |||
| MallPermissionService mallPermissionService; | |||
| @GetMapping("alllist") | |||
| public ResultData alllist(String ava) { | |||
| SysPermission record = new SysPermission(); | |||
| MallPermission record = new MallPermission(); | |||
| record.setAvailable(ava); | |||
| PageInfo<SysPermission> permissions= sysPermissionService.listAsPage(record, 1, 10000); | |||
| PageInfo<MallPermission> permissions= mallPermissionService.listAsPage(record, 1, 10000); | |||
| return new ResultData(Result.SUCCESS, "查询成功", permissions.getList()); | |||
| } | |||
| @PostMapping("add") | |||
| public ResultData createPermission(SysPermission sysPermission) { | |||
| Assert.notNull(sysPermission.getName(), "用户名不能为空"); | |||
| sysPermissionService.saveOrUpdate(sysPermission); | |||
| return new ResultData(sysPermission.getId()); | |||
| public ResultData createPermission(MallPermission mallPermission) { | |||
| Assert.notNull(mallPermission.getName(), "用户名不能为空"); | |||
| mallPermissionService.saveOrUpdate(mallPermission); | |||
| return new ResultData(mallPermission.getId()); | |||
| } | |||
| @PostMapping("update") | |||
| public ResultData updatePermission(SysPermission sysPermission) { | |||
| sysPermissionService.saveOrUpdate(sysPermission); | |||
| public ResultData updatePermission(MallPermission sysPermission) { | |||
| mallPermissionService.saveOrUpdate(sysPermission); | |||
| return new ResultData(); | |||
| } | |||
| @GetMapping("/del") | |||
| public ResultData delete(String id) { | |||
| sysPermissionService.deleteById(id); | |||
| public ResultData delete(Long id) { | |||
| mallPermissionService.deleteById(id); | |||
| return new ResultData(Result.SUCCESS, "删除成功", null); | |||
| } | |||
| @@ -5,6 +5,10 @@ import java.util.HashMap; | |||
| import java.util.List; | |||
| import java.util.Map; | |||
| import com.simple.domain.po.MallUserInfo; | |||
| import com.simple.domain.po.MallUserRole; | |||
| import com.simple.service.MallUserInfoService; | |||
| import com.simple.service.MallUserRoleService; | |||
| import org.apache.shiro.SecurityUtils; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.util.Assert; | |||
| @@ -15,10 +19,6 @@ import org.springframework.web.bind.annotation.RestController; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.simple.common.ResultData; | |||
| import com.simple.domain.po.SysUserRole; | |||
| import com.simple.domain.po.UserInfo; | |||
| import com.simple.service.SysUserRoleService; | |||
| import com.simple.service.UserInfoService; | |||
| import com.simple.shiro.PasswordHelper; | |||
| import com.simple.shiro.UserSession; | |||
| @@ -35,28 +35,28 @@ import io.swagger.annotations.ApiOperation; | |||
| public class UserInfoController { | |||
| @Autowired | |||
| UserInfoService userInfoService; | |||
| MallUserInfoService userInfoService; | |||
| @Autowired | |||
| SysUserRoleService userRoleService; | |||
| MallUserRoleService userRoleService; | |||
| @ApiOperation(value = "用户分页接口", response = String.class) | |||
| @GetMapping("lists") | |||
| public ResultData listAsPage(UserInfo userInfo, Integer pageNum, Integer pageSize){ | |||
| final PageInfo<UserInfo> page = userInfoService.listAsPage(userInfo, pageNum, pageSize); | |||
| public ResultData listAsPage(MallUserInfo userInfo, Integer pageNum, Integer pageSize){ | |||
| final PageInfo<MallUserInfo> page = userInfoService.listAsPage(userInfo, pageNum, pageSize); | |||
| return new ResultData(page); | |||
| } | |||
| @ApiOperation(value = "用户详情接口", response = String.class) | |||
| @GetMapping("detail") | |||
| public ResultData detail(String id){ | |||
| final UserInfo user = userInfoService.getById(id); | |||
| public ResultData detail(Long id){ | |||
| final MallUserInfo user = userInfoService.getById(id); | |||
| return new ResultData(user); | |||
| } | |||
| @ApiOperation(value = "创建用户接口", response = String.class) | |||
| @PostMapping("add") | |||
| public ResultData createUser(UserInfo userInfo){ | |||
| public ResultData createUser(MallUserInfo userInfo){ | |||
| Assert.notNull(userInfo.getUsername(), "用户名不能为空"); | |||
| Assert.isTrue(checkUnique(userInfo.getUsername(), 0), "重复的用户名"); | |||
| Assert.notNull(userInfo.getPassword(), "密码不能为空"); | |||
| @@ -68,7 +68,7 @@ public class UserInfoController { | |||
| @ApiOperation(value = "修改用户接口", response = String.class) | |||
| @PostMapping("update") | |||
| public ResultData updateUser(UserInfo userInfo){ | |||
| public ResultData updateUser(MallUserInfo userInfo){ | |||
| Assert.notNull(userInfo.getUsername(), "用户名不能为空"); | |||
| Assert.isTrue(checkUnique(userInfo.getUsername(), 1), "重复的用户名"); | |||
| Assert.notNull(userInfo.getPassword(), "密码不能为空"); | |||
| @@ -80,8 +80,8 @@ public class UserInfoController { | |||
| @ApiOperation(value = "删除用户接口", response = String.class) | |||
| @GetMapping("/del") | |||
| public ResultData deleteUser(String id) { | |||
| userInfoService.deleteUser(id); | |||
| public ResultData deleteUser(Long id) { | |||
| userInfoService.deleteById(id); | |||
| return new ResultData(); | |||
| } | |||
| @@ -93,8 +93,8 @@ public class UserInfoController { | |||
| */ | |||
| @ApiOperation(value = "起停用户接口", response = String.class) | |||
| @GetMapping("status") | |||
| public ResultData modifyStatus(String userId, Integer status) { | |||
| UserInfo userInfo = userInfoService.getById(userId); | |||
| public ResultData modifyStatus(Long userId, Integer status) { | |||
| MallUserInfo userInfo = userInfoService.getById(userId); | |||
| userInfo.setStatus(status); | |||
| userInfoService.saveOrUpdate(userInfo); | |||
| return new ResultData(userInfo); | |||
| @@ -102,16 +102,16 @@ public class UserInfoController { | |||
| @ApiOperation(value = "用户添加角色接口", response = String.class) | |||
| @PostMapping("setRoles") | |||
| public ResultData setRoles(String userId,String roleIds) { | |||
| String[] roIds = roleIds.split(","); | |||
| List<SysUserRole> u2rs = new ArrayList<>(roIds.length); | |||
| public ResultData setRoles(Long userId,String roleIds) { | |||
| /*String[] roIds = roleIds.split(","); | |||
| List<MallUserRole> u2rs = new ArrayList<>(roIds.length); | |||
| for (String roleId : roIds) { | |||
| SysUserRole userRole = new SysUserRole(); | |||
| MallUserRole userRole = new MallUserRole(); | |||
| userRole.setRoleId(roleId); | |||
| userRole.setUid(userId); | |||
| u2rs.add(userRole); | |||
| } | |||
| userRoleService.batchInsert(u2rs); | |||
| userRoleService.batchInsert(u2rs);*/ | |||
| return new ResultData(); | |||
| } | |||
| @@ -134,7 +134,7 @@ public class UserInfoController { | |||
| public ResultData hasButtonPermission(String permissions){ | |||
| Map<String,Boolean> map=new HashMap<>(); | |||
| for(String name:permissions.split(",")){ | |||
| String userId = (String) | |||
| Long userId = (Long) | |||
| SecurityUtils.getSubject().getSession().getAttribute(UserSession.userId); | |||
| boolean has =userInfoService.hasButtonPermission(userId, name); | |||
| map.put(name, has); | |||
| @@ -151,7 +151,7 @@ public class UserInfoController { | |||
| @GetMapping("getUser") | |||
| public ResultData getUserInfo(){ | |||
| UserInfo info =(UserInfo) SecurityUtils.getSubject().getSession().getAttribute(UserSession.userInfo); | |||
| MallUserInfo info =(MallUserInfo) SecurityUtils.getSubject().getSession().getAttribute(UserSession.userInfo); | |||
| ResultData data = new ResultData(); | |||
| data.data=info; | |||
| return data; | |||
| @@ -11,15 +11,12 @@ import com.simple.common.ResultData; | |||
| import com.simple.domain.po.WxCoupon; | |||
| import com.simple.service.WxCouponService; | |||
| import io.swagger.annotations.Api; | |||
| import io.swagger.annotations.ApiImplicitParam; | |||
| import io.swagger.annotations.ApiImplicitParams; | |||
| import io.swagger.annotations.ApiOperation; | |||
| @RestController | |||
| @RequestMapping("wxCoupon") | |||
| @Api(description="优惠券相关接口") | |||
| public class WxCouponController extends BaseController | |||
| { | |||
| @Autowired | |||
| @@ -0,0 +1,71 @@ | |||
| package com.simple.controller; | |||
| import org.apache.log4j.Logger; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.util.Assert; | |||
| import org.springframework.web.bind.annotation.*; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.simple.common.Result; | |||
| import com.simple.common.ResultData; | |||
| import com.simple.domain.po.WxCouponSend; | |||
| import com.simple.service.WxCouponSendService; | |||
| import io.swagger.annotations.ApiImplicitParam; | |||
| import io.swagger.annotations.ApiImplicitParams; | |||
| import io.swagger.annotations.ApiOperation; | |||
| @RestController | |||
| @RequestMapping("wxCouponSend") | |||
| public class WxCouponSendController extends BaseController | |||
| { | |||
| @Autowired | |||
| private WxCouponSendService wxCouponSendService; | |||
| private Logger logger = Logger.getLogger(WxCouponSendController.class); | |||
| @ApiOperation("分页列表接口") | |||
| @GetMapping("list") | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name="pageNum",value="页数",dataType="int", paramType = "query",required=true), | |||
| @ApiImplicitParam(name="pageSize",value="每页条数",dataType="int", paramType = "query",required=true)}) | |||
| public ResultData list(@ModelAttribute WxCouponSend wxCouponSend,Integer pageNum, Integer pageSize) { | |||
| if (null == wxCouponSend) wxCouponSend = new WxCouponSend(); | |||
| final PageInfo<WxCouponSend> page = wxCouponSendService.listAsPage(wxCouponSend, pageNum, pageSize); | |||
| return new ResultData(page); | |||
| } | |||
| @ApiOperation("新增接口") | |||
| @PostMapping("add") | |||
| public ResultData add(@RequestBody WxCouponSend wxCouponSend) { | |||
| //Assert.notNull(wxCouponSend.getName(), "角色名不能为空"); | |||
| //Assert.isTrue(!checkUnique(sysRole.getName(), null), "重复的角色名"); | |||
| wxCouponSendService.saveOrUpdate(wxCouponSend); | |||
| return new ResultData(); | |||
| } | |||
| @ApiOperation("根据id更新接口") | |||
| @PostMapping("update") | |||
| public ResultData update(@RequestBody WxCouponSend wxCouponSend) { | |||
| wxCouponSendService.saveOrUpdate(wxCouponSend); | |||
| return new ResultData(); | |||
| } | |||
| @ApiOperation("根据id删除接口") | |||
| @GetMapping("/del") | |||
| @ApiImplicitParam(name="id",value="id",dataType="Long", paramType = "query",required=true) | |||
| public ResultData delete(Long id) { | |||
| wxCouponSendService.deleteById(id); | |||
| return new ResultData(Result.SUCCESS, "删除成功", null); | |||
| } | |||
| @ApiOperation("根据id查询接口") | |||
| @GetMapping("/findById") | |||
| @ApiImplicitParam(name="id",value="id",dataType="Long", paramType = "query",required=true) | |||
| public ResultData findById(Long id) { | |||
| return new ResultData(Result.SUCCESS,"查询成功",wxCouponSendService.getById(id)); | |||
| } | |||
| } | |||
| @@ -0,0 +1,71 @@ | |||
| package com.simple.controller; | |||
| import org.apache.log4j.Logger; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.util.Assert; | |||
| import org.springframework.web.bind.annotation.*; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.simple.common.Result; | |||
| import com.simple.common.ResultData; | |||
| import com.simple.domain.po.WxCouponTarget; | |||
| import com.simple.service.WxCouponTargetService; | |||
| import io.swagger.annotations.ApiImplicitParam; | |||
| import io.swagger.annotations.ApiImplicitParams; | |||
| import io.swagger.annotations.ApiOperation; | |||
| @RestController | |||
| @RequestMapping("wxCouponTarget") | |||
| public class WxCouponTargetController extends BaseController | |||
| { | |||
| @Autowired | |||
| private WxCouponTargetService wxCouponTargetService; | |||
| private Logger logger = Logger.getLogger(WxCouponTargetController.class); | |||
| @ApiOperation("分页列表接口") | |||
| @GetMapping("list") | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name="pageNum",value="页数",dataType="int", paramType = "query",required=true), | |||
| @ApiImplicitParam(name="pageSize",value="每页条数",dataType="int", paramType = "query",required=true)}) | |||
| public ResultData list(@ModelAttribute WxCouponTarget wxCouponTarget,Integer pageNum, Integer pageSize) { | |||
| if (null == wxCouponTarget) wxCouponTarget = new WxCouponTarget(); | |||
| final PageInfo<WxCouponTarget> page = wxCouponTargetService.listAsPage(wxCouponTarget, pageNum, pageSize); | |||
| return new ResultData(page); | |||
| } | |||
| @ApiOperation("新增接口") | |||
| @PostMapping("add") | |||
| public ResultData add(@RequestBody WxCouponTarget wxCouponTarget) { | |||
| //Assert.notNull(wxCouponTarget.getName(), "角色名不能为空"); | |||
| //Assert.isTrue(!checkUnique(sysRole.getName(), null), "重复的角色名"); | |||
| wxCouponTargetService.saveOrUpdate(wxCouponTarget); | |||
| return new ResultData(); | |||
| } | |||
| @ApiOperation("根据id更新接口") | |||
| @PostMapping("update") | |||
| public ResultData update(@RequestBody WxCouponTarget wxCouponTarget) { | |||
| wxCouponTargetService.saveOrUpdate(wxCouponTarget); | |||
| return new ResultData(); | |||
| } | |||
| @ApiOperation("根据id删除接口") | |||
| @GetMapping("/del") | |||
| @ApiImplicitParam(name="id",value="id",dataType="Long", paramType = "query",required=true) | |||
| public ResultData delete(Long id) { | |||
| wxCouponTargetService.deleteById(id); | |||
| return new ResultData(Result.SUCCESS, "删除成功", null); | |||
| } | |||
| @ApiOperation("根据id查询接口") | |||
| @GetMapping("/findById") | |||
| @ApiImplicitParam(name="id",value="id",dataType="Long", paramType = "query",required=true) | |||
| public ResultData findById(Long id) { | |||
| return new ResultData(Result.SUCCESS,"查询成功",wxCouponTargetService.getById(id)); | |||
| } | |||
| } | |||
| @@ -2,6 +2,7 @@ package com.simple.shiro; | |||
| import javax.annotation.Resource; | |||
| import com.simple.service.MallUserInfoService; | |||
| import org.apache.shiro.SecurityUtils; | |||
| import org.apache.shiro.authc.AuthenticationException; | |||
| import org.apache.shiro.authc.AuthenticationInfo; | |||
| @@ -15,9 +16,9 @@ import org.apache.shiro.session.Session; | |||
| import org.apache.shiro.subject.PrincipalCollection; | |||
| import org.apache.shiro.util.ByteSource; | |||
| import com.simple.domain.po.UserInfo; | |||
| import com.simple.service.SysPermissionService; | |||
| import com.simple.service.UserInfoService; | |||
| import com.simple.domain.po.MallUserInfo; | |||
| import com.simple.service.MallPermissionService; | |||
| import com.simple.service.MallUserInfoService; | |||
| /** | |||
| * Created by yangqj on 2017/4/21. | |||
| @@ -25,15 +26,15 @@ import com.simple.service.UserInfoService; | |||
| public class MyShiroRealm extends AuthorizingRealm { | |||
| @Resource | |||
| private UserInfoService userService; | |||
| private MallUserInfoService userService; | |||
| @Resource | |||
| private SysPermissionService resourcesService; | |||
| private MallPermissionService resourcesService; | |||
| //授权 | |||
| @Override | |||
| protected AuthorizationInfo doGetAuthorizationInfo(PrincipalCollection principalCollection) { | |||
| UserInfo user= (UserInfo) SecurityUtils.getSubject().getPrincipal();//User{id=1, username='admin', password='3ef7164d1f6167cb9f2658c07d3c2f0a', enable=1} | |||
| MallUserInfo user= (MallUserInfo) SecurityUtils.getSubject().getPrincipal();//User{id=1, username='admin', password='3ef7164d1f6167cb9f2658c07d3c2f0a', enable=1} | |||
| // Map<String,Object> map = new HashMap<String,Object>(); | |||
| // map.put("userid",user.getId()); | |||
| // List<SysPermission> resourcesList = resourcesService.list(map); | |||
| @@ -50,7 +51,7 @@ public class MyShiroRealm extends AuthorizingRealm { | |||
| protected AuthenticationInfo doGetAuthenticationInfo(AuthenticationToken token) throws AuthenticationException { | |||
| //获取用户的输入的账号. | |||
| String username = (String)token.getPrincipal(); | |||
| UserInfo user = userService.getByUsername(username); | |||
| MallUserInfo user = userService.getByUsername(username); | |||
| if(user==null) throw new UnknownAccountException("用户名不存在"); | |||
| // if (0==user.getEnable()) { | |||
| // throw new LockedAccountException(); // 帐号锁定 | |||
| @@ -1,17 +1,18 @@ | |||
| package com.simple.shiro; | |||
| import com.simple.domain.po.MallUserInfo; | |||
| import org.apache.shiro.crypto.hash.SimpleHash; | |||
| import org.apache.shiro.util.ByteSource; | |||
| import com.simple.domain.po.UserInfo; | |||
| public class PasswordHelper { | |||
| //private RandomNumberGenerator randomNumberGenerator = new SecureRandomNumberGenerator(); | |||
| private String algorithmName = "md5"; | |||
| private int hashIterations = 2; | |||
| public void encryptPassword(UserInfo user) { | |||
| public void encryptPassword(MallUserInfo user) { | |||
| //String salt=randomNumberGenerator.nextBytes().toHex(); | |||
| String newPassword = new SimpleHash(algorithmName, user.getPassword(), ByteSource.Util.bytes(user.getUsername()), hashIterations).toHex(); | |||
| //String newPassword = new SimpleHash(algorithmName, user.getPassword()).toHex(); | |||
| @@ -14,8 +14,8 @@ import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.stereotype.Service; | |||
| import com.github.pagehelper.util.StringUtil; | |||
| import com.simple.domain.po.SysPermission; | |||
| import com.simple.service.SysPermissionService; | |||
| import com.simple.domain.po.MallPermission; | |||
| import com.simple.service.MallPermissionService; | |||
| /** | |||
| * Created by yangqj on 2017/4/30. | |||
| @@ -25,7 +25,7 @@ public class ShiroService { | |||
| @Autowired | |||
| private ShiroFilterFactoryBean shiroFilterFactoryBean; | |||
| @Autowired | |||
| private SysPermissionService resourcesService; | |||
| private MallPermissionService resourcesService; | |||
| @Autowired | |||
| private RedisSessionDAO redisSessionDAO; | |||
| /** | |||
| @@ -1,31 +1,32 @@ | |||
| package com.simple.domain.po; | |||
| import javax.persistence.*; | |||
| import java.util.*; | |||
| import java.io.Serializable; | |||
| import java.math.*; | |||
| import javax.persistence.Id; | |||
| import javax.persistence.Table; | |||
| import javax.persistence.Transient; | |||
| import java.io.Serializable; | |||
| import java.util.ArrayList; | |||
| import java.util.List; | |||
| import javax.persistence.Id; | |||
| @Table(name = "sys_permission") | |||
| public class SysPermission implements Serializable{ | |||
| @Table(name = "mall_permission") | |||
| public class MallPermission implements Serializable { | |||
| private static final long serialVersionUID = 1L; | |||
| @Id | |||
| protected String id; | |||
| protected Long id; | |||
| @Transient | |||
| protected List<String> ids; | |||
| @Transient | |||
| protected String sortColumns; | |||
| public String getId() { | |||
| public Long getId() { | |||
| return id; | |||
| } | |||
| public void setId(String id) { | |||
| public void setId(Long id) { | |||
| this.id = id; | |||
| } | |||
| public String getSortColumns() { | |||
| return sortColumns; | |||
| } | |||
| @@ -39,6 +40,9 @@ public class SysPermission implements Serializable{ | |||
| /*租户ID**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="租户ID",name="tenantId") | |||
| private String tenantId; | |||
| /*权限名称[LIKE]**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="权限名称[LIKE]",name="name") | |||
| private String name; | |||
| @@ -79,6 +83,12 @@ public class SysPermission implements Serializable{ | |||
| private Integer sortLte; | |||
| @Transient | |||
| private Integer sortLt; | |||
| public String getTenantId() { | |||
| return tenantId; | |||
| } | |||
| public void setTenantId(String _tenantId) { | |||
| tenantId = _tenantId; | |||
| } | |||
| public String getName() { | |||
| return name; | |||
| } | |||
| @@ -181,6 +191,7 @@ public class SysPermission implements Serializable{ | |||
| public static enum Field | |||
| { | |||
| Id_ASC("`id` ASC"),Id_DESC("`id` DESC") | |||
| ,TenantId_ASC("`tenantId` ASC"),TenantId_DESC("`tenantId` DESC") | |||
| ,Name_ASC("`name` ASC"),Name_DESC("`name` DESC") | |||
| ,Available_ASC("`available` ASC"),Available_DESC("`available` DESC") | |||
| ,ParentId_ASC("`parentId` ASC"),ParentId_DESC("`parentId` DESC") | |||
| @@ -206,7 +217,7 @@ public class SysPermission implements Serializable{ | |||
| } | |||
| } | |||
| public void setSortColumns(SysPermission.Field... fields) | |||
| public void setSortColumns(MallPermission.Field... fields) | |||
| { | |||
| if (fields == null || fields.length == 0) { | |||
| return; | |||
| @@ -221,9 +232,9 @@ public class SysPermission implements Serializable{ | |||
| sb.append(","); | |||
| sb.append(fields[k].toString()); | |||
| } | |||
| } | |||
| public void setSortColumns(String sortColumns) | |||
| { | |||
| if (sortColumns == null || "".equals(sortColumns.trim())) { | |||
| @@ -231,7 +242,7 @@ public class SysPermission implements Serializable{ | |||
| } | |||
| if (sortColumns.contains(",")) { | |||
| String[] cols = sortColumns.split(","); | |||
| java.util.List<Field> fList = new java.util.ArrayList(); | |||
| List<Field> fList = new ArrayList(); | |||
| for (int k = 0; k < cols.length; k++) { | |||
| fList.add(Field.valueOf(cols[k])); | |||
| } | |||
| @@ -1,31 +1,32 @@ | |||
| package com.simple.domain.po; | |||
| import javax.persistence.*; | |||
| import java.util.*; | |||
| import java.io.Serializable; | |||
| import java.math.*; | |||
| import javax.persistence.Id; | |||
| import javax.persistence.Table; | |||
| import javax.persistence.Transient; | |||
| import java.io.Serializable; | |||
| import java.util.ArrayList; | |||
| import java.util.List; | |||
| import javax.persistence.Id; | |||
| @Table(name = "sys_role") | |||
| public class SysRole implements Serializable{ | |||
| @Table(name = "mall_role") | |||
| public class MallRole implements Serializable { | |||
| private static final long serialVersionUID = 1L; | |||
| @Id | |||
| protected String id; | |||
| protected Long id; | |||
| @Transient | |||
| protected List<String> ids; | |||
| @Transient | |||
| protected String sortColumns; | |||
| public String getId() { | |||
| public Long getId() { | |||
| return id; | |||
| } | |||
| public void setId(String id) { | |||
| public void setId(Long id) { | |||
| this.id = id; | |||
| } | |||
| public String getSortColumns() { | |||
| return sortColumns; | |||
| } | |||
| @@ -39,6 +40,9 @@ public class SysRole implements Serializable{ | |||
| /*租户ID**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="租户ID",name="tenantId") | |||
| private String tenantId; | |||
| /*角色名称**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="角色名称",name="name") | |||
| private String name; | |||
| @@ -48,6 +52,12 @@ public class SysRole implements Serializable{ | |||
| /*角色描述**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="角色描述",name="description") | |||
| private String description; | |||
| public String getTenantId() { | |||
| return tenantId; | |||
| } | |||
| public void setTenantId(String _tenantId) { | |||
| tenantId = _tenantId; | |||
| } | |||
| public String getName() { | |||
| return name; | |||
| } | |||
| @@ -72,6 +82,7 @@ public class SysRole implements Serializable{ | |||
| public static enum Field | |||
| { | |||
| Id_ASC("`id` ASC"),Id_DESC("`id` DESC") | |||
| ,TenantId_ASC("`tenantId` ASC"),TenantId_DESC("`tenantId` DESC") | |||
| ,Name_ASC("`name` ASC"),Name_DESC("`name` DESC") | |||
| ,Available_ASC("`available` ASC"),Available_DESC("`available` DESC") | |||
| ,Description_ASC("`description` ASC"),Description_DESC("`description` DESC") | |||
| @@ -92,7 +103,7 @@ public class SysRole implements Serializable{ | |||
| } | |||
| } | |||
| public void setSortColumns(SysRole.Field... fields) | |||
| public void setSortColumns(MallRole.Field... fields) | |||
| { | |||
| if (fields == null || fields.length == 0) { | |||
| return; | |||
| @@ -107,9 +118,9 @@ public class SysRole implements Serializable{ | |||
| sb.append(","); | |||
| sb.append(fields[k].toString()); | |||
| } | |||
| } | |||
| public void setSortColumns(String sortColumns) | |||
| { | |||
| if (sortColumns == null || "".equals(sortColumns.trim())) { | |||
| @@ -117,7 +128,7 @@ public class SysRole implements Serializable{ | |||
| } | |||
| if (sortColumns.contains(",")) { | |||
| String[] cols = sortColumns.split(","); | |||
| java.util.List<Field> fList = new java.util.ArrayList(); | |||
| List<Field> fList = new ArrayList(); | |||
| for (int k = 0; k < cols.length; k++) { | |||
| fList.add(Field.valueOf(cols[k])); | |||
| } | |||
| @@ -1,31 +1,33 @@ | |||
| package com.simple.domain.po; | |||
| import java.io.Serializable; | |||
| import java.util.Date; | |||
| import java.util.List; | |||
| import javax.persistence.Id; | |||
| import javax.persistence.Table; | |||
| import javax.persistence.Transient; | |||
| import java.io.Serializable; | |||
| import java.util.ArrayList; | |||
| import java.util.Date; | |||
| import java.util.List; | |||
| @Table(name = "user_info") | |||
| public class UserInfo implements Serializable{ | |||
| @Table(name = "mall_user_info") | |||
| public class MallUserInfo implements Serializable { | |||
| private static final long serialVersionUID = 1L; | |||
| @Id | |||
| protected String id; | |||
| protected Long id; | |||
| @Transient | |||
| protected List<String> ids; | |||
| @Transient | |||
| protected String sortColumns; | |||
| public String getId() { | |||
| public Long getId() { | |||
| return id; | |||
| } | |||
| public void setId(String id) { | |||
| public void setId(Long id) { | |||
| this.id = id; | |||
| } | |||
| public String getSortColumns() { | |||
| return sortColumns; | |||
| } | |||
| @@ -39,6 +41,9 @@ public class UserInfo implements Serializable{ | |||
| /*租户ID**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="租户ID",name="tenantId") | |||
| private String tenantId; | |||
| /*登录用户名**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="登录用户名",name="username") | |||
| private String username; | |||
| @@ -62,10 +67,16 @@ public class UserInfo implements Serializable{ | |||
| private Integer isAdmin; | |||
| //该用户所有的角色 | |||
| @Transient | |||
| private List<SysRole> role; | |||
| private List<MallRole> role; | |||
| //该用户包含的所有权限 | |||
| @Transient | |||
| private List<SysPermission> permission; | |||
| private List<MallPermission> permission; | |||
| public String getTenantId() { | |||
| return tenantId; | |||
| } | |||
| public void setTenantId(String _tenantId) { | |||
| tenantId = _tenantId; | |||
| } | |||
| public String getUsername() { | |||
| return username; | |||
| } | |||
| @@ -108,19 +119,19 @@ public class UserInfo implements Serializable{ | |||
| public void setIsAdmin(Integer _isAdmin) { | |||
| isAdmin = _isAdmin; | |||
| } | |||
| public List<SysRole> getRole() { | |||
| public List<MallRole> getRole() { | |||
| return role; | |||
| } | |||
| public void setRole(List<SysRole> role) { | |||
| public void setRole(List<MallRole> role) { | |||
| this.role = role; | |||
| } | |||
| public List<SysPermission> getPermission() { | |||
| public List<MallPermission> getPermission() { | |||
| return permission; | |||
| } | |||
| public void setPermission(List<SysPermission> permission) { | |||
| public void setPermission(List<MallPermission> permission) { | |||
| this.permission = permission; | |||
| } | |||
| @@ -129,6 +140,7 @@ public class UserInfo implements Serializable{ | |||
| public static enum Field | |||
| { | |||
| Id_ASC("`id` ASC"),Id_DESC("`id` DESC") | |||
| ,TenantId_ASC("`tenantId` ASC"),TenantId_DESC("`tenantId` DESC") | |||
| ,Username_ASC("`username` ASC"),Username_DESC("`username` DESC") | |||
| ,Name_ASC("`name` ASC"),Name_DESC("`name` DESC") | |||
| ,Password_ASC("`password` ASC"),Password_DESC("`password` DESC") | |||
| @@ -153,7 +165,7 @@ public class UserInfo implements Serializable{ | |||
| } | |||
| } | |||
| public void setSortColumns(UserInfo.Field... fields) | |||
| public void setSortColumns(MallUserInfo.Field... fields) | |||
| { | |||
| if (fields == null || fields.length == 0) { | |||
| return; | |||
| @@ -168,9 +180,9 @@ public class UserInfo implements Serializable{ | |||
| sb.append(","); | |||
| sb.append(fields[k].toString()); | |||
| } | |||
| } | |||
| public void setSortColumns(String sortColumns) | |||
| { | |||
| if (sortColumns == null || "".equals(sortColumns.trim())) { | |||
| @@ -178,7 +190,7 @@ public class UserInfo implements Serializable{ | |||
| } | |||
| if (sortColumns.contains(",")) { | |||
| String[] cols = sortColumns.split(","); | |||
| java.util.List<Field> fList = new java.util.ArrayList(); | |||
| List<Field> fList = new ArrayList(); | |||
| for (int k = 0; k < cols.length; k++) { | |||
| fList.add(Field.valueOf(cols[k])); | |||
| } | |||
| @@ -1,31 +1,32 @@ | |||
| package com.simple.domain.po; | |||
| import javax.persistence.*; | |||
| import java.util.*; | |||
| import java.io.Serializable; | |||
| import java.math.*; | |||
| import javax.persistence.Id; | |||
| import javax.persistence.Table; | |||
| import javax.persistence.Transient; | |||
| import java.io.Serializable; | |||
| import java.util.ArrayList; | |||
| import java.util.List; | |||
| import javax.persistence.Id; | |||
| @Table(name = "sys_user_role") | |||
| public class SysUserRole implements Serializable{ | |||
| @Table(name = "mall_user_role") | |||
| public class MallUserRole implements Serializable { | |||
| private static final long serialVersionUID = 1L; | |||
| @Id | |||
| protected String id; | |||
| protected Long id; | |||
| @Transient | |||
| protected List<String> ids; | |||
| @Transient | |||
| protected String sortColumns; | |||
| public String getId() { | |||
| public Long getId() { | |||
| return id; | |||
| } | |||
| public void setId(String id) { | |||
| public void setId(Long id) { | |||
| this.id = id; | |||
| } | |||
| public String getSortColumns() { | |||
| return sortColumns; | |||
| } | |||
| @@ -41,20 +42,20 @@ public class SysUserRole implements Serializable{ | |||
| /*用户ID**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="用户ID",name="uid") | |||
| private String uid; | |||
| private Long uid; | |||
| /*角色ID**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="角色ID",name="roleId") | |||
| private String roleId; | |||
| public String getUid() { | |||
| private Long roleId; | |||
| public Long getUid() { | |||
| return uid; | |||
| } | |||
| public void setUid(String _uid) { | |||
| public void setUid(Long _uid) { | |||
| uid = _uid; | |||
| } | |||
| public String getRoleId() { | |||
| public Long getRoleId() { | |||
| return roleId; | |||
| } | |||
| public void setRoleId(String _roleId) { | |||
| public void setRoleId(Long _roleId) { | |||
| roleId = _roleId; | |||
| } | |||
| @@ -82,7 +83,7 @@ public class SysUserRole implements Serializable{ | |||
| } | |||
| } | |||
| public void setSortColumns(SysUserRole.Field... fields) | |||
| public void setSortColumns(MallUserRole.Field... fields) | |||
| { | |||
| if (fields == null || fields.length == 0) { | |||
| return; | |||
| @@ -97,9 +98,9 @@ public class SysUserRole implements Serializable{ | |||
| sb.append(","); | |||
| sb.append(fields[k].toString()); | |||
| } | |||
| } | |||
| public void setSortColumns(String sortColumns) | |||
| { | |||
| if (sortColumns == null || "".equals(sortColumns.trim())) { | |||
| @@ -107,7 +108,7 @@ public class SysUserRole implements Serializable{ | |||
| } | |||
| if (sortColumns.contains(",")) { | |||
| String[] cols = sortColumns.split(","); | |||
| java.util.List<Field> fList = new java.util.ArrayList(); | |||
| List<Field> fList = new ArrayList(); | |||
| for (int k = 0; k < cols.length; k++) { | |||
| fList.add(Field.valueOf(cols[k])); | |||
| } | |||
| @@ -1,31 +1,32 @@ | |||
| package com.simple.domain.po; | |||
| import javax.persistence.*; | |||
| import java.util.*; | |||
| import java.io.Serializable; | |||
| import java.math.*; | |||
| import javax.persistence.Id; | |||
| import javax.persistence.Table; | |||
| import javax.persistence.Transient; | |||
| import java.io.Serializable; | |||
| import java.util.ArrayList; | |||
| import java.util.List; | |||
| import javax.persistence.Id; | |||
| @Table(name = "sys_role_permission") | |||
| public class SysRolePermission implements Serializable{ | |||
| @Table(name = "mall_user_role_permission") | |||
| public class MallUserRolePermission implements Serializable { | |||
| private static final long serialVersionUID = 1L; | |||
| @Id | |||
| protected String id; | |||
| protected Long id; | |||
| @Transient | |||
| protected List<String> ids; | |||
| @Transient | |||
| protected String sortColumns; | |||
| public String getId() { | |||
| public Long getId() { | |||
| return id; | |||
| } | |||
| public void setId(String id) { | |||
| public void setId(Long id) { | |||
| this.id = id; | |||
| } | |||
| public String getSortColumns() { | |||
| return sortColumns; | |||
| } | |||
| @@ -39,22 +40,31 @@ public class SysRolePermission implements Serializable{ | |||
| /*租户ID**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="租户ID",name="tenantId") | |||
| private String tenantId; | |||
| /*权限ID**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="权限ID",name="permissionId") | |||
| private String permissionId; | |||
| private Long permissionId; | |||
| /*角色ID**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="角色ID",name="roleId") | |||
| private String roleId; | |||
| public String getPermissionId() { | |||
| private Long roleId; | |||
| public String getTenantId() { | |||
| return tenantId; | |||
| } | |||
| public void setTenantId(String _tenantId) { | |||
| tenantId = _tenantId; | |||
| } | |||
| public Long getPermissionId() { | |||
| return permissionId; | |||
| } | |||
| public void setPermissionId(String _permissionId) { | |||
| public void setPermissionId(Long _permissionId) { | |||
| permissionId = _permissionId; | |||
| } | |||
| public String getRoleId() { | |||
| public Long getRoleId() { | |||
| return roleId; | |||
| } | |||
| public void setRoleId(String _roleId) { | |||
| public void setRoleId(Long _roleId) { | |||
| roleId = _roleId; | |||
| } | |||
| @@ -62,9 +72,10 @@ public class SysRolePermission implements Serializable{ | |||
| public static enum Field | |||
| { | |||
| PermissionId_ASC("`permissionId` ASC"),PermissionId_DESC("`permissionId` DESC") | |||
| Id_ASC("`id` ASC"),Id_DESC("`id` DESC") | |||
| ,TenantId_ASC("`tenantId` ASC"),TenantId_DESC("`tenantId` DESC") | |||
| ,PermissionId_ASC("`permissionId` ASC"),PermissionId_DESC("`permissionId` DESC") | |||
| ,RoleId_ASC("`roleId` ASC"),RoleId_DESC("`roleId` DESC") | |||
| ,Id_ASC("`id` ASC"),Id_DESC("`id` DESC") | |||
| ; | |||
| private String value; | |||
| Field(String value){ | |||
| @@ -82,7 +93,7 @@ public class SysRolePermission implements Serializable{ | |||
| } | |||
| } | |||
| public void setSortColumns(SysRolePermission.Field... fields) | |||
| public void setSortColumns(MallUserRolePermission.Field... fields) | |||
| { | |||
| if (fields == null || fields.length == 0) { | |||
| return; | |||
| @@ -97,9 +108,9 @@ public class SysRolePermission implements Serializable{ | |||
| sb.append(","); | |||
| sb.append(fields[k].toString()); | |||
| } | |||
| } | |||
| public void setSortColumns(String sortColumns) | |||
| { | |||
| if (sortColumns == null || "".equals(sortColumns.trim())) { | |||
| @@ -107,7 +118,7 @@ public class SysRolePermission implements Serializable{ | |||
| } | |||
| if (sortColumns.contains(",")) { | |||
| String[] cols = sortColumns.split(","); | |||
| java.util.List<Field> fList = new java.util.ArrayList(); | |||
| List<Field> fList = new ArrayList(); | |||
| for (int k = 0; k < cols.length; k++) { | |||
| fList.add(Field.valueOf(cols[k])); | |||
| } | |||
| @@ -44,14 +44,11 @@ public class WxCoupon implements Serializable { | |||
| /*租户ID**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="租户ID",name="tenantId") | |||
| private String tenantId; | |||
| /*卡券活动id**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="卡券活动id",name="activityId") | |||
| private Long activityId; | |||
| /*商户id**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="商户id",name="merchantId") | |||
| private Long merchantId; | |||
| /*券类型**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="券类型",name="type") | |||
| /*券类型(1.满减券,2.代金券,3.团购券,4.礼品券,5.停车券)**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="券类型(1.满减券,2.代金券,3.团购券,4.礼品券,5.停车券)",name="type") | |||
| private Integer type; | |||
| /*封面图**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="封面图",name="coverImg") | |||
| @@ -62,23 +59,53 @@ public class WxCoupon implements Serializable { | |||
| /*副标题**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="副标题",name="subTitle") | |||
| private String subTitle; | |||
| /*售价(适用于类型2,3,4,5)**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="售价(适用于类型2,3,4,5)",name="salePrice") | |||
| private BigDecimal salePrice; | |||
| /*使用条件金额(适用于类型1,2,3,4)**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="使用条件金额(适用于类型1,2,3,4)",name="usePrice") | |||
| private BigDecimal usePrice; | |||
| /*限领张数**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="限领张数",name="useLimitQuantity") | |||
| private Integer useLimitQuantity; | |||
| /*发放开始时间**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="发放开始时间",name="sendStartDate") | |||
| private Date sendStartDate; | |||
| /*发放结束时间**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="发放结束时间",name="sendEndDate") | |||
| private Date sendEndDate; | |||
| /*有效日期-开始**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="有效日期-开始",name="validStartDate") | |||
| private Date validStartDate; | |||
| /*有效日期-结束**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="有效日期-结束",name="validEndDate") | |||
| private Date validEndDate; | |||
| /*自领取之日几日有效,(停车券当天有效)**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="自领取之日几日有效,(停车券当天有效)",name="validDays") | |||
| private Integer validDays; | |||
| /*须知**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="须知",name="detail") | |||
| private String detail; | |||
| /*发券方式(1.主动领取,2.定向投放)**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="发券方式(1.主动领取,2.定向投放)",name="sendType") | |||
| private Integer sendType; | |||
| /*投放频道位置(1.banner图,2.限时抢购)**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="投放频道位置(1.banner图,2.限时抢购)",name="targetAd") | |||
| private Integer targetAd; | |||
| /*业态**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="业态",name="businesses") | |||
| private String businesses; | |||
| /*面额**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="面额",name="price") | |||
| private BigDecimal price; | |||
| /*售价**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="售价",name="salePrice") | |||
| private BigDecimal salePrice; | |||
| /*使用条件金额**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="使用条件金额",name="usePrice") | |||
| private BigDecimal usePrice; | |||
| /*业态**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="业态",name="business") | |||
| private String business; | |||
| /*状态(0.未绑定1.已绑定)**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="状态(0.未绑定1.已绑定)",name="status") | |||
| /*库存**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="库存",name="number") | |||
| private Integer number; | |||
| /*总数**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="总数",name="total") | |||
| private Integer total; | |||
| /*状态(0:草稿,1:待生效,2:已生效,3:已失效,4:已作废)**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="状态(0:草稿,1:待生效,2:已生效,3:已失效,4:已作废)",name="status") | |||
| private Integer status; | |||
| /*创建时间**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="创建时间",name="createDate") | |||
| @@ -92,12 +119,6 @@ public class WxCoupon implements Serializable { | |||
| public void setTenantId(String _tenantId) { | |||
| tenantId = _tenantId; | |||
| } | |||
| public Long getActivityId() { | |||
| return activityId; | |||
| } | |||
| public void setActivityId(Long _activityId) { | |||
| activityId = _activityId; | |||
| } | |||
| public Long getMerchantId() { | |||
| return merchantId; | |||
| } | |||
| @@ -128,35 +149,95 @@ public class WxCoupon implements Serializable { | |||
| public void setSubTitle(String _subTitle) { | |||
| subTitle = _subTitle; | |||
| } | |||
| public BigDecimal getSalePrice() { | |||
| return salePrice; | |||
| } | |||
| public void setSalePrice(BigDecimal _salePrice) { | |||
| salePrice = _salePrice; | |||
| } | |||
| public BigDecimal getUsePrice() { | |||
| return usePrice; | |||
| } | |||
| public void setUsePrice(BigDecimal _usePrice) { | |||
| usePrice = _usePrice; | |||
| } | |||
| public Integer getUseLimitQuantity() { | |||
| return useLimitQuantity; | |||
| } | |||
| public void setUseLimitQuantity(Integer _useLimitQuantity) { | |||
| useLimitQuantity = _useLimitQuantity; | |||
| } | |||
| public Date getSendStartDate() { | |||
| return sendStartDate; | |||
| } | |||
| public void setSendStartDate(Date _sendStartDate) { | |||
| sendStartDate = _sendStartDate; | |||
| } | |||
| public Date getSendEndDate() { | |||
| return sendEndDate; | |||
| } | |||
| public void setSendEndDate(Date _sendEndDate) { | |||
| sendEndDate = _sendEndDate; | |||
| } | |||
| public Date getValidStartDate() { | |||
| return validStartDate; | |||
| } | |||
| public void setValidStartDate(Date _validStartDate) { | |||
| validStartDate = _validStartDate; | |||
| } | |||
| public Date getValidEndDate() { | |||
| return validEndDate; | |||
| } | |||
| public void setValidEndDate(Date _validEndDate) { | |||
| validEndDate = _validEndDate; | |||
| } | |||
| public Integer getValidDays() { | |||
| return validDays; | |||
| } | |||
| public void setValidDays(Integer _validDays) { | |||
| validDays = _validDays; | |||
| } | |||
| public String getDetail() { | |||
| return detail; | |||
| } | |||
| public void setDetail(String _detail) { | |||
| detail = _detail; | |||
| } | |||
| public Integer getSendType() { | |||
| return sendType; | |||
| } | |||
| public void setSendType(Integer _sendType) { | |||
| sendType = _sendType; | |||
| } | |||
| public Integer getTargetAd() { | |||
| return targetAd; | |||
| } | |||
| public void setTargetAd(Integer _targetAd) { | |||
| targetAd = _targetAd; | |||
| } | |||
| public String getBusinesses() { | |||
| return businesses; | |||
| } | |||
| public void setBusinesses(String _businesses) { | |||
| businesses = _businesses; | |||
| } | |||
| public BigDecimal getPrice() { | |||
| return price; | |||
| } | |||
| public void setPrice(BigDecimal _price) { | |||
| price = _price; | |||
| } | |||
| public BigDecimal getSalePrice() { | |||
| return salePrice; | |||
| } | |||
| public void setSalePrice(BigDecimal _salePrice) { | |||
| salePrice = _salePrice; | |||
| public Integer getNumber() { | |||
| return number; | |||
| } | |||
| public BigDecimal getUsePrice() { | |||
| return usePrice; | |||
| public void setNumber(Integer _number) { | |||
| number = _number; | |||
| } | |||
| public void setUsePrice(BigDecimal _usePrice) { | |||
| usePrice = _usePrice; | |||
| } | |||
| public String getBusiness() { | |||
| return business; | |||
| public Integer getTotal() { | |||
| return total; | |||
| } | |||
| public void setBusiness(String _business) { | |||
| business = _business; | |||
| public void setTotal(Integer _total) { | |||
| total = _total; | |||
| } | |||
| public Integer getStatus() { | |||
| return status; | |||
| @@ -183,17 +264,26 @@ public class WxCoupon implements Serializable { | |||
| { | |||
| Id_ASC("`id` ASC"),Id_DESC("`id` DESC") | |||
| ,TenantId_ASC("`tenantId` ASC"),TenantId_DESC("`tenantId` DESC") | |||
| ,ActivityId_ASC("`activityId` ASC"),ActivityId_DESC("`activityId` DESC") | |||
| ,MerchantId_ASC("`merchantId` ASC"),MerchantId_DESC("`merchantId` DESC") | |||
| ,Type_ASC("`type` ASC"),Type_DESC("`type` DESC") | |||
| ,CoverImg_ASC("`coverImg` ASC"),CoverImg_DESC("`coverImg` DESC") | |||
| ,Title_ASC("`title` ASC"),Title_DESC("`title` DESC") | |||
| ,SubTitle_ASC("`subTitle` ASC"),SubTitle_DESC("`subTitle` DESC") | |||
| ,Detail_ASC("`detail` ASC"),Detail_DESC("`detail` DESC") | |||
| ,Price_ASC("`price` ASC"),Price_DESC("`price` DESC") | |||
| ,SalePrice_ASC("`salePrice` ASC"),SalePrice_DESC("`salePrice` DESC") | |||
| ,UsePrice_ASC("`usePrice` ASC"),UsePrice_DESC("`usePrice` DESC") | |||
| ,Business_ASC("`business` ASC"),Business_DESC("`business` DESC") | |||
| ,UseLimitQuantity_ASC("`useLimitQuantity` ASC"),UseLimitQuantity_DESC("`useLimitQuantity` DESC") | |||
| ,SendStartDate_ASC("`sendStartDate` ASC"),SendStartDate_DESC("`sendStartDate` DESC") | |||
| ,SendEndDate_ASC("`sendEndDate` ASC"),SendEndDate_DESC("`sendEndDate` DESC") | |||
| ,ValidStartDate_ASC("`validStartDate` ASC"),ValidStartDate_DESC("`validStartDate` DESC") | |||
| ,ValidEndDate_ASC("`validEndDate` ASC"),ValidEndDate_DESC("`validEndDate` DESC") | |||
| ,ValidDays_ASC("`validDays` ASC"),ValidDays_DESC("`validDays` DESC") | |||
| ,Detail_ASC("`detail` ASC"),Detail_DESC("`detail` DESC") | |||
| ,SendType_ASC("`sendType` ASC"),SendType_DESC("`sendType` DESC") | |||
| ,TargetAd_ASC("`targetAd` ASC"),TargetAd_DESC("`targetAd` DESC") | |||
| ,Businesses_ASC("`businesses` ASC"),Businesses_DESC("`businesses` DESC") | |||
| ,Price_ASC("`price` ASC"),Price_DESC("`price` DESC") | |||
| ,Number_ASC("`number` ASC"),Number_DESC("`number` DESC") | |||
| ,Total_ASC("`total` ASC"),Total_DESC("`total` DESC") | |||
| ,Status_ASC("`status` ASC"),Status_DESC("`status` DESC") | |||
| ,CreateDate_ASC("`createDate` ASC"),CreateDate_DESC("`createDate` DESC") | |||
| ,UpdateDate_ASC("`updateDate` ASC"),UpdateDate_DESC("`updateDate` DESC") | |||
| @@ -0,0 +1,181 @@ | |||
| package com.simple.domain.po; | |||
| import javax.persistence.*; | |||
| import java.util.*; | |||
| import java.math.*; | |||
| import javax.persistence.Transient; | |||
| import java.util.List; | |||
| import javax.persistence.Id; | |||
| import java.io.Serializable; | |||
| @Table(name = "wx_coupon_send") | |||
| public class WxCouponSend implements Serializable { | |||
| private static final long serialVersionUID = 1L; | |||
| @Id | |||
| protected Long id; | |||
| @Transient | |||
| protected List<String> ids; | |||
| @Transient | |||
| protected String sortColumns; | |||
| public Long getId() { | |||
| return id; | |||
| } | |||
| public void setId(Long id) { | |||
| this.id = id; | |||
| } | |||
| public String getSortColumns() { | |||
| return sortColumns; | |||
| } | |||
| public List<String> getIds() { | |||
| return ids; | |||
| } | |||
| public void setIds(List<String> ids) { | |||
| this.ids = ids; | |||
| } | |||
| /*租户ID**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="租户ID",name="tenantId") | |||
| private String tenantId; | |||
| /*商户id**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="商户id",name="merchantId") | |||
| private Long merchantId; | |||
| /*卡券id**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="卡券id",name="couponId") | |||
| private Long couponId; | |||
| /*券类型(1.满减券,2.代金券,3.团购券,4.礼品券,5.停车券)**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="券类型(1.满减券,2.代金券,3.团购券,4.礼品券,5.停车券)",name="type") | |||
| private Integer type; | |||
| /*券名称**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="券名称",name="title") | |||
| private String title; | |||
| /*发券方式(1.主动领取,2.停车发券,3.核销发券)**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="发券方式(1.主动领取,2.停车发券,3.核销发券)",name="sendType") | |||
| private Integer sendType; | |||
| /*创建时间**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="创建时间",name="createDate") | |||
| private Date createDate; | |||
| /*更新时间**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="更新时间",name="updateDate") | |||
| private Date updateDate; | |||
| public String getTenantId() { | |||
| return tenantId; | |||
| } | |||
| public void setTenantId(String _tenantId) { | |||
| tenantId = _tenantId; | |||
| } | |||
| public Long getMerchantId() { | |||
| return merchantId; | |||
| } | |||
| public void setMerchantId(Long _merchantId) { | |||
| merchantId = _merchantId; | |||
| } | |||
| public Long getCouponId() { | |||
| return couponId; | |||
| } | |||
| public void setCouponId(Long _couponId) { | |||
| couponId = _couponId; | |||
| } | |||
| public Integer getType() { | |||
| return type; | |||
| } | |||
| public void setType(Integer _type) { | |||
| type = _type; | |||
| } | |||
| public String getTitle() { | |||
| return title; | |||
| } | |||
| public void setTitle(String _title) { | |||
| title = _title; | |||
| } | |||
| public Integer getSendType() { | |||
| return sendType; | |||
| } | |||
| public void setSendType(Integer _sendType) { | |||
| sendType = _sendType; | |||
| } | |||
| public Date getCreateDate() { | |||
| return createDate; | |||
| } | |||
| public void setCreateDate(Date _createDate) { | |||
| createDate = _createDate; | |||
| } | |||
| public Date getUpdateDate() { | |||
| return updateDate; | |||
| } | |||
| public void setUpdateDate(Date _updateDate) { | |||
| updateDate = _updateDate; | |||
| } | |||
| public static enum Field | |||
| { | |||
| Id_ASC("`id` ASC"),Id_DESC("`id` DESC") | |||
| ,TenantId_ASC("`tenantId` ASC"),TenantId_DESC("`tenantId` DESC") | |||
| ,MerchantId_ASC("`merchantId` ASC"),MerchantId_DESC("`merchantId` DESC") | |||
| ,CouponId_ASC("`couponId` ASC"),CouponId_DESC("`couponId` DESC") | |||
| ,Type_ASC("`type` ASC"),Type_DESC("`type` DESC") | |||
| ,Title_ASC("`title` ASC"),Title_DESC("`title` DESC") | |||
| ,SendType_ASC("`sendType` ASC"),SendType_DESC("`sendType` DESC") | |||
| ,CreateDate_ASC("`createDate` ASC"),CreateDate_DESC("`createDate` DESC") | |||
| ,UpdateDate_ASC("`updateDate` ASC"),UpdateDate_DESC("`updateDate` DESC") | |||
| ; | |||
| private String value; | |||
| Field(String value){ | |||
| this.value = value; | |||
| } | |||
| public String getValue() { | |||
| return value; | |||
| } | |||
| public void setCol(String value) { | |||
| this.value = value; | |||
| } | |||
| @Override | |||
| public String toString() { | |||
| return this.getValue(); | |||
| } | |||
| } | |||
| public void setSortColumns(WxCouponSend.Field... fields) | |||
| { | |||
| if (fields == null || fields.length == 0) { | |||
| return; | |||
| } | |||
| for (int k = 0; k < fields.length; k++) { | |||
| if (fields[k] == null) { | |||
| return; | |||
| } | |||
| } | |||
| StringBuilder sb = new StringBuilder(fields[0].toString()); | |||
| for (int k = 1; k < fields.length; k++) { | |||
| sb.append(","); | |||
| sb.append(fields[k].toString()); | |||
| } | |||
| } | |||
| public void setSortColumns(String sortColumns) | |||
| { | |||
| if (sortColumns == null || "".equals(sortColumns.trim())) { | |||
| return; | |||
| } | |||
| if (sortColumns.contains(",")) { | |||
| String[] cols = sortColumns.split(","); | |||
| java.util.List<Field> fList = new java.util.ArrayList(); | |||
| for (int k = 0; k < cols.length; k++) { | |||
| fList.add(Field.valueOf(cols[k])); | |||
| } | |||
| this.setSortColumns(fList.toArray(new Field[fList.size()])); | |||
| } else { | |||
| this.setSortColumns(Field.valueOf(sortColumns)); | |||
| } | |||
| } | |||
| } | |||
| @@ -0,0 +1,181 @@ | |||
| package com.simple.domain.po; | |||
| import javax.persistence.*; | |||
| import java.util.*; | |||
| import java.math.*; | |||
| import javax.persistence.Transient; | |||
| import java.util.List; | |||
| import javax.persistence.Id; | |||
| import java.io.Serializable; | |||
| @Table(name = "wx_coupon_target") | |||
| public class WxCouponTarget implements Serializable { | |||
| private static final long serialVersionUID = 1L; | |||
| @Id | |||
| protected Long id; | |||
| @Transient | |||
| protected List<String> ids; | |||
| @Transient | |||
| protected String sortColumns; | |||
| public Long getId() { | |||
| return id; | |||
| } | |||
| public void setId(Long id) { | |||
| this.id = id; | |||
| } | |||
| public String getSortColumns() { | |||
| return sortColumns; | |||
| } | |||
| public List<String> getIds() { | |||
| return ids; | |||
| } | |||
| public void setIds(List<String> ids) { | |||
| this.ids = ids; | |||
| } | |||
| /*租户ID**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="租户ID",name="tenantId") | |||
| private String tenantId; | |||
| /*商户id**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="商户id",name="merchantId") | |||
| private Long merchantId; | |||
| /*卡券id**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="卡券id",name="couponId") | |||
| private Long couponId; | |||
| /*券类型(1.满减券,2.代金券,3.团购券,4.礼品券,5.停车券)**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="券类型(1.满减券,2.代金券,3.团购券,4.礼品券,5.停车券)",name="type") | |||
| private Integer type; | |||
| /*券名称**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="券名称",name="title") | |||
| private String title; | |||
| /*投放频道位置(1.banner图,2.限时抢购)**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="投放频道位置(1.banner图,2.限时抢购)",name="targetAd") | |||
| private Integer targetAd; | |||
| /*创建时间**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="创建时间",name="createDate") | |||
| private Date createDate; | |||
| /*更新时间**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="更新时间",name="updateDate") | |||
| private Date updateDate; | |||
| public String getTenantId() { | |||
| return tenantId; | |||
| } | |||
| public void setTenantId(String _tenantId) { | |||
| tenantId = _tenantId; | |||
| } | |||
| public Long getMerchantId() { | |||
| return merchantId; | |||
| } | |||
| public void setMerchantId(Long _merchantId) { | |||
| merchantId = _merchantId; | |||
| } | |||
| public Long getCouponId() { | |||
| return couponId; | |||
| } | |||
| public void setCouponId(Long _couponId) { | |||
| couponId = _couponId; | |||
| } | |||
| public Integer getType() { | |||
| return type; | |||
| } | |||
| public void setType(Integer _type) { | |||
| type = _type; | |||
| } | |||
| public String getTitle() { | |||
| return title; | |||
| } | |||
| public void setTitle(String _title) { | |||
| title = _title; | |||
| } | |||
| public Integer getTargetAd() { | |||
| return targetAd; | |||
| } | |||
| public void setTargetAd(Integer _targetAd) { | |||
| targetAd = _targetAd; | |||
| } | |||
| public Date getCreateDate() { | |||
| return createDate; | |||
| } | |||
| public void setCreateDate(Date _createDate) { | |||
| createDate = _createDate; | |||
| } | |||
| public Date getUpdateDate() { | |||
| return updateDate; | |||
| } | |||
| public void setUpdateDate(Date _updateDate) { | |||
| updateDate = _updateDate; | |||
| } | |||
| public static enum Field | |||
| { | |||
| Id_ASC("`id` ASC"),Id_DESC("`id` DESC") | |||
| ,TenantId_ASC("`tenantId` ASC"),TenantId_DESC("`tenantId` DESC") | |||
| ,MerchantId_ASC("`merchantId` ASC"),MerchantId_DESC("`merchantId` DESC") | |||
| ,CouponId_ASC("`couponId` ASC"),CouponId_DESC("`couponId` DESC") | |||
| ,Type_ASC("`type` ASC"),Type_DESC("`type` DESC") | |||
| ,Title_ASC("`title` ASC"),Title_DESC("`title` DESC") | |||
| ,TargetAd_ASC("`targetAd` ASC"),TargetAd_DESC("`targetAd` DESC") | |||
| ,CreateDate_ASC("`createDate` ASC"),CreateDate_DESC("`createDate` DESC") | |||
| ,UpdateDate_ASC("`updateDate` ASC"),UpdateDate_DESC("`updateDate` DESC") | |||
| ; | |||
| private String value; | |||
| Field(String value){ | |||
| this.value = value; | |||
| } | |||
| public String getValue() { | |||
| return value; | |||
| } | |||
| public void setCol(String value) { | |||
| this.value = value; | |||
| } | |||
| @Override | |||
| public String toString() { | |||
| return this.getValue(); | |||
| } | |||
| } | |||
| public void setSortColumns(WxCouponTarget.Field... fields) | |||
| { | |||
| if (fields == null || fields.length == 0) { | |||
| return; | |||
| } | |||
| for (int k = 0; k < fields.length; k++) { | |||
| if (fields[k] == null) { | |||
| return; | |||
| } | |||
| } | |||
| StringBuilder sb = new StringBuilder(fields[0].toString()); | |||
| for (int k = 1; k < fields.length; k++) { | |||
| sb.append(","); | |||
| sb.append(fields[k].toString()); | |||
| } | |||
| } | |||
| public void setSortColumns(String sortColumns) | |||
| { | |||
| if (sortColumns == null || "".equals(sortColumns.trim())) { | |||
| return; | |||
| } | |||
| if (sortColumns.contains(",")) { | |||
| String[] cols = sortColumns.split(","); | |||
| java.util.List<Field> fList = new java.util.ArrayList(); | |||
| for (int k = 0; k < cols.length; k++) { | |||
| fList.add(Field.valueOf(cols[k])); | |||
| } | |||
| this.setSortColumns(fList.toArray(new Field[fList.size()])); | |||
| } else { | |||
| this.setSortColumns(Field.valueOf(sortColumns)); | |||
| } | |||
| } | |||
| } | |||
| @@ -59,9 +59,7 @@ public class WxMerchant implements Serializable { | |||
| /*银行开户行**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="银行开户行",name="bankName") | |||
| private String bankName; | |||
| /*商户id**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="商户id",name="merchantId") | |||
| private String merchantId; | |||
| public String getTenantId() { | |||
| return tenantId; | |||
| } | |||
| @@ -98,12 +96,7 @@ public class WxMerchant implements Serializable { | |||
| public void setBankName(String _bankName) { | |||
| bankName = _bankName; | |||
| } | |||
| public String getMerchantId() { | |||
| return merchantId; | |||
| } | |||
| public void setMerchantId(String _merchantId) { | |||
| merchantId = _merchantId; | |||
| } | |||
| @@ -0,0 +1,20 @@ | |||
| package com.simple.mapper; | |||
| import com.simple.common.CommonMapper; | |||
| import com.simple.domain.po.MallPermission; | |||
| import org.apache.ibatis.annotations.Param; | |||
| import java.util.List; | |||
| public interface MallPermissionMapper extends CommonMapper<MallPermission, String> { | |||
| List<MallPermission> findList(MallPermission mallPermission); | |||
| List<MallPermission> findPermissionByRoleId(Long roleId); | |||
| List<MallPermission> findPermissionByRoleIds(@Param("roleIds") List<Long> roleIds); | |||
| } | |||
| @@ -0,0 +1,20 @@ | |||
| package com.simple.mapper; | |||
| import com.simple.common.CommonMapper; | |||
| import com.simple.domain.po.MallRole; | |||
| import java.util.List; | |||
| import java.util.Map; | |||
| public interface MallRoleMapper extends CommonMapper<MallRole, String> { | |||
| List<MallRole> findList(MallRole mallRole); | |||
| List<MallRole> findRoleByUserId(Long userId); | |||
| int countByName(Map<String, Object> map); | |||
| } | |||
| @@ -0,0 +1,19 @@ | |||
| package com.simple.mapper; | |||
| import com.simple.common.CommonMapper; | |||
| import com.simple.domain.po.MallUserInfo; | |||
| import org.apache.ibatis.annotations.Param; | |||
| import java.util.List; | |||
| public interface MallUserInfoMapper extends CommonMapper<MallUserInfo, String> { | |||
| List<MallUserInfo> findList(MallUserInfo mallUserInfo); | |||
| Integer hasButtonPermission(@Param("userId") Long userId, @Param("permission") String permission); | |||
| } | |||
| @@ -0,0 +1,17 @@ | |||
| package com.simple.mapper; | |||
| import com.simple.common.CommonMapper; | |||
| import com.simple.domain.po.MallUserRole; | |||
| import java.util.List; | |||
| public interface MallUserRoleMapper extends CommonMapper<MallUserRole, String> { | |||
| List<MallUserRole> findList(MallUserRole mallUserRole); | |||
| } | |||
| @@ -0,0 +1,19 @@ | |||
| package com.simple.mapper; | |||
| import com.simple.common.CommonMapper; | |||
| import com.simple.domain.po.MallUserRolePermission; | |||
| import java.util.List; | |||
| import java.util.Map; | |||
| public interface MallUserRolePermissionMapper extends CommonMapper<MallUserRolePermission, String> { | |||
| List<MallUserRolePermission> findList(MallUserRolePermission mallUserRolePermission); | |||
| void deleteByRoleId(Map<String, Object> map); | |||
| } | |||
| @@ -1,19 +0,0 @@ | |||
| package com.simple.mapper; | |||
| import java.util.*; | |||
| import com.simple.common.CommonMapper; | |||
| import org.apache.ibatis.annotations.Param; | |||
| import com.simple.domain.po.SysPermission; | |||
| public interface SysPermissionMapper extends CommonMapper<SysPermission, String> { | |||
| List<SysPermission> findList(SysPermission sysPermission); | |||
| List<SysPermission> findPermissionByRoleId(String roleId); | |||
| List<SysPermission> findPermissionByRoleIds(@Param("roleIds") List<String> roleIds); | |||
| } | |||
| @@ -1,19 +0,0 @@ | |||
| package com.simple.mapper; | |||
| import java.util.*; | |||
| import com.simple.common.CommonMapper; | |||
| import org.apache.ibatis.annotations.Param; | |||
| import com.simple.domain.po.SysRole; | |||
| public interface SysRoleMapper extends CommonMapper<SysRole, String> { | |||
| List<SysRole> findList(SysRole sysRole); | |||
| List<SysRole> findRoleByUserId(String userId); | |||
| int countByName(Map<String,Object> map); | |||
| } | |||
| @@ -1,18 +0,0 @@ | |||
| package com.simple.mapper; | |||
| import java.util.*; | |||
| import com.simple.common.CommonMapper; | |||
| import org.apache.ibatis.annotations.Param; | |||
| import com.simple.domain.po.SysRolePermission; | |||
| public interface SysRolePermissionMapper extends CommonMapper<SysRolePermission, String> { | |||
| List<SysRolePermission> findList(SysRolePermission sysRolePermission); | |||
| void deleteByRoleId(Map<String,Object> map); | |||
| } | |||
| @@ -1,17 +0,0 @@ | |||
| package com.simple.mapper; | |||
| import java.util.*; | |||
| import com.simple.common.CommonMapper; | |||
| import org.apache.ibatis.annotations.Param; | |||
| import com.simple.domain.po.SysUserRole; | |||
| public interface SysUserRoleMapper extends CommonMapper<SysUserRole, String> { | |||
| List<SysUserRole> findList(SysUserRole sysUserRole); | |||
| } | |||
| @@ -1,18 +0,0 @@ | |||
| package com.simple.mapper; | |||
| import java.util.*; | |||
| import com.simple.common.CommonMapper; | |||
| import org.apache.ibatis.annotations.Param; | |||
| import com.simple.domain.po.UserInfo; | |||
| public interface UserInfoMapper extends CommonMapper<UserInfo, String> { | |||
| List<UserInfo> findList(UserInfo userInfo); | |||
| Integer hasButtonPermission(@Param("userId") String userId, @Param("permission") String permission); | |||
| } | |||
| @@ -0,0 +1,17 @@ | |||
| package com.simple.mapper; | |||
| import java.util.*; | |||
| import com.simple.common.CommonMapper; | |||
| import org.apache.ibatis.annotations.Param; | |||
| import com.simple.domain.po.WxCouponSend; | |||
| public interface WxCouponSendMapper extends CommonMapper<WxCouponSend, String> { | |||
| List<WxCouponSend> findList(WxCouponSend wxCouponSend); | |||
| } | |||
| @@ -0,0 +1,17 @@ | |||
| package com.simple.mapper; | |||
| import java.util.*; | |||
| import com.simple.common.CommonMapper; | |||
| import org.apache.ibatis.annotations.Param; | |||
| import com.simple.domain.po.WxCouponTarget; | |||
| public interface WxCouponTargetMapper extends CommonMapper<WxCouponTarget, String> { | |||
| List<WxCouponTarget> findList(WxCouponTarget wxCouponTarget); | |||
| } | |||
| @@ -1,10 +1,11 @@ | |||
| package com.simple.service; | |||
| import java.util.*; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.simple.domain.po.SysPermission; | |||
| import com.simple.domain.po.MallPermission; | |||
| public interface SysPermissionService { | |||
| import java.util.List; | |||
| public interface MallPermissionService { | |||
| /** | |||
| * 根据实体查询分页列表 | |||
| @@ -14,7 +15,7 @@ public interface SysPermissionService { | |||
| * @param limit | |||
| * @return | |||
| */ | |||
| PageInfo<SysPermission> listAsPage(SysPermission record, Integer pageIndex, Integer pageSize); | |||
| PageInfo<MallPermission> listAsPage(MallPermission record, Integer pageIndex, Integer pageSize); | |||
| /** | |||
| * 根据Id获得实体 | |||
| @@ -22,35 +23,35 @@ public interface SysPermissionService { | |||
| * @param id | |||
| * @return | |||
| */ | |||
| SysPermission getById(String id); | |||
| MallPermission getById(Long id); | |||
| /** | |||
| * 保存或更新实体 | |||
| * | |||
| * @param record | |||
| */ | |||
| void saveOrUpdate(SysPermission record); | |||
| void saveOrUpdate(MallPermission record); | |||
| /** | |||
| * 根据Id删除实体 | |||
| * | |||
| * @param id | |||
| */ | |||
| void deleteById(String id); | |||
| void deleteById(Long id); | |||
| /** | |||
| * 根据roleId查询菜单和按钮权限 | |||
| * @param roleId | |||
| * @return | |||
| */ | |||
| List<SysPermission> findPermissionByRoleId(String roleId); | |||
| List<MallPermission> findPermissionByRoleId(Long roleId); | |||
| /** | |||
| * 根据ruleId权限组查找相应权限 | |||
| * @param roleIds | |||
| * @return | |||
| */ | |||
| List<SysPermission> findPermissionByRoleIds(List<String> roleIds); | |||
| List<MallPermission> findPermissionByRoleIds(List<Long> roleIds); | |||
| @@ -1,10 +1,11 @@ | |||
| package com.simple.service; | |||
| import java.util.*; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.simple.domain.po.SysRole; | |||
| import com.simple.domain.po.MallRole; | |||
| public interface SysRoleService { | |||
| import java.util.List; | |||
| public interface MallRoleService { | |||
| /** | |||
| * 根据实体查询分页列表 | |||
| @@ -14,7 +15,7 @@ public interface SysRoleService { | |||
| * @param limit | |||
| * @return | |||
| */ | |||
| PageInfo<SysRole> listAsPage(SysRole record, Integer pageIndex, Integer pageSize); | |||
| PageInfo<MallRole> listAsPage(MallRole record, Integer pageIndex, Integer pageSize); | |||
| /** | |||
| * 根据Id获得实体 | |||
| @@ -22,21 +23,21 @@ public interface SysRoleService { | |||
| * @param id | |||
| * @return | |||
| */ | |||
| SysRole getById(String id); | |||
| MallRole getById(Long id); | |||
| /** | |||
| * 保存或更新实体 | |||
| * | |||
| * @param record | |||
| */ | |||
| void saveOrUpdate(SysRole record); | |||
| void saveOrUpdate(MallRole record); | |||
| /** | |||
| * 根据Id删除实体 | |||
| * | |||
| * @param id | |||
| */ | |||
| void deleteById(String id); | |||
| void deleteById(Long id); | |||
| /** | |||
| @@ -44,14 +45,14 @@ public interface SysRoleService { | |||
| * @param userId | |||
| * @return | |||
| */ | |||
| List<SysRole> findRoleByUserId(String userId); | |||
| List<MallRole> findRoleByUserId(Long userId); | |||
| /** | |||
| * 根据名称查询数量 | |||
| * @param name 名称 | |||
| * @return | |||
| */ | |||
| int countByName(String name,String id); | |||
| int countByName(String name, Long id); | |||
| @@ -1,10 +1,9 @@ | |||
| package com.simple.service; | |||
| import java.util.*; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.simple.domain.po.UserInfo; | |||
| import com.simple.domain.po.MallUserInfo; | |||
| public interface UserInfoService { | |||
| public interface MallUserInfoService { | |||
| /** | |||
| * 根据实体查询分页列表 | |||
| @@ -14,7 +13,7 @@ public interface UserInfoService { | |||
| * @param limit | |||
| * @return | |||
| */ | |||
| PageInfo<UserInfo> listAsPage(UserInfo record, Integer pageIndex, Integer pageSize); | |||
| PageInfo<MallUserInfo> listAsPage(MallUserInfo record, Integer pageIndex, Integer pageSize); | |||
| /** | |||
| * 根据Id获得实体 | |||
| @@ -22,21 +21,21 @@ public interface UserInfoService { | |||
| * @param id | |||
| * @return | |||
| */ | |||
| UserInfo getById(String id); | |||
| MallUserInfo getById(Long id); | |||
| /** | |||
| * 保存或更新实体 | |||
| * | |||
| * @param record | |||
| */ | |||
| void saveOrUpdate(UserInfo record); | |||
| void saveOrUpdate(MallUserInfo record); | |||
| /** | |||
| * 根据Id删除实体 | |||
| * | |||
| * @param id | |||
| */ | |||
| void deleteById(String id); | |||
| void deleteById(Long id); | |||
| @@ -53,13 +52,13 @@ public interface UserInfoService { | |||
| * @param username | |||
| * @return | |||
| */ | |||
| UserInfo getByUsername(String username); | |||
| MallUserInfo getByUsername(String username); | |||
| /** | |||
| * 删除用户相关数据(用户记录,角色关联) | |||
| * @param id | |||
| */ | |||
| void deleteUser(String id); | |||
| void deleteUser(Long id); | |||
| /** | |||
| * 检查用户按钮是否有权限 | |||
| @@ -67,7 +66,7 @@ public interface UserInfoService { | |||
| * @param permission | |||
| * @return 是否有权限(true: 有| false: 没有) | |||
| */ | |||
| boolean hasButtonPermission(String userId, String permission); | |||
| boolean hasButtonPermission(Long userId, String permission); | |||
| @@ -1,10 +1,9 @@ | |||
| package com.simple.service; | |||
| import java.util.*; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.simple.domain.po.SysRolePermission; | |||
| import com.simple.domain.po.MallUserRolePermission; | |||
| public interface SysRolePermissionService { | |||
| public interface MallUserRolePermissionService { | |||
| /** | |||
| * 根据实体查询分页列表 | |||
| @@ -14,7 +13,7 @@ public interface SysRolePermissionService { | |||
| * @param limit | |||
| * @return | |||
| */ | |||
| PageInfo<SysRolePermission> listAsPage(SysRolePermission record, Integer pageIndex, Integer pageSize); | |||
| PageInfo<MallUserRolePermission> listAsPage(MallUserRolePermission record, Integer pageIndex, Integer pageSize); | |||
| /** | |||
| * 根据Id获得实体 | |||
| @@ -22,21 +21,21 @@ public interface SysRolePermissionService { | |||
| * @param id | |||
| * @return | |||
| */ | |||
| SysRolePermission getById(String id); | |||
| MallUserRolePermission getById(Long id); | |||
| /** | |||
| * 保存或更新实体 | |||
| * | |||
| * @param record | |||
| */ | |||
| void saveOrUpdate(SysRolePermission record); | |||
| void saveOrUpdate(MallUserRolePermission record); | |||
| /** | |||
| * 根据Id删除实体 | |||
| * | |||
| * @param id | |||
| */ | |||
| void deleteById(String id); | |||
| void deleteById(Long id); | |||
| @@ -45,7 +44,7 @@ public interface SysRolePermissionService { | |||
| * @param roleId | |||
| * @param perId | |||
| */ | |||
| void savePermissions(String roleId,String[] perId); | |||
| void savePermissions(Long roleId, Long[] perId); | |||
| @@ -1,10 +1,11 @@ | |||
| package com.simple.service; | |||
| import java.util.*; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.simple.domain.po.SysUserRole; | |||
| import com.simple.domain.po.MallUserRole; | |||
| public interface SysUserRoleService { | |||
| import java.util.List; | |||
| public interface MallUserRoleService { | |||
| /** | |||
| * 根据实体查询分页列表 | |||
| @@ -14,7 +15,7 @@ public interface SysUserRoleService { | |||
| * @param limit | |||
| * @return | |||
| */ | |||
| PageInfo<SysUserRole> listAsPage(SysUserRole record, Integer pageIndex, Integer pageSize); | |||
| PageInfo<MallUserRole> listAsPage(MallUserRole record, Integer pageIndex, Integer pageSize); | |||
| /** | |||
| * 根据Id获得实体 | |||
| @@ -22,30 +23,30 @@ public interface SysUserRoleService { | |||
| * @param id | |||
| * @return | |||
| */ | |||
| SysUserRole getById(String id); | |||
| MallUserRole getById(Long id); | |||
| /** | |||
| * 保存或更新实体 | |||
| * | |||
| * @param record | |||
| */ | |||
| void saveOrUpdate(SysUserRole record); | |||
| void saveOrUpdate(MallUserRole record); | |||
| /** | |||
| * 根据Id删除实体 | |||
| * | |||
| * @param id | |||
| */ | |||
| void deleteById(String id); | |||
| void deleteById(Long id); | |||
| /** | |||
| * 批量增加用户对应角色 | |||
| * @param u2rs | |||
| */ | |||
| void batchInsert(List<SysUserRole> u2rs); | |||
| void batchInsert(List<MallUserRole> u2rs); | |||
| @@ -0,0 +1,48 @@ | |||
| package com.simple.service; | |||
| import java.util.*; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.simple.domain.po.WxCouponSend; | |||
| public interface WxCouponSendService { | |||
| /** | |||
| * 根据实体查询分页列表 | |||
| * | |||
| * @param record | |||
| * @param offset | |||
| * @param limit | |||
| * @return | |||
| */ | |||
| PageInfo<WxCouponSend> listAsPage(WxCouponSend record, Integer pageIndex, Integer pageSize); | |||
| /** | |||
| * 根据Id获得实体 | |||
| * | |||
| * @param id | |||
| * @return | |||
| */ | |||
| WxCouponSend getById(Long id); | |||
| /** | |||
| * 保存或更新实体 | |||
| * | |||
| * @param record | |||
| */ | |||
| void saveOrUpdate(WxCouponSend record); | |||
| /** | |||
| * 根据Id删除实体 | |||
| * | |||
| * @param id | |||
| */ | |||
| void deleteById(Long id); | |||
| } | |||
| @@ -0,0 +1,48 @@ | |||
| package com.simple.service; | |||
| import java.util.*; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.simple.domain.po.WxCouponTarget; | |||
| public interface WxCouponTargetService { | |||
| /** | |||
| * 根据实体查询分页列表 | |||
| * | |||
| * @param record | |||
| * @param offset | |||
| * @param limit | |||
| * @return | |||
| */ | |||
| PageInfo<WxCouponTarget> listAsPage(WxCouponTarget record, Integer pageIndex, Integer pageSize); | |||
| /** | |||
| * 根据Id获得实体 | |||
| * | |||
| * @param id | |||
| * @return | |||
| */ | |||
| WxCouponTarget getById(Long id); | |||
| /** | |||
| * 保存或更新实体 | |||
| * | |||
| * @param record | |||
| */ | |||
| void saveOrUpdate(WxCouponTarget record); | |||
| /** | |||
| * 根据Id删除实体 | |||
| * | |||
| * @param id | |||
| */ | |||
| void deleteById(Long id); | |||
| } | |||
| @@ -0,0 +1,63 @@ | |||
| package com.simple.service.impl; | |||
| import com.github.pagehelper.PageHelper; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.simple.common.IdWorker; | |||
| import com.simple.domain.po.MallPermission; | |||
| import com.simple.mapper.MallPermissionMapper; | |||
| import com.simple.service.MallPermissionService; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.stereotype.Service; | |||
| import java.util.List; | |||
| @Service | |||
| public class MallPermissionServiceImpl implements MallPermissionService { | |||
| @Autowired | |||
| MallPermissionMapper mallPermissionMapper; | |||
| @Override | |||
| public PageInfo<MallPermission> listAsPage(MallPermission record, Integer pageIndex, Integer pageSize) { | |||
| return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> mallPermissionMapper.findList(record)); | |||
| } | |||
| @Override | |||
| public MallPermission getById(Long id) { | |||
| return mallPermissionMapper.selectByPrimaryKey(id); | |||
| } | |||
| @Override | |||
| public void saveOrUpdate(MallPermission record) { | |||
| if (record.getId() == null) { | |||
| //record.setId(UUID.randomUUID().toString().replaceAll("-", "")); | |||
| mallPermissionMapper.insertSelective(record); | |||
| } else { | |||
| mallPermissionMapper.updateByPrimaryKeySelective(record); | |||
| } | |||
| } | |||
| @Override | |||
| public void deleteById(Long id) { | |||
| mallPermissionMapper.deleteByPrimaryKey(id); | |||
| } | |||
| @Override | |||
| public List<MallPermission> findPermissionByRoleId(Long roleId) { | |||
| return mallPermissionMapper.findPermissionByRoleId(roleId); | |||
| } | |||
| @Override | |||
| public List<MallPermission> findPermissionByRoleIds(List<Long> roleIds) { | |||
| return mallPermissionMapper.findPermissionByRoleIds(roleIds); | |||
| } | |||
| } | |||
| @@ -0,0 +1,69 @@ | |||
| package com.simple.service.impl; | |||
| import com.github.pagehelper.PageHelper; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.simple.common.IdWorker; | |||
| import com.simple.domain.po.MallRole; | |||
| import com.simple.mapper.MallRoleMapper; | |||
| import com.simple.service.MallRoleService; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.stereotype.Service; | |||
| import java.util.HashMap; | |||
| import java.util.List; | |||
| import java.util.Map; | |||
| @Service | |||
| public class MallRoleServiceImpl implements MallRoleService { | |||
| @Autowired | |||
| MallRoleMapper mallRoleMapper; | |||
| @Override | |||
| public PageInfo<MallRole> listAsPage(MallRole record, Integer pageIndex, Integer pageSize) { | |||
| return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> mallRoleMapper.findList(record)); | |||
| } | |||
| @Override | |||
| public MallRole getById(Long id) { | |||
| return mallRoleMapper.selectByPrimaryKey(id); | |||
| } | |||
| @Override | |||
| public void saveOrUpdate(MallRole record) { | |||
| if (record.getId() == null) { | |||
| //record.setId(UUID.randomUUID().toString().replaceAll("-", "")); | |||
| IdWorker idWorker = new IdWorker(0, 0); | |||
| record.setId(idWorker.nextId()); | |||
| mallRoleMapper.insertSelective(record); | |||
| } else { | |||
| mallRoleMapper.updateByPrimaryKeySelective(record); | |||
| } | |||
| } | |||
| @Override | |||
| public void deleteById(Long id) { | |||
| mallRoleMapper.deleteByPrimaryKey(id); | |||
| } | |||
| @Override | |||
| public List<MallRole> findRoleByUserId(Long userId) { | |||
| return mallRoleMapper.findRoleByUserId(userId); | |||
| } | |||
| @Override | |||
| public int countByName(String name,Long id) { | |||
| Map<String,Object> map = new HashMap<>(2); | |||
| map.put("name", name); | |||
| map.put("id", id); | |||
| return mallRoleMapper.countByName(map); | |||
| } | |||
| } | |||
| @@ -0,0 +1,85 @@ | |||
| package com.simple.service.impl; | |||
| import com.github.pagehelper.PageHelper; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.simple.common.IdWorker; | |||
| import com.simple.domain.po.MallUserInfo; | |||
| import com.simple.domain.po.MallUserRole; | |||
| import com.simple.mapper.MallUserInfoMapper; | |||
| import com.simple.mapper.MallUserRoleMapper; | |||
| import com.simple.service.MallUserInfoService; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.stereotype.Service; | |||
| import org.springframework.transaction.annotation.Transactional; | |||
| @Service | |||
| public class MallUserInfoServiceImpl implements MallUserInfoService { | |||
| @Autowired | |||
| MallUserInfoMapper mallUserInfoMapper; | |||
| @Autowired | |||
| MallUserRoleMapper userRoleMapper; | |||
| @Override | |||
| public PageInfo<MallUserInfo> listAsPage(MallUserInfo record, Integer pageIndex, Integer pageSize) { | |||
| return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> mallUserInfoMapper.findList(record)); | |||
| } | |||
| @Override | |||
| public MallUserInfo getById(Long id) { | |||
| return mallUserInfoMapper.selectByPrimaryKey(id); | |||
| } | |||
| @Override | |||
| public void saveOrUpdate(MallUserInfo record) { | |||
| if (record.getId() == null) { | |||
| //record.setId(UUID.randomUUID().toString().replaceAll("-", "")); | |||
| IdWorker idWorker = new IdWorker(0, 0); | |||
| record.setId(idWorker.nextId()); | |||
| mallUserInfoMapper.insertSelective(record); | |||
| } else { | |||
| mallUserInfoMapper.updateByPrimaryKeySelective(record); | |||
| } | |||
| } | |||
| @Override | |||
| public void deleteById(Long id) { | |||
| mallUserInfoMapper.deleteByPrimaryKey(id); | |||
| } | |||
| @Override | |||
| public MallUserInfo getByUsername(String username) { | |||
| MallUserInfo userInfo = new MallUserInfo(); | |||
| userInfo.setUsername(username); | |||
| return mallUserInfoMapper.selectOne(userInfo); | |||
| } | |||
| @Override | |||
| public long cntByUserName(String username) { | |||
| MallUserInfo userInfo = new MallUserInfo(); | |||
| userInfo.setUsername(username); | |||
| return PageHelper.count(() -> mallUserInfoMapper.select(userInfo)); | |||
| } | |||
| @Override | |||
| @Transactional(rollbackFor = Exception.class) | |||
| public void deleteUser(Long id) { | |||
| mallUserInfoMapper.deleteByPrimaryKey(id); | |||
| MallUserRole userRole = new MallUserRole(); | |||
| userRole.setUid(id); | |||
| userRoleMapper.delete(userRole); | |||
| } | |||
| @Override | |||
| public boolean hasButtonPermission(Long userId, String permission) { | |||
| return mallUserInfoMapper.hasButtonPermission(userId, permission) == null ? false : true; | |||
| } | |||
| } | |||
| @@ -0,0 +1,69 @@ | |||
| package com.simple.service.impl; | |||
| import com.github.pagehelper.PageHelper; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.simple.common.IdWorker; | |||
| import com.simple.domain.po.MallUserRolePermission; | |||
| import com.simple.mapper.MallUserRolePermissionMapper; | |||
| import com.simple.service.MallUserRolePermissionService; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.stereotype.Service; | |||
| import java.util.HashMap; | |||
| import java.util.Map; | |||
| @Service | |||
| public class MallUserRolePermissionServiceImpl implements MallUserRolePermissionService { | |||
| @Autowired | |||
| MallUserRolePermissionMapper mallUserRolePermissionMapper; | |||
| @Override | |||
| public PageInfo<MallUserRolePermission> listAsPage(MallUserRolePermission record, Integer pageIndex, Integer pageSize) { | |||
| return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> mallUserRolePermissionMapper.findList(record)); | |||
| } | |||
| @Override | |||
| public MallUserRolePermission getById(Long id) { | |||
| return mallUserRolePermissionMapper.selectByPrimaryKey(id); | |||
| } | |||
| @Override | |||
| public void saveOrUpdate(MallUserRolePermission record) { | |||
| if (record.getId() == null) { | |||
| //record.setId(UUID.randomUUID().toString().replaceAll("-", "")); | |||
| IdWorker idWorker = new IdWorker(0, 0); | |||
| record.setId(idWorker.nextId()); | |||
| mallUserRolePermissionMapper.insertSelective(record); | |||
| } else { | |||
| mallUserRolePermissionMapper.updateByPrimaryKeySelective(record); | |||
| } | |||
| } | |||
| @Override | |||
| public void deleteById(Long id) { | |||
| mallUserRolePermissionMapper.deleteByPrimaryKey(id); | |||
| } | |||
| @Override | |||
| public void savePermissions(Long roleId, Long[] perId) { | |||
| Map<String,Object> map = new HashMap<>(); | |||
| map.put("roleId", roleId); | |||
| mallUserRolePermissionMapper.deleteByRoleId(map); | |||
| for(Long pId:perId){ | |||
| MallUserRolePermission permission =new MallUserRolePermission(); | |||
| permission.setId(roleId); | |||
| permission.setPermissionId(pId); | |||
| mallUserRolePermissionMapper.insert(permission); | |||
| } | |||
| } | |||
| } | |||
| @@ -0,0 +1,59 @@ | |||
| package com.simple.service.impl; | |||
| import com.github.pagehelper.PageHelper; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.simple.common.IdWorker; | |||
| import com.simple.domain.po.MallUserRole; | |||
| import com.simple.mapper.MallUserRoleMapper; | |||
| import com.simple.service.MallUserRoleService; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.stereotype.Service; | |||
| import java.util.List; | |||
| @Service | |||
| public class MallUserRoleServiceImpl implements MallUserRoleService { | |||
| @Autowired | |||
| MallUserRoleMapper mallUserRoleMapper; | |||
| @Override | |||
| public PageInfo<MallUserRole> listAsPage(MallUserRole record, Integer pageIndex, Integer pageSize) { | |||
| return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> mallUserRoleMapper.findList(record)); | |||
| } | |||
| @Override | |||
| public MallUserRole getById(Long id) { | |||
| return mallUserRoleMapper.selectByPrimaryKey(id); | |||
| } | |||
| @Override | |||
| public void saveOrUpdate(MallUserRole record) { | |||
| if (record.getId() == null) { | |||
| //record.setId(UUID.randomUUID().toString().replaceAll("-", "")); | |||
| IdWorker idWorker = new IdWorker(0, 0); | |||
| record.setId(idWorker.nextId()); | |||
| mallUserRoleMapper.insertSelective(record); | |||
| } else { | |||
| mallUserRoleMapper.updateByPrimaryKeySelective(record); | |||
| } | |||
| } | |||
| @Override | |||
| public void deleteById(Long id) { | |||
| mallUserRoleMapper.deleteByPrimaryKey(id); | |||
| } | |||
| @Override | |||
| public void batchInsert(List<MallUserRole> u2rs) { | |||
| mallUserRoleMapper.insertList(u2rs); | |||
| } | |||
| } | |||
| @@ -1,60 +0,0 @@ | |||
| package com.simple.service.impl; | |||
| import java.util.*; | |||
| import com.github.pagehelper.PageHelper; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.simple.domain.po.SysPermission; | |||
| import com.simple.mapper.SysPermissionMapper; | |||
| import com.simple.service.SysPermissionService; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.stereotype.Service; | |||
| @Service | |||
| public class SysPermissionServiceImpl implements SysPermissionService { | |||
| @Autowired | |||
| SysPermissionMapper sysPermissionMapper; | |||
| @Override | |||
| public PageInfo<SysPermission> listAsPage(SysPermission record, Integer pageIndex, Integer pageSize) { | |||
| return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> sysPermissionMapper.findList(record)); | |||
| } | |||
| @Override | |||
| public SysPermission getById(String id) { | |||
| return sysPermissionMapper.selectByPrimaryKey(id); | |||
| } | |||
| @Override | |||
| public void saveOrUpdate(SysPermission record) { | |||
| if (record.getId() == null) { | |||
| record.setId(UUID.randomUUID().toString().replaceAll("-", "")); | |||
| sysPermissionMapper.insertSelective(record); | |||
| } else { | |||
| sysPermissionMapper.updateByPrimaryKeySelective(record); | |||
| } | |||
| } | |||
| @Override | |||
| public void deleteById(String id) { | |||
| sysPermissionMapper.deleteByPrimaryKey(id); | |||
| } | |||
| @Override | |||
| public List<SysPermission> findPermissionByRoleId(String roleId) { | |||
| return sysPermissionMapper.findPermissionByRoleId(roleId); | |||
| } | |||
| @Override | |||
| public List<SysPermission> findPermissionByRoleIds(List<String> roleIds) { | |||
| return sysPermissionMapper.findPermissionByRoleIds(roleIds); | |||
| } | |||
| } | |||
| @@ -1,64 +0,0 @@ | |||
| package com.simple.service.impl; | |||
| import java.util.*; | |||
| import com.github.pagehelper.PageHelper; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.simple.domain.po.SysRolePermission; | |||
| import com.simple.mapper.SysRolePermissionMapper; | |||
| import com.simple.service.SysRolePermissionService; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.stereotype.Service; | |||
| @Service | |||
| public class SysRolePermissionServiceImpl implements SysRolePermissionService { | |||
| @Autowired | |||
| SysRolePermissionMapper sysRolePermissionMapper; | |||
| @Override | |||
| public PageInfo<SysRolePermission> listAsPage(SysRolePermission record, Integer pageIndex, Integer pageSize) { | |||
| return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> sysRolePermissionMapper.findList(record)); | |||
| } | |||
| @Override | |||
| public SysRolePermission getById(String id) { | |||
| return sysRolePermissionMapper.selectByPrimaryKey(id); | |||
| } | |||
| @Override | |||
| public void saveOrUpdate(SysRolePermission record) { | |||
| if (record.getId() == null) { | |||
| record.setId(UUID.randomUUID().toString().replaceAll("-", "")); | |||
| sysRolePermissionMapper.insertSelective(record); | |||
| } else { | |||
| sysRolePermissionMapper.updateByPrimaryKeySelective(record); | |||
| } | |||
| } | |||
| @Override | |||
| public void deleteById(String id) { | |||
| sysRolePermissionMapper.deleteByPrimaryKey(id); | |||
| } | |||
| @Override | |||
| public void savePermissions(String roleId, String[] perId) { | |||
| Map<String,Object> map = new HashMap<>(); | |||
| map.put("roleId", roleId); | |||
| sysRolePermissionMapper.deleteByRoleId(map); | |||
| for(String pId:perId){ | |||
| SysRolePermission permission =new SysRolePermission(); | |||
| permission.setId(roleId); | |||
| permission.setPermissionId(pId); | |||
| sysRolePermissionMapper.insert(permission); | |||
| } | |||
| } | |||
| } | |||
| @@ -1,63 +0,0 @@ | |||
| package com.simple.service.impl; | |||
| import java.util.*; | |||
| import com.github.pagehelper.PageHelper; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.simple.domain.po.SysRole; | |||
| import com.simple.mapper.SysRoleMapper; | |||
| import com.simple.service.SysRoleService; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.stereotype.Service; | |||
| @Service | |||
| public class SysRoleServiceImpl implements SysRoleService { | |||
| @Autowired | |||
| SysRoleMapper sysRoleMapper; | |||
| @Override | |||
| public PageInfo<SysRole> listAsPage(SysRole record, Integer pageIndex, Integer pageSize) { | |||
| return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> sysRoleMapper.findList(record)); | |||
| } | |||
| @Override | |||
| public SysRole getById(String id) { | |||
| return sysRoleMapper.selectByPrimaryKey(id); | |||
| } | |||
| @Override | |||
| public void saveOrUpdate(SysRole record) { | |||
| if (record.getId() == null) { | |||
| record.setId(UUID.randomUUID().toString().replaceAll("-", "")); | |||
| sysRoleMapper.insertSelective(record); | |||
| } else { | |||
| sysRoleMapper.updateByPrimaryKeySelective(record); | |||
| } | |||
| } | |||
| @Override | |||
| public void deleteById(String id) { | |||
| sysRoleMapper.deleteByPrimaryKey(id); | |||
| } | |||
| @Override | |||
| public List<SysRole> findRoleByUserId(String userId) { | |||
| return sysRoleMapper.findRoleByUserId(userId); | |||
| } | |||
| @Override | |||
| public int countByName(String name,String id) { | |||
| Map<String,Object> map = new HashMap<>(2); | |||
| map.put("name", name); | |||
| map.put("id", id); | |||
| return sysRoleMapper.countByName(map); | |||
| } | |||
| } | |||
| @@ -1,55 +0,0 @@ | |||
| package com.simple.service.impl; | |||
| import java.util.*; | |||
| import com.github.pagehelper.PageHelper; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.simple.domain.po.SysUserRole; | |||
| import com.simple.mapper.SysUserRoleMapper; | |||
| import com.simple.service.SysUserRoleService; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.stereotype.Service; | |||
| @Service | |||
| public class SysUserRoleServiceImpl implements SysUserRoleService { | |||
| @Autowired | |||
| SysUserRoleMapper sysUserRoleMapper; | |||
| @Override | |||
| public PageInfo<SysUserRole> listAsPage(SysUserRole record, Integer pageIndex, Integer pageSize) { | |||
| return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> sysUserRoleMapper.findList(record)); | |||
| } | |||
| @Override | |||
| public SysUserRole getById(String id) { | |||
| return sysUserRoleMapper.selectByPrimaryKey(id); | |||
| } | |||
| @Override | |||
| public void saveOrUpdate(SysUserRole record) { | |||
| if (record.getId() == null) { | |||
| record.setId(UUID.randomUUID().toString().replaceAll("-", "")); | |||
| sysUserRoleMapper.insertSelective(record); | |||
| } else { | |||
| sysUserRoleMapper.updateByPrimaryKeySelective(record); | |||
| } | |||
| } | |||
| @Override | |||
| public void deleteById(String id) { | |||
| sysUserRoleMapper.deleteByPrimaryKey(id); | |||
| } | |||
| @Override | |||
| public void batchInsert(List<SysUserRole> u2rs) { | |||
| sysUserRoleMapper.insertList(u2rs); | |||
| } | |||
| } | |||
| @@ -1,85 +0,0 @@ | |||
| package com.simple.service.impl; | |||
| import java.util.UUID; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.stereotype.Service; | |||
| import org.springframework.transaction.annotation.Transactional; | |||
| import com.github.pagehelper.PageHelper; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.simple.domain.po.SysUserRole; | |||
| import com.simple.domain.po.UserInfo; | |||
| import com.simple.mapper.SysUserRoleMapper; | |||
| import com.simple.mapper.UserInfoMapper; | |||
| import com.simple.service.UserInfoService; | |||
| @Service | |||
| public class UserInfoServiceImpl implements UserInfoService { | |||
| @Autowired | |||
| UserInfoMapper userInfoMapper; | |||
| @Autowired | |||
| SysUserRoleMapper userRoleMapper; | |||
| @Override | |||
| public PageInfo<UserInfo> listAsPage(UserInfo record, Integer pageIndex, Integer pageSize) { | |||
| return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> userInfoMapper.findList(record)); | |||
| } | |||
| @Override | |||
| public UserInfo getById(String id) { | |||
| return userInfoMapper.selectByPrimaryKey(id); | |||
| } | |||
| @Override | |||
| public void saveOrUpdate(UserInfo record) { | |||
| if (record.getId() == null) { | |||
| record.setId(UUID.randomUUID().toString().replaceAll("-", "")); | |||
| userInfoMapper.insertSelective(record); | |||
| } else { | |||
| userInfoMapper.updateByPrimaryKeySelective(record); | |||
| } | |||
| } | |||
| @Override | |||
| public void deleteById(String id) { | |||
| userInfoMapper.deleteByPrimaryKey(id); | |||
| } | |||
| @Override | |||
| public UserInfo getByUsername(String username) { | |||
| UserInfo userInfo = new UserInfo(); | |||
| userInfo.setUsername(username); | |||
| return userInfoMapper.selectOne(userInfo); | |||
| } | |||
| @Override | |||
| public long cntByUserName(String username) { | |||
| UserInfo userInfo = new UserInfo(); | |||
| userInfo.setUsername(username); | |||
| return PageHelper.count(() -> userInfoMapper.select(userInfo)); | |||
| } | |||
| @Override | |||
| @Transactional(rollbackFor = Exception.class) | |||
| public void deleteUser(String id) { | |||
| userInfoMapper.deleteByPrimaryKey(id); | |||
| SysUserRole userRole = new SysUserRole(); | |||
| userRole.setUid(id); | |||
| userRoleMapper.delete(userRole); | |||
| } | |||
| @Override | |||
| public boolean hasButtonPermission(String userId, String permission) { | |||
| return userInfoMapper.hasButtonPermission(userId, permission) == null ? false : true; | |||
| } | |||
| } | |||
| @@ -0,0 +1,54 @@ | |||
| package com.simple.service.impl; | |||
| import java.util.*; | |||
| import com.github.pagehelper.PageHelper; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.simple.domain.po.WxCouponSend; | |||
| import com.simple.mapper.WxCouponSendMapper; | |||
| import com.simple.service.WxCouponSendService; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.stereotype.Service; | |||
| import com.simple.common.IdWorker; | |||
| @Service | |||
| public class WxCouponSendServiceImpl implements WxCouponSendService { | |||
| @Autowired | |||
| WxCouponSendMapper wxCouponSendMapper; | |||
| @Override | |||
| public PageInfo<WxCouponSend> listAsPage(WxCouponSend record, Integer pageIndex, Integer pageSize) { | |||
| return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxCouponSendMapper.findList(record)); | |||
| } | |||
| @Override | |||
| public WxCouponSend getById(Long id) { | |||
| return wxCouponSendMapper.selectByPrimaryKey(id); | |||
| } | |||
| @Override | |||
| public void saveOrUpdate(WxCouponSend record) { | |||
| if (record.getId() == null) { | |||
| //record.setId(UUID.randomUUID().toString().replaceAll("-", "")); | |||
| IdWorker idWorker = new IdWorker(0, 0); | |||
| record.setId(idWorker.nextId()); | |||
| wxCouponSendMapper.insertSelective(record); | |||
| } else { | |||
| wxCouponSendMapper.updateByPrimaryKeySelective(record); | |||
| } | |||
| } | |||
| @Override | |||
| public void deleteById(Long id) { | |||
| wxCouponSendMapper.deleteByPrimaryKey(id); | |||
| } | |||
| } | |||
| @@ -0,0 +1,54 @@ | |||
| package com.simple.service.impl; | |||
| import java.util.*; | |||
| import com.github.pagehelper.PageHelper; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.simple.domain.po.WxCouponTarget; | |||
| import com.simple.mapper.WxCouponTargetMapper; | |||
| import com.simple.service.WxCouponTargetService; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.stereotype.Service; | |||
| import com.simple.common.IdWorker; | |||
| @Service | |||
| public class WxCouponTargetServiceImpl implements WxCouponTargetService { | |||
| @Autowired | |||
| WxCouponTargetMapper wxCouponTargetMapper; | |||
| @Override | |||
| public PageInfo<WxCouponTarget> listAsPage(WxCouponTarget record, Integer pageIndex, Integer pageSize) { | |||
| return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxCouponTargetMapper.findList(record)); | |||
| } | |||
| @Override | |||
| public WxCouponTarget getById(Long id) { | |||
| return wxCouponTargetMapper.selectByPrimaryKey(id); | |||
| } | |||
| @Override | |||
| public void saveOrUpdate(WxCouponTarget record) { | |||
| if (record.getId() == null) { | |||
| //record.setId(UUID.randomUUID().toString().replaceAll("-", "")); | |||
| IdWorker idWorker = new IdWorker(0, 0); | |||
| record.setId(idWorker.nextId()); | |||
| wxCouponTargetMapper.insertSelective(record); | |||
| } else { | |||
| wxCouponTargetMapper.updateByPrimaryKeySelective(record); | |||
| } | |||
| } | |||
| @Override | |||
| public void deleteById(Long id) { | |||
| wxCouponTargetMapper.deleteByPrimaryKey(id); | |||
| } | |||
| } | |||
| @@ -1,12 +1,13 @@ | |||
| <?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.simple.mapper.SysPermissionMapper"> | |||
| <resultMap id="BaseResultMap" type="com.simple.domain.po.SysPermission"> | |||
| <mapper namespace="com.simple.mapper.MallPermissionMapper"> | |||
| <resultMap id="BaseResultMap" type="com.simple.domain.po.MallPermission"> | |||
| <id column="id" jdbcType="VARCHAR" property="id" /> | |||
| <result column="tenant_id" jdbcType="VARCHAR" property="tenantId" /> | |||
| <result column="name" jdbcType="VARCHAR" property="name" /> | |||
| <result column="available" jdbcType="VARCHAR" property="available" /> | |||
| <result column="parent_id" jdbcType="VARCHAR" property="parentId" /> | |||
| <result column="parent_ids" jdbcType="VARCHAR" property="parentIds" /> | |||
| <result column="parent_id" jdbcType="INTEGER" property="parentId" /> | |||
| <result column="parent_ids" jdbcType="INTEGER" property="parentIds" /> | |||
| <result column="permission" jdbcType="VARCHAR" property="permission" /> | |||
| <result column="resource_type" jdbcType="VARCHAR" property="resourceType" /> | |||
| <result column="url" jdbcType="VARCHAR" property="url" /> | |||
| @@ -14,27 +15,68 @@ | |||
| </resultMap> | |||
| <sql id="allColumns"> | |||
| `id`,`name`,`available`,`parent_id`,`parent_ids`,`permission`,`resource_type`,`url`,`sort` | |||
| `id`,`tenant_id`,`name`,`available`,`parent_id`,`parent_ids`,`permission`,`resource_type`,`url`,`sort` | |||
| </sql> | |||
| <sql id="dynamicWhereConditions"> | |||
| where 1 = 1 | |||
| <if test=" null != id "> and `id` = #{id} </if> | |||
| <if test=" null != name "> and `name` = #{name} </if> | |||
| <if test=" null != id "> | |||
| and `id` like concat('%', #{id},'%') | |||
| </if> | |||
| <if test=" null != tenantId "> | |||
| and `tenant_id` like concat('%', #{tenantId},'%') | |||
| </if> | |||
| <if test=" null != name "> | |||
| and `name` like concat('%', #{name},'%') | |||
| </if> | |||
| <if test=" null != nameLike and '' != nameLike "> and `name` like concat('%', #{nameLike},'%')</if> | |||
| <if test=" null != available "> and `available` = #{available} </if> | |||
| <if test=" null != parentId "> and `parent_id` = #{parentId} </if> | |||
| <if test=" null != parentIds "> and `parent_ids` = #{parentIds} </if> | |||
| <if test=" null != permission "> and `permission` = #{permission} </if> | |||
| <if test=" null != available "> | |||
| and `available` like concat('%', #{available},'%') | |||
| </if> | |||
| <if test=" null != parentId "> | |||
| and `parent_id` like concat('%', #{parentId},'%') | |||
| </if> | |||
| <if test=" null != parentIds "> | |||
| and `parent_ids` like concat('%', #{parentIds},'%') | |||
| </if> | |||
| <if test=" null != permission "> | |||
| and `permission` like concat('%', #{permission},'%') | |||
| </if> | |||
| <if test=" null != permissions "> | |||
| and `permission` in | |||
| <foreach collection="permissions" item="item_permission" open="(" close=")" separator=","> | |||
| #{item_permission} | |||
| </foreach> | |||
| </if> | |||
| <if test=" null != resourceType "> and `resource_type` = #{resourceType} </if> | |||
| <if test=" null != url "> and `url` = #{url} </if> | |||
| <if test=" null != sort "> and `sort` = #{sort} </if> | |||
| <if test=" null != resourceType "> | |||
| and `resource_type` like concat('%', #{resourceType},'%') | |||
| </if> | |||
| <if test=" null != url "> | |||
| and `url` like concat('%', #{url},'%') | |||
| </if> | |||
| <if test=" null != sort "> | |||
| and `sort` = #{sort} | |||
| </if> | |||
| <if test=" null != sortFrom "> and `sort` >= #{sortFrom} </if> | |||
| <if test=" null != sortTo "> and #{sortTo} >= `sort` </if> | |||
| <if test=" null != sortGte "> and `sort` >= #{sortGte} </if> | |||
| @@ -50,21 +92,21 @@ | |||
| <if test=" null != sortColumns"> order by ${sortColumns} </if> | |||
| </sql> | |||
| <select id="findList" parameterType="com.simple.domain.po.SysPermission" resultMap="BaseResultMap"> | |||
| select <include refid="allColumns" /> from sys_permission | |||
| <select id="findList" parameterType="com.simple.domain.po.MallPermission" resultMap="BaseResultMap"> | |||
| select <include refid="allColumns" /> from mall_permission | |||
| <include refid="dynamicWhereConditions" /> | |||
| </select> | |||
| <select id="findPermissionByRoleId" parameterType="java.lang.Long" resultMap="BaseResultMap"> | |||
| SELECT p.* | |||
| FROM sys_role_permission r2p, sys_permission p | |||
| FROM mall_user_role_permission r2p, mall_permission p | |||
| WHERE r2p.permission_id = p.id | |||
| AND r2p.id = #{roleId} | |||
| </select> | |||
| <select id="findPermissionByRoleIds" resultMap="BaseResultMap"> | |||
| SELECT p.* | |||
| FROM sys_role_permission r2p, sys_permission p | |||
| FROM mall_user_role_permission r2p, mall_permission p | |||
| WHERE resource_type='0' and r2p.permission_id = p.id | |||
| <if test="roleIds != null and roleIds.size() > 0 "> | |||
| AND r2p.id in | |||
| @@ -1,23 +1,45 @@ | |||
| <?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.simple.mapper.SysRoleMapper"> | |||
| <resultMap id="BaseResultMap" type="com.simple.domain.po.SysRole"> | |||
| <mapper namespace="com.simple.mapper.MallRoleMapper"> | |||
| <resultMap id="BaseResultMap" type="com.simple.domain.po.MallRole"> | |||
| <id column="id" jdbcType="VARCHAR" property="id" /> | |||
| <result column="tenant_id" jdbcType="VARCHAR" property="tenantId" /> | |||
| <result column="name" jdbcType="VARCHAR" property="name" /> | |||
| <result column="available" jdbcType="VARCHAR" property="available" /> | |||
| <result column="description" jdbcType="VARCHAR" property="description" /> | |||
| </resultMap> | |||
| <sql id="allColumns"> | |||
| `id`,`name`,`available`,`description` | |||
| `id`,`tenant_id`,`name`,`available`,`description` | |||
| </sql> | |||
| <sql id="dynamicWhereConditions"> | |||
| where 1 = 1 | |||
| <if test=" null != id "> and `id` = #{id} </if> | |||
| <if test=" null != name "> and `name` = #{name} </if> | |||
| <if test=" null != available "> and `available` = #{available} </if> | |||
| <if test=" null != description "> and `description` = #{description} </if> | |||
| <if test=" null != id "> | |||
| and `id` like concat('%', #{id},'%') | |||
| </if> | |||
| <if test=" null != tenantId "> | |||
| and `tenant_id` like concat('%', #{tenantId},'%') | |||
| </if> | |||
| <if test=" null != name "> | |||
| and `name` like concat('%', #{name},'%') | |||
| </if> | |||
| <if test=" null != available "> | |||
| and `available` like concat('%', #{available},'%') | |||
| </if> | |||
| <if test=" null != description "> | |||
| and `description` like concat('%', #{description},'%') | |||
| </if> | |||
| <if test=" null != ids "> | |||
| and id in | |||
| <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")"> | |||
| @@ -27,20 +49,20 @@ | |||
| <if test=" null != sortColumns"> order by ${sortColumns} </if> | |||
| </sql> | |||
| <select id="findList" parameterType="com.simple.domain.po.SysRole" resultMap="BaseResultMap"> | |||
| select <include refid="allColumns" /> from sys_role | |||
| <select id="findList" parameterType="com.simple.domain.po.MallRole" resultMap="BaseResultMap"> | |||
| select <include refid="allColumns" /> from mall_role | |||
| <include refid="dynamicWhereConditions" /> | |||
| </select> | |||
| <select id="countByName" resultType="java.lang.Integer" parameterType="java.util.HashMap"> | |||
| select count(1) from sys_role where name=#{name} | |||
| select count(1) from mall_role where name=#{name} | |||
| <if test="id!=null"> and id !=#{id}</if> | |||
| </select> | |||
| <select id="findRoleByUserId" parameterType="java.lang.Long" resultMap="BaseResultMap"> | |||
| SELECT r.id | |||
| FROM sys_user_role u2r, sys_role r | |||
| FROM mall_user_role u2r, mall_role r | |||
| WHERE u2r.role_id = r.id | |||
| AND u2r.uid = #{userId} | |||
| </select> | |||
| @@ -0,0 +1,95 @@ | |||
| <?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.simple.mapper.MallUserInfoMapper"> | |||
| <resultMap id="BaseResultMap" type="com.simple.domain.po.MallUserInfo"> | |||
| <id column="id" jdbcType="BIGINT" property="id" /> | |||
| <result column="tenant_id" jdbcType="VARCHAR" property="tenantId" /> | |||
| <result column="username" jdbcType="VARCHAR" property="username" /> | |||
| <result column="name" jdbcType="VARCHAR" property="name" /> | |||
| <result column="password" jdbcType="VARCHAR" property="password" /> | |||
| <result column="create_time" jdbcType="TIMESTAMP" property="createTime" /> | |||
| <result column="last_login_time" jdbcType="TIMESTAMP" property="lastLoginTime" /> | |||
| <result column="status" jdbcType="INTEGER" property="status" /> | |||
| <result column="is_admin" jdbcType="INTEGER" property="isAdmin" /> | |||
| </resultMap> | |||
| <sql id="allColumns"> | |||
| `id`,`tenant_id`,`username`,`name`,`password`,`create_time`,`last_login_time`,`status`,`is_admin` | |||
| </sql> | |||
| <sql id="dynamicWhereConditions"> | |||
| where 1 = 1 | |||
| <if test=" null != id "> | |||
| and `id` = #{id} | |||
| </if> | |||
| <if test=" null != tenantId "> | |||
| and `tenant_id` like concat('%', #{tenantId},'%') | |||
| </if> | |||
| <if test=" null != username "> | |||
| and `username` like concat('%', #{username},'%') | |||
| </if> | |||
| <if test=" null != name "> | |||
| and `name` like concat('%', #{name},'%') | |||
| </if> | |||
| <if test=" null != password "> | |||
| and `password` like concat('%', #{password},'%') | |||
| </if> | |||
| <if test=" null != createTime "> | |||
| and `create_time` = #{createTime} | |||
| </if> | |||
| <if test=" null != lastLoginTime "> | |||
| and `last_login_time` = #{lastLoginTime} | |||
| </if> | |||
| <if test=" null != status "> | |||
| and `status` = #{status} | |||
| </if> | |||
| <if test=" null != isAdmin "> | |||
| and `is_admin` = #{isAdmin} | |||
| </if> | |||
| <if test=" null != ids "> | |||
| and id in | |||
| <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")"> | |||
| #{idItem} | |||
| </foreach> | |||
| </if> | |||
| <if test=" null != sortColumns"> order by ${sortColumns} </if> | |||
| </sql> | |||
| <select id="findList" parameterType="com.simple.domain.po.MallUserInfo" resultMap="BaseResultMap"> | |||
| select <include refid="allColumns" /> from mall_user_info | |||
| <include refid="dynamicWhereConditions" /> | |||
| </select> | |||
| <select id="hasButtonPermission" resultType="java.lang.Integer"> | |||
| SELECT 1 | |||
| FROM mall_user_role ur, mall_user_role_permission rp, mall_permission p | |||
| WHERE rp.role_id = ur.role_id | |||
| AND rp.permission_id = p.id | |||
| AND p.resource_type = 1 | |||
| AND ur.uid = #{userId} | |||
| AND p.permission = #{permission} | |||
| </select> | |||
| </mapper> | |||
| @@ -1,7 +1,7 @@ | |||
| <?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.simple.mapper.SysUserRoleMapper"> | |||
| <resultMap id="BaseResultMap" type="com.simple.domain.po.SysUserRole"> | |||
| <mapper namespace="com.simple.mapper.MallUserRoleMapper"> | |||
| <resultMap id="BaseResultMap" type="com.simple.domain.po.MallUserRole"> | |||
| <id column="id" jdbcType="VARCHAR" property="id" /> | |||
| <result column="uid" jdbcType="VARCHAR" property="uid" /> | |||
| <result column="role_id" jdbcType="VARCHAR" property="roleId" /> | |||
| @@ -13,9 +13,21 @@ | |||
| <sql id="dynamicWhereConditions"> | |||
| where 1 = 1 | |||
| <if test=" null != uid "> and `uid` = #{uid} </if> | |||
| <if test=" null != roleId "> and `role_id` = #{roleId} </if> | |||
| <if test=" null != id "> and `id` = #{id} </if> | |||
| <if test=" null != uid "> | |||
| and `uid` like concat('%', #{uid},'%') | |||
| </if> | |||
| <if test=" null != roleId "> | |||
| and `role_id` like concat('%', #{roleId},'%') | |||
| </if> | |||
| <if test=" null != id "> | |||
| and `id` like concat('%', #{id},'%') | |||
| </if> | |||
| <if test=" null != ids "> | |||
| and id in | |||
| <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")"> | |||
| @@ -25,8 +37,8 @@ | |||
| <if test=" null != sortColumns"> order by ${sortColumns} </if> | |||
| </sql> | |||
| <select id="findList" parameterType="com.simple.domain.po.SysUserRole" resultMap="BaseResultMap"> | |||
| select <include refid="allColumns" /> from sys_user_role | |||
| <select id="findList" parameterType="com.simple.domain.po.MallUserRole" resultMap="BaseResultMap"> | |||
| select <include refid="allColumns" /> from mall_user_role | |||
| <include refid="dynamicWhereConditions" /> | |||
| </select> | |||
| @@ -0,0 +1,56 @@ | |||
| <?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.simple.mapper.MallUserRolePermissionMapper"> | |||
| <resultMap id="BaseResultMap" type="com.simple.domain.po.MallUserRolePermission"> | |||
| <id column="id" jdbcType="BIGINT" property="id" /> | |||
| <result column="tenant_id" jdbcType="VARCHAR" property="tenantId" /> | |||
| <result column="permission_id" jdbcType="VARCHAR" property="permissionId" /> | |||
| <result column="role_id" jdbcType="VARCHAR" property="roleId" /> | |||
| </resultMap> | |||
| <sql id="allColumns"> | |||
| `id`,`tenant_id`,`permission_id`,`role_id` | |||
| </sql> | |||
| <sql id="dynamicWhereConditions"> | |||
| where 1 = 1 | |||
| <if test=" null != id "> | |||
| and `id` = #{id} | |||
| </if> | |||
| <if test=" null != tenantId "> | |||
| and `tenant_id` like concat('%', #{tenantId},'%') | |||
| </if> | |||
| <if test=" null != permissionId "> | |||
| and `permission_id` like concat('%', #{permissionId},'%') | |||
| </if> | |||
| <if test=" null != roleId "> | |||
| and `role_id` like concat('%', #{roleId},'%') | |||
| </if> | |||
| <if test=" null != ids "> | |||
| and id in | |||
| <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")"> | |||
| #{idItem} | |||
| </foreach> | |||
| </if> | |||
| <if test=" null != sortColumns"> order by ${sortColumns} </if> | |||
| </sql> | |||
| <select id="findList" parameterType="com.simple.domain.po.MallUserRolePermission" resultMap="BaseResultMap"> | |||
| select <include refid="allColumns" /> from mall_user_role_permission | |||
| <include refid="dynamicWhereConditions" /> | |||
| </select> | |||
| </mapper> | |||
| @@ -1,41 +0,0 @@ | |||
| <?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.simple.mapper.SysRolePermissionMapper"> | |||
| <resultMap id="BaseResultMap" type="com.simple.domain.po.SysRolePermission"> | |||
| <id column="id" jdbcType="VARCHAR" property="id" /> | |||
| <result column="permission_id" jdbcType="VARCHAR" property="permissionId" /> | |||
| <result column="role_id" jdbcType="VARCHAR" property="roleId" /> | |||
| </resultMap> | |||
| <sql id="allColumns"> | |||
| `permission_id`,`role_id`,`id` | |||
| </sql> | |||
| <sql id="dynamicWhereConditions"> | |||
| where 1 = 1 | |||
| <if test=" null != permissionId "> and `permission_id` = #{permissionId} </if> | |||
| <if test=" null != roleId "> and `role_id` = #{roleId} </if> | |||
| <if test=" null != id "> and `id` = #{id} </if> | |||
| <if test=" null != ids "> | |||
| and id in | |||
| <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")"> | |||
| #{idItem} | |||
| </foreach> | |||
| </if> | |||
| <if test=" null != sortColumns"> order by ${sortColumns} </if> | |||
| </sql> | |||
| <select id="findList" parameterType="com.simple.domain.po.SysRolePermission" resultMap="BaseResultMap"> | |||
| select <include refid="allColumns" /> from sys_role_permission | |||
| <include refid="dynamicWhereConditions" /> | |||
| </select> | |||
| <delete id="deleteByRoleId" parameterType="java.util.HashMap"> | |||
| delete from sys_role_permission where role_id=#{roleId} | |||
| </delete> | |||
| </mapper> | |||
| @@ -1,57 +0,0 @@ | |||
| <?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.simple.mapper.UserInfoMapper"> | |||
| <resultMap id="BaseResultMap" type="com.simple.domain.po.UserInfo"> | |||
| <id column="id" jdbcType="VARCHAR" property="id" /> | |||
| <result column="username" jdbcType="VARCHAR" property="username" /> | |||
| <result column="name" jdbcType="VARCHAR" property="name" /> | |||
| <result column="password" jdbcType="VARCHAR" property="password" /> | |||
| <result column="create_time" jdbcType="TIMESTAMP" property="createTime" /> | |||
| <result column="last_login_time" jdbcType="TIMESTAMP" property="lastLoginTime" /> | |||
| <result column="status" jdbcType="INTEGER" property="status" /> | |||
| <result column="is_admin" jdbcType="INTEGER" property="isAdmin" /> | |||
| </resultMap> | |||
| <sql id="allColumns"> | |||
| `id`,`username`,`name`,`password`,`create_time`,`last_login_time`,`status`,`is_admin` | |||
| </sql> | |||
| <sql id="dynamicWhereConditions"> | |||
| where 1 = 1 | |||
| <if test=" null != id "> and `id` = #{id} </if> | |||
| <if test=" null != username "> and `username` = #{username} </if> | |||
| <if test=" null != name "> and `name` = #{name} </if> | |||
| <if test=" null != password "> and `password` = #{password} </if> | |||
| <if test=" null != createTime "> and `create_time` = #{createTime} </if> | |||
| <if test=" null != lastLoginTime "> and `last_login_time` = #{lastLoginTime} </if> | |||
| <if test=" null != status "> and `status` = #{status} </if> | |||
| <if test=" null != isAdmin "> and `is_admin` = #{isAdmin} </if> | |||
| <if test=" null != ids "> | |||
| and id in | |||
| <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")"> | |||
| #{idItem} | |||
| </foreach> | |||
| </if> | |||
| <if test=" null != sortColumns"> order by ${sortColumns} </if> | |||
| </sql> | |||
| <select id="findList" parameterType="com.simple.domain.po.UserInfo" resultMap="BaseResultMap"> | |||
| select <include refid="allColumns" /> from user_info | |||
| <include refid="dynamicWhereConditions" /> | |||
| </select> | |||
| <select id="hasButtonPermission" resultType="java.lang.Integer"> | |||
| SELECT 1 | |||
| FROM sys_user_role ur, sys_role_permission rp, sys_permission p | |||
| WHERE rp.role_id = ur.role_id | |||
| AND rp.permission_id = p.id | |||
| AND p.resource_type = 1 | |||
| AND ur.uid = #{userId} | |||
| AND p.permission = #{permission} | |||
| </select> | |||
| </mapper> | |||
| @@ -4,24 +4,33 @@ | |||
| <resultMap id="BaseResultMap" type="com.simple.domain.po.WxCoupon"> | |||
| <id column="id" jdbcType="BIGINT" property="id" /> | |||
| <result column="tenant_id" jdbcType="VARCHAR" property="tenantId" /> | |||
| <result column="activity_id" jdbcType="BIGINT" property="activityId" /> | |||
| <result column="merchant_id" jdbcType="BIGINT" property="merchantId" /> | |||
| <result column="type" jdbcType="INTEGER" property="type" /> | |||
| <result column="cover_img" jdbcType="VARCHAR" property="coverImg" /> | |||
| <result column="title" jdbcType="VARCHAR" property="title" /> | |||
| <result column="sub_title" jdbcType="VARCHAR" property="subTitle" /> | |||
| <result column="detail" jdbcType="VARCHAR" property="detail" /> | |||
| <result column="price" jdbcType="DECIMAL" property="price" /> | |||
| <result column="sale_price" jdbcType="DECIMAL" property="salePrice" /> | |||
| <result column="use_price" jdbcType="DECIMAL" property="usePrice" /> | |||
| <result column="business" jdbcType="VARCHAR" property="business" /> | |||
| <result column="use_limit_quantity" jdbcType="INTEGER" property="useLimitQuantity" /> | |||
| <result column="send_start_date" jdbcType="TIMESTAMP" property="sendStartDate" /> | |||
| <result column="send_end_date" jdbcType="TIMESTAMP" property="sendEndDate" /> | |||
| <result column="valid_start_date" jdbcType="TIMESTAMP" property="validStartDate" /> | |||
| <result column="valid_end_date" jdbcType="TIMESTAMP" property="validEndDate" /> | |||
| <result column="valid_days" jdbcType="INTEGER" property="validDays" /> | |||
| <result column="detail" jdbcType="VARCHAR" property="detail" /> | |||
| <result column="send_type" jdbcType="INTEGER" property="sendType" /> | |||
| <result column="target_ad" jdbcType="INTEGER" property="targetAd" /> | |||
| <result column="businesses" jdbcType="VARCHAR" property="businesses" /> | |||
| <result column="price" jdbcType="DECIMAL" property="price" /> | |||
| <result column="number" jdbcType="INTEGER" property="number" /> | |||
| <result column="total" jdbcType="INTEGER" property="total" /> | |||
| <result column="status" jdbcType="INTEGER" property="status" /> | |||
| <result column="create_date" jdbcType="TIMESTAMP" property="createDate" /> | |||
| <result column="update_date" jdbcType="TIMESTAMP" property="updateDate" /> | |||
| </resultMap> | |||
| <sql id="allColumns"> | |||
| `id`,`tenant_id`,`activity_id`,`merchant_id`,`type`,`cover_img`,`title`,`sub_title`,`detail`,`price`,`sale_price`,`use_price`,`business`,`status`,`create_date`,`update_date` | |||
| `id`,`tenant_id`,`merchant_id`,`type`,`cover_img`,`title`,`sub_title`,`sale_price`,`use_price`,`use_limit_quantity`,`send_start_date`,`send_end_date`,`valid_start_date`,`valid_end_date`,`valid_days`,`detail`,`send_type`,`target_ad`,`businesses`,`price`,`number`,`total`,`status`,`create_date`,`update_date` | |||
| </sql> | |||
| <sql id="dynamicWhereConditions"> | |||
| @@ -37,11 +46,6 @@ | |||
| </if> | |||
| <if test=" null != activityId "> | |||
| and `activity_id` = #{activityId} | |||
| </if> | |||
| <if test=" null != merchantId "> | |||
| and `merchant_id` = #{merchantId} | |||
| @@ -67,28 +71,78 @@ | |||
| </if> | |||
| <if test=" null != salePrice "> | |||
| and `sale_price` = #{salePrice} | |||
| </if> | |||
| <if test=" null != usePrice "> | |||
| and `use_price` = #{usePrice} | |||
| </if> | |||
| <if test=" null != useLimitQuantity "> | |||
| and `use_limit_quantity` = #{useLimitQuantity} | |||
| </if> | |||
| <if test=" null != sendStartDate "> | |||
| and `send_start_date` = #{sendStartDate} | |||
| </if> | |||
| <if test=" null != sendEndDate "> | |||
| and `send_end_date` = #{sendEndDate} | |||
| </if> | |||
| <if test=" null != validStartDate "> | |||
| and `valid_start_date` = #{validStartDate} | |||
| </if> | |||
| <if test=" null != validEndDate "> | |||
| and `valid_end_date` = #{validEndDate} | |||
| </if> | |||
| <if test=" null != validDays "> | |||
| and `valid_days` = #{validDays} | |||
| </if> | |||
| <if test=" null != detail "> | |||
| and `detail` like concat('%', #{detail},'%') | |||
| </if> | |||
| <if test=" null != price "> | |||
| and `price` = #{price} | |||
| <if test=" null != sendType "> | |||
| and `send_type` = #{sendType} | |||
| </if> | |||
| <if test=" null != salePrice "> | |||
| and `sale_price` = #{salePrice} | |||
| <if test=" null != targetAd "> | |||
| and `target_ad` = #{targetAd} | |||
| </if> | |||
| <if test=" null != usePrice "> | |||
| and `use_price` = #{usePrice} | |||
| <if test=" null != businesses "> | |||
| and `businesses` like concat('%', #{businesses},'%') | |||
| </if> | |||
| <if test=" null != price "> | |||
| and `price` = #{price} | |||
| </if> | |||
| <if test=" null != number "> | |||
| and `number` = #{number} | |||
| </if> | |||
| <if test=" null != business "> | |||
| and `business` like concat('%', #{business},'%') | |||
| <if test=" null != total "> | |||
| and `total` = #{total} | |||
| </if> | |||
| @@ -0,0 +1,86 @@ | |||
| <?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.simple.mapper.WxCouponSendMapper"> | |||
| <resultMap id="BaseResultMap" type="com.simple.domain.po.WxCouponSend"> | |||
| <id column="id" jdbcType="BIGINT" property="id" /> | |||
| <result column="tenant_id" jdbcType="VARCHAR" property="tenantId" /> | |||
| <result column="merchant_id" jdbcType="BIGINT" property="merchantId" /> | |||
| <result column="coupon_id" jdbcType="BIGINT" property="couponId" /> | |||
| <result column="type" jdbcType="INTEGER" property="type" /> | |||
| <result column="title" jdbcType="VARCHAR" property="title" /> | |||
| <result column="send_type" jdbcType="INTEGER" property="sendType" /> | |||
| <result column="create_date" jdbcType="TIMESTAMP" property="createDate" /> | |||
| <result column="update_date" jdbcType="TIMESTAMP" property="updateDate" /> | |||
| </resultMap> | |||
| <sql id="allColumns"> | |||
| `id`,`tenant_id`,`merchant_id`,`coupon_id`,`type`,`title`,`send_type`,`create_date`,`update_date` | |||
| </sql> | |||
| <sql id="dynamicWhereConditions"> | |||
| where 1 = 1 | |||
| <if test=" null != id "> | |||
| and `id` = #{id} | |||
| </if> | |||
| <if test=" null != tenantId "> | |||
| and `tenant_id` like concat('%', #{tenantId},'%') | |||
| </if> | |||
| <if test=" null != merchantId "> | |||
| and `merchant_id` = #{merchantId} | |||
| </if> | |||
| <if test=" null != couponId "> | |||
| and `coupon_id` = #{couponId} | |||
| </if> | |||
| <if test=" null != type "> | |||
| and `type` = #{type} | |||
| </if> | |||
| <if test=" null != title "> | |||
| and `title` like concat('%', #{title},'%') | |||
| </if> | |||
| <if test=" null != sendType "> | |||
| and `send_type` = #{sendType} | |||
| </if> | |||
| <if test=" null != createDate "> | |||
| and `create_date` = #{createDate} | |||
| </if> | |||
| <if test=" null != updateDate "> | |||
| and `update_date` = #{updateDate} | |||
| </if> | |||
| <if test=" null != ids "> | |||
| and id in | |||
| <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")"> | |||
| #{idItem} | |||
| </foreach> | |||
| </if> | |||
| <if test=" null != sortColumns"> order by ${sortColumns} </if> | |||
| </sql> | |||
| <select id="findList" parameterType="com.simple.domain.po.WxCouponSend" resultMap="BaseResultMap"> | |||
| select <include refid="allColumns" /> from wx_coupon_send | |||
| <include refid="dynamicWhereConditions" /> | |||
| </select> | |||
| </mapper> | |||
| @@ -0,0 +1,86 @@ | |||
| <?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.simple.mapper.WxCouponTargetMapper"> | |||
| <resultMap id="BaseResultMap" type="com.simple.domain.po.WxCouponTarget"> | |||
| <id column="id" jdbcType="BIGINT" property="id" /> | |||
| <result column="tenant_id" jdbcType="VARCHAR" property="tenantId" /> | |||
| <result column="merchant_id" jdbcType="BIGINT" property="merchantId" /> | |||
| <result column="coupon_id" jdbcType="BIGINT" property="couponId" /> | |||
| <result column="type" jdbcType="INTEGER" property="type" /> | |||
| <result column="title" jdbcType="VARCHAR" property="title" /> | |||
| <result column="target_ad" jdbcType="INTEGER" property="targetAd" /> | |||
| <result column="create_date" jdbcType="TIMESTAMP" property="createDate" /> | |||
| <result column="update_date" jdbcType="TIMESTAMP" property="updateDate" /> | |||
| </resultMap> | |||
| <sql id="allColumns"> | |||
| `id`,`tenant_id`,`merchant_id`,`coupon_id`,`type`,`title`,`target_ad`,`create_date`,`update_date` | |||
| </sql> | |||
| <sql id="dynamicWhereConditions"> | |||
| where 1 = 1 | |||
| <if test=" null != id "> | |||
| and `id` = #{id} | |||
| </if> | |||
| <if test=" null != tenantId "> | |||
| and `tenant_id` like concat('%', #{tenantId},'%') | |||
| </if> | |||
| <if test=" null != merchantId "> | |||
| and `merchant_id` = #{merchantId} | |||
| </if> | |||
| <if test=" null != couponId "> | |||
| and `coupon_id` = #{couponId} | |||
| </if> | |||
| <if test=" null != type "> | |||
| and `type` = #{type} | |||
| </if> | |||
| <if test=" null != title "> | |||
| and `title` like concat('%', #{title},'%') | |||
| </if> | |||
| <if test=" null != targetAd "> | |||
| and `target_ad` = #{targetAd} | |||
| </if> | |||
| <if test=" null != createDate "> | |||
| and `create_date` = #{createDate} | |||
| </if> | |||
| <if test=" null != updateDate "> | |||
| and `update_date` = #{updateDate} | |||
| </if> | |||
| <if test=" null != ids "> | |||
| and id in | |||
| <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")"> | |||
| #{idItem} | |||
| </foreach> | |||
| </if> | |||
| <if test=" null != sortColumns"> order by ${sortColumns} </if> | |||
| </sql> | |||
| <select id="findList" parameterType="com.simple.domain.po.WxCouponTarget" resultMap="BaseResultMap"> | |||
| select <include refid="allColumns" /> from wx_coupon_target | |||
| <include refid="dynamicWhereConditions" /> | |||
| </select> | |||
| </mapper> | |||
| @@ -9,11 +9,10 @@ | |||
| <result column="link_phone" jdbcType="VARCHAR" property="linkPhone" /> | |||
| <result column="bank_card" jdbcType="VARCHAR" property="bankCard" /> | |||
| <result column="bank_name" jdbcType="VARCHAR" property="bankName" /> | |||
| <result column="merchant_id" jdbcType="VARCHAR" property="merchantId" /> | |||
| </resultMap> | |||
| <sql id="allColumns"> | |||
| `id`,`tenant_id`,`img_url`,`name`,`link_phone`,`bank_card`,`bank_name`,`merchant_id` | |||
| `id`,`tenant_id`,`img_url`,`name`,`link_phone`,`bank_card`,`bank_name` | |||
| </sql> | |||
| <sql id="dynamicWhereConditions"> | |||
| @@ -53,11 +52,7 @@ | |||
| and `bank_name` like concat('%', #{bankName},'%') | |||
| </if> | |||
| <if test=" null != merchantId "> | |||
| and `merchant_id` like concat('%', #{merchantId},'%') | |||
| </if> | |||
| <if test=" null != ids "> | |||
| and id in | |||
| <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")"> | |||