<?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.ruoyi.system.mapper.TServiceManageMapper">
    
    <resultMap type="TServiceManage" id="TServiceManageResult">
        <result property="id"    column="id"    />
        <result property="storeName"    column="store_name"    />
        <result property="storeNature"    column="store_nature"    />
        <result property="username"    column="username"    />
        <result property="password"    column="password"    />
        <result property="leader"    column="leader"    />
        <result property="leaderTel"    column="leader_tel"    />
        <result property="serviceStatus"    column="service_status"    />
        <result property="begintime"    column="begintime"    />
        <result property="endtime"    column="endtime"    />
        <result property="weekendStatus"    column="weekend_status"    />
        <result property="holidayStatus"    column="holiday_status"    />
        <result property="phone"    column="phone"    />
        <result property="isRegion"    column="is_region"    />
        <result property="serviceRegion"    column="service_region"    />
        <result property="address"    column="address"    />
        <result property="settleTime"    column="settle_time"    />
        <result property="storeOnline"    column="store_online"    />
        <result property="isOne"    column="is_one"    />
        <result property="businessurl"    column="businessurl"    />
        <result property="storeurl"    column="storeurl"    />
        <result property="contracturl"    column="contracturl"    />
        <result property="creditCode"    column="credit_code"    />
        <result property="releaseScope"    column="release_scope"    />
        <result property="createDepartment"    column="create_department"    />
        <result property="status"    column="status"    />
        <result property="introduction"    column="introduction"    />
        <result property="createTime"    column="createtime"    />
    </resultMap>

    <sql id="selectTServiceManageVo">
        select id, store_name, store_nature, username, password, leader, leader_tel, service_status, begintime, endtime, weekend_status, holiday_status, phone, is_region, service_region, address, settle_time, store_online, is_one, businessurl, storeurl, contracturl, credit_code, release_scope, create_department, status, createtime,introduction from t_service_manage
    </sql>

    <select id="selectTServiceManageList" parameterType="TServiceManage" resultMap="TServiceManageResult">
        <include refid="selectTServiceManageVo"/>
        <where>  
            <if test="storeName != null  and storeName != ''"> and store_name like concat('%', #{storeName}, '%')</if>
            <if test="storeNature != null "> and store_nature = #{storeNature}</if>
            <if test="username != null  and username != ''"> and username like concat('%', #{username}, '%')</if>
            <if test="password != null  and password != ''"> and password = #{password}</if>
            <if test="leader != null  and leader != ''"> and leader = #{leader}</if>
            <if test="leaderTel != null  and leaderTel != ''"> and leader_tel = #{leaderTel}</if>
            <if test="serviceStatus != null "> and service_status = #{serviceStatus}</if>
            <if test="begintime != null "> and begintime = #{begintime}</if>
            <if test="endtime != null "> and endtime = #{endtime}</if>
            <if test="weekendStatus != null "> and weekend_status = #{weekendStatus}</if>
            <if test="holidayStatus != null "> and holiday_status = #{holidayStatus}</if>
            <if test="phone != null  and phone != ''"> and phone = #{phone}</if>
            <if test="isRegion != null  and isRegion != ''"> and is_region = #{isRegion}</if>
            <if test="serviceRegion != null  and serviceRegion != ''"> and service_region = #{serviceRegion}</if>
            <if test="address != null  and address != ''"> and address = #{address}</if>
            <if test="settleTime != null "> and settle_time = #{settleTime}</if>
            <if test="storeOnline != null "> and store_online = #{storeOnline}</if>
            <if test="isOne != null "> and is_one = #{isOne}</if>
            <if test="businessurl != null  and businessurl != ''"> and businessurl = #{businessurl}</if>
            <if test="storeurl != null  and storeurl != ''"> and storeurl = #{storeurl}</if>
            <if test="contracturl != null  and contracturl != ''"> and contracturl = #{contracturl}</if>
            <if test="creditCode != null  and creditCode != ''"> and credit_code = #{creditCode}</if>
            <if test="releaseScope != null  and releaseScope != ''"> and release_scope = #{releaseScope}</if>
            <if test="createDepartment != null  and createDepartment != ''"> and create_department = #{createDepartment}</if>
            <if test="status != null "> and status = #{status}</if>
            <if test="introduction != null "> and introduction = #{introduction}</if>
            <if test="createTime != null "> and createtime = #{createTime}</if>
        </where>
    </select>
    
    <select id="selectTServiceManageById" parameterType="Integer" resultMap="TServiceManageResult">
        <include refid="selectTServiceManageVo"/>
        where id = #{id}
    </select>

    <insert id="insertTServiceManage" parameterType="TServiceManage" useGeneratedKeys="true" keyProperty="id">
        insert into t_service_manage
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="storeName != null">store_name,</if>
            <if test="storeNature != null">store_nature,</if>
            <if test="username != null">username,</if>
            <if test="password != null">password,</if>
            <if test="leader != null">leader,</if>
            <if test="leaderTel != null">leader_tel,</if>
            <if test="serviceStatus != null">service_status,</if>
            <if test="begintime != null">begintime,</if>
            <if test="endtime != null">endtime,</if>
            <if test="weekendStatus != null">weekend_status,</if>
            <if test="holidayStatus != null">holiday_status,</if>
            <if test="phone != null">phone,</if>
            <if test="isRegion != null">is_region,</if>
            <if test="serviceRegion != null">service_region,</if>
            <if test="address != null">address,</if>
            <if test="settleTime != null">settle_time,</if>
            <if test="storeOnline != null">store_online,</if>
            <if test="isOne != null">is_one,</if>
            <if test="businessurl != null">businessurl,</if>
            <if test="storeurl != null">storeurl,</if>
            <if test="contracturl != null">contracturl,</if>
            <if test="creditCode != null">credit_code,</if>
            <if test="releaseScope != null">release_scope,</if>
            <if test="createDepartment != null">create_department,</if>
            <if test="status != null">status,</if>
            <if test="introduction != null">introduction,</if>
            <if test="createTime != null">createtime,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="storeName != null">#{storeName},</if>
            <if test="storeNature != null">#{storeNature},</if>
            <if test="username != null">#{username},</if>
            <if test="password != null">#{password},</if>
            <if test="leader != null">#{leader},</if>
            <if test="leaderTel != null">#{leaderTel},</if>
            <if test="serviceStatus != null">#{serviceStatus},</if>
            <if test="begintime != null">#{begintime},</if>
            <if test="endtime != null">#{endtime},</if>
            <if test="weekendStatus != null">#{weekendStatus},</if>
            <if test="holidayStatus != null">#{holidayStatus},</if>
            <if test="phone != null">#{phone},</if>
            <if test="isRegion != null">#{isRegion},</if>
            <if test="serviceRegion != null">#{serviceRegion},</if>
            <if test="address != null">#{address},</if>
            <if test="settleTime != null">#{settleTime},</if>
            <if test="storeOnline != null">#{storeOnline},</if>
            <if test="isOne != null">#{isOne},</if>
            <if test="businessurl != null">#{businessurl},</if>
            <if test="storeurl != null">#{storeurl},</if>
            <if test="contracturl != null">#{contracturl},</if>
            <if test="creditCode != null">#{creditCode},</if>
            <if test="releaseScope != null">#{releaseScope},</if>
            <if test="createDepartment != null">#{createDepartment},</if>
            <if test="status != null">#{status},</if>
            <if test="introduction != null">#{introduction},</if>
            <if test="createTime != null">#{createTime},</if>
         </trim>
    </insert>

    <update id="updateTServiceManage" parameterType="TServiceManage">
        update t_service_manage
        <trim prefix="SET" suffixOverrides=",">
            <if test="storeName != null">store_name = #{storeName},</if>
            <if test="storeNature != null">store_nature = #{storeNature},</if>
            <if test="username != null">username = #{username},</if>
            <if test="password != null">password = #{password},</if>
            <if test="leader != null">leader = #{leader},</if>
            <if test="leaderTel != null">leader_tel = #{leaderTel},</if>
            <if test="serviceStatus != null">service_status = #{serviceStatus},</if>
            <if test="begintime != null">begintime = #{begintime},</if>
            <if test="endtime != null">endtime = #{endtime},</if>
            <if test="weekendStatus != null">weekend_status = #{weekendStatus},</if>
            <if test="holidayStatus != null">holiday_status = #{holidayStatus},</if>
            <if test="phone != null">phone = #{phone},</if>
            <if test="isRegion != null">is_region = #{isRegion},</if>
            <if test="serviceRegion != null">service_region = #{serviceRegion},</if>
            <if test="address != null">address = #{address},</if>
            <if test="settleTime != null">settle_time = #{settleTime},</if>
            <if test="storeOnline != null">store_online = #{storeOnline},</if>
            <if test="isOne != null">is_one = #{isOne},</if>
            <if test="businessurl != null">businessurl = #{businessurl},</if>
            <if test="storeurl != null">storeurl = #{storeurl},</if>
            <if test="contracturl != null">contracturl = #{contracturl},</if>
            <if test="creditCode != null">credit_code = #{creditCode},</if>
            <if test="releaseScope != null">release_scope = #{releaseScope},</if>
            <if test="createDepartment != null">create_department = #{createDepartment},</if>
            <if test="status != null">status = #{status},</if>
            <if test="introduction != null">introduction = #{introduction},</if>
            <if test="createTime != null">createtime = #{createTime},</if>
        </trim>
        where id = #{id}
    </update>

    <delete id="deleteTServiceManageById" parameterType="Integer">
        delete from t_service_manage where id = #{id}
    </delete>

    <delete id="deleteTServiceManageByIds" parameterType="String">
        delete from t_service_manage where id in 
        <foreach item="id" collection="array" open="(" separator="," close=")">
            #{id}
        </foreach>
    </delete>
</mapper>