no message

This commit is contained in:
Vinjor 2025-03-17 13:21:36 +08:00
parent 1fb05b6a63
commit 5e3fd2dfb8
19 changed files with 165 additions and 774 deletions

View File

@ -35,6 +35,7 @@
<logback.version>1.2.13</logback.version>
<spring-security.version>5.7.12</spring-security.version>
<spring-framework.version>5.3.39</spring-framework.version>
<hutool.version>5.8.26</hutool.version>
<mybatis-plus.version>3.5.1</mybatis-plus.version>
</properties>
@ -190,6 +191,12 @@
<version>${kaptcha.version}</version>
</dependency>
<dependency>
<groupId>cn.hutool</groupId>
<artifactId>hutool-all</artifactId>
<version>${hutool.version}</version>
</dependency>
<!-- 定时任务-->
<dependency>
<groupId>com.ruoyi</groupId>

View File

@ -1,5 +1,7 @@
package com.ruoyi.base.controller;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
@ -28,7 +30,7 @@ import com.ruoyi.common.core.page.TableDataInfo;
* @date 2025-03-17
*/
@RestController
@RequestMapping("/base/baseConfig")
@RequestMapping("/base/config")
public class BaseConfigController extends BaseController
{
@Autowired
@ -37,24 +39,22 @@ public class BaseConfigController extends BaseController
/**
* 查询基础配置-账户配置小程序配置的内容列表
*/
@PreAuthorize("@ss.hasPermi('base:baseConfig:list')")
@GetMapping("/list")
public TableDataInfo list(BaseConfig baseConfig)
public AjaxResult list(BaseConfig baseConfig)
{
startPage();
List<BaseConfig> list = baseConfigService.selectBaseConfigList(baseConfig);
return getDataTable(list);
List<BaseConfig> list = baseConfigService.list();
return success(list);
}
/**
* 导出基础配置-账户配置小程序配置的内容列表
*/
@PreAuthorize("@ss.hasPermi('base:baseConfig:export')")
@Log(title = "基础配置-账户配置、小程序配置的内容", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, BaseConfig baseConfig)
{
List<BaseConfig> list = baseConfigService.selectBaseConfigList(baseConfig);
List<BaseConfig> list = baseConfigService.list();
ExcelUtil<BaseConfig> util = new ExcelUtil<BaseConfig>(BaseConfig.class);
util.exportExcel(response, list, "基础配置-账户配置、小程序配置的内容数据");
}
@ -62,43 +62,42 @@ public class BaseConfigController extends BaseController
/**
* 获取基础配置-账户配置小程序配置的内容详细信息
*/
@PreAuthorize("@ss.hasPermi('base:baseConfig:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") String id)
{
return success(baseConfigService.selectBaseConfigById(id));
return success(baseConfigService.getById(id));
}
/**
* 新增基础配置-账户配置小程序配置的内容
*/
@PreAuthorize("@ss.hasPermi('base:baseConfig:add')")
@Log(title = "基础配置-账户配置、小程序配置的内容", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody BaseConfig baseConfig)
{
return toAjax(baseConfigService.insertBaseConfig(baseConfig));
return toAjax(baseConfigService.save(baseConfig));
}
/**
* 修改基础配置-账户配置小程序配置的内容
*/
@PreAuthorize("@ss.hasPermi('base:baseConfig:edit')")
@PreAuthorize("@ss.hasPermi('base:config:edit')")
@Log(title = "基础配置-账户配置、小程序配置的内容", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody BaseConfig baseConfig)
{
return toAjax(baseConfigService.updateBaseConfig(baseConfig));
return toAjax(baseConfigService.updateById(baseConfig));
}
/**
* 删除基础配置-账户配置小程序配置的内容
*/
@PreAuthorize("@ss.hasPermi('base:baseConfig:remove')")
@PreAuthorize("@ss.hasPermi('base:config:remove')")
@Log(title = "基础配置-账户配置、小程序配置的内容", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable String[] ids)
{
return toAjax(baseConfigService.deleteBaseConfigByIds(ids));
List<String> list = new ArrayList<>(Arrays.asList(ids));
return toAjax(baseConfigService.removeBatchByIds(list));
}
}

View File

@ -1,21 +1,31 @@
package com.ruoyi.base.domain;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.*;
import com.ruoyi.common.core.domain.DlBaseEntity;
/**
* 基础配置-账户配置小程序配置的内容对象 base_config
* 基础配置-账户配置小程序配置的内容对象 dl_base_config
*
* @author vinjor-m
* @date 2025-03-17
*/
public class BaseConfig extends BaseEntity
@TableName("dl_base_config")
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class BaseConfig extends DlBaseEntity
{
private static final long serialVersionUID = 1L;
/** 唯一主键 */
@TableId(type = IdType.ASSIGN_UUID)
private String id;
/** 唯一编码 */
@ -26,88 +36,4 @@ public class BaseConfig extends BaseEntity
@Excel(name = "json字符串")
private String jsonStr;
/** 创建人 */
@Excel(name = "创建人")
private String creator;
/** 更新人 */
@Excel(name = "更新人")
private String updater;
/** 是否删除(0未删除|1已删除) */
private Long delFlag;
public void setId(String id)
{
this.id = id;
}
public String getId()
{
return id;
}
public void setCode(String code)
{
this.code = code;
}
public String getCode()
{
return code;
}
public void setJsonStr(String jsonStr)
{
this.jsonStr = jsonStr;
}
public String getJsonStr()
{
return jsonStr;
}
public void setCreator(String creator)
{
this.creator = creator;
}
public String getCreator()
{
return creator;
}
public void setUpdater(String updater)
{
this.updater = updater;
}
public String getUpdater()
{
return updater;
}
public void setDelFlag(Long delFlag)
{
this.delFlag = delFlag;
}
public Long getDelFlag()
{
return delFlag;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("code", getCode())
.append("jsonStr", getJsonStr())
.append("creator", getCreator())
.append("createTime", getCreateTime())
.append("updater", getUpdater())
.append("updateTime", getUpdateTime())
.append("delFlag", getDelFlag())
.toString();
}
}

View File

