<?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.ezhizao.project.business.mapper.BizTakeStockPeriodMapper">

    <resultMap type="cn.ezhizao.project.business.domain.BizTakeStockPeriod" id="BizTakeStockPeriodResult">
        <id column="id" property="id"/>
    </resultMap>


    <select id="getList" parameterType="BizTakeStockPeriod" resultMap="BizTakeStockPeriodResult">
        SELECT *, CONCAT(stock_year, '-', LPAD(stock_month, 2, '0')) AS stockTime  FROM biz_take_stock_period
        <trim prefix=" WHERE" suffix="" suffixOverrides="AND">
            deleted = 0
            <if test="status != null "> AND status = #{status}</if>
            <if test="remark != null "> AND remark like concat('%',#{remark},'%')</if>
            <if test="createStartTime != null ">AND create_time &gt; #{createStartTime}</if>
            <if test="createEndTime != null ">AND create_time &lt; #{createEndTime}</if>
            <if test="startTimeStr != null ">AND start_time &gt; #{startTimeStr}</if>
            <if test="startTimeEnd != null ">AND start_time &lt; #{startTimeEnd}</if>
            <if test="endTimeStr != null ">AND end_time &gt; #{endTimeStr}</if>
            <if test="endTimeEnd != null ">AND end_time &lt; #{endTimeEnd}</if>
        </trim>
        order by create_time desc
    </select>
    <update id="updateDruidPoolSize">
        SET GLOBAL max_connections = #{druidPoolSize} ;
    </update>

    <delete id="physicalDelete">
        DELETE FROM biz_take_stock_period
        <trim prefix=" WHERE" suffix="" suffixOverrides="AND">
            <if test="id != null">
                id = #{id} AND
            </if>
       <!-- 删除条件为其他外键可以在这里加 -->
        </trim>
    </delete>
</mapper>
