完善c端接口

This commit is contained in:
menxipeng
2025-08-01 16:06:05 +08:00
parent f8a898687b
commit 0c82bef933
10 changed files with 466 additions and 8 deletions

View File

@@ -0,0 +1,62 @@
package com.ruoyi.system.mapper;
import com.ruoyi.common.core.domain.entity.Tag;
import java.util.List;
/**
* 【请填写功能名称】Mapper接口
*
* @author ruoyi
* @date 2025-07-22
*/
public interface TagMapper
{
/**
* 查询【请填写功能名称】
*
* @param id 【请填写功能名称】主键
* @return 【请填写功能名称】
*/
public Tag selectTagById(String id);
/**
* 查询【请填写功能名称】列表
*
* @param tag 【请填写功能名称】
* @return 【请填写功能名称】集合
*/
public List<Tag> selectTagList(Tag tag);
/**
* 新增【请填写功能名称】
*
* @param tag 【请填写功能名称】
* @return 结果
*/
public int insertTag(Tag tag);
/**
* 修改【请填写功能名称】
*
* @param tag 【请填写功能名称】
* @return 结果
*/
public int updateTag(Tag tag);
/**
* 删除【请填写功能名称】
*
* @param id 【请填写功能名称】主键
* @return 结果
*/
public int deleteTagById(String id);
/**
* 批量删除【请填写功能名称】
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deleteTagByIds(String[] ids);
}

View File

@@ -0,0 +1,62 @@
package com.ruoyi.system.service;
import com.ruoyi.common.core.domain.entity.Tag;
import java.util.List;
/**
* 【请填写功能名称】Service接口
*
* @author ruoyi
* @date 2025-07-22
*/
public interface ITagService
{
/**
* 查询【请填写功能名称】
*
* @param id 【请填写功能名称】主键
* @return 【请填写功能名称】
*/
public Tag selectTagById(String id);
/**
* 查询【请填写功能名称】列表
*
* @param tag 【请填写功能名称】
* @return 【请填写功能名称】集合
*/
public List<Tag> selectTagList(Tag tag);
/**
* 新增【请填写功能名称】
*
* @param tag 【请填写功能名称】
* @return 结果
*/
public int insertTag(Tag tag);
/**
* 修改【请填写功能名称】
*
* @param tag 【请填写功能名称】
* @return 结果
*/
public int updateTag(Tag tag);
/**
* 批量删除【请填写功能名称】
*
* @param ids 需要删除的【请填写功能名称】主键集合
* @return 结果
*/
public int deleteTagByIds(String[] ids);
/**
* 删除【请填写功能名称】信息
*
* @param id 【请填写功能名称】主键
* @return 结果
*/
public int deleteTagById(String id);
}

View File

@@ -0,0 +1,96 @@
package com.ruoyi.system.service.impl;
import com.ruoyi.common.core.domain.entity.Tag;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.system.mapper.TagMapper;
import com.ruoyi.system.service.ITagService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* 【请填写功能名称】Service业务层处理
*
* @author ruoyi
* @date 2025-07-22
*/
@Service
public class TagServiceImpl implements ITagService
{
@Autowired
private TagMapper tagMapper;
/**
* 查询【请填写功能名称】
*
* @param id 【请填写功能名称】主键
* @return 【请填写功能名称】
*/
@Override
public Tag selectTagById(String id)
{
return tagMapper.selectTagById(id);
}
/**
* 查询【请填写功能名称】列表
*
* @param tag 【请填写功能名称】
* @return 【请填写功能名称】
*/
@Override
public List<Tag> selectTagList(Tag tag)
{
return tagMapper.selectTagList(tag);
}
/**
* 新增【请填写功能名称】
*
* @param tag 【请填写功能名称】
* @return 结果
*/
@Override
public int insertTag(Tag tag)
{
tag.setCreateTime(DateUtils.getNowDate());
return tagMapper.insertTag(tag);
}
/**
* 修改【请填写功能名称】
*
* @param tag 【请填写功能名称】
* @return 结果
*/
@Override
public int updateTag(Tag tag)
{
return tagMapper.updateTag(tag);
}
/**
* 批量删除【请填写功能名称】
*
* @param ids 需要删除的【请填写功能名称】主键
* @return 结果
*/
@Override
public int deleteTagByIds(String[] ids)
{
return tagMapper.deleteTagByIds(ids);
}
/**
* 删除【请填写功能名称】信息
*
* @param id 【请填写功能名称】主键
* @return 结果
*/
@Override
public int deleteTagById(String id)
{
return tagMapper.deleteTagById(id);
}
}

View File

@@ -0,0 +1,60 @@
<?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.system.mapper.TagMapper">
<resultMap type="Tag" id="TagResult">
<result property="id" column="id" />
<result property="name" column="name" />
<result property="createTime" column="create_time" />
</resultMap>
<sql id="selectTagVo">
select id, name, create_time from tag
</sql>
<select id="selectTagList" parameterType="Tag" resultMap="TagResult">
<include refid="selectTagVo"/>
<where>
<if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
</where>
</select>
<select id="selectTagById" parameterType="String" resultMap="TagResult">
<include refid="selectTagVo"/>
where id = #{id}
</select>
<insert id="insertTag" parameterType="Tag" useGeneratedKeys="true" keyProperty="id">
insert into tag
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="name != null">name,</if>
<if test="createTime != null">create_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="name != null">#{name},</if>
<if test="createTime != null">#{createTime},</if>
</trim>
</insert>
<update id="updateTag" parameterType="Tag">
update tag
<trim prefix="SET" suffixOverrides=",">
<if test="name != null">name = #{name},</if>
<if test="createTime != null">create_time = #{createTime},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteTagById" parameterType="String">
delete from tag where id = #{id}
</delete>
<delete id="deleteTagByIds" parameterType="String">
delete from tag where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>