You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
467 lines
23 KiB
XML
467 lines
23 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.foreverwin.mesnac.meapi.mapper.NcCodeMapper">
|
|
|
|
<!-- 通用查询映射结果 -->
|
|
<resultMap id="BaseResultMap" type="com.foreverwin.mesnac.meapi.model.NcCode">
|
|
<result column="HANDLE" property="handle" />
|
|
<result column="CHANGE_STAMP" property="changeStamp" />
|
|
<result column="SITE" property="site" />
|
|
<result column="NC_CODE" property="ncCode" />
|
|
<result column="STATUS_BO" property="statusBo" />
|
|
<result column="CREATED_DATE_TIME" property="createdDateTime" />
|
|
<result column="MODIFIED_DATE_TIME" property="modifiedDateTime" />
|
|
<result column="NC_CATEGORY" property="ncCategory" />
|
|
<result column="DPMO_CATEGORY_BO" property="dpmoCategoryBo" />
|
|
<result column="DESCRIPTION" property="description"/>
|
|
</resultMap>
|
|
|
|
<resultMap id="ncCodeDto" type="com.foreverwin.mesnac.meapi.dto.NcCodeDto">
|
|
<result column="NG_GROUP" property="ngGroup"/>
|
|
<result column="NG_DESCRIPTION" property="ngDescription"/>
|
|
</resultMap>
|
|
|
|
<!-- 通用查询结果列 -->
|
|
<sql id="Base_Column_List">
|
|
HANDLE, CHANGE_STAMP, SITE, NC_CODE, STATUS_BO, CREATED_DATE_TIME, MODIFIED_DATE_TIME, NC_CATEGORY, DPMO_CATEGORY_BO,DESCRIPTION
|
|
</sql>
|
|
|
|
<!-- BaseMapper标准查询/修改/删除 -->
|
|
|
|
<select id="selectByMap" resultMap="BaseResultMap">
|
|
SELECT <include refid="Base_Column_List"></include>
|
|
FROM NC_CODE
|
|
<if test="cm!=null and !cm.isEmpty">
|
|
<where>
|
|
<foreach collection="cm.keys" item="k" separator="AND">
|
|
<if test="cm[k] != null">
|
|
${k} = #{cm[${k}]}
|
|
</if>
|
|
</foreach>
|
|
</where>
|
|
</if>
|
|
</select>
|
|
|
|
|
|
<select id="selectOne" resultMap="BaseResultMap">
|
|
SELECT <include refid="Base_Column_List"></include> FROM NC_CODE
|
|
<where>
|
|
<if test="ew.entity.handle!=null">
|
|
HANDLE=#{ew.handle}
|
|
</if>
|
|
<if test="ew.entity.changeStamp!=null"> AND CHANGE_STAMP=#{ew.entity.changeStamp}</if>
|
|
<if test="ew.entity.site!=null"> AND SITE=#{ew.entity.site}</if>
|
|
<if test="ew.entity.ncCode!=null"> AND NC_CODE=#{ew.entity.ncCode}</if>
|
|
<if test="ew.entity.statusBo!=null"> AND STATUS_BO=#{ew.entity.statusBo}</if>
|
|
<if test="ew.entity.createdDateTime!=null"> AND CREATED_DATE_TIME=#{ew.entity.createdDateTime}</if>
|
|
<if test="ew.entity.modifiedDateTime!=null"> AND MODIFIED_DATE_TIME=#{ew.entity.modifiedDateTime}</if>
|
|
<if test="ew.entity.ncCategory!=null"> AND NC_CATEGORY=#{ew.entity.ncCategory}</if>
|
|
<if test="ew.entity.dpmoCategoryBo!=null"> AND DPMO_CATEGORY_BO=#{ew.entity.dpmoCategoryBo}</if>
|
|
</where>
|
|
</select>
|
|
|
|
<select id="selectCount" resultType="Integer">
|
|
SELECT COUNT(1) FROM NC_CODE
|
|
<where>
|
|
<if test="ew!=null">
|
|
<if test="ew.entity!=null">
|
|
<if test="ew.entity.handle!=null">
|
|
HANDLE=#{ew.entity.handle}
|
|
</if>
|
|
<if test="ew.entity.changeStamp!=null"> AND CHANGE_STAMP=#{ew.entity.changeStamp}</if>
|
|
<if test="ew.entity.site!=null"> AND SITE=#{ew.entity.site}</if>
|
|
<if test="ew.entity.ncCode!=null"> AND NC_CODE=#{ew.entity.ncCode}</if>
|
|
<if test="ew.entity.statusBo!=null"> AND STATUS_BO=#{ew.entity.statusBo}</if>
|
|
<if test="ew.entity.createdDateTime!=null"> AND CREATED_DATE_TIME=#{ew.entity.createdDateTime}</if>
|
|
<if test="ew.entity.modifiedDateTime!=null"> AND MODIFIED_DATE_TIME=#{ew.entity.modifiedDateTime}</if>
|
|
<if test="ew.entity.ncCategory!=null"> AND NC_CATEGORY=#{ew.entity.ncCategory}</if>
|
|
<if test="ew.entity.dpmoCategoryBo!=null"> AND DPMO_CATEGORY_BO=#{ew.entity.dpmoCategoryBo}</if>
|
|
</if>
|
|
<if test="ew!=null and ew.sqlSegment!=null and ew.nonEmptyOfWhere">
|
|
${ew.sqlSegment}
|
|
</if>
|
|
</if>
|
|
</where>
|
|
<if test="ew!=null and ew.sqlSegment!=null and ew.emptyOfWhere">
|
|
${ew.sqlSegment}
|
|
</if>
|
|
</select>
|
|
|
|
<select id="selectList" resultMap="BaseResultMap">
|
|
SELECT nc.NC_CODE,nct.DESCRIPTION
|
|
FROM NC_CODE nc
|
|
LEFT JOIN NC_CODE_T nct ON nc.HANDLE = nct.NC_CODE_BO AND nct.LOCALE='zh'
|
|
<where>
|
|
<if test="ew!=null">
|
|
<if test="ew.entity!=null">
|
|
<if test="ew.entity.handle!=null">
|
|
HANDLE=#{ew.entity.handle}
|
|
</if>
|
|
<if test="ew.entity.changeStamp!=null"> AND CHANGE_STAMP=#{ew.entity.changeStamp}</if>
|
|
<if test="ew.entity.site!=null"> AND SITE=#{ew.entity.site}</if>
|
|
<if test="ew.entity.ncCode!=null"> AND NC_CODE=#{ew.entity.ncCode}</if>
|
|
<if test="ew.entity.statusBo!=null"> AND STATUS_BO=#{ew.entity.statusBo}</if>
|
|
<if test="ew.entity.createdDateTime!=null"> AND CREATED_DATE_TIME=#{ew.entity.createdDateTime}</if>
|
|
<if test="ew.entity.modifiedDateTime!=null"> AND MODIFIED_DATE_TIME=#{ew.entity.modifiedDateTime}</if>
|
|
<if test="ew.entity.ncCategory!=null"> AND NC_CATEGORY=#{ew.entity.ncCategory}</if>
|
|
<if test="ew.entity.dpmoCategoryBo!=null"> AND DPMO_CATEGORY_BO=#{ew.entity.dpmoCategoryBo}</if>
|
|
</if>
|
|
<if test="ew!=null and ew.sqlSegment!=null and ew.nonEmptyOfWhere">
|
|
${ew.sqlSegment}
|
|
</if>
|
|
</if>
|
|
</where>
|
|
<if test="ew!=null and ew.sqlSegment!=null and ew.emptyOfWhere">
|
|
${ew.sqlSegment}
|
|
</if>
|
|
</select>
|
|
|
|
<select id="selectMaps" resultType="HashMap">
|
|
SELECT <choose><when test="ew != null and ew.sqlSelect != null">${ew.sqlSelect}</when><otherwise><include refid="Base_Column_List"></include></otherwise></choose> FROM NC_CODE
|
|
<where>
|
|
<if test="ew!=null">
|
|
<if test="ew.entity!=null">
|
|
<if test="ew.entity.handle!=null">
|
|
HANDLE=#{ew.entity.handle}
|
|
</if>
|
|
<if test="ew.entity.changeStamp!=null"> AND CHANGE_STAMP=#{ew.entity.changeStamp}</if>
|
|
<if test="ew.entity.site!=null"> AND SITE=#{ew.entity.site}</if>
|
|
<if test="ew.entity.ncCode!=null"> AND NC_CODE=#{ew.entity.ncCode}</if>
|
|
<if test="ew.entity.statusBo!=null"> AND STATUS_BO=#{ew.entity.statusBo}</if>
|
|
<if test="ew.entity.createdDateTime!=null"> AND CREATED_DATE_TIME=#{ew.entity.createdDateTime}</if>
|
|
<if test="ew.entity.modifiedDateTime!=null"> AND MODIFIED_DATE_TIME=#{ew.entity.modifiedDateTime}</if>
|
|
<if test="ew.entity.ncCategory!=null"> AND NC_CATEGORY=#{ew.entity.ncCategory}</if>
|
|
<if test="ew.entity.dpmoCategoryBo!=null"> AND DPMO_CATEGORY_BO=#{ew.entity.dpmoCategoryBo}</if>
|
|
</if>
|
|
<if test="ew!=null and ew.sqlSegment!=null and ew.nonEmptyOfWhere">
|
|
${ew.sqlSegment}
|
|
</if>
|
|
</if>
|
|
</where>
|
|
<if test="ew!=null and ew.sqlSegment!=null and ew.emptyOfWhere">
|
|
${ew.sqlSegment}
|
|
</if>
|
|
</select>
|
|
|
|
<select id="selectObjs" resultType="Object">
|
|
SELECT <choose><when test="ew != null and ew.sqlSelect != null">${ew.sqlSelect}</when><otherwise><include refid="Base_Column_List"></include></otherwise></choose> FROM NC_CODE
|
|
<where>
|
|
<if test="ew!=null">
|
|
<if test="ew.entity!=null">
|
|
<if test="ew.entity.handle!=null">
|
|
HANDLE=#{ew.entity.handle}
|
|
</if>
|
|
<if test="ew.entity.changeStamp!=null"> AND CHANGE_STAMP=#{ew.entity.changeStamp}</if>
|
|
<if test="ew.entity.site!=null"> AND SITE=#{ew.entity.site}</if>
|
|
<if test="ew.entity.ncCode!=null"> AND NC_CODE=#{ew.entity.ncCode}</if>
|
|
<if test="ew.entity.statusBo!=null"> AND STATUS_BO=#{ew.entity.statusBo}</if>
|
|
<if test="ew.entity.createdDateTime!=null"> AND CREATED_DATE_TIME=#{ew.entity.createdDateTime}</if>
|
|
<if test="ew.entity.modifiedDateTime!=null"> AND MODIFIED_DATE_TIME=#{ew.entity.modifiedDateTime}</if>
|
|
<if test="ew.entity.ncCategory!=null"> AND NC_CATEGORY=#{ew.entity.ncCategory}</if>
|
|
<if test="ew.entity.dpmoCategoryBo!=null"> AND DPMO_CATEGORY_BO=#{ew.entity.dpmoCategoryBo}</if>
|
|
</if>
|
|
<if test="ew!=null and ew.sqlSegment!=null and ew.nonEmptyOfWhere">
|
|
${ew.sqlSegment}
|
|
</if>
|
|
</if>
|
|
</where>
|
|
<if test="ew!=null and ew.sqlSegment!=null and ew.emptyOfWhere">
|
|
${ew.sqlSegment}
|
|
</if>
|
|
</select>
|
|
|
|
<select id="selectPage" resultMap="BaseResultMap">
|
|
SELECT <choose><when test="ew != null and ew.sqlSelect != null">${ew.sqlSelect}</when><otherwise><include refid="Base_Column_List"></include></otherwise></choose> FROM NC_CODE
|
|
<where>
|
|
<if test="ew!=null">
|
|
<if test="ew.entity!=null">
|
|
<if test="ew.entity.handle!=null">
|
|
HANDLE=#{ew.entity.handle}
|
|
</if>
|
|
<if test="ew.entity.changeStamp!=null"> AND CHANGE_STAMP=#{ew.entity.changeStamp}</if>
|
|
<if test="ew.entity.site!=null"> AND SITE=#{ew.entity.site}</if>
|
|
<if test="ew.entity.ncCode!=null"> AND NC_CODE=#{ew.entity.ncCode}</if>
|
|
<if test="ew.entity.statusBo!=null"> AND STATUS_BO=#{ew.entity.statusBo}</if>
|
|
<if test="ew.entity.createdDateTime!=null"> AND CREATED_DATE_TIME=#{ew.entity.createdDateTime}</if>
|
|
<if test="ew.entity.modifiedDateTime!=null"> AND MODIFIED_DATE_TIME=#{ew.entity.modifiedDateTime}</if>
|
|
<if test="ew.entity.ncCategory!=null"> AND NC_CATEGORY=#{ew.entity.ncCategory}</if>
|
|
<if test="ew.entity.dpmoCategoryBo!=null"> AND DPMO_CATEGORY_BO=#{ew.entity.dpmoCategoryBo}</if>
|
|
</if>
|
|
<if test="ew!=null and ew.sqlSegment!=null and ew.nonEmptyOfWhere">
|
|
AND ${ew.sqlSegment}
|
|
</if>
|
|
</if>
|
|
</where>
|
|
<if test="ew!=null and ew.sqlSegment!=null and ew.emptyOfWhere">
|
|
AND ${ew.sqlSegment}
|
|
</if>
|
|
</select>
|
|
|
|
<select id="selectMapsPage" resultType="HashMap">
|
|
SELECT <choose><when test="ew != null and ew.sqlSelect != null">${ew.sqlSelect}</when><otherwise><include refid="Base_Column_List"></include></otherwise></choose> FROM NC_CODE
|
|
<where>
|
|
<if test="ew!=null">
|
|
<if test="ew.entity!=null">
|
|
<if test="ew.entity.handle!=null">
|
|
HANDLE=#{ew.entity.handle}
|
|
</if>
|
|
<if test="ew.entity.changeStamp!=null"> AND CHANGE_STAMP=#{ew.entity.changeStamp}</if>
|
|
<if test="ew.entity.site!=null"> AND SITE=#{ew.entity.site}</if>
|
|
<if test="ew.entity.ncCode!=null"> AND NC_CODE=#{ew.entity.ncCode}</if>
|
|
<if test="ew.entity.statusBo!=null"> AND STATUS_BO=#{ew.entity.statusBo}</if>
|
|
<if test="ew.entity.createdDateTime!=null"> AND CREATED_DATE_TIME=#{ew.entity.createdDateTime}</if>
|
|
<if test="ew.entity.modifiedDateTime!=null"> AND MODIFIED_DATE_TIME=#{ew.entity.modifiedDateTime}</if>
|
|
<if test="ew.entity.ncCategory!=null"> AND NC_CATEGORY=#{ew.entity.ncCategory}</if>
|
|
<if test="ew.entity.dpmoCategoryBo!=null"> AND DPMO_CATEGORY_BO=#{ew.entity.dpmoCategoryBo}</if>
|
|
</if>
|
|
<if test="ew!=null and ew.sqlSegment!=null and ew.nonEmptyOfWhere">
|
|
${ew.sqlSegment}
|
|
</if>
|
|
</if>
|
|
</where>
|
|
<if test="ew!=null and ew.sqlSegment!=null and ew.emptyOfWhere">
|
|
${ew.sqlSegment}
|
|
</if>
|
|
</select>
|
|
|
|
<insert id="insert" parameterType="com.foreverwin.mesnac.meapi.model.NcCode">
|
|
INSERT INTO NC_CODE
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
HANDLE,
|
|
<if test="changeStamp!=null">CHANGE_STAMP,</if>
|
|
<if test="site!=null">SITE,</if>
|
|
<if test="ncCode!=null">NC_CODE,</if>
|
|
<if test="statusBo!=null">STATUS_BO,</if>
|
|
<if test="createdDateTime!=null">CREATED_DATE_TIME,</if>
|
|
<if test="modifiedDateTime!=null">MODIFIED_DATE_TIME,</if>
|
|
<if test="ncCategory!=null">NC_CATEGORY,</if>
|
|
<if test="dpmoCategoryBo!=null">DPMO_CATEGORY_BO,</if>
|
|
</trim> VALUES
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
#{handle},
|
|
<if test="changeStamp!=null">#{changeStamp},</if>
|
|
<if test="site!=null">#{site},</if>
|
|
<if test="ncCode!=null">#{ncCode},</if>
|
|
<if test="statusBo!=null">#{statusBo},</if>
|
|
<if test="createdDateTime!=null">#{createdDateTime},</if>
|
|
<if test="modifiedDateTime!=null">#{modifiedDateTime},</if>
|
|
<if test="ncCategory!=null">#{ncCategory},</if>
|
|
<if test="dpmoCategoryBo!=null">#{dpmoCategoryBo},</if>
|
|
</trim>
|
|
</insert>
|
|
|
|
<insert id="insertAllColumn" parameterType="com.foreverwin.mesnac.meapi.model.NcCode">
|
|
INSERT INTO NC_CODE
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
<include refid="Base_Column_List"></include>
|
|
</trim> VALUES
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
#{handle},
|
|
#{changeStamp},
|
|
#{site},
|
|
#{ncCode},
|
|
#{statusBo},
|
|
#{createdDateTime},
|
|
#{modifiedDateTime},
|
|
#{ncCategory},
|
|
#{dpmoCategoryBo},
|
|
</trim>
|
|
</insert>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<update id="update">
|
|
UPDATE NC_CODE <trim prefix="SET" suffixOverrides=",">
|
|
<if test="et.handle!=null">HANDLE=#{et.handle},</if>
|
|
<if test="et.changeStamp!=null">CHANGE_STAMP=#{et.changeStamp},</if>
|
|
<if test="et.site!=null">SITE=#{et.site},</if>
|
|
<if test="et.ncCode!=null">NC_CODE=#{et.ncCode},</if>
|
|
<if test="et.statusBo!=null">STATUS_BO=#{et.statusBo},</if>
|
|
<if test="et.createdDateTime!=null">CREATED_DATE_TIME=#{et.createdDateTime},</if>
|
|
<if test="et.modifiedDateTime!=null">MODIFIED_DATE_TIME=#{et.modifiedDateTime},</if>
|
|
<if test="et.ncCategory!=null">NC_CATEGORY=#{et.ncCategory},</if>
|
|
<if test="et.dpmoCategoryBo!=null">DPMO_CATEGORY_BO=#{et.dpmoCategoryBo},</if>
|
|
</trim>
|
|
<where>
|
|
<if test="ew!=null">
|
|
<if test="ew.entity!=null">
|
|
HANDLE=#{ew.entity.handle}
|
|
<if test="ew.entity.changeStamp!=null"> AND CHANGE_STAMP=#{ew.entity.changeStamp}</if>
|
|
<if test="ew.entity.site!=null"> AND SITE=#{ew.entity.site}</if>
|
|
<if test="ew.entity.ncCode!=null"> AND NC_CODE=#{ew.entity.ncCode}</if>
|
|
<if test="ew.entity.statusBo!=null"> AND STATUS_BO=#{ew.entity.statusBo}</if>
|
|
<if test="ew.entity.createdDateTime!=null"> AND CREATED_DATE_TIME=#{ew.entity.createdDateTime}</if>
|
|
<if test="ew.entity.modifiedDateTime!=null"> AND MODIFIED_DATE_TIME=#{ew.entity.modifiedDateTime}</if>
|
|
<if test="ew.entity.ncCategory!=null"> AND NC_CATEGORY=#{ew.entity.ncCategory}</if>
|
|
<if test="ew.entity.dpmoCategoryBo!=null"> AND DPMO_CATEGORY_BO=#{ew.entity.dpmoCategoryBo}</if>
|
|
</if>
|
|
<if test="ew!=null and ew.sqlSegment!=null and ew.nonEmptyOfWhere">
|
|
${ew.sqlSegment}
|
|
</if>
|
|
</if>
|
|
</where>
|
|
<if test="ew!=null and ew.sqlSegment!=null and ew.emptyOfWhere">
|
|
${ew.sqlSegment}
|
|
</if>
|
|
</update>
|
|
|
|
|
|
<delete id="deleteByMap">
|
|
DELETE FROM NC_CODE
|
|
<if test="cm!=null and !cm.isEmpty">
|
|
<where>
|
|
<foreach collection="cm.keys" item="k" separator="AND">
|
|
<if test="cm[k] != null">
|
|
${k} = #{cm[${k}]}
|
|
</if>
|
|
</foreach>
|
|
</where>
|
|
</if>
|
|
</delete>
|
|
|
|
<delete id="delete">
|
|
DELETE FROM NC_CODE
|
|
<where>
|
|
<if test="ew!=null">
|
|
<if test="ew.entity!=null">
|
|
<if test="ew.entity.handle!=null">
|
|
HANDLE=#{ew.entity.handle}
|
|
</if>
|
|
<if test="ew.entity.changeStamp!=null"> AND CHANGE_STAMP=#{ew.entity.changeStamp}</if>
|
|
<if test="ew.entity.site!=null"> AND SITE=#{ew.entity.site}</if>
|
|
<if test="ew.entity.ncCode!=null"> AND NC_CODE=#{ew.entity.ncCode}</if>
|
|
<if test="ew.entity.statusBo!=null"> AND STATUS_BO=#{ew.entity.statusBo}</if>
|
|
<if test="ew.entity.createdDateTime!=null"> AND CREATED_DATE_TIME=#{ew.entity.createdDateTime}</if>
|
|
<if test="ew.entity.modifiedDateTime!=null"> AND MODIFIED_DATE_TIME=#{ew.entity.modifiedDateTime}</if>
|
|
<if test="ew.entity.ncCategory!=null"> AND NC_CATEGORY=#{ew.entity.ncCategory}</if>
|
|
<if test="ew.entity.dpmoCategoryBo!=null"> AND DPMO_CATEGORY_BO=#{ew.entity.dpmoCategoryBo}</if>
|
|
</if>
|
|
<if test="ew!=null and ew.sqlSegment!=null and ew.nonEmptyOfWhere">
|
|
${ew.sqlSegment}
|
|
</if>
|
|
</if>
|
|
</where>
|
|
<if test="ew!=null and ew.sqlSegment!=null and ew.emptyOfWhere">
|
|
${ew.sqlSegment}
|
|
</if>
|
|
</delete>
|
|
|
|
<!-- BaseMapper标准查询/修改/删除 -->
|
|
|
|
<select id="findNcByCategory" resultMap="BaseResultMap">
|
|
SELECT NC.NC_CODE , NCT.DESCRIPTION
|
|
FROM NC_CODE NC
|
|
/*判断是否是主数据*/
|
|
/*INNER JOIN NC_CODE_DEF NCD ON NC.HANDLE = NCD.NC_CODE_OR_GROUP_GBO AND NCD.CAN_BE_PRIMARY_CODE = 'true'*/
|
|
INNER JOIN NC_CODE_T NCT ON NCT.NC_CODE_BO = NC.HANDLE AND NCT.LOCALE = #{locale}
|
|
LEFT JOIN NC_GROUP_MEMBER NGM ON NGM.NC_CODE_OR_GROUP_GBO = NC.HANDLE
|
|
LEFT JOIN NC_GROUP NG ON NG.HANDLE = NGM.NC_GROUP_BO
|
|
<where>
|
|
NC.SITE = #{site}
|
|
AND NG.NC_GROUP LIKE 'E\_%' ESCAPE '\'
|
|
<if test="code != null and code != ''">
|
|
AND NC.NC_CDDE = #{code}
|
|
</if>
|
|
AND NC.STATUS_BO = 'StatusBO:' || #{site} || ',101'
|
|
</where>
|
|
</select>
|
|
|
|
<!--暂时不用-->
|
|
<select id="findSecondaryNcByNc" resultMap="BaseResultMap">
|
|
SELECT SUBSTR(nsc.NC_CODE_OR_GROUP_GBO, instr(nsc.NC_CODE_OR_GROUP_GBO,',')+1) NC_CODE,nct.DESCRIPTION
|
|
FROM NC_CODE nc
|
|
INNER JOIN NC_CODE_DEF ncd ON NC.HANDLE = NCD.NC_CODE_OR_GROUP_GBO AND NCD.CAN_BE_PRIMARY_CODE = 'true'
|
|
INNER JOIN NC_SECONDARY_CODE nsc ON nsc.NC_CODE_DEF_BO = ncd.HANDLE
|
|
INNER JOIN NC_CODE_T nct ON nct.NC_CODE_BO = nsc.NC_CODE_OR_GROUP_GBO AND NCT.LOCALE = #{locale}
|
|
WHERE nc.NC_CODE = #{ncCode} AND nc.SITE = #{site}
|
|
</select>
|
|
|
|
<select id="selectPageByNcGroup" resultMap="BaseResultMap">
|
|
SELECT nc.NC_CODE,nct.DESCRIPTION FROM NC_CODE nc
|
|
LEFT JOIN NC_CODE_T NCT ON nc.HANDLE=NCT.NC_CODE_BO AND NCT.LOCALE=#{locale}
|
|
JOIN NC_GROUP_MEMBER NGM ON nc.HANDLE=NGM.NC_CODE_OR_GROUP_GBO
|
|
WHERE NGM.NC_GROUP_BO = #{ncGroupBO} and nc.NC_CATEGORY='FAILURE'
|
|
</select>
|
|
|
|
<select id="checkNcCode" resultType="integer">
|
|
SELECT count(NC.HANDLE)
|
|
FROM NC_CODE NC
|
|
LEFT JOIN NC_GROUP_MEMBER NGM ON NGM.NC_CODE_OR_GROUP_GBO = NC.HANDLE
|
|
LEFT JOIN NC_GROUP NG ON NG.HANDLE = NGM.NC_GROUP_BO
|
|
WHERE NC.NC_CODE IN
|
|
<foreach collection="NcCodeList" index="index" item="item" separator="," open="(" close=")">
|
|
UPPER(#{item})
|
|
</foreach>
|
|
<if test="site != null and site != ''">
|
|
AND NC.SITE = #{site}
|
|
</if>
|
|
AND NG.NC_GROUP LIKE 'E\_%' ESCAPE '\'
|
|
</select>
|
|
|
|
<select id="findNcCodeByNcGroup" resultMap="BaseResultMap">
|
|
SELECT NC.NC_CODE ,NCT.DESCRIPTION
|
|
FROM NC_GROUP NG
|
|
INNER JOIN NC_GROUP_MEMBER NGM ON NG.HANDLE = NGM.NC_GROUP_BO
|
|
INNER JOIN NC_CODE NC ON NGM.NC_CODE_OR_GROUP_GBO = NC.HANDLE
|
|
LEFT JOIN NC_CODE_T NCT ON NCT.NC_CODE_BO = NC.HANDLE AND NCT.LOCALE = 'zh'
|
|
<where>
|
|
NC.STATUS_BO = 'StatusBO:' || #{ncGroup.site} || ',101'
|
|
<if test="ncGroup != null">
|
|
<if test="ncGroup.site != null and ncGroup.site != ''">
|
|
AND NG.SITE = #{ncGroup.site}
|
|
</if>
|
|
<if test="ncGroup.ncGroup != null and ncGroup.ncGroup != null">
|
|
AND NG.NC_GROUP = #{ncGroup.ncGroup}
|
|
</if>
|
|
</if>
|
|
|
|
</where>
|
|
</select>
|
|
|
|
<select id="findNcCodeDescriptionByNcCode" resultMap="ncCodeDto">
|
|
SELECT NC.NC_CODE NC_CODE, NCT.DESCRIPTION DESCRIPTION,NG.NC_GROUP NG_GROUP,NG.DESCRIPTION NG_DESCRIPTION
|
|
FROM NC_CODE NC
|
|
LEFT JOIN NC_CODE_T NCT ON NC.HANDLE = NCT.NC_CODE_BO AND NCT.LOCALE = #{locale}
|
|
LEFT JOIN NC_GROUP_MEMBER NGM ON NGM.NC_CODE_OR_GROUP_GBO = NC.HANDLE
|
|
LEFT JOIN NC_GROUP NG ON NG.HANDLE = NGM.NC_GROUP_BO
|
|
<where>
|
|
NC.SITE = #{site} AND NC.NC_CODE IN
|
|
<foreach collection="ncCode" open="(" close=")" item="item" separator=",">
|
|
UPPER(#{item})
|
|
</foreach>
|
|
AND NC.STATUS_BO = 'StatusBO:' || #{site} || ',101'
|
|
</where>
|
|
</select>
|
|
|
|
<select id="findNcCodeByNcGroupList" resultMap="ncCodeDto">
|
|
SELECT NC.NC_CODE NC_CODE, NCT.DESCRIPTION DESCRIPTION,NG.NC_GROUP NG_GROUP,NG.DESCRIPTION NG_DESCRIPTION
|
|
FROM NC_CODE NC
|
|
LEFT JOIN NC_CODE_T NCT ON NC.HANDLE = NCT.NC_CODE_BO AND NCT.LOCALE = #{locale}
|
|
LEFT JOIN NC_GROUP_MEMBER NGM ON NGM.NC_CODE_OR_GROUP_GBO = NC.HANDLE
|
|
LEFT JOIN NC_GROUP NG ON NG.HANDLE = NGM.NC_GROUP_BO
|
|
<where>
|
|
NC.SITE = #{site} AND NG.NC_GROUP IN
|
|
<foreach collection="ncGroup" open="(" close=")" item="item" separator=",">
|
|
UPPER(#{item})
|
|
</foreach>
|
|
</where>
|
|
</select>
|
|
|
|
<!--根据不良代码,查询描述,以逗号为分隔符-->
|
|
<select id="findNcCodeDescriptionByNcCodeList" resultType="java.lang.String">
|
|
SELECT LISTAGG(T.DESCRIPTION,',') WITHIN GROUP (ORDER BY T.SITE) AS NC_CODE_DESCRIPTION
|
|
FROM (
|
|
SELECT NC.SITE ,NCT.DESCRIPTION FROM NC_CODE NC
|
|
LEFT JOIN NC_CODE_T NCT ON NCT.NC_CODE_BO = NC.HANDLE AND NCT.LOCALE = 'zh'
|
|
WHERE NC.SITE = #{site} AND NC.NC_CODE IN
|
|
<foreach collection="ncCode" open="(" close=")" item="item" separator=",">
|
|
UPPER(#{item})
|
|
</foreach>
|
|
) T GROUP BY T.SITE
|
|
</select>
|
|
|
|
</mapper>
|