feat(item): 新增 PkItem 实体及 CRUD 全套代码

新增 PkItem.java 实体、Mapper、Service、Controller 与 XML,并配置 MyBatisCodeHelper 生成规则,同时忽略 /src/test/ 目录
This commit is contained in:
2026-03-27 11:53:35 +08:00
parent 79d541e4df
commit 37ebde7b9d
9 changed files with 411 additions and 0 deletions

1
.gitignore vendored
View File

@@ -28,3 +28,4 @@ replay_pid*
/target/
/AGENTS.md
/.xcodemap/
/src/test/

Binary file not shown.

View File

@@ -4,8 +4,44 @@
<option name="projectProfile">
<ProjectProfile>
<option name="controllerTemplateString" value="&#10;#* @vtlvariable name=&quot;tableName&quot; type=&quot;java.lang.String&quot; *#&#10;#* @vtlvariable name=&quot;entityPackageName&quot; type=&quot;java.lang.String&quot; *#&#10;#* @vtlvariable name=&quot;entityClassName&quot; type=&quot;java.lang.String&quot; *#&#10;#* @vtlvariable name=&quot;servicePackageName&quot; type=&quot;java.lang.String&quot; *#&#10;#* @vtlvariable name=&quot;serviceInterfacePackage&quot; type=&quot;java.lang.String&quot; *#&#10;#* @vtlvariable name=&quot;serviceClassName&quot; type=&quot;java.lang.String&quot; *#&#10;#* @vtlvariable name=&quot;serviceInterfaceClassName&quot; type=&quot;java.lang.String&quot; *#&#10;#* @vtlvariable name=&quot;mapperPackageName&quot; type=&quot;java.lang.String&quot; *#&#10;#* @vtlvariable name=&quot;mapperClassName&quot; type=&quot;java.lang.String&quot; *#&#10;#* @vtlvariable name=&quot;controllerPackage&quot; type=&quot;java.lang.String&quot; *#&#10;#* @vtlvariable name=&quot;tableRemark&quot; type=&quot;java.lang.String&quot; *#&#10;#* @vtlvariable name=&quot;myDate&quot; type=&quot;java.util.Date&quot; *#&#10;#* @vtlvariable name=&quot;simpleDateFormat&quot; type=&quot;java.text.SimpleDateFormat&quot; *#&#10;package $!{controllerPackage};&#10;import $!{entityPackageName}.$!{entityClassName};&#10;###set($realServiceName = $!{serviceClassName}+'Impl')&#10;import $!{servicePackageName}.$!{serviceClassName};&#10;import org.springframework.web.bind.annotation.*;&#10;&#10;#set($serviceFirstLower = $!{serviceClassName.substring(0,1).toLowerCase()}+$!{serviceClassName.substring(1,$!{serviceClassName.length()})})&#10;import org.springframework.beans.factory.annotation.Autowired;&#10;&#10;/**&#10;* $!{tableRemark}($!{tableName})表控制层&#10;*&#10;* @author xxxxx&#10;*/&#10;@RestController&#10;@RequestMapping(&quot;/$!{tableName}&quot;)&#10;public class $!{entityClassName}Controller {&#10;/**&#10;* 服务对象&#10;*/&#10; @Autowired&#10; private $!{serviceClassName} $!{serviceFirstLower};&#10;&#10; /**&#10; * 通过主键查询单条数据&#10; *&#10; * @param id 主键&#10; * @return 单条数据&#10; */&#10; @GetMapping(&quot;selectOne&quot;)&#10; public $!{entityClassName} selectOne(Integer id) {&#10; return $!{serviceFirstLower}.selectByPrimaryKey(id);&#10; }&#10;&#10;}" />
<option name="javaMapperPackage" value="vvpkassistant.item" />
<option name="javaMapperPath" value="$PROJECT_DIR$/src/main/java" />
<option name="javaModelPackage" value="vvpkassistant.item.model" />
<option name="javaModelPath" value="$PROJECT_DIR$/src/main/java" />
<option name="lastDatabaseCrudChooseModuleName" value="vvPkAssistant" />
<option name="moduleNameToPackageAndPathMap">
<map>
<entry key="vvPkAssistant">
<value>
<UserPackageAndPathInfoByModule>
<option name="javaMapperPackage" value="vvpkassistant.item" />
<option name="javaMapperPath" value="$PROJECT_DIR$/src/main/java" />
<option name="javaModelPacakge" value="vvpkassistant.item.model" />
<option name="javaModelPath" value="$PROJECT_DIR$/src/main/java" />
<option name="javaServiceInterfacePath" value="$PROJECT_DIR$/src/main/java" />
<option name="javaServicePath" value="$PROJECT_DIR$/src/main/java" />
<option name="xmlPackage" value="mapper" />
<option name="xmlPath" value="$PROJECT_DIR$/src/main/resources" />
</UserPackageAndPathInfoByModule>
</value>
</entry>
</map>
</option>
<option name="tableGenerateConfigs">
<map>
<entry key="ruoyi-vue-pro:pk_item">
<value>
<TableGenerateConfig>
<option name="generatedKey" value="" />
<option name="javaModelName" value="PkItem" />
<option name="moduleName" value="vvPkAssistant" />
<option name="mybatisplusIdType" value="INPUT" />
<option name="sequenceColumn" value="" />
<option name="sequenceId" value="" />
<option name="useActualColumnName" value="false" />
</TableGenerateConfig>
</value>
</entry>
<entry key="vv_assistant:user">
<value>
<TableGenerateConfig>
@@ -19,6 +55,8 @@
</entry>
</map>
</option>
<option name="xmlMapperPackage" value="mapper" />
<option name="xmlMapperPath" value="$PROJECT_DIR$/src/main/resources" />
</ProjectProfile>
</option>
</component>

