All Downloads are FREE. Search and download functionalities are using the official Maven repository.

mappings.modules.SequenceDao.xml Maven / Gradle / Ivy

<?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.yqjr.modules.sequence.dao.SequenceDao">
	<resultMap id="BaseResultMap" type="com.yqjr.modules.sequence.entity.Sequence">
		<result column="ID" jdbcType="DECIMAL" property="id" />
		<result column="SEQ_NAME" jdbcType="VARCHAR" property="seqName" />
		<result column="CURRENT_VALUE" jdbcType="DECIMAL" property="currentValue" />
		<result column="SEQ_CACHE" jdbcType="DECIMAL" property="seqCache" />
		<result column="CREATEBY" jdbcType="DECIMAL" property="createBy.id" />
		<result column="CREATEDATE" jdbcType="TIMESTAMP" property="createDate"
			typeHandler="DateHandler" />
		<result column="UPDATEBY" jdbcType="DECIMAL" property="updateBy.id" />
		<result column="UPDATEDATE" jdbcType="TIMESTAMP" property="updateDate"
			typeHandler="DateHandler" />
		<result column="REMARKS" jdbcType="VARCHAR" property="remarks" />
		<result column="DELETESTATUS" jdbcType="DECIMAL" property="deleteStatus" />
	</resultMap>
	<sql id="Base_Column_List">
		ID, SEQ_NAME, CURRENT_VALUE, SEQ_CACHE, CREATEBY,
		CREATEDATE, UPDATEBY,
		UPDATEDATE,
		REMARKS, DELETESTATUS
	</sql>
	<sql id="Base_Where_Condition">
		<where>
			<if test="id != null">
				and ID = #{id,jdbcType=DECIMAL}
			</if>
			<if test="seqName != null">
				and SEQ_NAME = #{seqName,jdbcType=VARCHAR}
			</if>
			<if test="currentValue != null">
				and CURRENT_VALUE = #{currentValue,jdbcType=DECIMAL}
			</if>
			<if test="seqCache != null">
				and SEQ_CACHE = #{seqCache,jdbcType=DECIMAL}
			</if>
			<if test="createBy != null">
				and CREATEBY = #{createBy.id}
			</if>
			<if test="createDate != null">
				and CREATEDATE =
				#{createDate,jdbcType=TIMESTAMP,typeHandler=DateHandler}
			</if>
			<if test="updateBy != null">
				and UPDATEBY = #{updateBy.id}
			</if>
			<if test="updateDate != null">
				and UPDATEDATE =
				#{updateDate,jdbcType=TIMESTAMP,typeHandler=DateHandler}
			</if>
			<if test="remarks != null">
				and REMARKS = #{remarks,jdbcType=VARCHAR}
			</if>
			<if test="deleteStatus != null">
				and DELETESTATUS =
				#{deleteStatus,jdbcType=DECIMAL}
			</if>
		</where>
	</sql>
	<insert id="insert" parameterType="com.yqjr.modules.sequence.entity.Sequence">
		insert into FMK_SEQUENCE
		<trim prefix="(" suffix=")" suffixOverrides=",">
			<if test="id != null">
				ID,
			</if>
			<if test="seqName != null">
				SEQ_NAME,
			</if>
			<if test="currentValue != null">
				CURRENT_VALUE,
			</if>
			<if test="seqCache != null">
				SEQ_CACHE,
			</if>
			<if test="createBy != null">
				CREATEBY,
			</if>
			<if test="createDate != null">
				CREATEDATE,
			</if>
			<if test="updateBy != null">
				UPDATEBY,
			</if>
			<if test="updateDate != null">
				UPDATEDATE,
			</if>
			<if test="remarks != null">
				REMARKS,
			</if>
			<if test="deleteStatus != null">
				DELETESTATUS,
			</if>
		</trim>
		<trim prefix="values (" suffix=")" suffixOverrides=",">
			<if test="id != null">
				#{id,jdbcType=DECIMAL},
			</if>
			<if test="seqName != null">
				#{seqName,jdbcType=VARCHAR},
			</if>
			<if test="currentValue != null">
				#{currentValue,jdbcType=DECIMAL},
			</if>
			<if test="seqCache != null">
				#{seqCache,jdbcType=DECIMAL},
			</if>
			<if test="createBy != null">
				#{createBy.id},
			</if>
			<if test="createDate != null">
				#{createDate,jdbcType=TIMESTAMP,typeHandler=DateHandler},
			</if>
			<if test="updateBy != null">
				#{updateBy.id},
			</if>
			<if test="updateDate != null">
				#{updateDate,jdbcType=TIMESTAMP,typeHandler=DateHandler},
			</if>
			<if test="remarks != null">
				#{remarks,jdbcType=VARCHAR},
			</if>
			<if test="deleteStatus != null">
				#{deleteStatus,jdbcType=DECIMAL},
			</if>
		</trim>
	</insert>
	<update id="update" parameterType="com.yqjr.modules.sequence.entity.Sequence">
		update FMK_SEQUENCE
		<set>
			<if test="seqName != null">
				SEQ_NAME = #{seqName,jdbcType=VARCHAR},
			</if>
			<if test="currentValue != null">
				CURRENT_VALUE = #{currentValue,jdbcType=DECIMAL},
			</if>
			<if test="seqCache != null">
				SEQ_CACHE = #{seqCache,jdbcType=DECIMAL},
			</if>
			<if test="createBy != null">
				CREATEBY = #{createBy.id},
			</if>
			<if test="createDate != null">
				CREATEDATE =
				#{createDate,jdbcType=TIMESTAMP,typeHandler=DateHandler},
			</if>
			<if test="updateBy != null">
				UPDATEBY = #{updateBy.id},
			</if>
			<if test="updateDate != null">
				UPDATEDATE =
				#{updateDate,jdbcType=TIMESTAMP,typeHandler=DateHandler},
			</if>
			<if test="remarks != null">
				REMARKS = #{remarks,jdbcType=VARCHAR},
			</if>
			<if test="deleteStatus != null">
				DELETESTATUS =
				#{deleteStatus,jdbcType=DECIMAL},
			</if>
		</set>
		<where>
			id = #{id}
		</where>
	</update>
	<update id="delete" parameterType="com.yqjr.modules.sequence.entity.Sequence">
		update FMK_SEQUENCE
		<set>
			deleteStatus = 0
			<if test="updateBy != null">
				updateBy = #{updateBy.id},
			</if>
			<if test="updateDate != null">
				updateDate =
				#{updateDate,jdbcType=TIMESTAMP,typeHandler=DateHandler}
			</if>
		</set>
		<where>
			id = #{id}
		</where>
	</update>
	<select id="id" resultMap="BaseResultMap">
		select
		<include refid="Base_Column_List" />
		from FMK_SEQUENCE
		<if test="_parameter != null">
			where id = #{id}
		</if>
	</select>
	<select id="get" parameterType="com.yqjr.modules.sequence.entity.Sequence"
		resultMap="BaseResultMap">
		select
		<include refid="Base_Column_List" />
		from FMK_SEQUENCE
		<if test="_parameter != null">
			<include refid="Base_Where_Condition" />
		</if>
	</select>
	<select id="findList" parameterType="com.yqjr.modules.sequence.entity.Sequence"
		resultMap="BaseResultMap">
		select
		<include refid="Base_Column_List" />
		from FMK_SEQUENCE
		<if test="_parameter != null">
			<include refid="Base_Where_Condition" />
		</if>
	</select>
	<select id="findByCondition" parameterType="com.yqjr.modules.sequence.condition.SequenceCondition"
		resultMap="BaseResultMap">
		select
		<include refid="Base_Column_List" />
		from FMK_SEQUENCE
		<if test="_parameter != null">
			<where>
				<if test="seqName != null">
					and SEQ_NAME = #{seqName,jdbcType=VARCHAR}
				</if>
				<if test="currentValue != null">
					and CURRENT_VALUE = #{currentValue,jdbcType=DECIMAL}
				</if>
				<if test="seqCache != null">
					and SEQ_CACHE = #{seqCache,jdbcType=DECIMAL}
				</if>
				<if test="deleteStatus != null">
					and DELETESTATUS =
					#{deleteStatus,jdbcType=DECIMAL}
				</if>
				<if test="startDate != null">
          <![CDATA[  and updateDate >= TO_DATE(#{startDate},'yyyy-mm-dd') ]]>
				</if>
				<if test="endDate != null">
          <![CDATA[  and updateDate < TO_DATE(#{endDate},'yyyy-mm-dd')+1 ]]>
				</if>
				<if test="userId > 0">
					and createBy = #{userId}
				</if>
			</where>
		</if>
	</select>
	<select id="getOracleSequence" resultType="long">
		select ${_parameter}.nextval from dual
	</select>
	<select id="getSequenceForUpdate" resultMap="BaseResultMap">
		select
		<include refid="Base_Column_List" />
		from FMK_SEQUENCE
		where
		SEQ_NAME = #{_parameter} for update
	</select>
</mapper>




© 2015 - 2024 Weber Informatics LLC | Privacy Policy