gz_smz_android_manager/target/classes/mappers/offline/OffLineMapper.xml

104 lines
4.2 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.gzrn.rnama.offline.dao.OffLineDao">
<select id="getPro" resultType="com.bonus.gzrn.rnama.offline.entity.ProjectBean" parameterType="com.bonus.gzrn.rnama.offline.entity.ProjectBean">
select p.id,name,ABBREVIATION,org_id as orgId,PRO_TYPE as proType,lon,lat,UPDATE_TIME as updateTime,IS_ACTIVE as isActive
from bm_project p
<if test = 'type == "3"'>
where p.id = #{id}
</if>
<if test = 'type == "4"'>
left join bm_sub_pro_relation bspr on bspr.pro_id = p.id
where bspr.sub_id = #{subId}
<!-- <if test = 'orgType == 2'>-->
<!-- and org_id = #{orgId}-->
<!-- </if>-->
<!-- <if test = 'orgType == 1'>-->
<!-- and company_id = #{companyId}-->
<!-- </if>-->
</if>
and status = '在建' and is_active = 1
</select>
<select id="getWorkSceneByProId" resultType="com.bonus.gzrn.rnama.offline.entity.WorkSceneBean" parameterType="com.bonus.gzrn.rnama.offline.entity.WorkSceneBean">
select id,name,lon,lat,UPDATE_TIME as updateTime,pro_id as proId,order_num as sort,is_active as isActive from
bm_work_scene where pro_id = #{proId} and is_active = 1
</select>
<select id="getSubcontractor" resultType="com.bonus.gzrn.rnama.offline.entity.SubcontractorBean">
-- select id,sub_name as name,represent,re_contact as reContact,id_number as idNumber,
-- UPDATE_TIME as updateTime,is_active as isActive,
-- SIGNATURE_URL as signUrl,SEAL_URL as sealUrl,
-- ADDRESS
-- from bm_subcontractor where is_active = 1 and AUDIT_RESULT = 1
select bs.id,sub_name as name,represent,re_contact as reContact,id_number as idNumber,
UPDATE_TIME as updateTime,is_active as isActive,
SIGNATURE_URL as signUrl,SEAL_URL as sealUrl,
ADDRESS,bspr.proId
from bm_subcontractor bs
left join (
select sub_id as subId,GROUP_CONCAT(IFNULL(pro_id,'0')) as proId
from bm_sub_pro_relation GROUP BY sub_id
) bspr on bspr.subId = bs.id
where is_active = 1 and AUDIT_RESULT = 1 and bs.SUB_NAME is not null
and proId is not null
</select>
<select id="getSubTeam" resultType="com.bonus.gzrn.rnama.offline.entity.SubTeamBean" parameterType="com.bonus.gzrn.rnama.offline.entity.SubTeamBean">
select id,name,sub_id as subId,ein_time as einTime,exit_time as exitTime,UPDATE_TIME as updateTime,is_active as isActive from
bm_sub_team where is_active = 1
</select>
<select id="getWorkType" resultType="com.bonus.gzrn.rnama.offline.entity.WorkTypeBean">
select sdd.id,sdd.name as type,sdt.name as code,sdd.is_active as isActive from sys_dic_detail sdd
left join sys_dic_type sdt on sdt.id = sdd.dic_type
where sdd.is_active = 1 and sdt.is_active = 1
</select>
<select id="getOrg" resultType="com.bonus.gzrn.rnama.offline.entity.ProjectBean">
select id,name,UPDATE_TIME as updateTime,is_active as isActive from
pm_organization where is_active = 1
</select>
<select id="selectOrgList" resultType="com.bonus.gzrn.rnama.offline.entity.OrgCompanyBean">
select 0 as id,'公司' as name,'-1' as pId,
'0' as companyId,'1' as isActive from t_dict
union
select id,name,PARENT_ID as pId,
COMPANY_ID as companyId,IS_ACTIVE as isActive
from pm_organization
where IS_ACTIVE = 1
</select>
<select id="selectRole" resultType="com.bonus.gzrn.rnama.offline.entity.WorkTypeBean">
select id,name as type,type as code,updateTime,is_active as isActive
from sys_role
where company_id = (
select company_id from pm_organization
where id = #{id} and is_active = 1
)
and is_active = 1 and status = 1
</select>
<select id="selectPro" resultType="com.bonus.gzrn.rnama.offline.entity.ProjectBean">
select id,abbreviation as name
from bm_project
where company_id = (
select company_id from pm_organization
where id = #{id} and is_active = 1
)
and is_active = 1
</select>
<select id="selectSub" resultType="com.bonus.gzrn.rnama.offline.entity.SubcontractorBean">
select id,sub_name as name from
bm_subcontractor where company_id = (
select company_id from pm_organization
where id = #{id} and is_active = 1
)
and IS_ACTIVE = 1 and AUDIT_RESULT = 1
</select>
</mapper>