<?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="XxlJobGroupMapper">
	
	<resultMap id="XxlJobGroup" type="com.xxl.job.admin.core.model.XxlJobGroup" >
		<result column="id" property="id" />
	    <result column="app_name" property="appName" />
	    <result column="title" property="title" />
	    <result column="order" property="order" />
		<result column="address_type" property="addressType" />
		<result column="address_list" property="addressList" />
	</resultMap>

	<sql id="Base_Column_List">
		t.id,
		t.app_name,
		t.title,
		t.order,
		t.address_type,
		t.address_list
	</sql>

	<select id="findAll" parameterType="java.lang.Integer" resultMap="XxlJobGroup">
		SELECT <include refid="Base_Column_List" />
		FROM XXL_JOB_QRTZ_TRIGGER_GROUP AS t
		ORDER BY t.order ASC
	</select>

	<insert id="save" parameterType="com.xxl.job.admin.core.model.XxlJobGroup" >
		INSERT INTO XXL_JOB_QRTZ_TRIGGER_GROUP ( `app_name`, `title`, `order`, `address_type`, `address_list`)
		values ( #{appName}, #{title}, #{order}, #{addressType}, #{addressList});
	</insert>

	<update id="update" parameterType="com.xxl.job.admin.core.model.XxlJobGroup" >
		UPDATE XXL_JOB_QRTZ_TRIGGER_GROUP
		SET `app_name` = #{appName},
			`title` = #{title},
			`order` = #{order},
			`address_type` = #{addressType},
			`address_list` = #{addressList}
		WHERE id = #{id}
	</update>

	<delete id="remove" parameterType="java.lang.Integer" >
		DELETE FROM XXL_JOB_QRTZ_TRIGGER_GROUP
		WHERE id = #{id}
	</delete>

	<select id="load" parameterType="java.lang.Integer" resultMap="XxlJobGroup">
		SELECT <include refid="Base_Column_List" />
		FROM XXL_JOB_QRTZ_TRIGGER_GROUP AS t
		WHERE t.id = #{id}
	</select>

</mapper>