饮食知识库对象

This commit is contained in:
zhangheng 2024-05-17 17:08:21 +08:00
parent 702b1f0bd4
commit c1389f5648
6 changed files with 623 additions and 0 deletions

View File

@ -0,0 +1,91 @@
package com.xinelu.manage.controller.basesportinfo;
import com.xinelu.common.annotation.Log;
import com.xinelu.common.core.controller.BaseController;
import com.xinelu.common.core.domain.AjaxResult;
import com.xinelu.common.core.page.TableDataInfo;
import com.xinelu.common.enums.BusinessType;
import com.xinelu.common.utils.poi.ExcelUtil;
import com.xinelu.manage.domain.basesportinfo.BaseSportInfo;
import com.xinelu.manage.service.basesportinfo.IBaseSportInfoService;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**
* 运动知识库Controller
*
* @author xinelu
* @date 2024-05-16
*/
@RestController
@RequestMapping("/system/baseSport")
public class BaseSportInfoController extends BaseController {
@Resource
private IBaseSportInfoService baseSportInfoService;
/**
* 查询运动知识库列表
*/
@PreAuthorize("@ss.hasPermi('system:baseSport:list')")
@GetMapping("/list")
public TableDataInfo list(BaseSportInfo baseSportInfo) {
startPage();
List<BaseSportInfo> list = baseSportInfoService.selectBaseSportInfoList(baseSportInfo);
return getDataTable(list);
}
/**
* 导出运动知识库列表
*/
@PreAuthorize("@ss.hasPermi('system:baseSport:export')")
@Log(title = "运动知识库", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, BaseSportInfo baseSportInfo) {
List<BaseSportInfo> list = baseSportInfoService.selectBaseSportInfoList(baseSportInfo);
ExcelUtil<BaseSportInfo> util = new ExcelUtil<>(BaseSportInfo.class);
util.exportExcel(response, list, "运动知识库数据");
}
/**
* 获取运动知识库详细信息
*/
@PreAuthorize("@ss.hasPermi('system:baseSport:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id) {
return AjaxResult.success(baseSportInfoService.selectBaseSportInfoById(id));
}
/**
* 新增运动知识库
*/
@PreAuthorize("@ss.hasPermi('system:baseSport:add')")
@Log(title = "运动知识库", businessType = BusinessType.INSERT)
@PostMapping("/add")
public AjaxResult add(@RequestBody BaseSportInfo baseSportInfo) {
return toAjax(baseSportInfoService.insertBaseSportInfo(baseSportInfo));
}
/**
* 修改运动知识库
*/
@PreAuthorize("@ss.hasPermi('system:baseSport:edit')")
@Log(title = "运动知识库", businessType = BusinessType.UPDATE)
@PutMapping("/edit")
public AjaxResult edit(@RequestBody BaseSportInfo baseSportInfo) {
return toAjax(baseSportInfoService.updateBaseSportInfo(baseSportInfo));
}
/**
* 删除运动知识库
*/
@PreAuthorize("@ss.hasPermi('system:baseSport:remove')")
@Log(title = "运动知识库", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids) {
return toAjax(baseSportInfoService.deleteBaseSportInfoByIds(ids));
}
}

View File

