<?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_EvaluationMapper" >
|
<resultMap id="BaseResultMap" type="com.landtool.lanbase.modules.res.entity.Res_Evaluation" >
|
<id column="EVALID" property="evalid" jdbcType="INTEGER" />
|
<result column="RESOURCEID" property="resourceid" jdbcType="INTEGER" />
|
<result column="STARRATING" property="starrating" jdbcType="TINYINT" />
|
<result column="EVALUSERID" property="evaluserid" jdbcType="INTEGER" />
|
<result column="EVALTIME" property="evaltime" jdbcType="TIMESTAMP" />
|
<result column="CONTENT" property="content" jdbcType="VARCHAR" />
|
<result column="AUDITRESULT" property="auditresult" jdbcType="TINYINT" />
|
</resultMap>
|
<sql id="Base_Column_List" >
|
EVALID, RESOURCEID, STARRATING, EVALUSERID, EVALTIME, CONTENT, AUDITRESULT
|
</sql>
|
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
|
select
|
<include refid="Base_Column_List" />
|
from RES_EVALUATION
|
where EVALID = #{evalid,jdbcType=INTEGER}
|
</select>
|
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" >
|
delete from RES_EVALUATION
|
where EVALID = #{evalid,jdbcType=INTEGER}
|
</delete>
|
<insert id="insert" parameterType="com.landtool.lanbase.modules.res.entity.Res_Evaluation" >
|
insert into RES_EVALUATION (EVALID, RESOURCEID, STARRATING,
|
EVALUSERID, EVALTIME, CONTENT,
|
AUDITRESULT)
|
values (#{evalid,jdbcType=INTEGER}, #{resourceid,jdbcType=INTEGER}, #{starrating,jdbcType=TINYINT},
|
#{evaluserid,jdbcType=INTEGER}, #{evaltime,jdbcType=TIMESTAMP}, #{content,jdbcType=VARCHAR},
|
#{auditresult,jdbcType=TINYINT})
|
</insert>
|
<insert id="insertSelective" parameterType="com.landtool.lanbase.modules.res.entity.Res_Evaluation" >
|
insert into RES_EVALUATION
|
<trim prefix="(" suffix=")" suffixOverrides="," >
|
<if test="resourceid != null" >
|
RESOURCEID,
|
</if>
|
<if test="starrating != null" >
|
STARRATING,
|
</if>
|
<if test="evaluserid != null" >
|
EVALUSERID,
|
</if>
|
<if test="evaltime != null" >
|
EVALTIME,
|
</if>
|
<if test="content != null" >
|
CONTENT,
|
</if>
|
<if test="auditresult != null" >
|
AUDITRESULT,
|
</if>
|
</trim>
|
<trim prefix="values (" suffix=")" suffixOverrides="," >
|
<if test="resourceid != null" >
|
#{resourceid,jdbcType=INTEGER},
|
</if>
|
<if test="starrating != null" >
|
#{starrating,jdbcType=TINYINT},
|
</if>
|
<if test="evaluserid != null" >
|
#{evaluserid,jdbcType=INTEGER},
|
</if>
|
<if test="evaltime != null" >
|
#{evaltime,jdbcType=TIMESTAMP},
|
</if>
|
<if test="content != null" >
|
#{content,jdbcType=VARCHAR},
|
</if>
|
<if test="auditresult != null" >
|
#{auditresult,jdbcType=TINYINT},
|
</if>
|
</trim>
|
</insert>
|
<update id="updateByPrimaryKeySelective" parameterType="com.landtool.lanbase.modules.res.entity.Res_Evaluation" >
|
update RES_EVALUATION
|
<set >
|
<if test="resourceid != null" >
|
RESOURCEID = #{resourceid,jdbcType=INTEGER},
|
</if>
|
<if test="starrating != null" >
|
STARRATING = #{starrating,jdbcType=TINYINT},
|
</if>
|
<if test="evaluserid != null" >
|
EVALUSERID = #{evaluserid,jdbcType=INTEGER},
|
</if>
|
<if test="evaltime != null" >
|
EVALTIME = #{evaltime,jdbcType=TIMESTAMP},
|
</if>
|
<if test="content != null" >
|
CONTENT = #{content,jdbcType=VARCHAR},
|
</if>
|
<if test="auditresult != null" >
|
AUDITRESULT = #{auditresult,jdbcType=TINYINT},
|
</if>
|
</set>
|
where EVALID = #{evalid,jdbcType=INTEGER}
|
</update>
|
<update id="updateByPrimaryKey" parameterType="com.landtool.lanbase.modules.res.entity.Res_Evaluation" >
|
update RES_EVALUATION
|
set RESOURCEID = #{resourceid,jdbcType=INTEGER},
|
STARRATING = #{starrating,jdbcType=TINYINT},
|
EVALUSERID = #{evaluserid,jdbcType=INTEGER},
|
EVALTIME = #{evaltime,jdbcType=TIMESTAMP},
|
CONTENT = #{content,jdbcType=VARCHAR},
|
AUDITRESULT = #{auditresult,jdbcType=TINYINT}
|
where EVALID = #{evalid,jdbcType=INTEGER}
|
</update>
|
|
<update id="updateResEvaluationResult" parameterType="com.landtool.lanbase.modules.res.entity.Res_Evaluation" >
|
update RES_EVALUATION
|
set
|
AUDITUSERID = #{audituserid,jdbcType=DECIMAL},
|
AUDITRESULT = #{auditresult,jdbcType=DECIMAL}
|
where EVALID = #{evalid,jdbcType=INTEGER}
|
</update>
|
<select id="selectByResourceidAndUserid" resultMap="BaseResultMap" parameterType="com.landtool.lanbase.modules.res.entity.Res_Evaluation" >
|
select
|
<include refid="Base_Column_List" />
|
from RES_EVALUATION
|
where RESOURCEID = #{resourceid,jdbcType=INTEGER} and EVALUSERID = #{evaluserid,jdbcType=INTEGER}
|
</select>
|
|
<select id="selectByResourceidAndUseridNoShengHe" resultMap="BaseResultMap" parameterType="com.landtool.lanbase.modules.res.entity.Res_Evaluation" >
|
select
|
<include refid="Base_Column_List" />
|
from RES_EVALUATION
|
where RESOURCEID = #{resourceid,jdbcType=INTEGER} and EVALUSERID = #{evaluserid,jdbcType=INTEGER} and AUDITRESULT=0
|
</select>
|
|
<select id="selectResEvaluation" parameterType="com.landtool.lanbase.modules.res.entity.Res_Evaluation"
|
resultType="com.landtool.lanbase.modules.res.entity.UserDefined.MainInfoJoinEvaluation">
|
select a.*,b.title from RES_EVALUATION a left join RES_MAININFO b on a.RESOURCEID = b.RESOURCEID
|
<where>
|
RESOURCESTATUS = 0
|
<if test="title!=null and title != '' ">
|
and (b.TITLE like ('%' || #{title} || '%') OR replace(KEYWORDS,',','') like ('%' || #{title} || '%'))
|
</if>
|
<if test="auditresult != null">
|
and a.auditresult = #{auditresult}
|
</if>
|
<if test="starrating != null">
|
and a.starrating = #{starrating}
|
</if>
|
<if test="evaltimeBeg != null and evaltimeBeg != '' ">
|
<![CDATA[ and evaltime >= to_timestamp(#{evaltimeBeg} || ' 00:00:00','yyyy-mm-dd hh24:mi:ss') ]]>
|
</if>
|
<if test="evaltimeEnd != null and evaltimeEnd != '' ">
|
<![CDATA[ and evaltime <= to_timestamp(#{evaltimeEnd} || ' 23:59:59','yyyy-mm-dd hh24:mi:ss') ]]>
|
</if>
|
/** modified by qufangxu **/
|
<if test="existpermission !=null">
|
and b.CREATEUSERID=#{existpermission}
|
</if>
|
</where>
|
<if test="sort!=null and sort != '' ">
|
order by ${sort} ${dir}
|
</if>
|
<if test="sort==null">
|
order by evaltime desc
|
</if>
|
|
</select>
|
|
<select id="selectResEvaluationCount" parameterType="com.landtool.lanbase.modules.res.entity.Res_Evaluation"
|
resultType="java.lang.Integer">
|
select count(*) from RES_EVALUATION a left join RES_MAININFO b on a.RESOURCEID = b.RESOURCEID
|
<where>
|
RESOURCESTATUS = 0
|
<if test="title!=null and title != '' ">
|
and (b.TITLE like ('%' || #{title} || '%') OR replace(KEYWORDS,',','') like ('%' || #{title} || '%'))
|
</if>
|
<if test="auditresult != null">
|
and a.auditresult = #{auditresult}
|
</if>
|
<if test="starrating != null">
|
and a.starrating = #{starrating}
|
</if>
|
<if test="evaltimeBeg != null and evaltimeBeg != '' ">
|
<![CDATA[ and evaltime >= to_timestamp(#{evaltimeBeg} || ' 00:00:00','yyyy-mm-dd hh24:mi:ss') ]]>
|
</if>
|
<if test="evaltimeEnd != null and evaltimeEnd != '' ">
|
<![CDATA[ and evaltime <= to_timestamp(#{evaltimeEnd} || ' 23:59:59','yyyy-mm-dd hh24:mi:ss') ]]>
|
</if>
|
</where>
|
</select>
|
|
<select id="selectOtherByResourceid" resultMap="BaseResultMap" parameterType="com.landtool.lanbase.modules.res.entity.Res_Evaluation" >
|
select
|
<include refid="Base_Column_List" />
|
from RES_EVALUATION
|
where RESOURCEID = #{resourceid,jdbcType=INTEGER} and (AUDITRESULT =1 or EVALUSERID = #{evaluserid})
|
</select>
|
|
<select id="selectCountByResourceid" resultType="java.lang.Integer" parameterType="java.lang.Integer">
|
select count(*) from RES_EVALUATION
|
where resourceid = #{resourceid,jdbcType=DECIMAL}
|
</select>
|
<delete id="deleteByResourceid" parameterType="java.lang.Integer">
|
delete from RES_EVALUATION
|
where resourceid = #{resourceid,jdbcType=DECIMAL}
|
</delete>
|
</mapper>
|