You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
spms-java/api-admin/src/main/resources/mybatis/mapper/auth/AuthAdminDao.xml

171 lines
5.6 KiB
XML

4 years ago
<?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.glxp.sale.admin.dao.auth.AuthAdminDao">
<select id="listAdminPage" parameterType="com.glxp.sale.admin.req.auth.AuthAdminQueryRequest"
resultType="com.glxp.sale.admin.entity.auth.AuthAdmin">
4 years ago
SELECT *
FROM auth_user
<where>
<if test="ids != null and ids.size > 0">
AND id IN
<foreach collection="ids" item="id" index="index" open="(" close=")" separator=",">
#{id}
</foreach>
</if>
<if test="userFlag != null">
AND userFlag = #{userFlag}
</if>
<if test="userName != null and '' != userName">
AND userName LIKE CONCAT(#{userName},'%')
</if>
<if test="CustomerId != null">
AND CustomerId = #{CustomerId}
4 years ago
</if>
<if test="lastUpdateTime!=null and lastUpdateTime!=''">
<![CDATA[ and DATE_FORMAT(lastModifyTime, '%Y-%m-%d %H:%i:%S')>= DATE_FORMAT(#{lastUpdateTime}, '%Y-%m-%d %H:%i:%S') ]]>
</if>
4 years ago
</where>
ORDER BY id
DESC
</select>
3 years ago
<insert id="replaceAuthAdmin" keyProperty="id" parameterType="com.glxp.sale.admin.entity.auth.AuthAdmin">
replace
INTO auth_user(id, userName, passWord, lastLoginIp,
lastLoginTime, createTime, userFlag, lastModifyTime, employeeName,CustomerId,locInvCode,locSubInvCode)
3 years ago
values (
#{id},
#{userName},
#{passWord},
#{lastLoginIp},
#{lastLoginTime},
#{createTime},
#{userFlag,jdbcType=INTEGER},
#{lastModifyTime},
#{employeeName},
#{CustomerId},
#{locInvCode},
#{locSubInvCode}
3 years ago
)
</insert>
4 years ago
<select id="findByUserName" parameterType="hashmap" resultType="com.glxp.sale.admin.entity.auth.AuthAdmin">
SELECT *
FROM auth_user
<where>
userName = #{userName}
</where>
LIMIT 1
</select>
3 years ago
<select id="findCountByCustomerId" parameterType="java.lang.Long" resultType="java.lang.Integer">
SELECT count(0)
FROM auth_user
3 years ago
where CustomerId = #{id}
</select>
<select id="findByUser" parameterType="Map" resultType="com.glxp.sale.admin.entity.auth.AuthAdmin">
SELECT *
FROM auth_user
<where>
userName = #{userName}
<if test="CustomerId != null">
AND CustomerId = #{CustomerId}
</if>
</where>
4 years ago
LIMIT 1
</select>
<select id="findById" parameterType="hashmap" resultType="com.glxp.sale.admin.entity.auth.AuthAdmin">
SELECT *
FROM auth_user
<where>
id = #{id}
</where>
LIMIT 1
</select>
<select id="findPwdById" parameterType="hashmap" resultType="com.glxp.sale.admin.entity.auth.AuthAdmin">
SELECT passWord
FROM auth_user
<where>
id = #{id}
</where>
LIMIT 1
</select>
<insert id="insertAuthAdmin" keyProperty="id" parameterType="com.glxp.sale.admin.entity.auth.AuthAdmin">
INSERT INTO
auth_user(userName,passWord,lastLoginIp,lastLoginTime,createTime,userFlag
,employeeName,CustomerId,lastModifyTime,locInvCode,locSubInvCode)
4 years ago
values
(#{userName},
<choose>
<when test="passWord != null">
#{passWord},
</when>
<otherwise>
'',
</otherwise>
</choose>
<choose>
<when test="lastLoginIp != null">
#{lastLoginIp},
</when>
<otherwise>
'',
</otherwise>
</choose>
<choose>
<when test="lastLoginTime != null">
#{lastLoginTime},
</when>
<otherwise>
'0001-01-01 00:00:00',
</otherwise>
</choose>
#{createTime},
#{userFlag,jdbcType=INTEGER},
#{employeeName},
#{CustomerId},#{lastModifyTime},#{locInvCode},#{locSubInvCode})
4 years ago
</insert>
<update id="updateAuthAdmin" parameterType="com.glxp.sale.admin.entity.auth.AuthAdmin">
UPDATE auth_user
<trim prefix="set" suffixOverrides=",">
4 years ago
<if test="userName != null">userName=#{userName},</if>
<if test="passWord != null">passWord=#{passWord},</if>
<if test="lastLoginIp != null">lastLoginIp=#{lastLoginIp},</if>
<if test="lastLoginTime != null">lastLoginTime=#{lastLoginTime},</if>
<if test="lastModifyTime != null">lastModifyTime=#{lastModifyTime},</if>
4 years ago
<if test="userFlag != null">userFlag=#{userFlag},</if>
<if test="employeeName != null">employeeName=#{employeeName},</if>
<if test="locInvCode != null">locInvCode=#{locInvCode},</if>
<if test="locSubInvCode != null">locSubInvCode=#{locSubInvCode},</if>
</trim>
4 years ago
WHERE id=#{id}
</update>
<delete id="deleteById" parameterType="java.lang.Long">
delete
from auth_user
where id = #{id}
4 years ago
</delete>
3 years ago
<delete id="deleteByCustomerId" parameterType="java.lang.Long">
delete
from auth_user
where CustomerId = #{customerId}
</delete>
<select id="selectHospitalUser" resultType="com.glxp.sale.admin.entity.auth.AuthAdmin">
select *
from auth_user
where CustomerId = 110
</select>
4 years ago
</mapper>