Commit 731d741d by 龙于生 Committed by 284718418@qq.com

新增公司服务端地址接口和 检查账号是否存在接口

parent b6cb64ee
package cn.timer.api.bean.serverurl;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
/**
* 公司服务端地址表
*/
@Entity
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Table(name = "company_server_url")
@Data
@ApiModel("公司服务端地址表")
public class CompanyServerUrl extends Model<CompanyServerUrl> {
private static final long serialVersionUID = 1L;
/**
* id
*/
@Id
@GeneratedValue
@TableId(type = IdType.AUTO)
@ApiModelProperty(value = "ID")
private Long id;
/**
* 公司名称
*/
@ApiModelProperty(value = "公司名称")
private String companyName;
/**
* 服务端IP地址或域名地址
*/
@ApiModelProperty(value = "服务端IP地址或域名地址")
private String serverUrl;
/**
* 状态 0停用 1启用
*/
@ApiModelProperty(value = "状态 0停用 1启用")
private Integer status;
/**
* 排序 数字越大排最前面
*/
@ApiModelProperty(value = "排序 数字越大排最前面")
private Integer sort;
/**
* 备注
*/
@ApiModelProperty(value = "备注")
private String note;
}
package cn.timer.api.controller.check;
import cn.timer.api.bean.qyzx.QyzxEmpLogin;
import cn.timer.api.bean.serverurl.CompanyServerUrl;
import cn.timer.api.utils.ResultUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.transaction.Transactional;
import java.util.List;
@Api(tags = "服务器地址查询")
@Transactional(rollbackOn = Exception.class)
@RestController
@RequestMapping(value = "/check", produces = { "application/json" })
public class CheckController {
@GetMapping(value = "/company_server_url_list")
@ApiOperation(value = "公司服务端地址列表", httpMethod = "GET", notes = "公司服务端地址列表")
public Object CompanyServerUrlList (){
List<CompanyServerUrl> companyServerUrls = CompanyServerUrl.builder().build()
.selectList(new QueryWrapper<CompanyServerUrl>().lambda()
.eq(CompanyServerUrl::getStatus, 1).orderByDesc(CompanyServerUrl::getSort));
//System.out.println(companyServerUrls);
return ResultUtil.data(companyServerUrls,"查询成功");
}
@GetMapping(value = "/check_account_exist/{account}")
@ApiOperation(value = "检测该用户是否存在", httpMethod = "GET", notes = "检测该用户是否存在")
public Object checkAccountExist (@PathVariable("account") String account){
if (account == null || "".equals(account)) {
return ResultUtil.error("手机号不能为空!");
}
List<QyzxEmpLogin> qyzxEmpLogins = QyzxEmpLogin.builder().build()
.selectList(new QueryWrapper<QyzxEmpLogin>()
.lambda().eq(QyzxEmpLogin::getPhone, account).eq(QyzxEmpLogin::getSts, 1));
//System.out.println(qyzxEmpLogins);
if (qyzxEmpLogins.size()==0){
return ResultUtil.error("账户不存在");
}
return ResultUtil.success("OK");
}
}
package cn.timer.api.dao.serverurl;
import cn.timer.api.bean.serverurl.CompanyServerUrl;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.springframework.stereotype.Repository;
@Repository
public interface CompanyServerUrlMapper extends BaseMapper<CompanyServerUrl> {
}
<?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.timer.api.dao.serverurl.CompanyServerUrlMapper">
<!-- 可根据自己的需求,是否要使用 -->
<resultMap type="cn.timer.api.bean.serverurl.CompanyServerUrl" id="company">
<result property="id" column="id"/>
<result property="companyName" column="company_name"/>
<result property="serverUrl" column="server_url"/>
<result property="status" column="status"/>
<result property="sort" column="sort"/>
<result property="note" column="note"/>
</resultMap>
</mapper>
\ No newline at end of file
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