# template_config

name: entity
file_name: ${context.classNamePascal}.java
group_name: default
content:
  package ${context.packageName}.entity;

  #if(${table.hasDateField})
  import java.util.Date;
  #end
  #if(${table.hasLocalDateField})
  import java.time.LocalDate;
  #end
  #if(${table.hasLocalDateTimeField})
  import java.time.LocalDateTime;
  #end
  #if(${table.hasBigDecimalField})
  import java.math.BigDecimal;
  #end

  #if( "${table.comment}" != "" )
  /**
   * ${table.comment}
   */
  #end
  public class ${context.javaBeanName} {
  #foreach($column in $columns)
  #if( "${column.comment}" != "" )
  	/** ${column.comment} */
  #end
  	private ${column.javaTypeBox} ${column.javaFieldName};
  #end

  #foreach(${column} in ${columns})
  	public void set${column.javaFieldNameUF}(${column.javaTypeBox} ${column.javaFieldName}) {
  		this.${column.javaFieldName} = ${column.javaFieldName};
  	}
  	
  	public ${column.javaTypeBox} get${column.javaFieldNameUF}() {
  		return this.${column.javaFieldName};
  	}
  	
  #end

  	@Override
      public boolean equals(Object o) {
          if (this == o) { return true; }
          if (o == null || getClass() != o.getClass()) {return false;}
          ${context.javaBeanName} that = (${context.javaBeanName}) o;
          return ${pk.javaFieldName}.equals(that.${pk.javaFieldName});
      }

      @Override
      public int hashCode() {
          return java.util.Objects.hash(${pk.javaFieldName});
      }
      
      @Override
      public String toString() {
          return "${context.javaBeanName}{" +
  #foreach(${column} in ${columns})
  		#if($velocityCount == 1)
  		"${column.javaFieldName}=" + ${column.javaFieldName} +
  		#else
  		",${column.javaFieldName}='" + ${column.javaFieldName} + "'" + 
  		#end
  #end
                  '}';
      }
  	
  }


name: mybatis
file_name: ${context.classNamePascal}Mapper.xml
group_name: default
content:
  #set($jq="$")
  <?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="${context.packageName}.mapper.${context.javaBeanName}Mapper">
  	<resultMap id="BaseResultMap" type="${context.packageName}.entity.${context.javaBeanName}">
      #foreach($column in $columns)    
          <result column="${column.columnName}" property="${column.javaFieldName}" />
  	#end
  	</resultMap>  
      
      <!-- 表字段 -->
      <sql id="baseColumns">
      #foreach($column in $columns)
      #if($velocityCount > 1),#end t.${column.columnName}
      #end
      </sql> 
      
      <!-- 查询全部 -->
      <select id="listAll" resultMap="BaseResultMap">
  		SELECT         
          	<include refid="baseColumns" />
  		FROM ${table.tableName} t
  	</select>
   
   	<!-- 根据主键获取单条记录 -->
      <select id="getById" resultMap="BaseResultMap" parameterType="${pk.javaTypeBox}">
  		SELECT         
          	<include refid="baseColumns" />
  		FROM ${table.tableName} t
  		WHERE ${pk.columnName} = #{${pk.javaFieldName}}
  	</select>

  	<!-- 插入全部字段 -->
      <insert id="insert" parameterType="${context.packageName}.entity.${context.javaBeanName}"
  		keyProperty="${context.javaPkName}" keyColumn="${context.pkName}" useGeneratedKeys="true"
      >
  	INSERT INTO ${table.tableName}
      <trim prefix="(" suffix=")" suffixOverrides=",">	 
      #foreach($column in $columns) 
      	#if(!${column.isIdentityPk}) 
      	${column.columnName},
      	#end          
      #end
      </trim>
      <trim prefix="VALUES (" suffix=")" suffixOverrides=",">            
      #foreach($column in $columns) 
      	#if(!${column.isIdentityPk})                     
          #{${column.javaFieldName}},                   
      	#end          
      #end
      </trim>
  	</insert>
      
      <!-- 插入不为NULL的字段 -->
      <insert id="insertIgnoreNull" parameterType="${context.packageName}.entity.${context.javaBeanName}"
          keyProperty="${pk.javaFieldName}" keyColumn="${context.pkName}" useGeneratedKeys="true"
          >
          INSERT INTO ${table.tableName}    
          <trim prefix="(" suffix=")" suffixOverrides=",">	 

              #foreach($column in $columns) 
                  #if(!${column.isIdentityPk}) 
                      <if test="${column.javaFieldName} != null">
                     ${column.columnName},
                      </if>
                  #end          
              #end
          </trim>
          <trim prefix="VALUES (" suffix=")" suffixOverrides=",">            
              #foreach($column in $columns) 
                  #if(!${column.isIdentityPk})  
                      <if test="${column.javaFieldName} != null" >
                      #{${column.javaFieldName}},                    
                      </if>
                  #end          
              #end
          </trim>
      </insert>

  	<!-- 更新,更新全部字段 -->
      <update id="update" parameterType="${context.packageName}.entity.${context.javaBeanName}">
      UPDATE ${table.tableName}
       <set>		
       #foreach($column in $columns) 
           #if(!${column.isPk})               
           ${column.columnName}=#{${column.javaFieldName}},        
           #end          
       #end
       </set>	
      WHERE ${pk.columnName} = #{${pk.javaFieldName}}
      </update>  
      
      
      <!-- 更新不为NULL的字段 -->
      <update id="updateIgnoreNull" parameterType="${context.packageName}.entity.${context.javaBeanName}">
      UPDATE ${table.tableName}
      <set>
      	#foreach($column in $columns) 
              #if(!${column.isPk})  
                  <if test="${column.javaFieldName} != null" >
                  ${column.columnName}=#{${column.javaFieldName}},                 
                  </if>
              #end          
          #end
      </set>
      WHERE ${pk.columnName} = #{${pk.javaFieldName}}
      </update>

  		
  	<!-- 根据主键删除记录 -->
  	<delete id="delete" parameterType="${context.packageName}.entity.${context.javaBeanName}">
  		UPDATE ${table.tableName}
  		SET is_deleted=1
  		WHERE ${pk.columnName} = #{${pk.javaFieldName}}
  	</delete>


  </mapper>


