添加游戏数学管理
This commit is contained in:
@ -0,0 +1,103 @@
|
||||
package com.ruoyi.project.benyi.controller;
|
||||
|
||||
import java.util.List;
|
||||
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.framework.aspectj.lang.annotation.Log;
|
||||
import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
|
||||
import com.ruoyi.project.benyi.domain.ByMath;
|
||||
import com.ruoyi.project.benyi.service.IByMathService;
|
||||
import com.ruoyi.framework.web.controller.BaseController;
|
||||
import com.ruoyi.framework.web.domain.AjaxResult;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.framework.web.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 游戏数学Controller
|
||||
*
|
||||
* @author tsbz
|
||||
* @date 2020-07-20
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/benyi/math")
|
||||
public class ByMathController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private IByMathService byMathService;
|
||||
|
||||
/**
|
||||
* 查询游戏数学列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('benyi:math:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(ByMath byMath)
|
||||
{
|
||||
startPage();
|
||||
List<ByMath> list = byMathService.selectByMathList(byMath);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出游戏数学列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('benyi:math:export')")
|
||||
@Log(title = "游戏数学", businessType = BusinessType.EXPORT)
|
||||
@GetMapping("/export")
|
||||
public AjaxResult export(ByMath byMath)
|
||||
{
|
||||
List<ByMath> list = byMathService.selectByMathList(byMath);
|
||||
ExcelUtil<ByMath> util = new ExcelUtil<ByMath>(ByMath.class);
|
||||
return util.exportExcel(list, "math");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取游戏数学详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('benyi:math:query')")
|
||||
@GetMapping(value = "/{id}")
|
||||
public AjaxResult getInfo(@PathVariable("id") Long id)
|
||||
{
|
||||
return AjaxResult.success(byMathService.selectByMathById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增游戏数学
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('benyi:math:add')")
|
||||
@Log(title = "游戏数学", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody ByMath byMath)
|
||||
{
|
||||
return toAjax(byMathService.insertByMath(byMath));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改游戏数学
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('benyi:math:edit')")
|
||||
@Log(title = "游戏数学", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody ByMath byMath)
|
||||
{
|
||||
return toAjax(byMathService.updateByMath(byMath));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除游戏数学
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('benyi:math:remove')")
|
||||
@Log(title = "游戏数学", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public AjaxResult remove(@PathVariable Long[] ids)
|
||||
{
|
||||
return toAjax(byMathService.deleteByMathByIds(ids));
|
||||
}
|
||||
}
|
122
ruoyi/src/main/java/com/ruoyi/project/benyi/domain/ByMath.java
Normal file
122
ruoyi/src/main/java/com/ruoyi/project/benyi/domain/ByMath.java
Normal file
@ -0,0 +1,122 @@
|
||||
package com.ruoyi.project.benyi.domain;
|
||||
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
import com.ruoyi.framework.aspectj.lang.annotation.Excel;
|
||||
import com.ruoyi.framework.web.domain.BaseEntity;
|
||||
|
||||
/**
|
||||
* 游戏数学对象 by_math
|
||||
*
|
||||
* @author tsbz
|
||||
* @date 2020-07-20
|
||||
*/
|
||||
public class ByMath extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 编号 */
|
||||
private Long id;
|
||||
|
||||
/** 名称 */
|
||||
@Excel(name = "名称")
|
||||
private String name;
|
||||
|
||||
/** 学习目标 */
|
||||
@Excel(name = "学习目标")
|
||||
private String target;
|
||||
|
||||
/** 年龄段表现特征 */
|
||||
@Excel(name = "年龄段表现特征")
|
||||
private String feature;
|
||||
|
||||
/** 教学建议 */
|
||||
@Excel(name = "教学建议")
|
||||
private String suggest;
|
||||
|
||||
/** 适用班级 */
|
||||
@Excel(name = "适用班级")
|
||||
private Integer classtypeId;
|
||||
|
||||
/** 序号 */
|
||||
@Excel(name = "序号")
|
||||
private Long sort;
|
||||
|
||||
public void setId(Long id)
|
||||
{
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Long getId()
|
||||
{
|
||||
return id;
|
||||
}
|
||||
public void setName(String name)
|
||||
{
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getName()
|
||||
{
|
||||
return name;
|
||||
}
|
||||
public void setTarget(String target)
|
||||
{
|
||||
this.target = target;
|
||||
}
|
||||
|
||||
public String getTarget()
|
||||
{
|
||||
return target;
|
||||
}
|
||||
public void setFeature(String feature)
|
||||
{
|
||||
this.feature = feature;
|
||||
}
|
||||
|
||||
public String getFeature()
|
||||
{
|
||||
return feature;
|
||||
}
|
||||
public void setSuggest(String suggest)
|
||||
{
|
||||
this.suggest = suggest;
|
||||
}
|
||||
|
||||
public String getSuggest()
|
||||
{
|
||||
return suggest;
|
||||
}
|
||||
public void setClasstypeId(Integer classtypeId)
|
||||
{
|
||||
this.classtypeId = classtypeId;
|
||||
}
|
||||
|
||||
public Integer getClasstypeId()
|
||||
{
|
||||
return classtypeId;
|
||||
}
|
||||
public void setSort(Long sort)
|
||||
{
|
||||
this.sort = sort;
|
||||
}
|
||||
|
||||
public Long getSort()
|
||||
{
|
||||
return sort;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("id", getId())
|
||||
.append("name", getName())
|
||||
.append("target", getTarget())
|
||||
.append("feature", getFeature())
|
||||
.append("suggest", getSuggest())
|
||||
.append("classtypeId", getClasstypeId())
|
||||
.append("sort", getSort())
|
||||
.append("createTime", getCreateTime())
|
||||
.toString();
|
||||
}
|
||||
}
|
@ -0,0 +1,61 @@
|
||||
package com.ruoyi.project.benyi.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import com.ruoyi.project.benyi.domain.ByMath;
|
||||
|
||||
/**
|
||||
* 游戏数学Mapper接口
|
||||
*
|
||||
* @author tsbz
|
||||
* @date 2020-07-20
|
||||
*/
|
||||
public interface ByMathMapper
|
||||
{
|
||||
/**
|
||||
* 查询游戏数学
|
||||
*
|
||||
* @param id 游戏数学ID
|
||||
* @return 游戏数学
|
||||
*/
|
||||
public ByMath selectByMathById(Long id);
|
||||
|
||||
/**
|
||||
* 查询游戏数学列表
|
||||
*
|
||||
* @param byMath 游戏数学
|
||||
* @return 游戏数学集合
|
||||
*/
|
||||
public List<ByMath> selectByMathList(ByMath byMath);
|
||||
|
||||
/**
|
||||
* 新增游戏数学
|
||||
*
|
||||
* @param byMath 游戏数学
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertByMath(ByMath byMath);
|
||||
|
||||
/**
|
||||
* 修改游戏数学
|
||||
*
|
||||
* @param byMath 游戏数学
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateByMath(ByMath byMath);
|
||||
|
||||
/**
|
||||
* 删除游戏数学
|
||||
*
|
||||
* @param id 游戏数学ID
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteByMathById(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除游戏数学
|
||||
*
|
||||
* @param ids 需要删除的数据ID
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteByMathByIds(Long[] ids);
|
||||
}
|
@ -0,0 +1,61 @@
|
||||
package com.ruoyi.project.benyi.service;
|
||||
|
||||
import java.util.List;
|
||||
import com.ruoyi.project.benyi.domain.ByMath;
|
||||
|
||||
/**
|
||||
* 游戏数学Service接口
|
||||
*
|
||||
* @author tsbz
|
||||
* @date 2020-07-20
|
||||
*/
|
||||
public interface IByMathService
|
||||
{
|
||||
/**
|
||||
* 查询游戏数学
|
||||
*
|
||||
* @param id 游戏数学ID
|
||||
* @return 游戏数学
|
||||
*/
|
||||
public ByMath selectByMathById(Long id);
|
||||
|
||||
/**
|
||||
* 查询游戏数学列表
|
||||
*
|
||||
* @param byMath 游戏数学
|
||||
* @return 游戏数学集合
|
||||
*/
|
||||
public List<ByMath> selectByMathList(ByMath byMath);
|
||||
|
||||
/**
|
||||
* 新增游戏数学
|
||||
*
|
||||
* @param byMath 游戏数学
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertByMath(ByMath byMath);
|
||||
|
||||
/**
|
||||
* 修改游戏数学
|
||||
*
|
||||
* @param byMath 游戏数学
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateByMath(ByMath byMath);
|
||||
|
||||
/**
|
||||
* 批量删除游戏数学
|
||||
*
|
||||
* @param ids 需要删除的游戏数学ID
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteByMathByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 删除游戏数学信息
|
||||
*
|
||||
* @param id 游戏数学ID
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteByMathById(Long id);
|
||||
}
|
@ -0,0 +1,95 @@
|
||||
package com.ruoyi.project.benyi.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
import com.ruoyi.common.utils.DateUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.ruoyi.project.benyi.mapper.ByMathMapper;
|
||||
import com.ruoyi.project.benyi.domain.ByMath;
|
||||
import com.ruoyi.project.benyi.service.IByMathService;
|
||||
|
||||
/**
|
||||
* 游戏数学Service业务层处理
|
||||
*
|
||||
* @author tsbz
|
||||
* @date 2020-07-20
|
||||
*/
|
||||
@Service
|
||||
public class ByMathServiceImpl implements IByMathService
|
||||
{
|
||||
@Autowired
|
||||
private ByMathMapper byMathMapper;
|
||||
|
||||
/**
|
||||
* 查询游戏数学
|
||||
*
|
||||
* @param id 游戏数学ID
|
||||
* @return 游戏数学
|
||||
*/
|
||||
@Override
|
||||
public ByMath selectByMathById(Long id)
|
||||
{
|
||||
return byMathMapper.selectByMathById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询游戏数学列表
|
||||
*
|
||||
* @param byMath 游戏数学
|
||||
* @return 游戏数学
|
||||
*/
|
||||
@Override
|
||||
public List<ByMath> selectByMathList(ByMath byMath)
|
||||
{
|
||||
return byMathMapper.selectByMathList(byMath);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增游戏数学
|
||||
*
|
||||
* @param byMath 游戏数学
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertByMath(ByMath byMath)
|
||||
{
|
||||
byMath.setCreateTime(DateUtils.getNowDate());
|
||||
return byMathMapper.insertByMath(byMath);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改游戏数学
|
||||
*
|
||||
* @param byMath 游戏数学
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateByMath(ByMath byMath)
|
||||
{
|
||||
return byMathMapper.updateByMath(byMath);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除游戏数学
|
||||
*
|
||||
* @param ids 需要删除的游戏数学ID
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteByMathByIds(Long[] ids)
|
||||
{
|
||||
return byMathMapper.deleteByMathByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除游戏数学信息
|
||||
*
|
||||
* @param id 游戏数学ID
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteByMathById(Long id)
|
||||
{
|
||||
return byMathMapper.deleteByMathById(id);
|
||||
}
|
||||
}
|
88
ruoyi/src/main/resources/mybatis/benyi/ByMathMapper.xml
Normal file
88
ruoyi/src/main/resources/mybatis/benyi/ByMathMapper.xml
Normal file
@ -0,0 +1,88 @@
|
||||
<?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.project.benyi.mapper.ByMathMapper">
|
||||
|
||||
<resultMap type="ByMath" id="ByMathResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="name" column="name" />
|
||||
<result property="target" column="target" />
|
||||
<result property="feature" column="feature" />
|
||||
<result property="suggest" column="suggest" />
|
||||
<result property="classtypeId" column="classtype_id" />
|
||||
<result property="sort" column="sort" />
|
||||
<result property="createTime" column="create_time" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectByMathVo">
|
||||
select id, name, target, feature, suggest, classtype_id, sort, create_time from by_math
|
||||
</sql>
|
||||
|
||||
<select id="selectByMathList" parameterType="ByMath" resultMap="ByMathResult">
|
||||
<include refid="selectByMathVo"/>
|
||||
<where>
|
||||
<if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
|
||||
<if test="target != null and target != ''"> and target = #{target}</if>
|
||||
<if test="feature != null and feature != ''"> and feature = #{feature}</if>
|
||||
<if test="suggest != null and suggest != ''"> and suggest = #{suggest}</if>
|
||||
<if test="classtypeId != null "> and classtype_id = #{classtypeId}</if>
|
||||
<if test="sort != null "> and sort = #{sort}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectByMathById" parameterType="Long" resultMap="ByMathResult">
|
||||
<include refid="selectByMathVo"/>
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<insert id="insertByMath" parameterType="ByMath">
|
||||
insert into by_math
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null ">id,</if>
|
||||
<if test="name != null and name != ''">name,</if>
|
||||
<if test="target != null and target != ''">target,</if>
|
||||
<if test="feature != null and feature != ''">feature,</if>
|
||||
<if test="suggest != null and suggest != ''">suggest,</if>
|
||||
<if test="classtypeId != null ">classtype_id,</if>
|
||||
<if test="sort != null ">sort,</if>
|
||||
<if test="createTime != null ">create_time,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null ">#{id},</if>
|
||||
<if test="name != null and name != ''">#{name},</if>
|
||||
<if test="target != null and target != ''">#{target},</if>
|
||||
<if test="feature != null and feature != ''">#{feature},</if>
|
||||
<if test="suggest != null and suggest != ''">#{suggest},</if>
|
||||
<if test="classtypeId != null ">#{classtypeId},</if>
|
||||
<if test="sort != null ">#{sort},</if>
|
||||
<if test="createTime != null ">#{createTime},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateByMath" parameterType="ByMath">
|
||||
update by_math
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="name != null and name != ''">name = #{name},</if>
|
||||
<if test="target != null and target != ''">target = #{target},</if>
|
||||
<if test="feature != null and feature != ''">feature = #{feature},</if>
|
||||
<if test="suggest != null and suggest != ''">suggest = #{suggest},</if>
|
||||
<if test="classtypeId != null ">classtype_id = #{classtypeId},</if>
|
||||
<if test="sort != null ">sort = #{sort},</if>
|
||||
<if test="createTime != null ">create_time = #{createTime},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="deleteByMathById" parameterType="Long">
|
||||
delete from by_math where id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteByMathByIds" parameterType="String">
|
||||
delete from by_math where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
</mapper>
|
Reference in New Issue
Block a user