SysEntityDeptMapper.xml 2.31 KB
<?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.chinagas.modules.system.mapper.SysEntityDeptMapper">

    <resultMap type="com.chinagas.api.system.domain.YsEntityDept" id="SysEntityDeptResult">
        <result property="deptId"    column="dept_id"    />
        <result property="deptName"    column="dept_name"    />
        <result property="entity"    column="entity"    />
        <result property="entityName"    column="entity_name"    />
        <result property="status"    column="status"    />
        <result property="ANCESTORS"    column="ANCESTORS"    />
        <result property="objectId"    column="object_id"    />
        <result property="sysCtime"    column="sys_ctime"    />
        <result property="sysUtime"    column="sys_utime"    />
    </resultMap>

    <sql id="selectSysEntityDeptVo">
        select id, dept_id, dept_name, entity, entity_name, status, ANCESTORS, object_id, sys_ctime, sys_utime, delete_flag from ys_entity_dept
    </sql>

    <select id="selectByDept" parameterType="com.chinagas.api.system.domain.YsEntityDept" resultMap="SysEntityDeptResult">
        select * from ys_entity_dept where dept_id = #{deptId} and delete_flag = 0
    </select>

    <insert id="insertEntityDept" parameterType="com.chinagas.api.system.domain.YsEntityDept">
        insert into ys_entity_dept (dept_id, dept_name, entity, entity_name, status, ANCESTORS, object_id)
        values (#{deptId}, #{deptName}, #{entity}, #{entityName}, #{status}, #{ANCESTORS}, #{objectId})
    </insert>

    <select id="selectListByStutus" parameterType="com.chinagas.api.system.domain.YsEntityDept" resultMap="SysEntityDeptResult">
        <include refid="selectSysEntityDeptVo"/>
        <where>
            <if test="entity != null  and entity != ''"> and entity = #{entity}</if>
            <if test="entityName != null  and entityName != ''"> and entity_name REGEXP #{entityName}</if>
            <if test="deptId != null  and deptId != ''"> and dept_id REGEXP #{deptId}</if>
            <if test="deptName != null  and deptName != ''"> and dept_name REGEXP #{deptName}</if>
            <if test="status != null  and status != ''"> and status = #{status}</if>
            and delete_flag = 0
        </where>
    </select>

</mapper>