From f4e8f069d050293232cfe68ebd38b2b05c4ad4b4 Mon Sep 17 00:00:00 2001
From: guoyuji <guoyujie@ng.com>
Date: 星期五, 12 七月 2024 11:41:30 +0800
Subject: [PATCH] Merge branch 'master' of http://bore.pub:10439/r/ERP_override

---
 north-glass-erp/src/main/resources/mapper/userInfo/User.xml |   87 +++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 87 insertions(+), 0 deletions(-)

diff --git a/north-glass-erp/src/main/resources/mapper/userInfo/User.xml b/north-glass-erp/src/main/resources/mapper/userInfo/User.xml
new file mode 100644
index 0000000..a593cf5
--- /dev/null
+++ b/north-glass-erp/src/main/resources/mapper/userInfo/User.xml
@@ -0,0 +1,87 @@
+<?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.example.erp.mapper.userInfo.UserMapper">
+    <resultMap id="findAllMap" type="com.example.erp.entity.userInfo.User">
+        <id property="id" column="id"/>
+        <result property="loginName" column="login_name"/>
+        <result property="userName" column="user_name"/>
+        <result property="createTime" column="create_time"/>
+
+        <collection property="userRoleList" ofType="com.example.erp.entity.userInfo.UserRole">
+            <result property="userId" column="user_id"/>
+            <result property="roleId" column="role_id"/>
+            <result property="role" column="role"/>
+        </collection>
+    </resultMap>
+
+
+    <select id="findAll" resultMap="findAllMap">
+        SELECT a.*,
+        b.role_id,
+        c.role
+        FROM erp_user_info.user as a
+        left join user_role as b
+        on a.id = b.user_id
+        left join role as c
+        on b.role_id = c.id
+        where state =1 and a.id != 1
+    </select>
+
+    <select id="findOne" >
+        SELECT *
+        FROM erp_user_info.user
+        where id=#{id}
+    </select>
+
+    <select id="findOneLoginName" >
+        SELECT *
+        FROM erp_user_info.user
+        where login_name=#{LoginName}
+    </select>
+
+    <select id="findOnePassWord" >
+        SELECT *
+        FROM erp_user_info.user
+        where id=#{id} and password=#{passWord}
+    </select>
+
+    <insert id="register"  useGeneratedKeys="true" keyProperty="id">
+        insert erp_user_info.user
+            (password,user_name)
+        values (
+                 #{password} ,#{userName}
+               )
+    </insert>
+
+    <select id="getUserRole">
+        SELECT
+            c.role
+        from
+            user as a
+        left join user_role as b
+            on a.id = b.user_id
+        left join role as c
+            on b.role_id = c.id
+        where a.id = #{loginId}
+
+    </select>
+    <update id="userDelete">
+        update user
+        set state =0
+        where id = #{id}
+    </update>
+
+    <update id="updatePassWordById">
+        update erp_user_info.user
+        set password=#{passWord},update_time=now()
+        where id=#{id}
+    </update>
+
+    <update id="updateUserNameById">
+        update erp_user_info.user
+        set user_name=#{userName},update_time=now()
+        where id=#{id}
+    </update>
+</mapper>
\ No newline at end of file

--
Gitblit v1.8.0