package com.fjs.scenic.mapper.system;

import com.fjs.scenic.entity.system.Manage;
import com.fjs.scenic.mapper.common.BaseMapper;
import org.apache.ibatis.annotations.*;

import java.util.List;

public interface ManageMapper extends BaseMapper<Manage> {

    Manage selectByAccount(@Param("account")String account);
    
    List<Manage> selectRepet(Manage manage);

    List<Manage> selectAll1(Manage record);

    /**
     * 获取具有领导决策管理员的信息
     * @return
     */
    List<Manage> selectLDJCManage();

    /**
     * 通过账号修改
     * @param manage
     * @return
     */
    int updateByAccountKeySelective(Manage manage);

    @Insert("insert into manage(name,account,password,phone,supplier_ids,status,type) " +
            "values(#{name},#{account},#{password},#{phone},#{supplierIds},#{status},'1')")
    int add(Manage manage);

    @Update("update manage set name=#{name},account=#{account},phone=#{phone},supplier_ids=#{supplierIds} where id=#{id}")
    int update(Manage manage);

    @Update("update manage set password=#{password} where id=#{id}")
    int updatePwd(Integer id,String password);

    @Update("update manage set status=#{status} where id=#{id}")
    int updateStatus(@Param("id") Integer id, @Param("status") String status);

    @Delete("delete from manage where id=#{id}")
    int delete(Integer id);

    @Select("select * from manage where type='1'")
    List<Manage> queryAll();

    @Select("select id,name,account,phone,supplier_ids from manage where id=#{id}")
    Manage queryOne(Integer id);

    @Select("select * from manage where account=#{account} and password=#{password} and type='1'")
    Manage getManeger(@Param("account")String account, @Param("password")String password);

    @Select("select id from manage where phone=#{phone} and type='1'")
    Integer queryByPhone(String phone);

    @Select("select id from manage where account=#{account} and type='1'")
    Integer queryByAccount(String account);
}