jhprjv2/yanzhu-jh/src/main/resources/mapper/project/BaseBuildNodeMapper.xml

103 lines
4.9 KiB
XML

<?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.yanzhu.jh.project.mapper.BaseBuildNodeMapper">
<resultMap type="BaseBuildNode" id="BaseBuildNodeResult">
<result property="id" column="id" />
<result property="buildType" column="build_type" />
<result property="nodeText" column="node_text" />
<result property="nodeLvl" column="node_lvl" />
<result property="nodeType" column="node_type" />
<result property="remark" column="remark" />
<result property="isDel" column="is_del" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
</resultMap>
<sql id="selectBaseBuildNodeVo">
select id, build_type, node_text, node_lvl, remark, is_del, create_by, create_time, update_by, update_time from base_build_node
</sql>
<select id="selectBaseBuildNodeList" parameterType="BaseBuildNode" resultMap="BaseBuildNodeResult">
<include refid="selectBaseBuildNodeVo"/>
<where>
<if test="buildType != null "> and build_type = #{buildType}</if>
<if test="nodeText != null and nodeText != ''"> and node_text = #{nodeText}</if>
<if test="nodeLvl != null and nodeLvl != ''"> and node_lvl = #{nodeLvl}</if>
<if test="nodeType != null "> and node_lvl = #{nodeType}</if>
<if test="isDel != null "> and is_del = #{isDel}</if>
</where>
ORDER BY node_lvl,id
</select>
<select id="selectBaseBuildNodeById" parameterType="Long" resultMap="BaseBuildNodeResult">
<include refid="selectBaseBuildNodeVo"/>
where id = #{id}
</select>
<insert id="insertBaseBuildNode" parameterType="BaseBuildNode" useGeneratedKeys="true" keyProperty="id">
insert into base_build_node
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="buildType != null">build_type,</if>
<if test="nodeText != null">node_text,</if>
<if test="nodeLvl != null">node_lvl,</if>
<if test="nodeType != null">node_type,</if>
<if test="remark != null">remark,</if>
<if test="isDel != null">is_del,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="buildType != null">#{buildType},</if>
<if test="nodeText != null">#{nodeText},</if>
<if test="nodeLvl != null">#{nodeLvl},</if>
<if test="nodeType != null">#{nodeType},</if>
<if test="remark != null">#{remark},</if>
<if test="isDel != null">#{isDel},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
</trim>
</insert>
<update id="updateBaseBuildNode" parameterType="BaseBuildNode">
update base_build_node
<trim prefix="SET" suffixOverrides=",">
<if test="buildType != null">build_type = #{buildType},</if>
<if test="nodeText != null">node_text = #{nodeText},</if>
<if test="nodeLvl != null">node_lvl = #{nodeLvl},</if>
<if test="nodeType != null">node_type = #{nodeType},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="isDel != null">is_del = #{isDel},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteBaseBuildNodeById" parameterType="Long">
delete from base_build_node where id = #{id}
</delete>
<delete id="deleteBaseBuildNodeByIds" parameterType="String">
delete from base_build_node where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<select id="selectByProject" parameterType="Long" resultMap="BaseBuildNodeResult">
<include refid="selectBaseBuildNodeVo"/>
WHERE build_Type IN ( SELECT projectNature FROM sur_project WHERE id=#{projectId} )
</select>
</mapper>