<?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.landtool.lanbase.modules.res.dao.Res_SubscriptionsMapper" >
|
<resultMap id="BaseResultMap" type="com.landtool.lanbase.modules.res.entity.Res_Subscriptions" >
|
<result column="APPID" property="appid" jdbcType="DECIMAL" />
|
<result column="RESOURCEID" property="resourceid" jdbcType="DECIMAL" />
|
<result column="APPUSERID" property="appuserid" jdbcType="VARCHAR" />
|
<result column="APPUNITID" property="appunitid" jdbcType="VARCHAR" />
|
<result column="APPREASON" property="appreason" jdbcType="VARCHAR" />
|
<result column="APPDATE" property="appdate" jdbcType="TIMESTAMP" />
|
<result column="AUDITUSERID" property="audituserid" jdbcType="DECIMAL" />
|
<result column="AUDITTIME" property="audittime" jdbcType="TIMESTAMP" />
|
<result column="AUDITOPINION" property="auditopinion" jdbcType="VARCHAR" />
|
<result column="AUDITRESULT" property="auditresult" jdbcType="TINYINT" />
|
<result column="DATASOURCEID" property="datasourceid" jdbcType="DECIMAL" />
|
<result column="TABLEFIELDS" property="tablefields" jdbcType="VARCHAR" />
|
<result column="QUERYWHERE" property="querywhere" jdbcType="VARCHAR" />
|
<result column="SYNCTIMES" property="synctimes" jdbcType="DECIMAL" />
|
<result column="LASTUPDATE" property="lastupdate" jdbcType="TIMESTAMP" />
|
<result column="TIMESTAMPFIELD" property="timestampfield" jdbcType="TIMESTAMP" />
|
<result column="TABLENAME" property="tablename" jdbcType="VARCHAR" />
|
<result column="DATESYNC" property="datesync" jdbcType="DECIMAL" />
|
<result column="ISNEW" property="isnew" jdbcType="INTEGER" />
|
<result column="CLEARTABLE" property="cleartable" jdbcType="INTEGER" />
|
<result column="SYNCMESSAGE" property="syncmessage" jdbcType="VARCHAR" />
|
<result column="HANGUP" property="hangup" jdbcType="INTEGER" />
|
<result column="SYNCRESULT" property="syncresult" jdbcType="INTEGER" />
|
</resultMap>
|
|
<sql id="Base_Column_List">
|
APPID, RESOURCEID, APPUSERID, APPUNITID, APPREASON, APPDATE, AUDITUSERID,ISNEW,CLEARTABLE,SYNCMESSAGE,HANGUP,SYNCRESULT,
|
AUDITTIME, AUDITOPINION, AUDITRESULT, DATASOURCEID, TABLEFIELDS, QUERYWHERE, SYNCTIMES,
|
LASTUPDATE, TIMESTAMPFIELD, TABLENAME,DATESYNC
|
</sql>
|
|
<insert id="insert" parameterType="com.landtool.lanbase.modules.res.entity.Res_Subscriptions" >
|
insert into RES_SUBSCRIPTIONS (APPID, RESOURCEID, APPUSERID,
|
APPUNITID, APPREASON, APPDATE,
|
AUDITUSERID, AUDITTIME, AUDITOPINION,
|
AUDITRESULT, DATASOURCEID, TABLEFIELDS,
|
QUERYWHERE, SYNCTIMES, LASTUPDATE, TIMESTAMPFIELD, TABLENAME,DATESYNC,ISNEW,CLEARTABLE,SYNCMESSAGE,HANGUP,SYNCRESULT
|
)
|
values (#{appid,jdbcType=DECIMAL}, #{resourceid,jdbcType=DECIMAL}, #{appuserid,jdbcType=VARCHAR},
|
#{appunitid,jdbcType=VARCHAR}, #{appreason,jdbcType=VARCHAR}, #{appdate,jdbcType=TIMESTAMP},
|
#{audituserid,jdbcType=DECIMAL}, #{audittime,jdbcType=TIMESTAMP}, #{auditopinion,jdbcType=VARCHAR},
|
#{auditresult,jdbcType=TINYINT}, #{datasourceid,jdbcType=DECIMAL}, #{tablefields,jdbcType=VARCHAR},
|
#{querywhere,jdbcType=VARCHAR}, #{synctimes,jdbcType=DECIMAL}, #{lastupdate,jdbcType=TIMESTAMP},
|
#{timestampfield,jdbcType=TIMESTAMP}, #{tablename, jdbcType=VARCHAR},#{datesync,jdbcType=DECIMAL},
|
#{isnew,jdbcType=INTEGER},#{cleartable,jdbcType=INTEGER},#{syncmessage,jdbcType=VARCHAR},#{hangup,jdbcType=INTEGER},
|
#{syncresult,jdbcType=INTEGER}
|
)
|
</insert>
|
|
<insert id="insertSelective" parameterType="com.landtool.lanbase.modules.res.entity.Res_Subscriptions">
|
INSERT INTO RES_SUBSCRIPTIONS
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
<if test="appid != null and appid != ''">
|
APPID,
|
</if>
|
<if test="resourceid != null">
|
RESOURCEID,
|
</if>
|
<if test="appuserid != null">
|
APPUSERID,
|
</if>
|
<if test="appunitid != null">
|
APPUNITID,
|
</if>
|
<if test="appreason != null">
|
APPREASON,
|
</if>
|
<if test="appdate != null">
|
APPDATE,
|
</if>
|
<if test="audituserid != null">
|
AUDITUSERID,
|
</if>
|
<if test="audittime != null">
|
AUDITTIME,
|
</if>
|
<if test="auditopinion != null">
|
AUDITOPINION,
|
</if>
|
<if test="auditresult != null">
|
AUDITRESULT,
|
</if>
|
<if test="datasourceid != null">
|
DATASOURCEID,
|
</if>
|
<if test="tablefields != null">
|
TABLEFIELDS,
|
</if>
|
<if test="querywhere != null">
|
QUERYWHERE,
|
</if>
|
<if test="synctimes != null">
|
SYNCTIMES,
|
</if>
|
<if test="lastupdate != null">
|
LASTUPDATE,
|
</if>
|
<if test="timestampfield != null">
|
TIMESTAMPFIELD,
|
</if>
|
<if test="tablename != null">
|
TABLENAME,
|
</if>
|
<if test="datesync != null">
|
DATESYNC,
|
</if>
|
<if test="isnew != null">
|
ISNEW,
|
</if>
|
<if test="cleartable != null">
|
CLEARTABLE,
|
</if>
|
<if test="syncmessage != null">
|
SYNCMESSAGE,
|
</if>
|
<if test="hangup != null">
|
HANGUP,
|
</if>
|
<if test="syncresult != null">
|
SYNCRESULT,
|
</if>
|
</trim>
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
<if test="appid != null and appid != ''">
|
#{appid,jdbcType=DECIMAL},
|
</if>
|
<if test="resourceid != null">
|
#{resourceid,jdbcType=DECIMAL},
|
</if>
|
<if test="appuserid != null">
|
#{appuserid,jdbcType=OTHER},
|
</if>
|
<if test="appunitid != null">
|
#{appunitid,jdbcType=OTHER},
|
</if>
|
<if test="appreason != null">
|
#{appreason,jdbcType=OTHER},
|
</if>
|
<if test="appdate != null">
|
#{appdate,jdbcType=TIMESTAMP},
|
</if>
|
<if test="audituserid != null">
|
#{audituserid,jdbcType=DECIMAL},
|
</if>
|
<if test="audittime != null">
|
#{audittime,jdbcType=TIMESTAMP},
|
</if>
|
<if test="auditopinion != null">
|
#{auditopinion,jdbcType=OTHER},
|
</if>
|
<if test="auditresult != null">
|
#{auditresult,jdbcType=DECIMAL},
|
</if>
|
<if test="datasourceid != null">
|
#{datasourceid,jdbcType=DECIMAL},
|
</if>
|
<if test="tablefields != null">
|
#{tablefields,jdbcType=VARCHAR},
|
</if>
|
<if test="querywhere != null">
|
#{querywhere,jdbcType=VARCHAR},
|
</if>
|
<if test="synctimes != null">
|
#{synctimes,jdbcType=DECIMAL},
|
</if>
|
<if test="lastupdate != null">
|
#{lastupdate,jdbcType=TIMESTAMP},
|
</if>
|
<if test="timestampfield != null">
|
#{timestampfield,jdbcType=TIMESTAMP},
|
</if>
|
<if test="tablename != null">
|
#{tablename,jdbcType=VARCHAR},
|
</if>
|
<if test="datesync != null">
|
#{datesync,jdbcType=DECIMAL},
|
</if>
|
<if test="isnew != null">
|
#{isnew,jdbcType=INTEGER},
|
</if>
|
<if test="cleartable != null">
|
#{cleartable,jdbcType=INTEGER},
|
</if>
|
<if test="syncmessage != null">
|
#{syncmessage,jdbcType=VARCHAR},
|
</if>
|
<if test="hangup != null">
|
#{hangup,jdbcType=INTEGER},
|
</if>
|
<if test="syncresult != null">
|
#{syncresult,jdbcType=INTEGER},
|
</if>
|
</trim>
|
</insert>
|
|
<update id="updateByPrimaryKey" parameterType="com.landtool.lanbase.modules.res.entity.Res_SpacesParam" >
|
UPDATE RES_SUBSCRIPTIONS
|
SET RESOURCEID = #{resourceid,jdbcType=DECIMAL},
|
APPUSERID = #{appuserid,jdbcType=VARCHAR},
|
APPUNITID = #{appunitid,jdbcType=VARCHAR},
|
APPREASON = #{appreason,jdbcType=VARCHAR},
|
APPDATE = #{appdate,jdbcType=TIMESTAMP},
|
AUDITUSERID = #{audituserid,jdbcType=DECIMAL},
|
AUDITTIME = #{audittime,jdbcType=TIMESTAMP},
|
AUDITOPINION = #{auditopinion,jdbcType=VARCHAR},
|
AUDITRESULT = #{auditresult,jdbcType=TINYINT},
|
DATASOURCEID = #{datasourceid,jdbcType=DECIMAL},
|
TABLEFIELDS = #{tablefields,jdbcType=VARCHAR},
|
QUERYWHERE = #{querywhere,jdbcType=VARCHAR},
|
SYNCTIMES = #{synctimes,jdbcType=DECIMAL},
|
LASTUPDATE = #{lastupdate,jdbcType=TIMESTAMP},
|
TIMESTAMPFIELD = #{timestampfield,jdbcType=TIMESTAMP},
|
DATESYNC=#{datesync,jdbcType=VARCHAR},
|
TABLENAME = #{tablename,jdbcType=VARCHAR},
|
ISNEW=#{isnew,jdbcType=INTEGER},
|
CLEARTABLE=#{cleartable,jdbcType=INTEGER},
|
SYNCMESSAGE=#{syncmessage,jdbcType=VARCHAR},
|
HANGUP=#{hangup,jdbcType=INTEGER},
|
SYNCRESULT=#{syncresult,jdbcType=INTEGER}
|
WHERE APPID = #{appid,jdbcType=DECIMAL}
|
</update>
|
|
<update id="update" parameterType="com.landtool.lanbase.modules.res.entity.Res_SpacesParam" >
|
UPDATE RES_SUBSCRIPTIONS
|
<set>
|
<if test="resourceid != null">
|
RESOURCEID = #{resourceid,jdbcType=DECIMAL},
|
</if>
|
<if test="appuserid != null">
|
APPUSERID = #{appuserid,jdbcType=VARCHAR},
|
</if>
|
<if test="appunitid != null">
|
APPUNITID = #{appunitid,jdbcType=VARCHAR},
|
</if>
|
<if test="appreason != null">
|
APPREASON = #{appreason,jdbcType=VARCHAR},
|
</if>
|
<if test="appdate != null">
|
APPDATE = #{appdate,jdbcType=TIMESTAMP},
|
</if>
|
<if test="audituserid != null">
|
AUDITUSERID = #{audituserid,jdbcType=DECIMAL},
|
</if>
|
<if test="audittime != null">
|
AUDITTIME = #{audittime,jdbcType=TIMESTAMP},
|
</if>
|
<if test="auditopinion != null">
|
AUDITOPINION = #{auditopinion,jdbcType=VARCHAR},
|
</if>
|
<if test="auditresult != null">
|
AUDITRESULT = #{auditresult,jdbcType=TINYINT},
|
</if>
|
<if test="datasourceid != null">
|
DATASOURCEID = #{datasourceid,jdbcType=DECIMAL},
|
</if>
|
<if test="tablefields != null and tablefields != ''">
|
TABLEFIELDS = #{tablefields,jdbcType=VARCHAR},
|
</if>
|
<if test="querywhere != null">
|
QUERYWHERE = #{querywhere,jdbcType=VARCHAR},
|
</if>
|
<if test="synctimes != null">
|
SYNCTIMES = #{synctimes,jdbcType=DECIMAL},
|
</if>
|
<if test="lastupdate != null">
|
LASTUPDATE = #{lastupdate,jdbcType=TIMESTAMP},
|
</if>
|
<if test="timestampfield != null">
|
TIMESTAMPFIELD = #{timestampfield,jdbcType=TIMESTAMP},
|
</if>
|
<if test="datesync != null">
|
DATESYNC = #{datesync,jdbcType=VARCHAR},
|
</if>
|
<if test="tablename != null">
|
TABLENAME = #{tablename,jdbcType=VARCHAR},
|
</if>
|
<if test="isnew != null">
|
ISNEW = #{isnew,jdbcType=INTEGER},
|
</if>
|
<if test="cleartable != null">
|
CLEARTABLE = #{cleartable,jdbcType=INTEGER},
|
</if>
|
<if test="syncmessage != null">
|
SYNCMESSAGE = #{syncmessage,jdbcType=VARCHAR},
|
</if>
|
<if test="hangup != null">
|
HANGUP = #{hangup,jdbcType=INTEGER},
|
</if>
|
<if test="syncresult != null">
|
SYNCRESULT = #{syncresult,jdbcType=INTEGER}
|
</if>
|
</set>
|
WHERE APPID = #{appid,jdbcType=DECIMAL}
|
</update>
|
|
<select id="selectByResSubscriptions" resultMap="BaseResultMap" parameterType="com.landtool.lanbase.modules.res.entity.Res_Subscriptions">
|
SELECT
|
a.APPID, a.RESOURCEID, a.APPUSERID, a.APPUNITID, a.APPREASON, a.APPDATE, a.AUDITUSERID,a.ISNEW,a.CLEARTABLE,SYNCMESSAGE,HANGUP,SYNCRESULT,
|
a.AUDITTIME, a.AUDITOPINION, a.AUDITRESULT,a.DATESYNC
|
FROM RES_SUBSCRIPTIONS a
|
LEFT JOIN RES_APPLYRECOMMEND b
|
ON (a.resourceid=b.resourceid)
|
<where>
|
<if test="appuserid!=null and appuserid!=''">
|
AND a.appuserid=#{appuserid,jdbcType=DECIMAL}
|
</if>
|
<if test="resourceid!=null and resourceid!=''">
|
AND a.resourceid=#{resourceid,jdbcType=DECIMAL}
|
</if>
|
<if test="appid!=null and appid!=''">
|
AND a.appid=#{appid,jdbcType=DECIMAL}
|
</if>
|
</where>
|
</select>
|
|
<select id="selectByTablefields" resultMap="BaseResultMap" parameterType="com.landtool.lanbase.modules.res.entity.Res_Subscriptions">
|
SELECT *
|
FROM RES_MAININFO a
|
LEFT JOIN RES_APPLYRECOMMEND b
|
ON (a.resourceid=b.resourceid)
|
<where>
|
b.isRecommend=0
|
<if test="appuserid!=null and appuserid!=''">
|
AND a.appuserid=#{appuserid,jdbcType=DECIMAL}
|
</if>
|
<if test="resourceid!=null and resourceid!=''">
|
AND a.resourceid=#{resourceid,jdbcType=DECIMAL}
|
</if>
|
</where>
|
</select>
|
|
<select id="selectResSubscriptions" parameterType="com.landtool.lanbase.modules.res.entity.UserDefined.MainInfoJoinSubscriptions" resultType="com.landtool.lanbase.modules.res.entity.UserDefined.MainInfoJoinSubscriptions">
|
select
|
a.*,d.CREATEUSERID,d.TITLE,d.KEYWORDS,applycount,
|
case when replycount > 0 then replycount else 0 end as replycount
|
from RES_SUBSCRIPTIONS a
|
left join (select RESOURCEID,COUNT(*) as applycount from RES_SUBSCRIPTIONS group by RESOURCEID) b on
|
a.RESOURCEID = b.RESOURCEID
|
left join (select RESOURCEID,COUNT(*) as replycount from RES_SUBSCRIPTIONS where AUDITRESULT=1 group by RESOURCEID) c on
|
a.RESOURCEID = c.RESOURCEID
|
left join RES_MAININFO d on a.RESOURCEID = d.RESOURCEID
|
<where>
|
RESOURCESTATUS = 0
|
<if test="title!=null and title != '' ">
|
and (d.TITLE like ('%' || #{title} || '%') OR replace(KEYWORDS,',','') like ('%' || #{title} || '%'))
|
</if>
|
<if test="auditresult !=null">
|
and AUDITRESULT= #{auditresult}
|
</if>
|
<if test="ExistPermission !=null">
|
and CREATEUSERID=#{ExistPermission}
|
</if>
|
<if test="appdateBeg != null and appdateBeg != '' ">
|
<![CDATA[ and APPDATE >= to_timestamp(#{appdateBeg} || ' 00:00:00','yyyy-mm-dd hh24:mi:ss') ]]>
|
</if>
|
<if test="appdateEnd != null and appdateEnd != '' ">
|
<![CDATA[ and APPDATE <= to_timestamp(#{appdateEnd} || ' 23:59:59','yyyy-mm-dd hh24:mi:ss') ]]>
|
</if>
|
<if test="appuserid != null and appuserid != '' ">
|
and APPUSERID = #{appuserid}
|
</if>
|
</where>
|
order by a.APPDATE DESC
|
</select>
|
|
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer">
|
select
|
<include refid="Base_Column_List"/>
|
from RES_SUBSCRIPTIONS
|
where APPID = #{appid,jdbcType=DECIMAL}
|
</select>
|
|
<update id="updateResSubscriptionsResult"
|
parameterType="com.landtool.lanbase.modules.res.entity.Res_Subscriptions">
|
update RES_SUBSCRIPTIONS
|
set
|
AUDITUSERID = #{audituserid,jdbcType=DECIMAL},
|
AUDITTIME = #{audittime,jdbcType=TIMESTAMP},
|
AUDITOPINION = #{auditopinion,jdbcType=OTHER},
|
AUDITRESULT = #{auditresult,jdbcType=DECIMAL}
|
where APPID = #{appid,jdbcType=DECIMAL}
|
</update>
|
|
<select id="selectSubscriptionsByUser" resultMap="BaseResultMap" parameterType="com.landtool.lanbase.modules.res.entity.Res_Subscriptions">
|
select * from RES_SUBSCRIPTIONS
|
<where>
|
<if test="appuserid!=null and appuserid!=''">
|
and appuserid=#{appuserid,jdbcType=DECIMAL}
|
</if>
|
<if test="resourceid!=null and resourceid!=''">
|
and resourceid=#{resourceid,jdbcType=DECIMAL}
|
</if>
|
<if test="appid!=null and appid!=''">
|
and appid=#{appid,jdbcType=DECIMAL}
|
</if>
|
</where>
|
</select>
|
|
<select id="selectAll" resultMap="BaseResultMap">
|
select * from RES_SUBSCRIPTIONS order by appid desc
|
</select>
|
|
<select id="selectDataPush" resultMap="BaseResultMap" parameterType="java.lang.Integer">
|
select * from RES_SUBSCRIPTIONS where appuserid=#{userId}
|
</select>
|
|
<select id="selectByResourceIdList" resultMap="BaseResultMap">
|
select * from RES_SUBSCRIPTIONS where resourceid=#{resourceid,jdbcType=DECIMAL}
|
<if test="appuserid != null and appuserid != ''">
|
and appuserid = #{appuserid}
|
</if>
|
</select>
|
|
<select id="selectSubscriptions" resultMap="BaseResultMap" parameterType="com.landtool.lanbase.modules.res.entity.Res_Subscriptions">
|
select * from RES_SUBSCRIPTIONS
|
<where>
|
<if test="appuserid!=null and appuserid!=''">
|
and appuserid=#{appuserid,jdbcType=DECIMAL}
|
</if>
|
<if test="resourceid!=null and resourceid!=''">
|
and resourceid=#{resourceid,jdbcType=DECIMAL}
|
</if>
|
<if test="tablename!=null and tablename!=''">
|
and tablename=#{tablename,jdbcType=VARCHAR}
|
</if>
|
</where>
|
</select>
|
|
<select id="findList" resultMap="BaseResultMap" parameterType="com.landtool.lanbase.modules.res.entity.Res_Subscriptions">
|
select s.*,m.title from RES_SUBSCRIPTIONS s LEFT JOIN RES_MAININFO m ON s.RESOURCEID=m.RESOURCEID
|
<where>
|
<if test="title!=null and title!=''">
|
and (TITLE like '%'||#{title}||'%')
|
</if>
|
<if test="appdateBeg!=null and appdateBeg != '' ">
|
and lastupdate >= to_timestamp(#{appdateBeg} || ' 00:00:00','yyyy-mm-dd hh24:mi:ss')
|
</if>
|
<if test="appdateEnd!=null and appdateEnd != '' ">
|
<![CDATA[ and lastupdate <= to_timestamp(#{appdateEnd} || ' 23:59:59','yyyy-mm-dd hh24:mi:ss') ]]>
|
</if>
|
</where>
|
|
order by s.RESOURCEID DESC
|
|
</select>
|
</mapper>
|