金币系统后端
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

6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
  1. package com.example.demo.mapper;
  2. import com.example.demo.domain.entity.Admin;
  3. import org.apache.ibatis.annotations.*;
  4. import java.util.List;
  5. @Mapper
  6. public interface AdminMapper {
  7. @Insert({
  8. "insert into admin",
  9. "(name,jwcode,password,permission,area,store,admin_flag,create_time,remark,status1,machineId)",
  10. "values",
  11. "(#{name},#{jwcode},#{password},#{permission},#{area},#{store},#{adminFlag},now(),#{remark},#{status1},#{machineId})"
  12. })
  13. @Options(useGeneratedKeys = true,keyColumn = "admin_id",keyProperty = "adminId")
  14. int insert(Admin admin);
  15. @Update({
  16. "<script>",
  17. "UPDATE admin",
  18. "<set>",
  19. "<if test='name!=null and name.length()>0'>name =#{name},</if>",
  20. "<if test='password!=null and password.length()>0'>password =#{password},</if>",
  21. "<if test='permission!=null and permission.length()>0'>permission =#{permission},</if>",
  22. "<if test='area!=null and area.length()>0'>area =#{area},</if>",
  23. "<if test='adminFlag!=null '>admin_flag =#{adminFlag},</if>",
  24. "<if test='status1!=null '>status1 =#{status1},</if>",
  25. "<if test='remark!=null '>remark =#{remark},</if>",
  26. "</set>",
  27. "where jwcode =#{jwcode}",
  28. "</script>"
  29. })
  30. int update(Admin admin);
  31. @Select({
  32. "select * from admin",
  33. "where admin_id=#{adminId}"
  34. })
  35. Admin selectById(Integer adminId);
  36. @Select({
  37. "select * from admin",
  38. "where jwcode=#{jwcode}"
  39. })
  40. Admin selectByName(String username);
  41. @Select({
  42. "<script>",
  43. "SELECT * from admin",
  44. "<where>",
  45. "admin_flag=1",
  46. "<if test='name!=null and name.length()>0'> and `name` like concat('%',#{name},'%')</if>",
  47. "<if test='jwcode!=null and jwcode.length()>0'> and jwcode=#{jwcode}</if>",
  48. "<if test='area!=null and area.length()>0'> and `area`=#{area}</if>",
  49. "<if test='store!=null and store.length()>0'> and `store`=#{store}</if>",
  50. "and permission != 4",
  51. "</where>",
  52. "ORDER BY status1 DESC, permission ASC",
  53. "</script>"
  54. })
  55. List<Admin> select(Admin admin);
  56. @Select({
  57. "select DISTINCT store from admin"
  58. })
  59. List<String> selectStore();
  60. @Select({
  61. "select DISTINCT area from admin"
  62. })
  63. List<String> selectArea();
  64. @Select({
  65. // "<script>",
  66. "select * from admin ",
  67. // "<where>",
  68. "where (permission != 1 AND permission != 2 AND permission != 3) and jwcode=#{jwcode}",
  69. // "</where>",
  70. })
  71. List<Admin> selectNo(Admin admin);
  72. @Select({
  73. "select * from admin",
  74. "where jwcode=#{jwcode}",
  75. "and",
  76. "admin_flag = 1"
  77. })
  78. Admin selectByJwcode(String jwcode);
  79. }