254 lines
9.6 KiB
XML
254 lines
9.6 KiB
XML
<?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.rzyc.mapper.RkCompanyDiagnosisMapper">
|
|
<resultMap id="BaseResultMap" type="com.rzyc.model.RkCompanyDiagnosis">
|
|
<id column="diagnosis_id" jdbcType="VARCHAR" property="diagnosisId" />
|
|
<result column="enterprise_id" jdbcType="VARCHAR" property="enterpriseId" />
|
|
<result column="score" jdbcType="INTEGER" property="score" />
|
|
<result column="grade" jdbcType="INTEGER" property="grade" />
|
|
<result column="assess_time" jdbcType="TIMESTAMP" property="assessTime" />
|
|
<result column="status" jdbcType="VARCHAR" property="status" />
|
|
<result column="created" jdbcType="VARCHAR" property="created" />
|
|
<result column="modified" jdbcType="VARCHAR" property="modified" />
|
|
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
|
|
<result column="modify_time" jdbcType="TIMESTAMP" property="modifyTime" />
|
|
<result column="category" jdbcType="VARCHAR" property="category"/>
|
|
<result column="gradeName" jdbcType="VARCHAR" property="gradeName"/>
|
|
</resultMap>
|
|
<sql id="Example_Where_Clause">
|
|
<where>
|
|
<foreach collection="oredCriteria" item="criteria" separator="or">
|
|
<if test="criteria.valid">
|
|
<trim prefix="(" prefixOverrides="and" suffix=")">
|
|
<foreach collection="criteria.criteria" item="criterion">
|
|
<choose>
|
|
<when test="criterion.noValue">
|
|
and ${criterion.condition}
|
|
</when>
|
|
<when test="criterion.singleValue">
|
|
and ${criterion.condition} #{criterion.value}
|
|
</when>
|
|
<when test="criterion.betweenValue">
|
|
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
|
|
</when>
|
|
<when test="criterion.listValue">
|
|
and ${criterion.condition}
|
|
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
|
|
#{listItem}
|
|
</foreach>
|
|
</when>
|
|
</choose>
|
|
</foreach>
|
|
</trim>
|
|
</if>
|
|
</foreach>
|
|
</where>
|
|
</sql>
|
|
<sql id="Update_By_Example_Where_Clause">
|
|
<where>
|
|
<foreach collection="example.oredCriteria" item="criteria" separator="or">
|
|
<if test="criteria.valid">
|
|
<trim prefix="(" prefixOverrides="and" suffix=")">
|
|
<foreach collection="criteria.criteria" item="criterion">
|
|
<choose>
|
|
<when test="criterion.noValue">
|
|
and ${criterion.condition}
|
|
</when>
|
|
<when test="criterion.singleValue">
|
|
and ${criterion.condition} #{criterion.value}
|
|
</when>
|
|
<when test="criterion.betweenValue">
|
|
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
|
|
</when>
|
|
<when test="criterion.listValue">
|
|
and ${criterion.condition}
|
|
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
|
|
#{listItem}
|
|
</foreach>
|
|
</when>
|
|
</choose>
|
|
</foreach>
|
|
</trim>
|
|
</if>
|
|
</foreach>
|
|
</where>
|
|
</sql>
|
|
<sql id="Base_Column_List">
|
|
diagnosis_id, enterprise_id, score, grade, assess_time, status, created, modified,
|
|
create_time, modify_time
|
|
</sql>
|
|
|
|
<select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
|
|
select
|
|
<include refid="Base_Column_List" />
|
|
from rk_company_diagnosis
|
|
where diagnosis_id = #{diagnosisId,jdbcType=VARCHAR}
|
|
</select>
|
|
<delete id="deleteByPrimaryKey" parameterType="java.lang.String">
|
|
delete from rk_company_diagnosis
|
|
where diagnosis_id = #{diagnosisId,jdbcType=VARCHAR}
|
|
</delete>
|
|
|
|
<insert id="insert" parameterType="com.rzyc.model.RkCompanyDiagnosis">
|
|
insert into rk_company_diagnosis (diagnosis_id, enterprise_id, score,
|
|
grade, assess_time, status,
|
|
created, modified, create_time,
|
|
modify_time,category)
|
|
values (#{diagnosisId,jdbcType=VARCHAR}, #{enterpriseId,jdbcType=VARCHAR}, #{score,jdbcType=INTEGER},
|
|
#{grade,jdbcType=INTEGER}, #{assessTime,jdbcType=TIMESTAMP}, #{status,jdbcType=VARCHAR},
|
|
#{created,jdbcType=VARCHAR}, #{modified,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP},
|
|
#{modifyTime,jdbcType=TIMESTAMP},#{category})
|
|
</insert>
|
|
<insert id="insertSelective" parameterType="com.rzyc.model.RkCompanyDiagnosis">
|
|
insert into rk_company_diagnosis
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
<if test="diagnosisId != null">
|
|
diagnosis_id,
|
|
</if>
|
|
<if test="enterpriseId != null">
|
|
enterprise_id,
|
|
</if>
|
|
<if test="score != null">
|
|
score,
|
|
</if>
|
|
<if test="grade != null">
|
|
grade,
|
|
</if>
|
|
<if test="assessTime != null">
|
|
assess_time,
|
|
</if>
|
|
<if test="status != null">
|
|
status,
|
|
</if>
|
|
<if test="created != null">
|
|
created,
|
|
</if>
|
|
<if test="modified != null">
|
|
modified,
|
|
</if>
|
|
<if test="createTime != null">
|
|
create_time,
|
|
</if>
|
|
<if test="modifyTime != null">
|
|
modify_time,
|
|
</if>
|
|
</trim>
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
<if test="diagnosisId != null">
|
|
#{diagnosisId,jdbcType=VARCHAR},
|
|
</if>
|
|
<if test="enterpriseId != null">
|
|
#{enterpriseId,jdbcType=VARCHAR},
|
|
</if>
|
|
<if test="score != null">
|
|
#{score,jdbcType=INTEGER},
|
|
</if>
|
|
<if test="grade != null">
|
|
#{grade,jdbcType=INTEGER},
|
|
</if>
|
|
<if test="assessTime != null">
|
|
#{assessTime,jdbcType=TIMESTAMP},
|
|
</if>
|
|
<if test="status != null">
|
|
#{status,jdbcType=VARCHAR},
|
|
</if>
|
|
<if test="created != null">
|
|
#{created,jdbcType=VARCHAR},
|
|
</if>
|
|
<if test="modified != null">
|
|
#{modified,jdbcType=VARCHAR},
|
|
</if>
|
|
<if test="createTime != null">
|
|
#{createTime,jdbcType=TIMESTAMP},
|
|
</if>
|
|
<if test="modifyTime != null">
|
|
#{modifyTime,jdbcType=TIMESTAMP},
|
|
</if>
|
|
</trim>
|
|
</insert>
|
|
|
|
|
|
|
|
<update id="updateByPrimaryKeySelective" parameterType="com.rzyc.model.RkCompanyDiagnosis">
|
|
update rk_company_diagnosis
|
|
<set>
|
|
<if test="enterpriseId != null">
|
|
enterprise_id = #{enterpriseId,jdbcType=VARCHAR},
|
|
</if>
|
|
<if test="score != null">
|
|
score = #{score,jdbcType=INTEGER},
|
|
</if>
|
|
<if test="grade != null">
|
|
grade = #{grade,jdbcType=INTEGER},
|
|
</if>
|
|
<if test="assessTime != null">
|
|
assess_time = #{assessTime,jdbcType=TIMESTAMP},
|
|
</if>
|
|
<if test="status != null">
|
|
status = #{status,jdbcType=VARCHAR},
|
|
</if>
|
|
<if test="created != null">
|
|
created = #{created,jdbcType=VARCHAR},
|
|
</if>
|
|
<if test="modified != null">
|
|
modified = #{modified,jdbcType=VARCHAR},
|
|
</if>
|
|
<if test="createTime != null">
|
|
create_time = #{createTime,jdbcType=TIMESTAMP},
|
|
</if>
|
|
<if test="modifyTime != null">
|
|
modify_time = #{modifyTime,jdbcType=TIMESTAMP},
|
|
</if>
|
|
<if test="category != null">
|
|
category = #{category}
|
|
</if>
|
|
</set>
|
|
where diagnosis_id = #{diagnosisId,jdbcType=VARCHAR}
|
|
</update>
|
|
<update id="updateByPrimaryKey" parameterType="com.rzyc.model.RkCompanyDiagnosis">
|
|
update rk_company_diagnosis
|
|
set enterprise_id = #{enterpriseId,jdbcType=VARCHAR},
|
|
score = #{score,jdbcType=INTEGER},
|
|
grade = #{grade,jdbcType=INTEGER},
|
|
assess_time = #{assessTime,jdbcType=TIMESTAMP},
|
|
status = #{status,jdbcType=VARCHAR},
|
|
created = #{created,jdbcType=VARCHAR},
|
|
modified = #{modified,jdbcType=VARCHAR},
|
|
create_time = #{createTime,jdbcType=TIMESTAMP},
|
|
modify_time = #{modifyTime,jdbcType=TIMESTAMP}
|
|
where diagnosis_id = #{diagnosisId,jdbcType=VARCHAR}
|
|
</update>
|
|
<!--根据企业id删除列表-->
|
|
<delete id="deletByEnterpriseId" parameterType="java.lang.String">
|
|
delete from rk_company_diagnosis
|
|
where enterprise_id = #{enterpriseId,jdbcType=VARCHAR}
|
|
</delete>
|
|
|
|
<!--根据企业id返回诊断列表-->
|
|
<select id="selectByEnterpriseId" parameterType="java.lang.String" resultMap="BaseResultMap" >
|
|
SELECT enterprise_id,score,grade,assess_time,`status` FROM rk_company_diagnosis WHERE enterprise_id = #{enterpriseId}
|
|
</select>
|
|
|
|
<select id="selectByDiagnosisId" parameterType="java.lang.String" resultMap="BaseResultMap">
|
|
SELECT enterprise_id,score,(case grade WHEN '1' THEN 'Ⅰ级' WHEN '2' THEN 'Ⅱ级' WHEN '3' THEN 'Ⅲ级' WHEN '4' THEN 'Ⅳ级' else '未评级' END )gradeName,
|
|
assess_time,`status`,grade
|
|
FROM rk_company_diagnosis WHERE diagnosis_id = #{diagnosisId}
|
|
</select>
|
|
|
|
<!--条件查询-->
|
|
<select id="selectQueryCompanyDiagnosis" parameterType="com.rzyc.model.RkCompanyDiagnosis" resultMap="BaseResultMap">
|
|
SELECT diagnosis_id, enterprise_id,score,grade,assess_time,`status`,
|
|
(case grade WHEN '1' THEN 'Ⅰ级' WHEN '2' THEN 'Ⅱ级' WHEN '3' THEN 'Ⅲ级' WHEN '4' THEN 'Ⅳ级' else '未评级' END )gradeName
|
|
FROM rk_company_diagnosis WHERE enterprise_id = #{enterpriseId}
|
|
<if test="grade != null">
|
|
and grade = #{grade}
|
|
</if>
|
|
<if test="codition != null and codition != ''">
|
|
and (score like concat(concat("%",#{codition}),"%")
|
|
or status like concat(concat("%",#{codition}),"%")
|
|
)
|
|
|
|
</if>
|
|
</select>
|
|
</mapper>
|