@ -0,0 +1,124 @@
package com.xinelu.manage.domain.basesportinfo;
import com.xinelu.common.annotation.Excel;
import com.xinelu.common.core.domain.BaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
/**
* 运动知识库对象 base_sport_info
*
* @author xinelu
* @date 2024-05-16
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "运动知识库对象", description = "base_sport_info")
public class BaseSportInfo extends BaseEntity {
private static final long serialVersionUID = 1L;
/**
* $column.columnComment
*/
private Long id;
/**
* 运动名称
*/
@ApiModelProperty(value = "运动名称")
@Excel(name = "运动名称")
private String sportName;
/**
* 运动类型ID字典表
*/
@ApiModelProperty(value = "运动类型ID")
@Excel(name = "运动类型ID", readConverterExp = "字=典表")
private Long sportTypeId;
/**
* 运动类型名称
*/
@ApiModelProperty(value = "运动类型名称")
@Excel(name = "运动类型名称")
private String sportTypeName;
/**
* 运动方式
*/
@ApiModelProperty(value = "运动方式")
@Excel(name = "运动方式")
private String sportWay;
/**
* 运动频率
*/
@ApiModelProperty(value = "运动频率")
@Excel(name = "运动频率")
private String sportFrequency;
/**
* 每次运动时长
*/
@ApiModelProperty(value = "每次运动时长")
@Excel(name = "每次运动时长")
private String sportDuration;
/**
* 运动时间
*/
@ApiModelProperty(value = "运动时间")
@Excel(name = "运动时间")
private String sportTime;
/**
* 运动强度
*/
@ApiModelProperty(value = "运动强度")
@Excel(name = "运动强度")
private String sportIntensity;
/**
* 运动注意事项
*/
@ApiModelProperty(value = "运动注意事项")
@Excel(name = "运动注意事项")
private String sportAttention;
/**
* 动作说明
*/
@ApiModelProperty(value = "动作说明")
@Excel(name = "动作说明")
private String sportRemark;
@Override
public String toString() {
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("sportName", getSportName())
.append("sportTypeId", getSportTypeId())
.append("sportTypeName", getSportTypeName())
.append("sportWay", getSportWay())
.append("sportFrequency", getSportFrequency())
.append("sportDuration", getSportDuration())
.append("sportTime", getSportTime())
.append("sportIntensity", getSportIntensity())
.append("sportAttention", getSportAttention())
.append("sportRemark", getSportRemark())
.append("createTime", getCreateTime())
.append("createBy", getCreateBy())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.toString();
}
}

View File

