|
|
@@ -1,37 +1,49 @@
|
|
|
<?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">
|
|
|
+ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
+ "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
|
|
<mapper namespace="com.doc.biz.mapper.DocShareMapper">
|
|
|
-
|
|
|
+
|
|
|
<resultMap type="DocShare" id="DocShareResult">
|
|
|
- <result property="shareId" column="SHARE_ID" />
|
|
|
- <result property="docId" column="DOC_ID" />
|
|
|
- <result property="userId" column="USER_ID" />
|
|
|
- <result property="userName" column="USER_NAME" />
|
|
|
- <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="remark" column="REMARK" />
|
|
|
+ <result property="shareId" column="SHARE_ID"/>
|
|
|
+ <result property="docId" column="DOC_ID"/>
|
|
|
+ <result property="userId" column="USER_ID"/>
|
|
|
+ <result property="userName" column="USER_NAME"/>
|
|
|
+ <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="remark" column="REMARK"/>
|
|
|
</resultMap>
|
|
|
|
|
|
<sql id="selectDocShareVo">
|
|
|
- select SHARE_ID, DOC_ID, USER_ID, USER_NAME, CREATE_BY, CREATE_TIME, UPDATE_BY, UPDATE_TIME, REMARK from doc_share
|
|
|
+ select *
|
|
|
+ from (select a.SHARE_ID,
|
|
|
+ a.DOC_ID,
|
|
|
+ a.USER_ID,
|
|
|
+ a.CREATE_BY,
|
|
|
+ b.NICK_NAME USER_NAME,
|
|
|
+ a.CREATE_TIME,
|
|
|
+ a.UPDATE_BY,
|
|
|
+ a.UPDATE_TIME,
|
|
|
+ a.REMARK
|
|
|
+ from doc_share a,
|
|
|
+ sys_user b
|
|
|
+ where a.user_id = b.user_id) t
|
|
|
</sql>
|
|
|
|
|
|
<select id="selectDocShareList" parameterType="DocShare" resultMap="DocShareResult">
|
|
|
<include refid="selectDocShareVo"/>
|
|
|
- <where>
|
|
|
- <if test="userName != null and userName != ''"> and USER_NAME like concat('%', #{userName}, '%')</if>
|
|
|
+ <where>
|
|
|
+ <if test="userName != null and userName != ''">and USER_NAME like concat('%', #{userName}, '%')</if>
|
|
|
</where>
|
|
|
</select>
|
|
|
-
|
|
|
+
|
|
|
<select id="selectDocShareByShareId" parameterType="Long" resultMap="DocShareResult">
|
|
|
<include refid="selectDocShareVo"/>
|
|
|
where SHARE_ID = #{shareId}
|
|
|
</select>
|
|
|
-
|
|
|
+
|
|
|
<insert id="insertDocShare" parameterType="DocShare" useGeneratedKeys="true" keyProperty="shareId">
|
|
|
insert into doc_share
|
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
|
@@ -43,7 +55,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
<if test="updateBy != null">UPDATE_BY,</if>
|
|
|
<if test="updateTime != null">UPDATE_TIME,</if>
|
|
|
<if test="remark != null">REMARK,</if>
|
|
|
- </trim>
|
|
|
+ </trim>
|
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
|
<if test="docId != null">#{docId},</if>
|
|
|
<if test="userId != null">#{userId},</if>
|
|
|
@@ -53,7 +65,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
<if test="updateBy != null">#{updateBy},</if>
|
|
|
<if test="updateTime != null">#{updateTime},</if>
|
|
|
<if test="remark != null">#{remark},</if>
|
|
|
- </trim>
|
|
|
+ </trim>
|
|
|
</insert>
|
|
|
|
|
|
<update id="updateDocShare" parameterType="DocShare">
|
|
|
@@ -72,11 +84,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
</update>
|
|
|
|
|
|
<delete id="deleteDocShareByShareId" parameterType="Long">
|
|
|
- delete from doc_share where SHARE_ID = #{shareId}
|
|
|
+ delete
|
|
|
+ from doc_share
|
|
|
+ where SHARE_ID = #{shareId}
|
|
|
</delete>
|
|
|
|
|
|
<delete id="deleteDocShareByShareIds" parameterType="String">
|
|
|
- delete from doc_share where SHARE_ID in
|
|
|
+ delete from doc_share where SHARE_ID in
|
|
|
<foreach item="shareId" collection="array" open="(" separator="," close=")">
|
|
|
#{shareId}
|
|
|
</foreach>
|