View File

@@ -0,0 +1,24 @@
package vvpkassistant.controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import vvpkassistant.Data.ResponseData;
import vvpkassistant.item.model.PkItem;
import vvpkassistant.item.service.PkItemService;
import javax.annotation.Resource;
import java.util.List;
@RestController
@RequestMapping("pkItem")
public class PkItemController {
@Resource
private PkItemService pkItemService;
@GetMapping("list")
public ResponseData<List<PkItem>> list() {
return ResponseData.success(pkItemService.selectItemList());
}
}

View File

@@ -0,0 +1,27 @@
package vvpkassistant.item;
import org.apache.ibatis.annotations.Mapper;
import vvpkassistant.item.model.PkItem;
import java.util.List;
/*
* @author: ziin
* @date: 2026/3/27 10:13
*/
@Mapper
public interface PkItemMapper {
int deleteByPrimaryKey(Long id);
int insert(PkItem record);
int insertSelective(PkItem record);
PkItem selectByPrimaryKey(Long id);
List<PkItem> selectItemList();
int updateByPrimaryKeySelective(PkItem record);
int updateByPrimaryKey(PkItem record);
}

View File

@@ -0,0 +1,78 @@
package vvpkassistant.item.model;
import lombok.Data;
import java.util.Date;
/*
* @author: ziin
* @date: 2026/3/27 10:13
*/
@Data
public class PkItem {
/**
* 主键Id
*/
private Long id;
/**
* 套餐名称
*/
private String itemName;
/**
* 套餐价格
*/
private Integer itemPrice;
/**
* 套餐描述
*/
private String itemDesc;
/**
* 功能
*/
private String itemFunction;
/**
* 时长
*/
private Integer itemDuration;
/**
* 是否上架
*/
private Integer itemStatus;
/**
* 备注
*/
private String remark;
/**
* 创建者
*/
private String creator;
/**
* 创建时间
*/
private Date createTime;
/**
* 更新者
*/
private String updater;
/**
* 更新时间
*/
private Date updateTime;
/**
* 是否删除
*/
private Boolean deleted;
}

