<?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.gkhy.exam.system.mapper.CatalogueMapper">
|
<insert id="insertCatalogueData" keyProperty="id" useGeneratedKeys="true">
|
INSERT INTO `catalogue_data`
|
( `company_id`, `catalogue_id`, `content`, `analysis`, `create_by`, `create_time` )
|
VALUES
|
( #{companyId}, #{catalogueId}, #{content}, #{analysis}, #{createBy}, #{createTime} )
|
</insert>
|
|
<insert id="insertCatalogueDataFile">
|
INSERT INTO `train_exam`.`catalogue_data_file`
|
( `catalogue_id`,`company_id`, `name`, `file_path`,`file_name`, `type`, `create_by`, `create_time` )
|
VALUES
|
( #{catalogueId},#{companyId}, #{name}, #{filePath},#{fileName}, #{type}, #{createBy}, #{createTime} )
|
</insert>
|
|
<update id="updateCatalogueData">
|
UPDATE `train_exam`.`catalogue_data`
|
SET
|
<if test="companyId!=null">
|
`company_id` = #{companyId},
|
</if>
|
<if test="catalogueId!=null">
|
`catalogue_id` = #{catalogueId},
|
</if>
|
<if test="content!=null and content!=''">
|
`content` = #{content},
|
</if>
|
<if test="analysic!=null and analysic!=''">
|
`analysis` = #{analysis},
|
</if>
|
<if test="delFlag!=null and delFlag!=''">
|
`del_flag` = #{delFlag},
|
</if>
|
<if test="updateBy!=null and update!=''">
|
`update_by` = #{updateBy},
|
</if>
|
<if test="updateTime!=null">
|
`update_time` = #{updateTime}
|
</if>
|
WHERE
|
`id` = #{id}
|
</update>
|
<update id="updateCatalogueDataFile">
|
UPDATE `train_exam`.`catalogue_data_file`
|
<if test="catalogueId!=null">
|
`catalogue_id` = #{catalogueId},
|
</if>
|
<if test="companyId!=null">
|
`company_id` = #{companyId},
|
</if>
|
<if test="name!=null">
|
`name` = #{name},
|
</if>
|
<if test="filePath!=null">
|
`file_path` = #{filePath},
|
</if>
|
<if test="fileName!=null">
|
`file_name` = #{fileName},
|
</if>
|
<if test="type!=null">
|
`type` = #{type},
|
</if>
|
<if test="delFlag != null and delFlag != ''" >
|
del_flag = #{item.delFlag},
|
</if>
|
<if test="updateBy != null" >
|
update_by = #{updateBy},
|
</if>
|
<if test="updateTime != null" >
|
update_time = #{updateTime}
|
</if>
|
where id = #{id}
|
</update>
|
|
<select id="selectCatalogueList" resultType="com.gkhy.exam.system.domain.vo.CatalogueVo">
|
SELECT
|
`id`,
|
`parent_id`,
|
`number`,
|
`mess`,
|
`type`,
|
`del_flag`,
|
`create_by`,
|
`create_time`,
|
`update_by`,
|
`update_time`
|
FROM
|
catalogue
|
WHERE del_flag = 1
|
<if test="type!=null">
|
and type = #{type}
|
</if>
|
ORDER BY create_time ASC
|
</select>
|
<select id="selectCatalogueDataList" resultType="com.gkhy.exam.system.domain.vo.CatalogueDataVo">
|
SELECT
|
cd.`id`,
|
cd.`company_id`,
|
sc.name,
|
cd.`catalogue_id`,
|
cd.`content`,
|
cd.`analysis`,
|
cd.`del_flag`,
|
cd.`create_by`,
|
cd.`create_time`,
|
cd.`update_by`,
|
cd.`update_time`
|
FROM
|
catalogue_data cd
|
left join sys_company sc on cd.company_id = sc.id
|
WHERE
|
cd.del_flag = 1
|
<if test="catalogueId!=null">
|
and cd.catalogue_id = #{catalogueId}
|
</if>
|
<if test="companyId!=null">
|
and cd.company_id = #{companyId}
|
</if>
|
</select>
|
<select id="selectCatalogueDataFile" resultType="com.gkhy.exam.system.domain.CatalogueDataFile">
|
SELECT
|
id,
|
`catalogue_data_id`,
|
`name`,
|
`file_path`,
|
`type`,
|
`create_by`,
|
`create_time`
|
FROM
|
catalogue_data_file
|
WHERE
|
company_id = #{companyId} and catalogue_id = #{catalogueId}
|
</select>
|
<select id="selectByCompanyId" resultType="com.gkhy.exam.system.domain.CatalogueData">
|
SELECT
|
`id`,
|
`company_id`,
|
name,
|
`catalogue_id`,
|
`content`,
|
`analysis`,
|
`del_flag`,
|
`create_by`,
|
`create_time`,
|
`update_by`,
|
`update_time`
|
FROM
|
catalogue_data
|
where company_id = #{companyId} and del_flag = 1
|
|
</select>
|
</mapper>
|