Commit a90a1f8a authored by licc's avatar licc

框架整理

parent 49503838
package cn.wisenergy.mapper;
import cn.wisenergy.model.app.AccountInfo;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import java.util.Map;
public interface AccountMapper extends BaseMapper<AccountInfo> {
/**
* 查询管理员信息
* @param map 查询参数
* @return
*/
AccountInfo getAccountInfo(Map<String, Object> map);
}
package cn.wisenergy.mapper;
import cn.hutool.system.UserInfo;
import cn.wisenergy.model.app.User;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;
/**
* @author 86187
* @ Description:
* @ Author : 86187
* @ Date : 2021/1/6 15:32
*/
@Mapper
public interface UsersMapper extends BaseMapper<User> {
/**
* 添加
*
* @param user 用户信息
* @return 用户信息
*/
int add(User user);
/**
* 编辑
*
* @param user 用户信息
* @return 修改是否成功
*/
int edit(User user);
/**
* 删除
*
* @param id 用户id
* @return 删除是否成功
*/
int delById(@Param("id") Integer id);
int countByPhoneAnsUserId(@Param("phone") String phone, @Param("userId") Integer userId);
List<User> getList(Map<String, Object> map);
Integer getUserNumbers(Map<String, Object> map);
User getByPhone(@Param("phone") String phone);
List<User> test(@Param("list") List<String> list);
}
<?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="cn.wisenergy.mapper.UsersMapper">
<resultMap id="userMap" type="cn.wisenergy.model.app.User">
<id column="id" property="id"/>
<result column="user_name" property="userName"/>
<result column="password" property="password"/>
<result column="phone" property="phone"/>
<result column="uuid" property="uuid"/>
<result column="head_image" property="headImage"/>
<result column="sex" property="sex"/>
<result column="school" property="school"/>
<result column="exam_type" property="examType"/>
<result column="source" property="source"/>
<result column="is_delete" property="isDelete"/>
<result column="create_time" property="createTime"/>
<result column="update_time" property="updateTime"/>
</resultMap>
<sql id="table">
user
</sql>
<sql id="cols_all">
id,
<include refid="cols_exclude_id"/>
</sql>
<sql id="cols_exclude_id">
user_name,password, phone,uuid,head_image,sex,school, exam_type,source,is_delete,create_time,update_time
</sql>
<sql id="vals">
#{userName},#{password},#{phone},#{uuid},#{headImage},#{sex},#{school},#{examType}, #{source},
#{isDelete},now(),now()
</sql>
<sql id="updateCondition">
<if test="userName != null">user_name = #{userName},</if>
<if test="password != null">password =#{password},</if>
<if test="phone != null">phone =#{phone},</if>
<if test="uuid != null">uuid =#{uuid},</if>
<if test="headImage != null">head_image =#{headImage},</if>
<if test="sex != null">sex =#{sex},</if>
<if test="school != null">school =#{school},</if>
<if test="examType != null">exam_type = #{examType},</if>
<if test="source != null">source = #{source},</if>
<if test="isDelete != null">is_delete = #{isDelete},</if>
update_time =now()
</sql>
<sql id="criteria">
<if test="id != null">id = #{id}</if>
<if test="userName != null">and user_name = #{userName}</if>
<if test="password != null">and password =#{password}</if>
<if test="phone != null">and phone =#{phone}</if>
<if test="uuid != null">and uuid =#{uuid}</if>
<if test="headImage != null">and head_image =#{headImage}</if>
<if test="sex != null">and sex =#{sex}</if>
<if test="school != null">and school =#{school}</if>
<if test="examType != null">and exam_type = #{examType}</if>
<if test="source != null">and source = #{source}</if>
<if test="isDelete != null">and is_delete = #{isDelete}</if>
<if test="createTime != null">and create_time &gt;= #{createTime}</if>
<if test="updateTime != null">and #{updateTime} &gt;= update_time</if>
</sql>
<insert id="add" parameterType="cn.wisenergy.model.app.User" keyProperty="id" useGeneratedKeys="true">
insert into
<include refid="table"/>
(<include refid="cols_exclude_id"/>)
value(
<include refid="vals"/>
)
</insert>
<update id="edit" parameterType="cn.wisenergy.model.app.User">
UPDATE
<include refid="table"/>
<set>
<include refid="updateCondition"/>
</set>
<where>
id = #{id}
</where>
</update>
<delete id="delById" parameterType="java.lang.Integer">
delete from
<include refid="table"/>
where id = #{id}
</delete>
<select id="countByPhoneAnsUserId" resultType="java.lang.Integer">
SELECT COUNT(1)
FROM
<include refid="table"/>
WHERE phone=#{phone} and id !=#{userId} and is_delete=0
</select>
<select id="getList" resultMap="userMap" parameterType="map">
select
<include refid="cols_all"/>
from
<include refid="table"/>
<where>
is_delete=0
<if test="startTime != null">
and create_time
between #{startTime}
</if>
<if test="endTime != null">and #{endTime}</if>
<if test="userName != null">and user_name like ('%' #{userName} '%')</if>
<if test="phone != null">and phone like ('%' #{phone} '%')</if>
order by create_time desc
limit #{pageNo},#{pageSize}
</where>
</select>
<select id="getUserNumbers" resultType="java.lang.Integer">
SELECT COUNT(id)
FROM
<include refid="table"/>
<where>
is_delete=0
<if test="startTime != null">
and create_time
between #{startTime}
</if>
<if test="endTime != null">and #{endTime}</if>
<if test="userName != null">and user_name like ('%' #{userName} '%')</if>
<if test="phone != null">and phone like ('%' #{phone} '%')</if>
</where>
</select>
<select id="getByPhone" resultType="cn.wisenergy.model.app.User">
SELECT
<include refid="cols_all"/>
FROM
<include refid="table"/>
where is_delete=0 and phone=#{phone}
</select>
<select id="test" resultType="cn.wisenergy.model.app.User">
select
<include refid="cols_all"/>
from
<include refid="table"/>
<where>
<if test="list != null">
<foreach collection="list" index="index" item="id" separator="or" open="(" close=")">
user_name LIKE CONCAT('%',#{id},'%')
</foreach>
</if>
</where>
</select>
</mapper>
package cn.wisenergy.model.app;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
* 管理员实体类
*/
@Data
@ApiModel(value = "AccountInfo")
public class AccountInfo implements Serializable {
private static final long serialVersionUID = 3050641578536493424L;
/**
* 管理员主键id
*/
@ApiModelProperty(name ="id",value = "管理员主键id")
private Integer id;
/**
* 管理员账号
*/
@ApiModelProperty(name = "name",value = "管理员账号")
private String userName;
/**
* 管理员密码
*/
@ApiModelProperty(name="password",value = "管理员密码")
private String password;
/**
* 头像
*/
@ApiModelProperty(name = "headImage",value = "头像")
private String headImage;
/**
* 是否删除
*/
@ApiModelProperty(name = "isDelete",value = "是否删除 0:正常 1:删除")
private Integer isDelete;
/**
* 创建时间
*/
@ApiModelProperty(name = "createTime",value = "创建时间")
private Date createTime;
/**
* 修改时间
*/
@ApiModelProperty(name = "updateTime",value = "修改时间")
private Date updateTime;
}
package cn.wisenergy.model.app;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
* @author 86187
* @ Description : 用户实体类
* @ Author : lcc
* @ CreateDate : 2020/11/8 19:59
*/
@Data
@ApiModel(value = "AccountUsers")
@TableName("user")
public class User implements Serializable {
private static final long serialVersionUID = 2525339404301884673L;
/**
* 主键id
*/
@ApiModelProperty(name = "id", value = "用户主键id")
private Integer id;
/**
* 用户名称
*/
@ApiModelProperty(name = "name", value = "用户名")
private String userName;
/**
* 密码
*/
@ApiModelProperty(name = "password", value = "用户密码")
private String password;
/**
* 电话号码
*/
@ApiModelProperty(name = "phone", value = "手机号")
private String phone;
/**
* 头像
*/
@ApiModelProperty(name = "headImage", value = "头像")
private String headImage;
/**
* 微信uuid
*/
@ApiModelProperty(name = "微信uuid", value = "uuid")
private String uuid;
/**
* 性别
*/
@ApiModelProperty(name = "sex", value = "用户性别:0:男,1:女")
private Integer sex;
/**
* 学校
*/
@ApiModelProperty(name = "school", value = "毕业院校")
private String school;
/**
* 学生类型
*/
@ApiModelProperty(name = "examType", value = "考生类型 1:文化课考生 2:美术生 3:体育生 4:文学编导考生")
private Integer examType;
/**
* 来源 1:PC 2: APP
*/
@ApiModelProperty(name = "source", value = "来源 1:PC 2: APP")
private Integer source;
/**
* 是否删除
*/
@ApiModelProperty(name = "isDelete", value = "是否删除 0:正常 1:删除")
private Integer isDelete;
/**
* 创建时间
*/
@ApiModelProperty(name = "createTime", value = "创建时间")
private Date createTime;
/**
* 修改时间
*/
@ApiModelProperty(name = "updateTime", value = "修改时间")
private Date updateTime;
}
package cn.wisenergy.model.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
@Data
@ApiModel(value = "AccountInfo")
public class AccountLoginVo implements Serializable {
private static final long serialVersionUID = -3802879442149734552L;
/**
* 管理员账号
*/
@ApiModelProperty(name = "name",value = "管理员账号")
private String userName;
/**
* 管理员密码
*/
@ApiModelProperty(name="password",value = "管理员密码")
private String password;
}
package cn.wisenergy.service.app;
import cn.wisenergy.common.utils.R;
import cn.wisenergy.model.app.AccountInfo;
/**
* @author 86187
*/
public interface AccountSerivce {
R<AccountInfo> getById(Integer userId);
}
package cn.wisenergy.service.app;
import cn.wisenergy.common.utils.R;
import cn.wisenergy.model.app.User;
import java.util.List;
/**
* @ Description: 用户接口
* @ Author : 86187
* @ Date : 2021/1/6 16:08
*/
public interface UserService {
/**
* 获取用户信息
* @param phone 电话号码
* @return 用户信息
*/
User getByPhone(String phone);
R<List<User>> test();
}
package cn.wisenergy.service.app.impl;
import cn.wisenergy.common.utils.R;
import cn.wisenergy.mapper.AccountMapper;
import cn.wisenergy.model.app.AccountInfo;
import cn.wisenergy.service.app.AccountSerivce;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
@Slf4j
@Service
public class AccountSerivceImpl extends ServiceImpl<AccountMapper,AccountInfo>implements AccountSerivce {
@Override
public R<AccountInfo> getById(Integer userId) {
return null;
}
}
package cn.wisenergy.service.app.impl;
import cn.wisenergy.common.constant.CommonAttributes;
import cn.wisenergy.common.utils.R;
import cn.wisenergy.mapper.UsersMapper;
import cn.wisenergy.model.app.User;
import cn.wisenergy.service.app.UserService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.github.pagehelper.PageInfo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @ Description: 用户接口实现
* @ Author : 86187
* @ Date : 2021/1/6 16:11
*/
@Service
@Slf4j
public class UserServiceImpl extends ServiceImpl<UsersMapper, User> implements UserService {
@Autowired
private UsersMapper usersMapper;
@Override
public User getByPhone(String phone) {
return null;
}
@Override
public R<List<User>> test() {
return null;
}
}
package cn.wisenergy.web.common; package cn.wisenergy.web.common;
import cn.wisenergy.model.app.User; import cn.wisenergy.model.app.User;
import cn.wisenergy.service.app.UserService;
import cn.wisenergy.web.shiro.JwtUtil; import cn.wisenergy.web.shiro.JwtUtil;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
......
/*
Navicat MySQL Data Transfer
Source Server : test
Source Server Type : MySQL
Source Server Version : 50727
Source Host : localhost:3306
Source Schema : ljfl
Target Server Type : MySQL
Target Server Version : 50727
File Encoding : 65001
Date: 03/11/2020 10:07:47
*/
SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;
-- ----------------------------
-- Table structure for camera
-- ----------------------------
DROP TABLE IF EXISTS `camera`;
CREATE TABLE `camera` (
`id` int(11) NOT NULL COMMENT '主键',
`camera_number` varchar(20) CHARACTER SET latin1 COLLATE latin1_swedish_ci NULL DEFAULT NULL COMMENT '摄像机编号',
`name` varchar(30) CHARACTER SET latin1 COLLATE latin1_swedish_ci NULL DEFAULT NULL COMMENT '名称',
`site` varchar(30) CHARACTER SET latin1 COLLATE latin1_swedish_ci NULL DEFAULT NULL COMMENT '投放点',
`inspector_name` varchar(255) CHARACTER SET latin1 COLLATE latin1_swedish_ci NULL DEFAULT NULL COMMENT '督察员姓名',
`inspector_phone` varchar(255) CHARACTER SET latin1 COLLATE latin1_swedish_ci NULL DEFAULT NULL COMMENT '督察员手机号',
`longitude` double NULL DEFAULT NULL COMMENT '经度',
`latitude` double NULL DEFAULT NULL COMMENT '纬度',
`status` int(2) NULL DEFAULT NULL COMMENT '状态:0:在线 1:离线',
`is_delete` int(2) NULL DEFAULT NULL COMMENT '是否删除 0:正常 1:删除',
`remark` varchar(255) CHARACTER SET latin1 COLLATE latin1_swedish_ci NULL DEFAULT NULL COMMENT '备注',
`rubbish_id` int(11) NULL DEFAULT NULL COMMENT '所属垃圾点id',
`create_time` datetime(0) NULL DEFAULT NULL,
`update_time` datetime(0) NULL DEFAULT NULL,
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = latin1 COLLATE = latin1_swedish_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Table structure for resident
-- ----------------------------
DROP TABLE IF EXISTS `resident`;
CREATE TABLE `resident` (
`id` int(11) NOT NULL COMMENT '主键id',
`name` varchar(20) CHARACTER SET latin1 COLLATE latin1_swedish_ci NULL DEFAULT NULL COMMENT '姓名',
`phone` varchar(20) CHARACTER SET latin1 COLLATE latin1_swedish_ci NULL DEFAULT NULL COMMENT '手机号码',
`sex` int(2) NULL DEFAULT NULL COMMENT '性别 1:男 2:女',
`street` varchar(255) CHARACTER SET latin1 COLLATE latin1_swedish_ci NULL DEFAULT NULL COMMENT '所属街道',
`community` varchar(255) CHARACTER SET latin1 COLLATE latin1_swedish_ci NULL DEFAULT NULL COMMENT '所属社区',
`remark` varchar(255) CHARACTER SET latin1 COLLATE latin1_swedish_ci NULL DEFAULT NULL COMMENT '备注',
`is_delete` int(2) NULL DEFAULT NULL COMMENT '是否删除 0:正常 1:删除',
`create_time` datetime(0) NULL DEFAULT NULL,
`update_time` datetime(0) NULL DEFAULT NULL,
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = latin1 COLLATE = latin1_swedish_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Table structure for rubbish
-- ----------------------------
DROP TABLE IF EXISTS `rubbish`;
CREATE TABLE `rubbish` (
`id` int(11) NOT NULL COMMENT '主键id',
`rubbish_number` varchar(20) CHARACTER SET latin1 COLLATE latin1_swedish_ci NULL DEFAULT NULL COMMENT '垃圾站编号',
`user_name` varchar(20) CHARACTER SET latin1 COLLATE latin1_swedish_ci NULL DEFAULT NULL COMMENT '负责人姓名',
`street` varchar(255) CHARACTER SET latin1 COLLATE latin1_swedish_ci NULL DEFAULT NULL COMMENT '所属街道',
`community` varchar(255) CHARACTER SET latin1 COLLATE latin1_swedish_ci NULL DEFAULT NULL COMMENT '所属社区',
`live_time` datetime(0) NULL DEFAULT NULL COMMENT '直播时间',
`click_time` datetime(0) NULL DEFAULT NULL COMMENT '点播时间',
`remark` varchar(255) CHARACTER SET latin1 COLLATE latin1_swedish_ci NULL DEFAULT NULL COMMENT '备注',
`status` int(2) NULL DEFAULT NULL COMMENT '状态 :0:再用 1:弃用',
`is_delete` int(2) NULL DEFAULT NULL COMMENT '是否删除 0:正常 1:删除',
`create_time` datetime(0) NULL DEFAULT NULL COMMENT '创建时间',
`update_time` datetime(0) NULL DEFAULT NULL COMMENT '更新时间',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = latin1 COLLATE = latin1_swedish_ci ROW_FORMAT = Dynamic;
SET FOREIGN_KEY_CHECKS = 1;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment