Browse Source

优化代码生成模板

tags/v3.1.0
RuoYi 3 years ago
parent
commit
ea038a5437
  1. 4
      ruoyi-modules/ruoyi-gen/src/main/resources/vm/java/controller.java.vm
  2. 2
      ruoyi-modules/ruoyi-gen/src/main/resources/vm/java/mapper.java.vm
  3. 2
      ruoyi-modules/ruoyi-gen/src/main/resources/vm/xml/mapper.xml.vm

4
ruoyi-modules/ruoyi-gen/src/main/resources/vm/java/controller.java.vm

@ -78,7 +78,7 @@ public class ${ClassName}Controller extends BaseController
@GetMapping(value = "/{${pkColumn.javaField}}") @GetMapping(value = "/{${pkColumn.javaField}}")
public AjaxResult getInfo(@PathVariable("${pkColumn.javaField}") ${pkColumn.javaType} ${pkColumn.javaField}) public AjaxResult getInfo(@PathVariable("${pkColumn.javaField}") ${pkColumn.javaType} ${pkColumn.javaField})
{ {
return AjaxResult.success(${className}Service.select${ClassName}ById(${pkColumn.javaField})); return AjaxResult.success(${className}Service.select${ClassName}By${pkColumn.capJavaField}(${pkColumn.javaField}));
} }
/** /**
@ -111,6 +111,6 @@ public class ${ClassName}Controller extends BaseController
@DeleteMapping("/{${pkColumn.javaField}s}") @DeleteMapping("/{${pkColumn.javaField}s}")
public AjaxResult remove(@PathVariable ${pkColumn.javaType}[] ${pkColumn.javaField}s) public AjaxResult remove(@PathVariable ${pkColumn.javaType}[] ${pkColumn.javaField}s)
{ {
return toAjax(${className}Service.delete${ClassName}ByIds(${pkColumn.javaField}s)); return toAjax(${className}Service.delete${ClassName}By${pkColumn.capJavaField}s(${pkColumn.javaField}s));
} }
} }

2
ruoyi-modules/ruoyi-gen/src/main/resources/vm/java/mapper.java.vm

@ -86,6 +86,6 @@ public interface ${ClassName}Mapper
* @param ${pkColumn.javaField} ${functionName}ID * @param ${pkColumn.javaField} ${functionName}ID
* @return 结果 * @return 结果
*/ */
public int delete${subClassName}By${pkColumn.capJavaField}(${pkColumn.javaType} ${pkColumn.javaField}); public int delete${subClassName}By${subTableFkClassName}(${pkColumn.javaType} ${pkColumn.javaField});
#end #end
} }

2
ruoyi-modules/ruoyi-gen/src/main/resources/vm/xml/mapper.xml.vm

@ -121,7 +121,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</foreach> </foreach>
</delete> </delete>
<delete id="delete${subClassName}By${subTableFkClassName}" parameterType="${subTableFkjavaType}"> <delete id="delete${subClassName}By${subTableFkClassName}" parameterType="${pkColumn.javaType}">
delete from ${subTableName} where ${subTableFkName} = #{${subTableFkclassName}} delete from ${subTableName} where ${subTableFkName} = #{${subTableFkclassName}}
</delete> </delete>

Loading…
Cancel
Save