二次提交
parent
a29f3066f4
commit
f4d4d98470
|
@ -103,4 +103,12 @@ public class TClazzController extends BaseController {
|
|||
public Result<String> remove(@PathVariable List<Long> clazzIds) {
|
||||
return toAjax(tClazzService.removeBatchByIds(clazzIds));
|
||||
}
|
||||
|
||||
/**
|
||||
* 无条件差查询班级管理
|
||||
*/
|
||||
@GetMapping("/findUnconditional")
|
||||
public Result findUnconditional(){
|
||||
return getDataTable(tClazzService.list());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,111 @@
|
|||
package com.ruoyi.web.controller.clazz;
|
||||
|
||||
import java.util.List;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import com.ruoyi.clazz.domain.TGroup;
|
||||
import com.ruoyi.clazz.domain.req.TGroupEditReq;
|
||||
import com.ruoyi.clazz.domain.req.TGroupQueryReq;
|
||||
import com.ruoyi.clazz.domain.req.TGroupSaveReq;
|
||||
import com.ruoyi.clazz.service.TGroupService;
|
||||
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.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 小组Controller
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2024-04-23
|
||||
*/
|
||||
@Api(tags = "小组")
|
||||
@RestController
|
||||
@RequestMapping("/group/group")
|
||||
public class TGroupController extends BaseController {
|
||||
@Autowired
|
||||
private TGroupService tGroupService;
|
||||
|
||||
/**
|
||||
* 查询小组列表
|
||||
*/
|
||||
@ApiOperation("获取小组列表")
|
||||
@PreAuthorize("@ss.hasPermi('group:group:list')")
|
||||
@GetMapping("/list")
|
||||
public Result<TableDataInfo<TGroup>> list(TGroupQueryReq tGroupQueryReq) {
|
||||
startPage();
|
||||
List<TGroup> list = tGroupService.list(TGroup.queryBuild(tGroupQueryReq));
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出小组列表
|
||||
*/
|
||||
@ApiOperation("导出小组列表")
|
||||
@PreAuthorize("@ss.hasPermi('group:group:export')")
|
||||
@Log(title = "小组", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, TGroup tGroup) {
|
||||
List<TGroup> list = tGroupService.list(tGroup);
|
||||
ExcelUtil<TGroup> util = new ExcelUtil<TGroup>(TGroup.class);
|
||||
util.exportExcel(response, list, "小组数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取小组详细信息
|
||||
*/
|
||||
@ApiOperation("获取小组详细信息")
|
||||
@PreAuthorize("@ss.hasPermi('group:group:query')")
|
||||
@GetMapping(value = "/{groupId}")
|
||||
@ApiImplicitParam(name = "groupId", value = "groupId", 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('group:group:add')")
|
||||
@Log(title = "小组", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
@ApiOperation("新增小组")
|
||||
public Result<String> add(@RequestBody TGroupSaveReq tGroupSaveReq) {
|
||||
return toAjax(tGroupService.save(TGroup.saveBuild(tGroupSaveReq)));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改小组
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('group:group:edit')")
|
||||
@Log(title = "小组", businessType = BusinessType.UPDATE)
|
||||
@PutMapping("/{groupId}")
|
||||
@ApiOperation("修改小组")
|
||||
public Result<String> edit(@PathVariable Long groupId, @RequestBody TGroupEditReq tGroupEditReq) {
|
||||
return toAjax(tGroupService.updateById(TGroup.editBuild(groupId,tGroupEditReq)));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除小组
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('group:group:remove')")
|
||||
@Log(title = "小组", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{groupIds}")
|
||||
@ApiOperation("删除小组")
|
||||
@ApiImplicitParam(name = "groupId", value = "groupId", required = true, dataType = "Long", paramType = "path", dataTypeClass = String.class, example = "1,2,3,4")
|
||||
public Result<String> remove(@PathVariable List<Long> groupIds) {
|
||||
return toAjax(tGroupService.removeBatchByIds(groupIds));
|
||||
}
|
||||
}
|
|
@ -0,0 +1,96 @@
|
|||
package com.ruoyi.clazz.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.ruoyi.clazz.domain.req.TGroupEditReq;
|
||||
import com.ruoyi.clazz.domain.req.TGroupQueryReq;
|
||||
import com.ruoyi.clazz.domain.req.TGroupSaveReq;
|
||||
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;
|
||||
|
||||
/**
|
||||
* 小组对象 t_group
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2024-04-23
|
||||
*/
|
||||
@Data
|
||||
@SuperBuilder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@TableName("t_group")
|
||||
@ApiModel(value = "TGroup", description = "小组")
|
||||
public class TGroup{
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 小组ID */
|
||||
@TableId(value = "group_id",type = IdType.AUTO)
|
||||
@ApiModelProperty(name = "小组ID", value = "小组ID")
|
||||
private Long groupId;
|
||||
|
||||
/** 小组名称 */
|
||||
@Excel(name = "小组名称")
|
||||
@ApiModelProperty(name = "小组名称", value = "小组名称")
|
||||
private String groupName;
|
||||
|
||||
/** 小组人数 */
|
||||
@Excel(name = "小组人数")
|
||||
@ApiModelProperty(name = "小组人数", value = "小组人数")
|
||||
private Long groupPeople;
|
||||
|
||||
/** 小组人员 */
|
||||
@Excel(name = "小组人员")
|
||||
@ApiModelProperty(name = "小组人员", value = "小组人员")
|
||||
private String groupPersonnel;
|
||||
|
||||
/** 班级ID */
|
||||
@Excel(name = "班级ID")
|
||||
@ApiModelProperty(name = "班级ID", value = "班级ID")
|
||||
private Long clazzId;
|
||||
|
||||
/**
|
||||
* 查询构造器
|
||||
*/
|
||||
public static TGroup queryBuild( TGroupQueryReq tGroupQueryReq){
|
||||
return TGroup.builder()
|
||||
.groupName(tGroupQueryReq.getGroupName())
|
||||
.groupPeople(tGroupQueryReq.getGroupPeople())
|
||||
.groupPersonnel(tGroupQueryReq.getGroupPersonnel())
|
||||
.clazzId(tGroupQueryReq.getClazzId())
|
||||
.build();
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加构造器
|
||||
*/
|
||||
public static TGroup saveBuild(TGroupSaveReq tGroupSaveReq){
|
||||
return TGroup.builder()
|
||||
.groupName(tGroupSaveReq.getGroupName())
|
||||
.groupPeople(tGroupSaveReq.getGroupPeople())
|
||||
.groupPersonnel(tGroupSaveReq.getGroupPersonnel())
|
||||
.clazzId(tGroupSaveReq.getClazzId())
|
||||
.build();
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改构造器
|
||||
*/
|
||||
public static TGroup editBuild(Long groupId, TGroupEditReq tGroupEditReq){
|
||||
return TGroup.builder()
|
||||
.groupId(groupId)
|
||||
.groupName(tGroupEditReq.getGroupName())
|
||||
.groupPeople(tGroupEditReq.getGroupPeople())
|
||||
.groupPersonnel(tGroupEditReq.getGroupPersonnel())
|
||||
.clazzId(tGroupEditReq.getClazzId())
|
||||
.build();
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,45 @@
|
|||
package com.ruoyi.clazz.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;
|
||||
|
||||
/**
|
||||
* 小组对象 t_group
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2024-04-23
|
||||
*/
|
||||
@Data
|
||||
@SuperBuilder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@ApiModel(value = "TGroupEditReq", description = "小组")
|
||||
public class TGroupEditReq extends BaseEntity {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 小组名称 */
|
||||
@ApiModelProperty(name = "小组名称", value = "小组名称")
|
||||
private String groupName;
|
||||
|
||||
/** 小组人数 */
|
||||
@ApiModelProperty(name = "小组人数", value = "小组人数")
|
||||
private Long groupPeople;
|
||||
|
||||
/** 小组人员 */
|
||||
@ApiModelProperty(name = "小组人员", value = "小组人员")
|
||||
private String groupPersonnel;
|
||||
|
||||
/** 班级ID */
|
||||
@ApiModelProperty(name = "班级ID", value = "班级ID")
|
||||
private Long clazzId;
|
||||
|
||||
}
|
|
@ -0,0 +1,45 @@
|
|||
package com.ruoyi.clazz.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;
|
||||
|
||||
/**
|
||||
* 小组对象 t_group
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2024-04-23
|
||||
*/
|
||||
@Data
|
||||
@SuperBuilder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@ApiModel(value = "TGroupQueryReq", description = "小组")
|
||||
public class TGroupQueryReq extends BaseEntity {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 小组名称 */
|
||||
@ApiModelProperty(name = "小组名称", value = "小组名称")
|
||||
private String groupName;
|
||||
|
||||
/** 小组人数 */
|
||||
@ApiModelProperty(name = "小组人数", value = "小组人数")
|
||||
private Long groupPeople;
|
||||
|
||||
/** 小组人员 */
|
||||
@ApiModelProperty(name = "小组人员", value = "小组人员")
|
||||
private String groupPersonnel;
|
||||
|
||||
/** 班级ID */
|
||||
@ApiModelProperty(name = "班级ID", value = "班级ID")
|
||||
private Long clazzId;
|
||||
|
||||
}
|
|
@ -0,0 +1,54 @@
|
|||
package com.ruoyi.clazz.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;
|
||||
|
||||
/**
|
||||
* 小组对象 t_group
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2024-04-23
|
||||
*/
|
||||
@Data
|
||||
@SuperBuilder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@ApiModel(value = "TGroupSaveReq", description = "小组")
|
||||
public class TGroupSaveReq extends BaseEntity {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 小组ID */
|
||||
|
||||
@ApiModelProperty(name = "小组ID", value = "小组ID")
|
||||
private Long groupId;
|
||||
|
||||
/** 小组名称 */
|
||||
|
||||
@ApiModelProperty(name = "小组名称", value = "小组名称")
|
||||
private String groupName;
|
||||
|
||||
/** 小组人数 */
|
||||
|
||||
@ApiModelProperty(name = "小组人数", value = "小组人数")
|
||||
private Long groupPeople;
|
||||
|
||||
/** 小组人员 */
|
||||
|
||||
@ApiModelProperty(name = "小组人员", value = "小组人员")
|
||||
private String groupPersonnel;
|
||||
|
||||
/** 班级ID */
|
||||
|
||||
@ApiModelProperty(name = "班级ID", value = "班级ID")
|
||||
private Long clazzId;
|
||||
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
package com.ruoyi.clazz.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.ruoyi.clazz.domain.TGroup;
|
||||
|
||||
|
||||
/**
|
||||
* 小组Mapper接口
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2024-04-23
|
||||
*/
|
||||
public interface TGroupMapper extends BaseMapper<TGroup> {
|
||||
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
package com.ruoyi.clazz.service;
|
||||
|
||||
import java.util.List;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.ruoyi.clazz.domain.TGroup;
|
||||
|
||||
/**
|
||||
* 小组Service接口
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2024-04-23
|
||||
*/
|
||||
public interface TGroupService extends IService<TGroup> {
|
||||
/**
|
||||
* 查询小组列表
|
||||
*
|
||||
* @param tGroup 小组
|
||||
* @return 小组集合
|
||||
*/
|
||||
public List<TGroup> list(TGroup tGroup);
|
||||
|
||||
}
|
|
@ -0,0 +1,40 @@
|
|||
package com.ruoyi.clazz.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.ruoyi.clazz.domain.TGroup;
|
||||
import com.ruoyi.clazz.mapper.TGroupMapper;
|
||||
import com.ruoyi.clazz.service.TGroupService;
|
||||
import com.ruoyi.common.utils.ObjUtils;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
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 TGroupServiceImpl extends ServiceImpl<TGroupMapper, TGroup> implements TGroupService {
|
||||
|
||||
/**
|
||||
* 查询小组列表
|
||||
*
|
||||
* @param tGroup 小组
|
||||
* @return 小组
|
||||
*/
|
||||
@Override
|
||||
public List<TGroup> list(TGroup tGroup) {
|
||||
LambdaQueryWrapper<TGroup> queryWrapper = new LambdaQueryWrapper<>();
|
||||
|
||||
if (ObjUtils.notNull(tGroup.getClazzId())){
|
||||
queryWrapper.eq(TGroup::getClazzId, tGroup.getClazzId());
|
||||
}
|
||||
return list(queryWrapper);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,19 @@
|
|||
<?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.clazz.mapper.TGroupMapper">
|
||||
|
||||
|
||||
<resultMap type="com.ruoyi.clazz.domain.TGroup" id="TGroupResult">
|
||||
<result property="groupId" column="group_id" />
|
||||
<result property="groupName" column="group_name" />
|
||||
<result property="groupPeople" column="group_people" />
|
||||
<result property="groupPersonnel" column="group_personnel" />
|
||||
<result property="clazzId" column="clazz_id" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectTGroupVo">
|
||||
select group_id, group_name, group_people, group_personnel, clazz_id from t_group
|
||||
</sql>
|
||||
</mapper>
|
Loading…
Reference in New Issue