@ -2,6 +2,8 @@ package com.ruoyi.base.mapper;
import java.util.List;
import com.ruoyi.base.domain.BaseConfig;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
/**
* 基础配置-账户配置小程序配置的内容Mapper接口
@ -9,53 +11,8 @@ import com.ruoyi.base.domain.BaseConfig;
* @author vinjor-m
* @date 2025-03-17
*/
public interface BaseConfigMapper
@Mapper
public interface BaseConfigMapper extends BaseMapper<BaseConfig>
{
/**
* 查询基础配置-账户配置小程序配置的内容
*
* @param id 基础配置-账户配置小程序配置的内容主键
* @return 基础配置-账户配置小程序配置的内容
*/
public BaseConfig selectBaseConfigById(String id);
/**
* 查询基础配置-账户配置小程序配置的内容列表
*
* @param baseConfig 基础配置-账户配置小程序配置的内容
* @return 基础配置-账户配置小程序配置的内容集合
*/
public List<BaseConfig> selectBaseConfigList(BaseConfig baseConfig);
/**
* 新增基础配置-账户配置小程序配置的内容
*
* @param baseConfig 基础配置-账户配置小程序配置的内容
* @return 结果
*/
public int insertBaseConfig(BaseConfig baseConfig);
/**
* 修改基础配置-账户配置小程序配置的内容
*
* @param baseConfig 基础配置-账户配置小程序配置的内容
* @return 结果
*/
public int updateBaseConfig(BaseConfig baseConfig);
/**
* 删除基础配置-账户配置小程序配置的内容
*
* @param id 基础配置-账户配置小程序配置的内容主键
* @return 结果
*/
public int deleteBaseConfigById(String id);
/**
* 批量删除基础配置-账户配置小程序配置的内容
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deleteBaseConfigByIds(String[] ids);
}

View File

@ -1,6 +1,7 @@
package com.ruoyi.base.service;
import java.util.List;
import com.baomidou.mybatisplus.extension.service.IService;
import com.ruoyi.base.domain.BaseConfig;
/**
@ -9,53 +10,7 @@ import com.ruoyi.base.domain.BaseConfig;
* @author vinjor-m
* @date 2025-03-17
*/
public interface IBaseConfigService
public interface IBaseConfigService extends IService<BaseConfig>
{
/**
* 查询基础配置-账户配置小程序配置的内容
*
* @param id 基础配置-账户配置小程序配置的内容主键
* @return 基础配置-账户配置小程序配置的内容
*/
public BaseConfig selectBaseConfigById(String id);
/**
* 查询基础配置-账户配置小程序配置的内容列表
*
* @param baseConfig 基础配置-账户配置小程序配置的内容
* @return 基础配置-账户配置小程序配置的内容集合
*/
public List<BaseConfig> selectBaseConfigList(BaseConfig baseConfig);
/**
* 新增基础配置-账户配置小程序配置的内容
*
* @param baseConfig 基础配置-账户配置小程序配置的内容
* @return 结果
*/
public int insertBaseConfig(BaseConfig baseConfig);
/**
* 修改基础配置-账户配置小程序配置的内容
*
* @param baseConfig 基础配置-账户配置小程序配置的内容
* @return 结果
*/
public int updateBaseConfig(BaseConfig baseConfig);
/**
* 批量删除基础配置-账户配置小程序配置的内容
*
* @param ids 需要删除的基础配置-账户配置小程序配置的内容主键集合
* @return 结果
*/
public int deleteBaseConfigByIds(String[] ids);
/**
* 删除基础配置-账户配置小程序配置的内容信息
*
* @param id 基础配置-账户配置小程序配置的内容主键
* @return 结果
*/
public int deleteBaseConfigById(String id);
}

View File

@ -4,6 +4,7 @@ import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.base.mapper.BaseConfigMapper;
import com.ruoyi.base.domain.BaseConfig;
import com.ruoyi.base.service.IBaseConfigService;
@ -15,82 +16,10 @@ import com.ruoyi.base.service.IBaseConfigService;
* @date 2025-03-17
*/
@Service
public class BaseConfigServiceImpl implements IBaseConfigService
public class BaseConfigServiceImpl extends ServiceImpl<BaseConfigMapper,BaseConfig> implements IBaseConfigService
{
@Autowired
private BaseConfigMapper baseConfigMapper;
/**
* 查询基础配置-账户配置小程序配置的内容
*
* @param id 基础配置-账户配置小程序配置的内容主键
* @return 基础配置-账户配置小程序配置的内容
*/
@Override
public BaseConfig selectBaseConfigById(String id)
{
return baseConfigMapper.selectBaseConfigById(id);
}
/**
* 查询基础配置-账户配置小程序配置的内容列表
*
* @param baseConfig 基础配置-账户配置小程序配置的内容
* @return 基础配置-账户配置小程序配置的内容
*/
@Override
public List<BaseConfig> selectBaseConfigList(BaseConfig baseConfig)
{
return baseConfigMapper.selectBaseConfigList(baseConfig);
}
/**
* 新增基础配置-账户配置小程序配置的内容
*
* @param baseConfig 基础配置-账户配置小程序配置的内容
* @return 结果
*/
@Override
public int insertBaseConfig(BaseConfig baseConfig)
{
baseConfig.setCreateTime(DateUtils.getNowDate());
return baseConfigMapper.insertBaseConfig(baseConfig);
}
/**
* 修改基础配置-账户配置小程序配置的内容
*
* @param baseConfig 基础配置-账户配置小程序配置的内容
* @return 结果
*/
@Override
public int updateBaseConfig(BaseConfig baseConfig)
{
baseConfig.setUpdateTime(DateUtils.getNowDate());
return baseConfigMapper.updateBaseConfig(baseConfig);
}
/**
* 批量删除基础配置-账户配置小程序配置的内容
*
* @param ids 需要删除的基础配置-账户配置小程序配置的内容主键
* @return 结果
*/
@Override
public int deleteBaseConfigByIds(String[] ids)
{
return baseConfigMapper.deleteBaseConfigByIds(ids);
}
/**
* 删除基础配置-账户配置小程序配置的内容信息
*
* @param id 基础配置-账户配置小程序配置的内容主键
* @return 结果
*/
@Override
public int deleteBaseConfigById(String id)
{
return baseConfigMapper.deleteBaseConfigById(id);
}
}

View File

@ -105,7 +105,24 @@ mybatis:
mapperLocations: classpath*:mapper/**/*Mapper.xml
# 加载全局的配置文件
configLocation: classpath:mybatis/mybatis-config.xml
# MyBatis Plus 的配置项
mybatis-plus:
configuration:
map-underscore-to-camel-case: true # 虽然默认为 true ,但是还是显示去指定下。
# log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
global-config:
db-config:
id-type: NONE # “智能”模式,基于 IdTypeEnvironmentPostProcessor + 数据源的类型,自动适配成 AUTO、INPUT 模式。
# id-type: AUTO # 自增 ID适合 MySQL 等直接自增的数据库
# id-type: INPUT # 用户输入 ID适合 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库
# id-type: ASSIGN_ID # 分配 ID默认使用雪花算法。注意Oracle、PostgreSQL、Kingbase、DB2、H2 数据库时,需要去除实体类上的 @KeySequence 注解
logic-delete-value: 1 # 逻辑已删除值(默认为 1)
logic-not-delete-value: 0 # 逻辑未删除值(默认为 0)
banner: false # 关闭控制台的 Banner 打印
mapper-locations:
- classpath*:mapper/*/*.xml # 扫描子模块下的 mapper.xml文件
- classpath:mapper/*/*.xml # 扫描当前模块下的 mapper.xml 文件
- classpath*:mapper/*.xml
# PageHelper分页插件
pagehelper:
helperDialect: mysql

View File

@ -19,67 +19,5 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
select id, code, json_str, creator, create_time, updater, update_time, del_flag from dl_base_config
</sql>
<select id="selectBaseConfigList" parameterType="BaseConfig" resultMap="BaseConfigResult">
<include refid="selectBaseConfigVo"/>
<where>
<if test="code != null and code != ''"> and code = #{code}</if>
<if test="jsonStr != null and jsonStr != ''"> and json_str = #{jsonStr}</if>
<if test="creator != null and creator != ''"> and creator = #{creator}</if>
<if test="updater != null and updater != ''"> and updater = #{updater}</if>
</where>
</select>
<select id="selectBaseConfigById" parameterType="String" resultMap="BaseConfigResult">
<include refid="selectBaseConfigVo"/>
where id = #{id}
</select>
<insert id="insertBaseConfig" parameterType="BaseConfig">
insert into dl_base_config
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">id,</if>
<if test="code != null">code,</if>
<if test="jsonStr != null">json_str,</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="delFlag != null">del_flag,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},</if>
<if test="code != null">#{code},</if>
<if test="jsonStr != null">#{jsonStr},</if>
<if test="creator != null">#{creator},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updater != null">#{updater},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="delFlag != null">#{delFlag},</if>
</trim>
</insert>
<update id="updateBaseConfig" parameterType="BaseConfig">
update dl_base_config
<trim prefix="SET" suffixOverrides=",">
<if test="code != null">code = #{code},</if>
<if test="jsonStr != null">json_str = #{jsonStr},</if>
<if test="creator != null">creator = #{creator},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updater != null">updater = #{updater},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="delFlag != null">del_flag = #{delFlag},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteBaseConfigById" parameterType="String">
delete from dl_base_config where id = #{id}
</delete>
<delete id="deleteBaseConfigByIds" parameterType="String">
delete from dl_base_config where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>

View File

@ -118,7 +118,19 @@
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
</dependency>
<!-- mybatis-plus -->
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</dependency>
<dependency>
<groupId>cn.hutool</groupId>
<artifactId>hutool-all</artifactId>
</dependency>
</dependencies>
</project>

View File

@ -45,18 +45,16 @@ public class GenConstants
"bit", "bigint", "float", "double", "decimal" };
/** 页面不需要编辑字段 */
public static final String[] COLUMNNAME_NOT_EDIT = { "id", "create_by", "create_time", "del_flag" };
public static final String[] COLUMNNAME_NOT_EDIT = { "id", "create_by","update_by","creator","updater", "update_time","create_time", "del_flag" };
/** 页面不需要显示的列表字段 */
public static final String[] COLUMNNAME_NOT_LIST = { "id", "create_by", "create_time", "del_flag", "update_by",
"update_time" };
public static final String[] COLUMNNAME_NOT_LIST = { "id", "create_by","update_by","creator","updater", "update_time","create_time", "del_flag" };
/** 页面不需要查询字段 */
public static final String[] COLUMNNAME_NOT_QUERY = { "id", "create_by", "create_time", "del_flag", "update_by",
"update_time", "remark" };
public static final String[] COLUMNNAME_NOT_QUERY = { "id", "create_by","update_by","creator","updater", "update_time","create_time", "del_flag" };
/** Entity基类字段 */
public static final String[] BASE_ENTITY = { "createBy", "createTime", "updateBy", "updateTime", "remark" };
public static final String[] BASE_ENTITY = { "createBy", "createTime", "updateBy", "updateTime", "creator" , "updater", "delFlag"};
/** Tree基类字段 */
public static final String[] TREE_ENTITY = { "parentName", "parentId", "orderNum", "ancestors", "children" };

View File

@ -0,0 +1,43 @@
package com.ruoyi.common.core.domain;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
/**
* Entity基类--点亮
*
* @author ruoyi
*/
@Data
public class DlBaseEntity implements Serializable
{
private static final long serialVersionUID = 1L;
/** 创建者 */
private String creator;
/** 创建时间 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date createTime;
/** 更新者 */
private String updater;
/** 更新时间 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date updateTime;
/** 是否删除(0未删除|1已删除) */
@TableLogic
private String delFlag;
}

View File

@ -332,7 +332,7 @@ public class GenTableColumn extends BaseEntity
{
return StringUtils.equalsAnyIgnoreCase(javaField,
// BaseEntity
"createBy", "createTime", "updateBy", "updateTime", "remark",
"creator", "createTime", "updater", "updateTime", "delFlag",
// TreeEntity
"parentName", "parentId", "orderNum", "ancestors");
}

View File

@ -1,12 +1,12 @@
# 代码生成
gen:
# 作者
author: ruoyi
author: vinjor-m
# 默认生成包路径 system 需改成自己的模块名称 如 system monitor tool
packageName: com.ruoyi.system
packageName: com.ruoyi.base
# 自动去除表前缀默认是false
autoRemovePre: false
autoRemovePre: true
# 表前缀(生成类名不会包含表前缀,多个用逗号分隔)
tablePrefix: sys_
tablePrefix: sys_,dl_
# 是否允许生成文件覆盖到本地(自定义路径),默认不允许
allowOverwrite: false

View File

@ -1,5 +1,7 @@
package ${packageName}.controller;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
@ -43,16 +45,16 @@ public class ${ClassName}Controller extends BaseController
@PreAuthorize("@ss.hasPermi('${permissionPrefix}:list')")
@GetMapping("/list")
#if($table.crud || $table.sub)
public TableDataInfo list(${ClassName} ${className})
public AjaxResult list(${ClassName} ${className})
{
startPage();
List<${ClassName}> list = ${className}Service.select${ClassName}List(${className});
return getDataTable(list);
List<${ClassName}> list = ${className}Service.list();
return success(list);
}
#elseif($table.tree)
public AjaxResult list(${ClassName} ${className})
{
List<${ClassName}> list = ${className}Service.select${ClassName}List(${className});
List<${ClassName}> list = ${className}Service.list();
return success(list);
}
#end
@ -65,7 +67,7 @@ public class ${ClassName}Controller extends BaseController
@PostMapping("/export")
public void export(HttpServletResponse response, ${ClassName} ${className})
{
List<${ClassName}> list = ${className}Service.select${ClassName}List(${className});
List<${ClassName}> list = ${className}Service.list();
ExcelUtil<${ClassName}> util = new ExcelUtil<${ClassName}>(${ClassName}.class);
util.exportExcel(response, list, "${functionName}数据");
}
@ -77,7 +79,7 @@ public class ${ClassName}Controller extends BaseController
@GetMapping(value = "/{${pkColumn.javaField}}")
public AjaxResult getInfo(@PathVariable("${pkColumn.javaField}") ${pkColumn.javaType} ${pkColumn.javaField})
{
return success(${className}Service.select${ClassName}By${pkColumn.capJavaField}(${pkColumn.javaField}));
return success(${className}Service.getById(${pkColumn.javaField}));
}
/**
@ -88,7 +90,7 @@ public class ${ClassName}Controller extends BaseController
@PostMapping
public AjaxResult add(@RequestBody ${ClassName} ${className})
{
return toAjax(${className}Service.insert${ClassName}(${className}));
return toAjax(${className}Service.save(${className}));
}
/**
@ -99,7 +101,7 @@ public class ${ClassName}Controller extends BaseController
@PutMapping
public AjaxResult edit(@RequestBody ${ClassName} ${className})
{
return toAjax(${className}Service.update${ClassName}(${className}));
return toAjax(${className}Service.updateById(${className}));
}
/**
@ -110,6 +112,7 @@ public class ${ClassName}Controller extends BaseController
@DeleteMapping("/{${pkColumn.javaField}s}")
public AjaxResult remove(@PathVariable ${pkColumn.javaType}[] ${pkColumn.javaField}s)
{
return toAjax(${className}Service.delete${ClassName}By${pkColumn.capJavaField}s(${pkColumn.javaField}s));
List<${pkColumn.javaType}> list = new ArrayList<>(Arrays.asList(${pkColumn.javaField}s));
return toAjax(${className}Service.removeBatchByIds(list));
}
}

View File

@ -3,11 +3,13 @@ package ${packageName}.domain;
#foreach ($import in $importList)
import ${import};
#end
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.*;
#if($table.crud || $table.sub)
import com.ruoyi.common.core.domain.BaseEntity;
import com.ruoyi.common.core.domain.DlBaseEntity;
#elseif($table.tree)
import com.ruoyi.common.core.domain.TreeEntity;
#end
@ -19,10 +21,17 @@ import com.ruoyi.common.core.domain.TreeEntity;
* @date ${datetime}
*/
#if($table.crud || $table.sub)
#set($Entity="BaseEntity")
#set($Entity="DlBaseEntity")
#elseif($table.tree)
#set($Entity="TreeEntity")
#end
@TableName("${tableName}")
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class ${ClassName} extends ${Entity}
{
private static final long serialVersionUID = 1L;
@ -30,6 +39,9 @@ public class ${ClassName} extends ${Entity}
#foreach ($column in $columns)
#if(!$table.isSuperColumn($column.javaField))
/** $column.columnComment */
#if($column.javaField == 'id')
@TableId(type = IdType.ASSIGN_UUID)
#end
#if($column.list)
#set($parentheseIndex=$column.columnComment.indexOf(""))
#if($parentheseIndex != -1)
@ -55,51 +67,4 @@ public class ${ClassName} extends ${Entity}
private List<${subClassName}> ${subclassName}List;
#end
#foreach ($column in $columns)
#if(!$table.isSuperColumn($column.javaField))
#if($column.javaField.length() > 2 && $column.javaField.substring(1,2).matches("[A-Z]"))
#set($AttrName=$column.javaField)
#else
#set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)})
#end
public void set${AttrName}($column.javaType $column.javaField)
{
this.$column.javaField = $column.javaField;
}
public $column.javaType get${AttrName}()
{
return $column.javaField;
}
#end
#end
#if($table.sub)
public List<${subClassName}> get${subClassName}List()
{
return ${subclassName}List;
}
public void set${subClassName}List(List<${subClassName}> ${subclassName}List)
{
this.${subclassName}List = ${subclassName}List;
}
#end
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
#foreach ($column in $columns)
#if($column.javaField.length() > 2 && $column.javaField.substring(1,2).matches("[A-Z]"))
#set($AttrName=$column.javaField)
#else
#set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)})
#end
.append("${column.javaField}", get${AttrName}())
#end
#if($table.sub)
.append("${subclassName}List", get${subClassName}List())
#end
.toString();
}
}

