commit
78ab90501b
@ -0,0 +1,35 @@
|
||||
package au.com.royalpay.payment.manage.mappers.system;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.github.miemiedev.mybatis.paginator.domain.PageBounds;
|
||||
import com.github.miemiedev.mybatis.paginator.domain.PageList;
|
||||
|
||||
import cn.yixblog.support.mybatis.autosql.annotations.AutoMapper;
|
||||
import cn.yixblog.support.mybatis.autosql.annotations.AutoSql;
|
||||
import cn.yixblog.support.mybatis.autosql.annotations.SqlType;
|
||||
|
||||
/**
|
||||
* Created by davep on 2016-08-03.
|
||||
*/
|
||||
@AutoMapper(tablename = "sys_mail_unsub", pkName = "id")
|
||||
public interface MailUnsubMapper {
|
||||
|
||||
@AutoSql(type = SqlType.INSERT)
|
||||
void save(JSONObject record);
|
||||
|
||||
@AutoSql(type = SqlType.DELETE)
|
||||
void delete(@Param("id") Long id);
|
||||
|
||||
@AutoSql(type = SqlType.SELECT)
|
||||
JSONObject getOne(@Param("id") Long id,@Param("address") String address);
|
||||
|
||||
PageList<JSONObject> queryPageable(JSONObject params, PageBounds pagination);
|
||||
|
||||
List<JSONObject> query(JSONObject params);
|
||||
|
||||
List<String> getAllAddress();
|
||||
}
|
@ -0,0 +1,46 @@
|
||||
package au.com.royalpay.payment.manage.system.web;
|
||||
|
||||
import au.com.royalpay.payment.manage.notice.core.MailService;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
/**
|
||||
* @author kira
|
||||
* @date 2018/6/12
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/sys/mail")
|
||||
public class MailController {
|
||||
|
||||
@Resource
|
||||
private MailService mailService;
|
||||
|
||||
@RequestMapping(value = "/unsub/{id}",method = RequestMethod.DELETE)
|
||||
// @RequireManager(role = {ManagerRole.ADMIN, ManagerRole.BD_USER, ManagerRole.OPERATOR, ManagerRole.SERVANT})
|
||||
public void removeSub(@PathVariable Long id) {
|
||||
mailService.removeUnsub(id);
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/unsub",method = RequestMethod.POST)
|
||||
// @RequireManager(role = {ManagerRole.ADMIN, ManagerRole.BD_USER, ManagerRole.OPERATOR, ManagerRole.SERVANT})
|
||||
public void removeSub(@RequestParam String client_moniker) {
|
||||
mailService.addUnsub(client_moniker);
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/unsub/query",method = RequestMethod.GET)
|
||||
// @RequireManager(role = {ManagerRole.ADMIN, ManagerRole.BD_USER, ManagerRole.OPERATOR, ManagerRole.SERVANT})
|
||||
public JSONObject list(@RequestParam(required = false) String client_moniker,@RequestParam(required = false) String address,@RequestParam(required = false,defaultValue = "10") int limit ,@RequestParam(required = false,defaultValue = "1") int page) {
|
||||
JSONObject params = new JSONObject();
|
||||
params.put("client_moniker",client_moniker);
|
||||
params.put("address",address);
|
||||
return mailService.queryUnsubPageable(params,limit,page);
|
||||
}
|
||||
}
|
@ -0,0 +1,49 @@
|
||||
<?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="au.com.royalpay.payment.manage.mappers.system.MailUnsubMapper">
|
||||
|
||||
<select id="getOne" resultType="com.alibaba.fastjson.JSONObject">
|
||||
select * from sys_mail_unsub
|
||||
<where>
|
||||
<if test="id!=null">
|
||||
and id = #{id}
|
||||
</if>
|
||||
<if test="address != null">
|
||||
and address = #{address}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
<select id="queryPageable" resultType="com.alibaba.fastjson.JSONObject">
|
||||
select * from sys_mail_unsub
|
||||
<where>
|
||||
<if test="client_moniker!=null">
|
||||
and client_moniker = #{client_moniker}
|
||||
</if>
|
||||
<if test="client_id != null">
|
||||
and client_id = #{client_id}
|
||||
</if>
|
||||
<if test="address != null">
|
||||
and address = #{address}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="query" resultType="com.alibaba.fastjson.JSONObject">
|
||||
select * from sys_mail_unsub
|
||||
<where>
|
||||
<if test="client_moniker!=null">
|
||||
and client_moniker = #{client_moniker}
|
||||
</if>
|
||||
<if test="client_id != null">
|
||||
and client_id = #{client_id}
|
||||
</if>
|
||||
<if test="address != null">
|
||||
and address = #{address}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="getAllAddress" resultType="java.lang.String">
|
||||
select address from sys_mail_unsub
|
||||
</select>
|
||||
</mapper>
|
Loading…
Reference in new issue