You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
162 lines
6.6 KiB
162 lines
6.6 KiB
<?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.machine.mapper.TpmMachineProjectMapper">
|
|
<select id="queryMachinePage" resultType="com.xujie.sys.modules.machine.entity.TpmMachineProject">
|
|
select a.id,
|
|
a.site,
|
|
a.bu_no,
|
|
a.project_no,
|
|
a.project_name,
|
|
a.project_income,
|
|
a.project_budget,
|
|
a.project_actual_expenses,
|
|
a.responsible_no,
|
|
a.responsible_person,
|
|
a.start_date,
|
|
a.end_date,
|
|
a.sstatus,
|
|
a.create_by,
|
|
a.create_date,
|
|
a.update_by,
|
|
a.update_date,
|
|
a.remark,
|
|
a.bu_id,
|
|
a.object_id,
|
|
a.object_desc,
|
|
b.bu_desc
|
|
from tpm_machine_project a
|
|
left join BU b on a.bu_no = b.bu_no and b.site = a.site
|
|
<where>
|
|
a.site in (select site from eam_access_site where username = #{projectVo.createBy})
|
|
and (a.site + '-' + a.bu_no) in (select * from dbo.query_bu(#{projectVo.createBy}))
|
|
<if test="projectVo.buNo != null and projectVo.buNo != ''">
|
|
and a.bu_no = #{projectVo.buNo}
|
|
</if>
|
|
<if test="projectVo.projectNo != null and projectVo.projectNo != ''">
|
|
and a.project_no like concat('%',#{projectVo.projectNo},'%')
|
|
</if>
|
|
<if test="projectVo.projectName != null and projectVo.projectName != ''">
|
|
and a.project_name like concat('%',#{projectVo.projectName},'%')
|
|
</if>
|
|
<if test="projectVo.sstatus != null and projectVo.sstatus != ''">
|
|
and a.sstatus = #{projectVo.sstatus}
|
|
</if>
|
|
<if test="projectVo.startDate != null">
|
|
and a.start_date >= #{projectVo.startDate}
|
|
</if>
|
|
<if test="projectVo.endDate != null">
|
|
and a.start_date <= concat(#{projectVo.endDate},' 23:59:59')
|
|
</if>
|
|
</where>
|
|
order by a.id desc
|
|
</select>
|
|
|
|
<select id="queryBuSiteById" resultType="com.xujie.sys.modules.base.entity.Bu">
|
|
select id, site, bu_no, bu_desc, remark, active
|
|
from BU
|
|
where id = #{buId}
|
|
</select>
|
|
|
|
<select id="queryProjectNo" resultType="java.lang.String">
|
|
SELECT
|
|
Right('0000000000' + convert(VARCHAR(10), isnull(max(convert(INT, SUBSTRING(project_no, 4, 10))), 0) + 1), 8)
|
|
FROM tpm_machine_project
|
|
WHERE site = #{site}
|
|
</select>
|
|
<select id="searchUserAuthMachineProjectApplicationInfo"
|
|
resultType="com.xujie.sys.modules.machine.entity.TpmMachineProject">
|
|
SELECT
|
|
b.*,
|
|
b.site + '_' + b.bu_no AS bu,
|
|
dbo.get_bu_desc ( b.site, b.bu_no ) AS bu_desc,
|
|
dbo.plm_get_customer_desc ( b.site, b.responsible_person ) AS customer_desc,
|
|
dbo.plm_get_user_display ( b.site, b.project_name ) AS quoterName,
|
|
dbo.plm_get_user_display ( b.site, b.responsible_no ) AS purchaseName,
|
|
a.id AS auth_hist_id,
|
|
a.auth_user_id,
|
|
dbo.plm_get_user_display ( a.site, a.auth_user_id ) AS user_display,
|
|
a.auth_group_id,
|
|
a.step_id,
|
|
c.group_desc,
|
|
a.remark AS auth_hist_remark,
|
|
a.can_auth_flag,
|
|
a.last_step_flag,
|
|
a.record_type_db,
|
|
a.order_ref1,
|
|
a.is_simultaneous
|
|
FROM
|
|
view_all_auth_info_with_email a
|
|
LEFT JOIN tpm_machine_project b ON a.site = b.site
|
|
AND a.order_ref2 = b.bu_no
|
|
AND a.order_ref1 = b.project_no
|
|
LEFT JOIN auth_group c ON c.site = a.site
|
|
AND c.bu_no = a.order_ref2
|
|
AND c.group_no = a.auth_group_id
|
|
where
|
|
a.user_id = #{projectVo.userId}
|
|
AND a.site = #{projectVo.site}
|
|
AND a.order_ref1 LIKE concat(#{projectVo.orderRef1} ,'%')
|
|
<choose>
|
|
<when test="projectVo.sstatus != null and projectVo.sstatus != ''">
|
|
AND b.sstatus = #{projectVo.sstatus}
|
|
</when>
|
|
<otherwise>
|
|
AND a.can_auth_flag = 'Y'
|
|
</otherwise>
|
|
</choose>
|
|
|
|
<if test="projectVo.buNo != null and projectVo.buNo != ''">
|
|
AND b.bu_no = #{projectVo.buNo}
|
|
</if>
|
|
<if test="projectVo.projectNo != null and projectVo.projectNo != ''">
|
|
AND b.project_no like concat('%',#{projectVo.projectNo},'%')
|
|
</if>
|
|
<if test="projectVo.projectName != null and projectVo.projectName != ''">
|
|
AND b.project_name like concat('%',#{projectVo.projectName},'%')
|
|
</if>
|
|
<if test="projectVo.sstatus != null and projectVo.sstatus != ''">
|
|
AND b.sstatus = #{projectVo.sstatus}
|
|
</if>
|
|
<if test="projectVo.startDate != null">
|
|
AND b.start_date >= #{projectVo.startDate}
|
|
</if>
|
|
<if test="projectVo.endDate != null">
|
|
AND b.start_date <= concat(#{projectVo.endDate},' 23:59:59')
|
|
</if>
|
|
order by b.id desc,a.id desc
|
|
</select>
|
|
<select id="searchMachineProjectAuthRecords"
|
|
resultType="com.xujie.sys.modules.machine.entity.vo.MachineProjectAuthVo">
|
|
SELECT
|
|
b.project_no,
|
|
b.project_name,
|
|
b.site + '_' + b.bu_no AS bu,
|
|
dbo.get_bu_desc ( b.site, b.bu_no ) AS bu_desc,
|
|
dbo.plm_get_customer_desc ( b.site, b.responsible_person ) AS customer_desc,
|
|
dbo.plm_get_user_display ( b.site, b.project_name ) AS quoterName,
|
|
dbo.plm_get_user_display ( b.site, b.responsible_no ) AS purchaseName,
|
|
a.id AS auth_hist_id,
|
|
a.auth_user_id,
|
|
dbo.plm_get_user_display ( a.site, a.auth_user_id ) AS user_display,
|
|
a.auth_group_id,
|
|
c.group_desc,
|
|
a.act_authorize_date,
|
|
a.approve_result,
|
|
a.approve_result_comments,
|
|
a.remark AS auth_hist_remark,
|
|
a.record_type_db,
|
|
a.order_ref1
|
|
FROM
|
|
view_all_auth_info_with_email a
|
|
LEFT JOIN tpm_machine_project b ON a.site = b.site
|
|
AND a.order_ref2 = b.bu_no
|
|
AND a.order_ref1 = b.project_no
|
|
LEFT JOIN auth_group c ON c.site = a.site
|
|
AND c.bu_no = a.order_ref2
|
|
AND c.group_no = a.auth_group_id
|
|
where
|
|
a.site = #{site}
|
|
AND a.order_ref1 = #{projectNo}
|
|
</select>
|
|
</mapper>
|