View File

@ -2,6 +2,8 @@ package ${packageName}.mapper;
import java.util.List;
import ${packageName}.domain.${ClassName};
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
#if($table.sub)
import ${packageName}.domain.${subClassName};
#end
@ -12,80 +14,8 @@ import ${packageName}.domain.${subClassName};
* @author ${author}
* @date ${datetime}
*/
public interface ${ClassName}Mapper
@Mapper
public interface ${ClassName}Mapper extends BaseMapper<${ClassName}>
{
/**
* 查询${functionName}
*
* @param ${pkColumn.javaField} ${functionName}主键
* @return ${functionName}
*/
public ${ClassName} select${ClassName}By${pkColumn.capJavaField}(${pkColumn.javaType} ${pkColumn.javaField});
/**
* 查询${functionName}列表
*
* @param ${className} ${functionName}
* @return ${functionName}集合
*/
public List<${ClassName}> select${ClassName}List(${ClassName} ${className});
/**
* 新增${functionName}
*
* @param ${className} ${functionName}
* @return 结果
*/
public int insert${ClassName}(${ClassName} ${className});
/**
* 修改${functionName}
*
* @param ${className} ${functionName}
* @return 结果
*/
public int update${ClassName}(${ClassName} ${className});
/**
* 删除${functionName}
*
* @param ${pkColumn.javaField} ${functionName}主键
* @return 结果
*/
public int delete${ClassName}By${pkColumn.capJavaField}(${pkColumn.javaType} ${pkColumn.javaField});
/**
* 批量删除${functionName}
*
* @param ${pkColumn.javaField}s 需要删除的数据主键集合
* @return 结果
*/
public int delete${ClassName}By${pkColumn.capJavaField}s(${pkColumn.javaType}[] ${pkColumn.javaField}s);
#if($table.sub)
/**
* 批量删除${subTable.functionName}
*
* @param ${pkColumn.javaField}s 需要删除的数据主键集合
* @return 结果
*/
public int delete${subClassName}By${subTableFkClassName}s(${pkColumn.javaType}[] ${pkColumn.javaField}s);
/**
* 批量新增${subTable.functionName}
*
* @param ${subclassName}List ${subTable.functionName}列表
* @return 结果
*/
public int batch${subClassName}(List<${subClassName}> ${subclassName}List);
/**
* 通过${functionName}主键删除${subTable.functionName}信息
*
* @param ${pkColumn.javaField} ${functionName}ID
* @return 结果
*/
public int delete${subClassName}By${subTableFkClassName}(${pkColumn.javaType} ${pkColumn.javaField});
#end
}

