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.

354 lines
19 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.NcGroupMapper">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="com.foreverwin.mesnac.meapi.model.NcGroup">
<result column="HANDLE" property="handle" />
<result column="CHANGE_STAMP" property="changeStamp" />
<result column="SITE" property="site" />
<result column="NC_GROUP" property="ncGroup" />
<result column="DESCRIPTION" property="description" />
<result column="VALID_AT_ALL_OPERATIONS" property="validAtAllOperations" />
<result column="PRIORITY" property="priority" />
<result column="CREATED_DATE_TIME" property="createdDateTime" />
<result column="MODIFIED_DATE_TIME" property="modifiedDateTime" />
</resultMap>
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
HANDLE, CHANGE_STAMP, SITE, NC_GROUP, DESCRIPTION, VALID_AT_ALL_OPERATIONS, PRIORITY, CREATED_DATE_TIME, MODIFIED_DATE_TIME
</sql>
<!-- BaseMapper标准查询/修改/删除 -->
<select id="selectByMap" resultMap="BaseResultMap">
SELECT <include refid="Base_Column_List"></include>
FROM NC_GROUP
<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_GROUP
<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.ncGroup!=null"> AND NC_GROUP=#{ew.entity.ncGroup}</if>
<if test="ew.entity.description!=null"> AND DESCRIPTION=#{ew.entity.description}</if>
<if test="ew.entity.validAtAllOperations!=null"> AND VALID_AT_ALL_OPERATIONS=#{ew.entity.validAtAllOperations}</if>
<if test="ew.entity.priority!=null"> AND PRIORITY=#{ew.entity.priority}</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>
</where>
</select>
<select id="selectCount" resultType="Integer">
SELECT COUNT(1) FROM NC_GROUP
<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.ncGroup!=null"> AND NC_GROUP=#{ew.entity.ncGroup}</if>
<if test="ew.entity.description!=null"> AND DESCRIPTION=#{ew.entity.description}</if>
<if test="ew.entity.validAtAllOperations!=null"> AND VALID_AT_ALL_OPERATIONS=#{ew.entity.validAtAllOperations}</if>
<if test="ew.entity.priority!=null"> AND PRIORITY=#{ew.entity.priority}</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>
<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 <choose><when test="ew != null and ew.sqlSelect != null">${ew.sqlSelect}</when><otherwise><include refid="Base_Column_List"></include></otherwise></choose> FROM NC_GROUP
<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.ncGroup!=null"> AND NC_GROUP=#{ew.entity.ncGroup}</if>
<if test="ew.entity.description!=null"> AND DESCRIPTION=#{ew.entity.description}</if>
<if test="ew.entity.validAtAllOperations!=null"> AND VALID_AT_ALL_OPERATIONS=#{ew.entity.validAtAllOperations}</if>
<if test="ew.entity.priority!=null"> AND PRIORITY=#{ew.entity.priority}</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>
<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_GROUP
<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.ncGroup!=null"> AND NC_GROUP=#{ew.entity.ncGroup}</if>
<if test="ew.entity.description!=null"> AND DESCRIPTION=#{ew.entity.description}</if>
<if test="ew.entity.validAtAllOperations!=null"> AND VALID_AT_ALL_OPERATIONS=#{ew.entity.validAtAllOperations}</if>
<if test="ew.entity.priority!=null"> AND PRIORITY=#{ew.entity.priority}</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>
<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_GROUP
<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.ncGroup!=null"> AND NC_GROUP=#{ew.entity.ncGroup}</if>
<if test="ew.entity.description!=null"> AND DESCRIPTION=#{ew.entity.description}</if>
<if test="ew.entity.validAtAllOperations!=null"> AND VALID_AT_ALL_OPERATIONS=#{ew.entity.validAtAllOperations}</if>
<if test="ew.entity.priority!=null"> AND PRIORITY=#{ew.entity.priority}</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>
<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_GROUP
<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.ncGroup!=null"> AND NC_GROUP=#{ew.entity.ncGroup}</if>
<if test="ew.entity.description!=null"> AND DESCRIPTION=#{ew.entity.description}</if>
<if test="ew.entity.validAtAllOperations!=null"> AND VALID_AT_ALL_OPERATIONS=#{ew.entity.validAtAllOperations}</if>
<if test="ew.entity.priority!=null"> AND PRIORITY=#{ew.entity.priority}</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>
<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_GROUP
<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.ncGroup!=null"> AND NC_GROUP=#{ew.entity.ncGroup}</if>
<if test="ew.entity.description!=null"> AND DESCRIPTION=#{ew.entity.description}</if>
<if test="ew.entity.validAtAllOperations!=null"> AND VALID_AT_ALL_OPERATIONS=#{ew.entity.validAtAllOperations}</if>
<if test="ew.entity.priority!=null"> AND PRIORITY=#{ew.entity.priority}</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>
<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.NcGroup">
INSERT INTO NC_GROUP
<trim prefix="(" suffix=")" suffixOverrides=",">
HANDLE,
<if test="changeStamp!=null">CHANGE_STAMP,</if>
<if test="site!=null">SITE,</if>
<if test="ncGroup!=null">NC_GROUP,</if>
<if test="description!=null">DESCRIPTION,</if>
<if test="validAtAllOperations!=null">VALID_AT_ALL_OPERATIONS,</if>
<if test="priority!=null">PRIORITY,</if>
<if test="createdDateTime!=null">CREATED_DATE_TIME,</if>
<if test="modifiedDateTime!=null">MODIFIED_DATE_TIME,</if>
</trim> VALUES
<trim prefix="(" suffix=")" suffixOverrides=",">
#{handle},
<if test="changeStamp!=null">#{changeStamp},</if>
<if test="site!=null">#{site},</if>
<if test="ncGroup!=null">#{ncGroup},</if>
<if test="description!=null">#{description},</if>
<if test="validAtAllOperations!=null">#{validAtAllOperations},</if>
<if test="priority!=null">#{priority},</if>
<if test="createdDateTime!=null">#{createdDateTime},</if>
<if test="modifiedDateTime!=null">#{modifiedDateTime},</if>
</trim>
</insert>
<insert id="insertAllColumn" parameterType="com.foreverwin.mesnac.meapi.model.NcGroup">
INSERT INTO NC_GROUP
<trim prefix="(" suffix=")" suffixOverrides=",">
<include refid="Base_Column_List"></include>
</trim> VALUES
<trim prefix="(" suffix=")" suffixOverrides=",">
#{handle},
#{changeStamp},
#{site},
#{ncGroup},
#{description},
#{validAtAllOperations},
#{priority},
#{createdDateTime},
#{modifiedDateTime},
</trim>
</insert>
<update id="update">
UPDATE NC_GROUP <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.ncGroup!=null">NC_GROUP=#{et.ncGroup},</if>
<if test="et.description!=null">DESCRIPTION=#{et.description},</if>
<if test="et.validAtAllOperations!=null">VALID_AT_ALL_OPERATIONS=#{et.validAtAllOperations},</if>
<if test="et.priority!=null">PRIORITY=#{et.priority},</if>
<if test="et.createdDateTime!=null">CREATED_DATE_TIME=#{et.createdDateTime},</if>
<if test="et.modifiedDateTime!=null">MODIFIED_DATE_TIME=#{et.modifiedDateTime},</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.ncGroup!=null"> AND NC_GROUP=#{ew.entity.ncGroup}</if>
<if test="ew.entity.description!=null"> AND DESCRIPTION=#{ew.entity.description}</if>
<if test="ew.entity.validAtAllOperations!=null"> AND VALID_AT_ALL_OPERATIONS=#{ew.entity.validAtAllOperations}</if>
<if test="ew.entity.priority!=null"> AND PRIORITY=#{ew.entity.priority}</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>
<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_GROUP
<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_GROUP
<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.ncGroup!=null"> AND NC_GROUP=#{ew.entity.ncGroup}</if>
<if test="ew.entity.description!=null"> AND DESCRIPTION=#{ew.entity.description}</if>
<if test="ew.entity.validAtAllOperations!=null"> AND VALID_AT_ALL_OPERATIONS=#{ew.entity.validAtAllOperations}</if>
<if test="ew.entity.priority!=null"> AND PRIORITY=#{ew.entity.priority}</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>
<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标准查询/修改/删除 -->
4 years ago
<select id="selectPageByOperation" resultMap="BaseResultMap">
SELECT DISTINCT ng.NC_GROUP,NG.DESCRIPTION FROM NC_GROUP ng
LEFT JOIN NC_GROUP_VALID_OPER ngvo ON ng.HANDLE=ngvo.NC_GROUP_BO
WHERE SITE=#{site} AND (ng.VALID_AT_ALL_OPERATIONS='true' OR ngvo.OPERATION_BO=#{operationBO})
<if test="globalQuery!=null and globalQuery!=''">
AND (ng.NC_GROUP LIKE '%${globalQuery}%' or NG.DESCRIPTION LIKE '%${globalQuery}%')
</if>
</select>
</mapper>