cn.ponfee.disjob.supervisor.dao.xml.SchedGroupMapper.xml Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of disjob-supervisor Show documentation
Show all versions of disjob-supervisor Show documentation
Distributed job supervisor module
The newest version!
<?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="cn.ponfee.disjob.supervisor.dao.mapper.SchedGroupMapper"> <sql id="Table_Name">sched_group</sql> <sql id="Base_Column_List"> `group`, own_user, supervisor_token, worker_token, user_token, dev_users, alarm_users, worker_context_path, web_hook </sql> <sql id="Large_Column_List"> <include refid="Base_Column_List" />, version, updated_by, created_by, updated_at, created_at </sql> <insert id="insert" keyColumn="id" keyProperty="id" parameterType="cn.ponfee.disjob.supervisor.model.SchedGroup" useGeneratedKeys="true"> INSERT INTO <include refid="Table_Name" /> ( `group`, own_user, updated_by, created_by ) VALUES ( #{group,jdbcType=VARCHAR}, #{ownUser,jdbcType=VARCHAR}, #{updatedBy,jdbcType=VARCHAR}, #{createdBy,jdbcType=VARCHAR} ) </insert> <select id="get" resultType="cn.ponfee.disjob.supervisor.model.SchedGroup"> SELECT <include refid="Large_Column_List"/> FROM <include refid="Table_Name" /> WHERE `group` = #{group,jdbcType=VARCHAR} AND is_deleted = 0 </select> <select id="findAll" resultType="cn.ponfee.disjob.supervisor.model.SchedGroup"> SELECT <include refid="Base_Column_List"/> FROM <include refid="Table_Name" /> WHERE is_deleted = 0 </select> <update id="updateToken"> UPDATE <include refid="Table_Name" /> SET ${type}_token = #{newToken,jdbcType=VARCHAR}, updated_by = #{updatedBy,jdbcType=VARCHAR}, version = version+1 WHERE `group` = #{group,jdbcType=VARCHAR} AND ${type}_token = #{oldToken,jdbcType=VARCHAR} AND is_deleted = 0 </update> <update id="updateOwnUser"> UPDATE <include refid="Table_Name" /> SET own_user = #{ownUser,jdbcType=VARCHAR}, updated_by = #{updatedBy,jdbcType=VARCHAR}, version = version+1 WHERE `group` = #{group,jdbcType=VARCHAR} AND is_deleted = 0 </update> <update id="softDelete" parameterType="string"> UPDATE <include refid="Table_Name" /> SET is_deleted = id, updated_by = #{updatedBy,jdbcType=VARCHAR}, version = version+1 WHERE `group` = #{group,jdbcType=VARCHAR} AND is_deleted = 0 </update> <update id="edit"> UPDATE <include refid="Table_Name" /> SET own_user = #{ownUser,jdbcType=VARCHAR}, dev_users = #{devUsers,jdbcType=VARCHAR}, alarm_users = #{alarmUsers,jdbcType=VARCHAR}, worker_context_path = #{workerContextPath,jdbcType=VARCHAR}, web_hook = #{webHook,jdbcType=VARCHAR}, updated_by = #{updatedBy,jdbcType=VARCHAR}, version = version+1 WHERE `group` = #{group,jdbcType=VARCHAR} AND version = #{version,jdbcType=INTEGER} AND is_deleted = 0 </update> <!-- | SELECT COUNT(*) cnt FROM ( | SELECT 1 | FROM <include refid="Table_Name" /> | WHERE `group` = #{group,jdbcType=VARCHAR} AND is_deleted = 0 | LIMIT 1 | ) t |--> <select id="exists" parameterType="string" resultType="_boolean"> SELECT EXISTS ( SELECT 1 FROM <include refid="Table_Name" /> WHERE `group` = #{group,jdbcType=VARCHAR} AND is_deleted = 0 ) </select> <select id="searchGroup" parameterType="string" resultType="string"> SELECT `group` FROM <include refid="Table_Name" /> WHERE is_deleted = 0 <if test="_parameter != null and _parameter != ''"> AND `group` LIKE #{_parameter} </if> LIMIT 20 </select> <!-- ********************page query******************** --> <select id="queryPageCount" resultType="_long"> SELECT COUNT(*) cnt FROM <include refid="Table_Name" /> <include refid="Query_Page_Condition" /> </select> <select id="queryPageRecords" resultType="cn.ponfee.disjob.supervisor.model.SchedGroup"> SELECT <include refid="Large_Column_List" /> FROM <include refid="Table_Name" /> <include refid="Query_Page_Condition" /> ORDER BY updated_at DESC LIMIT #{offset}, #{pageSize} </select> <sql id="Query_Page_Condition"> WHERE is_deleted = 0 <if test="groups != null and groups.size() != 0"> AND `group` IN (<foreach collection="groups" separator="," item="g">#{g,jdbcType=VARCHAR}</foreach>) </if> </sql> </mapper>
© 2015 - 2025 Weber Informatics LLC | Privacy Policy