View File

@ -1,6 +1,7 @@
package ${packageName}.service;
import java.util.List;
import com.baomidou.mybatisplus.extension.service.IService;
import ${packageName}.domain.${ClassName};
/**
@ -9,53 +10,7 @@ import ${packageName}.domain.${ClassName};
* @author ${author}
* @date ${datetime}
*/
public interface I${ClassName}Service
public interface I${ClassName}Service extends IService<${ClassName}>
{
/**
* 查询${functionName}
*
* @param ${pkColumn.javaField} ${functionName}主键
* @return ${functionName}
*/
public ${ClassName} select${ClassName}By${pkColumn.capJavaField}(${pkColumn.javaType} ${pkColumn.javaField});
/**
* 查询${functionName}列表
*
* @param ${className} ${functionName}
* @return ${functionName}集合
*/
public List<${ClassName}> select${ClassName}List(${ClassName} ${className});
/**
* 新增${functionName}
*
* @param ${className} ${functionName}
* @return 结果
*/
public int insert${ClassName}(${ClassName} ${className});
/**
* 修改${functionName}
*
* @param ${className} ${functionName}
* @return 结果
*/
public int update${ClassName}(${ClassName} ${className});
/**
* 批量删除${functionName}
*
* @param ${pkColumn.javaField}s 需要删除的${functionName}主键集合
* @return 结果
*/
public int delete${ClassName}By${pkColumn.capJavaField}s(${pkColumn.javaType}[] ${pkColumn.javaField}s);
/**
* 删除${functionName}信息
*
* @param ${pkColumn.javaField} ${functionName}主键
* @return 结果
*/
public int delete${ClassName}By${pkColumn.capJavaField}(${pkColumn.javaType} ${pkColumn.javaField});
}

