这个聪明的家伙吧 关注:1贴子:124
  • 3回复贴,共1

【2018/4/27】mybatis中生成key及for、linux Jdk(安装)、boots

只看楼主收藏回复

mybatis中生成key及for:
一、生成主键:
<insert id="addUserMas" parameterType="user.beans.UUserMas">
<selectKey keyColumn="USER_CODE" keyProperty="userCode" resultType="java.lang.String" order="BEFORE">
select (to_char(sysdate,'yyyymmdd')||'0000'||lpad(USER_CODE_SEQ.nextval,8,'0')) from DUAL
</selectKey>
insert into U_USER_MAS (USER_CODE,
WORK_CODE, USER_TYPE,
REALNAME, "PASSWORD", DEPARTMENT,
"POSITION", AGENT_CODE, "STATUS",
CHANGE_PASSWD_FLAG, CREATOR, CREATE_TIME,
LAST_UPD_PASSWD_TIME, LAST_LOGIN_TIME, CITY_CODE,
BRANCH_CODE)
values (#{userCode,jdbcType=VARCHAR},
#{workCode,jdbcType=VARCHAR}, #{userType,jdbcType=VARCHAR},
#{realname,jdbcType=VARCHAR}, #{password,jdbcType=VARCHAR}, #{department,jdbcType=VARCHAR},
#{position,jdbcType=VARCHAR}, #{agentCode,jdbcType=VARCHAR}, #{status,jdbcType=VARCHAR},
#{changePasswdFlag,jdbcType=VARCHAR}, #{creator,jdbcType=VARCHAR}, sysdate,
#{lastUpdPasswdTime,jdbcType=TIMESTAMP}, #{lastLoginTime,jdbcType=TIMESTAMP}, #{cityCode,jdbcType=VARCHAR},
#{branchCode,jdbcType=VARCHAR})
</insert>
二、foreach使用:
1、serviceImp:
List ids = new ArrayList();
ids.add("值");
aApPlanLedgMasMapper.updateByPrimaryKeySelective(ids);
2、进入xml之前
int updateByPrimaryKeySelective(List ids);
3、.xml:
<update id="updateByPrimaryKeySelective">
update A_AP_PLAN_LEDG_MAS
set IS_SUCCESS = '',
apBatchNo = ''
where 1=1 and
AP_LEDG_SEQ_NO in
<foreach collection="list" index="index" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</update>


IP属地:湖北1楼2018-04-27 11:42回复
    定义全局静态参数--ESB中User:
    【1】.定义类:
    package com.bean.collection;
    import java.util.Map;
    import java.util.concurrent.ConcurrentHashMap;
    /**
    * 信息配对接口调用:静态参数类
    *
    * @author jing.wang
    *
    */
    public class StaticParameterCache {
    /**
    * 静态参数:关系
    */
    public static Map<String, String> RELATION_MAP = new ConcurrentHashMap<String, String>();
    /**
    * 静态参数:电话类型
    */
    public static Map<String, String> CONTACT_MAP = new ConcurrentHashMap<String, String>();
    }
    【2】.使用时:
    StaticParameterCache.CONTACT_MAP.put(custBankAcctMasList2.get(i).getParaCode(), custBankAcctMasList2.get(i).getParaValue());


    IP属地:湖北5楼2018-04-27 11:44
    回复
      ESB系统服务配置log日志:
      <?xml version="1.0" encoding="UTF-8"?>
      <Configuration status="WARN">
      <properties>
      <property name="logPath">D:\log</property>
      <!-- <property name="logPath">/opt/esb_service/pcl-user/log</property> -->
      </properties>
      <Appenders>
      <Console name="Console" target="SYSTEM_OUT">
      <PatternLayout
      pattern="[%d{yyyy-MM-dd HH:mm:ss}] [%t] %-5p %C{1}:%L [%X{BizCode}][%X{ReqCode}]- %msg%n" />
      </Console>
      <RollingFile name="RollingFile" filename="${logPath}/pcl-user.log"
      filepattern="${logPath}/%d{yyyyMMddHHmmss}-pcl-user.log.zip">
      <PatternLayout
      pattern="[%d{yyyy-MM-dd HH:mm:ss}] [%t] %-5p %C{1}:%L - %msg%n" />
      <Policies>
      <SizeBasedTriggeringPolicy size="10 MB" />
      </Policies>
      <DefaultRolloverStrategy compressionLevel="9" max="20" /><!--compressionLevel:日志压缩级别。0-9,压缩效果依次增大。只对于压缩文件类型有效。 -->
      </RollingFile>
      </Appenders>
      <Loggers>
      <Logger name="fileLogger" level="info" additivity="false">
      <AppenderRef ref="Console" /> <!-- UAT或者正式删除掉,原因:放置控制台打出syso -->
      <AppenderRef ref="RollingFile" />
      </Logger>
      <Root level="info">
      <AppenderRef ref="Console" />
      </Root>
      </Loggers>
      </Configuration>


      IP属地:湖北6楼2018-04-27 16:14
      回复
        服务在Linux中启动:start.sh
        #!/bin/bash
        SERVICE_HOME=/opt/service/pcl-autoPayment
        BINDIR=$SERVICE_HOME/bin
        LIBDIR=$SERVICE_HOME/lib
        LOGDIR=$SERVICE_HOME/log
        CONFDIR=$SERVICE_HOME/config
        JAR_NAME=pcl-autoPayment.jar
        RUN_NAME=pcl-autoPayment
        MAIN_CLASS=listen.Listener
        JAVA_OPTS="-D$RUN_NAME -server -Xms1G -Xmx1G"
        for cdir in ${LIBDIR}/*.jar
        do
        CLASSPATH=$CLASSPATH:$cdir
        export CLASSPATH
        done
        CLASSPATH=$CLASSPATH:$BINDIR/$JAR_NAME
        export CLASSPATH
        CLASSPATH=$CLASSPATH:$CONFDIR/
        export CLASSPATH
        start() {
        echo "$RUN_NAME trying to start..."
        #echo "CLASSPATH=$CLASSPATH"
        nohup /usr/bin/java $JAVA_OPTS $MAIN_CLASS > $LOGDIR/start.log 2>&1 &
        echo "$RUN_NAME started success."
        }
        stop() {
        echo "Stoping $RUN_NAME"
        kill `ps -ef|grep $RUN_NAME|grep -v grep|grep -v stop|awk '{print $2}'`
        echo "$RUN_NAME stop success."
        }
        case "$1" in
        start)
        start
        ;;
        stop)
        stop
        ;;
        restart)
        stop
        sleep 5
        start
        ;;
        *)
        echo $"Usage: $0 {start|stop|restart}"
        exit 1
        esac


        IP属地:湖北7楼2018-04-27 16:18
        回复