feat:用户商户

This commit is contained in:
dzc committed 2025-03-28 15:40:06 +08:00
1 parent c281382a86
commit c07a3b66ae
8 files changed
+275

No files matched your search

@@ -0,0 +1,9 @@
package com.bsd.pjcloud.wallet.api.dto.mch;
import com.bsd.pjcloud.wallet.api.entity.mch.MchDeptUserEntity;
import lombok.Data;
@Data
public class MchDeptUserDto extends MchDeptUserEntity {
}
@@ -0,0 +1,91 @@
package com.bsd.pjcloud.wallet.api.entity.mch;
import com.baomidou.mybatisplus.annotation.*;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import com.bsd.pjcloud.common.core.util.TenantTable;
import java.time.LocalDateTime;
/**
* 用户部门商户关系表
*
* @author pjcloud
* @date 2025-03-28 15:28:00
*/
@Data
@TenantTable
@TableName("mch_dept_user")
@EqualsAndHashCode(callSuper = true)
@Schema(description = "用户部门商户关系表")
public class MchDeptUserEntity extends Model<MchDeptUserEntity> {
/**
* 主键
*/
@TableId(type = IdType.ASSIGN_ID)
@Schema(description="主键")
private Long id;
/**
* 商户id
*/
@Schema(description="商户id")
private Long mchId;
/**
* 用户id
*/
@Schema(description="用户id")
private Long userId;
/**
* 用户部门id
*/
@Schema(description="用户部门id")
private Long userDeptId;
/**
* 创建人
*/
@TableField(fill = FieldFill.INSERT)
@Schema(description="创建人")
private String createBy;
/**
* 创建时间
*/
@TableField(fill = FieldFill.INSERT)
@Schema(description="创建时间")
private LocalDateTime createTime;
/**
* 修改人
*/
@TableField(fill = FieldFill.INSERT_UPDATE)
@Schema(description="修改人")
private String updateBy;
/**
* 修改时间
*/
@TableField(fill = FieldFill.INSERT_UPDATE)
@Schema(description="修改时间")
private LocalDateTime updateTime;
/**
* 删除标记
*/
@TableLogic
@TableField(fill = FieldFill.INSERT)
@Schema(description="删除标记")
private String delFlag;
/**
* 租户ID
*/
@Schema(description="租户ID")
private Long tenantId;
}
@@ -0,0 +1,9 @@
package com.bsd.pjcloud.wallet.api.vo.mch;
import com.bsd.pjcloud.wallet.api.entity.mch.MchDeptUserEntity;
import lombok.Data;
@Data
public class MchDeptUserVo extends MchDeptUserEntity {
}
@@ -0,0 +1,116 @@
package com.bsd.pjcloud.wallet.controller.mch;
import cn.hutool.core.util.ArrayUtil;
import cn.hutool.core.collection.CollUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.bsd.pjcloud.common.core.util.R;
import com.bsd.pjcloud.common.log.annotation.SysLog;
import com.bsd.pjcloud.wallet.api.entity.mch.MchDeptUserEntity;
import com.bsd.pjcloud.wallet.service.MchDeptUserService;
import org.springframework.security.access.prepost.PreAuthorize;
import com.bsd.pjcloud.common.excel.annotation.ResponseExcel;
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
import org.springdoc.core.annotations.ParameterObject;
import org.springframework.http.HttpHeaders;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Operation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import java.util.Objects;
/**
* 用户部门商户关系表
*/
@RestController
@RequiredArgsConstructor
@RequestMapping("/mchDeptUser" )
@Tag(description = "mchDeptUser" , name = "用户部门商户关系表管理" )
@SecurityRequirement(name = HttpHeaders.AUTHORIZATION)
public class MchDeptUserController {
private final MchDeptUserService mchDeptUserService;
/**
* 分页查询
* @param page 分页对象
* @param mchDeptUser 用户部门商户关系表
* @return
*/
@Operation(summary = "分页查询" , description = "分页查询" )
@GetMapping("/page" )
@PreAuthorize("@pms.hasPermission('wallet_mchDeptUser_view')" )
public R getMchDeptUserPage(@ParameterObject Page page, @ParameterObject MchDeptUserEntity mchDeptUser) {
LambdaQueryWrapper<MchDeptUserEntity> wrapper = Wrappers.lambdaQuery();
return R.ok(mchDeptUserService.page(page, wrapper));
}
/**
* 通过id查询用户部门商户关系表
* @param id id
* @return R
*/
@Operation(summary = "通过id查询" , description = "通过id查询" )
@GetMapping("/{id}" )
@PreAuthorize("@pms.hasPermission('wallet_mchDeptUser_view')" )
public R getById(@PathVariable("id" ) Long id) {
return R.ok(mchDeptUserService.getById(id));
}
/**
* 新增用户部门商户关系表
* @param mchDeptUser 用户部门商户关系表
* @return R
*/
@Operation(summary = "新增用户部门商户关系表" , description = "新增用户部门商户关系表" )
@SysLog("新增用户部门商户关系表" )
@PostMapping
@PreAuthorize("@pms.hasPermission('wallet_mchDeptUser_add')" )
public R save(@RequestBody MchDeptUserEntity mchDeptUser) {
return R.ok(mchDeptUserService.save(mchDeptUser));
}
/**
* 修改用户部门商户关系表
* @param mchDeptUser 用户部门商户关系表
* @return R
*/
@Operation(summary = "修改用户部门商户关系表" , description = "修改用户部门商户关系表" )
@SysLog("修改用户部门商户关系表" )
@PutMapping
@PreAuthorize("@pms.hasPermission('wallet_mchDeptUser_edit')" )
public R updateById(@RequestBody MchDeptUserEntity mchDeptUser) {
return R.ok(mchDeptUserService.updateById(mchDeptUser));
}
/**
* 通过id删除用户部门商户关系表
* @param ids id列表
* @return R
*/
@Operation(summary = "通过id删除用户部门商户关系表" , description = "通过id删除用户部门商户关系表" )
@SysLog("通过id删除用户部门商户关系表" )
@DeleteMapping
@PreAuthorize("@pms.hasPermission('wallet_mchDeptUser_del')" )
public R removeById(@RequestBody Long[] ids) {
return R.ok(mchDeptUserService.removeBatchByIds(CollUtil.toList(ids)));
}
/**
* 导出excel 表格
* @param mchDeptUser 查询条件
* @param ids 导出指定ID
* @return excel 文件流
*/
@ResponseExcel
@GetMapping("/export")
@PreAuthorize("@pms.hasPermission('wallet_mchDeptUser_export')" )
public List<MchDeptUserEntity> export(MchDeptUserEntity mchDeptUser,Long[] ids) {
return mchDeptUserService.list(Wrappers.lambdaQuery(mchDeptUser).in(ArrayUtil.isNotEmpty(ids), MchDeptUserEntity::getId, ids));
}
}
@@ -0,0 +1,11 @@
package com.bsd.pjcloud.wallet.mapper.mch;
import com.bsd.pjcloud.common.data.datascope.PjcloudBaseMapper;
import com.bsd.pjcloud.wallet.api.entity.mch.MchDeptUserEntity;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface MchDeptUserMapper extends PjcloudBaseMapper<MchDeptUserEntity> {
}
@@ -0,0 +1,8 @@
package com.bsd.pjcloud.wallet.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.bsd.pjcloud.wallet.api.entity.mch.MchDeptUserEntity;
public interface MchDeptUserService extends IService<MchDeptUserEntity> {
}
@@ -0,0 +1,13 @@
package com.bsd.pjcloud.wallet.service.impl.mch;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.bsd.pjcloud.wallet.api.entity.mch.MchDeptUserEntity;
import com.bsd.pjcloud.wallet.mapper.mch.MchDeptUserMapper;
import com.bsd.pjcloud.wallet.service.MchDeptUserService;
import org.springframework.stereotype.Service;
/**
* 用户部门商户关系表
*/
@Service
public class MchDeptUserServiceImpl extends ServiceImpl<MchDeptUserMapper, MchDeptUserEntity> implements MchDeptUserService {
}
@@ -0,0 +1,18 @@
<?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.bsd.pjcloud.wallet.mapper.mch.MchDeptUserMapper">
<resultMap id="mchDeptUserMap" type="com.bsd.pjcloud.wallet.api.entity.mch.MchDeptUserEntity">
<id property="id" column="id"/>
<result property="mchId" column="mch_id"/>
<result property="userId" column="user_id"/>
<result property="userDeptId" column="user_dept_id"/>
<result property="createBy" column="create_by"/>
<result property="createTime" column="create_time"/>
<result property="updateBy" column="update_by"/>
<result property="updateTime" column="update_time"/>
<result property="delFlag" column="del_flag"/>
<result property="tenantId" column="tenant_id"/>
</resultMap>
</mapper>