name: dao
file_name: ${context.classNamePascal}Mapper.java
group_name: default
content:
  package ${context.packageName}.mapper;

  import java.util.List;
  import org.apache.ibatis.annotations.Mapper;
  import ${context.packageName}.entity.${context.javaBeanName};

  @Mapper
  public interface ${context.javaBeanName}Mapper {

  	/**
       * 查询所有记录
       *
       * @return 返回集合，没有返回空List
       */
  	List<${context.javaBeanName}> listAll();


  	/**
       * 根据主键查询
       *
       * @param id 主键
       * @return 返回记录，没有返回null
       */
  	${context.javaBeanName} getById(${pk.javaTypeBox} ${pk.javaFieldName});
  	
  	/**
       * 新增，插入所有字段
       *
       * @param ${context.javaBeanNameLF} 新增的记录
       * @return 返回影响行数
       */
  	int insert(${context.javaBeanName} ${context.javaBeanNameLF});
  	
  	/**
       * 新增，忽略null字段
       *
       * @param ${context.javaBeanNameLF} 新增的记录
       * @return 返回影响行数
       */
  	int insertIgnoreNull(${context.javaBeanName} ${context.javaBeanNameLF});
  	
  	/**
       * 修改，修改所有字段
       *
       * @param ${context.javaBeanNameLF} 修改的记录
       * @return 返回影响行数
       */
  	int update(${context.javaBeanName} ${context.javaBeanNameLF});
  	
  	/**
       * 修改，忽略null字段
       *
       * @param ${context.javaBeanNameLF} 修改的记录
       * @return 返回影响行数
       */
  	int updateIgnoreNull(${context.javaBeanName} ${context.javaBeanNameLF});
  	
  	/**
       * 删除记录
       *
       * @param ${context.javaBeanNameLF} 待删除的记录
       * @return 返回影响行数
       */
  	int delete(${context.javaBeanName} ${context.javaBeanNameLF});
  	
  }


name: service
file_name: ${context.classNamePascal}Service.java
group_name: default
content:
  #set($serviceClass="${context.classNamePascal}Service")
  #set($mapperClass="${context.classNamePascal}Mapper")
  #set($mapperObj="${context.classNameCamel}Mapper")
  #set($entityClass="${context.classNamePascal}")
  #set($entityObj="${context.classNameCamel}")
  package ${context.packageName}.mapper;

  import ${context.packageName}.entity.${entityClass};
  import ${context.packageName}.mapper.${mapperClass};
  import org.springframework.beans.factory.annotation.Autowired;
  import org.springframework.stereotype.Service;

  import java.util.List;

  @Service
  public class ${serviceClass} {

      @Autowired
      private ${mapperClass} ${mapperObj};

      /**
       * 查询所有记录
       *
       * @return 返回集合，没有返回空List
       */
      public List<${entityClass}> listAll() {
      	return ${mapperObj}.listAll();
      }


      /**
       * 根据主键查询
       *
       * @param id 主键
       * @return 返回记录，没有返回null
       */
      public ${entityClass} getById(${pk.javaTypeBox} ${pk.javaFieldName}) {
      	return ${mapperObj}.getById(${pk.javaFieldName});
      }
  	
      /**
       * 新增，插入所有字段
       *
       * @param ${entityObj} 新增的记录
       * @return 返回影响行数
       */
      public int insert(${entityClass} ${entityObj}) {
      	return ${mapperObj}.insert(${entityObj});
      }
  	
      /**
       * 新增，忽略null字段
       *
       * @param ${entityObj} 新增的记录
       * @return 返回影响行数
       */
      public int insertIgnoreNull(${entityClass} ${entityObj}) {
      	return ${mapperObj}.insertIgnoreNull(${entityObj});
      }
  	
      /**
       * 修改，修改所有字段
       *
       * @param ${entityObj} 修改的记录
       * @return 返回影响行数
       */
      public int update(${entityClass} ${entityObj}) {
      	return ${mapperObj}.update(${entityObj});
      }
  	
      /**
       * 修改，忽略null字段
       *
       * @param ${entityObj} 修改的记录
       * @return 返回影响行数
       */
      public int updateIgnoreNull(${entityClass} ${entityObj}) {
      	return ${mapperObj}.updateIgnoreNull(${entityObj});
      }
  	
      /**
       * 删除记录
       *
       * @param ${entityObj} 待删除的记录
       * @return 返回影响行数
       */
      public int delete(${entityClass} ${entityObj}) {
      	return ${mapperObj}.delete(${entityObj});
      }
  	
  }


name: controller
file_name: ${context.classNamePascal}Controller.java
group_name: default
content:
  #set($controllerClass="${context.classNamePascal}Controller")
  #set($serviceClass="${context.classNamePascal}Service")
  #set($serviceObj="${context.classNameCamel}Service")
  #set($entityClass="${context.classNamePascal}")
  #set($entityObj="${context.classNameCamel}")
  package ${context.packageName}.mapper;

  import java.util.List;
  import org.springframework.beans.factory.annotation.Autowired;
  import org.springframework.web.bind.annotation.RequestMapping;
  import org.springframework.web.bind.annotation.RequestBody;
  import org.springframework.web.bind.annotation.RestController;

  import ${context.packageName}.entity.${entityClass};
  import ${context.packageName}.service.${serviceClass};

  @RestController
  public class ${controllerClass} {

      @Autowired
      private ${serviceClass} ${serviceObj};

      /**
       * 查询所有记录
       *
       * @return 返回集合，没有返回空List
       */
      @RequestMapping("list")
      public List<${entityClass}> listAll() {
          return ${serviceObj}.listAll();
      }


      /**
       * 根据主键查询
       *
       * @param id 主键
       * @return 返回记录，没有返回null
       */
      @RequestMapping("getById")
      public ${entityClass} getById(${pk.javaTypeBox} ${pk.javaFieldName}) {
          return ${serviceObj}.getById(${pk.javaFieldName});
      }    
       
      /**
       * 新增，忽略null字段
       *
       * @param ${entityObj} 新增的记录
       * @return 返回影响行数
       */
      @RequestMapping("insert")
      public int insert(@RequestBody ${entityClass} ${entityObj}) {
          return ${serviceObj}.insertIgnoreNull(${entityObj});
      }    
        
      /**
       * 修改，忽略null字段
       *
       * @param ${entityObj} 修改的记录
       * @return 返回影响行数
       */
      @RequestMapping("update")
      public int update(@RequestBody ${entityClass} ${entityObj}) {
          return ${serviceObj}.updateIgnoreNull(${entityObj});
      }
      
      /**
       * 删除记录
       *
       * @param ${entityObj} 待删除的记录
       * @return 返回影响行数
       */
      @RequestMapping("delete")
      public int delete(@RequestBody ${entityClass} ${entityObj}) {
          return ${serviceObj}.delete(${entityObj});
      }
      
  }


