|
|
<?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.xujie.sys.modules.factory.dao.SiteMapper"> <!-- 获取当前用户不包含的工厂 --> <select id="getSiteList1" resultType="SiteVo" parameterType="SiteVo"> SELECT a.siteid, a.sitename FROM site a LEFT JOIN eam_access_site b ON b.username = #{username} and a.siteid = b.site WHERE b.username is null and a.active = 'Y' </select>
<!-- 获取当前用户包含的工厂 --> <select id="getSiteList2" resultType="SiteVo" parameterType="SiteVo"> SELECT b.siteid, b.sitename FROM eam_access_site a LEFT JOIN site b ON a.site = b.siteid WHERE a.username = #{username} </select>
<!-- 查询user里是否已存在该site --> <select id="selectSiteByUserName" resultType="SiteVo"> SELECT username, site FROM eam_access_site WHERE username = #{username} and site = #{siteid} </select>
<!-- 新增user的site --> <insert id="addUserSite" parameterType="SiteVo"> INSERT INTO eam_access_site (username, site) VALUES (#{username}, #{siteid}) </insert>
<!-- 删除user的site --> <delete id="delUserSite" parameterType="SiteVo"> DELETE FROM eam_access_site WHERE username = #{username} and site = #{siteid} </delete>
<!-- 查询site --> <select id="getSite" resultType="SiteVo" parameterType="SiteVo"> SELECT a.siteid, a.sitename FROM site a LEFT JOIN eam_access_site b ON b.username = #{username} and a.siteid = b.site <where> and b.username is null and a.active = 'Y' <if test = "siteid != null and siteid != ''"> AND a.siteid LIKE '%' + #{siteid} + '%' </if> <if test = "sitename != null and sitename != ''"> AND a.sitename LIKE '%' + #{sitename} + '%' </if> </where> </select>
<!-- 查询site --> <select id="getSite2" resultType="SiteVo" parameterType="SiteVo"> SELECT a.siteid, a.sitename FROM site a LEFT JOIN eam_access_site b ON b.username = #{username} and a.siteid = b.site <where> a.active = 'Y' <if test = "siteid != null and siteid != ''"> AND a.siteid LIKE '%' + #{siteid} + '%' </if> <if test = "sitename != null and sitename != ''"> AND a.sitename LIKE '%' + #{sitename} + '%' </if> </where> </select>
<!-- 获取当前用户不包含的bu --> <select id="getBuList1" resultType="BuData" parameterType="BuData"> SELECT a.site, a.bu_no, a.bu_desc FROM BU a LEFT JOIN AccessBu b ON b.username = #{username} and a.bu_no = b.bu_no and a.site = b.site WHERE b.username is null and a.active = 'Y' </select>
<select id="getAllBuList" resultType="BuData" parameterType="BuData"> SELECT b.id, a.site, c.sitename, (a.site + '_' + a.bu_no) as buNo, b.bu_desc FROM AccessBu as a left join bu as b on a.bu_no = b.bu_no and a.site = b.site left join site as c on a.site = c.siteid WHERE a.username = #{username} </select>
<!-- 获取当前用户包含的bu --> <select id="getBuList2" resultType="BuData" parameterType="BuData"> SELECT b.site, b.bu_no, b.bu_desc FROM AccessBu a LEFT JOIN BU b ON a.site = b.site and a.bu_no = b.bu_no WHERE a.username = #{username} </select>
<!-- 查询user里是否已存在该bu --> <select id="selectBuByUserName" resultType="BuData" parameterType="BuData"> SELECT site, username, bu_no FROM AccessBu WHERE username = #{username} and site = #{site} and bu_no = #{buNo} </select>
<!-- 新增user的bu --> <insert id="addUserBu" parameterType="BuData"> INSERT INTO AccessBu (username, site, bu_no) VALUES (#{username}, #{site}, #{buNo}) </insert>
<!-- 删除user的bu --> <delete id="delUserBu" parameterType="BuData"> DELETE FROM AccessBu WHERE username = #{username} and site = #{site} and bu_no = #{buNo} </delete>
<!-- 查询bu --> <select id="getBu" resultType="BuData" parameterType="BuData"> SELECT a.site, a.bu_no, a.bu_desc FROM BU a LEFT JOIN AccessBu b ON b.username = #{username} and a.site = b.site and a.bu_no = b.bu_no <where> and b.username is null and a.active = 'Y' <if test = "site != null and site != ''"> AND a.site LIKE '%' + #{site} + '%' </if> <if test = "buNo != null and buNo != ''"> AND a.bu_no LIKE '%' + #{buNo} + '%' </if> <if test = "buDesc != null and buDesc != ''"> AND a.bu_desc LIKE '%' + #{buDesc} + '%' </if> </where> </select>
<!-- 获取当前用户不包含的部门 --> <select id="getDeptList1" resultType="SysDepartmentEntity" parameterType="SysDepartmentEntity"> SELECT a.site, a.bu_no, dbo.get_bu_desc(a.site, a.bu_no) as buDesc, a.department_id, a.department_name FROM sys_department a LEFT JOIN Access_dept b ON b.username = #{username} and a.bu_no = b.bu_no and a.site = b.site and a.department_id = b.department_id WHERE a.site in (select site from eam_access_site where username = #{username}) and (a.site + '-' + a.bu_no) in (select (a.site + '-' + a.bu_no) from AccessBu as a left join eam_access_site as b on a.site = b.site and a.username = b.username where a.username = #{username}) and b.username is null </select>
<!-- 获取当前用户包含的部门 --> <select id="getDeptList2" resultType="SysDepartmentEntity" parameterType="SysDepartmentEntity"> SELECT b.site, b.bu_no, dbo.get_bu_desc(a.site, a.bu_no) as buDesc, b.department_id, b.department_name FROM Access_dept a LEFT JOIN sys_department b ON a.site = b.site and a.bu_no = b.bu_no and a.department_id = b.department_id WHERE a.username = #{username} </select>
<!-- 查询user里是否已存在该部门 --> <select id="selectDeptByUserName" resultType="SysDepartmentEntity" parameterType="SysDepartmentEntity"> SELECT site, username, bu_no, department_id FROM Access_dept WHERE username = #{username} and site = #{site} and bu_no = #{buNo} and department_id = #{departmentId} </select>
<!-- 新增user的部门 --> <insert id="addUserDept" parameterType="SysDepartmentEntity"> INSERT INTO Access_dept (username, site, bu_no, department_id) VALUES (#{username}, #{site}, #{buNo}, #{departmentId}) </insert>
<!-- 删除user的部门 --> <delete id="delUserDept" parameterType="SysDepartmentEntity"> DELETE FROM Access_dept WHERE username = #{username} and site = #{site} and bu_no = #{buNo} and department_id = #{departmentId} </delete>
<!-- 查询部门 --> <select id="getDept" resultType="SysDepartmentEntity" parameterType="SysDepartmentEntity"> SELECT a.site, a.bu_no, dbo.get_bu_desc(a.site, a.bu_no) as buDesc, a.department_id, a.department_name FROM sys_department a LEFT JOIN Access_dept b ON b.username = #{username} and a.site = b.site and a.bu_no = b.bu_no and a.department_id = b.department_id <where> a.site in (select site from eam_access_site where username = #{username}) and (a.site + '-' + a.bu_no) in (select (a.site + '-' + a.bu_no) from AccessBu as a left join eam_access_site as b on a.site = b.site and a.username = b.username where a.username = #{username}) and b.username is null <if test = "departmentId != null and departmentId != ''"> AND a.department_id LIKE '%' + #{departmentId} + '%' </if> <if test = "departmentName != null and departmentName != ''"> AND a.departmen_name LIKE '%' + #{departmentName} + '%' </if> </where> </select>
<!-- 获取当前用户不包含的角色 --> <select id="getBusinessRoleList1" resultType="com.xujie.sys.modules.factory.entity.vo.BusinessRoleVo"> SELECT a.site, a.role_no, a.role_desc FROM business_role a left join access_role b on a.site=b.site and a.role_no = b.role_no and b.username = #{username} WHERE a.site in (select site from eam_access_site where username = #{username}) and b.username is null <if test = "site != null and site != ''"> AND a.site = #{site} </if> </select>
<!-- 获取当前用户包含的角色 --> <select id="getBusinessRoleList2" resultType="com.xujie.sys.modules.factory.entity.vo.BusinessRoleVo"> SELECT b.site, b.role_no, b.role_desc FROM access_role a LEFT JOIN business_role b ON a.site = b.site and a.role_no = b.role_no WHERE a.username = #{username} </select> <select id="selectBusinessRoleByUserName" resultType="com.xujie.sys.modules.factory.entity.vo.BusinessRoleVo"> SELECT site, username, role_no FROM access_role WHERE username = #{username} and site = #{site} and role_no = #{roleNo} </select> <insert id="addUserBusinessRole" parameterType="com.xujie.sys.modules.factory.entity.vo.BusinessRoleVo"> INSERT INTO access_role (username, site, role_no) VALUES (#{username}, #{site}, #{roleNo}) </insert> <delete id="delUserBusinessRole" parameterType="com.xujie.sys.modules.factory.entity.vo.BusinessRoleVo"> DELETE FROM access_role WHERE username = #{username} and site = #{site} and role_no = #{roleNo} </delete>
<select id="searchBusinessInfo" resultType="com.xujie.sys.modules.factory.entity.vo.BusinessRoleVo"> SELECT B.role_no, U.username,U.user_display,B.active FROM business_role B JOIN access_role A ON B.site = A.site AND B.role_no = A.role_no JOIN sys_user U ON A.username = U.username AND B.site = U.site <where> a.site = #{site} and B.active = 'Y' AND b.role_desc = 'PM/Sales' <if test="roleDesc!= null and roleDesc != ''"> AND B.role_desc LIKE '%' + #{roleDesc} + '%' </if> <if test="userDisplay != null and userDisplay != ''"> AND U.user_display LIKE '%' + #{userDisplay} + '%' </if> </where> </select> <select id="searchBusinessInfo1" resultType="com.xujie.sys.modules.factory.entity.vo.BusinessRoleVo"> SELECT B.role_no, U.username,U.user_display,B.active FROM business_role B JOIN access_role A ON B.site = A.site AND B.role_no = A.role_no JOIN sys_user U ON A.username = U.username AND B.site = U.site <where> a.site = #{site} and B.active = 'Y' AND B.role_desc = 'PjM' <if test="roleDesc!= null and roleDesc != ''"> AND B.role_desc LIKE '%' + #{roleDesc} + '%' </if> <if test="userDisplay != null and userDisplay != ''"> AND U.user_display LIKE '%' + #{userDisplay} + '%' </if> </where> </select> <select id="searchBusinessInfo2" resultType="com.xujie.sys.modules.factory.entity.vo.BusinessRoleVo"> SELECT B.role_no, U.username,U.user_display,B.active FROM business_role B JOIN access_role A ON B.site = A.site AND B.role_no = A.role_no JOIN sys_user U ON A.username = U.username AND B.site = U.site <where> a.site = #{site} and B.active = 'Y' AND B.role_desc = 'IPQC-Lam/Pri/Etch/Slit' <if test="roleDesc!= null and roleDesc != ''"> AND B.role_desc LIKE '%' + #{roleDesc} + '%' </if> <if test="userDisplay != null and userDisplay != ''"> AND U.user_display LIKE '%' + #{userDisplay} + '%' </if> </where> </select> <select id="searchBusinessInfo3" resultType="com.xujie.sys.modules.factory.entity.vo.BusinessRoleVo"> SELECT B.role_no, U.username,U.user_display,B.active FROM business_role B JOIN access_role A ON B.site = A.site AND B.role_no = A.role_no JOIN sys_user U ON A.username = U.username AND B.site = U.site <where> a.site = #{site} and B.active = 'Y' AND B.role_desc = 'IPQC-Converting' <if test="roleDesc!= null and roleDesc != ''"> AND B.role_desc LIKE '%' + #{roleDesc} + '%' </if> <if test="userDisplay != null and userDisplay != ''"> AND U.user_display LIKE '%' + #{userDisplay} + '%' </if> </where> </select> <select id="searchBusinessInfo4" resultType="com.xujie.sys.modules.factory.entity.vo.BusinessRoleVo"> SELECT B.role_no, U.username,U.user_display,B.active FROM business_role B JOIN access_role A ON B.site = A.site AND B.role_no = A.role_no JOIN sys_user U ON A.username = U.username AND B.site = U.site <where> a.site = #{site} and B.active = 'Y' AND B.role_desc = 'FQC1' <if test="roleDesc!= null and roleDesc != ''"> AND B.role_desc LIKE '%' + #{roleDesc} + '%' </if> <if test="userDisplay != null and userDisplay != ''"> AND U.user_display LIKE '%' + #{userDisplay} + '%' </if> </where> </select> <select id="searchBusinessInfo5" resultType="com.xujie.sys.modules.factory.entity.vo.BusinessRoleVo"> SELECT B.role_no, U.username,U.user_display,B.active FROM business_role B JOIN access_role A ON B.site = A.site AND B.role_no = A.role_no JOIN sys_user U ON A.username = U.username AND B.site = U.site <where> a.site = #{site} and B.active = 'Y' AND B.role_desc = 'MFG' <if test="roleDesc!= null and roleDesc != ''"> AND B.role_desc LIKE '%' + #{roleDesc} + '%' </if> <if test="userDisplay != null and userDisplay != ''"> AND U.user_display LIKE '%' + #{userDisplay} + '%' </if> </where> </select> <select id="searchBusinessInfo6" resultType="com.xujie.sys.modules.factory.entity.vo.BusinessRoleVo"> SELECT B.role_no, U.username,U.user_display,B.active FROM business_role B JOIN access_role A ON B.site = A.site AND B.role_no = A.role_no JOIN sys_user U ON A.username = U.username AND B.site = U.site <where> a.site = #{site} and B.active = 'Y' AND B.role_desc = 'engineer' <if test="roleDesc!= null and roleDesc != ''"> AND B.role_desc LIKE '%' + #{roleDesc} + '%' </if> <if test="userDisplay != null and userDisplay != ''"> AND U.user_display LIKE '%' + #{userDisplay} + '%' </if> </where> </select> <select id="searchBusinessInfo7" resultType="com.xujie.sys.modules.factory.entity.vo.BusinessRoleVo"> SELECT B.role_no, U.username,U.user_display,B.active FROM business_role B JOIN access_role A ON B.site = A.site AND B.role_no = A.role_no JOIN sys_user U ON A.username = U.username AND B.site = U.site <where> a.site = #{site} and B.active = 'Y' AND B.role_desc = 'DocEngineer' <if test="roleDesc!= null and roleDesc != ''"> AND B.role_desc LIKE '%' + #{roleDesc} + '%' </if> <if test="userDisplay != null and userDisplay != ''"> AND U.user_display LIKE '%' + #{userDisplay} + '%' </if> </where> </select> <select id="searchBusinessInfo8" resultType="com.xujie.sys.modules.factory.entity.vo.BusinessRoleVo"> SELECT B.role_no, U.username,U.user_display,B.active FROM business_role B JOIN access_role A ON B.site = A.site AND B.role_no = A.role_no JOIN sys_user U ON A.username = U.username AND B.site = U.site <where> a.site = #{site} and B.active = 'Y' AND B.role_desc = 'DocEngineer2' <if test="roleDesc!= null and roleDesc != ''"> AND B.role_desc LIKE '%' + #{roleDesc} + '%' </if> <if test="userDisplay != null and userDisplay != ''"> AND U.user_display LIKE '%' + #{userDisplay} + '%' </if> </where> </select> <select id="getResponsibleDepartment" resultType="com.xujie.sys.modules.factory.entity.vo.BusinessRoleVo"> SELECT a.site, a.role_no, a.role_desc FROM business_role a WHERE a.site = #{site} and a.active = 'Y' </select>
<select id="getEamWorkShop" resultType="com.xujie.sys.modules.orderIssure.vo.EamWorkShop"> select WorkShopId,WorkShopName,remark from eam_WorkShop </select>
<!-- 查询部门列表 --> <select id="getEmpyDeptList" resultType="com.xujie.sys.modules.pms.data.EmpyDept" parameterType="com.xujie.sys.modules.pms.data.EmpyDept"> SELECT site, dept_id, dept_name FROM view_empy_dept <where> site in (select site from eam_access_site where username = #{userName}) <if test = "deptId != null and deptId != ''"> AND dept_id LIKE '%' + #{deptId} + '%' </if> <if test = "deptName != null and deptName != ''"> AND dept_name LIKE '%' + #{deptName} + '%' </if> </where> </select></mapper>
|