You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
90 lines
2.9 KiB
90 lines
2.9 KiB
package com.example.demo.mapper;
|
|
|
|
|
|
import com.example.demo.domain.entity.Admin;
|
|
import org.apache.ibatis.annotations.*;
|
|
|
|
|
|
import java.util.List;
|
|
|
|
@Mapper
|
|
public interface AdminMapper {
|
|
@Insert({
|
|
"insert into admin",
|
|
"(name,jwcode,password,permission,area,store,admin_flag,create_time,remark,status1,machineId)",
|
|
"values",
|
|
"(#{name},#{jwcode},#{password},#{permission},#{area},#{store},#{adminFlag},now(),#{remark},#{status1},#{machineId})"
|
|
})
|
|
@Options(useGeneratedKeys = true,keyColumn = "admin_id",keyProperty = "adminId")
|
|
int insert(Admin admin);
|
|
|
|
@Update({
|
|
"<script>",
|
|
"UPDATE admin",
|
|
"<set>",
|
|
"<if test='name!=null and name.length()>0'>name =#{name},</if>",
|
|
"<if test='password!=null and password.length()>0'>password =#{password},</if>",
|
|
"<if test='permission!=null and permission.length()>0'>permission =#{permission},</if>",
|
|
"<if test='area!=null and area.length()>0'>area =#{area},</if>",
|
|
"<if test='adminFlag!=null '>admin_flag =#{adminFlag},</if>",
|
|
"<if test='status1!=null '>status1 =#{status1},</if>",
|
|
"<if test='remark!=null '>remark =#{remark},</if>",
|
|
"</set>",
|
|
"where jwcode =#{jwcode}",
|
|
"</script>"
|
|
})
|
|
int update(Admin admin);
|
|
@Select({
|
|
"select * from admin",
|
|
"where admin_id=#{adminId}"
|
|
})
|
|
Admin selectById(Integer adminId);
|
|
@Select({
|
|
"select * from admin",
|
|
"where jwcode=#{jwcode}"
|
|
})
|
|
Admin selectByName(String username);
|
|
@Select({
|
|
"<script>",
|
|
"SELECT * from admin",
|
|
"<where>",
|
|
"admin_flag=1",
|
|
"<if test='name!=null and name.length()>0'> and `name` like concat('%',#{name},'%')</if>",
|
|
"<if test='jwcode!=null and jwcode.length()>0'> and jwcode=#{jwcode}</if>",
|
|
"<if test='area!=null and area.length()>0'> and `area`=#{area}</if>",
|
|
"<if test='store!=null and store.length()>0'> and `store`=#{store}</if>",
|
|
"and permission != 4",
|
|
"</where>",
|
|
"ORDER BY status1 DESC, permission ASC",
|
|
"</script>"
|
|
})
|
|
List<Admin> select(Admin admin);
|
|
|
|
@Select({
|
|
"select DISTINCT store from admin"
|
|
})
|
|
List<String> selectStore();
|
|
@Select({
|
|
"select DISTINCT area from admin"
|
|
})
|
|
List<String> selectArea();
|
|
|
|
@Select({
|
|
// "<script>",
|
|
"select * from admin ",
|
|
// "<where>",
|
|
"where (permission != 1 AND permission != 2 AND permission != 3) and jwcode=#{jwcode}",
|
|
// "</where>",
|
|
|
|
})
|
|
List<Admin> selectNo(Admin admin);
|
|
|
|
@Select({
|
|
"select * from admin",
|
|
"where jwcode=#{jwcode}",
|
|
"and",
|
|
"admin_flag = 1"
|
|
})
|
|
Admin selectByJwcode(String jwcode);
|
|
|
|
}
|