shiqian 3 năm trước cách đây
mục cha
commit
b62e2dd5ac
1 tập tin đã thay đổi với 115 bổ sung0 xóa
  1. 115 0
      boman-report/src/main/resources/mapper/BomanReportMapper.xml

+ 115 - 0
boman-report/src/main/resources/mapper/BomanReportMapper.xml

@@ -0,0 +1,115 @@
+<?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.system.mapper.BomanGroupMapper">
+
+    <resultMap type="com.boman.domain.BomanGroup" id="BomanGroupResult">
+        <id property="id" column="id"/>
+        <result property="groupName" column="group_name"/>
+        <result property="status" column="status"/>
+        <result property="number" column="number"/>
+        <result property="createBy" column="create_by"/>
+        <result property="createTime" column="create_time"/>
+        <result property="updateBy" column="update_by"/>
+        <result property="updateTime" column="update_time"/>
+        <result property="isDel" column="is_del"/>
+        <collection  property="bomanGroupUserList"   javaType="java.util.List" resultMap="BomanGroupUserResult" />
+    </resultMap>
+
+    <resultMap type="com.boman.domain.BomanGroupUser" id="BomanGroupUserResult">
+        <id property="id" column="g_u_id"/>
+        <result property="userId" column="user_id"/>
+        <result property="userName" column="user_name"/>
+        <result property="groupId" column="group_id"/>
+        <result property="status" column="status"/>
+        <result property="createBy" column="create_by"/>
+        <result property="createTime" column="create_time"/>
+        <result property="updateBy" column="update_by"/>
+        <result property="updateTime" column="update_time"/>
+        <result property="isDel" column="is_del"/>
+    </resultMap>
+
+
+    <sql id="selectGroupVo">
+        select g.id, g.group_name, g.status, g.number, g.create_by, g.create_time, g.is_del
+        from boman_group g
+    </sql>
+
+    <select id="selectGroupList" parameterType="com.boman.domain.BomanGroup" resultMap="BomanGroupResult">
+        select g.id, g.group_name, g.status, g.number,  g.create_by, g.create_time, g.is_del, gu.user_name , gu.id as g_u_id
+        from boman_group g
+        left join boman_group_user gu on gu.group_id = g.id and gu.is_del = 'N'
+        where
+        g.is_del = 'N'
+        <if test="groupName != null and groupName != ''">
+            AND g.group_name like concat('%', #{groupName}, '%')
+        </if>
+        <!-- 数据范围过滤 -->
+        ${params.dataScope}
+        order by g.number
+    </select>
+
+    <select id="selectGroupById" parameterType="Long" resultMap="BomanGroupResult">
+        select g.id, g.group_name, g.status, g.number,  g.create_by, g.create_time, g.is_del, gu.user_name , gu.id
+        from boman_group g
+        left join boman_group_user gu on gu.group_id = g.id and gu.is_del = 'N'
+        where g.is_del = 'N'
+        and g.id = #{id}
+    </select>
+
+    <select id="checkGroupNameUnique" resultMap="BomanGroupResult">
+        <include refid="selectGroupVo"/>
+        where g.group_name=#{groupName} and g.is_del = 'N' limit 1
+    </select>
+
+    <insert id="insertGroup" parameterType="com.boman.domain.BomanGroup">
+        insert into boman_group(
+        <if test="id != null and id != 0">id,</if>
+        <if test="groupName != null and groupName != ''">group_name,</if>
+        <if test="number != null and number != ''">number,</if>
+        <if test="status != null">status,</if>
+        <if test="createBy != null and createBy != ''">create_by,</if>
+        <if test="isDel != null and isDel != ''">is_del,</if>
+        create_time
+        )values(
+        <if test="id != null and id != 0">#{id},</if>
+        <if test="groupName != null and groupName != ''">#{groupName},</if>
+        <if test="number != null and number != ''">#{number},</if>
+        <if test="status != null">#{status},</if>
+        <if test="createBy != null and createBy != ''">#{createBy},</if>
+        <if test="isDel != null and isDel != ''">#{isDel},</if>
+        sysdate()
+        )
+    </insert>
+
+    <update id="updateGroup" parameterType="com.boman.domain.BomanGroup">
+        update boman_group
+        <set>
+            <if test="groupName != null and groupName != ''">group_name = #{groupName},</if>
+            <if test="number != null and number != ''">number = #{number},</if>
+            <if test="status != null and status != ''">status = #{status},</if>
+            <if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
+            <if test="isDel != null and isDel != ''">is_del = #{isDel},</if>
+            update_time = sysdate()
+        </set>
+        where id = #{id}
+    </update>
+
+
+    <select id="checkGroupExistUser" parameterType="Long" resultType="int">
+        select count(1) from boman_group_user where group_id in
+        <foreach collection="array" item="id" open="(" separator="," close=")">
+            #{id}
+        </foreach>
+        and is_del = 'N'
+    </select>
+
+
+	<update id="deleteGroupById" parameterType="Long">
+		update  boman_group set is_del = 'Y' where id in
+		<foreach collection="array" item="id" open="(" separator="," close=")">
+			#{id}
+		</foreach>
+	</update>
+</mapper>