name: columns
file_name: ${context.javaBeanName}Columns
group_name: fastmybatis-v2.0
folder: columns
content:
  ## filename=${context.javaBeanName}Columns, folder=columns
  /**
   * ${table.tableName}表字段映射关系<br>
   * 使用方式：
   * <pre>
   * {@literal
   * Query query = new Query().eq(TUserColumns.id, 6);
   * TUser tUser = mapper.getBySpecifiedColumns(Arrays.asList(TUserColumns.id, TUserColumns.username), query);
   * }
   * </pre>
   * @author xxx
   */
  public interface ${context.javaBeanName}Columns {
  #foreach($column in $columns)
  	/** ${column.comment} */
  	String ${column.columnName} = "${column.columnName}";
      
  #end
  }


name: service
file_name: ${context.javaBeanName}Service.java
group_name: fastmybatis-v2.0
folder: service
content:
  ## filename=${context.javaBeanName}Service.java, folder=service
  package ${context.packageName}.mapper;

  import com.gitee.fastmybatis.core.support.IService;
  import ${context.packageName}.dao.entity.${context.javaBeanName};
  import org.springframework.stereotype.Service;

  import java.util.List;

  /**
   * @author xxx
   */
  @Service
  public class ${context.javaBeanName}Service implements IService<${context.javaBeanName}, ${pk.javaTypeBox}> {

  }


name: entity
file_name: ${context.javaBeanName}.java
group_name: fastmybatis-v2.0
folder: entity
content:
  ## filename=${context.javaBeanName}.java, folder=entity
  package ${context.packageName}.dao.entity;

  #if(${table.hasDateField})
  import java.util.Date;
  #end
  #if(${table.hasLocalDateField})
  import java.time.LocalDate;
  #end
  #if(${table.hasLocalDateTimeField})
  import java.time.LocalDateTime;
  #end
  #if(${table.hasBigDecimalField})
  import java.math.BigDecimal;
  #end

  import com.gitee.fastmybatis.annotation.Pk;
  import com.gitee.fastmybatis.annotation.PkStrategy;
  import com.gitee.fastmybatis.annotation.Table;

  import lombok.Data;


  /**
   * 表名：${table.tableName}
  #if("$!{table.comment}" != "")
   * 备注：${table.comment}
  #end
   *
   * @author xxx
   */
  @Table(name = "${table.tableName}", pk = @Pk(name = "${pk.columnName}", strategy = PkStrategy.INCREMENT))
  @Data
  public class ${context.javaBeanName} {

  #foreach($column in $columns)
  #if("$!{column.comment}" != "")
      /** 
       * ${column.comment}
       */
  #end
  #if(${column.columnName} == "is_deleted")
      @com.gitee.fastmybatis.annotation.Column(logicDelete = true)
  #end
      private ${column.javaTypeBox} ${column.javaFieldName};

  #end

  }


name: mapper
file_name: ${context.javaBeanName}Mapper.java
group_name: fastmybatis-v2.0
folder: mapper
content:
  ## filename=${context.javaBeanName}Mapper.java, folder=mapper
  package ${context.packageName}.dao.mapper;

  import com.gitee.fastmybatis.core.mapper.CrudMapper;
  import ${context.packageName}.dao.entity.${context.javaBeanName};

  /**
   * @author xxx
   */
  public interface ${context.javaBeanName}Mapper extends CrudMapper<${context.javaBeanName}, ${pk.javaTypeBox}> {
  	
  }


name: controller
file_name: ${context.javaBeanName}Controller.java
group_name: fastmybatis-v2.0
folder: controller
content:
  ## filename=${context.javaBeanName}Controller.java, folder=controller
  package ${context.packageName}.web.controller;

  import com.gitee.fastmybatis.core.PageInfo;
  import com.gitee.fastmybatis.core.query.Query;
  import com.gitee.fastmybatis.core.query.param.PageParam;
  import org.springframework.beans.factory.annotation.Autowired;
  import org.springframework.web.bind.annotation.DeleteMapping;
  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.RequestMapping;
  import org.springframework.web.bind.annotation.RestController;

  import ${context.packageName}.dao.entity.${context.javaBeanName};
  import ${context.packageName}.service.${context.javaBeanName}Service;

  /**
   * @author xxx
   */
  @RestController
  @RequestMapping("${table.tableName}")
  public class ${context.javaBeanName}Controller {

      @Autowired
      private ${context.javaBeanName}Service ${context.javaBeanNameLF}Service;

      /**
       * 分页查询
       *
       * @param param
       * @return
       */
      @GetMapping("/page")
      public Result<PageInfo<${context.javaBeanName}>> page(PageParam param) {
          Query query = param.toQuery();
          PageInfo<${context.javaBeanName}> pageInfo = ${context.javaBeanNameLF}Service.page(query);
          return Result.ok(pageInfo);
      }
      
      /**
       * 新增记录
       *
       * @param user
       * @return
       */
      @PostMapping("/save")
      public Result<${pk.javaTypeBox}> save(${context.javaBeanName} user) {
          ${context.javaBeanNameLF}Service.saveIgnoreNull(user);
          // 返回添加后的主键值
          return Result.ok(user.getId());
      }
      
      /**
       * 修改记录
       *
       * @param user 表单数据
       * @return
       */
      @PutMapping("/update")
      public Result<?> update(${context.javaBeanName} user) {
          ${context.javaBeanNameLF}Service.updateIgnoreNull(user);
          return Result.ok();
      }
       
      /**
       * 删除记录
       *
       * @param id 主键id
       * @return
       */
      @DeleteMapping("/delete")
      public Result<?> delete(${pk.javaTypeBox} id) {
          ${context.javaBeanNameLF}Service.deleteById(id);
          return Result.ok();
      }
      
  }


