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

295 lines
14 KiB
XML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<?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.sarLawsInfo.dao.SarLawsInfoDao">
<!-- Result Map-->
<resultMap id="BaseResultMap" type="com.adc.da.slrs.sarLawsInfo.entity.SarLawsInfo">
<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="creation_user" property="creationUser"/>
<result column="replace_laws_num" property="replaceLawsNum"/>
<result column="replaced_laws_num" property="replacedLawsNum"/>
<result column="put_time" property="putTime"/>
<result column="issue_time" property="issueTime"/>
<result column="laws_state" property="lawsState"/>
<result column="laws_name" property="lawsName"/>
<result column="laws_number" property="lawsNumber"/>
<result column="laws_property" property="lawsProperty"/>
<result column="country" property="country"/>
<result column="laws_type" property="lawsType"/>
<result column="propertyName" property="propertyName"/>
<result column="stateName" property="stateName"/>
<result column="countryName" property="countryName"/>
<result column="laws_en_name" property="lawsEnName"/>
<result column="synopsis" property="synopsis"/>
<result column="cite_stand" property="citeStand"/>
<result column="cited_stand" property="citedStand"/>
<result column="is_relate_access" property="isRelateAccess" />
</resultMap>
<resultMap id="BaseResultMapExcel" type="com.adc.da.slrs.sarLawsInfo.entity.SarLawsInfo">
<result column="replace_laws_num" property="replaceLawsNum"/>
<result column="replaced_laws_num" property="replacedLawsNum"/>
<result column="put_time" property="putTime"/>
<result column="issue_time" property="issueTime"/>
<result column="laws_name" property="lawsName"/>
<result column="laws_number" property="lawsNumber"/>
<result column="propertyName" property="propertyName"/>
<result column="stateName" property="stateName"/>
<result column="countryName" property="countryName"/>
<result column="synopsis" property="synopsis"/>
<result column="laws_en_name" property="lawsEnName"/>
<result column="is_relate_access" property="isRelateAccess" />
</resultMap>
<!-- SAR_LAWS_INFO table all fields -->
<sql id="Base_Column_List">
concat(synopsis, '') as synopsis,laws_en_name,modify_time, creation_time, valid_flag, creation_user,replace_laws_num,replaced_laws_num,
put_time, issue_time, laws_state, laws_name, laws_number, laws_property, country, laws_type, id,cite_stand,cited_stand,is_relate_access
</sql>
<sql id="Group_Column_List_Query">
SAR_LAWS_INFO.laws_en_name,concat(synopsis, '') as synopsis,SAR_LAWS_INFO.modify_time,
SAR_LAWS_INFO.creation_time, SAR_LAWS_INFO.valid_flag, SAR_LAWS_INFO.creation_user,
SAR_LAWS_INFO.replaced_laws_num, SAR_LAWS_INFO.put_time, SAR_LAWS_INFO.issue_time, SAR_LAWS_INFO.laws_state,
SAR_LAWS_INFO.laws_name, SAR_LAWS_INFO.laws_number, SAR_LAWS_INFO.laws_property,SAR_LAWS_INFO.replace_laws_num,
SAR_LAWS_INFO.country, SAR_LAWS_INFO.laws_type, SAR_LAWS_INFO.id,SAR_LAWS_INFO.cite_stand,SAR_LAWS_INFO.cited_stand,SAR_LAWS_INFO.is_relate_access
</sql>
<sql id="Group_Column_List">
SAR_LAWS_INFO.laws_en_name,concat(synopsis, ''),SAR_LAWS_INFO.modify_time,
SAR_LAWS_INFO.creation_time, SAR_LAWS_INFO.valid_flag, SAR_LAWS_INFO.creation_user,SAR_LAWS_INFO.replace_laws_num,
SAR_LAWS_INFO.replaced_laws_num, SAR_LAWS_INFO.put_time, SAR_LAWS_INFO.issue_time, SAR_LAWS_INFO.laws_state,
SAR_LAWS_INFO.laws_name, SAR_LAWS_INFO.laws_number, SAR_LAWS_INFO.laws_property,
SAR_LAWS_INFO.country, SAR_LAWS_INFO.laws_type, SAR_LAWS_INFO.id,SAR_LAWS_INFO.cite_stand,SAR_LAWS_INFO.cited_stand,SAR_LAWS_INFO.is_relate_access
</sql>
<!-- 查询条件 -->
<sql id="Base_Where_Clause">
where 1=1
<trim suffixOverrides=",">
<if test="synopsis != null">
and synopsis like concat(concat('%',#{synopsis}),'%')
</if>
<if test="lawsEnName != null">
and laws_en_name like concat(concat('%',#{lawsEnName}),'%')
</if>
<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="creationUser != null">
and creation_user ${creationUserOperator} #{creationUser}
</if>
<!--需求变动 特此修改(byl)-->
<if test="replaceLawsNum != null">
and replace_laws_num ${replaceLawsNumOperator} concat(concat('%',#{replaceLawsNum}),'%')
</if>
<if test="replacedLawsNum != null">
and replaced_laws_num ${replaceLawsNumOperator} concat(concat('%',#{replacedLawsNum}),'%')
</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="lawsState != null">
and laws_state ${lawsStateOperator} #{lawsState}
</if>
<if test="lawsName != null">
and laws_name ${lawsNameOperator} concat(concat('%',#{lawsName}),'%')
</if>
<if test="lawsNumber != null">
<if test="lawsNumberOperator == '='.toString()">
and laws_number ${lawsNumberOperator} #{lawsNumber}
</if>
<if test="lawsNumberOperator == 'like'.toString()">
and laws_number ${lawsNumberOperator} concat(concat('%',#{lawsNumber}),'%')
</if>
</if>
<if test="lawsProperty != null">
and laws_property ${lawsPropertyOperator} #{lawsProperty}
</if>
<if test="country != null">
and country ${countryOperator} #{country}
</if>
<if test="lawsType != null">
and laws_type ${lawsTypeOperator} #{lawsType}
</if>
<if test="id != null">
and SAR_LAWS_INFO.id ${idOperator} #{id}
</if>
<if test="numberName != null">
and (laws_number ${lawsNumberOperator} concat(concat('%',#{numberName}),'%')
or laws_name ${lawsNameOperator} concat(concat('%',#{numberName}),'%'))
</if>
<if test="isRelateAccess != null" >
and is_relate_access = #{isRelateAccess}
</if>
</trim>
</sql>
<sql id="Second_Where_Clause">
where 1=1
<trim suffixOverrides=",">
<if test="isRelateAccess != null" >
and is_relate_access = #{isRelateAccess}
</if>
<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 = #{validFlag}
</if>
<if test="creationUser != null">
and creation_user = #{creationUser}
</if>
<if test="replaceLawsNum != null">
and replace_laws_num = #{replaceLawsNum}
</if>
<if test="putTime != null">
and put_time ${putTimeOperator} #{putTime}
</if>
<if test="lawsState != null">
and laws_state = #{lawsState}
</if>
<if test="lawsName != null">
and laws_name = #{lawsName}
</if>
<if test="lawsNumber != null">
and laws_number = #{lawsNumber}
</if>
<if test="lawsProperty != null">
and laws_property = #{lawsProperty}
</if>
<if test="country != null">
and country = #{country}
</if>
<if test="lawsType != null">
and laws_type = #{lawsType}
</if>
<if test="id != null">
and id = #{id}
</if>
</trim>
</sql>
<sql id="Laws_Where_Clause">
left join SAR_LAWS_MENU on SAR_LAWS_INFO.id = SAR_LAWS_MENU.LAWS_ID
left join SAR_MENU on SAR_LAWS_MENU.MENU_ID = SAR_MENU.id
left join SAR_LAWS_ATTR_INFO on (SAR_LAWS_ATTR_INFO.LAWS_ID = SAR_LAWS_INFO.id and SAR_LAWS_ATTR_INFO.valid_flag=0)
left join TS_DICTYPE dic1 on (SAR_LAWS_INFO.laws_property = dic1.dic_type_code AND dic1.VALID_FLAG = 0)
left join TS_DICTYPE dic2 on (SAR_LAWS_INFO.laws_state = dic2.dic_type_code AND dic2.VALID_FLAG = 0)
<include refid="Base_Where_Clause"/>
and SAR_LAWS_INFO.valid_flag = 0
<if test="menuId != null and menuId != ''">
and SAR_MENU.id in
<foreach collection="menuIdList" index="index" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
<!-- 新修改需求,根据角色查询有权限的菜单数据-->
<if test="menuRoleList != null">
and (SAR_LAWS_MENU.MENU_ID in
<foreach collection="menuRoleList" index="index" item="item" open="(" separator="," close=")">
#{item}
</foreach>
or (SAR_LAWS_INFO.ID not in (select SAR_LAWS_MENU.LAWS_ID from SAR_LAWS_MENU where SAR_LAWS_INFO.ID = SAR_LAWS_MENU.LAWS_ID and SAR_LAWS_MENU.VALID_FLAG = 0))
)
</if>
<if test="menuRoleList == null and idlist == null">
and SAR_LAWS_INFO.ID not in (select SAR_LAWS_MENU.LAWS_ID from SAR_LAWS_MENU where SAR_LAWS_INFO.ID = SAR_LAWS_MENU.LAWS_ID and SAR_LAWS_MENU.VALID_FLAG = 0)
</if>
<if test="collectMenuId != null">
and SAR_LAWS_INFO.id in (
select COLLECT_RES_ID from TS_PERSON_COLLECT where TS_PERSON_COLLECT.VALID_FLAG=0
and collect_type='FOREIGN_LAWS'
and TS_PERSON_COLLECT.user_id=#{userId}
)
</if>
<if test='labelMenuId != null and labelMenuId == "gxhbq"'>
and SAR_LAWS_ATTR_INFO.GXHBQ is not null
</if>
<if test='labelMenuId != null and labelMenuId != "gxhbq"'>
and SAR_LAWS_ATTR_INFO.GXHBQ like concat(concat('%',#{labelMenuId}),'%')
</if>
<if test="advanceSearchStr != null">
and (${advanceSearchStr})
</if>
<if test="idlist != null">
and SAR_LAWS_INFO.id in
<foreach collection="idlist" index="index" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
</sql>
<!-- 查询SAR_LAWS_INFO列表 -->
<select id="queryByPage" resultMap="BaseResultMap" parameterType="com.adc.da.base.page.BasePage">
select<include refid="Base_Column_List"/>
,propertyName,stateName
from
(select tmp_tb.* from
(select <include refid="Group_Column_List_Query"/>,dic1.dic_type_name as propertyName,dic2.dic_type_name as stateName
from SAR_LAWS_INFO
<include refid="Laws_Where_Clause"/>
GROUP BY <include refid="Group_Column_List"/>,dic1.dic_type_name,dic2.dic_type_name,SAR_LAWS_ATTR_INFO.XCXSSRQ
<if test="pager.orderCondition != null and pager.orderCondition != ''">
${pager.orderCondition}
</if>
) tmp_tb limit ${pager.startIndex-1},${pageSize}) a
</select>
<!-- SAR_LAWS_INFO 列表总数-->
<select id="queryByCount" resultType="java.lang.Integer" parameterType="com.adc.da.base.page.BasePage">
select count(1) from (select SAR_LAWS_INFO.ID from SAR_LAWS_INFO
<include refid="Laws_Where_Clause"/>
GROUP BY SAR_LAWS_INFO.ID) a
</select>
<select id="selectLawsColumn" resultType="java.lang.Integer" parameterType="java.lang.String">
SELECT COUNT(*)
FROM information_schema.columns
WHERE table_name = 'SAR_LAWS_INFO' AND column_name = #{columnName}
</select>
</mapper>