@ -0,0 +1,61 @@
package com.xinelu.manage.mapper.basesportinfo;
import com.xinelu.manage.domain.basesportinfo.BaseSportInfo;
import java.util.List;
/**
* 运动知识库Mapper接口
*
* @author xinelu
* @date 2024-05-16
*/
public interface BaseSportInfoMapper {
/**
* 查询运动知识库
*
* @param id 运动知识库主键
* @return 运动知识库
*/
BaseSportInfo selectBaseSportInfoById(Long id);
/**
* 查询运动知识库列表
*
* @param baseSportInfo 运动知识库
* @return 运动知识库集合
*/
List<BaseSportInfo> selectBaseSportInfoList(BaseSportInfo baseSportInfo);
/**
* 新增运动知识库
*
* @param baseSportInfo 运动知识库
* @return 结果
*/
int insertBaseSportInfo(BaseSportInfo baseSportInfo);
/**
* 修改运动知识库
*
* @param baseSportInfo 运动知识库
* @return 结果
*/
int updateBaseSportInfo(BaseSportInfo baseSportInfo);
/**
* 删除运动知识库
*
* @param id 运动知识库主键
* @return 结果
*/
int deleteBaseSportInfoById(Long id);
/**
* 批量删除运动知识库
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
int deleteBaseSportInfoByIds(Long[] ids);
}

View File

@ -0,0 +1,62 @@
package com.xinelu.manage.service.basesportinfo;
import com.xinelu.manage.domain.basesportinfo.BaseSportInfo;
import java.util.List;
/**
* 运动知识库Service接口
*
* @author xinelu
* @date 2024-05-16
*/
public interface IBaseSportInfoService {
/**
* 查询运动知识库
*
* @param id 运动知识库主键
* @return 运动知识库
*/
BaseSportInfo selectBaseSportInfoById(Long id);
/**
* 查询运动知识库列表
*
* @param baseSportInfo 运动知识库
* @return 运动知识库集合
*/
List<BaseSportInfo> selectBaseSportInfoList(BaseSportInfo baseSportInfo);
/**
* 新增运动知识库
*
* @param baseSportInfo 运动知识库
* @return 结果
*/
int insertBaseSportInfo(BaseSportInfo baseSportInfo);
/**
* 修改运动知识库
*
* @param baseSportInfo 运动知识库
* @return 结果
*/
int updateBaseSportInfo(BaseSportInfo baseSportInfo);
/**
* 批量删除运动知识库
*
* @param ids 需要删除的运动知识库主键集合
* @return 结果
*/
int deleteBaseSportInfoByIds(Long[] ids);
/**
* 删除运动知识库信息
*
* @param id 运动知识库主键
* @return 结果
*/
int deleteBaseSportInfoById(Long id);
}

View File

@ -0,0 +1,90 @@
package com.xinelu.manage.service.basesportinfo.impl;
import com.xinelu.manage.domain.basesportinfo.BaseSportInfo;
import com.xinelu.manage.mapper.basesportinfo.BaseSportInfoMapper;
import com.xinelu.manage.service.basesportinfo.IBaseSportInfoService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.time.LocalDateTime;
import java.util.List;
/**
* 运动知识库Service业务层处理
*
* @author xinelu
* @date 2024-05-16
*/
@Service
public class BaseSportInfoServiceImpl implements IBaseSportInfoService {
@Resource
private BaseSportInfoMapper baseSportInfoMapper;
/**
* 查询运动知识库
*
* @param id 运动知识库主键
* @return 运动知识库
*/
@Override
public BaseSportInfo selectBaseSportInfoById(Long id) {
return baseSportInfoMapper.selectBaseSportInfoById(id);
}
/**
* 查询运动知识库列表
*
* @param baseSportInfo 运动知识库
* @return 运动知识库
*/
@Override
public List<BaseSportInfo> selectBaseSportInfoList(BaseSportInfo baseSportInfo) {
return baseSportInfoMapper.selectBaseSportInfoList(baseSportInfo);
}
/**
* 新增运动知识库
*
* @param baseSportInfo 运动知识库
* @return 结果
*/
@Override
public int insertBaseSportInfo(BaseSportInfo baseSportInfo) {
baseSportInfo.setCreateTime(LocalDateTime.now());
return baseSportInfoMapper.insertBaseSportInfo(baseSportInfo);
}
/**
* 修改运动知识库
*
* @param baseSportInfo 运动知识库
* @return 结果
*/
@Override
public int updateBaseSportInfo(BaseSportInfo baseSportInfo) {
baseSportInfo.setUpdateTime(LocalDateTime.now());
return baseSportInfoMapper.updateBaseSportInfo(baseSportInfo);
}
/**
* 批量删除运动知识库
*
* @param ids 需要删除的运动知识库主键
* @return 结果
*/
@Override
public int deleteBaseSportInfoByIds(Long[] ids) {
return baseSportInfoMapper.deleteBaseSportInfoByIds(ids);
}
/**
* 删除运动知识库信息
*
* @param id 运动知识库主键
* @return 结果
*/
@Override
public int deleteBaseSportInfoById(Long id) {
return baseSportInfoMapper.deleteBaseSportInfoById(id);
}
}

View File

@ -0,0 +1,195 @@
<?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.xinelu.manage.mapper.basesportinfo.BaseSportInfoMapper">
<resultMap type="BaseSportInfo" id="BaseSportInfoResult">
<result property="id" column="id"/>
<result property="sportName" column="sport_name"/>
<result property="sportTypeId" column="sport_type_id"/>
<result property="sportTypeName" column="sport_type_name"/>
<result property="sportWay" column="sport_way"/>
<result property="sportFrequency" column="sport_frequency"/>
<result property="sportDuration" column="sport_duration"/>
<result property="sportTime" column="sport_time"/>
<result property="sportIntensity" column="sport_intensity"/>
<result property="sportAttention" column="sport_attention"/>
<result property="sportRemark" column="sport_remark"/>
<result property="createTime" column="create_time"/>
<result property="createBy" column="create_by"/>
<result property="updateBy" column="update_by"/>
<result property="updateTime" column="update_time"/>
</resultMap>
<sql id="selectBaseSportInfoVo">
select id, sport_name, sport_type_id, sport_type_name, sport_way, sport_frequency, sport_duration, sport_time, sport_intensity, sport_attention, sport_remark, create_time, create_by, update_by, update_time from base_sport_info
</sql>
<select id="selectBaseSportInfoList" parameterType="BaseSportInfo" resultMap="BaseSportInfoResult">
<include refid="selectBaseSportInfoVo"/>
<where>
<if test="sportName != null and sportName != ''">
and sport_name like concat('%', #{sportName}, '%')
</if>
<if test="sportTypeId != null ">
and sport_type_id = #{sportTypeId}
</if>
<if test="sportTypeName != null and sportTypeName != ''">
and sport_type_name like concat('%', #{sportTypeName}, '%')
</if>
<if test="sportWay != null and sportWay != ''">
and sport_way = #{sportWay}
</if>
<if test="sportFrequency != null and sportFrequency != ''">
and sport_frequency = #{sportFrequency}
</if>
<if test="sportDuration != null and sportDuration != ''">
and sport_duration = #{sportDuration}
</if>
<if test="sportTime != null and sportTime != ''">
and sport_time = #{sportTime}
</if>
<if test="sportIntensity != null and sportIntensity != ''">
and sport_intensity = #{sportIntensity}
</if>
<if test="sportAttention != null and sportAttention != ''">
and sport_attention = #{sportAttention}
</if>
<if test="sportRemark != null and sportRemark != ''">
and sport_remark = #{sportRemark}
</if>
</where>
</select>
<select id="selectBaseSportInfoById" parameterType="Long"
resultMap="BaseSportInfoResult">
<include refid="selectBaseSportInfoVo"/>
where id = #{id}
</select>
<insert id="insertBaseSportInfo" parameterType="BaseSportInfo" useGeneratedKeys="true"
keyProperty="id">
insert into base_sport_info
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="sportName != null">sport_name,
</if>
<if test="sportTypeId != null">sport_type_id,
</if>
<if test="sportTypeName != null">sport_type_name,
</if>
<if test="sportWay != null">sport_way,
</if>
<if test="sportFrequency != null">sport_frequency,
</if>
<if test="sportDuration != null">sport_duration,
</if>
<if test="sportTime != null">sport_time,
</if>
<if test="sportIntensity != null">sport_intensity,
</if>
<if test="sportAttention != null">sport_attention,
</if>
<if test="sportRemark != null">sport_remark,
</if>
<if test="createTime != null">create_time,
</if>
<if test="createBy != null">create_by,
</if>
<if test="updateBy != null">update_by,
</if>
<if test="updateTime != null">update_time,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="sportName != null">#{sportName},
</if>
<if test="sportTypeId != null">#{sportTypeId},
</if>
<if test="sportTypeName != null">#{sportTypeName},
</if>
<if test="sportWay != null">#{sportWay},
</if>
<if test="sportFrequency != null">#{sportFrequency},
</if>
<if test="sportDuration != null">#{sportDuration},
</if>
<if test="sportTime != null">#{sportTime},
</if>
<if test="sportIntensity != null">#{sportIntensity},
</if>
<if test="sportAttention != null">#{sportAttention},
</if>
<if test="sportRemark != null">#{sportRemark},
</if>
<if test="createTime != null">#{createTime},
</if>
<if test="createBy != null">#{createBy},
</if>
<if test="updateBy != null">#{updateBy},
</if>
<if test="updateTime != null">#{updateTime},
</if>
</trim>
</insert>
<update id="updateBaseSportInfo" parameterType="BaseSportInfo">
update base_sport_info
<trim prefix="SET" suffixOverrides=",">
<if test="sportName != null">sport_name =
#{sportName},
</if>
<if test="sportTypeId != null">sport_type_id =
#{sportTypeId},
</if>
<if test="sportTypeName != null">sport_type_name =
#{sportTypeName},
</if>
<if test="sportWay != null">sport_way =
#{sportWay},
</if>
<if test="sportFrequency != null">sport_frequency =
#{sportFrequency},
</if>
<if test="sportDuration != null">sport_duration =
#{sportDuration},
</if>
<if test="sportTime != null">sport_time =
#{sportTime},
</if>
<if test="sportIntensity != null">sport_intensity =
#{sportIntensity},
</if>
<if test="sportAttention != null">sport_attention =
#{sportAttention},
</if>
<if test="sportRemark != null">sport_remark =
#{sportRemark},
</if>
<if test="createTime != null">create_time =
#{createTime},
</if>
<if test="createBy != null">create_by =
#{createBy},
</if>
<if test="updateBy != null">update_by =
#{updateBy},
</if>
<if test="updateTime != null">update_time =
#{updateTime},
</if>
</trim>
where id = #{id}
</update>
<delete id="deleteBaseSportInfoById" parameterType="Long">
delete from base_sport_info where id = #{id}
</delete>
<delete id="deleteBaseSportInfoByIds" parameterType="String">
delete from base_sport_info where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>