parent
bc55ad973a
commit
5e5d10b993
@ -0,0 +1,93 @@
|
||||
package com.xit.biz.ctgy.v2.repository;
|
||||
|
||||
import com.xit.biz.ctgy.dto.MinUserinfoDto;
|
||||
import com.xit.biz.ctgy.entity.MinUserinfo;
|
||||
import com.xit.core.config.database.BaseMpowerDaoSupport;
|
||||
import com.xit.core.oauth2.config.properties.SlaveDatabaseProperties;
|
||||
import com.xit.core.support.sql.parser.QueryGenerator;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
@Repository
|
||||
@Slf4j
|
||||
public class UserSubDao extends BaseMpowerDaoSupport {
|
||||
private static final String NAME_SPACE = "userSub";
|
||||
|
||||
public UserSubDao(SlaveDatabaseProperties databaseProperties) {
|
||||
super(databaseProperties);
|
||||
}
|
||||
|
||||
public void insertMinUserinfoDto(@NotNull final MinUserinfoDto dto) {
|
||||
final String sql = QueryGenerator.createNamedQuery(NAME_SPACE, "insertMinUserinfo")
|
||||
.setParameter("userid", dto.getUserid())
|
||||
.setParameter("accesstype", dto.getAccesstype())
|
||||
.setParameter("email", dto.getEmail())
|
||||
.setParameter("isenable", dto.getIsenable())
|
||||
.setParameter("mphone", dto.getMphone())
|
||||
.setParameter("name", dto.getName())
|
||||
.setParameter("passwd", dto.getPasswd())
|
||||
.setParameter("regdate", dto.getRegdate())
|
||||
.setParameter("team", dto.getTeam())
|
||||
.setParameter("gu", dto.getGu())
|
||||
.getQueryString();
|
||||
insert(sql);
|
||||
}
|
||||
|
||||
public void updateMinUserinfoDto(MinUserinfoDto dto) {
|
||||
final String sql = QueryGenerator.createNamedQuery(NAME_SPACE, "updateMinUserinfo")
|
||||
.setParameter("userid", dto.getUserid())
|
||||
.setParameter("accesstype", dto.getAccesstype())
|
||||
.setParameter("email", dto.getEmail())
|
||||
.setParameter("mphone", dto.getMphone())
|
||||
.setParameter("name", dto.getName())
|
||||
//.setParameter("passwd", dto.getPasswd())
|
||||
.setParameter("team", dto.getTeam())
|
||||
.getQueryString();
|
||||
update(sql);
|
||||
}
|
||||
|
||||
public void insertMinUserinfo(@NotNull final MinUserinfo dto) {
|
||||
final String sql = QueryGenerator.createNamedQuery(NAME_SPACE, "insertMinUserinfo")
|
||||
.setParameter("userid", dto.getUserid())
|
||||
.setParameter("accesstype", dto.getAccesstype())
|
||||
.setParameter("email", dto.getEmail())
|
||||
.setParameter("isenable", dto.getIsenable())
|
||||
.setParameter("mphone", dto.getMphone())
|
||||
.setParameter("name", dto.getName())
|
||||
.setParameter("passwd", dto.getPasswd())
|
||||
.setParameter("regdate", dto.getRegdate())
|
||||
.setParameter("team", dto.getTeam())
|
||||
.setParameter("gu", dto.getGu())
|
||||
.getQueryString();
|
||||
insert(sql);
|
||||
}
|
||||
|
||||
public void updateMinUserinfo(MinUserinfo dto) {
|
||||
final String sql = QueryGenerator.createNamedQuery(NAME_SPACE, "updateMinUserinfo")
|
||||
.setParameter("userid", dto.getUserid())
|
||||
.setParameter("accesstype", dto.getAccesstype())
|
||||
.setParameter("email", dto.getEmail())
|
||||
.setParameter("mphone", dto.getMphone())
|
||||
.setParameter("name", dto.getName())
|
||||
.setParameter("passwd", dto.getPasswd())
|
||||
.setParameter("team", dto.getTeam())
|
||||
.getQueryString();
|
||||
update(sql);
|
||||
}
|
||||
|
||||
public void removeMinUserinfo(@NotNull final MinUserinfoDto dto) {
|
||||
final String sql = QueryGenerator.createNamedQuery(NAME_SPACE, "updateMinUserinfoIsenable")
|
||||
.setParameter("userid", dto.getUserid())
|
||||
.setParameter("isenable", dto.getIsenable())
|
||||
.getQueryString();
|
||||
update(sql);
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,50 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<entity-mappings namespace="userSub">
|
||||
|
||||
<native-query id="insertMinUserinfo">
|
||||
/* minusersubinfo-mapper|insertMinUserinfo|julim */
|
||||
INSERT
|
||||
INTO min_userinfo (
|
||||
userid
|
||||
, accesstype
|
||||
, email
|
||||
, gu
|
||||
, isenable
|
||||
, mphone
|
||||
, name
|
||||
, passwd
|
||||
, regdate
|
||||
, team
|
||||
) VALUES (
|
||||
#{userid}
|
||||
, #{accesstype}
|
||||
, #{email}
|
||||
, #{gu}
|
||||
, #{isenable}
|
||||
, #{mphone}
|
||||
, #{name}
|
||||
, #{passwd}
|
||||
, #{regdate}
|
||||
, #{team}
|
||||
)
|
||||
</native-query>
|
||||
|
||||
<native-query id="updateMinUserinfo">
|
||||
/* minusersubinfo-mapper|updateMinUserinfo|julim */
|
||||
UPDATE min_userinfo
|
||||
SET accesstype = #{accesstype}
|
||||
, team = #{team}
|
||||
, name = #{name}
|
||||
, mphone = #{mphone}
|
||||
, email = #{email}
|
||||
WHERE userid= #{userid}
|
||||
</native-query>
|
||||
|
||||
<native-query id="updateMinUserinfoIsenable">
|
||||
/* minusersubinfo-mapper|updateMinUserinfoIsenable|julim */
|
||||
UPDATE min_userinfo
|
||||
SET isenable = #{isenable}
|
||||
WHERE userid= #{userid}
|
||||
</native-query>
|
||||
|
||||
</entity-mappings>
|
Loading…
Reference in New Issue