View File

@ -9,6 +9,7 @@ import com.ruoyi.common.utils.DateUtils;
#end
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
#if($table.sub)
import java.util.ArrayList;
import com.ruoyi.common.utils.StringUtils;
@ -26,144 +27,10 @@ import ${packageName}.service.I${ClassName}Service;
* @date ${datetime}
*/
@Service
public class ${ClassName}ServiceImpl implements I${ClassName}Service
public class ${ClassName}ServiceImpl extends ServiceImpl<${ClassName}Mapper,${ClassName}> implements I${ClassName}Service
{
@Autowired
private ${ClassName}Mapper ${className}Mapper;
/**
* 查询${functionName}
*
* @param ${pkColumn.javaField} ${functionName}主键
* @return ${functionName}
*/
@Override
public ${ClassName} select${ClassName}By${pkColumn.capJavaField}(${pkColumn.javaType} ${pkColumn.javaField})
{
return ${className}Mapper.select${ClassName}By${pkColumn.capJavaField}(${pkColumn.javaField});
}
/**
* 查询${functionName}列表
*
* @param ${className} ${functionName}
* @return ${functionName}
*/
@Override
public List<${ClassName}> select${ClassName}List(${ClassName} ${className})
{
return ${className}Mapper.select${ClassName}List(${className});
}
/**
* 新增${functionName}
*
* @param ${className} ${functionName}
* @return 结果
*/
#if($table.sub)
@Transactional
#end
@Override
public int insert${ClassName}(${ClassName} ${className})
{
#foreach ($column in $columns)
#if($column.javaField == 'createTime')
${className}.setCreateTime(DateUtils.getNowDate());
#end
#end
#if($table.sub)
int rows = ${className}Mapper.insert${ClassName}(${className});
insert${subClassName}(${className});
return rows;
#else
return ${className}Mapper.insert${ClassName}(${className});
#end
}
/**
* 修改${functionName}
*
* @param ${className} ${functionName}
* @return 结果
*/
#if($table.sub)
@Transactional
#end
@Override
public int update${ClassName}(${ClassName} ${className})
{
#foreach ($column in $columns)
#if($column.javaField == 'updateTime')
${className}.setUpdateTime(DateUtils.getNowDate());
#end
#end
#if($table.sub)
${className}Mapper.delete${subClassName}By${subTableFkClassName}(${className}.get${pkColumn.capJavaField}());
insert${subClassName}(${className});
#end
return ${className}Mapper.update${ClassName}(${className});
}
/**
* 批量删除${functionName}
*
* @param ${pkColumn.javaField}s 需要删除的${functionName}主键
* @return 结果
*/
#if($table.sub)
@Transactional
#end
@Override
public int delete${ClassName}By${pkColumn.capJavaField}s(${pkColumn.javaType}[] ${pkColumn.javaField}s)
{
#if($table.sub)
${className}Mapper.delete${subClassName}By${subTableFkClassName}s(${pkColumn.javaField}s);
#end
return ${className}Mapper.delete${ClassName}By${pkColumn.capJavaField}s(${pkColumn.javaField}s);
}
/**
* 删除${functionName}信息
*
* @param ${pkColumn.javaField} ${functionName}主键
* @return 结果
*/
#if($table.sub)
@Transactional
#end
@Override
public int delete${ClassName}By${pkColumn.capJavaField}(${pkColumn.javaType} ${pkColumn.javaField})
{
#if($table.sub)
${className}Mapper.delete${subClassName}By${subTableFkClassName}(${pkColumn.javaField});
#end
return ${className}Mapper.delete${ClassName}By${pkColumn.capJavaField}(${pkColumn.javaField});
}
#if($table.sub)
/**
* 新增${subTable.functionName}信息
*
* @param ${className} ${functionName}对象
*/
public void insert${subClassName}(${ClassName} ${className})
{
List<${subClassName}> ${subclassName}List = ${className}.get${subClassName}List();
${pkColumn.javaType} ${pkColumn.javaField} = ${className}.get${pkColumn.capJavaField}();
if (StringUtils.isNotNull(${subclassName}List))
{
List<${subClassName}> list = new ArrayList<${subClassName}>();
for (${subClassName} ${subclassName} : ${subclassName}List)
{
${subclassName}.set${subTableFkClassName}(${pkColumn.javaField});
list.add(${subclassName});
}
if (list.size() > 0)
{
${className}Mapper.batch${subClassName}(list);
}
}
}
#end
}

