Code pull completed, the page will refresh automatically
ps: Поддерживаются два стиля конфигурации — Mapper и sqlSession.
git clone https://git.oschina.net/darkidiot/CodeHelper.git
java -jar ./CodeHelper/dist/CodeHelper.jar
private String getMyBatisCode(Table table, String pack, String author) throws Exception {
String xml = Util.read(getDaoTemplateLocation());
String daoTemplate = Util.matchs(xml, "<class>([\\w\\W]+?)</class>", 1).get(0);
... ... ...
return daoTemplate.toString();
}
<mapper namespace="#class.package#.mapper.#class.name#Mapper">
<resultMap id="BaseResultMap" type="#class.package#.model.#class.name#">
#columns.mapping#
</resultMap>
... ... ...
<sql id="tb">
#table.name#
</sql>
<sql id="cols_all">
#id#, <include refid="cols_exclude_id" />
</sql>
... ... ...
<select id="load" parameterType="long" resultMap="BaseResultMap">
SELECT
<include refid="cols_all" />
FROM
<include refid="tb" />
WHERE #id# = #{id}
</select>
... ... ...
<insert id="create" parameterType="#class.package#.model.#class.name#">
INSERT INTO
<include refid="tb" /> (<include refid="cols_all"/>)
VALUES(<include refid="vals_all"/>)
</insert>
... ... ...
<update id="update" parameterType="#class.package#.model.#class.name#">
UPDATE <include refid="tb" />
<set>
#commaIfEntrys#
</set>
WHERE #id# = #idVal#
</update>
... ... ...
<delete id="delete" parameterType="long">
DELETE FROM <include refid="tb" />
WHERE #id# = #{id}
</delete>
</mapper>
You can comment after Login
Inappropriate content may be displayed here and will not be shown on the page. You can check and modify it through the relevant editing function
If you confirm that the content does not involve inappropriate language/advertisement redirection/violence/vulgar pornography/infringement/piracy/false/insignificant or illegal content related to national laws and regulations, you can click submit to make an appeal, and we will handle it as soon as possible.
Comments ( 0 )