StandardMapper.xml 7.57 KB
<?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.yoho.search.dal.StandardMapper">
	<resultMap id="BaseResultMap" type="com.yoho.search.dal.model.Standard">
		<id column="id" property="id" jdbcType="INTEGER" />
		<result column="standard_name" property="standardName"
			jdbcType="VARCHAR" />
		<result column="standard_sort_id" property="standardSortId"
			jdbcType="INTEGER" />
		<result column="sort_id" property="sortId" jdbcType="INTEGER" />
		<result column="order_by" property="orderBy" jdbcType="INTEGER" />
		<result column="unit" property="unit" jdbcType="VARCHAR" />
		<result column="box_view" property="boxView" jdbcType="CHAR" />
		<result column="search_view" property="searchView" jdbcType="CHAR" />
		<result column="parameter_make" property="parameterMake"
			jdbcType="CHAR" />
		<result column="search_make" property="searchMake" jdbcType="CHAR" />
		<result column="search_order_by" property="searchOrderBy"
			jdbcType="INTEGER" />
		<result column="status" property="status" jdbcType="INTEGER" />
	</resultMap>
	<sql id="Base_Column_List">
		id, standard_name, standard_sort_id, sort_id, order_by,
		unit, box_view,
		search_view,
		parameter_make, search_make,
		search_order_by, status
	</sql>
	<select id="selectByPrimaryKey" resultMap="BaseResultMap"
		parameterType="java.lang.Integer" timeout="20000">
		select
		<include refid="Base_Column_List" />
		from standard
		where id = #{id,jdbcType=INTEGER}
	</select>
	<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer"
		timeout="20000">
		delete from standard
		where id = #{id,jdbcType=INTEGER}
	</delete>
	<insert id="insert" parameterType="com.yoho.search.dal.model.Standard"
		timeout="20000">
		insert ignore into standard (id, standard_name, standard_sort_id,
		sort_id, order_by, unit,
		box_view, search_view, parameter_make,
		search_make, search_order_by, status
		)
		values (#{id,jdbcType=INTEGER},
		#{standardName,jdbcType=VARCHAR},
		#{standardSortId,jdbcType=INTEGER},
		#{sortId,jdbcType=INTEGER}, #{orderBy,jdbcType=INTEGER},
		#{unit,jdbcType=VARCHAR},
		#{boxView,jdbcType=CHAR},
		#{searchView,jdbcType=CHAR},
		#{parameterMake,jdbcType=CHAR},
		#{searchMake,jdbcType=CHAR}, #{searchOrderBy,jdbcType=INTEGER},
		#{status,jdbcType=INTEGER}
		)
	</insert>
	<insert id="insertSelective" parameterType="com.yoho.search.dal.model.Standard"
		timeout="20000">
		insert ignore into standard
		<trim prefix="(" suffix=")" suffixOverrides=",">
			<if test="id != null">
				id,
			</if>
			<if test="standardName != null">
				standard_name,
			</if>
			<if test="standardSortId != null">
				standard_sort_id,
			</if>
			<if test="sortId != null">
				sort_id,
			</if>
			<if test="orderBy != null">
				order_by,
			</if>
			<if test="unit != null">
				unit,
			</if>
			<if test="boxView != null">
				box_view,
			</if>
			<if test="searchView != null">
				search_view,
			</if>
			<if test="parameterMake != null">
				parameter_make,
			</if>
			<if test="searchMake != null">
				search_make,
			</if>
			<if test="searchOrderBy != null">
				search_order_by,
			</if>
			<if test="status != null">
				status,
			</if>
		</trim>
		<trim prefix="values (" suffix=")" suffixOverrides=",">
			<if test="id != null">
				#{id,jdbcType=INTEGER},
			</if>
			<if test="standardName != null">
				#{standardName,jdbcType=VARCHAR},
			</if>
			<if test="standardSortId != null">
				#{standardSortId,jdbcType=INTEGER},
			</if>
			<if test="sortId != null">
				#{sortId,jdbcType=INTEGER},
			</if>
			<if test="orderBy != null">
				#{orderBy,jdbcType=INTEGER},
			</if>
			<if test="unit != null">
				#{unit,jdbcType=VARCHAR},
			</if>
			<if test="boxView != null">
				#{boxView,jdbcType=CHAR},
			</if>
			<if test="searchView != null">
				#{searchView,jdbcType=CHAR},
			</if>
			<if test="parameterMake != null">
				#{parameterMake,jdbcType=CHAR},
			</if>
			<if test="searchMake != null">
				#{searchMake,jdbcType=CHAR},
			</if>
			<if test="searchOrderBy != null">
				#{searchOrderBy,jdbcType=INTEGER},
			</if>
			<if test="status != null">
				#{status,jdbcType=INTEGER},
			</if>
		</trim>
	</insert>
	<update id="updateByPrimaryKeySelective" parameterType="com.yoho.search.dal.model.Standard"
		timeout="20000">
		update standard
		<set>
			<if test="standardName != null">
				standard_name = #{standardName,jdbcType=VARCHAR},
			</if>
			<if test="standardSortId != null">
				standard_sort_id = #{standardSortId,jdbcType=INTEGER},
			</if>
			<if test="sortId != null">
				sort_id = #{sortId,jdbcType=INTEGER},
			</if>
			<if test="orderBy != null">
				order_by = #{orderBy,jdbcType=INTEGER},
			</if>
			<if test="unit != null">
				unit = #{unit,jdbcType=VARCHAR},
			</if>
			<if test="boxView != null">
				box_view = #{boxView,jdbcType=CHAR},
			</if>
			<if test="searchView != null">
				search_view = #{searchView,jdbcType=CHAR},
			</if>
			<if test="parameterMake != null">
				parameter_make = #{parameterMake,jdbcType=CHAR},
			</if>
			<if test="searchMake != null">
				search_make = #{searchMake,jdbcType=CHAR},
			</if>
			<if test="searchOrderBy != null">
				search_order_by = #{searchOrderBy,jdbcType=INTEGER},
			</if>
			<if test="status != null">
				status = #{status,jdbcType=INTEGER},
			</if>
		</set>
		where id = #{id,jdbcType=INTEGER}
	</update>
	<update id="updateByPrimaryKey" parameterType="com.yoho.search.dal.model.Standard"
		timeout="20000">
		update standard
		set standard_name =
		#{standardName,jdbcType=VARCHAR},
		standard_sort_id =
		#{standardSortId,jdbcType=INTEGER},
		sort_id =
		#{sortId,jdbcType=INTEGER},
		order_by = #{orderBy,jdbcType=INTEGER},
		unit = #{unit,jdbcType=VARCHAR},
		box_view = #{boxView,jdbcType=CHAR},
		search_view = #{searchView,jdbcType=CHAR},
		parameter_make =
		#{parameterMake,jdbcType=CHAR},
		search_make =
		#{searchMake,jdbcType=CHAR},
		search_order_by =
		#{searchOrderBy,jdbcType=INTEGER},
		status = #{status,jdbcType=INTEGER}
		where id = #{id,jdbcType=INTEGER}
	</update>
	<select id="selectCount" resultType="java.lang.Integer" timeout="20000">
		SELECT count(id) FROM standard
	</select>
	<select id="selectPageLists" resultMap="BaseResultMap" timeout="20000">
		select
		<include refid="Base_Column_List" />
		from standard limit #{offset},#{pageSize}
	</select>

	<resultMap id="standardMap" type="java.util.Map">
		<result column="parameter_id" property="parameterId" jdbcType="INTEGER" />
		<result column="parameter_value" property="parameterValue"
			jdbcType="VARCHAR" />
		<result column="standard_id" property="standardId" jdbcType="INTEGER" />
		<result column="standard_name" property="standardName"
			jdbcType="VARCHAR" />
	</resultMap>
	
	<select id="selectStandardByParameterId" resultMap="standardMap"
		parameterType="java.lang.Integer" timeout="20000">
    <![CDATA[SELECT t.id AS parameter_id,t.`parameter_value`,t.`standard_id`,s.`standard_name`
        FROM parameter_make t,standard s WHERE t.`standard_id`=s.id AND t.id=#{parameterId,jdbcType=INTEGER}
     ]]>
	</select>
	<select id="selectStandardLists" resultMap="standardMap" timeout="20000">
    <![CDATA[SELECT t.id AS parameter_id,t.`parameter_value`,t.`standard_id`,s.`standard_name`
        FROM parameter_make t,standard s WHERE t.`standard_id`=s.id limit #{offset},#{pageSize}
     ]]>
	</select>
	<select id="selectStandardMapCount" resultType="java.lang.Integer"
		timeout="20000">
		SELECT count(1) FROM parameter_make t,standard s WHERE
		t.`standard_id`=s.id
	</select>
	<select id="selectAll" resultMap="BaseResultMap" timeout="20000">
		select
		<include refid="Base_Column_List" />
		from standard
	</select>
</mapper>