中文亚洲精品无码_熟女乱子伦免费_人人超碰人人爱国产_亚洲熟妇女综合网

當前位置: 首頁 > news >正文

長春市疫情防控最新政策天津seo實戰(zhàn)培訓(xùn)

長春市疫情防控最新政策,天津seo實戰(zhàn)培訓(xùn),學(xué)校網(wǎng)站建設(shè)報價表,泉州網(wǎng)站建設(shè)哪家好Aop自定義注解生成日志 1.編寫自定義注解 //表示此注解可以標注在方法上 Target(ElementType.METHOD) //運行時生效 Retention(RetentionPolicy.RUNTIME) public interface OpetionLog {//定義一個變量,可以接收參數(shù)String value() default "";}2.Cont…

Aop自定義注解生成日志

1.編寫自定義注解

//表示此注解可以標注在方法上
@Target(ElementType.METHOD)
//運行時生效
@Retention(RetentionPolicy.RUNTIME)
public @interface OpetionLog {//定義一個變量,可以接收參數(shù)String  value() default "";}

2.Controller

    @PostMapping("updatestate/{id}")@ApiOperation("更改科室啟用狀態(tài)")@OpetionLog("更改科室啟用狀態(tài)")public Result updateStatus(@PathVariable Integer id) throws UnknownHostException {log.info("修改科室啟用狀態(tài)");return departmentService.updateStatus(id);}

3.切面類(控制臺日志)

@Component
@Aspect
public class ParamaterLogAop {private static Logger log =           Logger.getLogger(String.valueOf(ParamaterLogAop.class));private long start = 0;@Pointcut("execution(* com.aaa.controller.*.*(..))")//切面簽名public  void  haha(){}@Before("haha()")public  void  before(JoinPoint point){ServletRequestAttributes requestAttributes = (ServletRequestAttributes)           RequestContextHolder.getRequestAttributes();HttpServletRequest request = requestAttributes.getRequest();HttpServletResponse response = requestAttributes.getResponse();String addr = request.getRemoteAddr();String uri = request.getRequestURI();Object[] args = point.getArgs();start = System.currentTimeMillis();log.info("===================請求的地址是:================="+addr);log.info("===================請求的路徑是:================="+uri);log.info("===================請求的參數(shù)是:================="+ Arrays.toString(args));}@AfterReturning("haha()")public  void  after(){long end = System.currentTimeMillis();log.info("=================耗時================="+ (end-start));log.info("=================結(jié)束了=================");}
}

4.切面類(數(shù)據(jù)庫日志表)

@Component
@Aspect
public class OptionsLogAop {@Resourceprivate HttpSession httpSession;@Resourceprivate LogsMapper logsMapper;@AfterReturning(pointcut = "@annotation(opetionLog)", returning = "result")public void insertLog(JoinPoint joinPoint, OpetionLog opetionLog, Result result) throws UnknownHostException {//獲取日志信息//獲取當前時間String logTime = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date());//獲取當前操作人ip地址String addr = InetAddress.getLocalHost().getHostAddress();//獲取登錄人員姓名String name = ((DoctorDTO)httpSession.getAttribute("doctor")).getName();//操作類型String operation = opetionLog.value();//操作數(shù)據(jù)Object[] args = joinPoint.getArgs();//操作結(jié)果String code = result.getCode().toString();//日志對象LogsDTO logsDTO = new LogsDTO(null, name, operation, logTime, addr, Arrays.toString(args), code);//插入數(shù)據(jù)庫logsMapper.insertLogs(logsDTO);}
}

4.1LogsDTO

@Data
@AllArgsConstructor
@NoArgsConstructor
public class LogsDTO implements Serializable {private static final long serialVersionUID = -28616532886171515L;private Integer id;private String name;private String operation;private String time;private String addr;private String data;private String result;
}

4.2LogsMapper

int insertLogs(LogsDTO logsDTO);//Logsmapper.xml
<insert id="insertLogs">insert into logsvalues (null, #{name}, #{operation},#{time},#{addr},#{data},#{result})
</insert>

5.結(jié)果

5.1控制臺

在這里插入圖片描述

5.2數(shù)據(jù)庫日志表

在這里插入圖片描述

http://www.risenshineclean.com/news/30716.html

相關(guān)文章:

  • seo做子網(wǎng)站網(wǎng)絡(luò)商城應(yīng)該如何推廣
  • 網(wǎng)站做眾籌需哪些條件china東莞seo
  • 網(wǎng)站建設(shè)誤區(qū)圖交易平臺官網(wǎng)
  • 深圳模板網(wǎng)站建設(shè)設(shè)計公司排名優(yōu)化方法
  • 網(wǎng)站域名備案查詢官網(wǎng)百度競價排名的利與弊
  • 上海建溧建設(shè)集團有限公司網(wǎng)站百度網(wǎng)頁版登錄
  • wordpress打不開主頁一點優(yōu)化
  • 找做網(wǎng)站的朋友電商數(shù)據(jù)統(tǒng)計網(wǎng)站
  • 注冊外貿(mào)公司seo咨詢
  • 哈爾濱網(wǎng)站建設(shè)制作價格如何推廣一款app
  • 豬八戒做網(wǎng)站靠譜嗎國際最新新聞
  • 網(wǎng)站建設(shè)與開發(fā)做什么足球世界排名國家最新
  • 商城購物網(wǎng)站建設(shè)方案短視頻營銷策略
  • 東莞手機網(wǎng)站建設(shè)網(wǎng)站怎么優(yōu)化關(guān)鍵詞
  • 遵義做什么網(wǎng)站好seo門戶
  • 石家莊網(wǎng)站運營公司最新新聞事件
  • 口碑好的常州做網(wǎng)站app開發(fā)用什么軟件
  • 可以充值的網(wǎng)站怎么做互聯(lián)網(wǎng)金融
  • 煙臺網(wǎng)站推廣排名競價推廣代運營
  • 做一個類似京東的網(wǎng)站免費發(fā)布推廣的平臺
  • 南京制作網(wǎng)站公司網(wǎng)站seo1視頻發(fā)布會
  • php動態(tài)網(wǎng)站開發(fā)案例教程china東莞seo
  • 蘇州網(wǎng)站制作設(shè)計西安網(wǎng)絡(luò)seo公司
  • wordpress限制ip訪問次數(shù)網(wǎng)站seo報價
  • 網(wǎng)站開發(fā)大學(xué)是什么專業(yè)中國目前最好的搜索引擎
  • wordpress怎么掙錢常見的系統(tǒng)優(yōu)化軟件
  • 蘇州實力做網(wǎng)站公司人員優(yōu)化方案怎么寫
  • 做微商進哪個網(wǎng)站安全蟻坊軟件輿情監(jiān)測系統(tǒng)
  • 網(wǎng)頁設(shè)計與制作教程西北工業(yè)大學(xué)廣州網(wǎng)站優(yōu)化步驟
  • 如何做高大上的網(wǎng)站 知乎企業(yè)營銷網(wǎng)站建設(shè)系統(tǒng)