From fe4b228fcc11defe951b4ca4edf16cc91b307a9e Mon Sep 17 00:00:00 2001 From: xin <1099200748@qq.com> Date: Mon, 16 Jun 2025 20:54:31 +0800 Subject: [PATCH] 门店管理列表、商户管理列表 --- oying-system/src/main/java/com/oying/modules/system/rest/UserMerchantController.java | 73 ++++++ oying-system/src/main/java/com/oying/modules/system/service/impl/UserMerchantServiceImpl.java | 78 ++++++ oying-system/src/main/java/com/oying/modules/system/domain/dto/UserStoreQueryCriteria.java | 27 ++ oying-system/src/main/java/com/oying/modules/system/mapper/UserMerchantMapper.java | 22 + oying-system/src/main/resources/config/application.yml | 2 oying-system/src/main/java/com/oying/modules/system/domain/UserMerchant.java | 42 +++ oying-system/src/main/java/com/oying/modules/system/mapper/UserStoreMapper.java | 22 + oying-system/src/main/java/com/oying/modules/system/rest/UserStoreController.java | 73 ++++++ oying-system/src/main/java/com/oying/modules/system/service/UserStoreService.java | 59 ++++ oying-system/src/main/java/com/oying/modules/system/service/impl/UserStoreServiceImpl.java | 78 ++++++ oying-system/src/main/resources/mapper/system/UserStoreMapper.xml | 36 +++ oying-system/src/main/java/com/oying/modules/system/domain/UserStore.java | 42 +++ oying-system/src/main/java/com/oying/modules/system/domain/dto/UserMerchantQueryCriteria.java | 27 ++ oying-system/src/main/resources/mapper/system/UserMerchantMapper.xml | 36 +++ oying-system/src/main/java/com/oying/modules/system/service/UserMerchantService.java | 59 ++++ 15 files changed, 675 insertions(+), 1 deletions(-) diff --git a/oying-system/src/main/java/com/oying/modules/system/domain/UserMerchant.java b/oying-system/src/main/java/com/oying/modules/system/domain/UserMerchant.java new file mode 100644 index 0000000..3bcd226 --- /dev/null +++ b/oying-system/src/main/java/com/oying/modules/system/domain/UserMerchant.java @@ -0,0 +1,42 @@ +package com.oying.modules.system.domain; + +import cn.hutool.core.bean.BeanUtil; +import com.oying.base.BaseEntity; +import io.swagger.annotations.ApiModelProperty; +import cn.hutool.core.bean.copier.CopyOptions; +import javax.validation.constraints.NotBlank; +import java.io.Serializable; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Getter; +import lombok.Setter; + +/** +* @description / +* @author lixin +* @date 2025-06-16 +**/ +@Getter +@Setter +@TableName("sys_user_merchant") +public class UserMerchant extends BaseEntity implements Serializable { + + @TableId(value = "merchant_id") + @ApiModelProperty(value = "商户id") + private Long merchantId; + + @TableId(value = "user_id") + @ApiModelProperty(value = "用户id") + private Long userId; + + @NotBlank + @ApiModelProperty(value = "角色类型(OWNER、ADMIN、FINANCE、OPERATOR)") + private String roleType; + + @ApiModelProperty(value = "权限集(备用)") + private String permissions; + + public void copy(UserMerchant source){ + BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); + } +} diff --git a/oying-system/src/main/java/com/oying/modules/system/domain/UserStore.java b/oying-system/src/main/java/com/oying/modules/system/domain/UserStore.java new file mode 100644 index 0000000..d7d1af7 --- /dev/null +++ b/oying-system/src/main/java/com/oying/modules/system/domain/UserStore.java @@ -0,0 +1,42 @@ +package com.oying.modules.system.domain; + +import com.oying.base.BaseEntity; +import cn.hutool.core.bean.BeanUtil; +import io.swagger.annotations.ApiModelProperty; +import cn.hutool.core.bean.copier.CopyOptions; +import javax.validation.constraints.NotBlank; +import java.io.Serializable; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Getter; +import lombok.Setter; + +/** +* @description / +* @author lixin +* @date 2025-06-16 +**/ +@Getter +@Setter +@TableName("sys_user_store") +public class UserStore extends BaseEntity implements Serializable { + + @TableId(value = "store_id") + @ApiModelProperty(value = "门店id") + private Long storeId; + + @TableId(value = "user_id") + @ApiModelProperty(value = "用户id") + private Long userId; + + @NotBlank + @ApiModelProperty(value = "角色类型") + private String roleType; + + @ApiModelProperty(value = "权限集(备用)") + private String permissions; + + public void copy(UserStore source){ + BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); + } +} diff --git a/oying-system/src/main/java/com/oying/modules/system/domain/dto/UserMerchantQueryCriteria.java b/oying-system/src/main/java/com/oying/modules/system/domain/dto/UserMerchantQueryCriteria.java new file mode 100644 index 0000000..615e94d --- /dev/null +++ b/oying-system/src/main/java/com/oying/modules/system/domain/dto/UserMerchantQueryCriteria.java @@ -0,0 +1,27 @@ +package com.oying.modules.system.domain.dto; + +import lombok.Data; +import java.sql.Timestamp; +import java.util.List; +import io.swagger.annotations.ApiModelProperty; + +/** +* @author lixin +* @date 2025-06-16 +**/ +@Data +public class UserMerchantQueryCriteria{ + + @ApiModelProperty(value = "页码", example = "1") + private Integer page = 1; + + @ApiModelProperty(value = "每页数据量", example = "10") + private Integer size = 10; + + @ApiModelProperty(value = "用户id") + private Long userId; + + @ApiModelProperty(value = "角色类型(OWNER、ADMIN、FINANCE、OPERATOR)") + private String roleType; + private List<Timestamp> createTime; +} diff --git a/oying-system/src/main/java/com/oying/modules/system/domain/dto/UserStoreQueryCriteria.java b/oying-system/src/main/java/com/oying/modules/system/domain/dto/UserStoreQueryCriteria.java new file mode 100644 index 0000000..8b194fc --- /dev/null +++ b/oying-system/src/main/java/com/oying/modules/system/domain/dto/UserStoreQueryCriteria.java @@ -0,0 +1,27 @@ +package com.oying.modules.system.domain.dto; + +import lombok.Data; +import java.sql.Timestamp; +import java.util.List; +import io.swagger.annotations.ApiModelProperty; + +/** +* @author lixin +* @date 2025-06-16 +**/ +@Data +public class UserStoreQueryCriteria{ + + @ApiModelProperty(value = "页码", example = "1") + private Integer page = 1; + + @ApiModelProperty(value = "每页数据量", example = "10") + private Integer size = 10; + + @ApiModelProperty(value = "用户id") + private Long userId; + + @ApiModelProperty(value = "角色类型") + private String roleType; + private List<Timestamp> createTime; +} diff --git a/oying-system/src/main/java/com/oying/modules/system/mapper/UserMerchantMapper.java b/oying-system/src/main/java/com/oying/modules/system/mapper/UserMerchantMapper.java new file mode 100644 index 0000000..e663086 --- /dev/null +++ b/oying-system/src/main/java/com/oying/modules/system/mapper/UserMerchantMapper.java @@ -0,0 +1,22 @@ +package com.oying.modules.system.mapper; + +import com.oying.modules.system.domain.UserMerchant; +import com.oying.modules.system.domain.dto.UserMerchantQueryCriteria; +import java.util.List; +import org.apache.ibatis.annotations.Param; +import org.apache.ibatis.annotations.Mapper; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; + +/** +* @author lixin +* @date 2025-06-16 +**/ +@Mapper +public interface UserMerchantMapper extends BaseMapper<UserMerchant> { + + IPage<UserMerchant> findAll(@Param("criteria") UserMerchantQueryCriteria criteria, Page<Object> page); + + List<UserMerchant> findAll(@Param("criteria") UserMerchantQueryCriteria criteria); +} diff --git a/oying-system/src/main/java/com/oying/modules/system/mapper/UserStoreMapper.java b/oying-system/src/main/java/com/oying/modules/system/mapper/UserStoreMapper.java new file mode 100644 index 0000000..acd3ccd --- /dev/null +++ b/oying-system/src/main/java/com/oying/modules/system/mapper/UserStoreMapper.java @@ -0,0 +1,22 @@ +package com.oying.modules.system.mapper; + +import com.oying.modules.system.domain.UserStore; +import com.oying.modules.system.domain.dto.UserStoreQueryCriteria; +import java.util.List; +import org.apache.ibatis.annotations.Param; +import org.apache.ibatis.annotations.Mapper; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; + +/** +* @author lixin +* @date 2025-06-16 +**/ +@Mapper +public interface UserStoreMapper extends BaseMapper<UserStore> { + + IPage<UserStore> findAll(@Param("criteria") UserStoreQueryCriteria criteria, Page<Object> page); + + List<UserStore> findAll(@Param("criteria") UserStoreQueryCriteria criteria); +} diff --git a/oying-system/src/main/java/com/oying/modules/system/rest/UserMerchantController.java b/oying-system/src/main/java/com/oying/modules/system/rest/UserMerchantController.java new file mode 100644 index 0000000..4dd3bc9 --- /dev/null +++ b/oying-system/src/main/java/com/oying/modules/system/rest/UserMerchantController.java @@ -0,0 +1,73 @@ +package com.oying.modules.system.rest; + +import com.oying.annotation.Log; +import com.oying.modules.system.domain.UserMerchant; +import com.oying.modules.system.service.UserMerchantService; +import com.oying.modules.system.domain.dto.UserMerchantQueryCriteria; +import lombok.RequiredArgsConstructor; +import java.util.List; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; +import io.swagger.annotations.*; +import java.io.IOException; +import javax.servlet.http.HttpServletResponse; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.oying.utils.PageResult; + +/** +* @author lixin +* @date 2025-06-16 +**/ +@RestController +@RequiredArgsConstructor +@Api(tags = "系统:商户管理员信息") +@RequestMapping("/api/userMerchant") +public class UserMerchantController { + + private final UserMerchantService userMerchantService; + + @ApiOperation("导出数据") + @GetMapping(value = "/download") + @PreAuthorize("@el.check('userMerchant:list')") + public void exportUserMerchant(HttpServletResponse response, UserMerchantQueryCriteria criteria) throws IOException { + userMerchantService.download(userMerchantService.queryAll(criteria), response); + } + + @GetMapping + @ApiOperation("查询商户管理员信息") + @PreAuthorize("@el.check('userMerchant:list')") + public ResponseEntity<PageResult<UserMerchant>> queryUserMerchant(UserMerchantQueryCriteria criteria){ + Page<Object> page = new Page<>(criteria.getPage(), criteria.getSize()); + return new ResponseEntity<>(userMerchantService.queryAll(criteria,page),HttpStatus.OK); + } + + @PostMapping + @Log("新增商户管理员信息") + @ApiOperation("新增商户管理员信息") + @PreAuthorize("@el.check('userMerchant:add')") + public ResponseEntity<Object> createUserMerchant(@Validated @RequestBody UserMerchant resources){ + userMerchantService.create(resources); + return new ResponseEntity<>(HttpStatus.CREATED); + } + + @PutMapping + @Log("修改商户管理员信息") + @ApiOperation("修改商户管理员信息") + @PreAuthorize("@el.check('userMerchant:edit')") + public ResponseEntity<Object> updateUserMerchant(@Validated @RequestBody UserMerchant resources){ + userMerchantService.update(resources); + return new ResponseEntity<>(HttpStatus.NO_CONTENT); + } + + @DeleteMapping + @Log("删除商户管理员信息") + @ApiOperation("删除商户管理员信息") + @PreAuthorize("@el.check('userMerchant:del')") + public ResponseEntity<Object> deleteUserMerchant(@ApiParam(value = "传ID数组[]") @RequestBody List<Long> ids) { + userMerchantService.deleteAll(ids); + return new ResponseEntity<>(HttpStatus.OK); + } +} diff --git a/oying-system/src/main/java/com/oying/modules/system/rest/UserStoreController.java b/oying-system/src/main/java/com/oying/modules/system/rest/UserStoreController.java new file mode 100644 index 0000000..3fab73c --- /dev/null +++ b/oying-system/src/main/java/com/oying/modules/system/rest/UserStoreController.java @@ -0,0 +1,73 @@ +package com.oying.modules.system.rest; + +import com.oying.annotation.Log; +import com.oying.modules.system.domain.UserStore; +import com.oying.modules.system.service.UserStoreService; +import com.oying.modules.system.domain.dto.UserStoreQueryCriteria; +import lombok.RequiredArgsConstructor; +import java.util.List; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; +import io.swagger.annotations.*; +import java.io.IOException; +import javax.servlet.http.HttpServletResponse; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.oying.utils.PageResult; + +/** +* @author lixin +* @date 2025-06-16 +**/ +@RestController +@RequiredArgsConstructor +@Api(tags = "系统:门店管理信息") +@RequestMapping("/api/userStore") +public class UserStoreController { + + private final UserStoreService userStoreService; + + @ApiOperation("导出数据") + @GetMapping(value = "/download") + @PreAuthorize("@el.check('userStore:list')") + public void exportUserStore(HttpServletResponse response, UserStoreQueryCriteria criteria) throws IOException { + userStoreService.download(userStoreService.queryAll(criteria), response); + } + + @GetMapping + @ApiOperation("查询门店管理信息") + @PreAuthorize("@el.check('userStore:list')") + public ResponseEntity<PageResult<UserStore>> queryUserStore(UserStoreQueryCriteria criteria){ + Page<Object> page = new Page<>(criteria.getPage(), criteria.getSize()); + return new ResponseEntity<>(userStoreService.queryAll(criteria,page),HttpStatus.OK); + } + + @PostMapping + @Log("新增门店管理信息") + @ApiOperation("新增门店管理信息") + @PreAuthorize("@el.check('userStore:add')") + public ResponseEntity<Object> createUserStore(@Validated @RequestBody UserStore resources){ + userStoreService.create(resources); + return new ResponseEntity<>(HttpStatus.CREATED); + } + + @PutMapping + @Log("修改门店管理信息") + @ApiOperation("修改门店管理信息") + @PreAuthorize("@el.check('userStore:edit')") + public ResponseEntity<Object> updateUserStore(@Validated @RequestBody UserStore resources){ + userStoreService.update(resources); + return new ResponseEntity<>(HttpStatus.NO_CONTENT); + } + + @DeleteMapping + @Log("删除门店管理信息") + @ApiOperation("删除门店管理信息") + @PreAuthorize("@el.check('userStore:del')") + public ResponseEntity<Object> deleteUserStore(@ApiParam(value = "传ID数组[]") @RequestBody List<Long> ids) { + userStoreService.deleteAll(ids); + return new ResponseEntity<>(HttpStatus.OK); + } +} diff --git a/oying-system/src/main/java/com/oying/modules/system/service/UserMerchantService.java b/oying-system/src/main/java/com/oying/modules/system/service/UserMerchantService.java new file mode 100644 index 0000000..f491e05 --- /dev/null +++ b/oying-system/src/main/java/com/oying/modules/system/service/UserMerchantService.java @@ -0,0 +1,59 @@ +package com.oying.modules.system.service; + +import com.oying.modules.system.domain.UserMerchant; +import com.oying.modules.system.domain.dto.UserMerchantQueryCriteria; +import java.util.List; +import java.io.IOException; +import javax.servlet.http.HttpServletResponse; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.IService; +import com.oying.utils.PageResult; + +/** +* @description 服务接口 +* @author lixin +* @date 2025-06-16 +**/ +public interface UserMerchantService extends IService<UserMerchant> { + + /** + * 查询数据分页 + * @param criteria 条件 + * @param page 分页参数 + * @return PageResult + */ + PageResult<UserMerchant> queryAll(UserMerchantQueryCriteria criteria, Page<Object> page); + + /** + * 查询所有数据不分页 + * @param criteria 条件参数 + * @return List<UserMerchantDto> + */ + List<UserMerchant> queryAll(UserMerchantQueryCriteria criteria); + + /** + * 创建 + * @param resources / + */ + void create(UserMerchant resources); + + /** + * 编辑 + * @param resources / + */ + void update(UserMerchant resources); + + /** + * 多选删除 + * @param ids / + */ + void deleteAll(List<Long> ids); + + /** + * 导出数据 + * @param all 待导出的数据 + * @param response / + * @throws IOException / + */ + void download(List<UserMerchant> all, HttpServletResponse response) throws IOException; +} diff --git a/oying-system/src/main/java/com/oying/modules/system/service/UserStoreService.java b/oying-system/src/main/java/com/oying/modules/system/service/UserStoreService.java new file mode 100644 index 0000000..8565fbf --- /dev/null +++ b/oying-system/src/main/java/com/oying/modules/system/service/UserStoreService.java @@ -0,0 +1,59 @@ +package com.oying.modules.system.service; + +import com.oying.modules.system.domain.UserStore; +import com.oying.modules.system.domain.dto.UserStoreQueryCriteria; +import java.util.List; +import java.io.IOException; +import javax.servlet.http.HttpServletResponse; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.IService; +import com.oying.utils.PageResult; + +/** +* @description 服务接口 +* @author lixin +* @date 2025-06-16 +**/ +public interface UserStoreService extends IService<UserStore> { + + /** + * 查询数据分页 + * @param criteria 条件 + * @param page 分页参数 + * @return PageResult + */ + PageResult<UserStore> queryAll(UserStoreQueryCriteria criteria, Page<Object> page); + + /** + * 查询所有数据不分页 + * @param criteria 条件参数 + * @return List<UserStoreDto> + */ + List<UserStore> queryAll(UserStoreQueryCriteria criteria); + + /** + * 创建 + * @param resources / + */ + void create(UserStore resources); + + /** + * 编辑 + * @param resources / + */ + void update(UserStore resources); + + /** + * 多选删除 + * @param ids / + */ + void deleteAll(List<Long> ids); + + /** + * 导出数据 + * @param all 待导出的数据 + * @param response / + * @throws IOException / + */ + void download(List<UserStore> all, HttpServletResponse response) throws IOException; +} diff --git a/oying-system/src/main/java/com/oying/modules/system/service/impl/UserMerchantServiceImpl.java b/oying-system/src/main/java/com/oying/modules/system/service/impl/UserMerchantServiceImpl.java new file mode 100644 index 0000000..8962e13 --- /dev/null +++ b/oying-system/src/main/java/com/oying/modules/system/service/impl/UserMerchantServiceImpl.java @@ -0,0 +1,78 @@ +package com.oying.modules.system.service.impl; + +import com.oying.modules.system.domain.UserMerchant; +import com.oying.utils.FileUtil; +import lombok.RequiredArgsConstructor; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.oying.modules.system.service.UserMerchantService; +import com.oying.modules.system.domain.dto.UserMerchantQueryCriteria; +import com.oying.modules.system.mapper.UserMerchantMapper; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import com.oying.utils.PageUtil; +import java.util.List; +import java.util.Map; +import java.io.IOException; +import javax.servlet.http.HttpServletResponse; +import java.util.ArrayList; +import java.util.LinkedHashMap; +import com.oying.utils.PageResult; + +/** +* @description 服务实现 +* @author lixin +* @date 2025-06-16 +**/ +@Service +@RequiredArgsConstructor +public class UserMerchantServiceImpl extends ServiceImpl<UserMerchantMapper, UserMerchant> implements UserMerchantService { + + private final UserMerchantMapper userMerchantMapper; + + @Override + public PageResult<UserMerchant> queryAll(UserMerchantQueryCriteria criteria, Page<Object> page){ + return PageUtil.toPage(userMerchantMapper.findAll(criteria, page)); + } + + @Override + public List<UserMerchant> queryAll(UserMerchantQueryCriteria criteria){ + return userMerchantMapper.findAll(criteria); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void create(UserMerchant resources) { + userMerchantMapper.insert(resources); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(UserMerchant resources) { + UserMerchant userMerchant = getById(resources.getUserId()); + userMerchant.copy(resources); + userMerchantMapper.updateById(userMerchant); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void deleteAll(List<Long> ids) { + userMerchantMapper.deleteBatchIds(ids); + } + + @Override + public void download(List<UserMerchant> all, HttpServletResponse response) throws IOException { + List<Map<String, Object>> list = new ArrayList<>(); + for (UserMerchant userMerchant : all) { + Map<String, Object> map = new LinkedHashMap<>(); + map.put("角色类型(OWNER、ADMIN、FINANCE、OPERATOR)", userMerchant.getRoleType()); + map.put("权限集(备用)", userMerchant.getPermissions()); + map.put("创建者", userMerchant.getCreateBy()); + map.put("创建时间", userMerchant.getCreateTime()); + map.put("更新者", userMerchant.getUpdateBy()); + map.put("更新时间", userMerchant.getUpdateTime()); + list.add(map); + } + FileUtil.downloadExcel(list, response); + } +} diff --git a/oying-system/src/main/java/com/oying/modules/system/service/impl/UserStoreServiceImpl.java b/oying-system/src/main/java/com/oying/modules/system/service/impl/UserStoreServiceImpl.java new file mode 100644 index 0000000..2bbbc29 --- /dev/null +++ b/oying-system/src/main/java/com/oying/modules/system/service/impl/UserStoreServiceImpl.java @@ -0,0 +1,78 @@ +package com.oying.modules.system.service.impl; + +import com.oying.modules.system.domain.UserStore; +import com.oying.utils.FileUtil; +import lombok.RequiredArgsConstructor; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.oying.modules.system.service.UserStoreService; +import com.oying.modules.system.domain.dto.UserStoreQueryCriteria; +import com.oying.modules.system.mapper.UserStoreMapper; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import com.oying.utils.PageUtil; +import java.util.List; +import java.util.Map; +import java.io.IOException; +import javax.servlet.http.HttpServletResponse; +import java.util.ArrayList; +import java.util.LinkedHashMap; +import com.oying.utils.PageResult; + +/** +* @description 服务实现 +* @author lixin +* @date 2025-06-16 +**/ +@Service +@RequiredArgsConstructor +public class UserStoreServiceImpl extends ServiceImpl<UserStoreMapper, UserStore> implements UserStoreService { + + private final UserStoreMapper userStoreMapper; + + @Override + public PageResult<UserStore> queryAll(UserStoreQueryCriteria criteria, Page<Object> page){ + return PageUtil.toPage(userStoreMapper.findAll(criteria, page)); + } + + @Override + public List<UserStore> queryAll(UserStoreQueryCriteria criteria){ + return userStoreMapper.findAll(criteria); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void create(UserStore resources) { + userStoreMapper.insert(resources); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(UserStore resources) { + UserStore userStore = getById(resources.getUserId()); + userStore.copy(resources); + userStoreMapper.updateById(userStore); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void deleteAll(List<Long> ids) { + userStoreMapper.deleteBatchIds(ids); + } + + @Override + public void download(List<UserStore> all, HttpServletResponse response) throws IOException { + List<Map<String, Object>> list = new ArrayList<>(); + for (UserStore userStore : all) { + Map<String, Object> map = new LinkedHashMap<>(); + map.put("角色类型", userStore.getRoleType()); + map.put("权限集(备用)", userStore.getPermissions()); + map.put("创建者", userStore.getCreateBy()); + map.put("创建时间", userStore.getCreateTime()); + map.put("更新者", userStore.getUpdateBy()); + map.put("更新时间", userStore.getUpdateTime()); + list.add(map); + } + FileUtil.downloadExcel(list, response); + } +} diff --git a/oying-system/src/main/resources/config/application.yml b/oying-system/src/main/resources/config/application.yml index b916632..3813cb4 100644 --- a/oying-system/src/main/resources/config/application.yml +++ b/oying-system/src/main/resources/config/application.yml @@ -1,5 +1,5 @@ server: - port: 8000 + port: 8088 http2: # 启用 HTTP/2 支持,提升传输效率 enabled: true diff --git a/oying-system/src/main/resources/mapper/system/UserMerchantMapper.xml b/oying-system/src/main/resources/mapper/system/UserMerchantMapper.xml new file mode 100644 index 0000000..b820327 --- /dev/null +++ b/oying-system/src/main/resources/mapper/system/UserMerchantMapper.xml @@ -0,0 +1,36 @@ +<?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.oying.modules.system.mapper.UserMerchantMapper"> + <resultMap id="BaseResultMap" type="com.oying.modules.system.domain.UserMerchant"> + <id column="merchant_id" property="merchantId"/> + <id column="user_id" property="userId"/> + <result column="role_type" property="roleType"/> + <result column="permissions" property="permissions"/> + <result column="create_by" property="createBy"/> + <result column="create_time" property="createTime"/> + <result column="update_by" property="updateBy"/> + <result column="update_time" property="updateTime"/> + </resultMap> + + <sql id="Base_Column_List"> + merchant_id, user_id, role_type, permissions, create_by, create_time, update_by, update_time + </sql> + + <select id="findAll" resultMap="BaseResultMap"> + select + <include refid="Base_Column_List"/> + from sys_user_merchant + <where> + <if test="criteria.userId != null"> + and user_id = #{criteria.userId} + </if> + <if test="criteria.roleType != null"> + and role_type = #{criteria.roleType} + </if> + <if test="criteria.createTime != null and criteria.createTime.size() > 0"> + AND create_time BETWEEN #{criteria.createTime[0]} AND #{criteria.createTime[1]} + </if> + </where> + order by user_id desc + </select> +</mapper> \ No newline at end of file diff --git a/oying-system/src/main/resources/mapper/system/UserStoreMapper.xml b/oying-system/src/main/resources/mapper/system/UserStoreMapper.xml new file mode 100644 index 0000000..7e80085 --- /dev/null +++ b/oying-system/src/main/resources/mapper/system/UserStoreMapper.xml @@ -0,0 +1,36 @@ +<?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.oying.modules.system.mapper.UserStoreMapper"> + <resultMap id="BaseResultMap" type="com.oying.modules.system.domain.UserStore"> + <id column="store_id" property="storeId"/> + <id column="user_id" property="userId"/> + <result column="role_type" property="roleType"/> + <result column="permissions" property="permissions"/> + <result column="create_by" property="createBy"/> + <result column="create_time" property="createTime"/> + <result column="update_by" property="updateBy"/> + <result column="update_time" property="updateTime"/> + </resultMap> + + <sql id="Base_Column_List"> + store_id, user_id, role_type, permissions, create_by, create_time, update_by, update_time + </sql> + + <select id="findAll" resultMap="BaseResultMap"> + select + <include refid="Base_Column_List"/> + from sys_user_store + <where> + <if test="criteria.userId != null"> + and user_id = #{criteria.userId} + </if> + <if test="criteria.roleType != null"> + and role_type = #{criteria.roleType} + </if> + <if test="criteria.createTime != null and criteria.createTime.size() > 0"> + AND create_time BETWEEN #{criteria.createTime[0]} AND #{criteria.createTime[1]} + </if> + </where> + order by user_id desc + </select> +</mapper> \ No newline at end of file -- Gitblit v1.9.3