<?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.microservices.dss.projects.mapper.IssuesMapper">
    <resultMap id="BaseResultMap" type="com.microservices.dss.projects.domain.Issues">
        <id column="id" property="id" jdbcType="INTEGER" />
        <result column="tracker_id" property="trackerId" jdbcType="INTEGER" />
        <result column="project_id" property="projectId" jdbcType="INTEGER" />
        <result column="subject" property="subject" jdbcType="VARCHAR" />
        <result column="due_date" property="dueDate" jdbcType="DATE" />
        <result column="category_id" property="categoryId" jdbcType="INTEGER" />
        <result column="status_id" property="statusId" jdbcType="INTEGER" />
        <result column="assigned_to_id" property="assignedToId" jdbcType="INTEGER" />
        <result column="priority_id" property="priorityId" jdbcType="INTEGER" />
        <result column="fixed_version_id" property="fixedVersionId" jdbcType="INTEGER" />
        <result column="author_id" property="authorId" jdbcType="INTEGER" />
        <result column="created_on" property="createdOn" jdbcType="TIMESTAMP" />
        <result column="updated_on" property="updatedOn" jdbcType="TIMESTAMP" />
        <result column="start_date" property="startDate" jdbcType="DATE" />
        <result column="done_ratio" property="doneRatio" jdbcType="INTEGER" />
        <result column="estimated_hours" property="estimatedHours" jdbcType="REAL" />
        <result column="parent_id" property="parentId" jdbcType="INTEGER" />
        <result column="root_id" property="rootId" jdbcType="INTEGER" />
        <result column="lft" property="lft" jdbcType="INTEGER" />
        <result column="rgt" property="rgt" jdbcType="INTEGER" />
        <result column="is_private" property="isPrivate" jdbcType="BIT" />
        <result column="closed_on" property="closedOn" jdbcType="TIMESTAMP" />
        <result column="project_issues_index" property="projectIssuesIndex" jdbcType="INTEGER" />
        <result column="issue_type" property="issueType" jdbcType="VARCHAR" />
        <result column="token" property="token" jdbcType="INTEGER" />
        <result column="issue_tags_value" property="issueTagsValue" jdbcType="VARCHAR" />
        <result column="is_lock" property="isLock" jdbcType="BIT" />
        <result column="issue_classify" property="issueClassify" jdbcType="VARCHAR" />
        <result column="ref_name" property="refName" jdbcType="VARCHAR" />
        <result column="branch_name" property="branchName" jdbcType="VARCHAR" />
    </resultMap>

    <select id="getNewAddedIssuesCompletionByMonth" parameterType="java.lang.String" resultType="java.util.HashMap">
        SELECT
            DATE_FORMAT(created_on, '%Y-%m') AS createTime,
            COUNT(*) AS num
        FROM
            issues
        WHERE
            created_on &gt;= #{startTime,jdbcType=VARCHAR}
          AND created_on &lt;= #{endTime,jdbcType=VARCHAR}
        GROUP BY DATE_FORMAT(created_on, '%Y-%m')
    </select>
</mapper>