<?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.ycwl.basic.mapper.pc.ScenicAccountMapper"> <insert id="add"> insert into scenic_account(id, scenic_id, is_super, name, account, password, create_time, update_time) values (#{id}, #{scenicId}, #{isSuper}, #{name}, #{account}, #{password}, now(), now()) </insert> <update id="update"> update scenic_account <set> <if test="name != null and name != ''"> name = #{name}, </if> <if test="account != null and account != ''"> account = #{account}, </if> <if test="password != null and password != ''"> password = #{password}, </if> update_time = now() </set> where id = #{id} </update> <update id="updateStatus"> update scenic_account set status = (CASE WHEN status = 1 THEN 0 WHEN status = 0 THEN 1 ELSE null END) where id = #{id} </update> <delete id="deleteById"> delete from scenic_account where id = #{id} </delete> <delete id="deleteByScenicId"> delete from scenic_account where scenic_id = #{scenicId} </delete> <select id="getSuperAccountOfScenic" resultType="com.ycwl.basic.model.pc.scenic.entity.ScenicAccountEntity"> select id, scenic_id, is_super, name, account, password, create_time, update_time from scenic_account where scenic_id = #{scenicId} and is_super = 1 </select> <select id="getByAccount" resultType="com.ycwl.basic.model.pc.scenic.entity.ScenicAccountEntity"> select id, scenic_id, is_super, name, account, password, create_time, update_time from scenic_account where account = #{account} </select> </mapper>