private XmlElement generateSqlMapLogicalDelete(IntrospectedTable introspectedTable, String id, IntrospectedColumn logicalDeleteColumn, String logicalDeleteValue, boolean byExample) {
    """
	生成LogicalDelete sql map
	@param introspectedTable
	@param id
	@param logicalDeleteColumn
	@param logicalDeleteValue
	@param byExample
	@return
    """
        XmlElement updateEle = new XmlElement("update");

        updateEle.addAttribute(new Attribute("id", id));
        updateEle.addAttribute(new Attribute("parameterType", "map"));
        commentGenerator.addComment(updateEle);

        updateEle.addElement(new TextElement("update " + introspectedTable.getAliasedFullyQualifiedTableNameAtRuntime()));

        StringBuilder sb = new StringBuilder("set ");
        // 版本自增
        if (this.customizedNextVersion) {
            sb.append(MyBatis3FormattingUtilities.getEscapedColumnName(this.versionColumn));
            sb.append(" = ");
            sb.append("#{nextVersion,jdbcType=");
            sb.append(this.versionColumn.getJdbcTypeName());
            if (StringUtility.stringHasValue(this.versionColumn.getTypeHandler())) {
                sb.append(",typeHandler=");
                sb.append(this.versionColumn.getTypeHandler());
            }
            sb.append("}");
        } else {
            sb.append(MyBatis3FormattingUtilities.getEscapedColumnName(this.versionColumn));
            sb.append(" = ");
            sb.append(MyBatis3FormattingUtilities.getEscapedColumnName(this.versionColumn));
            sb.append(" + 1");
        }
        sb.append(",");

        // 逻辑删除 set
        sb.append(logicalDeleteColumn.getActualColumnName());
        sb.append(" = ");
        sb.append(XmlElementGeneratorTools.generateLogicalDeleteColumnValue(logicalDeleteColumn, logicalDeleteValue));
        updateEle.addElement(new TextElement(sb.toString()));

        // 更新条件
        if (byExample) {
            XmlElement ifElement = new XmlElement("if");
            ifElement.addAttribute(new Attribute("test", "_parameter != null"));

            XmlElement includeElement = new XmlElement("include");
            includeElement.addAttribute(new Attribute("refid", SQL_UPDATE_BY_EXAMPLE_WITH_VERSION_WHERE_CLAUSE));
            ifElement.addElement(includeElement);

            updateEle.addElement(ifElement);
        } else {
            updateEle = this.replacePrimaryKeyXmlElement(introspectedTable, updateEle, id, false);
        }

        return updateEle;
    }
private XmlElement generateSqlMapLogicalDelete(IntrospectedTable introspectedTable, String id, IntrospectedColumn logicalDeleteColumn, String logicalDeleteValue, boolean byExample) {
        XmlElement updateEle = new XmlElement("update");

        updateEle.addAttribute(new Attribute("id", id));
        updateEle.addAttribute(new Attribute("parameterType", "map"));
        commentGenerator.addComment(updateEle);

        updateEle.addElement(new TextElement("update " + introspectedTable.getAliasedFullyQualifiedTableNameAtRuntime()));

        StringBuilder sb = new StringBuilder("set ");
        // 版本自增
        if (this.customizedNextVersion) {
            sb.append(MyBatis3FormattingUtilities.getEscapedColumnName(this.versionColumn));
            sb.append(" = ");
            sb.append("#{nextVersion,jdbcType=");
            sb.append(this.versionColumn.getJdbcTypeName());
            if (StringUtility.stringHasValue(this.versionColumn.getTypeHandler())) {
                sb.append(",typeHandler=");
                sb.append(this.versionColumn.getTypeHandler());
            }
            sb.append("}");
        } else {
            sb.append(MyBatis3FormattingUtilities.getEscapedColumnName(this.versionColumn));
            sb.append(" = ");
            sb.append(MyBatis3FormattingUtilities.getEscapedColumnName(this.versionColumn));
            sb.append(" + 1");
        }
        sb.append(",");

        // 逻辑删除 set
        sb.append(logicalDeleteColumn.getActualColumnName());
        sb.append(" = ");
        sb.append(XmlElementGeneratorTools.generateLogicalDeleteColumnValue(logicalDeleteColumn, logicalDeleteValue));
        updateEle.addElement(new TextElement(sb.toString()));

        // 更新条件
        if (byExample) {
            XmlElement ifElement = new XmlElement("if");
            ifElement.addAttribute(new Attribute("test", "_parameter != null"));

            XmlElement includeElement = new XmlElement("include");
            includeElement.addAttribute(new Attribute("refid", SQL_UPDATE_BY_EXAMPLE_WITH_VERSION_WHERE_CLAUSE));
            ifElement.addElement(includeElement);

            updateEle.addElement(ifElement);
        } else {
            updateEle = this.replacePrimaryKeyXmlElement(introspectedTable, updateEle, id, false);
        }

        return updateEle;
    }
