12c40c6004
Add Node.js CLI tool with Handlebars templates for generating standard CRUD artifacts: Java entity, service, DAO, controller, MyBatis mapper XML, and Vue frontend pages. Also generate the full SampleTableBoard CRUD reference implementation, update README with backend execution instructions, and add project plan documentation.
47 lines
1.1 KiB
Handlebars
47 lines
1.1 KiB
Handlebars
package {{daoPackage}};
|
|
|
|
import java.util.List;
|
|
|
|
import org.apache.ibatis.session.SqlSession;
|
|
import org.springframework.stereotype.Repository;
|
|
|
|
import {{entityFqcn}};
|
|
|
|
@Repository
|
|
public class {{daoName}} {
|
|
|
|
private static final String MAPPER = "{{mapperNamespace}}.";
|
|
|
|
private final SqlSession sqlSession;
|
|
|
|
public {{daoName}}(SqlSession sqlSession) {
|
|
|
|
this.sqlSession = sqlSession;
|
|
}
|
|
|
|
public List<{{entityName}}> select{{entityName}}List() {
|
|
|
|
return sqlSession.selectList(MAPPER + "select{{entityName}}List");
|
|
}
|
|
|
|
public {{entityName}} select{{entityName}}({{primaryKeyJavaType}} {{primaryKeyProperty}}) {
|
|
|
|
return sqlSession.selectOne(MAPPER + "select{{entityName}}", {{primaryKeyProperty}});
|
|
}
|
|
|
|
public void insert{{entityName}}({{entityName}} {{entityVarName}}) {
|
|
|
|
sqlSession.insert(MAPPER + "insert{{entityName}}", {{entityVarName}});
|
|
}
|
|
|
|
public void update{{entityName}}({{entityName}} {{entityVarName}}) {
|
|
|
|
sqlSession.update(MAPPER + "update{{entityName}}", {{entityVarName}});
|
|
}
|
|
|
|
public void delete{{entityName}}({{primaryKeyJavaType}} {{primaryKeyProperty}}) {
|
|
|
|
sqlSession.delete(MAPPER + "delete{{entityName}}", {{primaryKeyProperty}});
|
|
}
|
|
}
|