小组管理
parent
e8ae7079c8
commit
99a6387497
|
@ -0,0 +1,112 @@
|
|||
package com.ruoyi.web.controller.business;
|
||||
|
||||
import java.util.List;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import io.swagger.annotations.*;
|
||||
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.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.Result;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.business.domain.TeamInfo;
|
||||
import com.ruoyi.business.domain.req.TeamInfoQueryReq;
|
||||
import com.ruoyi.business.domain.req.TeamInfoSaveReq;
|
||||
import com.ruoyi.business.domain.req.TeamInfoEditReq;
|
||||
import com.ruoyi.business.service.TeamInfoService;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 小组Controller
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2024-04-23
|
||||
*/
|
||||
@Api(tags = "小组管理")
|
||||
@RestController
|
||||
@RequestMapping("/business/team")
|
||||
public class TeamInfoController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private TeamInfoService teamInfoService;
|
||||
|
||||
/**
|
||||
* 查询小组列表
|
||||
*/
|
||||
@ApiOperation("获取小组列表")
|
||||
@PreAuthorize("@ss.hasPermi('business:team:list')")
|
||||
@GetMapping("/list")
|
||||
public Result<TableDataInfo<TeamInfo>> list(TeamInfoQueryReq teamInfoQueryReq) {
|
||||
startPage();
|
||||
List<TeamInfo> list = teamInfoService.list(TeamInfo.queryBuild(teamInfoQueryReq));
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出小组列表
|
||||
*/
|
||||
@ApiOperation("导出小组列表")
|
||||
@PreAuthorize("@ss.hasPermi('business:team:export')")
|
||||
@Log(title = "小组", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, TeamInfo teamInfo) {
|
||||
List<TeamInfo> list = teamInfoService.list(teamInfo);
|
||||
ExcelUtil<TeamInfo> util = new ExcelUtil<TeamInfo>(TeamInfo.class);
|
||||
util.exportExcel(response, list, "小组数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取小组详细信息
|
||||
*/
|
||||
@ApiOperation("获取小组详细信息")
|
||||
@PreAuthorize("@ss.hasPermi('business:team:query')")
|
||||
@GetMapping(value = "/{teamId}")
|
||||
@ApiImplicitParam(name = "teamId", value = "teamId", required = true, dataType = "Long", paramType = "path", dataTypeClass = Long.class)
|
||||
public Result<TeamInfo> getInfo(@PathVariable("teamId") Long teamId) {
|
||||
return Result.success(teamInfoService.getById(teamId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增小组
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('business:team:add')")
|
||||
@Log(title = "小组", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
@ApiOperation("新增小组")
|
||||
public Result<String> add(@RequestBody TeamInfoSaveReq teamInfoSaveReq) {
|
||||
return toAjax(teamInfoService.save(TeamInfo.saveBuild(teamInfoSaveReq)));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改小组
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('business:team:edit')")
|
||||
@Log(title = "小组", businessType = BusinessType.UPDATE)
|
||||
@PutMapping("/{teamId}")
|
||||
@ApiOperation("修改小组")
|
||||
public Result<String> edit(@PathVariable Long teamId, @RequestBody TeamInfoEditReq teamInfoEditReq) {
|
||||
return toAjax(teamInfoService.updateById(TeamInfo.editBuild(teamId,teamInfoEditReq)));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除小组
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('business:team:remove')")
|
||||
@Log(title = "小组", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{teamIds}")
|
||||
@ApiOperation("删除小组")
|
||||
@ApiImplicitParam(name = "teamId", value = "teamId", required = true, dataType = "Long", paramType = "path", dataTypeClass = String.class, example = "1,2,3,4")
|
||||
public Result<String> remove(@PathVariable List<Long> teamIds) {
|
||||
return toAjax(teamInfoService.removeBatchByIds(teamIds));
|
||||
}
|
||||
}
|
|
@ -0,0 +1,90 @@
|
|||
package com.ruoyi.business.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
import io.swagger.annotations.*;
|
||||
import com.ruoyi.common.annotation.Excel;
|
||||
import com.ruoyi.business.domain.req.TeamInfoQueryReq;
|
||||
import com.ruoyi.business.domain.req.TeamInfoSaveReq;
|
||||
import com.ruoyi.business.domain.req.TeamInfoEditReq;
|
||||
import com.ruoyi.common.core.domain.BaseEntity;
|
||||
|
||||
/**
|
||||
* 小组对象 team_info
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2024-04-23
|
||||
*/
|
||||
@Data
|
||||
@SuperBuilder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@TableName("team_info")
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ApiModel(value = "TeamInfo", description = "小组")
|
||||
public class TeamInfo extends BaseEntity {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 小组ID */
|
||||
@Excel(name = "小组ID")
|
||||
@TableId(value = "team_id",type = IdType.AUTO)
|
||||
@ApiModelProperty(name = "小组ID", value = "小组ID")
|
||||
private Long teamId;
|
||||
|
||||
/** 小组名称 */
|
||||
@Excel(name = "小组名称")
|
||||
@ApiModelProperty(name = "小组名称", value = "小组名称")
|
||||
private String teamName;
|
||||
|
||||
/** 状态 */
|
||||
@Excel(name = "状态")
|
||||
@ApiModelProperty(name = "状态", value = "状态")
|
||||
private String status;
|
||||
|
||||
/** 班级 */
|
||||
@ApiModelProperty(name = "班级", value = "班级")
|
||||
private Long clazzId;
|
||||
|
||||
/** 班级名称 */
|
||||
@Excel(name = "班级")
|
||||
@TableField(exist = false)
|
||||
private String clazzName;
|
||||
|
||||
/**
|
||||
* 查询构造器
|
||||
*/
|
||||
public static TeamInfo queryBuild( TeamInfoQueryReq teamInfoQueryReq){
|
||||
return TeamInfo.builder()
|
||||
.teamName(teamInfoQueryReq.getTeamName())
|
||||
.build();
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加构造器
|
||||
*/
|
||||
public static TeamInfo saveBuild(TeamInfoSaveReq teamInfoSaveReq){
|
||||
return TeamInfo.builder()
|
||||
.teamName(teamInfoSaveReq.getTeamName())
|
||||
.status(teamInfoSaveReq.getStatus())
|
||||
.clazzId(teamInfoSaveReq.getClazzId())
|
||||
.build();
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改构造器
|
||||
*/
|
||||
public static TeamInfo editBuild(Long teamId, TeamInfoEditReq teamInfoEditReq){
|
||||
return TeamInfo.builder()
|
||||
.teamId(teamId)
|
||||
.teamName(teamInfoEditReq.getTeamName())
|
||||
.status(teamInfoEditReq.getStatus())
|
||||
.clazzId(teamInfoEditReq.getClazzId())
|
||||
.build();
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,41 @@
|
|||
package com.ruoyi.business.domain.req;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
import io.swagger.annotations.*;
|
||||
import com.ruoyi.common.annotation.Excel;
|
||||
import com.ruoyi.common.core.domain.BaseEntity;
|
||||
|
||||
/**
|
||||
* 小组对象 team_info
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2024-04-23
|
||||
*/
|
||||
@Data
|
||||
@SuperBuilder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@ApiModel(value = "TeamInfoEditReq", description = "小组")
|
||||
public class TeamInfoEditReq extends BaseEntity {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 小组名称 */
|
||||
@ApiModelProperty(name = "小组名称", value = "小组名称")
|
||||
private String teamName;
|
||||
|
||||
/** 状态 */
|
||||
@ApiModelProperty(name = "状态", value = "状态")
|
||||
private String status;
|
||||
|
||||
/** 班级 */
|
||||
@ApiModelProperty(name = "班级", value = "班级")
|
||||
private Long clazzId;
|
||||
|
||||
}
|
|
@ -0,0 +1,33 @@
|
|||
package com.ruoyi.business.domain.req;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
import io.swagger.annotations.*;
|
||||
import com.ruoyi.common.annotation.Excel;
|
||||
import com.ruoyi.common.core.domain.BaseEntity;
|
||||
|
||||
/**
|
||||
* 小组对象 team_info
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2024-04-23
|
||||
*/
|
||||
@Data
|
||||
@SuperBuilder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@ApiModel(value = "TeamInfoQueryReq", description = "小组")
|
||||
public class TeamInfoQueryReq extends BaseEntity {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 小组名称 */
|
||||
@ApiModelProperty(name = "小组名称", value = "小组名称")
|
||||
private String teamName;
|
||||
|
||||
}
|
|
@ -0,0 +1,49 @@
|
|||
package com.ruoyi.business.domain.req;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
import io.swagger.annotations.*;
|
||||
import com.ruoyi.common.annotation.Excel;
|
||||
import com.ruoyi.common.core.domain.BaseEntity;
|
||||
|
||||
/**
|
||||
* 小组对象 team_info
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2024-04-23
|
||||
*/
|
||||
@Data
|
||||
@SuperBuilder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@ApiModel(value = "TeamInfoSaveReq", description = "小组")
|
||||
public class TeamInfoSaveReq extends BaseEntity {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 小组ID */
|
||||
|
||||
@ApiModelProperty(name = "小组ID", value = "小组ID")
|
||||
private Long teamId;
|
||||
|
||||
/** 小组名称 */
|
||||
|
||||
@ApiModelProperty(name = "小组名称", value = "小组名称")
|
||||
private String teamName;
|
||||
|
||||
/** 状态 */
|
||||
|
||||
@ApiModelProperty(name = "状态", value = "状态")
|
||||
private String status;
|
||||
|
||||
/** 班级 */
|
||||
|
||||
@ApiModelProperty(name = "班级", value = "班级")
|
||||
private Long clazzId;
|
||||
|
||||
}
|
|
@ -0,0 +1,24 @@
|
|||
package com.ruoyi.business.mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.*;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.ruoyi.business.domain.TeamInfo;
|
||||
|
||||
/**
|
||||
* 小组Mapper接口
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2024-04-23
|
||||
*/
|
||||
public interface TeamInfoMapper extends BaseMapper<TeamInfo> {
|
||||
|
||||
/**
|
||||
* 查询小组列表
|
||||
*
|
||||
* @param queryWrapper 查询条件
|
||||
* @return 小组集合
|
||||
*/
|
||||
List<TeamInfo> selectTeamList(LambdaQueryWrapper<TeamInfo> queryWrapper);
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
package com.ruoyi.business.service;
|
||||
|
||||
import java.util.List;
|
||||
import com.ruoyi.business.domain.TeamInfo;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
/**
|
||||
* 小组Service接口
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2024-04-23
|
||||
*/
|
||||
public interface TeamInfoService extends IService<TeamInfo> {
|
||||
/**
|
||||
* 查询小组列表
|
||||
*
|
||||
* @param teamInfo 小组
|
||||
* @return 小组集合
|
||||
*/
|
||||
public List<TeamInfo> list(TeamInfo teamInfo);
|
||||
|
||||
}
|
|
@ -0,0 +1,45 @@
|
|||
package com.ruoyi.business.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.ruoyi.common.utils.ObjUtils;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.*;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.ruoyi.business.mapper.TeamInfoMapper;
|
||||
import com.ruoyi.business.domain.TeamInfo;
|
||||
import com.ruoyi.business.service.TeamInfoService;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
|
||||
/**
|
||||
* 小组Service业务层处理
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2024-04-23
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
public class TeamInfoServiceImpl extends ServiceImpl<TeamInfoMapper, TeamInfo> implements TeamInfoService {
|
||||
|
||||
@Autowired
|
||||
private TeamInfoMapper teamInfoMapper;
|
||||
|
||||
/**
|
||||
* 查询小组列表
|
||||
*
|
||||
* @param teamInfo 小组
|
||||
* @return 小组
|
||||
*/
|
||||
@Override
|
||||
public List<TeamInfo> list(TeamInfo teamInfo) {
|
||||
LambdaQueryWrapper<TeamInfo> queryWrapper = new LambdaQueryWrapper<>();
|
||||
|
||||
if (ObjUtils.notNull(teamInfo.getTeamName())){
|
||||
queryWrapper.like(TeamInfo::getTeamName, teamInfo.getTeamName());
|
||||
}
|
||||
|
||||
return teamInfoMapper.selectTeamList(queryWrapper);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,48 @@
|
|||
<?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.business.mapper.TeamInfoMapper">
|
||||
|
||||
<resultMap type="com.ruoyi.business.domain.TeamInfo" id="TeamInfoResult">
|
||||
<result property="teamId" column="team_id" />
|
||||
<result property="teamName" column="team_name" />
|
||||
<result property="status" column="status" />
|
||||
<result property="clazzId" column="clazz_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="remark" column="remark" />
|
||||
<association property="clazz" javaType="com.ruoyi.business.domain.Clazz">
|
||||
<result property="clazzId" column="clazz_id"/>
|
||||
<result property="clazzName" column="clazz_name"/>
|
||||
<result property="status" column="status" />
|
||||
<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="remark" column="remark" />
|
||||
</association>
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectTeamInfoVo">
|
||||
select
|
||||
t.team_id,
|
||||
t.team_name,
|
||||
t.status,
|
||||
c.clazz_name,
|
||||
t.create_by,
|
||||
t.create_time,
|
||||
t.update_by,
|
||||
t.update_time,
|
||||
t.remark
|
||||
from
|
||||
team_info t
|
||||
left join t_clazz c on c.clazz_id = t.clazz_id
|
||||
</sql>
|
||||
|
||||
<select id="selectTeamList" resultType="com.ruoyi.business.domain.TeamInfo">
|
||||
<include refid="selectTeamInfoVo"/>
|
||||
</select>
|
||||
</mapper>
|
Loading…
Reference in New Issue