private XmlElement generateSqlMapLogicalDelete ( IntrospectedTable introspectedTable , String id , IntrospectedColumn logicalDeleteColumn , String logicalDeleteValue , boolean byExample ) { XmlElement updateEle = new XmlElement ( "update" ) ; updateEle . addAttribute ( new Attribute ( "id" , id ) ) ; updateEle . addAttribute ( new Attribute ( "parameterType" , "map" ) ) ; commentGenerator . addComment ( updateEle ) ; updateEle . addElement ( new TextElement ( "update " + introspectedTable . getAliasedFullyQualifiedTableNameAtRuntime ( ) ) ) ; StringBuilder sb = new StringBuilder ( "set " ) ; // 版本自增 if ( this . customizedNextVersion ) { sb . append ( MyBatis3FormattingUtilities . getEscapedColumnName ( this . versionColumn ) ) ; sb . append ( " = " ) ; sb . append ( "#{nextVersion,jdbcType=" ) ; sb . append ( this . versionColumn . getJdbcTypeName ( ) ) ; if ( StringUtility . stringHasValue ( this . versionColumn . getTypeHandler ( ) ) ) { sb . append ( ",typeHandler=" ) ; sb . append ( this . versionColumn . getTypeHandler ( ) ) ; } sb . append ( "}" ) ; } else { sb . append ( MyBatis3FormattingUtilities . getEscapedColumnName ( this . versionColumn ) ) ; sb . append ( " = " ) ; sb . append ( MyBatis3FormattingUtilities . getEscapedColumnName ( this . versionColumn ) ) ; sb . append ( " + 1" ) ; } sb . append ( "," ) ; // 逻辑删除 set sb . append ( logicalDeleteColumn . getActualColumnName ( ) ) ; sb . append ( " = " ) ; sb . append ( XmlElementGeneratorTools . generateLogicalDeleteColumnValue ( logicalDeleteColumn , logicalDeleteValue ) ) ; updateEle . addElement ( new TextElement ( sb . toString ( ) ) ) ; // 更新条件 if ( byExample ) { XmlElement ifElement = new XmlElement ( "if" ) ; ifElement . addAttribute ( new Attribute ( "test" , "_parameter != null" ) ) ; XmlElement includeElement = new XmlElement ( "include" ) ; includeElement . addAttribute ( new Attribute ( "refid" , SQL_UPDATE_BY_EXAMPLE_WITH_VERSION_WHERE_CLAUSE ) ) ; ifElement . addElement ( includeElement ) ; updateEle . addElement ( ifElement ) ; } else { updateEle = this . replacePrimaryKeyXmlElement ( introspectedTable , updateEle , id , false ) ; } return updateEle ; }
生成LogicalDelete sql map
@param introspectedTable
@param id
@param logicalDeleteColumn
@param logicalDeleteValue
@param byExample
@return
生成LogicalDelete sql map