<?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.jxy.system.mapper.StrategyMapper">


	<select id="selectUserByUserName" parameterType="String" resultType="com.jxy.system.entity.StrategyUser">
		select
			username as userName,
			password,
			privilege,
			last_landing as lastLanding,
			own_strategy as ownStrategy
		from
			strategy_user
		where
		 	username = #{userName}
	</select>

	<select id="checkUserNameUnique" parameterType="String" resultType="int">
		select count(1) from strategy_user where username = #{userName} limit 1
	</select>

	<update id="updateUser" parameterType="com.jxy.system.entity.StrategyUser">
		update strategy_user
		<set>
			<if test="userName != null and userName != ''">username = #{userName},</if>
			<if test="password != null and password != ''">password = #{password},</if>
			<if test="privilege != null and privilege != ''">privilege = #{privilege},</if>
			<if test="lastLanding != null">last_landing = #{lastLanding},</if>
			<if test="ownStrategy != null and ownStrategy != ''">own_strategy = #{ownStrategy},</if>
		</set>
		where username = #{userName}
	</update>

</mapper>

