feat(sys): 添加系统公告模块并优化租户信息获取
- 新增系统公告相关接口、控制器、服务、Mapper和XML文件 - 修改租户信息获取逻辑,按币种获取平台信息 -优化租户白名单相关接口,移除权限控制main-p
parent
f4be0750f5
commit
53d0edef5d
|
@ -19,6 +19,16 @@ public interface TenantPlatformMapper
|
|||
*/
|
||||
TenantPlatform selectTenantPlatformById(Long id);
|
||||
|
||||
|
||||
/**
|
||||
* 按租户id选择货币代码
|
||||
*
|
||||
* @param tenantId 租户id
|
||||
* @return {@link List }<{@link String }>
|
||||
*/
|
||||
List<String> selectCurrencyCodeByTenantId(Long tenantId);
|
||||
|
||||
|
||||
/**
|
||||
* 查询租户成本管理列表
|
||||
*
|
||||
|
|
|
@ -27,6 +27,14 @@ public interface ITenantPlatformService
|
|||
*/
|
||||
List<TenantPlatform> selectTenantPlatformList(TenantPlatform tenantPlatform);
|
||||
|
||||
/**
|
||||
* 按租户id选择货币代码
|
||||
*
|
||||
* @param tenantId 租户id
|
||||
* @return {@link List }<{@link String }>
|
||||
*/
|
||||
List<String> selectCurrencyCodeByTenantId(Long tenantId);
|
||||
|
||||
/**
|
||||
* 新增租户成本管理
|
||||
*
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package com.ff.base.system.service.impl;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import com.ff.base.utils.DateUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
@ -46,6 +47,17 @@ public class TenantPlatformServiceImpl implements ITenantPlatformService
|
|||
return tenantPlatformMapper.selectTenantPlatformList(tenantPlatform);
|
||||
}
|
||||
|
||||
/**
|
||||
* 按租户id选择货币代码
|
||||
*
|
||||
* @param tenantId 租户id
|
||||
* @return {@link List }<{@link String }>
|
||||
*/
|
||||
@Override
|
||||
public List<String> selectCurrencyCodeByTenantId(Long tenantId) {
|
||||
return tenantPlatformMapper.selectCurrencyCodeByTenantId(tenantId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增租户成本管理
|
||||
*
|
||||
|
|
|
@ -37,6 +37,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<select id="selectCurrencyCodeByTenantId" >
|
||||
select currency_code from ff_tenant_platform
|
||||
|
||||
where tenant_id = #{tenantId} group by currency_code
|
||||
</select>
|
||||
|
||||
<insert id="insertTenantPlatform" parameterType="TenantPlatform">
|
||||
insert into ff_tenant_platform
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
|
|
|
@ -0,0 +1,93 @@
|
|||
package com.ff.sys.controller;
|
||||
|
||||
import java.util.List;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.ff.base.annotation.Log;
|
||||
import com.ff.base.core.controller.BaseController;
|
||||
import com.ff.base.core.domain.AjaxResult;
|
||||
import com.ff.base.enums.BusinessType;
|
||||
import com.ff.sys.domain.SysNotice;
|
||||
import com.ff.sys.service.ISysNoticeService;
|
||||
import com.ff.base.utils.poi.ExcelUtil;
|
||||
import com.ff.base.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 系统公告Controller
|
||||
*
|
||||
* @author shi
|
||||
* @date 2025-02-28
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/sys/notice")
|
||||
public class SysNoticeController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private ISysNoticeService sysNoticeService;
|
||||
|
||||
/**
|
||||
* 查询系统公告列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('sys:notice:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(SysNotice sysNotice)
|
||||
{
|
||||
startPage();
|
||||
List<SysNotice> list = sysNoticeService.selectSysNoticeList(sysNotice);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 获取系统公告详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('sys:notice:query')")
|
||||
@GetMapping(value = "/{id}")
|
||||
public AjaxResult getInfo(@PathVariable("id") Long id)
|
||||
{
|
||||
return success(sysNoticeService.selectSysNoticeById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增系统公告
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('sys:notice:add')")
|
||||
@Log(title = "系统公告", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody SysNotice sysNotice)
|
||||
{
|
||||
return toAjax(sysNoticeService.insertSysNotice(sysNotice));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改系统公告
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('sys:notice:edit')")
|
||||
@Log(title = "系统公告", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody SysNotice sysNotice)
|
||||
{
|
||||
return toAjax(sysNoticeService.updateSysNotice(sysNotice));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除系统公告
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('sys:notice:remove')")
|
||||
@Log(title = "系统公告", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public AjaxResult remove(@PathVariable Long[] ids)
|
||||
{
|
||||
return toAjax(sysNoticeService.deleteSysNoticeByIds(ids));
|
||||
}
|
||||
}
|
|
@ -0,0 +1,29 @@
|
|||
package com.ff.sys.domain;
|
||||
|
||||
import com.ff.base.annotation.Excel;
|
||||
import com.ff.base.core.domain.BaseEntity;
|
||||
import lombok.Data;
|
||||
/**
|
||||
* 系统公告对象 ff_sys_notice
|
||||
*
|
||||
* @author shi
|
||||
* @date 2025-02-28
|
||||
*/
|
||||
@Data
|
||||
public class SysNotice extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** $column.columnComment */
|
||||
private Long id;
|
||||
|
||||
/** 标题 */
|
||||
@Excel(name = "标题")
|
||||
private String title;
|
||||
|
||||
/** 内容 */
|
||||
@Excel(name = "内容")
|
||||
private String content;
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,61 @@
|
|||
package com.ff.sys.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import com.ff.sys.domain.SysNotice;
|
||||
|
||||
/**
|
||||
* 系统公告Mapper接口
|
||||
*
|
||||
* @author shi
|
||||
* @date 2025-02-28
|
||||
*/
|
||||
public interface SysNoticeMapper
|
||||
{
|
||||
/**
|
||||
* 查询系统公告
|
||||
*
|
||||
* @param id 系统公告主键
|
||||
* @return 系统公告
|
||||
*/
|
||||
SysNotice selectSysNoticeById(Long id);
|
||||
|
||||
/**
|
||||
* 查询系统公告列表
|
||||
*
|
||||
* @param sysNotice 系统公告
|
||||
* @return 系统公告集合
|
||||
*/
|
||||
List<SysNotice> selectSysNoticeList(SysNotice sysNotice);
|
||||
|
||||
/**
|
||||
* 新增系统公告
|
||||
*
|
||||
* @param sysNotice 系统公告
|
||||
* @return 结果
|
||||
*/
|
||||
int insertSysNotice(SysNotice sysNotice);
|
||||
|
||||
/**
|
||||
* 修改系统公告
|
||||
*
|
||||
* @param sysNotice 系统公告
|
||||
* @return 结果
|
||||
*/
|
||||
int updateSysNotice(SysNotice sysNotice);
|
||||
|
||||
/**
|
||||
* 删除系统公告
|
||||
*
|
||||
* @param id 系统公告主键
|
||||
* @return 结果
|
||||
*/
|
||||
int deleteSysNoticeById(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除系统公告
|
||||
*
|
||||
* @param ids 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
int deleteSysNoticeByIds(Long[] ids);
|
||||
}
|
|
@ -0,0 +1,61 @@
|
|||
package com.ff.sys.service;
|
||||
|
||||
import java.util.List;
|
||||
import com.ff.sys.domain.SysNotice;
|
||||
|
||||
/**
|
||||
* 系统公告Service接口
|
||||
*
|
||||
* @author shi
|
||||
* @date 2025-02-28
|
||||
*/
|
||||
public interface ISysNoticeService
|
||||
{
|
||||
/**
|
||||
* 查询系统公告
|
||||
*
|
||||
* @param id 系统公告主键
|
||||
* @return 系统公告
|
||||
*/
|
||||
SysNotice selectSysNoticeById(Long id);
|
||||
|
||||
/**
|
||||
* 查询系统公告列表
|
||||
*
|
||||
* @param sysNotice 系统公告
|
||||
* @return 系统公告集合
|
||||
*/
|
||||
List<SysNotice> selectSysNoticeList(SysNotice sysNotice);
|
||||
|
||||
/**
|
||||
* 新增系统公告
|
||||
*
|
||||
* @param sysNotice 系统公告
|
||||
* @return 结果
|
||||
*/
|
||||
int insertSysNotice(SysNotice sysNotice);
|
||||
|
||||
/**
|
||||
* 修改系统公告
|
||||
*
|
||||
* @param sysNotice 系统公告
|
||||
* @return 结果
|
||||
*/
|
||||
int updateSysNotice(SysNotice sysNotice);
|
||||
|
||||
/**
|
||||
* 批量删除系统公告
|
||||
*
|
||||
* @param ids 需要删除的系统公告主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
int deleteSysNoticeByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 删除系统公告信息
|
||||
*
|
||||
* @param id 系统公告主键
|
||||
* @return 结果
|
||||
*/
|
||||
int deleteSysNoticeById(Long id);
|
||||
}
|
|
@ -0,0 +1,99 @@
|
|||
package com.ff.sys.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
import com.ff.base.utils.DateUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.ff.sys.mapper.SysNoticeMapper;
|
||||
import com.ff.sys.domain.SysNotice;
|
||||
import com.ff.sys.service.ISysNoticeService;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
|
||||
|
||||
/**
|
||||
* 系统公告Service业务层处理
|
||||
*
|
||||
* @author shi
|
||||
* @date 2025-02-28
|
||||
*/
|
||||
@Service
|
||||
public class SysNoticeServiceImpl implements ISysNoticeService
|
||||
{
|
||||
@Autowired
|
||||
private SysNoticeMapper sysNoticeMapper;
|
||||
|
||||
/**
|
||||
* 查询系统公告
|
||||
*
|
||||
* @param id 系统公告主键
|
||||
* @return 系统公告
|
||||
*/
|
||||
@Override
|
||||
public SysNotice selectSysNoticeById(Long id)
|
||||
{
|
||||
return sysNoticeMapper.selectSysNoticeById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询系统公告列表
|
||||
*
|
||||
* @param sysNotice 系统公告
|
||||
* @return 系统公告
|
||||
*/
|
||||
@Override
|
||||
public List<SysNotice> selectSysNoticeList(SysNotice sysNotice)
|
||||
{
|
||||
return sysNoticeMapper.selectSysNoticeList(sysNotice);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增系统公告
|
||||
*
|
||||
* @param sysNotice 系统公告
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertSysNotice(SysNotice sysNotice)
|
||||
{
|
||||
sysNotice.setId(IdUtil.getSnowflakeNextId());
|
||||
sysNotice.setCreateTime(DateUtils.getNowDate());
|
||||
return sysNoticeMapper.insertSysNotice(sysNotice);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改系统公告
|
||||
*
|
||||
* @param sysNotice 系统公告
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateSysNotice(SysNotice sysNotice)
|
||||
{
|
||||
sysNotice.setUpdateTime(DateUtils.getNowDate());
|
||||
return sysNoticeMapper.updateSysNotice(sysNotice);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除系统公告
|
||||
*
|
||||
* @param ids 需要删除的系统公告主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteSysNoticeByIds(Long[] ids)
|
||||
{
|
||||
return sysNoticeMapper.deleteSysNoticeByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除系统公告信息
|
||||
*
|
||||
* @param id 系统公告主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteSysNoticeById(Long id)
|
||||
{
|
||||
return sysNoticeMapper.deleteSysNoticeById(id);
|
||||
}
|
||||
}
|
|
@ -41,7 +41,6 @@ public class TenantController extends BaseController {
|
|||
*
|
||||
* @return {@link AjaxResult }
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('tenant:info:query')")
|
||||
@GetMapping
|
||||
public AjaxResult getInfo() {
|
||||
TenantSecretKey tenantSecretKey = tenantSecretKeyService.selectTenantSecretKeyById(getUserId());
|
||||
|
@ -50,12 +49,18 @@ public class TenantController extends BaseController {
|
|||
.tenantGameQuotaList(tenantGameQuotaService.selectTenantGameQuotaList(TenantGameQuota.builder()
|
||||
.tenantKey(tenantSecretKey.getTenantKey())
|
||||
.build()))
|
||||
.tenantPlatforms(tenantPlatformService.selectTenantPlatformList(TenantPlatform.builder()
|
||||
.tenantId(tenantSecretKey.getId())
|
||||
.build()))
|
||||
.currencyCodes(tenantPlatformService.selectCurrencyCodeByTenantId(tenantSecretKey.getId()))
|
||||
.build();
|
||||
return success(tenantDTO);
|
||||
}
|
||||
|
||||
@GetMapping("/platforms/{currencyCode}")
|
||||
public AjaxResult getTenantPlatformsInfo(@PathVariable("currencyCode") String currencyCode) {
|
||||
return success(tenantPlatformService.selectTenantPlatformList(TenantPlatform.builder()
|
||||
.currencyCode(currencyCode)
|
||||
.tenantId(getUserId())
|
||||
.build()));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -37,7 +37,6 @@ public class TenantWhiteController extends BaseController
|
|||
/**
|
||||
* 查询租户白名单列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('tenant:white:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(TenantWhite tenantWhite)
|
||||
{
|
||||
|
@ -51,7 +50,6 @@ public class TenantWhiteController extends BaseController
|
|||
/**
|
||||
* 新增租户白名单
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('tenant:white:add')")
|
||||
@Log(title = "租户白名单", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody TenantWhite tenantWhite)
|
||||
|
@ -64,7 +62,6 @@ public class TenantWhiteController extends BaseController
|
|||
/**
|
||||
* 删除租户白名单
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('tenant:white:remove')")
|
||||
@Log(title = "租户白名单", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public AjaxResult remove(@PathVariable Long[] ids)
|
||||
|
|
|
@ -34,7 +34,7 @@ public class TenantDTO implements java.io.Serializable{
|
|||
private List<TenantGameQuota> tenantGameQuotaList;
|
||||
|
||||
/**
|
||||
* 租户平台
|
||||
* 租户平台 币种
|
||||
*/
|
||||
private List<TenantPlatform> tenantPlatforms;
|
||||
private List<String> currencyCodes;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,79 @@
|
|||
<?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.ff.sys.mapper.SysNoticeMapper">
|
||||
|
||||
<resultMap type="SysNotice" id="SysNoticeResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="title" column="title" />
|
||||
<result property="content" column="content" />
|
||||
<result property="createBy" column="create_by" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="updateBy" column="update_by" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectSysNoticeVo">
|
||||
select id, title, content, create_by, create_time, update_by, update_time from ff_sys_notice
|
||||
</sql>
|
||||
|
||||
<select id="selectSysNoticeList" parameterType="SysNotice" resultMap="SysNoticeResult">
|
||||
<include refid="selectSysNoticeVo"/>
|
||||
<where>
|
||||
<if test="title != null and title != ''"> and title = #{title}</if>
|
||||
<if test="content != null and content != ''"> and content = #{content}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectSysNoticeById" parameterType="Long" resultMap="SysNoticeResult">
|
||||
<include refid="selectSysNoticeVo"/>
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<insert id="insertSysNotice" parameterType="SysNotice">
|
||||
insert into ff_sys_notice
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">id,</if>
|
||||
<if test="title != null">title,</if>
|
||||
<if test="content != null">content,</if>
|
||||
<if test="createBy != null">create_by,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
<if test="updateBy != null">update_by,</if>
|
||||
<if test="updateTime != null">update_time,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">#{id},</if>
|
||||
<if test="title != null">#{title},</if>
|
||||
<if test="content != null">#{content},</if>
|
||||
<if test="createBy != null">#{createBy},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
<if test="updateBy != null">#{updateBy},</if>
|
||||
<if test="updateTime != null">#{updateTime},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateSysNotice" parameterType="SysNotice">
|
||||
update ff_sys_notice
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="title != null">title = #{title},</if>
|
||||
<if test="content != null">content = #{content},</if>
|
||||
<if test="createBy != null">create_by = #{createBy},</if>
|
||||
<if test="createTime != null">create_time = #{createTime},</if>
|
||||
<if test="updateBy != null">update_by = #{updateBy},</if>
|
||||
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="deleteSysNoticeById" parameterType="Long">
|
||||
delete from ff_sys_notice where id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteSysNoticeByIds" parameterType="String">
|
||||
delete from ff_sys_notice where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
</mapper>
|
Loading…
Reference in New Issue