name: test
file_name: ${context.classNamePascal}.txt
content:
  # 测试变量
  #set($jq="$")
  ---pk
  ${jq}{pk.type} -> ${pk.type}
  ${jq}{pk.typeBase} -> ${pk.typeBase}
  ${jq}{pk.typeBox} -> ${pk.typeBox}
  ${jq}{pk.name} -> ${pk.name}
  ${jq}{pk.nameCamel} -> ${pk.nameCamel}
  ${jq}{pk.namePascal} -> ${pk.namePascal}
  ${jq}{pk.nameSnake} -> ${pk.nameSnake}
  ${jq}{pk.nameSnakeBig} -> ${pk.nameSnakeBig}
  ${jq}{pk.namePascalSnake} -> ${pk.namePascalSnake}
  ${jq}{pk.nameKebab} -> ${pk.nameKebab}
  ${jq}{pk.nameKebabBig} -> ${pk.nameKebabBig}
  ${jq}{pk.namePascalKebab} -> ${pk.namePascalKebab}
  ${jq}{pk.isIdentity} -> ${pk.isIdentity}
  ${jq}{pk.mybatisJdbcType} -> ${pk.mybatisJdbcType}
  ${jq}{pk.comment} -> ${pk.comment}
  ${jq}{pk.label} -> ${pk.label}

  ---context
  ${jq}{context.author} -> ${context.author}
  ${jq}{context.dbName} -> ${context.dbName}
  ${jq}{context.packageName} -> ${context.packageName}
  ${jq}{context.delPrefix} -> ${context.delPrefix}
  ${jq}{context.classNamePascal} -> ${context.classNamePascal}
  ${jq}{context.classNameCamel} -> ${context.classNameCamel}
  ${jq}{context.classNameLower} -> ${context.classNameLower}
  ${jq}{context.classNameKebab} -> ${context.classNameKebab}
  ${jq}{context.classNamePascalKebab} -> ${context.classNamePascalKebab}
  ${jq}{context.datetime} -> ${context.datetime}
  ${jq}{context.date} -> ${context.date}
  ${jq}{context.time} -> ${context.time}
  ${jq}{context.randomInt} -> ${context.randomInt}
  ${jq}{context.randomLong} -> ${context.randomLong}
  ${jq}{context.randomBoolean} -> ${context.randomBoolean}
  ${jq}{context.uuid} -> ${context.uuid}
  ${jq}{context.nextId} -> ${context.nextId}

  ---table
  ${jq}{table.tableName} -> ${table.tableName}
  ${jq}{table.comment} -> ${table.comment}
  ${jq}{table.schema} -> ${table.schema}

  ---columns
  #foreach($column in $columns) 
  ${jq}{velocityCount} -> ${velocityCount}
  ${jq}{column.type} -> ${column.type}
  ${jq}{column.typeBase} -> ${column.typeBase}
  ${jq}{column.typeBox} -> ${column.typeBox}
  ${jq}{column.name} -> ${column.name}
  ${jq}{column.nameCamel} -> ${column.nameCamel}
  ${jq}{column.namePascal} -> ${column.namePascal}
  ${jq}{column.nameSnake} -> ${column.nameSnake}
  ${jq}{column.nameSnakeBig} -> ${column.nameSnakeBig}
  ${jq}{column.namePascalSnake} -> ${column.namePascalSnake}
  ${jq}{column.nameKebab} -> ${column.nameKebab}
  ${jq}{column.nameKebabBig} -> ${column.nameKebabBig}
  ${jq}{column.namePascalKebab} -> ${column.namePascalKebab}
  ${jq}{column.isIdentity} -> ${column.isIdentity}
  ${jq}{column.isPk} -> ${column.isPk}
  ${jq}{column.isIdentityPk} -> ${column.isIdentityPk}
  ${jq}{column.mybatisJdbcType} -> ${column.mybatisJdbcType}
  ${jq}{column.comment} -> ${column.comment}
  ${jq}{column.label} -> ${column.label}
  ${jq}{column.maxLength} -> ${column.maxLength}
  ${jq}{column.scale} -> ${column.scale}
  ${jq}{column.isNullable} -> ${column.isNullable}

  #end


name: mapper
file_name: ${context.javaBeanName}Mapper.java
group_name: fastmybatis-v3.0
folder: mapper
content:
  ## filename=${context.javaBeanName}Mapper.java, folder=mapper
  #set($entityClass="${context.classNamePascal}")
  #set($pkg="${context.packageName}")
  package ${pkg}.dao.mapper;

  import com.gitee.fastmybatis.core.mapper.BaseMapper;
  import ${pkg}.dao.entity.${entityClass};

  /**
   * @author ${context.author}
   */
  public interface ${entityClass}Mapper extends BaseMapper<${entityClass}> {
  	
  }


name: controller
file_name: ${context.javaBeanName}Controller.java
group_name: fastmybatis-v3.0
folder: controller
content:
  ## filename=${context.javaBeanName}Controller.java, folder=controller
  #set($entityClass="${context.classNamePascal}")
  #set($entityObj="${context.classNameCamel}")
  #set($serviceClass="${context.classNamePascal}Service")
  #set($serviceObj="${context.classNameCamel}Service")
  #set($pkg="${context.packageName}")
  package ${pkg}.web.controller;

  import com.gitee.fastmybatis.core.PageInfo;
  import com.gitee.fastmybatis.core.query.Query;
  import com.gitee.fastmybatis.core.query.param.PageParam;
  import org.springframework.beans.factory.annotation.Autowired;
  import org.springframework.web.bind.annotation.DeleteMapping;
  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.RequestBody;
  import org.springframework.web.bind.annotation.RequestMapping;
  import org.springframework.web.bind.annotation.RestController;

  import ${pkg}.dao.entity.${entityClass};
  import ${pkg}.service.${serviceClass}Service;

  import javax.validation.Valid;

  /**
   * @author ${context.author}
   */
  @RestController
  @RequestMapping("${table.tableName}")
  public class ${entityClass}Controller {

      @Autowired
      private ${serviceClass} ${serviceObj};

      /**
       * 分页查询
       *
       * @param param 请求参数
       * @return 返回分页信息
       */
      @GetMapping("/page")
      public Result<PageInfo<${entityClass}>> page(PageParam param) {
          Query query = param.toQuery();
          PageInfo<${entityClass}> pageInfo = ${serviceObj}.page(query);
          return Result.ok(pageInfo);
      }

      /**
       * 新增
       *
       * @param $entityObj
       * @return 返回主键id
       */
      @PostMapping("/save")
      public Result<${pk.javaTypeBox}> save(@Valid @RequestBody ${entityClass} $entityObj) {
          ${serviceObj}.save($entityObj);
          // 返回添加后的主键值
          return Result.ok(${entityObj}.getId());
      }

      /**
       * 详情
       *
       * @param id
       * @return 返回详情
       */
      @GetMapping("/detail")
      public Result<${entityClass}> detail(${pk.javaTypeBox} id) {
      	${entityClass} record = ${serviceObj}.getById(id);
          return Result.ok(record);
      }

      /**
       * 修改
       *
       * @param $entityObj 表单数据
       * @return
       */
      @PutMapping("/update")
      public Result<?> update(@Valid @RequestBody ${entityClass} $entityObj) {
          ${serviceObj}.update($entityObj);
          return Result.ok();
      }

      /**
       * 删除
       *
       * @param id 主键id
       * @return
       */
      @DeleteMapping("/delete")
      public Result<?> delete(${pk.javaTypeBox} id) {
          ${serviceObj}.deleteById(id);
          return Result.ok();
      }

  }


