Files
foton-slrs-system-rest/adc-da-slrs/src/main/resources/mybatis/mapper/sarBussionessStand/SarBussionessStandMapper.xml
T

1000 lines
47 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.adc.da.slrs.sarBussionessStand.dao.SarBussionessStandDao">
<!-- Result Map-->
<resultMap id="BaseResultMap" type="com.adc.da.slrs.sarBussionessStand.entity.SarBussionessStand" >
<id column="id" property="id" />
<result column="modify_time" property="modifyTime" />
<result column="creation_time" property="creationTime" />
<result column="valid_flag" property="validFlag" />
<result column="stand_status" property="standStatus" />
<result column="replaced_stand_num" property="replacedStandNum" />
<result column="replace_stand_num" property="replaceStandNum" />
<result column="put_time" property="putTime" />
<result column="issue_time" property="issueTime" />
<result column="stand_en_name" property="standEnName" />
<result column="stand_name" property="standName" />
<result column="stand_code" property="standCode" />
<!-- 数据库新增字段-->
<result column="apply_country" property="applyCountry" />
<result column="stand_nature" property="standNature" />
<result column="stand_sort" property="standSort" />
<result column="stand_year" property="standYear" />
<result column="text_status_buss" property="textStatusBuss" />
</resultMap>
<resultMap id="BaseResultMapExcel" type="com.adc.da.slrs.sarBussionessStand.entity.SarBussionessStand" >
<result column="replaced_stand_num" property="replacedStandNum" />
<result column="replace_stand_num" property="replaceStandNum" />
<result column="put_time" property="putTime" />
<result column="issue_time" property="issueTime" />
<result column="stand_en_name" property="standEnName" />
<result column="stand_name" property="standName" />
<result column="stand_code" property="standCode" />
<!-- 数据库新增字段-->
<result column="applyCountryShow" property="applyCountryShow" />
<result column="standNatrueShow" property="standNatrueShow" />
<result column="standSortShow" property="standSortShow" />
<result column="stand_year" property="standYear" />
<result column="text_status_buss" property="textStatusBuss" />
<result column="stand_number" property="standNumber" />
</resultMap>
<!-- SAR_BUSSIONESS_STAND table all fields -->
<sql id="Base_Column_List" >
modify_time, creation_time, valid_flag, stand_status, replaced_stand_num,replace_stand_num,
put_time, issue_time,stand_en_name,stand_name, stand_code, id,apply_country, stand_nature, stand_sort,text_status_buss,stand_number
</sql>
<sql id="Base_Column_List_show" >
SAR_BUSSIONESS_STAND.modify_time,
SAR_BUSSIONESS_STAND.creation_time, SAR_BUSSIONESS_STAND.valid_flag,
SAR_BUSSIONESS_STAND.apply_country, SAR_BUSSIONESS_STAND.stand_nature,SAR_BUSSIONESS_STAND.stand_sort,SAR_BUSSIONESS_STAND.stand_year,
stand_status, replaced_stand_num,replace_stand_num,put_time,issue_time,stand_en_name,
stand_name, stand_code,SAR_BUSSIONESS_STAND.id,SAR_BUSSIONESS_STAND.text_status_buss,SAR_BUSSIONESS_STAND.stand_number
</sql>
<sql id="Group_Column_List_show" >
stand_status, replaced_stand_num, replace_stand_num,put_time,
issue_time, stand_en_name, stand_name, stand_code,stand_status,
SAR_BUSSIONESS_STAND.id
</sql>
<!-- 查询条件 -->
<sql id="Base_Where_Clause">
where 1=1
<trim suffixOverrides="," >
<if test="modifyTime != null" >
and modify_time ${modifyTimeOperator} #{modifyTime}
</if>
<if test="modifyTime1 != null" >
and modify_time &gt;= #{modifyTime1}
</if>
<if test="modifyTime2 != null" >
and modify_time &lt;= #{modifyTime2}
</if>
<if test="creationTime != null" >
and creation_time ${creationTimeOperator} #{creationTime}
</if>
<if test="creationTime1 != null" >
and creation_time &gt;= #{creationTime1}
</if>
<if test="creationTime2 != null" >
and creation_time &lt;= #{creationTime2}
</if>
<if test="validFlag != null" >
and valid_flag ${validFlagOperator} #{validFlag}
</if>
<if test="standStatus != null" >
and stand_status ${standStatusOperator} #{standStatus}
</if>
<if test="replacedStandNum != null" >
and replaced_stand_num ${replacedStandNumOperator} #{replacedStandNum}
</if>
<if test="replaceStandNum != null" >
and replace_stand_num ${replaceStandNumOperator} #{replaceStandNum}
</if>
<if test="putTime != null" >
and put_time ${putTimeOperator} #{putTime}
</if>
<if test="putTime1 != null" >
and put_time &gt;= #{putTime1}
</if>
<if test="putTime2 != null" >
and put_time &lt;= #{putTime2}
</if>
<if test="issueTime != null" >
and issue_time ${issueTimeOperator} #{issueTime}
</if>
<if test="issueTime1 != null" >
and issue_time &gt;= #{issueTime1}
</if>
<if test="issueTime2 != null" >
and issue_time &lt;= #{issueTime2}
</if>
<if test="standEnName != null" >
and stand_en_name ${standEnNameOperator} #{standEnName}
</if>
<if test="standName != null" >
and stand_name ${standNameOperator} #{standName}
</if>
<if test="standCode != null" >
and stand_code ${standCodeOperator} #{standCode}
</if>
<if test="id != null" >
and id ${idOperator} #{id}
</if>
<!-- 数据库新加字段-->
<if test="applyCountry != null" >
and apply_country ${applyCountryOperator} #{applyCountry}
</if>
<if test="standNature != null" >
and stand_nature ${standNatureOperator} #{standNature}
</if>
<if test="standSort != null" >
and stand_sort ${standSortOperator} #{standSort}
</if>
<if test="opinionFile != null" >
and opinion_file ${opinionFileOperator} #{opinionFile}
</if>
<if test="relevanceFile != null" >
and relevance_file ${relevanceFileOperator} #{relevanceFile}
</if>
<if test="remark != null" >
and remark ${remarkOperator} #{remark}
</if>
</trim>
</sql>
<!-- 动态插入记录 主键是序列 -->
<insert id="insertSelective" parameterType="com.adc.da.slrs.sarBussionessStand.entity.SarBussionessStand" >
<!-- <selectKey resultType="java.lang.String" order="BEFORE" keyProperty="id">
SELECT SEQ_SAR_BUSSIONESS_STAND.NEXTVAL FROM DUAL
</selectKey> -->
insert into SAR_BUSSIONESS_STAND
<trim prefix="(" suffix=")" suffixOverrides="," >
<if test="modifyTime != null" >modify_time,</if>
<if test="creationTime != null" >creation_time,</if>
<if test="validFlag != null" >valid_flag,</if>
<if test="standStatus != null" >stand_status,</if>
<if test="replacedStandNum != null" >replaced_stand_num,</if>
<if test="replaceStandNum != null" >replace_stand_num,</if>
<if test="putTime != null" >put_time,</if>
<if test="issueTime != null" >issue_time,</if>
<if test="standEnName != null" >stand_en_name,</if>
<if test="standName != null" >stand_name,</if>
<if test="standCode != null" >stand_code,</if>
<if test="id != null" >id,</if>
<!--数据库新增字段-->
<if test="applyCountry != null" >apply_country,</if>
<if test="standNature != null" >stand_Nature,</if>
<if test="standSort != null" >stand_sort,</if>
<if test="standYear != null" >stand_year,</if>
<if test="standNumber != null" >stand_number,</if>
<if test="reviseStatus != null" >REVISE_STATUS,</if>
<if test="standSn != null" >STAND_SN,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides="," >
<if test="modifyTime != null" >#{modifyTime, jdbcType=TIMESTAMP},</if>
<if test="creationTime != null" >#{creationTime, jdbcType=TIMESTAMP},</if>
<if test="validFlag != null" >#{validFlag, jdbcType=INTEGER},</if>
<if test="standStatus != null" >#{standStatus, jdbcType=VARCHAR},</if>
<if test="replacedStandNum != null" >#{replacedStandNum, jdbcType=VARCHAR},</if>
<if test="replaceStandNum != null" >#{replaceStandNum, jdbcType=VARCHAR},</if>
<if test="putTime != null" >#{putTime, jdbcType=TIMESTAMP},</if>
<if test="issueTime != null" >#{issueTime, jdbcType=TIMESTAMP},</if>
<if test="standEnName != null" >#{standEnName, jdbcType=VARCHAR},</if>
<if test="standName != null" >#{standName, jdbcType=VARCHAR},</if>
<if test="standCode != null" >#{standCode, jdbcType=VARCHAR},</if>
<if test="id != null" >#{id, jdbcType=VARCHAR},</if>
<!--数据库新增字段-->
<if test="applyCountry != null" >#{applyCountry, jdbcType=VARCHAR},</if>
<if test="standNature != null" >#{standNature, jdbcType=VARCHAR},</if>
<if test="standSort != null" >#{standSort, jdbcType=VARCHAR},</if>
<if test="standYear != null" >#{standYear, jdbcType=VARCHAR},</if>
<if test="standNumber != null" >#{standNumber, jdbcType=VARCHAR},</if>
<if test="reviseStatus != null" >#{reviseStatus, jdbcType=VARCHAR},</if>
<if test="standSn != null" >#{standSn, jdbcType=VARCHAR},</if>
</trim>
</insert>
<!-- 修改记录,只修改只不为空的字段 -->
<update id="updateByPrimaryKeySelective" parameterType="com.adc.da.slrs.sarBussionessStand.entity.SarBussionessStand" >
update SAR_BUSSIONESS_STAND
<set >
<if test="modifyTime != null" >
modify_time = #{modifyTime},
</if>
<if test="creationTime != null" >
creation_time = #{creationTime},
</if>
<if test="validFlag != null" >
valid_flag = #{validFlag},
</if>
<if test="standStatus != null" >
stand_status = #{standStatus},
</if>
<if test="replacedStandNum != null" >
replaced_stand_num = #{replacedStandNum},
</if>
<if test="replaceStandNum != null" >
replace_stand_num = #{replaceStandNum},
</if>
<if test="putTime != null" >
put_time = #{putTime},
</if>
<if test="putTime == null">
put_time = null,
</if>
<if test="issueTime != null" >
issue_time = #{issueTime},
</if>
<if test="issueTime == null">
issue_time = null,
</if>
<if test="standEnName != null" >
stand_en_name = #{standEnName},
</if>
<if test="standName != null" >
stand_name = #{standName},
</if>
<if test="standCode != null" >
stand_code = #{standCode},
</if>
<!-- 数据库新加字段-->
<if test="applyCountry != null" >
apply_country = #{applyCountry},
</if>
<if test="standNature != null" >
stand_nature = #{standNature},
</if>
<if test="standSort != null" >
stand_sort = #{standSort},
</if>
<if test="standYear != null" >
stand_year = #{standYear},
</if>
<if test="standNumber != null" >
stand_number = #{standNumber},
</if>
</set>
where id = #{id}
</update>
<!-- 修改记录,只修改只不为空的字段 -->
<update id="updateByPrimaryKeySelectiveTimeNotNull" parameterType="com.adc.da.slrs.sarBussionessStand.entity.SarBussionessStand" >
update SAR_BUSSIONESS_STAND
<set >
<if test="modifyTime != null" >
modify_time = #{modifyTime},
</if>
<if test="creationTime != null" >
creation_time = #{creationTime},
</if>
<if test="validFlag != null" >
valid_flag = #{validFlag},
</if>
<if test="standStatus != null" >
stand_status = #{standStatus},
</if>
<if test="replacedStandNum != null" >
replaced_stand_num = #{replacedStandNum},
</if>
<if test="replaceStandNum != null" >
replace_stand_num = #{replaceStandNum},
</if>
<if test="putTime != null" >
put_time = #{putTime},
</if>
<if test="issueTime != null" >
issue_time = #{issueTime},
</if>
<if test="standEnName != null" >
stand_en_name = #{standEnName},
</if>
<if test="standName != null" >
stand_name = #{standName},
</if>
<if test="standCode != null" >
stand_code = #{standCode},
</if>
<!-- 数据库新加字段-->
<if test="applyCountry != null" >
apply_country = #{applyCountry},
</if>
<if test="standNature != null" >
stand_nature = #{standNature},
</if>
<if test="standSort != null" >
stand_sort = #{standSort},
</if>
<if test="standYear != null" >
stand_year = #{standYear},
</if>
<if test="standNumber != null" >
stand_number = #{standNumber},
</if>
</set>
where id = #{id}
</update>
<!-- 根据id查询 SAR_BUSSIONESS_STAND -->
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.String">
select <include refid="Base_Column_List" />
from SAR_BUSSIONESS_STAND
where id = #{value} and valid_flag=0
</select>
<select id="getStandInfoByReviseStatus" resultMap="BaseResultMap" parameterType="java.lang.String">
select LPAD(MAX(DISTINCT CAST(STAND_SN AS decimal(9)))+1, 3, 0) AS newStandSn from sar_bussioness_stand
where revise_status = #{value} and valid_flag=0
</select>
<!-- 删除记录 -->
<delete id="deleteByPrimaryKey" parameterType="java.lang.String">
delete from SAR_BUSSIONESS_STAND
where id = #{value}
</delete>
<!-- SAR_BUSSIONESS_STAND 列表总数-->
<select id="queryByCount" resultType="java.lang.Integer" parameterType="com.adc.da.base.page.BasePage">
select count(1) from SAR_BUSSIONESS_STAND
<include refid="Base_Where_Clause"/>
</select>
<!-- 查询SAR_BUSSIONESS_STAND列表 -->
<select id="queryByPage" resultMap="BaseResultMap" parameterType="com.adc.da.base.page.BasePage">
select <include refid="Base_Column_List" /> from
(select tmp_tb.* from
(select <include refid="Base_Column_List" /> from SAR_BUSSIONESS_STAND
<include refid="Base_Where_Clause"/>
<if test="pager.orderCondition != null and pager.orderCondition != ''" >
${pager.orderCondition}
</if>
) tmp_tb limit ${pager.startIndex-1},${pageSize}) a
</select>
<select id="queryByList" resultMap="BaseResultMap" parameterType="com.adc.da.base.page.BasePage">
select <include refid="Base_Column_List"/> from SAR_BUSSIONESS_STAND
<include refid="Base_Where_Clause"/>
<if test="pager.orderCondition != null and pager.orderCondition != ''" >
${pager.orderCondition}
</if>
</select>
<!-- 分页查询条件 -->
<sql id="standSort_in">
ORDER BY
<if test='orderByA != null and orderByA != "" and order1 != null and order1 != ""'>
${orderByA} ${order1},
</if>
CASE
when tmp_tb.stand_code like concat('%', 'Q/FT A', '%') THEN 0
when tmp_tb.stand_code like concat('%', 'Q/FT B', '%') THEN 1
when tmp_tb.stand_code like concat('%', 'Q/FT E', '%') THEN 2
when tmp_tb.stand_code like concat('%', 'Q/FT F', '%') THEN 3
when tmp_tb.stand_code like concat('%', 'Q/FT G', '%') THEN 4
when tmp_tb.stand_code like concat('%', 'Q/FT M', '%') THEN 5
when tmp_tb.stand_code like concat('%', 'Q/FT Q', '%') THEN 6
when tmp_tb.stand_code like concat('%', 'Q/FT R', '%') THEN 7
when tmp_tb.stand_code like concat('%', 'Q/FT S', '%') THEN 8
when tmp_tb.stand_code like concat('%', 'Q/FT T', '%') THEN 9
when tmp_tb.stand_code like concat('%', 'Q/FT V', '%') THEN 10
when tmp_tb.stand_code like concat('%', 'Q/FT X', '%') THEN 11
when tmp_tb.stand_code like concat('%', 'Q/FT Y', '%') THEN 12
when tmp_tb.stand_code like concat('%', 'Q/FT Z', '%') THEN 13
when tmp_tb.stand_code like concat('%', 'Q/QCBFC', '%') THEN 14
when tmp_tb.stand_code like concat('%', '雷萨企标Q/FL', '%') THEN 15
when tmp_tb.stand_code like concat('%', 'Q/QCFLC', '%') THEN 16
ELSE 17
END,
tmp_tb.stand_sort ASC,CAST(tmp_tb.STAND_NUMBER AS decimal(9,2)) ASC,tmp_tb.STAND_YEAR DESC,tmp_tb.id
</sql>
<sql id="standSort_out">
ORDER BY
CASE
when tmp_tb.stand_code like concat('%', 'Q/FT A', '%') THEN 0
when tmp_tb.stand_code like concat('%', 'Q/FT B', '%') THEN 1
when tmp_tb.stand_code like concat('%', 'Q/FT E', '%') THEN 2
when tmp_tb.stand_code like concat('%', 'Q/FT F', '%') THEN 3
when tmp_tb.stand_code like concat('%', 'Q/FT G', '%') THEN 4
when tmp_tb.stand_code like concat('%', 'Q/FT M', '%') THEN 5
when tmp_tb.stand_code like concat('%', 'Q/FT Q', '%') THEN 6
when tmp_tb.stand_code like concat('%', 'Q/FT R', '%') THEN 7
when tmp_tb.stand_code like concat('%', 'Q/FT S', '%') THEN 8
when tmp_tb.stand_code like concat('%', 'Q/FT T', '%') THEN 9
when tmp_tb.stand_code like concat('%', 'Q/FT V', '%') THEN 10
when tmp_tb.stand_code like concat('%', 'Q/FT X', '%') THEN 11
when tmp_tb.stand_code like concat('%', 'Q/FT Y', '%') THEN 12
when tmp_tb.stand_code like concat('%', 'Q/FT Z', '%') THEN 13
when tmp_tb.stand_code like concat('%', 'Q/QCBFC', '%') THEN 14
when tmp_tb.stand_code like concat('%', '雷萨企标Q/FL', '%') THEN 15
when tmp_tb.stand_code like concat('%', 'Q/QCFLC', '%') THEN 16
ELSE 17
END,
tmp_tb.stand_sort ASC,
tmp_tb.issue_time is null,tmp_tb.issue_time desc,tmp_tb.id
</sql>
<sql id="SarBussionInfo_Where_Clause">
left join SAR_BUSS_STAND_MENU ON SAR_BUSSIONESS_STAND.id = SAR_BUSS_STAND_MENU.buss_stand_id
left join TS_RESOURCE on SAR_BUSS_STAND_MENU.menu_id = TS_RESOURCE.id
left join SAR_BUSS_STAND_ATTR_INFO on (SAR_BUSS_STAND_ATTR_INFO.STAND_ID = SAR_BUSSIONESS_STAND.id and SAR_BUSS_STAND_ATTR_INFO.valid_flag=0)
LEFT JOIN TS_DICTYPE dicstandTextStatus ON (
dicstandTextStatus.dic_type_code = SAR_BUSSIONESS_STAND.text_status_buss
AND dicstandTextStatus.dic_id IS NOT NULL
AND dicstandTextStatus.valid_flag = 0
)
where 1=1
<trim suffixOverrides="," >
<if test="putTime!=null">
and put_time=#{putTime}
</if>
<if test="issueTime!=null">
and issue_time=#{issueTime}
</if>
<if test="textStatusBuss!=null">
and text_status_buss=#{textStatusBuss}
</if>
<if test="standCode != null" >
<!-- and (
(concat(dicstandSort.DIC_TYPE_NAME, ' ', SAR_BUSSIONESS_STAND.STAND_CODE, '-', SAR_BUSSIONESS_STAND.STAND_YEAR)
like concat('%', #{standCode}, '%') and SAR_BUSSIONESS_STAND.STAND_YEAR != '' and SAR_BUSSIONESS_STAND.STAND_YEAR is not null)
or
(concat(dicstandSort.DIC_TYPE_NAME, ' ', SAR_BUSSIONESS_STAND.STAND_CODE)
like concat('%', #{standCode}, '%') and (SAR_BUSSIONESS_STAND.STAND_YEAR = '' or SAR_BUSSIONESS_STAND.STAND_YEAR is null) )
) -->
and SAR_BUSSIONESS_STAND.STAND_CODE like concat('%', #{standCode}, '%')
or REPLACE( SAR_BUSSIONESS_STAND.STAND_CODE,' ','') like REPLACE( concat('%', #{standCode}, '%'),' ','')
</if>
<if test="numberName != null" >
and (
<!-- (concat(dicstandSort.DIC_TYPE_NAME,' ',SAR_BUSSIONESS_STAND.STAND_CODE,'-',
SAR_BUSSIONESS_STAND.STAND_YEAR) like concat(concat('%',#{numberName}),'%') and SAR_BUSSIONESS_STAND.STAND_YEAR != '' and SAR_BUSSIONESS_STAND.STAND_YEAR is not null)
or (concat(dicstandSort.DIC_TYPE_NAME,' ',SAR_BUSSIONESS_STAND.STAND_CODE) like concat(concat('%',#{numberName}),'%')
and (SAR_BUSSIONESS_STAND.STAND_YEAR = '' or SAR_BUSSIONESS_STAND.STAND_YEAR is null)) -->
SAR_BUSSIONESS_STAND.STAND_CODE like concat(concat('%',#{numberName}),'%')
or stand_name like concat(concat('%',#{numberName}),'%')
)
</if>
<if test="standName != null" >
and stand_name like concat(concat('%',#{standName}),'%')
</if>
<!-- 高级搜索项 -->
<if test="putTime1 != null" >
and DATE_FORMAT(put_time,'%Y-%m-%D') &gt;= #{putTime1}
</if>
<if test="putTime2 != null" >
and DATE_FORMAT(put_time,'%Y-%m-%D') &lt;= #{putTime2}
</if>
<if test="issueTime1 != null" >
and DATE_FORMAT(issue_time,'%Y-%m-%D') &gt;= #{issueTime1}
</if>
<if test="issueTime2 != null" >
and DATE_FORMAT(issue_time,'%Y-%m-%D') &lt;= #{issueTime2}
</if>
<!-- 日期查询 -->
<if test="startPutTime != null" >
and DATE_FORMAT(put_time,'%Y-%m-%d') &gt;= #{startPutTime}
</if>
<if test="endPutTime != null" >
and DATE_FORMAT(put_time,'%Y-%m-%d') &lt;= #{endPutTime}
</if>
<if test="startIssueTime != null" >
and DATE_FORMAT(issue_time,'%Y-%m-%d') &gt;= #{startIssueTime}
</if>
<if test="endIssueTime != null" >
and DATE_FORMAT(issue_time,'%Y-%m-%d') &lt;= #{endIssueTime}
</if>
<!-- 目录判断 -->
<if test="menuId != null and menuId !='nomenu' and menuAllChildrenIdList != null" >
and SAR_BUSS_STAND_MENU.MENU_ID in
<foreach collection="menuAllChildrenIdList" index="index" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
<!-- 游离态标准查询 -->
<!-- <if test="menuId != null and menuId =='nomenu'" >-->
<!-- and SAR_BUSS_STAND_MENU.MENU_ID = (select TS_RESOURCE.id from TS_RESOURCE WHERE parent_id is null and sor_divide ='BUSINESS_STAND' and valid_flag=0)-->
<!-- </if>-->
<!-- 当第一次进入页面未选择记录时-->
<!-- <if test="(menuId == null or menuId =='') and menuRoleList == null" >-->
<!-- and SAR_BUSS_STAND_MENU.MENU_ID in ( SELECT TS_RESOURCE.id FROM TS_RESOURCE START WITH id =(-->
<!-- SELECT TS_RESOURCE.id FROM TS_RESOURCE WHERE parent_id IS NULL AND sor_divide = 'BUSINESS_STAND' and valid_flag=0 ) CONNECT BY PRIOR id = parent_id )-->
<!-- </if>-->
<!-- 新修改需求,根据角色查询有权限的菜单数据-->
<if test="menuRoleList != null">
and SAR_BUSS_STAND_MENU.MENU_ID in
<foreach collection="menuRoleList" index="index" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
<if test="collectMenuId != null">
and SAR_BUSSIONESS_STAND.id in (
select COLLECT_RES_ID from TS_PERSON_COLLECT where TS_PERSON_COLLECT.VALID_FLAG=0
and collect_type='BUSINESS_STAND'
and TS_PERSON_COLLECT.user_id=#{userId}
)
</if>
<if test="validFlag != null" >
and SAR_BUSSIONESS_STAND.valid_flag = #{validFlag}
</if>
<!-- 导出数据过程中,选择的id -->
<if test="idlist != null" >
and SAR_BUSSIONESS_STAND.id in
<foreach collection="idlist" index="index" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
<if test="standSort != null" >
and SAR_BUSSIONESS_STAND.stand_sort = #{standSort}
</if>
<if test="replaceStandNum != null" >
and replace_stand_num like concat(concat('%',#{replaceStandNum}),'%')
</if>
<if test="standStatus != null" >
and SAR_BUSSIONESS_STAND.STAND_STATUS = #{standStatus}
</if>
<if test="standEnName != null">
and SAR_BUSSIONESS_STAND.STAND_EN_NAME like concat('%', #{standEnName},'%')
</if>
<if test="advanceSearchStr != null">
and (${advanceSearchStr})
</if>
<if test="zqcrId != null">
and (SELECT ZYQCR
FROM SAR_BUSS_STAND_ATTR_INFO
WHERE valid_flag = 0
and stand_id = SAR_BUSSIONESS_STAND.id) = #{zqcrId}
</if>
</trim>
</sql>
<!-- 根据角色分页查询条件 -->
<sql id="SarBussionInfoRole_Where_Clause">
left join TS_DICTYPE dicstandStatus ON ( dicstandStatus.dic_type_code = SAR_BUSSIONESS_STAND.TEXT_STATUS_BUSS AND dicstandStatus.dic_id IS NOT NULL and dicstandStatus.valid_flag = 0)
left join TS_DICTYPE dicstandNature ON ( dicstandNature.dic_type_code = SAR_BUSSIONESS_STAND.STAND_NATURE AND dicstandNature.dic_id IS NOT NULL and dicstandNature.valid_flag = 0)
left join TS_DICTYPE dicstandSort ON ( dicstandSort.dic_type_code = SAR_BUSSIONESS_STAND.STAND_SORT AND dicstandSort.dic_id IS NOT NULL and dicstandSort.valid_flag = 0)
left join TS_DICTYPE dicapplyCountry ON ( dicapplyCountry.dic_type_code = SAR_BUSSIONESS_STAND.APPLY_COUNTRY AND dicapplyCountry.dic_id IS NOT NULL and dicapplyCountry.valid_flag = 0)
left join SAR_BUSS_STAND_MENU ON SAR_BUSSIONESS_STAND.id = SAR_BUSS_STAND_MENU.buss_stand_id
left join TS_RESOURCE on SAR_BUSS_STAND_MENU.menu_id = TS_RESOURCE.id
where 1=1
<trim suffixOverrides="," >
<!-- 基本搜索项 -->
<if test="standCode != null" >
and stand_code like concat(concat('%',#{standCode}),'%')
</if>
<if test="standName != null" >
and stand_name like concat(concat('%',#{standName}),'%')
</if>
<!-- 高级搜索项 -->
<if test="putTime1 != null" >
-- and to_char(put_time,'YYYY-MM-DD') &gt;= #{putTime1}
and DATE_FORMAT(put_time,'%Y-%m-%D') &gt;= #{putTime1}
</if>
<if test="putTime2 != null" >
-- and to_char(put_time,'YYYY-MM-DD') &lt;= #{putTime2}
and DATE_FORMAT(put_time,'%Y-%m-%D') &lt;= #{putTime2}
</if>
<if test="issueTime1 != null" >
-- and to_char(issue_time,'YYYY-MM-DD') &gt;= #{issueTime1}
and DATE_FORMAT(issue_time,'%Y-%m-%D') &gt;= #{issueTime1}
</if>
<if test="issueTime2 != null" >
and DATE_FORMAT(issue_time,'%Y-%m-%D') &lt;= #{issueTime2}
</if>
<!-- 目录判断 -->
<if test="menuId != null and menuId !='nomenu'" >
and SAR_BUSS_STAND_MENU.MENU_ID in (
select a.* from (
select TS_RESOURCE.id from TS_RESOURCE,TS_ROLE_SAR_MENU start with id=#{menuId} connect by prior id= parent_id
)a,TS_ROLE_SAR_MENU
where a.id = TS_ROLE_SAR_MENU.SAR_MENU_ID and TS_ROLE_SAR_MENU.ROLE_ID in
<foreach collection="roleIds" index="index" item="item" open="(" separator="," close=")">
#{item}
</foreach>
GROUP BY ID
)
</if>
<!-- 游离态标准查询 -->
<if test="menuId != null and menuId =='nomenu'" >
and SAR_BUSS_STAND_MENU.MENU_ID = (select TS_RESOURCE.id from TS_RESOURCE WHERE parent_id is null and sor_divide ='BUSINESS_STAND' and valid_flag=0)
</if>
<!-- 当第一次进入页面未选择记录时-->
<if test="menuId == null or menuId ==''" >
and SAR_BUSS_STAND_MENU.MENU_ID in (
select a.* from (
SELECT TS_RESOURCE.id FROM TS_RESOURCE START WITH id =(
SELECT TS_RESOURCE.id FROM TS_RESOURCE WHERE parent_id IS NULL AND sor_divide = 'BUSINESS_STAND' and valid_flag=0) connect by prior id= parent_id
)a,TS_ROLE_SAR_MENU
where a.id = TS_ROLE_SAR_MENU.SAR_MENU_ID and TS_ROLE_SAR_MENU.ROLE_ID in
<foreach collection="roleIds" index="index" item="item" open="(" separator="," close=")">
#{item}
</foreach>
GROUP BY ID
)
</if>
<if test="validFlag != null" >
and SAR_BUSSIONESS_STAND.valid_flag = #{validFlag}
</if>
<!-- 导出数据过程中,选择的id -->
<if test="idlist != null" >
and SAR_BUSSIONESS_STAND.id in
<foreach collection="idlist" index="index" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
<if test="standSort != null" >
and SAR_BUSSIONESS_STAND.stand_sort = #{standSort}
</if>
<if test="replaceStandNum != null" >
and replace_stand_num like concat(concat('%',#{replaceStandNum}),'%')
</if>
</trim>
</sql>
<!-- 企标复审使用-->
<sql id="SarBussionInfoRole_Where_Clause_Qbfs">
left join TS_DICTYPE dicstandStatus ON ( dicstandStatus.dic_type_code = SAR_BUSSIONESS_STAND.TEXT_STATUS_BUSS AND dicstandStatus.dic_id IS NOT NULL and dicstandStatus.valid_flag = 0)
left join TS_DICTYPE dicstandNature ON ( dicstandNature.dic_type_code = SAR_BUSSIONESS_STAND.STAND_NATURE AND dicstandNature.dic_id IS NOT NULL and dicstandNature.valid_flag = 0)
left join TS_DICTYPE dicstandSort ON ( dicstandSort.dic_type_code = SAR_BUSSIONESS_STAND.STAND_SORT AND dicstandSort.dic_id IS NOT NULL and dicstandSort.valid_flag = 0)
left join TS_DICTYPE dicapplyCountry ON ( dicapplyCountry.dic_type_code = SAR_BUSSIONESS_STAND.APPLY_COUNTRY AND dicapplyCountry.dic_id IS NOT NULL and dicapplyCountry.valid_flag = 0)
left join SAR_BUSS_STAND_MENU ON SAR_BUSSIONESS_STAND.id = SAR_BUSS_STAND_MENU.buss_stand_id
left join TS_RESOURCE on SAR_BUSS_STAND_MENU.menu_id = TS_RESOURCE.id
where 1=1
<trim suffixOverrides="," >
<!-- 基本搜索项 -->
<if test="standCode != null" >
and stand_code like concat(concat('%',#{standCode}),'%')
</if>
<if test="standName != null" >
and stand_name like concat(concat('%',#{standName}),'%')
</if>
<if test="validFlag != null" >
and SAR_BUSSIONESS_STAND.valid_flag = #{validFlag}
</if>
</trim>
</sql>
<!-- 分页查询条件当页数据 -->
<select id="getBussionessStandInfoPage" resultMap="BaseResultMap" parameterType="com.adc.da.slrs.sarStandardsInfo.entity.SarBussionessStandEOPage">
select * from
(select tmp_tb.* from
(select
dicstandTextStatus.DIC_TYPE_NAME AS standStatusShow,
<include refid="Base_Column_List_show" />
from SAR_BUSSIONESS_STAND
<include refid="SarBussionInfo_Where_Clause"/>
GROUP BY standStatusShow,<include refid="Group_Column_List_show"/>
) tmp_tb
<include refid="standSort_in"/>
limit ${pager.startIndex-1},${pageSize}) a
</select>
<!-- 企标复审使用-->
<select id="getBussionessStandInfoQbfs" resultMap="BaseResultMap" parameterType="com.adc.da.slrs.sarStandardsInfo.entity.SarBussionessStandEOPage">
select <include refid="Base_Column_List_show" />
from SAR_BUSSIONESS_STAND
<include refid="SarBussionInfoRole_Where_Clause_Qbfs"/>
GROUP BY <include refid="Group_Column_List_show"/>
<if test="pager.orderCondition != null and pager.orderCondition != ''" >
${pager.orderCondition}
</if>
</select>
<select id="getBussionessStandInfoPageByRole" resultMap="BaseResultMap" parameterType="com.adc.da.slrs.sarStandardsInfo.entity.SarBussionessStandEOPage">
select * from
(select tmp_tb.* from
(select <include refid="Base_Column_List_show" />
from SAR_BUSSIONESS_STAND
<include refid="SarBussionInfoRole_Where_Clause"/>
GROUP BY <include refid="Group_Column_List_show"/>
<if test="pager.orderCondition != null and pager.orderCondition != ''" >
${pager.orderCondition}
</if>
) tmp_tb limit ${pager.startIndex-1},${pageSize}) a
</select>
<!-- 分页查询条件查询一共有多少条数据,配合分页 -->
<select id="getBussionessStandInfoCount" resultType="java.lang.Integer" parameterType="com.adc.da.slrs.sarStandardsInfo.entity.SarBussionessStandEOPage">
select count(1) from (select count(*) from SAR_BUSSIONESS_STAND
<include refid="SarBussionInfo_Where_Clause"/>
GROUP BY SAR_BUSSIONESS_STAND.id) a
</select>
<select id="getBussionessStandInfoCountByRole" resultType="java.lang.Integer" parameterType="com.adc.da.slrs.sarStandardsInfo.entity.SarBussionessStandEOPage">
select count(1) from (select count(*) from SAR_BUSSIONESS_STAND
<include refid="SarBussionInfoRole_Where_Clause"/>
GROUP BY SAR_BUSSIONESS_STAND.id)
</select>
<!-- 条件查询后,用于导出标准信息数据-->
<select id="getSarBussionessStand" resultMap="BaseResultMapExcel" parameterType="com.adc.da.slrs.sarStandardsInfo.entity.SarBussionessStandEOPage">
SELECT * FROM (
select <include refid="Base_Column_List_show" />
from SAR_BUSSIONESS_STAND
<include refid="SarBussionInfo_Where_Clause"/>
GROUP BY <include refid="Group_Column_List_show"/>
) tmp_tb
<include refid="standSort_in"/>
</select>
<!--liwenxuan:标准法规更新数量及清单:企业标准-->
<select id="selectBussionessStandardsCount" resultType="java.lang.Integer" parameterType="Date">
SELECT count(1)
FROM SAR_BUSSIONESS_STAND
WHERE MODIFY_TIME > #{visitTime} And Valid_flag = 0
</select>
<!--liwenxuan:标准法规更新数量及清单:企业标准All-->
<select id="selectBussionessStandardsCountAll" resultType="java.lang.Integer" >
SELECT count(1)
FROM SAR_BUSSIONESS_STAND
WHERE Valid_flag = 0
</select>
<!-- 根据id查询 SAR_BUSSIONESS_STAND 的详细信息-->
<select id="selectStandardsInfoByKey" resultMap="BaseResultMap" parameterType="java.lang.String">
select <include refid="Base_Column_List_show" />
from SAR_BUSSIONESS_STAND
left join TS_DICTYPE dicstandStatus ON ( dicstandStatus.dic_type_code = SAR_BUSSIONESS_STAND.TEXT_STATUS_BUSS AND dicstandStatus.dic_id IS NOT NULL and dicstandStatus.valid_flag = 0)
left join TS_DICTYPE dicstandNature ON ( dicstandNature.dic_type_code = SAR_BUSSIONESS_STAND.STAND_NATURE AND dicstandNature.dic_id IS NOT NULL and dicstandNature.valid_flag = 0)
left join TS_DICTYPE dicstandSort ON ( dicstandSort.dic_type_code = SAR_BUSSIONESS_STAND.STAND_SORT AND dicstandSort.dic_id IS NOT NULL and dicstandSort.valid_flag = 0)
left join TS_DICTYPE dicapplyCountry ON ( dicapplyCountry.dic_type_code = SAR_BUSSIONESS_STAND.APPLY_COUNTRY AND dicapplyCountry.dic_id IS NOT NULL and dicapplyCountry.valid_flag = 0)
left join SAR_BUSS_STAND_MENU ON SAR_BUSSIONESS_STAND.id = SAR_BUSS_STAND_MENU.buss_stand_id
left join TS_RESOURCE on SAR_BUSS_STAND_MENU.menu_id = TS_RESOURCE.id
where SAR_BUSSIONESS_STAND.id = #{id}
</select>
<select id="selectSarBussionesDownloadFileInfo" resultType="com.adc.da.slrs.sarBussionessStand.entity.SarBussionessStand" parameterType="string">
SELECT SAR_BUSS_STAND_RES.stand_file_classify as standFileClassify,SAR_BUSS_STAND_FILE.att_id as attId FROM "SAR_BUSSIONESS_STAND"
left join "SAR_BUSS_STAND_RES" on (SAR_BUSSIONESS_STAND.id = SAR_BUSS_STAND_RES.stand_id)
left join "SAR_BUSS_STAND_FILE" on (SAR_BUSS_STAND_RES.id = SAR_BUSS_STAND_FILE.res_id)
where SAR_BUSSIONESS_STAND.id =#{id} and SAR_BUSS_STAND_FILE.use_module = 'SOURCE_FILE'
</select>
<!-- gaoyan 验证代替标准号是否存在 -->
<select id="selectStandardsByStandNumber" resultMap="BaseResultMap"
parameterType="com.adc.da.slrs.sarBussionessStand.entity.SarBussionessStand">
select
<include refid="Base_Column_List"/>
from
SAR_BUSSIONESS_STAND
where SAR_BUSSIONESS_STAND.valid_flag = 0
<if test="standCode != null">
and SAR_BUSSIONESS_STAND.stand_code=#{standCode}
</if>
</select>
<select id="selectStandByStandNumber" resultType="com.adc.da.slrs.sarBussionessStand.entity.SarBussionessStand" parameterType="java.util.Map">
select id from SAR_BUSSIONESS_STAND where stand_code = #{standCode}
</select>
<!-- gaoyan 搜索中心页面查询为我推荐 -->
<select id="selectRecommendStand" resultType="com.adc.da.slrs.sarStandardsInfo.entity.RecommendVO" parameterType="com.adc.da.slrs.sarStandardsInfo.entity.SarBussionessStandEOPage">
select tmp_tb.* from
(select
if(
SAR_STANDARDS_INFO.STAND_YEAR='',
CONCAT(SAR_STANDARDS_INFO.stand_sort,' ',SAR_STANDARDS_INFO.stand_number),
CONCAT(SAR_STANDARDS_INFO.stand_sort,' ',SAR_STANDARDS_INFO.stand_number,'-',SAR_STANDARDS_INFO.stand_year)
) as numberShow,
SAR_BUSSIONESS_STAND.stand_name as nameShow,
SAR_BUSSIONESS_STAND.id,
'BUSINESS_STAND' as typeShow
from SAR_BUSSIONESS_STAND
left join TS_DICTYPE dicstandSort ON ( dicstandSort.dic_type_code = SAR_BUSSIONESS_STAND.STAND_SORT AND dicstandSort.dic_id IS NOT NULL and dicstandSort.valid_flag = 0)
where SAR_BUSSIONESS_STAND.valid_flag = '0' and ( 1=1
<if test="standSort != null" >
and STAND_SORT = #{standSort}
</if>
<if test="standCode != null" >
or stand_code like concat(concat('%',#{standCode}),'%')
</if>
<if test="standYear != null" >
or stand_year like concat(concat('%',#{standYear}),'%')
</if>
<if test="standName != null" >
or stand_name like concat(concat('%',#{standName}),'%')
</if>
<!-- 适用车型 多选需要修改-->
<!--<if test="applyArcticList != null">
or REGEXP_LIKE(apply_arctic,
<foreach collection="applyArcticList" index="index" item="item" open="'(" separator="|" close=")'">
${item}
</foreach>
)
</if>
<if test="energyKindList != null" >
or
REGEXP_LIKE(energy_kind,
<foreach collection="energyKindList" index="index" item="item" open="'(" separator="|" close=")'">
${item}
</foreach>
)
</if>-->
)
order by SAR_BUSSIONESS_STAND.modify_time desc
) tmp_tb limit 0,5
</select>
<!-- gaoyan 查找相近标准 -->
<select id="selectCloseStand" resultType="com.adc.da.slrs.sarStandardsInfo.entity.RecommendVO" parameterType="com.adc.da.slrs.sarStandardsInfo.entity.SarBussionessStandEOPage">
select tmp_tb.* from
(select
stand_code as numberShow,
SAR_BUSSIONESS_STAND.stand_name as nameShow,
SAR_BUSSIONESS_STAND.id,
'BUSINESS_STAND' as typeShow
from SAR_BUSSIONESS_STAND
left join TS_DICTYPE dicstandSort ON ( dicstandSort.dic_type_code = SAR_BUSSIONESS_STAND.STAND_SORT AND dicstandSort.dic_id IS NOT NULL and dicstandSort.valid_flag = 0)
where SAR_BUSSIONESS_STAND.valid_flag = '0' and (
<if test="standName != null" >
or stand_name like concat(concat('%',#{standName}),'%')
</if>
)
<if test="id != null" >
and SAR_BUSSIONESS_STAND.id != #{id}
</if>
order by SAR_BUSSIONESS_STAND.modify_time desc
) tmp_tb limit 0,5
</select>
<select id="queryByPutTimeList" resultMap="BaseResultMap" parameterType="com.adc.da.slrs.sarBussionessStand.entity.SarBussionessStand">
select <include refid="Base_Column_List"/> from SAR_BUSSIONESS_STAND
where 1=1
<if test="putTime != null" >
and put_time &lt;= #{putTime}
</if>
<if test="standStatus != null" >
and stand_status = #{standStatus}
</if>
</select>
<update id="updateByStandNum" parameterType="com.adc.da.slrs.sarBussionessStand.entity.SarBussionessStand" >
update SAR_BUSSIONESS_STAND
<set >
<if test="modifyTime != null" >
modify_time = #{modifyTime},
</if>
<if test="creationTime != null" >
creation_time = #{creationTime},
</if>
<if test="validFlag != null" >
valid_flag = #{validFlag},
</if>
<if test="replacedStandNum != null" >
replaced_stand_num = #{replacedStandNum},
</if>
<if test="replaceStandNum != null" >
replace_stand_num = #{replaceStandNum},
</if>
<if test="putTime != null" >
put_time = #{putTime},
</if>
<if test="issueTime != null" >
issue_time = #{issueTime},
</if>
<if test="standEnName != null" >
stand_en_name = #{standEnName},
</if>
<if test="standName != null" >
stand_name = #{standName},
</if>
</set>
where STAND_CODE = #{standCode}
</update>
<update id="updateRelacedNumByNumber" parameterType="com.adc.da.slrs.sarStandardsInfo.entity.SarBussionessStandEOPage">
update SAR_BUSSIONESS_STAND set REPLACED_STAND_NUM = #{replacedStandNum} where
STAND_CODE in
<foreach collection="replaceStandNumList" index="index" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</update>
<update id="updateRelaceNumByNumber" parameterType="com.adc.da.slrs.sarStandardsInfo.entity.SarBussionessStandEOPage">
update SAR_BUSSIONESS_STAND set REPLACE_STAND_NUM = #{replaceStandNum} where
STAND_CODE in
<foreach collection="replacedStandNumList" index="index" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</update>
<select id="selectBussStandByIdAndRole" resultMap="BaseResultMap"
parameterType="com.adc.da.slrs.sarStandardsInfo.entity.SarBussionessStandEOPage">
select SAR_BUSSIONESS_STAND.id
from
SAR_BUSSIONESS_STAND
left join SAR_BUSS_STAND_MENU on SAR_BUSSIONESS_STAND.id=SAR_BUSS_STAND_MENU.BUSS_STAND_ID
where SAR_BUSSIONESS_STAND.valid_flag = 0
and SAR_BUSS_STAND_MENU.valid_flag = 0
<if test="id != null">
and SAR_BUSSIONESS_STAND.id = #{id}
</if>
<if test="menuRoleList != null">
and SAR_BUSS_STAND_MENU.MENU_ID in
<foreach collection="menuRoleList" index="index" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
</select>
<update id="updateReplacedNumById" parameterType="com.adc.da.slrs.sarBussionessStand.entity.SarBussionessStand">
update SAR_BUSSIONESS_STAND set REPLACED_STAND_NUM = #{replacedStandNum} where id = #{id}
</update>
<select id="selectStandColumn" resultType="java.lang.Integer" parameterType="java.lang.String">
SELECT COUNT(*)
FROM information_schema.columns
WHERE table_name = 'SAR_BUSSIONESS_STAND' AND column_name = #{columnName}
</select>
<select id="standRemindInfo" resultMap="BaseResultMap" parameterType="com.adc.da.slrs.sarBussionessStand.entity.SarBussionessStand">
select
*
from
(
select
*
from
SAR_BUSSIONESS_STAND
where VALID_FLAG = 0
and
(select count(0) from SAR_BUSSIONESS_STAND_STATE where SAR_BUSSIONESS_STAND_STATE.ID = SAR_BUSSIONESS_STAND.ID) = 0
and date_format(ISSUE_TIME,'%Y-%m-%d') = date_format(DATE_SUB(curdate(), INTERVAL 35 MONTH),'%Y-%m-%d')
union
select
sbs.*
from
SAR_BUSSIONESS_STAND sbs
right join SAR_BUSSIONESS_STAND_STATE sbss on sbs.ID = sbss.ID
where sbs.VALID_FLAG = 0
and date_format(sbss.REVIEW_TIME,'%Y-%m-%d') = date_format(DATE_SUB(curdate(), INTERVAL 35 MONTH),'%Y-%m-%d')) as aa
<where>
1=1
<if test="standCode != null and standCode !=''">
and STAND_CODE = #{standCode}
</if>
<if test="standName != null and standName !=''">
and STAND_NAME = #{standName}
</if>
</where>
</select>
<select id="selectIsExit" resultType="java.lang.Integer">
select count(*) from SAR_LAWS_INFO where id = #{id} and valid_flag != 0
</select>
<insert id="insertPerson">
insert into SAR_BUSSIONESS_PERSON(ID,QBID,USID) VALUE
<foreach collection ="list" item="Person" separator =",">
(#{Person.id}, #{Person.qbid}, #{Person.usid})
</foreach >
</insert>
<insert id="deletePerson" parameterType="java.lang.String">
DELETE FROM SAR_BUSSIONESS_PERSON
where qbid=#{qbid}
</insert>
<select id="selectPerson" parameterType="java.lang.String" resultType="java.lang.String">
select usid from SAR_BUSSIONESS_PERSON where QBID=#{qbid}
</select>
</mapper>