parent
0a4e225593
commit
32bbfeccf9
7
pom.xml
7
pom.xml
|
@ -192,6 +192,13 @@
|
|||
<version>${ruoyi.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- 小组管理-->
|
||||
<dependency>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>ruoyi-group</artifactId>
|
||||
<version>${ruoyi.version}</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
</dependencyManagement>
|
||||
|
||||
|
|
|
@ -86,6 +86,13 @@
|
|||
<groupId>com.muyu</groupId>
|
||||
<artifactId>ruoyi-clazz</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- 小组管理 -->
|
||||
<dependency>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>ruoyi-group</artifactId>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
|
|
@ -11,7 +11,7 @@ import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
|
|||
* @author ruoyi
|
||||
*/
|
||||
@SpringBootApplication(exclude = {DataSourceAutoConfiguration.class})
|
||||
@MapperScan(basePackages = {"com.ruoyi.clazz.mapper"})
|
||||
@MapperScan(basePackages = {"com.ruoyi.clazz.mapper","com.ruoyi.group.mapper"})
|
||||
public class RuoYiApplication {
|
||||
public static void main (String[] args) {
|
||||
SpringApplication.run(RuoYiApplication.class, args);
|
||||
|
|
|
@ -0,0 +1,111 @@
|
|||
package com.ruoyi.web.controller.group;
|
||||
|
||||
import java.util.List;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import com.ruoyi.group.domain.Group;
|
||||
import com.ruoyi.group.domain.req.GroupEditReq;
|
||||
import com.ruoyi.group.domain.req.GroupQueryReq;
|
||||
import com.ruoyi.group.domain.req.GroupSaveReq;
|
||||
import com.ruoyi.group.service.GroupService;
|
||||
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 seer
|
||||
* @date 2024-04-23
|
||||
*/
|
||||
@Api(tags = "小组管理")
|
||||
@RestController
|
||||
@RequestMapping("/data/group")
|
||||
public class GroupController extends BaseController {
|
||||
@Autowired
|
||||
private GroupService groupService;
|
||||
|
||||
/**
|
||||
* 查询小组管理列表
|
||||
*/
|
||||
@ApiOperation("获取小组管理列表")
|
||||
@PreAuthorize("@ss.hasPermi('data:group:list')")
|
||||
@GetMapping("/list")
|
||||
public Result<TableDataInfo<Group>> list(GroupQueryReq groupQueryReq) {
|
||||
startPage();
|
||||
List<Group> list = groupService.list(Group.queryBuild(groupQueryReq));
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出小组管理列表
|
||||
*/
|
||||
@ApiOperation("导出小组管理列表")
|
||||
@PreAuthorize("@ss.hasPermi('data:group:export')")
|
||||
@Log(title = "小组管理", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, Group group) {
|
||||
List<Group> list = groupService.list(group);
|
||||
ExcelUtil<Group> util = new ExcelUtil<Group>(Group.class);
|
||||
util.exportExcel(response, list, "小组管理数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取小组管理详细信息
|
||||
*/
|
||||
@ApiOperation("获取小组管理详细信息")
|
||||
@PreAuthorize("@ss.hasPermi('data:group:query')")
|
||||
@GetMapping(value = "/{groupId}")
|
||||
@ApiImplicitParam(name = "groupId", value = "groupId", required = true, dataType = "Long", paramType = "path", dataTypeClass = Long.class)
|
||||
public Result<Group> getInfo(@PathVariable("groupId") Long groupId) {
|
||||
return Result.success(groupService.getById(groupId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增小组管理
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('data:group:add')")
|
||||
@Log(title = "小组管理", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
@ApiOperation("新增小组管理")
|
||||
public Result<String> add(@RequestBody GroupSaveReq groupSaveReq) {
|
||||
return toAjax(groupService.save(Group.saveBuild(groupSaveReq)));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改小组管理
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('data:group:edit')")
|
||||
@Log(title = "小组管理", businessType = BusinessType.UPDATE)
|
||||
@PutMapping("/{groupId}")
|
||||
@ApiOperation("修改小组管理")
|
||||
public Result<String> edit(@PathVariable Long groupId, @RequestBody GroupEditReq groupEditReq) {
|
||||
return toAjax(groupService.updateById(Group.editBuild(groupId,groupEditReq)));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除小组管理
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('data: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(groupService.removeBatchByIds(groupIds));
|
||||
}
|
||||
}
|
|
@ -13,6 +13,7 @@
|
|||
<packaging>pom</packaging>
|
||||
<modules>
|
||||
<module>ruoyi-clazz</module>
|
||||
<module>ruoyi-group</module>
|
||||
</modules>
|
||||
|
||||
<properties>
|
||||
|
|
|
@ -0,0 +1,27 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>ruoyi-modules</artifactId>
|
||||
<version>3.8.6</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>ruoyi-group</artifactId>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>17</maven.compiler.source>
|
||||
<maven.compiler.target>17</maven.compiler.target>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>ruoyi-framework</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
|
@ -0,0 +1,101 @@
|
|||
package com.ruoyi.group.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
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.group.domain.req.GroupQueryReq;
|
||||
import com.ruoyi.group.domain.req.GroupSaveReq;
|
||||
import com.ruoyi.group.domain.req.GroupEditReq;
|
||||
import com.ruoyi.common.core.domain.BaseEntity;
|
||||
|
||||
/**
|
||||
* 小组管理对象 group
|
||||
*
|
||||
* @author seer
|
||||
* @date 2024-04-23
|
||||
*/
|
||||
@Data
|
||||
@SuperBuilder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@TableName("`group`")
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ApiModel(value = "Group", description = "小组管理")
|
||||
public class Group extends BaseEntity {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 小组ID
|
||||
*/
|
||||
@Excel(name = "小组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 = "所属班级", required = true)
|
||||
private Long groupClazz;
|
||||
|
||||
/**
|
||||
* 小组状态 0-停用 1-启用
|
||||
*/
|
||||
@Excel(name = "小组状态 0-停用 1-启用")
|
||||
@ApiModelProperty(name = "小组状态 0-停用 1-启用", value = "小组状态 0-停用 1-启用", required = true)
|
||||
private Long groupStatus;
|
||||
|
||||
/**
|
||||
* 查询构造器
|
||||
*/
|
||||
public static Group queryBuild(GroupQueryReq groupQueryReq) {
|
||||
return Group.builder()
|
||||
.groupId(groupQueryReq.getGroupId())
|
||||
.groupName(groupQueryReq.getGroupName())
|
||||
.groupClazz(groupQueryReq.getGroupClazz())
|
||||
.groupStatus(groupQueryReq.getGroupStatus())
|
||||
.build();
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加构造器
|
||||
*/
|
||||
public static Group saveBuild(GroupSaveReq groupSaveReq) {
|
||||
return Group.builder()
|
||||
.groupName(groupSaveReq.getGroupName())
|
||||
.groupClazz(groupSaveReq.getGroupClazz())
|
||||
.groupStatus(groupSaveReq.getGroupStatus())
|
||||
.remark(groupSaveReq.getRemark())
|
||||
.build();
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改构造器
|
||||
*/
|
||||
public static Group editBuild(Long groupId, GroupEditReq groupEditReq) {
|
||||
return Group.builder()
|
||||
.groupId(groupId)
|
||||
.groupName(groupEditReq.getGroupName())
|
||||
.groupClazz(groupEditReq.getGroupClazz())
|
||||
.groupStatus(groupEditReq.getGroupStatus())
|
||||
.remark(groupEditReq.getRemark())
|
||||
.build();
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,41 @@
|
|||
package com.ruoyi.group.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;
|
||||
|
||||
/**
|
||||
* 小组管理对象 group
|
||||
*
|
||||
* @author seer
|
||||
* @date 2024-04-23
|
||||
*/
|
||||
@Data
|
||||
@SuperBuilder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@ApiModel(value = "GroupEditReq", description = "小组管理")
|
||||
public class GroupEditReq extends BaseEntity {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 小组名称 */
|
||||
@ApiModelProperty(name = "小组名称", value = "小组名称")
|
||||
private String groupName;
|
||||
|
||||
/** 所属班级 */
|
||||
@ApiModelProperty(name = "所属班级", value = "所属班级", required = true)
|
||||
private Long groupClazz;
|
||||
|
||||
/** 小组状态 0-停用 1-启用 */
|
||||
@ApiModelProperty(name = "小组状态 0-停用 1-启用", value = "小组状态 0-停用 1-启用", required = true)
|
||||
private Long groupStatus;
|
||||
|
||||
}
|
|
@ -0,0 +1,47 @@
|
|||
package com.ruoyi.group.domain.req;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
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;
|
||||
|
||||
/**
|
||||
* 小组管理对象 group
|
||||
*
|
||||
* @author seer
|
||||
* @date 2024-04-23
|
||||
*/
|
||||
@Data
|
||||
@SuperBuilder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@ApiModel(value = "GroupQueryReq", description = "小组管理")
|
||||
public class GroupQueryReq extends BaseEntity {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 小组ID */
|
||||
@TableId(value = "groupId",type = IdType.AUTO)
|
||||
@ApiModelProperty(name = "小组ID", value = "小组ID")
|
||||
private Long groupId;
|
||||
|
||||
/** 小组名称 */
|
||||
@ApiModelProperty(name = "小组名称", value = "小组名称")
|
||||
private String groupName;
|
||||
|
||||
/** 所属班级 */
|
||||
@ApiModelProperty(name = "所属班级", value = "所属班级")
|
||||
private Long groupClazz;
|
||||
|
||||
/** 小组状态 0-停用 1-启用 */
|
||||
@ApiModelProperty(name = "小组状态 0-停用 1-启用", value = "小组状态 0-停用 1-启用")
|
||||
private Long groupStatus;
|
||||
|
||||
}
|
|
@ -0,0 +1,44 @@
|
|||
package com.ruoyi.group.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;
|
||||
|
||||
/**
|
||||
* 小组管理对象 group
|
||||
*
|
||||
* @author seer
|
||||
* @date 2024-04-23
|
||||
*/
|
||||
@Data
|
||||
@SuperBuilder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@ApiModel(value = "GroupSaveReq", description = "小组管理")
|
||||
public class GroupSaveReq extends BaseEntity {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 小组名称 */
|
||||
|
||||
@ApiModelProperty(name = "小组名称", value = "小组名称")
|
||||
private String groupName;
|
||||
|
||||
/** 所属班级 */
|
||||
|
||||
@ApiModelProperty(name = "所属班级", value = "所属班级", required = true)
|
||||
private Long groupClazz;
|
||||
|
||||
/** 小组状态 0-停用 1-启用 */
|
||||
|
||||
@ApiModelProperty(name = "小组状态 0-停用 1-启用", value = "小组状态 0-停用 1-启用", required = true)
|
||||
private Long groupStatus;
|
||||
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
package com.ruoyi.group.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.ruoyi.group.domain.Group;
|
||||
|
||||
/**
|
||||
* 小组管理Mapper接口
|
||||
*
|
||||
* @author seer
|
||||
* @date 2024-04-23
|
||||
*/
|
||||
public interface GroupMapper extends BaseMapper<Group> {
|
||||
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
package com.ruoyi.group.service;
|
||||
|
||||
import java.util.List;
|
||||
import com.ruoyi.group.domain.Group;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
/**
|
||||
* 小组管理Service接口
|
||||
*
|
||||
* @author seer
|
||||
* @date 2024-04-23
|
||||
*/
|
||||
public interface GroupService extends IService<Group> {
|
||||
/**
|
||||
* 查询小组管理列表
|
||||
*
|
||||
* @param group 小组管理
|
||||
* @return 小组管理集合
|
||||
*/
|
||||
public List<Group> list(Group group);
|
||||
|
||||
}
|
|
@ -0,0 +1,57 @@
|
|||
package com.ruoyi.group.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.stereotype.Service;
|
||||
import com.ruoyi.group.mapper.GroupMapper;
|
||||
import com.ruoyi.group.domain.Group;
|
||||
import com.ruoyi.group.service.GroupService;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
|
||||
/**
|
||||
* 小组管理Service业务层处理
|
||||
*
|
||||
* @author seer
|
||||
* @date 2024-04-23
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
public class GroupServiceImpl extends ServiceImpl<GroupMapper, Group> implements GroupService {
|
||||
|
||||
/**
|
||||
* 查询小组管理列表
|
||||
*
|
||||
* @param group 小组管理
|
||||
* @return 小组管理
|
||||
*/
|
||||
@Override
|
||||
public List<Group> list(Group group) {
|
||||
LambdaQueryWrapper<Group> queryWrapper = new LambdaQueryWrapper<>();
|
||||
|
||||
if (ObjUtils.notNull(group.getGroupId())){
|
||||
queryWrapper.eq(Group::getGroupId, group.getGroupId());
|
||||
}
|
||||
|
||||
if (ObjUtils.notNull(group.getGroupName())){
|
||||
queryWrapper.like(Group::getGroupName, group.getGroupName());
|
||||
}
|
||||
|
||||
if (null != (group.getGroupClazz())){
|
||||
queryWrapper.eq(Group::getGroupClazz, group.getGroupClazz());
|
||||
}
|
||||
|
||||
if (null != group.getGroupStatus()){
|
||||
queryWrapper.eq(Group::getGroupStatus, group.getGroupStatus());
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
return list(queryWrapper);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
<?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.group.mapper.GroupMapper">
|
||||
|
||||
<resultMap type="com.ruoyi.group.domain.Group" id="GroupResult">
|
||||
<result property="groupId" column="group_id" />
|
||||
<result property="groupName" column="group_name" />
|
||||
<result property="groupClazz" column="group_clazz" />
|
||||
<result property="groupStatus" column="group_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" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectGroupVo">
|
||||
select group_id, group_name, group_clazz, group_status, create_by, create_time, update_by, update_time, remark from `group`
|
||||
</sql>
|
||||
</mapper>
|
Loading…
Reference in New Issue