View File

@@ -0,0 +1,13 @@
package vvpkassistant.item.service;
import vvpkassistant.item.model.PkItem;
import java.util.List;
/*
* @author: ziin
* @date: 2026/3/27 10:13
*/
public interface PkItemService {
List<PkItem> selectItemList();
}

View File

@@ -0,0 +1,24 @@
package vvpkassistant.item.service;
import org.springframework.stereotype.Service;
import vvpkassistant.item.PkItemMapper;
import vvpkassistant.item.model.PkItem;
import javax.annotation.Resource;
import java.util.List;
/*
* @author: ziin
* @date: 2026/3/27 10:13
*/
@Service
public class PkItemServiceImpl implements PkItemService {
@Resource
private PkItemMapper pkItemMapper;
@Override
public List<PkItem> selectItemList() {
return pkItemMapper.selectItemList();
}
}

View File

@@ -0,0 +1,206 @@
<?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="vvpkassistant.item.PkItemMapper">
<resultMap id="BaseResultMap" type="vvpkassistant.item.model.PkItem">
<!--@mbg.generated-->
<!--@Table pk_item-->
<id column="id" jdbcType="BIGINT" property="id" />
<result column="item_name" jdbcType="VARCHAR" property="itemName" />
<result column="item_price" jdbcType="INTEGER" property="itemPrice" />
<result column="item_desc" jdbcType="VARCHAR" property="itemDesc" />
<result column="item_function" jdbcType="VARCHAR" property="itemFunction" />
<result column="item_duration" jdbcType="INTEGER" property="itemDuration" />
<result column="item_status" jdbcType="INTEGER" property="itemStatus" />
<result column="remark" jdbcType="VARCHAR" property="remark" />
<result column="creator" jdbcType="VARCHAR" property="creator" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="updater" jdbcType="VARCHAR" property="updater" />
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
<result column="deleted" jdbcType="BIT" property="deleted" />
</resultMap>
<sql id="Base_Column_List">
<!--@mbg.generated-->
id, item_name, item_price, item_desc, item_function, item_duration, item_status,
remark, creator, create_time, updater, update_time, deleted
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
<!--@mbg.generated-->
select
<include refid="Base_Column_List" />
from pk_item
where id = #{id,jdbcType=BIGINT}
</select>
<select id="selectItemList" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from pk_item
where deleted = 0
and
item_status = 0
order by id desc
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
<!--@mbg.generated-->
delete from pk_item
where id = #{id,jdbcType=BIGINT}
</delete>
<insert id="insert" parameterType="vvpkassistant.item.model.PkItem">
<!--@mbg.generated-->
insert into pk_item (id, item_name, item_price,
item_desc, item_function, item_duration,
item_status, remark, creator,
create_time, updater, update_time,
deleted)
values (#{id,jdbcType=BIGINT}, #{itemName,jdbcType=VARCHAR}, #{itemPrice,jdbcType=INTEGER},
#{itemDesc,jdbcType=VARCHAR}, #{itemFunction,jdbcType=VARCHAR}, #{itemDuration,jdbcType=INTEGER},
#{itemStatus,jdbcType=INTEGER}, #{remark,jdbcType=VARCHAR}, #{creator,jdbcType=VARCHAR},
#{createTime,jdbcType=TIMESTAMP}, #{updater,jdbcType=VARCHAR}, #{updateTime,jdbcType=TIMESTAMP},
#{deleted,jdbcType=BIT})
</insert>
<insert id="insertSelective" parameterType="vvpkassistant.item.model.PkItem">
<!--@mbg.generated-->
insert into pk_item
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
<if test="itemName != null">
item_name,
</if>
<if test="itemPrice != null">
item_price,
</if>
<if test="itemDesc != null">
item_desc,
</if>
<if test="itemFunction != null">
item_function,
</if>
<if test="itemDuration != null">
item_duration,
</if>
<if test="itemStatus != null">
item_status,
</if>
<if test="remark != null">
remark,
</if>
<if test="creator != null">
creator,
</if>
<if test="createTime != null">
create_time,
</if>
<if test="updater != null">
updater,
</if>
<if test="updateTime != null">
update_time,
</if>
<if test="deleted != null">
deleted,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id,jdbcType=BIGINT},
</if>
<if test="itemName != null">
#{itemName,jdbcType=VARCHAR},
</if>
<if test="itemPrice != null">
#{itemPrice,jdbcType=INTEGER},
</if>
<if test="itemDesc != null">
#{itemDesc,jdbcType=VARCHAR},
</if>
<if test="itemFunction != null">
#{itemFunction,jdbcType=VARCHAR},
</if>
<if test="itemDuration != null">
#{itemDuration,jdbcType=INTEGER},
</if>
<if test="itemStatus != null">
#{itemStatus,jdbcType=INTEGER},
</if>
<if test="remark != null">
#{remark,jdbcType=VARCHAR},
</if>
<if test="creator != null">
#{creator,jdbcType=VARCHAR},
</if>
<if test="createTime != null">
#{createTime,jdbcType=TIMESTAMP},
</if>
<if test="updater != null">
#{updater,jdbcType=VARCHAR},
</if>
<if test="updateTime != null">
#{updateTime,jdbcType=TIMESTAMP},
</if>
<if test="deleted != null">
#{deleted,jdbcType=BIT},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="vvpkassistant.item.model.PkItem">
<!--@mbg.generated-->
update pk_item
<set>
<if test="itemName != null">
item_name = #{itemName,jdbcType=VARCHAR},
</if>
<if test="itemPrice != null">
item_price = #{itemPrice,jdbcType=INTEGER},
</if>
<if test="itemDesc != null">
item_desc = #{itemDesc,jdbcType=VARCHAR},
</if>
<if test="itemFunction != null">
item_function = #{itemFunction,jdbcType=VARCHAR},
</if>
<if test="itemDuration != null">
item_duration = #{itemDuration,jdbcType=INTEGER},
</if>
<if test="itemStatus != null">
item_status = #{itemStatus,jdbcType=INTEGER},
</if>
<if test="remark != null">
remark = #{remark,jdbcType=VARCHAR},
</if>
<if test="creator != null">
creator = #{creator,jdbcType=VARCHAR},
</if>
<if test="createTime != null">
create_time = #{createTime,jdbcType=TIMESTAMP},
</if>
<if test="updater != null">
updater = #{updater,jdbcType=VARCHAR},
</if>
<if test="updateTime != null">
update_time = #{updateTime,jdbcType=TIMESTAMP},
</if>
<if test="deleted != null">
deleted = #{deleted,jdbcType=BIT},
</if>
</set>
where id = #{id,jdbcType=BIGINT}
</update>
<update id="updateByPrimaryKey" parameterType="vvpkassistant.item.model.PkItem">
<!--@mbg.generated-->
update pk_item
set item_name = #{itemName,jdbcType=VARCHAR},
item_price = #{itemPrice,jdbcType=INTEGER},
item_desc = #{itemDesc,jdbcType=VARCHAR},
item_function = #{itemFunction,jdbcType=VARCHAR},
item_duration = #{itemDuration,jdbcType=INTEGER},
item_status = #{itemStatus,jdbcType=INTEGER},
remark = #{remark,jdbcType=VARCHAR},
creator = #{creator,jdbcType=VARCHAR},
create_time = #{createTime,jdbcType=TIMESTAMP},
updater = #{updater,jdbcType=VARCHAR},
update_time = #{updateTime,jdbcType=TIMESTAMP},
deleted = #{deleted,jdbcType=BIT}
where id = #{id,jdbcType=BIGINT}
</update>
</mapper>