|
@@ -0,0 +1,94 @@
|
|
|
+<?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="com.boman.gen.mapper.GenTableRelationMapper">
|
|
|
+
|
|
|
+ <resultMap type="GenTableRelation" id="GenTableRelationResult">
|
|
|
+ <result property="id" column="id" />
|
|
|
+ <result property="description" column="description" />
|
|
|
+ <result property="relationParentId" column="relation_parent_id" />
|
|
|
+ <result property="relationChildId" column="relation_child_id" />
|
|
|
+ <result property="relationType" column="relation_type" />
|
|
|
+ </resultMap>
|
|
|
+
|
|
|
+ <sql id="selectGenTableRelationVo">
|
|
|
+ select id, description, relation_parent_id, relation_child_id, relation_type, create_by, create_time, update_by, update_time
|
|
|
+ from gen_table_relation
|
|
|
+ </sql>
|
|
|
+
|
|
|
+ <select id="selectGenTableRelationList" parameterType="GenTableRelation" resultMap="GenTableRelationResult">
|
|
|
+ <include refid="selectGenTableRelationVo"/>
|
|
|
+ <where>
|
|
|
+ <if test="description != null and description != ''">
|
|
|
+ AND description like concat('%', #{description}, '%')
|
|
|
+ </if>
|
|
|
+ <if test="relationParentId != null">
|
|
|
+ AND relation_parent_id = #{relationParentId}
|
|
|
+ </if>
|
|
|
+ <if test="relationChildId != null ">
|
|
|
+ AND relation_child_id = #{relationChildId}
|
|
|
+ </if>
|
|
|
+ <if test="relationType != null ">
|
|
|
+ AND relation_type = #{relationType}
|
|
|
+ </if>
|
|
|
+ <if test="params.beginTime != null and params.beginTime != ''"><!-- 开始时间检索 -->
|
|
|
+ and date_format(create_time,'%y%m%d') >= date_format(#{params.beginTime},'%y%m%d')
|
|
|
+ </if>
|
|
|
+ <if test="params.endTime != null and params.endTime != ''"><!-- 结束时间检索 -->
|
|
|
+ and date_format(create_time,'%y%m%d') <= date_format(#{params.endTime},'%y%m%d')
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ </select>
|
|
|
+
|
|
|
+
|
|
|
+ <select id="selectGenTableRelationById" parameterType="GenTableRelation" resultMap="GenTableRelationResult">
|
|
|
+ <include refid="selectGenTableRelationVo"/>
|
|
|
+ where id = #{id}
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <insert id="insertGenTableRelation" parameterType="GenTableRelation">
|
|
|
+ insert into gen_table_relation (
|
|
|
+ <if test="description != null and description != '' ">description,</if>
|
|
|
+ <if test="relationParentId != null">relation_parent_id,</if>
|
|
|
+ <if test="relationChildId != null">relation_child_id,</if>
|
|
|
+ <if test="relationType != null">relation_type,</if>
|
|
|
+ <if test="createBy != null and createBy != ''">create_by,</if>
|
|
|
+ <if test="updateBy != null and updateBy != ''">update_by,</if>
|
|
|
+ <if test="updateTime != null and updateTime != ''">update_time,</if>
|
|
|
+ create_time
|
|
|
+ )values(
|
|
|
+ <if test="description != null and description != ''">#{description},</if>
|
|
|
+ <if test="relationParentId != null">#{relationParentId},</if>
|
|
|
+ <if test="relationChildId != null">#{relationChildId},</if>
|
|
|
+ <if test="relationType != null">#{relationType},</if>
|
|
|
+ <if test="createBy != null and createBy != ''">#{createBy},</if>
|
|
|
+ <if test="updateBy != null and updateBy != ''">#{updateBy},</if>
|
|
|
+ <if test="updateTime != null and updateTime != ''">#{updateTime},</if>
|
|
|
+ sysdate()
|
|
|
+ )
|
|
|
+ </insert>
|
|
|
+
|
|
|
+ <update id="updateGenTableRelation" parameterType="GenTableRelation">
|
|
|
+ update gen_table_relation
|
|
|
+ <set>
|
|
|
+ <if test="description != null and description != ''">description = #{description},</if>
|
|
|
+ <if test="relationParentId != null">relation_parent_id = #{relationParentId},</if>
|
|
|
+ <if test="relationChildId != null">relation_child_id = #{relationChildId},</if>
|
|
|
+ <if test="relationType != null">relation_type = #{relationType},</if>
|
|
|
+ <if test="createBy != null and createBy != ''">create_by = #{createBy},</if>
|
|
|
+ <if test="create_time != null">create_time = #{createTime},</if>
|
|
|
+ <if test="updateBy != null and updateBy != null">update_by = #{updateBy},</if>
|
|
|
+ update_time = sysdate()
|
|
|
+ </set>
|
|
|
+ where id = #{id}
|
|
|
+ </update>
|
|
|
+
|
|
|
+ <update id="deleteGenTableRelation" parameterType="GenTableRelation">
|
|
|
+ update gen_table_relation
|
|
|
+ set is_del = '1' where id in
|
|
|
+ <foreach item="ids" collection="array" open="(" separator="," close=")">
|
|
|
+ #{ids}
|
|
|
+ </foreach>
|
|
|
+ </update>
|
|
|
+</mapper>
|