name: entity
file_name: ${context.javaBeanName}.java
group_name: fastmybatis-v3.0
folder: entity
content:
  ## filename=${context.javaBeanName}.java, folder=entity
  #set($entityClass="${context.classNamePascal}")
  package ${context.packageName}.dao.entity;

  import com.gitee.fastmybatis.annotation.Pk;
  import com.gitee.fastmybatis.annotation.PkStrategy;
  import com.gitee.fastmybatis.annotation.Table;
  import com.gitee.fastmybatis.core.query.LambdaQuery;
  import lombok.Data;

  #if(${table.hasDateField})
  import java.util.Date;
  #end
  #if(${table.hasLocalDateField})
  import java.time.LocalDate;
  #end
  #if(${table.hasLocalDateTimeField})
  import java.time.LocalDateTime;
  #end
  #if(${table.hasBigDecimalField})
  import java.math.BigDecimal;
  #end

  /**
   * 表名：${table.tableName}
  #if("$!{table.comment}" != "")
   * 备注：${table.comment}
  #end
   *
   * @author ${context.author}
   */
  @Table(name = "${table.tableName}", pk = @Pk(name = "${pk.columnName}", strategy = PkStrategy.INCREMENT))
  @Data
  public class ${entityClass} {

  #foreach($column in $columns)
  #if("$!{column.comment}" != "")
      /** 
       * ${column.comment}
       */
  #end
  #if(${column.columnName} == "is_deleted")
      @com.gitee.fastmybatis.annotation.Column(logicDelete = true)
  #end
      private ${column.javaTypeBox} ${column.javaFieldName};

  #end
      
      /**
       * 创建LambdaQuery对象
       * 
       * @return 返回LambdaQuery对象
       */
      public static LambdaQuery<${entityClass}> query() {
          return new LambdaQuery<>(${entityClass}.class);
      }

  }


name: service
file_name: ${context.javaBeanName}Service.java
group_name: fastmybatis-v3.0
folder: service
content:
  ## filename=${context.javaBeanName}Service.java, folder=service
  #set($entityClass="${context.classNamePascal}")
  #set($mapperClass="${context.classNamePascal}Mapper")
  #set($pkg="${context.packageName}")
  package ${pkg}.mapper;

  import com.gitee.fastmybatis.core.support.BaseLambdaService;
  import ${pkg}.dao.entity.${entityClass};
  import ${pkg}.dao.mapper.${mapperClass};
  import org.springframework.stereotype.Service;


  /**
   * @author ${context.author}
   */
  @Service
  public class ${entityClass}Service extends BaseLambdaService<${entityClass}, ${mapperClass}> {

  }


name: entity
file_name: ${entityDir}/${context.javaBeanName}.java
group_name: default
folder: entity
content:
  ## filename=${context.javaBeanName}.java, folder=entity
  package ${entityPackage};

  #if(${table.hasDateField})
  import java.util.Date;
  #end
  #if(${table.hasLocalDateField})
  import java.time.LocalDate;
  #end
  #if(${table.hasLocalDateTimeField})
  import java.time.LocalDateTime;
  #end
  #if(${table.hasBigDecimalField})
  import java.math.BigDecimal;
  #end

  import com.gitee.fastmybatis.annotation.Pk;
  import com.gitee.fastmybatis.annotation.PkStrategy;
  import com.gitee.fastmybatis.annotation.Table;

  import lombok.Data;


  /**
   * 表名：${table.tableName}
  #if("$!{table.comment}" != "")
   * 备注：${table.comment}
  #end
   *
   * @author ${context.author}
   */
  @Table(name = "${table.tableName}", pk = @Pk(name = "${pk.columnName}", strategy = PkStrategy.INCREMENT))
  @Data
  public class ${context.javaBeanName} {

  #foreach($column in $columns)
  #if("$!{column.comment}" != "")
      /**
       * ${column.comment}
       */
  #end
  #if(${column.columnName} == "is_deleted")
      @com.gitee.fastmybatis.annotation.Column(logicDelete = true)
  #end
      private ${column.javaTypeBox} ${column.javaFieldName};

  #end

  }


name: mapper
file_name: ${mapperDir}/${context.javaBeanName}Mapper.java
group_name: default
folder: mapper
content:
  ## filename=${context.javaBeanName}Mapper.java, folder=mapper
  package ${mapperPackage};

  import com.gitee.fastmybatis.core.mapper.BaseMapper;
  import org.apache.ibatis.annotations.Mapper;
  import ${entityPackage}.${context.javaBeanName};

  /**
   * @author ${context.author}
   */
  @Mapper
  public interface ${context.javaBeanName}Mapper extends BaseMapper<${context.javaBeanName}> {
  	
  }


name: service
file_name: ${serviceDir}/${moduleName}/${context.javaBeanName}Service.java
group_name: default
folder: service
content:
  ## filename=${context.javaBeanName}Service.java, folder=service
  package ${servicePackage}.${moduleName};

  import com.gitee.fastmybatis.core.PageInfo;
  import com.gitee.fastmybatis.core.query.LambdaQuery;
  import com.gitee.fastmybatis.core.support.LambdaService;
  import org.springframework.stereotype.Service;
  import ${entityPackage}.${context.javaBeanName};
  import ${mapperPackage}.${context.javaBeanName}Mapper;


  /**
   * @author ${context.author}
   */
  @Service
  public class ${context.javaBeanName}Service implements LambdaService<${context.javaBeanName}, ${context.javaBeanName}Mapper> {

  	public PageInfo<${context.javaBeanName}> doPage(LambdaQuery<${context.javaBeanName}> query) {
       	query.orderByDesc(${context.javaBeanName}::getId);
          PageInfo<${context.javaBeanName}> page = this.page(query);

          // 格式转换
          return page.convert(isvInfo -> {
  			
              return isvInfo;
          });
      }

  #set($hasStatus=0)
  #foreach($column in $columns) 
  	#if(${column.columnName} == "status")
      	#set($hasStatus=1)
          #break
      #end
  #end

  #if($hasStatus == 1)
      /**
       * 修改状态
       *
       * @param statusUpdateDTO 修改值
       * @return 返回影响行数
       */
      public int updateStatus(StatusUpdateDTO statusUpdateDTO) {
          return this.query()
                  .eq(${context.javaBeanName}::getId, statusUpdateDTO.getId())
                  .set(${context.javaBeanName}::getStatus, statusUpdateDTO.getStatus())
                  .update();
      }
  #end
  }


