baizonghao
2023-06-15 7351ad6176c2abd7076d1bbcb3d21ea2b35e3d2e
src/main/resources/mapper/DepartmentMapper.xml
@@ -7,19 +7,24 @@
        <result column="deleted" jdbcType="VARCHAR" property="deleted"/>
    </resultMap>
    <sql id="Base_Column_List">
        id
        , name,deleted
    </sql>
    <insert id="add" parameterType="com.mindskip.xzs.domain.Department" useGeneratedKeys="true" keyProperty="id">
        insert into t_department (name, deleted)
        values (#{name,jdbcType=VARCHAR}, #{deleted,jdbcType=VARCHAR})
    </insert>
    <update id="update" parameterType="com.mindskip.xzs.domain.Department">
        update t_user
        update t_department
        <set>
            <if test="name != null">
                name = #{name,jdbcType=VARCHAR},
            </if>
            <if test="deleted != null">
                name = #{deleted,jdbcType=VARCHAR},
                deleted = #{deleted,jdbcType=VARCHAR},
            </if>
        </set>
        where id = #{id,jdbcType=INTEGER}
@@ -30,4 +35,34 @@
        <include refid="Base_Column_List"/>
        from t_department where deleted=0
    </select>
    <select id="getById" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List"/>
        from t_department where deleted=0
        and id = #{id}
    </select>
    <select id="page" resultMap="BaseResultMap"
            parameterType="com.mindskip.xzs.viewmodel.admin.department.DepartmentResponseVM">
        SELECT
        <include refid="Base_Column_List"/>
        FROM t_department
        <where>
            and deleted=0
            <if test="id != null ">
                and id= #{id}
            </if>
            <if test="name != null ">
                and name like concat('%',#{name},'%')
            </if>
        </where>
    </select>
    <select id="getName" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List"/>
        from t_department where deleted=0 and name = #{name}
    </select>
</mapper>