FactorProjectMapper.xml 3.94 KB
  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
<?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.lyms.platform.permission.dao.master.FactorProjectMapper">

<resultMap id="FactorProjectMap" type="com.lyms.platform.permission.model.FactorProject">
<id column="id" property="id" jdbcType="INTEGER"/>
<result column="risk_factor_ids" property="riskFactorIds" jdbcType="VARCHAR"/>
<result column="risk_factor_name" property="riskFactorName" jdbcType="VARCHAR"/>
<result column="week_project_id" property="weekProjectId" jdbcType="VARCHAR"/>
<result column="hospital_id" property="hospitalId" jdbcType="INTEGER"/>
<result column="week" property="week" jdbcType="VARCHAR"/>
<result column="created" property="created" jdbcType="TIMESTAMP"/>
</resultMap>
<sql id="orderAndLimit">
<if test="sort != null and sort != '' ">
order by ${sort}
<if test="need != null">
limit #{offset, jdbcType=INTEGER} , #{limit, jdbcType=INTEGER}
</if>
</if>
</sql>
<select id="getList" resultMap="FactorProjectMap" parameterType="com.lyms.platform.permission.model.FactorProjectQuery">
SELECT id,
risk_factor_name,week_project_id,risk_factor_ids,
week,hospital_id,created
FROM lyms_factor_project
where
hospital_id = #{hospitalId,jdbcType=INTEGER}
<if test="week !=null and week !='' ">
and week=#{week,jdbcType=VARCHAR}
</if>
<if test="riskFactorIds!=null and riskFactorIds.size() > 0">
and risk_factor_ids in
<foreach collection="riskFactorIds" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
<include refid="orderAndLimit"/>
</select>

<select id="add" parameterType="com.lyms.platform.permission.model.FactorProject">
INSERT INTO lyms_factor_project(risk_factor_ids,risk_factor_name,week_project_id,week,hospital_id,created)
VALUES (#{riskFactorIds},#{riskFactorName},#{weekProjectId},#{week},#{hospitalId},#{created})
</select>


<update id="update" parameterType="com.lyms.platform.permission.model.FactorProject" >
update lyms_factor_project
<set>
<if test="riskFactorIds != null and riskFactorIds != ''">
risk_factor_ids = #{riskFactorIds,jdbcType=VARCHAR},
</if>
<if test="riskFactorName != null and riskFactorName != ''">
risk_factor_name = #{riskFactorName,jdbcType=VARCHAR},
</if>
<if test="weekProjectId != null and weekProjectId != ''">
week_project_id = #{weekProjectId,jdbcType=VARCHAR},
</if>
<if test="hospitalId != null">
hospital_id = #{hospitalId,jdbcType=INTEGER},
</if>
<if test="week != null and week != ''">
week = #{week,jdbcType=VARCHAR},
</if>
</set>
where id = #{id,jdbcType=INTEGER}
</update>

<delete id="del" parameterType="java.lang.Integer">
delete from lyms_factor_project where id = #{id,jdbcType=INTEGER}
</delete>
<select id="queryFactorProjectCount" resultType="int"
parameterType="com.lyms.platform.permission.model.FactorProjectQuery">
SELECT count(id) from lyms_factor_project where
<if test="hospitalId!=null">
hospital_id = #{hospitalId,jdbcType=INTEGER}
</if>
<if test="week !=null and week!='' ">
and week=#{week,jdbcType=VARCHAR}
</if>
</select>
<select id="selectById" resultMap="FactorProjectMap" parameterType="java.lang.Integer">
SELECT id,risk_factor_ids,
risk_factor_name,week_project_id,
week,hospital_id,created
FROM lyms_factor_project
where
id = #{id,jdbcType=INTEGER}
</select>

</mapper>