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

mappings.modules.UserDao.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.user.dao.UserDao">
	<resultMap id="BaseResultMap" type="com.yqjr.modules.user.entity.User">
		<result column="ID" jdbcType="DECIMAL" property="id" />
		<!-- <result column="USERNO" jdbcType="DECIMAL" property="userNo" typeHandler="AmountHandler" /> -->
		<result column="LOGINNAME" jdbcType="VARCHAR" property="loginName" />
		<result column="PASSWORD" jdbcType="VARCHAR" property="password" />
		<result column="USERNAME" jdbcType="VARCHAR" property="userName" />
		<result column="EMAIL" jdbcType="VARCHAR" property="email" />
		<result column="PHONE" jdbcType="VARCHAR" property="phone" />
		<result column="CANLOGIN" jdbcType="DECIMAL" property="canLogin" />
		<result column="LASTLOGINIP" jdbcType="VARCHAR" property="lastLoginIp" />
		<result column="LASTLOGINDATE" jdbcType="TIMESTAMP" property="lastLoginDate"
			typeHandler="DateHandler" />
		<result column="DELETESTATUS" jdbcType="DECIMAL" property="deleteStatus" />
		<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="DATAVERSION" jdbcType="VARCHAR" property="dataVersion" />
	</resultMap>
	<sql id="Base_Column_List">
		ID, LOGINNAME, PASSWORD, USERNAME, EMAIL, PHONE,
		CANLOGIN,
		LASTLOGINIP, LASTLOGINDATE,
		DELETESTATUS, CREATEBY, CREATEDATE,
		UPDATEBY, UPDATEDATE, REMARKS, DATAVERSION
	</sql>
	<sql id="Base_Where_Condition">
		<where>
			<if test="id != null">
				and ID = #{id,jdbcType=DECIMAL}
			</if>
			<!-- <if test="userNo != null">
				and USERNO = #{userNo,jdbcType=DECIMAL,typeHandler=AmountHandler}
			</if> -->
			<if test="loginName != null">
				and LOGINNAME = #{loginName,jdbcType=VARCHAR}
			</if>
			<if test="password != null">
				and PASSWORD = #{password,jdbcType=VARCHAR}
			</if>
			<if test="userName != null">
				and USERNAME = #{userName,jdbcType=VARCHAR}
			</if>
			<if test="email != null">
				and EMAIL = #{email,jdbcType=VARCHAR}
			</if>
			<if test="phone != null">
				and PHONE = #{phone,jdbcType=VARCHAR}
			</if>
			<if test="canLogin != null">
				and CANLOGIN = #{canLogin,jdbcType=DECIMAL}
			</if>
			<if test="lastLoginIp != null">
				and LASTLOGINIP = #{lastLoginIp,jdbcType=VARCHAR}
			</if>
			<if test="lastLoginDate != null">
				and LASTLOGINDATE =
				#{lastLoginDate,jdbcType=TIMESTAMP,typeHandler=DateHandler}
			</if>
			<if test="deleteStatus != null">
				and DELETESTATUS =
				#{deleteStatus,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>
		</where>
	</sql>
	<insert id="insert" parameterType="com.yqjr.modules.user.entity.User">
		insert into FMK_USER
		<trim prefix="(" suffix=")" suffixOverrides=",">
			<if test="id != null">
				ID,
			</if>
			<!-- <if test="userNo != null">
				USERNO,
			</if> -->
			<if test="loginName != null">
				LOGINNAME,
			</if>
			<if test="password != null">
				PASSWORD,
			</if>
			<if test="userName != null">
				USERNAME,
			</if>
			<if test="email != null">
				EMAIL,
			</if>
			<if test="phone != null">
				PHONE,
			</if>
			CANLOGIN,
			<if test="lastLoginIp != null">
				LASTLOGINIP,
			</if>
			<if test="lastLoginDate != null">
				LASTLOGINDATE,
			</if>
			<if test="deleteStatus != null">
				DELETESTATUS,
			</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="dataVersion != null">
				DATAVERSION,
			</if>
		</trim>
		<trim prefix="values (" suffix=")" suffixOverrides=",">
			<if test="id != null">
				#{id,jdbcType=DECIMAL},
			</if>
			<!-- <if test="userNo != null">
				#{userNo,jdbcType=VARCHAR},
			</if> -->
			<if test="loginName != null">
				#{loginName,jdbcType=VARCHAR},
			</if>
			<if test="password != null">
				#{password,jdbcType=VARCHAR},
			</if>
			<if test="userName != null">
				#{userName,jdbcType=VARCHAR},
			</if>
			<if test="email != null">
				#{email,jdbcType=VARCHAR},
			</if>
			<if test="phone != null">
				#{phone,jdbcType=VARCHAR},
			</if>
			#{canLogin,jdbcType=DECIMAL},
			<if test="lastLoginIp != null">
				#{lastLoginIp,jdbcType=VARCHAR},
			</if>
			<if test="lastLoginDate != null">
				#{lastLoginDate,jdbcType=TIMESTAMP,typeHandler=DateHandler},
			</if>
			<if test="deleteStatus != null">
				#{deleteStatus,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="dataVersion != null">
				#{dataVersion,jdbcType=DECIMAL},
			</if>
		</trim>
	</insert>
	<update id="update" parameterType="com.yqjr.modules.user.entity.User">
		update FMK_USER
		<set>
			<!-- <if test="userNo != null">
				USERNO = #{userNo,jdbcType=DECIMAL,typeHandler=AmountHandler},
			</if> -->
			<if test="loginName != null">
				LOGINNAME = #{loginName,jdbcType=VARCHAR},
			</if>
			<if test="password != null">
				PASSWORD = #{password,jdbcType=VARCHAR},
			</if>
			<if test="userName != null">
				USERNAME = #{userName,jdbcType=VARCHAR},
			</if>
			<if test="email != null">
				EMAIL = #{email,jdbcType=VARCHAR},
			</if>
			<if test="phone != null">
				PHONE = #{phone,jdbcType=VARCHAR},
			</if>
			<if test="canLogin != null">
				CANLOGIN = #{canLogin,jdbcType=DECIMAL},
			</if>
			<if test="lastLoginIp != null">
				LASTLOGINIP = #{lastLoginIp,jdbcType=VARCHAR},
			</if>
			<if test="lastLoginDate != null">
				LASTLOGINDATE =
				#{lastLoginDate,jdbcType=TIMESTAMP,typeHandler=DateHandler},
			</if>
			<if test="deleteStatus != null">
				DELETESTATUS =
				#{deleteStatus,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>
			DATAVERSION = DATAVERSION + 1
		</set>
		<where>
			ID = #{id}
			<if test="dataVersion != null">
				and DATAVERSION = #{dataVersion,jdbcType=DECIMAL}
			</if>
		</where>
	</update>
	<update id="delete" parameterType="com.yqjr.modules.user.entity.User">
		update FMK_USER
		<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_USER
		<if test="_parameter != null">
			where id = #{id}
		</if>
	</select>
	<select id="get" parameterType="com.yqjr.modules.user.entity.User"
		resultMap="BaseResultMap">
		select
		<include refid="Base_Column_List" />
		from FMK_USER
		<if test="_parameter != null">
			<include refid="Base_Where_Condition" />
		</if>
	</select>
	<select id="findList" parameterType="com.yqjr.modules.user.entity.User"
		resultMap="BaseResultMap">
		select
		<include refid="Base_Column_List" />
		from FMK_USER
		<if test="_parameter != null">
			<include refid="Base_Where_Condition" />
		</if>
	</select>
	<select id="findByCondition" parameterType="com.yqjr.modules.user.condition.UserCondition"
		resultMap="BaseResultMap">
		select
		<include refid="Base_Column_List" />
		from FMK_USER
		<if test="_parameter != null">
			<where>
				<!-- <if test="userNo != null">
					and USERNO = #{userNo,jdbcType=DECIMAL,typeHandler=AmountHandler}
				</if> -->
				<if test="loginName != null">
					and LOGINNAME = #{loginName,jdbcType=VARCHAR}
				</if>
				<if test="password != null">
					and PASSWORD = #{password,jdbcType=VARCHAR}
				</if>
				<if test="userName != null">
					and USERNAME = #{userName,jdbcType=VARCHAR}
				</if>
				<if test="email != null">
					and EMAIL = #{email,jdbcType=VARCHAR}
				</if>
				<if test="phone != null">
					and PHONE = #{phone,jdbcType=VARCHAR}
				</if>
				<if test="canLogin != null">
					and CANLOGIN = #{canLogin,jdbcType=DECIMAL}
				</if>
				<if test="lastLoginIp != null">
					and LASTLOGINIP = #{lastLoginIp,jdbcType=VARCHAR}
				</if>
				<if test="lastLoginDate != null">
					and LASTLOGINDATE =
					#{lastLoginDate,jdbcType=TIMESTAMP,typeHandler=DateHandler}
				</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>

	<delete id="deleteUserRole">
		DELETE FROM fmk_role_user WHERE user_id = #{id}
	</delete>
	<insert id="insertUserRole">
		INSERT INTO fmk_role_user(user_id, role_id)
		<foreach collection="roleList" item="role" separator=" union all ">
			SELECT
			#{user.id}, #{role.id} FROM dual
		</foreach>
	</insert>
</mapper>




© 2015 - 2024 Weber Informatics LLC | Privacy Policy