<?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.mmc.csf.release.dao.RequirementsDao">

    <insert id="addRequirementsInfo" parameterType="com.mmc.csf.release.entity.RequirementsInfoDO"
    keyProperty="id" useGeneratedKeys="true">
        INSERT INTO `iuav_ims`.`requirements_info`(`requirement_type_id`, `user_account_id`, `publish_name`, `publish_phone`, `require_description`, `create_time`)
        VALUES (#{requirementTypeId}, #{userAccountId}, #{publishName}, #{publishPhone}, #{requireDescription}, NOW());
    </insert>

    <update id="solveRequire">
        update requirements_info set is_solved = 1 where id = #{requirementsInfoId}
    </update>

    <select id="listType" resultType="com.mmc.csf.release.entity.RequirementsTypeDO">
        select id, type_name from requirements_type where is_deleted = 0
    </select>

    <select id="getRequirementsInfoById" resultType="com.mmc.csf.release.entity.RequirementsInfoDO">
        select id, requirement_type_id, user_account_id, publish_name, publish_phone, require_description, is_solved as solved, create_time from requirements_info where id = #{id}
    </select>
</mapper>