name: controller
file_name: ${controllerDir}/${moduleName}/${context.javaBeanName}Controller.java
group_name: default
folder: controller
content:
  ## filename=${context.javaBeanName}Controller.java, folder=controller
  #set($objService="${context.javaBeanNameLF}Service")
  package ${controllerPackage}.${moduleName};

  import com.gitee.fastmybatis.core.PageInfo;
  import com.gitee.fastmybatis.core.query.LambdaQuery;
  import com.gitee.sop.admin.common.req.IdParam;
  import com.gitee.sop.admin.common.resp.Result;
  import com.gitee.sop.admin.common.util.CopyUtil;
  import ${controllerPackage}.${moduleName}.param.${context.javaBeanName}AddParam;
  import ${controllerPackage}.${moduleName}.param.${context.javaBeanName}SearchParam;
  import ${controllerPackage}.${moduleName}.param.${context.javaBeanName}UpdateParam;
  import ${controllerPackage}.${moduleName}.vo.${context.javaBeanName}VO;
  import ${entityPackage}.${context.javaBeanName};
  import ${servicePackage}.${moduleName}.${context.javaBeanName}Service;
  import org.springframework.beans.factory.annotation.Autowired;
  import org.springframework.validation.annotation.Validated;
  import org.springframework.web.bind.annotation.GetMapping;
  import org.springframework.web.bind.annotation.PostMapping;
  import org.springframework.web.bind.annotation.RequestBody;
  import org.springframework.web.bind.annotation.RequestMapping;
  import org.springframework.web.bind.annotation.RestController;


  /**
   * @author ${context.author}
   */
  @RestController
  @RequestMapping("${moduleName}")
  public class ${context.javaBeanName}Controller {

      @Autowired
      private ${context.javaBeanName}Service ${objService};

      /**
       * 分页查询
       *
       * @param param 查询参数
       * @return 返回分页结果
       */
      @GetMapping("/page")
      public Result<PageInfo<${context.javaBeanName}VO>> page(${context.javaBeanName}SearchParam param) {
          LambdaQuery<${context.javaBeanName}> query = param.toLambdaQuery(${context.javaBeanName}.class);
          PageInfo<${context.javaBeanName}VO> pageInfo = ${objService}.doPage(query)
            .convert(data -> CopyUtil.copyBean(data, ${context.javaBeanName}VO::new));
          return Result.ok(pageInfo);
      }
      
      /**
       * 新增记录
       *
       * @param param 表单参数
       * @return 返回添加后的主键值
       */
      @PostMapping("/add")
      public Result<${pk.javaTypeBox}> add(@Validated @RequestBody ${context.javaBeanName}AddParam param) {
          ${context.javaBeanName} ${context.classNameCamel} = CopyUtil.copyBean(param, ${context.javaBeanName}::new);
          ${objService}.save(${context.classNameCamel});
          // 返回添加后的主键值
          return Result.ok(${context.classNameCamel}.getId());
      }
      
      /**
       * 修改记录
       *
       * @param param 表单数据
       * @return 返回影响行数
       */
      @PostMapping("/update")
      public Result<Integer> update(@Validated @RequestBody ${context.javaBeanName}UpdateParam param) {
          ${context.javaBeanName} ${context.classNameCamel} = CopyUtil.copyBean(param, ${context.javaBeanName}::new);
          return Result.ok(${objService}.update(${context.classNameCamel}));
      }
  #set($hasDel=0)
  #foreach($column in $columns) 
  	#if(${column.columnName} == "is_deleted")
      	#set($hasDel=1)
          #break
      #end
  #end

  #if($hasDel == 1)
      /**
       * 删除记录
       *
       * @param param 参数
       * @return 返回影响行数
       */
      @PostMapping("/delete")
      public Result<Integer> delete(@Validated @RequestBody IdParam param) {
          return Result.ok(${objService}.deleteById(param.getId()));
      }
  #end
      
  #set($hasStatus=0)
  #foreach($column in $columns) 
  	#if(${column.columnName} == "status")
      	#set($hasStatus=1)
          #break
      #end
  #end

  #if($hasStatus == 1)
      /**
       * 修改状态
       *
       * @param param 表单数据
       * @return 返回影响行数
       */
      @PostMapping("/updateStatus")
      public Result<Integer> updateStatus(@Validated @RequestBody StatusUpdateParam param) {
          StatusUpdateDTO statusUpdateDTO = CopyUtil.copyBean(param, StatusUpdateDTO::new);
          return Result.ok(${objService}.updateStatus(statusUpdateDTO));
      }
  #end
      
  }


name: addParam
file_name: ${controllerDir}/${moduleName}/param/${context.javaBeanName}AddParam.java
group_name: default
folder: entity
content:
  ## filename=${context.javaBeanName}AddParam.java, folder=entity
  package ${controllerPackage}.${moduleName}.param;

  #if(${table.hasDateField})
  import java.util.Date;
  #end
  #if(${table.hasLocalDateField})
  import java.time.LocalDate;
  #end
  #if(${table.hasLocalDateTimeField})
  import java.time.LocalDateTime;
  #end
  #if(${table.hasBigDecimalField})
  import java.math.BigDecimal;
  #end

  import lombok.Data;


  /**
   * 新增表单
   *
   * @author ${context.author}
   */
  @Data
  public class ${context.javaBeanName}AddParam {

  #foreach($column in $columns)
  #if(!${column.isPk} 
  	&& ${column.name} != "is_deleted" 
      && ${column.name} != "add_time"
      && ${column.name} != "update_time"
      && ${column.name} != "add_by"
      && ${column.name} != "update_by"
      )
  #if("$!{column.comment}" != "")
      /**
       * ${column.comment}
       */
  #end
      private ${column.javaTypeBox} ${column.javaFieldName};

  #end
  #end

  }


name: updateParam
file_name: ${controllerDir}/${moduleName}/param/${context.javaBeanName}UpdateParam.java
group_name: default
folder: entity
content:
  ## filename=${context.javaBeanName}UpdateParam.java, folder=entity
  package ${controllerPackage}.${moduleName}.param;

  import lombok.Data;
  import lombok.EqualsAndHashCode;

  import javax.validation.constraints.NotNull;


  /**
   * 修改表单
   *
   * @author ${context.author}
   */
  @EqualsAndHashCode(callSuper = true)
  @Data
  public class ${context.javaBeanName}UpdateParam extends ${context.javaBeanName}AddParam {

      /**
       * id
       */
      @NotNull(message = "id必填")
      private Long id;

  }


