This repository has been archived on 2025-09-14. You can view files and clone it, but cannot push or open issues or pull requests.
Files
k18-ntcs-web-ntc/src/main/java/com/nis/web/dao/specific/SpecificServiceCfgDao.xml
wangxin 272afe55f7 (1)行为类型由userRegion改为加在behavCode字段上
(2)界面展示行为类型的name
(3)审核自定义域添加BEHAV_ID
2018-07-24 10:46:54 +08:00

188 lines
7.9 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.nis.web.dao.specific.SpecificServiceCfgDao" >
<resultMap id="CFGResultMap" type="com.nis.domain.specific.SpecificServiceCfg" >
<id column="spec_service_id" property="specServiceId" jdbcType="INTEGER" />
<result column="spec_service_code" property="specServiceCode" jdbcType="INTEGER" />
<result column="spec_service_name" property="specServiceName" jdbcType="VARCHAR" />
<result column="spec_service_desc" property="specServiceDesc" jdbcType="VARCHAR" />
<result column="is_valid" property="isValid" jdbcType="INTEGER" />
<result column="op_time" property="opTime" jdbcType="TIMESTAMP" />
<result column="is_leaf" property="isLeaf" jdbcType="INTEGER" />
<result column="group_id" property="groupId" jdbcType="INTEGER" />
<result column="cfg_type" property="cfgType" jdbcType="INTEGER" />
<!-- 父id -->
<association property="parent" javaType="com.nis.domain.specific.SpecificServiceCfg">
<id column="parent_id" property="specServiceId" jdbcType="INTEGER" />
</association>
</resultMap>
<sql id="specificServiceCfgColumns">
s.spec_service_id AS specServiceId,
s.spec_service_code AS specServiceCode,
s.spec_service_name AS specServiceName,
s.spec_service_desc AS specServiceDesc,
s.is_valid AS isValid,
s.op_time AS opTime,
s.parent_id AS "parent.specServiceId",
s.is_leaf AS isLeaf,
s.group_id AS groupId,
s.cfg_type AS cfgType
</sql>
<!-- 根据id查出对象 -->
<select id="getBySpecServiceId" resultType="com.nis.domain.specific.SpecificServiceCfg" parameterType="java.lang.Integer">
select <include refid="specificServiceCfgColumns" />
from specific_service_cfg s where s.spec_service_id = #{specServiceId}
</select>
<!-- 查出所有符合条件的顶层数据 -->
<select id="findTopPage" resultMap="CFGResultMap" parameterType="com.nis.domain.specific.SpecificServiceCfg">
SELECT * FROM specific_service_cfg s WHERE s.is_valid=1
<if test="specServiceId != null">
AND s.spec_service_id like '%${specServiceId}%'
</if>
<if test="specServiceName != null and specServiceName != '' ">
AND s.spec_service_name like '%${specServiceName}%'
</if>
<if test="specServiceDesc != null and specServiceDesc != '' ">
AND s.spec_service_desc like '%${specServiceDesc}%'
</if>
<if test="groupId != null and groupId != '' ">
AND group_id like '%${groupId}%'
</if>
<if test="cfgType != null and cfgType != '' ">
AND cfg_type =#{cfgType,jdbcType=INTEGER}
</if>
<if test="beginDate != null" >
AND s.op_time &gt;= #{beginDate,jdbcType=TIMESTAMP}
</if>
<if test="endDate != null" >
AND s.op_time &lt;= #{endDate,jdbcType=TIMESTAMP}
</if>
AND s.parent_id not in (
SELECT s2.spec_service_id FROM specific_service_cfg s2 WHERE s2.is_valid=1
<if test="specServiceId != null">
AND s2.spec_service_id like '%${specServiceId}%'
</if>
<if test="specServiceCode != null">
AND spec_service_code = #{specServiceCode}
</if>
<if test="specServiceName != null and specServiceName != '' ">
AND s2.spec_service_name like '%${specServiceName}%'
</if>
<if test="specServiceDesc != null and specServiceDesc != '' ">
AND s2.spec_service_desc like '%${specServiceDesc}%'
</if>
<if test="groupId != null and groupId != '' ">
AND group_id like '%${groupId}%'
</if>
<if test="beginDate != null" >
AND s2.op_time &gt;= #{beginDate,jdbcType=TIMESTAMP}
</if>
<if test="endDate != null" >
AND s2.op_time &lt;= #{endDate,jdbcType=TIMESTAMP}
</if>
)
<choose>
<when test="page != null and page.orderBy != null and page.orderBy != ''">
ORDER BY s.${page.orderBy}
</when>
<otherwise>
ORDER BY s.op_time desc
</otherwise>
</choose>
</select>
<!-- 查询符合条件的所有数据 -->
<select id="findAllSpecificServiceCfg" resultMap="CFGResultMap" >
SELECT * from specific_service_cfg where is_valid = 1
<if test="specificServiceCfg.specServiceId != null">
AND spec_service_id =#{specificServiceCfg.specServiceId}
</if>
<if test="specificServiceCfg.specServiceCode != null">
AND spec_service_code =#{specificServiceCfg.specServiceCode}
</if>
<if test="specificServiceCfg.specServiceName != null and specificServiceCfg.specServiceName != '' ">
AND spec_service_name like '%${specificServiceCfg.specServiceName}%'
</if>
<if test="specificServiceCfg.specServiceDesc != null and specificServiceCfg.specServiceDesc != '' ">
AND spec_service_desc like '%${specificServiceCfg.specServiceDesc}%'
</if>
<if test="specificServiceCfg.groupId != null and specificServiceCfg.groupId != '' ">
AND group_id like '%${specificServiceCfg.groupId}%'
</if>
<if test="specificServiceCfg.cfgType != null and specificServiceCfg.cfgType != '' ">
AND cfg_type = #{specificServiceCfg.cfgType}
</if>
<if test="specificServiceCfg.isLeaf != null and specificServiceCfg.isLeaf != '' ">
AND is_leaf = #{specificServiceCfg.isLeaf}
</if>
<if test="specificServiceCfg.beginDate != null">
AND op_time &gt; #{specificServiceCfg.beginDate}
</if>
<if test="specificServiceCfg.endDate != null" >
AND op_time &lt; #{specificServiceCfg.endDate}
</if>
<choose>
<when test="orderBy != null and orderBy != '' ">
ORDER BY ${orderBy}
</when>
<otherwise>
ORDER BY op_time desc
</otherwise>
</choose>
</select>
<!-- 新增 -->
<insert id="insert" parameterType="com.nis.domain.specific.SpecificServiceCfg" useGeneratedKeys="true">
insert into specific_service_cfg (spec_service_code,spec_service_name,spec_service_desc,is_valid, op_time, parent_id,is_leaf,group_id,cfg_type)
values(#{specServiceCode},#{specServiceName},#{specServiceDesc},#{isValid},#{opTime},#{parent.specServiceId},#{isLeaf},#{groupId},#{cfgType})
</insert>
<!-- 修改 -->
<update id="update" parameterType="com.nis.domain.specific.SpecificServiceCfg">
UPDATE specific_service_cfg s SET
s.spec_service_code = #{specServiceCode},
s.spec_service_name = #{specServiceName},
s.spec_service_desc = #{specServiceDesc},
s.is_valid = #{isValid},
s.op_time = #{opTime},
s.parent_id = #{parent.specServiceId},
s.is_leaf = #{isLeaf},
s.group_id = #{groupId},
s.cfg_type = #{cfgType}
WHERE s.spec_service_id = #{specServiceId}
</update>
<!-- 删除 -->
<update id="delete" parameterType="com.nis.domain.specific.SpecificServiceCfg">
UPDATE specific_service_cfg s set s.is_valid = #{isValid} where s.spec_service_id = #{specServiceId}
</update>
<!-- getChildrenById -->
<select id="getChildrenById" resultMap="CFGResultMap" parameterType="java.lang.Integer">
SELECT * FROM specific_service_cfg s WHERE s.is_valid = 1 and s.parent_id = #{specServiceId}
</select>
<!-- 根据groupId查出配置分组信息 -->
<select id="getConfigGroupInfoByGroupId" resultType="com.nis.domain.specific.ConfigGroupInfo" parameterType="java.lang.Integer">
select id,group_id,group_name,is_issued,insert_time,update_time,group_type
from config_group_info c where c.group_id= #{groupId}
</select>
<!-- 修改配置分组状态信息 -->
<update id="updateConfigGroupInfobyGroupId" parameterType="com.nis.domain.specific.ConfigGroupInfo">
UPDATE config_group_info set is_issued = #{isIssued},update_time=now() where group_id = #{groupId}
</update>
<!-- 新增配置分组信息 -->
<insert id="insertConfigGroupInfo" parameterType="com.nis.domain.specific.ConfigGroupInfo" useGeneratedKeys="true">
insert into config_group_info (id,group_id,group_name,is_issued,insert_time,group_type)
values(#{id},#{groupId},#{groupName},#{isIssued},now(),#{groupType})
</insert>
</mapper>