1259 lines
35 KiB
XML
1259 lines
35 KiB
XML
<?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.bonus.sys.dao.UserDao">
|
|
<resultMap id="BaseResultMap" type="com.bonus.sys.beans.UserBean">
|
|
<id column="ID" property="id" jdbcType="INTEGER" />
|
|
<result column="NAME" property="name" jdbcType="VARCHAR" />
|
|
<result column="ORG_ID" property="orgId" jdbcType="INTEGER" />
|
|
<result column="roleId" property="role.id" />
|
|
<result column="authorId" property="authur.id" />
|
|
<result column="aStuId" property="authur.status.id" />
|
|
<result column="roleName" property="role.name" />
|
|
<result column="orgParentId" property="orgParentId" jdbcType="INTEGER" />
|
|
<result column="ORG_NAME" property="orgName" jdbcType="INTEGER" />
|
|
<result column="identity_state" property="identityState" jdbcType="VARCHAR" />
|
|
<result column="internalEmp" property="internalEmp" jdbcType="INTEGER" />
|
|
<result column="typeId" property="authur.type.id" jdbcType="INTEGER" />
|
|
<result column="brother" property="brother" jdbcType="INTEGER" />
|
|
<result column="typeId" property="type.id" jdbcType="INTEGER" />
|
|
<result column="team" property="team.name" jdbcType="VARCHAR" />
|
|
<result column="staId" property="authur.status.id" jdbcType="INTEGER" />
|
|
<result column="LOGIN_NAME" property="loginName" jdbcType="VARCHAR" />
|
|
<result column="PIC_URL" property="picUrl" jdbcType="VARCHAR" />
|
|
<result column="SKIN" property="skin" jdbcType="VARCHAR" />
|
|
<result column="SALT" property="salt" jdbcType="VARCHAR" />
|
|
<result column="PASSWD" property="passwd" jdbcType="VARCHAR" />
|
|
<result column="SEX" property="sex" jdbcType="CHAR" />
|
|
<result column="MAIL" property="mail" jdbcType="VARCHAR" />
|
|
<result column="QQ" property="qq" jdbcType="VARCHAR" />
|
|
<result column="C_ID" property="cId" jdbcType="VARCHAR" />
|
|
<result column="TELPHONE" property="telphone" jdbcType="VARCHAR" />
|
|
<result column="CREATE_TIME" property="createTime" jdbcType="DATE" />
|
|
<result column="UPDATE_TIME" property="updateTime" jdbcType="DATE" />
|
|
<result column="PROJECT_ID" property="projectId" jdbcType="DATE" />
|
|
<result column="IS_ACTIVE" property="isActive" jdbcType="CHAR" />
|
|
<result column="OFFICE_ADDRESS" property="officeAddress" jdbcType="VARCHAR" />
|
|
<result column="type" property="type.id" jdbcType="INTEGER" />
|
|
<result column="userId" property="id" />
|
|
<result column="userName" property="name" />
|
|
<result column="organId" property="orgId" />
|
|
<result column="organName" property="orgName" />
|
|
<result column="organName" property="orgName" />
|
|
<result column="organName" property="orgName" />
|
|
<result column="if_permiss" property="ifPermiss" />
|
|
<result column="profess" property="profess" />
|
|
<result column="id_card" property="idCard" />
|
|
<result column="greenScore" property="greenScore" />
|
|
</resultMap>
|
|
|
|
<resultMap id="baseMap" type="com.bonus.sys.beans.UserBean">
|
|
|
|
<id column="id" property="id" jdbcType="INTEGER" />
|
|
<result column="name" property="name" jdbcType="VARCHAR" />
|
|
<result column="orgId" property="org.id" jdbcType="INTEGER" />
|
|
<result column="orgName" property="org.name" jdbcType="VARCHAR" />
|
|
<result column="loginName" property="loginName" />
|
|
<result column="sex" property="sex" />
|
|
<result column="mail" property="mail" />
|
|
<result column="telphone" property="telphone" />
|
|
<result column="createTime" property="createDate" jdbcType="DATE" />
|
|
<result column="updateTime" property="updateTime" jdbcType="DATE" />
|
|
<result column="isActive" property="isActive" />
|
|
<result column="jobNumber" property="jobNumber" />
|
|
<result column="totalName" property="totalName" />
|
|
<result column="greenScore" property="greenScore" />
|
|
<result column="internalEmp" property="internalEmp" jdbcType="INTEGER" />
|
|
<collection property="roles" ofType="com.bonus.sys.beans.NewRoleBean">
|
|
<id column="pnrId" property="id" jdbcType="INTEGER" />
|
|
<result column="pnrName" property="name" jdbcType="VARCHAR" />
|
|
</collection>
|
|
|
|
</resultMap>
|
|
|
|
|
|
<resultMap id="ZNode" type="com.bonus.sys.beans.ZNode"></resultMap>
|
|
<resultMap id="webUserResultMap" type="com.bonus.sys.beans.UserBean">
|
|
<id column="ID" property="id" jdbcType="INTEGER" />
|
|
<result column="NAME" property="name" jdbcType="VARCHAR" />
|
|
<result column="loginName" property="loginName" jdbcType="VARCHAR" />
|
|
<result column="brother" property="brother" jdbcType="INTEGER" />
|
|
<result column="MAIL" property="mail" jdbcType="VARCHAR" />
|
|
<result column="TELPHONE" property="telphone" jdbcType="VARCHAR" />
|
|
<result column="isActive" property="isActive" jdbcType="VARCHAR" />
|
|
<result column="typeName" property="accountType.name" jdbcType="VARCHAR" />
|
|
<result column="typeId" property="accountType.id" jdbcType="INTEGER" />
|
|
<result column="handler" property="authur.handler" jdbcType="VARCHAR" />
|
|
<result column="phone" property="authur.phone" jdbcType="VARCHAR" />
|
|
</resultMap>
|
|
|
|
<resultMap id="oneGraphMap" type="com.bonus.sys.beans.UserBean">
|
|
<id column="userId" property="id" jdbcType="INTEGER" />
|
|
<result column="userName" property="name" jdbcType="VARCHAR" />
|
|
|
|
</resultMap>
|
|
|
|
<resultMap id="inuseProjectMap" type="com.bonus.sys.beans.UserBean">
|
|
<id column="userId" property="id" jdbcType="INTEGER" />
|
|
<result column="userName" property="name" jdbcType="VARCHAR" />
|
|
|
|
</resultMap>
|
|
|
|
<resultMap id="mapResultMap" type="HashMap">
|
|
<result property="key" column="csys" javaType="java.lang.String" />
|
|
<result property="value" column="takenNum" javaType="java.lang.Float" jdbcType="FLOAT" />
|
|
</resultMap>
|
|
|
|
|
|
|
|
<select id="findInternalEmp" resultMap="baseMap">
|
|
select
|
|
pu.`name`,
|
|
pu.id
|
|
from
|
|
pm_user pu
|
|
WHERE
|
|
pu.internal_emp = 1
|
|
AND
|
|
pu.IS_ACTIVE = 1
|
|
</select>
|
|
|
|
<select id="findUserBySelect" parameterType="com.bonus.sys.beans.UserBean" resultMap="baseMap">
|
|
SELECT
|
|
pu.id AS id,
|
|
pu.NAME AS name
|
|
FROM
|
|
pm_user pu
|
|
where
|
|
pu.ORG_ID = #{orgId}
|
|
ORDER BY
|
|
pu.id
|
|
</select>
|
|
|
|
<select id="findUserBeanById" parameterType="java.lang.String" resultMap="baseMap">
|
|
select
|
|
LOGIN_NAME as loginName
|
|
from
|
|
pm_user
|
|
where
|
|
id = #{userId}
|
|
</select>
|
|
|
|
<select id="findByidcard" parameterType="java.lang.String" resultMap="baseMap">
|
|
select
|
|
id
|
|
from
|
|
pm_user
|
|
where
|
|
LOGIN_NAME = #{idCard}
|
|
</select>
|
|
|
|
<select id="getUserInfo" parameterType="com.bonus.sys.beans.UserBean" resultMap="baseMap">
|
|
SELECT
|
|
pu.id AS userId,
|
|
pu.NAME AS userName,
|
|
po.id AS organId,
|
|
po.NAME AS organName
|
|
FROM
|
|
pm_user pu
|
|
LEFT JOIN pm_organization po ON po.id = pu.ORG_ID
|
|
WHERE
|
|
pu.id = #{param.id}
|
|
</select>
|
|
|
|
<select id="findUserInfoById" parameterType="com.bonus.sys.beans.UserBean" resultMap="baseMap">
|
|
SELECT
|
|
pu.id,
|
|
pu.`NAME`,
|
|
pu.ORG_ID AS orgId,
|
|
pu.LOGIN_NAME AS loginName,
|
|
pu.sex,
|
|
pu.telphone,
|
|
pu.mail,
|
|
pu.green_score AS greenScore,
|
|
pnru.role_id AS pnrId,
|
|
pu.internal_emp AS internalEmp,
|
|
IF(ppo.PARENT_ID=0,po.`NAME`,CONCAT(pooo.`NAME`,'/',ppo.`NAME`,"/",po.`NAME`)) AS orgName
|
|
FROM pm_user pu
|
|
LEFT JOIN pm_new_role_user pnru ON pu.ID = pnru.user_id
|
|
LEFT JOIN pm_organization po ON po.id = pu.ORG_ID
|
|
LEFT JOIN pm_organization ppo ON ppo.id = po.PARENT_ID
|
|
LEFT JOIN pm_organization pooo ON pooo.ID = ppo.PARENT_ID
|
|
WHERE
|
|
pu.ID = #{id}
|
|
|
|
</select>
|
|
|
|
<select id="findProjectCollarList" resultMap="oneGraphMap">
|
|
SELECT
|
|
p.type AS typeId,
|
|
p.project,
|
|
bpi.`name` AS projectName,
|
|
pu.`NAME` AS userName,
|
|
pu.id AS userId,
|
|
SUM(num) AS takenNum
|
|
FROM
|
|
ma_type_project_storage p
|
|
LEFT JOIN
|
|
bm_project_info bpi ON bpi.id = p.project
|
|
LEFT JOIN pm_user pu ON pu.id = bpi.`user`
|
|
WHERE
|
|
p.`status` = 1
|
|
GROUP BY
|
|
p.project,p.type
|
|
</select>
|
|
<select id="findInuseProjectCollarList" resultMap="inuseProjectMap">
|
|
SELECT
|
|
t.typeId,
|
|
t.project,
|
|
bpi.`NAME` AS projectName,
|
|
pu.`NAME` AS userName,
|
|
pu.`id` AS userId,
|
|
SUM(t.takenNum) AS takenNum
|
|
FROM
|
|
(SELECT
|
|
ttd.project,
|
|
mt.id AS typeId,
|
|
SUM(ttd.taken_num) AS takenNum
|
|
FROM
|
|
tm_task_details ttd
|
|
LEFT JOIN ma_type mt ON mt.id = ttd.machine
|
|
WHERE
|
|
ttd.`status` = 191
|
|
GROUP BY
|
|
ttd.project,mt.id
|
|
UNION
|
|
SELECT
|
|
bmb.project AS projectId,
|
|
bmbr.model_id AS typeId,
|
|
SUM(-1*bmbr.rm_num) AS takenNum
|
|
FROM
|
|
ba_ma_back_record bmbr
|
|
LEFT JOIN
|
|
ba_ma_back bmb ON bmb.TASK_ID = bmbr.task_id
|
|
GROUP BY
|
|
bmb.project,bmbr.model_id) t
|
|
LEFT JOIN bm_project_info bpi ON bpi.id = t.project
|
|
LEFT JOIN pm_user pu ON pu.id = bpi.`user`
|
|
GROUP BY
|
|
t.project
|
|
|
|
</select>
|
|
|
|
<select id="findProjectCollarMap" resultMap="mapResultMap">
|
|
SELECT
|
|
CONCAT(t.typeId,'-',t.project) AS csys,
|
|
SUM(t.takenNum) AS takenNum
|
|
FROM
|
|
(SELECT
|
|
ttd.project,
|
|
mt.id AS typeId,
|
|
SUM(ttd.taken_num) AS takenNum
|
|
FROM
|
|
tm_task_details ttd
|
|
LEFT JOIN ma_type mt ON mt.id = ttd.machine
|
|
WHERE
|
|
ttd.`status` = 191
|
|
GROUP BY
|
|
ttd.project,mt.id
|
|
UNION
|
|
SELECT
|
|
bmb.project AS projectId,
|
|
bmbr.model_id AS typeId,
|
|
SUM(-1*bmbr.rm_num) AS takenNum
|
|
FROM
|
|
ba_ma_back_record bmbr
|
|
LEFT JOIN
|
|
ba_ma_back bmb ON bmb.TASK_ID = bmbr.task_id
|
|
GROUP BY
|
|
bmb.project,bmbr.model_id) t
|
|
LEFT JOIN bm_project_info bpi ON bpi.id = t.project
|
|
LEFT JOIN pm_user pu ON pu.id = bpi.`user`
|
|
GROUP BY
|
|
t.project,t.typeId
|
|
</select>
|
|
|
|
<select id="findByPageOfWebUser" resultMap="webUserResultMap" parameterType="com.bonus.sys.beans.UserBean">
|
|
SELECT
|
|
pu.id,
|
|
pu.`NAME`,
|
|
pu.brother,
|
|
pu.LOGIN_NAME AS loginName,
|
|
pu.MAIL,
|
|
pu.TELPHONE,
|
|
pu.IS_ACTIVE AS isActive,
|
|
sdd.`NAME` AS typeName,
|
|
sdd.id AS typeId
|
|
|
|
FROM
|
|
pm_user pu
|
|
LEFT JOIN
|
|
sys_data_dict sdd
|
|
ON
|
|
sdd.id = pu.type
|
|
|
|
WHERE
|
|
pu.IS_ACTIVE = 1
|
|
AND
|
|
pu.internal_emp = 0 and pu.brother = 0
|
|
<!-- AND
|
|
waa.status = 31 -->
|
|
</select>
|
|
|
|
|
|
<select id="findByPageOfBrotherUser" resultMap="webUserResultMap" parameterType="com.bonus.sys.beans.UserBean">
|
|
SELECT
|
|
pu.id,
|
|
pu.`NAME`,
|
|
pu.brother,
|
|
pu.LOGIN_NAME AS loginName,
|
|
pu.MAIL,
|
|
pu.TELPHONE as telphone,
|
|
pu.IS_ACTIVE AS isActive
|
|
FROM
|
|
pm_user pu
|
|
|
|
WHERE
|
|
pu.IS_ACTIVE = 1
|
|
AND
|
|
pu.internal_emp = 0 and brother = 1
|
|
<!-- AND
|
|
waa.status = 31 -->
|
|
</select>
|
|
|
|
<select id="getDeptEmpByDeptId" resultMap="ZNode">
|
|
SELECT
|
|
u.ID,
|
|
u.NAME,
|
|
u.ORG_ID as pId
|
|
FROM
|
|
pm_user u
|
|
where
|
|
u.IS_ACTIVE='1'
|
|
AND
|
|
u.internal_emp = 1
|
|
AND
|
|
u.ORG_ID = #{orgId}
|
|
</select>
|
|
|
|
<select id="findAllInternalEmp" resultMap="ZNode">
|
|
SELECT
|
|
u.ID,
|
|
u.NAME,
|
|
u.ORG_ID as pId,
|
|
1 AS type
|
|
FROM
|
|
pm_user u
|
|
where
|
|
u.IS_ACTIVE='1'
|
|
AND
|
|
internal_emp = 1
|
|
</select>
|
|
|
|
<select id="getOrgBeans" resultMap="ZNode">
|
|
SELECT
|
|
ID,
|
|
`NAME`,
|
|
PARENT_ID as pId,
|
|
0 as type
|
|
FROM
|
|
pm_organization
|
|
WHERE
|
|
IS_ACTIVE = '1'
|
|
</select>
|
|
|
|
<select id="getOrgTreeList" parameterType="com.bonus.sys.beans.UserBean" resultMap="ZNode">
|
|
SELECT
|
|
ID,
|
|
`NAME`,
|
|
PARENT_ID as pId,
|
|
TYPE as type
|
|
FROM
|
|
pm_organization
|
|
WHERE
|
|
IS_ACTIVE = '1'
|
|
<if test="city == 1 or city == '1' ">
|
|
and TYPE is null
|
|
</if>
|
|
<if test="city == 2 or city == '2' ">
|
|
and TYPE = 2
|
|
</if>
|
|
</select>
|
|
|
|
<select id="getOrgBeansList" resultMap="ZNode">
|
|
SELECT
|
|
ID,
|
|
`NAME`,
|
|
CASE
|
|
PARENT_ID
|
|
WHEN 1 THEN 0
|
|
ELSE PARENT_ID
|
|
END AS pId,
|
|
0 as type
|
|
FROM
|
|
pm_organization
|
|
WHERE
|
|
IS_ACTIVE = '1' and ID not in (1, 2)
|
|
</select>
|
|
|
|
<select id="getTecEmp" resultMap="ZNode" parameterType="java.lang.Integer">
|
|
SELECT
|
|
pu.id,
|
|
0 AS pid,
|
|
pu.`NAME`
|
|
FROM
|
|
pm_user pu
|
|
LEFT JOIN
|
|
pm_organization po
|
|
ON
|
|
po.technician = pu.id
|
|
LEFT JOIN
|
|
ma_team_type mtt
|
|
ON
|
|
po.id = mtt.team_id
|
|
WHERE
|
|
mtt.type_id = #{0}
|
|
</select>
|
|
|
|
<select id="findOrgId" parameterType="java.lang.Integer" resultMap="baseMap">
|
|
SELECT if(T2.TYPE = 2,1,0) id,COUNT(1)
|
|
FROM (
|
|
SELECT
|
|
@r AS _id,
|
|
(SELECT @r := parent_id FROM pm_organization WHERE id = _id) AS parent_id,
|
|
@l := @l + 1 AS lvl
|
|
FROM
|
|
(SELECT @r := #{orgId}, @l := 0) vars,
|
|
pm_organization h
|
|
WHERE @r != 0) T1
|
|
JOIN pm_organization T2
|
|
ON T1._id = T2.id
|
|
WHERE IS_ACTIVE = '1'
|
|
GROUP BY T2.TYPE
|
|
having (COUNT(1) = 4 and T2.TYPE is null) or (COUNT(1) = 2 and T2.TYPE = 2)
|
|
ORDER BY T1.lvl DESC
|
|
</select>
|
|
|
|
<select id="getRepairEmpList" resultMap="ZNode" parameterType="java.lang.Integer">
|
|
SELECT
|
|
pu.id,
|
|
0 AS pid,
|
|
pu.`NAME`
|
|
FROM
|
|
pm_user pu
|
|
LEFT JOIN
|
|
pm_organization po
|
|
ON
|
|
po.technician = pu.id
|
|
LEFT JOIN
|
|
ma_team_type mtt
|
|
ON
|
|
po.id = mtt.team_id
|
|
WHERE
|
|
mtt.type_id = #{0}
|
|
UNION
|
|
SELECT
|
|
pu.id,
|
|
0 AS pid,
|
|
pu.`NAME`
|
|
FROM
|
|
pm_user pu
|
|
LEFT JOIN
|
|
ma_team_type mtt
|
|
ON
|
|
pu.ORG_ID = mtt.team_id
|
|
WHERE
|
|
mtt.type_id = #{0}
|
|
UNION
|
|
SELECT
|
|
pu.id,
|
|
0 AS pid,
|
|
pu.`NAME`
|
|
FROM
|
|
pm_user pu
|
|
LEFT JOIN
|
|
ma_team_type mtt
|
|
ON
|
|
pu.ORG_ID = mtt.team_id
|
|
WHERE
|
|
mtt.type_id = #{0}
|
|
</select>
|
|
|
|
<select id="getnum" parameterType="String" resultMap="BaseResultMap">
|
|
select * from pm_user where telphone=#{0}
|
|
</select>
|
|
|
|
<select id="findBuyersList" resultMap="BaseResultMap">
|
|
SELECT
|
|
pu.*
|
|
FROM
|
|
pm_user pu
|
|
LEFT JOIN
|
|
pm_new_role_user pnr
|
|
ON
|
|
pu.ID = pnr.user_id
|
|
WHERE
|
|
pnr.role_id = 4 AND IS_ACTIVE = '1'
|
|
</select>
|
|
|
|
|
|
<select id="findPerson" resultMap="ZNode" parameterType="com.bonus.sys.beans.UserBean">
|
|
|
|
|
|
SELECT ID,`NAME`,'0' as pId
|
|
FROM pm_user
|
|
WHERE IS_ACTIVE = '1' and ORG_ID = 11
|
|
<if test="name != null and name != ''">
|
|
and `NAME` like concat('%',#{name},'%')
|
|
</if>
|
|
</select>
|
|
|
|
<select id="findRepairTeam" resultMap="ZNode" parameterType="com.bonus.sys.beans.UserBean">
|
|
SELECT ID as id ,`NAME` as name,'0' as pId from pm_organization
|
|
WHERE PARENT_ID = 5 and IS_ACTIVE = 1
|
|
</select>
|
|
|
|
|
|
<select id="findAllKeeper" resultMap="webUserResultMap" parameterType="com.bonus.sys.beans.UserBean">
|
|
|
|
|
|
SELECT ID,`NAME`,'0' as pId
|
|
FROM pm_user
|
|
WHERE IS_ACTIVE = '1' and ORG_ID = 11
|
|
|
|
</select>
|
|
|
|
<select id="getRepairOrg" resultMap="webUserResultMap" parameterType="com.bonus.sys.beans.UserBean">
|
|
|
|
SELECT ID as id ,`NAME` as name from pm_organization
|
|
WHERE PARENT_ID = 5
|
|
|
|
</select>
|
|
|
|
<select id="findNewRole" resultMap="ZNode" parameterType="com.bonus.sys.beans.UserBean">
|
|
SELECT ID ,`NAME` ,'0' as pId
|
|
FROM pm_new_role
|
|
WHERE del_flag = 0
|
|
</select>
|
|
|
|
<select id="clientUnitTree" resultMap="ZNode" parameterType="com.bonus.sys.beans.UserBean">
|
|
SELECT *
|
|
FROM (
|
|
SELECT ID,`NAME`,'0' as pId
|
|
FROM pm_user
|
|
WHERE IS_ACTIVE = '1' and internal_emp = 0
|
|
) res
|
|
WHERE res.`NAME` LIKE CONCAT('%',#{name},'%')
|
|
</select>
|
|
|
|
<select id="findListByPhone" resultType="com.bonus.sys.beans.UserBean" parameterType="java.lang.String">
|
|
SELECT
|
|
u.ID,
|
|
u.login_name AS LoginName
|
|
FROM
|
|
pm_user u
|
|
where
|
|
u.telphone = #{phone}
|
|
and
|
|
u.internal_emp = 0
|
|
</select>
|
|
|
|
<select id="findAll" resultMap="BaseResultMap" parameterType="com.bonus.sys.beans.UserBean">
|
|
SELECT u.ID,
|
|
u.NAME,
|
|
u.ORG_ID as orgId,
|
|
o.parent_id AS orgParentId,
|
|
o.NAME as orgName,
|
|
LOGIN_NAME,
|
|
PIC_URL,SKIN,
|
|
SALT,PASSWD,
|
|
SEX,MAIL,QQ,
|
|
TELPHONE,
|
|
green_score as greenScore,
|
|
CREATE_TIME,
|
|
UPDATE_TIME,
|
|
u.OFFICE_ADDRESS as officeAddress,
|
|
u.IS_ACTIVE
|
|
FROM pm_user u
|
|
left join pm_organization o on u.ORG_ID=o.ID
|
|
where
|
|
u.IS_ACTIVE='1'
|
|
AND
|
|
LOGIN_NAME = #{telphone}
|
|
AND
|
|
u.internal_emp = 1
|
|
</select>
|
|
|
|
<select id="findAllByRole" resultMap="BaseResultMap" parameterType="com.bonus.sys.beans.UserBean">
|
|
SELECT u.ID,u.NAME,u.ORG_ID,o.NAME as
|
|
ORG_NAME,LOGIN_NAME,PIC_URL,SKIN,SALT,PASSWD,SEX,MAIL,QQ,TELPHONE,CREATE_TIME,UPDATE_TIME,u.green_score as greenScore,
|
|
if(ur.role_id > 0,1,0) as IS_ACTIVE,u.OFFICE_ADDRESS as officeAddress
|
|
FROM pm_user u left join pm_user_role ur on u.id = ur.user_id and
|
|
ur.role_id=#{roleId}
|
|
left join pm_organization o on u.ORG_ID=o.ID
|
|
where u.IS_ACTIVE='1'
|
|
<if test="keyWord!= null">
|
|
AND (u.NAME LIKE CONCAT('%',#{keyWord},'%')
|
|
OR o.NAME LIKE CONCAT('%',#{keyWord},'%')
|
|
)
|
|
</if>
|
|
ORDER BY o.NAME desc
|
|
</select>
|
|
|
|
<select id="findAllByNewRole" resultMap="BaseResultMap" parameterType="com.bonus.sys.beans.UserBean">
|
|
SELECT
|
|
u.ID AS id,
|
|
u.`NAME` AS `name`
|
|
FROM
|
|
pm_user u
|
|
LEFT JOIN pm_new_role_user ru ON u.ID = ru.user_id
|
|
WHERE
|
|
ru.role_id = #{role.id} AND u.IS_ACTIVE='1'
|
|
</select>
|
|
|
|
|
|
|
|
|
|
|
|
<select id="findByPage" resultMap="BaseResultMap" parameterType="com.bonus.sys.beans.UserBean">
|
|
SELECT DISTINCT sys.`name` as team, u.ID,u.NAME,u.ORG_ID,o.NAME AS ORG_NAME,LOGIN_NAME,PIC_URL,SKIN,SALT,u.green_score as greenScore,
|
|
PASSWD,SEX,MAIL,QQ,TELPHONE,CREATE_TIME,UPDATE_TIME,
|
|
u.OFFICE_ADDRESS AS officeAddress,u.IS_ACTIVE,u.job_number AS jobNumber
|
|
FROM pm_user u
|
|
LEFT JOIN pm_organization o ON u.ORG_ID = o.ID
|
|
LEFT JOIN sys_data_dict sys ON u.type=sys.id
|
|
WHERE u.ORG_ID=o.ID AND u.IS_ACTIVE='1'
|
|
<if test="param.loginName != null and param.loginName!='' ">
|
|
AND LOGIN_NAME LIKE CONCAT('%',#{param.loginName},'%')
|
|
</if>
|
|
<if test="param.internalEmp != null">
|
|
AND u.internal_emp = #{param.internalEmp}
|
|
</if>
|
|
<if test="param.keyWord!= null">
|
|
AND (
|
|
LOGIN_NAME LIKE CONCAT('%',#{param.keyWord},'%')
|
|
OR u.NAME LIKE CONCAT('%',#{param.keyWord},'%')
|
|
OR MAIL LIKE CONCAT('%',#{param.keyWord},'%')
|
|
OR o.NAME LIKE CONCAT('%',#{param.keyWord},'%')
|
|
OR u.OFFICE_ADDRESS LIKE CONCAT('%',#{param.keyWord},'%')
|
|
)
|
|
</if>
|
|
<if test="param.sex != null">
|
|
AND SEX=#{param.sex}
|
|
</if>
|
|
ORDER BY CREATE_TIME desc
|
|
</select>
|
|
|
|
<select id="findByPageOfNew" resultMap="baseMap" parameterType="com.bonus.sys.beans.UserBean">
|
|
SELECT
|
|
pu.id,
|
|
pu.`name`,
|
|
pu.LOGIN_NAME AS loginName,
|
|
IF(pu.sex = 1,'男','女') as sex,
|
|
pu.mail,
|
|
pu.telphone,
|
|
pu.CREATE_TIME AS createTime,
|
|
pu.IS_ACTIVE AS isActive,
|
|
pu.job_number AS jobNumber,
|
|
pu.green_score AS greenScore,
|
|
po.ID AS orgId,
|
|
pnr.id AS pnrId,
|
|
pnr.`name` AS pnrName,
|
|
CONCAT(pooo.`NAME`,'/',poo.`NAME`,'/',po.`NAME`) as totalName
|
|
FROM
|
|
pm_user pu
|
|
LEFT JOIN pm_organization po ON po.ID = pu.ORG_ID
|
|
LEFT JOIN pm_organization poo ON poo.ID = po.PARENT_ID
|
|
LEFT JOIN pm_organization pooo ON pooo.ID = poo.PARENT_ID
|
|
LEFT JOIN pm_new_role_user re ON re.user_id = pu.id
|
|
LEFT JOIN pm_new_role pnr ON pnr.id = re.role_id
|
|
WHERE
|
|
pu.IS_ACTIVE = 1
|
|
<if test="param.keyWord!= null">
|
|
AND (
|
|
pu.LOGIN_NAME LIKE CONCAT('%',#{param.keyWord},'%')
|
|
OR pu.NAME LIKE CONCAT('%',#{param.keyWord},'%')
|
|
OR pu.MAIL LIKE CONCAT('%',#{param.keyWord},'%')
|
|
OR po.NAME LIKE CONCAT('%',#{param.keyWord},'%')
|
|
OR pnr.`NAME` LIKE CONCAT('%',#{param.keyWord},'%')
|
|
OR pu.telphone LIKE CONCAT('%',#{param.keyWord},'%')
|
|
OR pu.job_number LIKE CONCAT('%',#{param.keyWord},'%')
|
|
)
|
|
</if>
|
|
<if test="param.orgId!= null">
|
|
and pu.ORG_ID=#{orgId}
|
|
</if>
|
|
ORDER BY pu.ID desc
|
|
|
|
</select>
|
|
|
|
<!-- 这方法能获取密码和盐 -->
|
|
<select id="findUserBeanByLoginName" resultMap="BaseResultMap" parameterType="String">
|
|
<![CDATA[
|
|
SELECT a.*,
|
|
a.identity_state AS identityState,
|
|
a.internal_emp AS internalEmp,
|
|
a.brother AS brother,
|
|
a.green_score AS greenScore,
|
|
pmo.`NAME` as orgName
|
|
FROM pm_user a
|
|
LEFT JOIN pm_organization pmo on pmo.ID = a.ORG_ID
|
|
WHERE
|
|
a.IS_ACTIVE='1'
|
|
AND
|
|
a.LOGIN_NAME=#{loginName,jdbcType=VARCHAR}
|
|
]]>
|
|
</select>
|
|
|
|
|
|
|
|
<select id="find" resultMap="BaseResultMap">
|
|
SELECT u.ID,
|
|
u.NAME,
|
|
u.ORG_ID,
|
|
u.green_score AS greenScore,
|
|
o.NAME AS ORG_NAME,
|
|
LOGIN_NAME,
|
|
PIC_URL,
|
|
SKIN,
|
|
SALT,
|
|
PASSWD,
|
|
SEX,
|
|
MAIL,
|
|
QQ,
|
|
TELPHONE,
|
|
u.CREATE_TIME,
|
|
UPDATE_TIME,
|
|
u.OFFICE_ADDRESS AS officeAddress,
|
|
u.IS_ACTIVE,u.job_number AS jobNumber,
|
|
GROUP_CONCAT(pnr.`name`) AS roleName
|
|
FROM pm_user u
|
|
LEFT JOIN pm_organization o ON u.ORG_ID = o.ID
|
|
LEFT JOIN pm_new_role_user pru ON u.ID = pru.user_id
|
|
LEFT JOIN pm_new_role pnr ON pru.role_id = pnr.id
|
|
WHERE
|
|
u.ORG_ID=o.ID
|
|
AND
|
|
u.IS_ACTIVE='1'
|
|
<if test="loginName != null and loginName!='' ">
|
|
and LOGIN_NAME=#{loginName}
|
|
</if>
|
|
<if test="id != null ">
|
|
and u.ID=#{id}
|
|
</if>
|
|
</select>
|
|
|
|
<select id="selectByPrimaryKey" resultMap="BaseResultMap"
|
|
parameterType="java.lang.Integer">
|
|
select
|
|
ID,NAME,ORG_ID,LOGIN_NAME,PIC_URL,SKIN,SALT,PASSWD,SEX,MAIL,QQ,TELPHONE,CREATE_TIME,UPDATE_TIME,IS_ACTIVE
|
|
from pm_user
|
|
where ID = #{id,jdbcType=INTEGER} and IS_ACTIVE = 1
|
|
</select>
|
|
|
|
<delete id="deleteByPrimaryKey" parameterType="com.bonus.sys.beans.UserBean">
|
|
delete from pm_user
|
|
where ID = #{id,jdbcType=INTEGER}
|
|
</delete>
|
|
|
|
<delete id="deleteUserRole" parameterType="com.bonus.sys.beans.UserBean">
|
|
delete from
|
|
pm_user_role
|
|
where role_id = #{roleId,jdbcType=INTEGER}
|
|
</delete>
|
|
|
|
<delete id="delete" parameterType="com.bonus.sys.beans.UserBean">
|
|
update pm_user set IS_ACTIVE = 0
|
|
where ID = #{id,jdbcType=INTEGER}
|
|
</delete>
|
|
|
|
<select id="findCountByLoginName" resultType="int">
|
|
SELECT COUNT(*)
|
|
FROM pm_user
|
|
WHERE LOGIN_NAME=#{loginName} and IS_ACTIVE='1'
|
|
</select>
|
|
|
|
<select id="selectUser" parameterType="String" resultMap="BaseResultMap">
|
|
select * from pm_user WHERE LOGIN_NAME=#{loginName}
|
|
</select>
|
|
|
|
<insert id="insertUserRole" parameterType="com.bonus.sys.beans.UserBean">
|
|
insert into pm_user_role (USER_ID,ROLE_ID) values
|
|
(#{id,jdbcType=INTEGER},#{roleId,jdbcType=INTEGER})
|
|
</insert>
|
|
|
|
<insert id="insertBean" parameterType="com.bonus.sys.beans.UserBean">
|
|
insert into pm_user (NAME, ORG_ID,
|
|
LOGIN_NAME, PIC_URL,
|
|
SKIN,
|
|
SALT, PASSWD,
|
|
SEX, MAIL, QQ, TELPHONE,
|
|
CREATE_TIME, UPDATE_TIME,
|
|
OFFICE_ADDRESS,
|
|
type,
|
|
IS_ACTIVE,identity_state,internal_emp,brother
|
|
)
|
|
values (#{name,jdbcType=VARCHAR},
|
|
#{orgId,jdbcType=INTEGER},
|
|
#{loginName,jdbcType=VARCHAR},"/SCEquipWeb/static/css/sys/images/user/hpic0.jpg",
|
|
"skin-0", #{salt,jdbcType=VARCHAR},
|
|
#{passwd,jdbcType=VARCHAR},
|
|
#{sex,jdbcType=CHAR}, #{mail,jdbcType=VARCHAR},
|
|
#{qq,jdbcType=VARCHAR},
|
|
#{telphone,jdbcType=VARCHAR},
|
|
#{createTime,jdbcType=DATE}, #{updateTime,jdbcType=DATE},
|
|
#{officeAddress,jdbcType=VARCHAR}, #{type.id,jdbcType=INTEGER},
|
|
"1",
|
|
#{identityState,jdbcType=VARCHAR},
|
|
#{internalEmp,jdbcType=INTEGER},
|
|
#{brother,jdbcType=INTEGER}
|
|
)
|
|
<selectKey resultType="int" keyProperty="id">
|
|
SELECT
|
|
last_insert_id() as ID;
|
|
</selectKey>
|
|
</insert>
|
|
|
|
<delete id="deleteBatch" parameterType="java.util.List">
|
|
update FROM pm_user set IS_ACTIVE = 0 WHERE id in(
|
|
<foreach item="o" collection="list" open="" separator=","
|
|
close="">
|
|
#{o.id}
|
|
</foreach>
|
|
)
|
|
</delete>
|
|
|
|
<insert id="insertSelective" parameterType="com.bonus.sys.beans.UserBean" useGeneratedKeys="true" keyProperty="id">
|
|
insert into pm_user
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
<if test="name != null">
|
|
NAME,
|
|
</if>
|
|
<if test="orgId != null">
|
|
ORG_ID,
|
|
</if>
|
|
<if test="loginName != null">
|
|
LOGIN_NAME,
|
|
</if>
|
|
PIC_URL,
|
|
SKIN,
|
|
<if test="salt != null">
|
|
SALT,
|
|
</if>
|
|
<if test="passwd != null">
|
|
PASSWD,
|
|
</if>
|
|
<if test="sex != null">
|
|
SEX,
|
|
</if>
|
|
<if test="mail != null">
|
|
MAIL,
|
|
</if>
|
|
<if test="qq != null">
|
|
QQ,
|
|
</if>
|
|
<if test="telphone != null">
|
|
TELPHONE,
|
|
</if>
|
|
<if test="createTime != null">
|
|
CREATE_TIME,
|
|
</if>
|
|
<if test="updateTime != null">
|
|
UPDATE_TIME,
|
|
</if>
|
|
<if test="internalEmp != null">
|
|
internal_emp,
|
|
</if>
|
|
IS_ACTIVE,
|
|
<if test="greenScore != null">
|
|
green_score,
|
|
</if>
|
|
<if test="ifPermiss != null">
|
|
if_permiss,
|
|
</if>
|
|
</trim>
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
<if test="name != null">
|
|
#{name,jdbcType=VARCHAR},
|
|
</if>
|
|
<if test="orgId != null">
|
|
#{orgId,jdbcType=INTEGER},
|
|
</if>
|
|
<if test="loginName != null">
|
|
#{loginName,jdbcType=VARCHAR},
|
|
</if>
|
|
"/SCEquipWeb/static/css/sys/images/user/hpic0.jpg",
|
|
"skin-0",
|
|
<if test="salt != null">
|
|
#{salt,jdbcType=VARCHAR},
|
|
</if>
|
|
<if test="passwd != null">
|
|
#{passwd,jdbcType=VARCHAR},
|
|
</if>
|
|
<if test="sex != null">
|
|
#{sex,jdbcType=CHAR},
|
|
</if>
|
|
<if test="mail != null">
|
|
#{mail,jdbcType=VARCHAR},
|
|
</if>
|
|
<if test="qq != null">
|
|
#{qq,jdbcType=VARCHAR},
|
|
</if>
|
|
<if test="telphone != null">
|
|
#{telphone,jdbcType=VARCHAR},
|
|
</if>
|
|
<if test="createTime != null">
|
|
#{createTime,jdbcType=DATE},
|
|
</if>
|
|
<if test="updateTime != null">
|
|
#{updateTime,jdbcType=DATE},
|
|
</if>
|
|
<if test="internalEmp != null">
|
|
#{internalEmp,jdbcType=INTEGER},
|
|
</if>
|
|
1,
|
|
<if test="greenScore != null">
|
|
#{greenScore},
|
|
</if>
|
|
<if test="ifPermiss != null">
|
|
#{ifPermiss},
|
|
</if>
|
|
</trim>
|
|
</insert>
|
|
|
|
<update id="update" parameterType="com.bonus.sys.beans.UserBean">
|
|
update pm_user
|
|
<set>
|
|
<if test="name != null">
|
|
NAME = #{name,jdbcType=VARCHAR},
|
|
</if>
|
|
<if test="orgId != null">
|
|
ORG_ID = #{orgId,jdbcType=INTEGER},
|
|
</if>
|
|
<if test="loginName != null">
|
|
LOGIN_NAME = #{loginName,jdbcType=VARCHAR},
|
|
</if>
|
|
<if test="picUrl != null">
|
|
PIC_URL = #{picUrl,jdbcType=VARCHAR},
|
|
</if>
|
|
<if test="skin != null">
|
|
SKIN = #{skin,jdbcType=VARCHAR},
|
|
</if>
|
|
<if test="salt != null">
|
|
SALT = #{salt,jdbcType=VARCHAR},
|
|
</if>
|
|
<if test="jobNumber != null">
|
|
job_number = #{jobNumber,jdbcType=VARCHAR},
|
|
</if>
|
|
<if test="passwd != null">
|
|
PASSWD = #{passwd,jdbcType=VARCHAR},
|
|
</if>
|
|
<if test="sex != null">
|
|
SEX = #{sex,jdbcType=CHAR},
|
|
</if>
|
|
<if test="mail != null">
|
|
MAIL = #{mail,jdbcType=VARCHAR},
|
|
</if>
|
|
<if test="qq != null">
|
|
QQ = #{qq,jdbcType=VARCHAR},
|
|
</if>
|
|
<if test="telphone != null">
|
|
TELPHONE = #{telphone,jdbcType=VARCHAR},
|
|
</if>
|
|
<if test="createTime != null">
|
|
CREATE_TIME = #{createTime,jdbcType=DATE},
|
|
</if>
|
|
<if test="updateTime != null">
|
|
UPDATE_TIME = #{updateTime,jdbcType=DATE},
|
|
</if>
|
|
<if test="officeAddress != null">
|
|
OFFICE_ADDRESS = #{officeAddress,jdbcType=VARCHAR},
|
|
</if>
|
|
<if test="isActive != null">
|
|
IS_ACTIVE = #{isActive,jdbcType=CHAR},
|
|
</if>
|
|
<if test="type != null">
|
|
type = #{type.id,jdbcType=INTEGER},
|
|
</if>
|
|
<if test="brother != null">
|
|
brother = #{brother,jdbcType=INTEGER},
|
|
</if>
|
|
<if test="cId != null">
|
|
C_ID = #{cId,jdbcType=CHAR},
|
|
</if>
|
|
</set>
|
|
where ID = #{id,jdbcType=INTEGER}
|
|
</update>
|
|
|
|
<update id="updateByPrimaryKeySelective" parameterType="com.bonus.sys.beans.UserBean">
|
|
update pm_user
|
|
<set>
|
|
<if test="name != null">
|
|
NAME = #{name,jdbcType=VARCHAR},
|
|
</if>
|
|
<if test="orgId != null">
|
|
ORG_ID = #{orgId,jdbcType=INTEGER},
|
|
</if>
|
|
<if test="loginName != null">
|
|
LOGIN_NAME = #{loginName,jdbcType=VARCHAR},
|
|
</if>
|
|
<if test="picUrl != null">
|
|
PIC_URL = #{picUrl,jdbcType=VARCHAR},
|
|
</if>
|
|
<if test="skin != null">
|
|
SKIN = #{skin,jdbcType=VARCHAR},
|
|
</if>
|
|
<if test="salt != null">
|
|
SALT = #{salt,jdbcType=VARCHAR},
|
|
</if>
|
|
<if test="passwd != null">
|
|
PASSWD = #{passwd,jdbcType=VARCHAR},
|
|
</if>
|
|
<if test="sex != null">
|
|
SEX = #{sex,jdbcType=CHAR},
|
|
</if>
|
|
<if test="mail != null">
|
|
MAIL = #{mail,jdbcType=VARCHAR},
|
|
</if>
|
|
<if test="qq != null">
|
|
QQ = #{qq,jdbcType=VARCHAR},
|
|
</if>
|
|
<if test="telphone != null">
|
|
TELPHONE = #{telphone,jdbcType=VARCHAR},
|
|
</if>
|
|
<if test="createTime != null">
|
|
CREATE_TIME = #{createTime,jdbcType=DATE},
|
|
</if>
|
|
<if test="updateTime != null">
|
|
UPDATE_TIME = #{updateTime,jdbcType=DATE},
|
|
</if>
|
|
<if test="internalEmp != null">
|
|
internal_emp = #{internalEmp},
|
|
</if>
|
|
<if test="isActive != null">
|
|
IS_ACTIVE = #{isActive,jdbcType=CHAR},
|
|
</if>
|
|
green_score = #{greenScore},
|
|
<if test="ifPermiss != null">
|
|
if_permiss = #{ifPermiss},
|
|
</if>
|
|
</set>
|
|
where ID = #{id,jdbcType=INTEGER}
|
|
</update>
|
|
|
|
<update id="setSetting" parameterType="com.bonus.sys.beans.UserBean">
|
|
UPDATE pm_user
|
|
SET skin =#{skin}
|
|
WHERE id=#{id}
|
|
</update>
|
|
|
|
<update id="resetPwd" parameterType="com.bonus.sys.beans.UserBean">
|
|
UPDATE
|
|
pm_user
|
|
SET
|
|
passwd =#{passwd},
|
|
salt =#{salt}
|
|
WHERE
|
|
id=#{id}
|
|
</update>
|
|
|
|
<update id="updateByPrimaryKey" parameterType="com.bonus.sys.beans.UserBean">
|
|
update pm_user
|
|
set
|
|
NAME = #{name,jdbcType=VARCHAR},
|
|
ORG_ID = #{orgId,jdbcType=INTEGER},
|
|
LOGIN_NAME = #{loginName,jdbcType=VARCHAR},
|
|
PIC_URL = #{picUrl,jdbcType=VARCHAR},
|
|
SKIN = #{skin,jdbcType=VARCHAR},
|
|
SALT = #{salt,jdbcType=VARCHAR},
|
|
PASSWD = #{passwd,jdbcType=VARCHAR},
|
|
SEX = #{sex,jdbcType=CHAR},
|
|
MAIL =
|
|
#{mail,jdbcType=VARCHAR},
|
|
QQ = #{qq,jdbcType=VARCHAR},
|
|
TELPHONE =
|
|
#{telphone,jdbcType=VARCHAR},
|
|
CREATE_TIME =
|
|
#{createTime,jdbcType=DATE},
|
|
UPDATE_TIME = #{updateTime,jdbcType=DATE},
|
|
OFFICE_ADDRESS = #{officeAddress,jdbcType=VARCHAR}
|
|
IS_ACTIVE = #{isActive,jdbcType=CHAR}
|
|
where ID = #{id,jdbcType=INTEGER}
|
|
</update>
|
|
|
|
<select id="findAllUser" resultType="com.bonus.sys.beans.UserBean">
|
|
SELECT DISTINCT pmu.id,pmu.`NAME`,pmu.TELPHONE as telphone,pmo.id as orgId,pmo.`NAME` as orgName
|
|
FROM pm_user pmu
|
|
LEFT JOIN pm_organization pmo on pmo.ID = pmu.ORG_ID
|
|
WHERE ORG_ID IN (4,7,8,14) and pmu.IS_ACTIVE = 1
|
|
ORDER BY pmo.`NAME`
|
|
</select>
|
|
|
|
<select id="findAllBuyer" resultType="com.bonus.sys.beans.UserBean">
|
|
SELECT DISTINCT
|
|
pmu.id,
|
|
pmu.`NAME`,
|
|
pmu.TELPHONE AS telphone,
|
|
pmo.id AS orgId,
|
|
pmo.`NAME` AS orgName
|
|
FROM
|
|
pm_user pmu
|
|
LEFT JOIN pm_organization pmo ON pmo.ID = pmu.ORG_ID
|
|
WHERE
|
|
pmu.IS_ACTIVE = 1
|
|
ORDER BY
|
|
pmo.`NAME`
|
|
</select>
|
|
|
|
<select id="findAllKeeperForOrgId" resultType="com.bonus.sys.beans.UserBean">
|
|
SELECT DISTINCT
|
|
pmu.id,
|
|
pmu.`NAME`,
|
|
pmu.TELPHONE AS telphone,
|
|
pmo.id AS orgId,
|
|
pmo.`NAME` AS orgName,
|
|
FROM
|
|
pm_user pmu
|
|
LEFT JOIN pm_organization pmo ON pmo.ID = pmu.ORG_ID
|
|
WHERE
|
|
pmo.id = #{orgId}
|
|
AND pmu.IS_ACTIVE = 1
|
|
ORDER BY
|
|
pmo.`NAME`
|
|
</select>
|
|
|
|
<select id="findAllPerson" resultType="com.bonus.sys.beans.UserBean">
|
|
SELECT DISTINCT pmu.id,pmu.`NAME`,pmu.TELPHONE as telphone,pmo.id as orgId,
|
|
pmo.`NAME` as orgName,bsu.USER_ID
|
|
FROM pm_user pmu
|
|
LEFT JOIN pm_organization pmo on pmo.ID = pmu.ORG_ID
|
|
LEFT JOIN ba_shop_user bsu ON pmu.ID = bsu.USER_ID
|
|
WHERE ISNULL(bsu.USER_ID)
|
|
ORDER BY pmo.`NAME`
|
|
</select>
|
|
|
|
<select id="findPersonByOrgId" parameterType="java.lang.String" resultType="com.bonus.sys.beans.UserBean">
|
|
SELECT DISTINCT pmu.id,pmu.`NAME`
|
|
FROM pm_user pmu
|
|
WHERE pmu.`NAME` not like '%组' and pmu.IS_ACTIVE = 1
|
|
<if test="orgId != 6 and orgId != 1 and orgId != 2">
|
|
and pmu.ORG_ID = #{orgId}
|
|
</if>
|
|
</select>
|
|
|
|
<select id="findByUserId" resultType="com.bonus.sys.beans.UserBean">
|
|
SELECT DISTINCT pmu.id,pmu.`NAME`,pmu.TELPHONE as telphone,pmo2.ID as orgId
|
|
FROM pm_user pmu
|
|
LEFT JOIN pm_organization pmo1 on pmo1.ID = pmu.ORG_ID
|
|
LEFT JOIN pm_organization pmo2 on pmo2.ID = pmo1.PARENT_ID
|
|
WHERE pmu.id = #{userId} and pmu.IS_ACTIVE = 1
|
|
<if test="flag == 1">
|
|
and pmo1.id != 14
|
|
</if>
|
|
<if test="flag == 0">
|
|
and pmo1.id = 14
|
|
</if>
|
|
</select>
|
|
|
|
<select id="findByOrg" resultType="com.bonus.sys.beans.UserBean" parameterType="com.bonus.sys.beans.UserBean" >
|
|
SELECT u.ID,u.`NAME` FROM pm_user u
|
|
WHERE u.ORG_ID = #{orgId} AND u.IS_ACTIVE = 1
|
|
</select>
|
|
|
|
<select id="findByRepair" resultType="com.bonus.sys.beans.UserBean">
|
|
SELECT DISTINCT pmu.id,pmu.`NAME`,pmu.TELPHONE as telphone,pmo.`NAME` as orgName
|
|
FROM pm_user pmu
|
|
LEFT JOIN pm_organization pmo on pmo.ID = pmu.ORG_ID
|
|
LEFT JOIN pm_organization pmb ON pmo.PARENT_ID = pmb.ID
|
|
WHERE pmb.ID = 6 and pmu.IS_ACTIVE = 1
|
|
ORDER BY pmo.`NAME`
|
|
</select>
|
|
|
|
<select id="getUnit" resultMap="BaseResultMap" parameterType="com.bonus.sys.beans.UserBean">
|
|
SELECT o.`NAME` as orgName,u.`NAME`
|
|
FROM pm_user u
|
|
LEFT JOIN pm_organization o ON u.ORG_ID = o.ID
|
|
WHERE u.ID = #{id} and u.IS_ACTIVE = 1
|
|
</select>
|
|
|
|
<select id="findCIdByOrgId" resultMap="BaseResultMap">
|
|
SELECT *
|
|
FROM pm_user pmu
|
|
WHERE 1 = 1 and pmu.IS_ACTIVE = 1
|
|
<if test="orgId != null and orgId != ''">
|
|
and pmu.ORG_ID = #{orgId}
|
|
</if>
|
|
</select>
|
|
|
|
<update id="VerificationLogin" parameterType="com.bonus.sys.beans.UserBean">
|
|
UPDATE pm_user
|
|
SET passwd =#{passwd},
|
|
name =#{name},
|
|
salt =#{salt}
|
|
WHERE id=#{id}
|
|
</update>
|
|
|
|
<select id="getUserList" resultType="com.bonus.sys.beans.UserBean">
|
|
SELECT DISTINCT u.id as id,
|
|
u.`NAME` as name
|
|
FROM pm_user u
|
|
WHERE u.IS_ACTIVE = 1 and u.internal_emp = 0
|
|
AND u.ID NOT IN (SELECT c.user FROM bm_contract_info c WHERE c.user is not NULL)
|
|
</select>
|
|
|
|
<select id="findAllClient" resultType="com.bonus.sys.beans.UserBean">
|
|
SELECT
|
|
pu.id,
|
|
pu.`NAME`,
|
|
pu.LOGIN_NAME AS loginName,
|
|
pu.TELPHONE
|
|
FROM
|
|
pm_user pu
|
|
WHERE
|
|
pu.internal_emp = 0
|
|
AND
|
|
pu.brother = #{brother}
|
|
AND
|
|
pu.IS_ACTIVE = 1
|
|
</select>
|
|
|
|
<select id="findEmpsByOrgId" resultType="com.bonus.sys.beans.UserBean">
|
|
SELECT
|
|
pu.id,
|
|
pu.`NAME`
|
|
FROM
|
|
pm_user pu
|
|
WHERE
|
|
pu.internal_emp = 1
|
|
AND
|
|
pu.IS_ACTIVE = 1
|
|
AND
|
|
pu.org_id = #{orgId}
|
|
</select>
|
|
|
|
<select id="findCompanyList" resultType="com.bonus.sys.beans.UserBean">
|
|
SELECT
|
|
pu.id,
|
|
pu.`NAME`,
|
|
pu.brother
|
|
FROM
|
|
pm_user pu
|
|
WHERE
|
|
pu.internal_emp = 0
|
|
AND
|
|
pu.IS_ACTIVE = 1
|
|
</select>
|
|
|
|
<select id="getUserByEmp" resultType="com.bonus.sys.beans.UserBean">
|
|
SELECT
|
|
pu.id,
|
|
pu.`NAME`
|
|
FROM
|
|
pm_user pu
|
|
WHERE
|
|
pu.internal_emp = 0
|
|
AND
|
|
pu.IS_ACTIVE = 1
|
|
</select>
|
|
|
|
|
|
</mapper> |