Browse Source

11月6日频道

huangqizheng/feature-20251104113536-现金管理二期退款修改
sunjiabei 3 weeks ago
parent
commit
2dc56f9b89
  1. 17
      src/main/java/com/example/demo/controller/coin/RoleController.java
  2. 1
      src/main/java/com/example/demo/domain/vo/coin/RoleVo.java
  3. 2
      src/main/java/com/example/demo/mapper/live/LiveMapper.java
  4. 2
      src/main/java/com/example/demo/service/coin/RoleService.java
  5. 16
      src/main/java/com/example/demo/serviceImpl/coin/RoleServiceImpl.java
  6. 7
      src/main/resources/liveMapper/LiveMapper.xml
  7. 16
      src/main/resources/mapper/RoleMapper.xml

17
src/main/java/com/example/demo/controller/coin/RoleController.java

@ -115,4 +115,21 @@ public class RoleController {
}
}
//查询所有直播渠道
@PostMapping("/getChannel")
public Result getChannel(){
return Result.success(roleService.getChannel());
}
@Log("获取频道列表")
@PostMapping("/selectChannel")
public Result selectChannel(@RequestBody RoleVo roleVo) {
Integer id = roleVo.getId();
List<RoleVo> list=roleService.selectSubRole(id);
return Result.success(list);
}
}

1
src/main/java/com/example/demo/domain/vo/coin/RoleVo.java

@ -34,6 +34,7 @@ public class RoleVo implements Serializable {
private String fatherMarket;//父级角色市场
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "Asia/Shanghai")
private Date createTime; // 创建时间
private String channel;//所属渠道
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "Asia/Shanghai")
private Date updateTime; // 更新时间

2
src/main/java/com/example/demo/mapper/live/LiveMapper.java

@ -21,6 +21,8 @@ public interface LiveMapper {
List<BeanConsumeLive> selectLiveBy(@Param("beanConsumeLive") BeanConsumeLive beanConsumeLive);
//获取直播礼物列表
List<String> getLiveGift();
//获取频道列表
List<String> getChannel();
//获取直播频道列表
List<String> getLiveChannel();
//计算直播消费金豆合计数

2
src/main/java/com/example/demo/service/coin/RoleService.java

@ -19,6 +19,8 @@ import java.util.List;
public interface RoleService {
//查询频道
List<String> getChannel();
//新增角色
Result addRole(RoleVo roleVo);
//新增角色二期替补

16
src/main/java/com/example/demo/serviceImpl/coin/RoleServiceImpl.java

@ -9,6 +9,7 @@ import com.example.demo.domain.vo.coin.Result;
import com.example.demo.domain.vo.coin.RoleVo;
import com.example.demo.mapper.coin.MenuMapper;
import com.example.demo.mapper.coin.RoleMapper;
import com.example.demo.mapper.live.LiveMapper;
import com.example.demo.service.coin.MenuService;
import com.example.demo.service.coin.RoleService;
import com.github.pagehelper.PageHelper;
@ -40,6 +41,16 @@ public class RoleServiceImpl implements RoleService {
private MenuService menuService;
@Autowired
private MenuMapper menuMapper;
@Autowired
private LiveMapper liveMapper;
//查询直播礼物
@Override
public List<String> getChannel() {
return liveMapper.getChannel();
}
//新增角色
@Override
@ -62,9 +73,8 @@ public class RoleServiceImpl implements RoleService {
if (roleVo.getMenuIds() == null || roleVo.getMenuIds().isEmpty()) {
return Result.error("权限为空");
}
if (roleVo.getMarket() == null || roleVo.getMarket().isEmpty()) {
return Result.error("所属市场为空");
}
if (roleVo.getFatherId() == null || roleVo.getFatherId() != 2) {
for (Integer menuId : roleVo.getMenuIds()) {

7
src/main/resources/liveMapper/LiveMapper.xml

@ -63,6 +63,13 @@
<select id="getLiveGift" resultType="java.lang.String">
select distinct name from live_gifts
</select>
<select id="getChannel" resultType="java.lang.String">
select distinct title
from live_pindao
where pd_id &lt; 999
and title is not null <!-- 可选:排除标题为空的记录 -->
and title != '' <!-- 可选:排除标题为空字符串的记录 -->
</select>
<!--获取直播频道列表-->
<select id="getLiveChannel" resultType="java.lang.String">
select distinct title from live_pindao where title is not null and title != ''

16
src/main/resources/mapper/RoleMapper.xml

@ -7,7 +7,12 @@
<if test="roleName != null">
role_name = #{roleName},
</if>
<if test="market != null">
market = #{market},
</if>
<if test="channel != null">
channel = #{channel},
</if>
<if test="fatherId != null">
father_id = #{fatherId},
</if>
@ -32,7 +37,7 @@
</select>
<select id="selectAllRole" resultType="com.example.demo.domain.vo.coin.RoleVo">
SELECT id,role_name FROM role
SELECT id,role_name,market,channel FROM role
<where>
<!-- 判断 market 是否不为总部且 markets 不为空 -->
<if test="markets != null and markets.size() > 0 and '总部' not in markets and '研发部' not in markets">
@ -44,7 +49,7 @@
</where>
</select>
<select id="selectByFatherId" resultType="com.example.demo.domain.vo.coin.RoleVo">
SELECT id,role_name FROM role
SELECT id,role_name,market,channel FROM role
<where>
father_id = #{id}
</where>
@ -54,8 +59,8 @@
<!-- 插入角色信息 -->
<insert id="addRole" parameterType="com.example.demo.domain.vo.coin.RoleVo" useGeneratedKeys="true" keyProperty="id">
INSERT INTO role
(role_name,father_id, market)
VALUES (#{roleName}, #{fatherId}, #{market})
(role_name,father_id, market,channel)
VALUES (#{roleName}, #{fatherId}, #{market},#{channel})
</insert>
<!-- 删除 role_menu 表中对应角色的数据 -->
@ -75,6 +80,7 @@
r.market AS market,
r.create_time AS createTime,
r.update_time AS updateTime,
r.channel AS channel,
-- 通过自连接查询父角色名称
father.role_name AS fatherName
FROM role r

Loading…
Cancel
Save