View File

@ -26,115 +26,5 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
select#foreach($column in $columns) $column.columnName#if($foreach.count != $columns.size()),#end#end from ${tableName}
</sql>
<select id="select${ClassName}List" parameterType="${ClassName}" resultMap="${ClassName}Result">
<include refid="select${ClassName}Vo"/>
<where>
#foreach($column in $columns)
#set($queryType=$column.queryType)
#set($javaField=$column.javaField)
#set($javaType=$column.javaType)
#set($columnName=$column.columnName)
#set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)})
#if($column.query)
#if($column.queryType == "EQ")
<if test="$javaField != null #if($javaType == 'String' ) and $javaField.trim() != ''#end"> and $columnName = #{$javaField}</if>
#elseif($queryType == "NE")
<if test="$javaField != null #if($javaType == 'String' ) and $javaField.trim() != ''#end"> and $columnName != #{$javaField}</if>
#elseif($queryType == "GT")
<if test="$javaField != null #if($javaType == 'String' ) and $javaField.trim() != ''#end"> and $columnName &gt; #{$javaField}</if>
#elseif($queryType == "GTE")
<if test="$javaField != null #if($javaType == 'String' ) and $javaField.trim() != ''#end"> and $columnName &gt;= #{$javaField}</if>
#elseif($queryType == "LT")
<if test="$javaField != null #if($javaType == 'String' ) and $javaField.trim() != ''#end"> and $columnName &lt; #{$javaField}</if>
#elseif($queryType == "LTE")
<if test="$javaField != null #if($javaType == 'String' ) and $javaField.trim() != ''#end"> and $columnName &lt;= #{$javaField}</if>
#elseif($queryType == "LIKE")
<if test="$javaField != null #if($javaType == 'String' ) and $javaField.trim() != ''#end"> and $columnName like concat('%', #{$javaField}, '%')</if>
#elseif($queryType == "BETWEEN")
<if test="params.begin$AttrName != null and params.begin$AttrName != '' and params.end$AttrName != null and params.end$AttrName != ''"> and $columnName between #{params.begin$AttrName} and #{params.end$AttrName}</if>
#end
#end
#end
</where>
</select>
<select id="select${ClassName}By${pkColumn.capJavaField}" parameterType="${pkColumn.javaType}" resultMap="#if($table.sub)${ClassName}${subClassName}Result#else${ClassName}Result#end">
#if($table.crud || $table.tree)
<include refid="select${ClassName}Vo"/>
where ${pkColumn.columnName} = #{${pkColumn.javaField}}
#elseif($table.sub)
select#foreach($column in $columns) $column.columnName#if($foreach.count != $columns.size()),#end#end
from ${tableName}
where ${pkColumn.columnName} = #{${pkColumn.javaField}}
#end
</select>
#if($table.sub)
<select id="select${subClassName}List" resultMap="${subClassName}Result">
select#foreach ($column in $subTable.columns) $column.columnName#if($foreach.count != $subTable.columns.size()),#end#end
from ${subTableName}
where ${subTableFkName} = #{${subTableFkName}}
</select>
#end
<insert id="insert${ClassName}" parameterType="${ClassName}"#if($pkColumn.increment) useGeneratedKeys="true" keyProperty="$pkColumn.javaField"#end>
insert into ${tableName}
<trim prefix="(" suffix=")" suffixOverrides=",">
#foreach($column in $columns)
#if($column.columnName != $pkColumn.columnName || !$pkColumn.increment)
<if test="$column.javaField != null#if($column.javaType == 'String' && $column.required) and $column.javaField != ''#end">$column.columnName,</if>
#end
#end
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
#foreach($column in $columns)
#if($column.columnName != $pkColumn.columnName || !$pkColumn.increment)
<if test="$column.javaField != null#if($column.javaType == 'String' && $column.required) and $column.javaField != ''#end">#{$column.javaField},</if>
#end
#end
</trim>
</insert>
<update id="update${ClassName}" parameterType="${ClassName}">
update ${tableName}
<trim prefix="SET" suffixOverrides=",">
#foreach($column in $columns)
#if($column.columnName != $pkColumn.columnName)
<if test="$column.javaField != null#if($column.javaType == 'String' && $column.required) and $column.javaField != ''#end">$column.columnName = #{$column.javaField},</if>
#end
#end
</trim>
where ${pkColumn.columnName} = #{${pkColumn.javaField}}
</update>
<delete id="delete${ClassName}By${pkColumn.capJavaField}" parameterType="${pkColumn.javaType}">
delete from ${tableName} where ${pkColumn.columnName} = #{${pkColumn.javaField}}
</delete>
<delete id="delete${ClassName}By${pkColumn.capJavaField}s" parameterType="String">
delete from ${tableName} where ${pkColumn.columnName} in
<foreach item="${pkColumn.javaField}" collection="array" open="(" separator="," close=")">
#{${pkColumn.javaField}}
</foreach>
</delete>
#if($table.sub)
<delete id="delete${subClassName}By${subTableFkClassName}s" parameterType="String">
delete from ${subTableName} where ${subTableFkName} in
<foreach item="${subTableFkclassName}" collection="array" open="(" separator="," close=")">
#{${subTableFkclassName}}
</foreach>
</delete>
<delete id="delete${subClassName}By${subTableFkClassName}" parameterType="${pkColumn.javaType}">
delete from ${subTableName} where ${subTableFkName} = #{${subTableFkclassName}}
</delete>
<insert id="batch${subClassName}">
insert into ${subTableName}(#foreach($column in $subTable.columns) $column.columnName#if($foreach.count != $subTable.columns.size()),#end#end) values
<foreach item="item" index="index" collection="list" separator=",">
(#foreach($column in $subTable.columns) #{item.$column.javaField}#if($foreach.count != $subTable.columns.size()),#end#end)
</foreach>
</insert>
#end
</mapper>