name: searchParam
file_name: ${controllerDir}/${moduleName}/param/${context.javaBeanName}SearchParam.java
group_name: default
folder: entity
content:
  ## filename=${context.javaBeanName}SearchParam.java, folder=entity
  package ${controllerPackage}.${moduleName}.param;

  #if(${table.hasDateField})
  import java.util.Date;
  #end
  #if(${table.hasLocalDateField})
  import java.time.LocalDate;
  #end
  #if(${table.hasLocalDateTimeField})
  import java.time.LocalDateTime;
  #end
  #if(${table.hasBigDecimalField})
  import java.math.BigDecimal;
  #end
  import com.gitee.fastmybatis.core.query.Operator;
  import com.gitee.fastmybatis.core.query.annotation.Condition;
  import com.gitee.fastmybatis.core.query.param.PageParam;

  import lombok.Data;
  import lombok.EqualsAndHashCode;

  /**
   * 查询表单
   *
   * @author ${context.author}
   */
  @EqualsAndHashCode(callSuper = true)
  @Data
  public class ${context.javaBeanName}SearchParam extends PageParam {
      private static final long serialVersionUID = 1L;

  #foreach($column in $columns)
  #if(!${column.isPk} && ${column.name} != "is_deleted")
  #if("$!{column.comment}" != "")
      /**
       * ${column.comment}
       */
  #end
  #if(${column.typeBox} == "String")
      @Condition(operator = Operator.like)
  #else
      @Condition
  #end
      private ${column.javaTypeBox} ${column.javaFieldName};

  #end
  #end

  }


name: respVO
file_name: ${controllerDir}/${moduleName}/vo/${context.javaBeanName}VO.java
group_name: default
folder: entity
content:
  ## filename=${context.javaBeanName}.java, folder=entity
  package ${controllerPackage}.${moduleName}.vo;

  #if(${table.hasDateField})
  import java.util.Date;
  #end
  #if(${table.hasLocalDateField})
  import java.time.LocalDate;
  #end
  #if(${table.hasLocalDateTimeField})
  import java.time.LocalDateTime;
  #end
  #if(${table.hasBigDecimalField})
  import java.math.BigDecimal;
  #end

  import com.gitee.sop.admin.service.jackson.convert.annotation.UserFormat;
  import lombok.Data;


  /**
   * 返回结果
   *
   * @author ${context.author}
   */
  @Data
  public class ${context.javaBeanName}VO {

  #foreach($column in $columns)
  #if("$!{column.comment}" != "")
      /**
       * ${column.comment}
       */
  #end
  #if(${column.columnName} != "is_deleted")
  #if(${column.name} == "add_by" || ${column.name} == "update_by")
      @UserFormat
  #end
      private ${column.javaTypeBox} ${column.javaFieldName};
  #end
      
  #end

  }


name: index.ts
file_name: ${frontendRootDir}/src/views/biz/${moduleName}/${context.classNameCamel}.ts
group_name: default
folder: view
content:
  ## filename=${context.classNameCamel}.ts, folder=view
  import { onMounted, ref } from "vue";
  import {
    type ButtonsCallBackParams,
    type PageInfo,
    type PlusColumn,
    useTable
  } from "plus-pro-components";
  import { ElMessage } from "element-plus";
  import { api } from "@/api/${context.classNameCamel}";

  export function use${context.classNamePascal}() {
    const isAdd = ref(false);

    // ========= search form =========

    // 查询表单对象
    const searchFormData = ref({
  #foreach($column in $columns)
  #if(!${column.isPk}	&& ${column.name} != "is_deleted" 
      && ${column.name} != "add_time"
      && ${column.name} != "update_time"
      && ${column.name} != "add_by"
      && ${column.name} != "update_by")
      ${column.nameCamel}: "",
  #end
  #end
      pageIndex: 1,
      pageSize: 10
    });

    // 查询表单字段定义
    const searchFormColumns: PlusColumn[] = [
  #foreach($column in $columns)
  #if(!${column.isPk} && ${column.name} != "is_deleted" 
      && ${column.name} != "add_time"
      && ${column.name} != "update_time"
      && ${column.name} != "add_by"
      && ${column.name} != "update_by")
      {
        label: "${column.label}",
        prop: "${column.nameCamel}"
  #if(${column.name}=="status")
        ,valueType: "select",
        options: [
          {
            label: "启用",
            value: StatusEnum.ENABLE
          },
          {
            label: "禁用",
            value: StatusEnum.DISABLE
          }
        ]
  #end
      }#if(${velocityCount} != ${table.columnCount}),#end

  #end
  #end
    ];

    // ========= table =========

    // 表格对象
    const {
      tableData,
      total,
      pageInfo,
      buttons: actionButtons
    } = useTable<any[]>();
    // 默认每页条数,默认10
    pageInfo.value.pageSize = 10;

    // 表格字段定义
    const tableColumns: PlusColumn[] = [
  #foreach($column in $columns)
  #if(!${column.isPk} && ${column.name} != "is_deleted")
      {
  #if(${column.type}=="datetime")
        width: 120,
  #end
        label: "${column.label}",
  #if(${column.nameCamel}=="addBy")
        width: 120,
        prop: "addBy.showName"
  #elseif(${column.nameCamel}=="updateBy")
        width: 120,
        prop: "updateBy.showName"
  #else
        prop: "${column.nameCamel}"
  #end
  #if(${column.name}=="status")
        ,valueType: "select",
        options: [
          {
            label: "启用",
            value: StatusEnum.ENABLE,
            color: "green"
          },
          {
            label: "禁用",
            value: StatusEnum.DISABLE,
            color: "red"
          }
        ]
  #end
      }#if(${velocityCount} != ${table.columnCount}),#end

  #end
  #end
    ];
    // 表格按钮定义
    actionButtons.value = [
      {
        // 修改
        text: "修改",
        code: "edit",
        props: {
          type: "primary"
        },
        onClick(params: ButtonsCallBackParams) {
          isAdd.value = false;
          editFormData.value = Object.assign({}, params.row);
          dlgTitle.value = "修改";
          dlgShow.value = true;
        }
      },
      {
        // 删除
        text: "删除",
        code: "delete",
        props: {
          type: "danger"
        },
        confirm: {
          options: { draggable: false }
        },
        onConfirm(params: ButtonsCallBackParams) {
          api.del(params.row).then(() => {
            ElMessage.success("删除成功");
            search();
          });
        }
      }
    ];

    // ========= dialog form =========

    // 弹窗显示
    const dlgShow = ref(false);
    const dlgTitle = ref("");
    // 表单值
    const editFormDataGen = () => {
      return {
  #foreach($column in $columns)
  #if(!${column.isPk} && ${column.name} != "is_deleted" 
      && ${column.name} != "add_time"
      && ${column.name} != "update_time"
      && ${column.name} != "add_by"
      && ${column.name} != "update_by")
        ${column.nameCamel}: ""#if(${velocityCount} != ${table.columnCount}),#end

  #end
  #end
      };
    };
    const editFormData = ref<any>(editFormDataGen());
    const editFormRules = {
  #foreach($column in $columns)
  #if(!${column.isNullable} && !${column.isPk} && ${column.name} != "is_deleted")
      ${column.nameCamel}: [{ required: true, message: "请输入${column.label}" }]#if(${velocityCount} != ${table.columnCount}),#end

  #end
  #end
    };

    // 表单内容
    const editFormColumns: PlusColumn[] = [
  #foreach($column in $columns)
  #if(!${column.isPk} && ${column.name} != "is_deleted" 
      && ${column.name} != "add_time"
      && ${column.name} != "update_time"
      && ${column.name} != "add_by"
      && ${column.name} != "update_by")
      {
        label: "${column.label}",
        prop: "${column.nameCamel}",
  #if(${column.name}=="status")
        valueType: "radio",
        options: [
          {
            label: "启用",
            value: StatusEnum.ENABLE
          },
          {
            label: "禁用",
            value: StatusEnum.DISABLE
          }
        ]
  #else
        valueType: "input"
  #end
      }#if(${velocityCount} != ${table.columnCount}),#end

  #end
  #end
    ];

    // ========= event =========

    // 添加按钮事件
    const handleAdd = () => {
      isAdd.value = true;
      editFormData.value = editFormDataGen();
      dlgTitle.value = "新增";
      dlgShow.value = true;
    };

    // 保存按钮事件,校验成功后触发
    const handleSave = () => {
      const postData = editFormData.value;
      const pms = isAdd.value ? api.add(postData) : api.update(postData);
      pms.then(() => {
        ElMessage.success("保存成功");
        dlgShow.value = false;
        search();
      });
    };

    // 点击查询按钮
    const handleSearch = () => {
      pageInfo.value.page = 1;
      search();
    };

    // 分页事件
    const handlePaginationChange = (_pageInfo: PageInfo): void => {
      pageInfo.value = _pageInfo;
      search();
    };

    // 查询
    const search = async () => {
      try {
        const { data } = await doSearch();
        tableData.value = data.list;
        total.value = data.total;
      } catch (error) {}
    };
    // 请求接口
    const doSearch = async () => {
      // 查询参数
      const data = searchFormData.value;
      // 添加分页参数
      data.pageIndex = pageInfo.value.page;
      data.pageSize = pageInfo.value.pageSize;

      return api.page(data);
    };

    onMounted(() => {
      // 页面加载
      search();
    });

    return {
      actionButtons,
      dlgShow,
      dlgTitle,
      editFormColumns,
      editFormData,
      editFormRules,
      handleAdd,
      handlePaginationChange,
      handleSave,
      handleSearch,
      pageInfo,
      searchFormColumns,
      searchFormData,
      tableColumns,
      tableData,
      total
    };
  }


