package thyyxxk.webserver.dao.his.dictionary.wxservice;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import thyyxxk.webserver.entity.dictionary.wxservice.ZdHealthEducationType;

import java.util.List;

@Mapper
public interface ZdHealthEducationTypeDao extends BaseMapper<ZdHealthEducationType> {

    @Select(" select * from zd_health_education_type order by sort ")
    List<ZdHealthEducationType> selectHeType();

    @Select(" select * from zd_health_education_type where code = #{code}  ")
    ZdHealthEducationType selectHeTypeByCode(@Param("code") String code);

    @Update("<script>" +
            "update zd_health_education_type " +
            "<trim prefix=\"set\" suffixOverrides=\",\">" +
            "<if test=\"code != null and code != '' \">" +
            "code = #{code}, " +
            "</if>" +
            "<if test=\"name != null and name != '' \">" +
            "name = #{name}, " +
            "</if>" +
            "<if test=\"sort != null and sort != '' \">" +
            "sort = #{sort}, " +
            "</if>" +
            "<if test=\"delFlag != null and delFlag != '' \">" +
            "del_flag = #{delFlag}, " +
            "</if>" +
            "</trim>" +
            "where code = #{code} " +
            "</script>")
    int updateHeTypeByCode(ZdHealthEducationType zdHealthEducationType);

    @Delete(" delete from zd_health_education_type where code = #{code} ")
    int deleteHeTypeByCode(@Param("code") String code);

}
