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

149 lines
5.0 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.sarStandMenu.dao.SarStandMenuDao">
<!-- Result Map-->
<resultMap id="BaseResultMap" type="com.adc.da.slrs.sarStandMenu.entity.SarStandMenu" >
<id column="id" property="id" />
<result column="valid_flag" property="validFlag" />
<result column="menu_id" property="menuId" />
<result column="stand_id" property="standId" />
</resultMap>
<!-- SAR_STAND_MENU table all fields -->
<sql id="Base_Column_List" >
valid_flag, menu_id, stand_id, id
</sql>
<!-- 查询条件 -->
<sql id="Base_Where_Clause">
where 1=1
<trim suffixOverrides="," >
<if test="validFlag != null" >
and valid_flag = #{validFlag}
</if>
<if test="menuId != null" >
and menu_id = #{menuId}
</if>
<if test="standId != null" >
and stand_id = #{standId}
</if>
<if test="id != null" >
and id = #{id}
</if>
</trim>
</sql>
<delete id="deleteByStandId" parameterType="java.lang.String">
delete from SAR_STAND_MENU
where stand_id = #{value}
</delete>
<select id="selectMenuByMenuParentId" resultMap="BaseResultMap" parameterType="com.adc.da.slrs.sarStandMenu.entity.SarStandMenu">
select <include refid="Base_Column_List"/> from SAR_STAND_MENU
where stand_id = #{standId} and valid_flag=0
and MENU_ID in
<foreach collection="menuIds" index="index" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</select>
<update id="updateByStandIdAndMenuId" parameterType="com.adc.da.slrs.sarStandMenu.entity.SarStandMenu" >
update SAR_STAND_MENU
<set >
<if test="menuId != null" >
menu_id = #{menuId},
</if>
</set>
where stand_id = #{standId}
and MENU_ID in
<foreach collection="menuIds" index="index" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</update>
<delete id="deleteByStandIdAndMenuId" parameterType="com.adc.da.slrs.sarStandMenu.entity.SarStandMenu">
delete from SAR_STAND_MENU
where stand_id = #{standId, jdbcType=VARCHAR} and MENU_ID = #{menuId, jdbcType=VARCHAR}
</delete>
<delete id="deleteByMenuId" parameterType="com.adc.da.slrs.sarStandMenu.entity.SarStandMenu">
delete from SAR_STAND_MENU
where stand_id = #{standId}
and MENU_ID in
<foreach collection="menuIds" index="index" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</delete>
<select id="selectAllMenuByStandId" resultMap="BaseResultMap" parameterType="com.adc.da.slrs.sarStandMenu.entity.SarStandMenu">
select <include refid="Base_Column_List" />
from SAR_STAND_MENU
where stand_id = #{standId} and valid_flag=0
</select>
<select id="getMenuByStandId" resultType="com.adc.da.slrs.sarStandMenu.entity.SarStandMenu">
SELECT
SAR_STAND_MENU.valid_flag as validFlag,
menu_id as menuId,
stand_id as standId,
SAR_STAND_MENU.id as id,
MENU_NAME as menuName
FROM
SAR_STAND_MENU
LEFT JOIN ts_resource ON SAR_STAND_MENU.MENU_ID = ts_resource.ID
<where>
SAR_STAND_MENU.VALID_FLAG = 0
<if test="standId !=null and stand != ''">
AND stand_id = #{standId}
</if>
<if test="standCode !=null and standCode != ''">
AND STAND_ID =
(
SELECT
id
FROM
sar_standards_info AS sarInfo
WHERE
VALID_FLAG = '0'
AND
(
(
REPLACE (
concat(
sarInfo.STAND_SORT,
' ',
sarInfo.STAND_NUMBER,
'-',
sarInfo.STAND_YEAR
),
' ',
''
) = REPLACE (
#{standCode},' ', '')
AND sarInfo.STAND_YEAR != ''
)
OR (
REPLACE (
concat(
sarInfo.STAND_SORT,
sarInfo.STAND_NUMBER
),
' ',
''
) = REPLACE (#{standCode},' ', '')
)
)
)
</if>
</where>
</select>
</mapper>