新增班级小组列表:增删改查
parent
0b831699c7
commit
3932ddcd6e
|
@ -4,6 +4,7 @@ import java.util.List;
|
|||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import com.ruoyi.system.domain.TClazz;
|
||||
import com.ruoyi.system.domain.TGroup;
|
||||
import com.ruoyi.system.domain.req.TClazzEditReq;
|
||||
import com.ruoyi.system.domain.req.TClazzQueryReq;
|
||||
import com.ruoyi.system.domain.req.TClazzSaveReq;
|
||||
|
@ -52,6 +53,7 @@ public class TClazzController extends BaseController {
|
|||
return getDataTable(list);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 导出数据管理列表
|
||||
*/
|
||||
|
|
|
@ -0,0 +1,102 @@
|
|||
package com.ruoyi.web.controller.system;
|
||||
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.Result;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.system.domain.TClazz;
|
||||
import com.ruoyi.system.domain.TGroup;
|
||||
import com.ruoyi.system.domain.req.TClazzEditReq;
|
||||
import com.ruoyi.system.domain.req.TClazzQueryReq;
|
||||
import com.ruoyi.system.domain.req.TClazzSaveReq;
|
||||
import com.ruoyi.system.mapper.TGroupMapper;
|
||||
import com.ruoyi.system.service.TClazzService;
|
||||
import com.ruoyi.system.service.TGroupService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 数据管理Controller
|
||||
*
|
||||
* @author HuangDaJu
|
||||
* @date 2024-04-22
|
||||
*/
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/clazz/group")
|
||||
public class TGroupController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private TGroupMapper tGroupMapper;
|
||||
@Autowired
|
||||
private TGroupService tGroupService;
|
||||
|
||||
/**
|
||||
* 获取班级小组数据列表
|
||||
*/
|
||||
@ApiOperation("获取班级小组数据列表")
|
||||
// @PreAuthorize("@ss.hasPermi('clazz:clazz:list')")
|
||||
@GetMapping("/groupList/{clazzId}")
|
||||
public Result<TableDataInfo<TGroup>> groupList(@PathVariable Long clazzId) {
|
||||
startPage();
|
||||
List<TGroup> list = tGroupMapper.clazzGroupList(clazzId);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
|
||||
// @PreAuthorize("@ss.hasPermi('clazz:clazz:remove')")
|
||||
@Log(title = "删除小组", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{groupId}")
|
||||
@ApiOperation("删除小组")
|
||||
// @ApiImplicitParam(name = "clazzId", value = "clazzId", required = true, dataType = "Long", paramType = "path", dataTypeClass = String.class, example = "1,2,3,4")
|
||||
public Result<String> remove(@PathVariable Long groupId) {
|
||||
return toAjax(tGroupService.removeGroup(groupId));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取数据管理详细信息
|
||||
*/
|
||||
@ApiOperation("获取小组详细信息")
|
||||
// @PreAuthorize("@ss.hasPermi('clazz:clazz:query')")
|
||||
@GetMapping(value = "/{groupId}")
|
||||
// @ApiImplicitParam(name = "clazzId", value = "clazzId", required = true, dataType = "Long", paramType = "path", dataTypeClass = Long.class)
|
||||
public Result<TGroup> getInfo(@PathVariable("groupId") Long groupId) {
|
||||
return Result.success(tGroupService.getById(groupId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增数据管理
|
||||
*/
|
||||
// @PreAuthorize("@ss.hasPermi('clazz:clazz:add')")
|
||||
@Log(title = "添加小组信息", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
@ApiOperation("新增数据管理")
|
||||
public Result<String> add(@RequestBody TGroup tGroup) {
|
||||
return toAjax(tGroupService.addTGroup(tGroup));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改数据管理
|
||||
*/
|
||||
// @PreAuthorize("@ss.hasPermi('clazz:clazz:edit')")
|
||||
@Log(title = "修改小组数据", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
@ApiOperation("修改数据管理")
|
||||
public Result<String> edit(@RequestBody TGroup tGroup) {
|
||||
return toAjax(tGroupService.updateById(tGroup));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -113,6 +113,9 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
|
|||
// 静态资源,可匿名访问
|
||||
.antMatchers(HttpMethod.GET, "/", "/*.html", "/**/*.html", "/**/*.css", "/**/*.js", "/profile/**").permitAll()
|
||||
.antMatchers("/swagger-ui.html", "/swagger-resources/**", "/webjars/**", "/*/api-docs", "/druid/**").permitAll()
|
||||
|
||||
//在这里添加想要测试的方法访问URL,后面添加匿名访问的权限permitAll()
|
||||
.antMatchers("/clazz/clazz/groupList").permitAll()
|
||||
// 除上面外的所有请求全部需要鉴权认证
|
||||
.anyRequest().authenticated()
|
||||
.and()
|
||||
|
|
|
@ -0,0 +1,39 @@
|
|||
package com.ruoyi.system.domain;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* 班级小组列表
|
||||
* @Author HuangDaJu
|
||||
* @Date 2024/4/23 19:13
|
||||
* @Version 1.0
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class TGroup {
|
||||
|
||||
/**
|
||||
* 小组id
|
||||
*/
|
||||
private Long groupId;
|
||||
/**
|
||||
* 班级id
|
||||
*/
|
||||
private Integer clazzId;
|
||||
/**
|
||||
* 小组名称
|
||||
*/
|
||||
private String groupName;
|
||||
/**
|
||||
* 小组组长
|
||||
*/
|
||||
private String groupUserName;
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,32 @@
|
|||
package com.ruoyi.system.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.ruoyi.system.domain.TClazz;
|
||||
import com.ruoyi.system.domain.TGroup;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* 班级小组Mapper接口
|
||||
*
|
||||
* @author HuangDaJu
|
||||
* @date 2024-04-22
|
||||
*/
|
||||
public interface TGroupMapper {
|
||||
|
||||
List<TGroup> clazzGroupList(Long clazzId);
|
||||
|
||||
|
||||
int removeGroup(Long groupId);
|
||||
|
||||
|
||||
TGroup getById(Long groupId);
|
||||
|
||||
int updateById(TGroup tGroup);
|
||||
|
||||
|
||||
int addTGroup(TGroup tGroup);
|
||||
|
||||
|
||||
}
|
|
@ -4,6 +4,7 @@ import java.util.List;
|
|||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.ruoyi.system.domain.TClazz;
|
||||
import com.ruoyi.system.domain.TGroup;
|
||||
|
||||
/**
|
||||
* 数据管理Service接口
|
||||
|
@ -20,4 +21,10 @@ public interface TClazzService extends IService<TClazz> {
|
|||
*/
|
||||
public List<TClazz> list(TClazz tClazz);
|
||||
|
||||
List<TGroup> clazzGroupList(Long clazzId);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,38 @@
|
|||
package com.ruoyi.system.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.ruoyi.system.domain.TClazz;
|
||||
import com.ruoyi.system.domain.TGroup;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 数据管理Service接口
|
||||
*
|
||||
* @author HuangDaJu
|
||||
* @date 2024-04-22
|
||||
*/
|
||||
public interface TGroupService {
|
||||
|
||||
/**
|
||||
* 查询数据管理列表
|
||||
*
|
||||
* @param clazzId 数据管理
|
||||
* @return 数据管理集合
|
||||
*/
|
||||
List<TGroup> clazzGroupList(Long clazzId);
|
||||
|
||||
|
||||
int removeGroup(Long groupId);
|
||||
|
||||
|
||||
TGroup getById(Long groupId);
|
||||
|
||||
|
||||
int updateById(TGroup tGroup);
|
||||
|
||||
|
||||
int addTGroup(TGroup tGroup);
|
||||
|
||||
|
||||
}
|
|
@ -5,9 +5,11 @@ import java.util.List;
|
|||
import com.ruoyi.common.utils.ObjUtils;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import com.ruoyi.system.domain.TClazz;
|
||||
import com.ruoyi.system.domain.TGroup;
|
||||
import com.ruoyi.system.mapper.TClazzMapper;
|
||||
import com.ruoyi.system.service.TClazzService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
|
@ -23,6 +25,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|||
@Service
|
||||
public class TClazzServiceImpl extends ServiceImpl<TClazzMapper, TClazz> implements TClazzService {
|
||||
|
||||
|
||||
/**
|
||||
* 查询数据管理列表
|
||||
*
|
||||
|
@ -33,7 +36,6 @@ public class TClazzServiceImpl extends ServiceImpl<TClazzMapper, TClazz> implem
|
|||
public List<TClazz> list(TClazz tClazz) {
|
||||
LambdaQueryWrapper<TClazz> queryWrapper = new LambdaQueryWrapper<>();
|
||||
|
||||
|
||||
if (ObjUtils.notNull(tClazz.getClazzName())){
|
||||
queryWrapper.like(TClazz::getClazzName, tClazz.getClazzName());
|
||||
}
|
||||
|
@ -42,10 +44,16 @@ public class TClazzServiceImpl extends ServiceImpl<TClazzMapper, TClazz> implem
|
|||
queryWrapper.eq(TClazz::getClazzState, tClazz.getClazzState());
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
return list(queryWrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<TGroup> clazzGroupList(Long clazzId) {
|
||||
if (StringUtils.isNotEmpty(new Long[]{clazzId})){
|
||||
throw new RuntimeException("参数错误");
|
||||
}
|
||||
return clazzGroupList(clazzId);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,66 @@
|
|||
package com.ruoyi.system.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.ruoyi.common.utils.ObjUtils;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import com.ruoyi.system.domain.TClazz;
|
||||
import com.ruoyi.system.domain.TGroup;
|
||||
import com.ruoyi.system.mapper.TClazzMapper;
|
||||
import com.ruoyi.system.mapper.TGroupMapper;
|
||||
import com.ruoyi.system.service.TClazzService;
|
||||
import com.ruoyi.system.service.TGroupService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 数据管理Service业务层处理
|
||||
*
|
||||
* @author HuangDaJu
|
||||
* @date 2024-04-22
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
public class TGroupServiceImpl implements TGroupService {
|
||||
|
||||
@Autowired
|
||||
private TGroupMapper tGroupMapper;
|
||||
/**
|
||||
* 查询小组数据管理列表
|
||||
*
|
||||
* @param clazzId 数据管理
|
||||
* @return 数据管理
|
||||
*/
|
||||
@Override
|
||||
public List<TGroup> clazzGroupList(Long clazzId) {
|
||||
if (StringUtils.isNotEmpty(new Long[]{clazzId})){
|
||||
throw new RuntimeException("参数错误");
|
||||
}
|
||||
return clazzGroupList(clazzId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int removeGroup(Long groupId) {
|
||||
return tGroupMapper.removeGroup(groupId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TGroup getById(Long groupId) {
|
||||
return tGroupMapper.getById(groupId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int updateById(TGroup tGroup) {
|
||||
return tGroupMapper.updateById(tGroup);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int addTGroup(TGroup tGroup) {
|
||||
return tGroupMapper.addTGroup(tGroup);
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,32 @@
|
|||
<?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.ruoyi.system.mapper.TGroupMapper">
|
||||
<insert id="addTGroup">
|
||||
INSERT INTO `qrtz_job_details`.`t_group` (`clazz_id`, `group_name`, `group_user_name`) VALUES
|
||||
(#{clazzId}, #{groupName}, #{groupUserName});
|
||||
</insert>
|
||||
<update id="updateById">
|
||||
update t_group
|
||||
<set>
|
||||
<if test="groupName != null and groupName != ''">group_name = #{groupName},</if>
|
||||
<if test="groupUserName != null and groupUserName != ''">group_user_name = #{groupUserName},</if>
|
||||
<if test="clazzId != null and clazzId != ''">clazz_id = #{clazzId},</if>
|
||||
</set>
|
||||
where group_id = #{groupId}
|
||||
</update>
|
||||
<delete id="removeGroup">
|
||||
delete from t_group where group_id = #{groupId}
|
||||
</delete>
|
||||
|
||||
|
||||
<select id="clazzGroupList" resultType="com.ruoyi.system.domain.TGroup">
|
||||
select group_id,group_name ,group_user_name ,clazz_id FROM t_group WHERE clazz_id= #{clazzId}
|
||||
</select>
|
||||
<select id="getById" resultType="com.ruoyi.system.domain.TGroup">
|
||||
select group_id,group_name ,group_user_name ,clazz_id FROM t_group WHERE group_id= #{groupId}
|
||||
</select>
|
||||
|
||||
|
||||
</mapper>
|
Loading…
Reference in New Issue