name: index.vue
file_name: ${frontendRootDir}/src/views/biz/${moduleName}/${context.classNameCamel}.vue
group_name: default
folder: view
content:
  ## filename=${context.classNameCamel}.vue, folder=view
  <script setup lang="ts">
  import { use${context.classNamePascal} } from "./${context.classNameCamel}";
  const {
    actionButtons,
    dlgShow,
    dlgTitle,
    editFormColumns,
    editFormData,
    editFormRules,
    handleAdd,
    handlePaginationChange,
    handleSave,
    handleSearch,
    pageInfo,
    searchFormColumns,
    searchFormData,
    tableColumns,
    tableData,
    total
  } = use${context.classNamePascal}();
  </script>
  <template>
    <el-card shadow="never">
      <template #header>
        <PlusSearch
          v-model="searchFormData"
          :columns="searchFormColumns"
          :show-number="3"
          label-position="right"
          :has-reset="true"
          @reset="handleSearch"
          @search="handleSearch"
        />
      </template>
      <PlusTable
        :columns="tableColumns"
        :table-data="tableData"
        :action-bar="{ buttons: actionButtons, width: 120 }"
        :pagination="{
          total,
          modelValue: pageInfo,
          pageSizeList: [10, 20, 50, 100],
          align: 'right'
        }"
        showOverflowTooltip
        adaptive
        @paginationChange="handlePaginationChange"
      >
        <template #title>
          <el-button type="primary" @click="handleAdd">新增</el-button>
        </template>
      </PlusTable>
      <PlusDialogForm
        v-model:visible="dlgShow"
        v-model="editFormData"
        :dialog="{ title: dlgTitle }"
        :form="{
          columns: editFormColumns,
          rules: editFormRules,
          labelWidth: '100px',
          labelPosition: 'right'
        }"
        :hasErrorTip="false"
        @confirm="handleSave"
      />
    </el-card>
  </template>


name: api
file_name: ${frontendRootDir}/src/api/${context.classNameCamel}.ts
group_name: default
folder: api
content:
  ## filename=${context.classNameCamel}.ts, folder=api
  import { createUrl, http } from "@/utils/http";
  import type { PageResult, Result } from "@/model";

  // 后端请求接口
  const apiUrl: any = createUrl({
    page: "/${moduleName}/page",
    add: "/${moduleName}/add",
    update: "/${moduleName}/update",
    del: "/${moduleName}/delete"
  });

  /**
   * 接口管理
   */
  export const api: any = {
    /**
     * 分页查询
     * @param params 查询参数
     */
    page(params: object): Promise<PageResult> {
      return http.get<PageResult, any>(apiUrl.page, { params });
    },
    /**
     * 新增
     * @param data 表单内容
     */
    add(data: object) {
      return http.post<Result<any>, any>(apiUrl.add, { data });
    },
    /**
     * 修改
     * @param data 表单内容
     */
    update(data: object) {
      return http.post<Result<any>, any>(apiUrl.update, { data });
    },
    /**
     * 删除
     * @param data 表单内容
     */
    del(data: object) {
      return http.post<Result<any>, any>(apiUrl.del, { data });
    }
  };


# generate_history

md5_value: ab68b10e5c77555af4fdbf6985632f66
config_content:
  {"author":"Jim","charset":"UTF-8","datasourceConfigId":1,"delPrefix":"","packageName":"com.xxx.stu","tableNames":["gen_template"],"templateConfigIdList":[14,15,16,17]}


md5_value: cb8e5d8927b3fb4b53f813c43f654e2e
config_content:
  {"author":"tanghc","charset":"UTF-8","datasourceConfigId":1,"delPrefix":"","packageName":"com.xxx.stu","tableNames":["gen_template"],"templateConfigIdList":[14,15,16,17]}


