<?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.HospitalServiceContentMapper">
<resultMap id="HospitalServiceContentResultMap" type="com.lyms.platform.permission.model.HospitalServiceContent">
<id column="id" property="id" jdbcType="VARCHAR"/>
<result column="hospital_id" property="hospitalId" jdbcType="VARCHAR"/>
<result column="ser_type" property="serType" jdbcType="INTEGER"/>
<result column="ser_types" property="serTypes" jdbcType="VARCHAR"/>
<result column="ser_price" property="serPrice" jdbcType="DECIMAL"/>
<result column="create_date" property="createDate" jdbcType="TIMESTAMP"/>
<result column="create_user" property="createUser" jdbcType="VARCHAR"/>
<result column="status" property="status" jdbcType="INTEGER"/>
<result column="sync_status" property="syncStatus" jdbcType="INTEGER"/>
<result column="weekPrice" property="weekPrice" jdbcType="DECIMAL"/>
<result column="devicePrice" property="devicePrice" jdbcType="DECIMAL"/>
<result column="deviceCon" property="deviceCon" jdbcType="INTEGER"/>
</resultMap>
<insert id="addHospitalServiceContent" parameterType="com.lyms.platform.permission.model.HospitalServiceContent">
insert into hospital_service_content (id,hospital_id,ser_type,ser_price,create_date,create_user,status,sync_status,weekPrice,deviceCon,devicePrice) values
(#{id},#{hospitalId},#{serType},#{serPrice},#{createDate},#{createUser},#{status},#{syncStatus},#{weekPrice},#{deviceCon},#{devicePrice})
</insert>
<update id="updateHospitalServiceContent" parameterType="com.lyms.platform.permission.model.HospitalServiceContent">
update hospital_service_content
<set>
<if test="hospitalId != null and hospitalId != ''">
hospital_id = #{hospitalId,jdbcType=VARCHAR},
</if>
<if test="serType != null and serType >= 0">
ser_type = #{serType,jdbcType=INTEGER},
</if>
<if test="serPrice != null">
ser_price = #{serPrice,jdbcType=DECIMAL},
</if>
<if test="weekPrice != null">
weekPrice = #{weekPrice,jdbcType=DECIMAL},
</if>
<if test="deviceCon != null and deviceCon >= 0">
deviceCon = #{deviceCon,jdbcType=INTEGER},
</if>
<if test="devicePrice != null">
devicePrice = #{devicePrice,jdbcType=DECIMAL},
</if>
<if test="createDate != null">
create_date = #{createDate,jdbcType=TIMESTAMP},
</if>
<if test="createUser != null and createUser != ''">
create_user = #{createUser,jdbcType=VARCHAR},
</if>
<if test="status != null and status >= 0">
status = #{status,jdbcType=INTEGER},
</if>
<if test="syncStatus != null and syncStatus >= 0">
sync_status = #{syncStatus,jdbcType=INTEGER},
</if>
</set>
where id = #{id,jdbcType=VARCHAR}
</update>
<delete id="deleteHospitalServiceContent" parameterType="java.lang.String">
delete from hospital_service_content where id = #{id,jdbcType=VARCHAR}
</delete>
<select id="getHospitalServiceContent" resultMap="HospitalServiceContentResultMap" parameterType="java.lang.String">
select id,hospital_id,ser_type,ser_price,create_date,create_user,status,sync_status,weekPrice
from hospital_service_content where id = #{id,jdbcType=VARCHAR}
</select>
<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>
<sql id="HospitalServiceContentCondition">
<where>
1 = 1
<if test="id != null and id != ''">
and id = #{id,jdbcType=VARCHAR}
</if>
<if test="hospitalId != null and hospitalId != ''">
and hospital_id = #{hospitalId,jdbcType=VARCHAR}
</if>
<if test="serType != null and serType >= 0">
and ser_type = #{serType,jdbcType=INTEGER}
</if>
<if test="serPrice != null">
and ser_price = #{serPrice,jdbcType=DECIMAL}
</if>
<if test="weekPrice != null">
and weekPrice = #{weekPrice,jdbcType=DECIMAL}
</if>
<if test="devicePrice != null">
and devicePrice = #{devicePrice,jdbcType=DECIMAL}
</if>
<if test="deviceCon != null and deviceCon >= 0">
and deviceCon = #{deviceCon,jdbcType=INTEGER}
</if>
<if test="createDate != null">
and create_date = #{createDate,jdbcType=TIMESTAMP}
</if>
<if test="createUser != null and createUser != ''">
and create_user = #{createUser,jdbcType=VARCHAR}
</if>
<if test="status != null and status >= 0">
and status = #{status,jdbcType=INTEGER}
</if>
<if test="syncStatus != null and syncStatus >= 0">
and sync_status = #{syncStatus,jdbcType=INTEGER}
</if>
</where>
</sql>
<select id="queryGroupHospitalServiceContent" resultMap="HospitalServiceContentResultMap"
parameterType="com.lyms.platform.permission.model.HospitalServiceContentQuery">
select hospital_id,group_concat(ser_type) as ser_types,create_date,create_user,sync_status,weekPrice,devicePrice,deviceCon from hospital_service_content
<include refid="HospitalServiceContentCondition"/>
group by hospital_id
<include refid="orderAndLimit"/>
</select>
<select id="queryGroupHospitalServiceContentCount" resultType="INTEGER"
parameterType="com.lyms.platform.permission.model.HospitalServiceContentQuery">
select count(1) from hospital_service_content
<include refid="HospitalServiceContentCondition"/>
group by hospital_id
</select>
<select id="queryHospitalServiceContent" resultMap="HospitalServiceContentResultMap"
parameterType="com.lyms.platform.permission.model.HospitalServiceContentQuery">
select id,hospital_id,ser_type,ser_price,create_date,create_user,status,sync_status,weekPrice,devicePrice,deviceCon
from hospital_service_content
<include refid="HospitalServiceContentCondition"/>
<include refid="orderAndLimit"/>
</select>
<select id="queryHospitalServiceContentCount" resultType="int"
parameterType="com.lyms.platform.permission.model.HospitalServiceContentQuery">
select count(1) from hospital_service_content
<include refid="HospitalServiceContentCondition"/>
</select>
</mapper>